@domql/element 2.5.185 → 2.5.186
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 +11 -11
- package/dist/cjs/create.js +11 -11
- package/dist/cjs/extend.js +1 -1
- package/dist/cjs/iterate.js +2 -2
- package/dist/cjs/methods/index.js +1 -1
- package/dist/cjs/methods/set.js +24 -24
- package/dist/cjs/mixins/attr.js +1 -1
- package/dist/cjs/mixins/content.js +1 -1
- package/dist/cjs/mixins/index.js +11 -11
- package/dist/cjs/mixins/registry.js +9 -9
- package/dist/cjs/mixins/text.js +1 -1
- package/dist/cjs/node.js +6 -6
- package/dist/cjs/props/create.js +2 -2
- package/dist/cjs/props/index.js +4 -4
- package/dist/cjs/props/update.js +2 -2
- package/dist/cjs/set.js +4 -4
- package/dist/cjs/update.js +8 -8
- package/dist/cjs/utils/component.js +1 -1
- package/dist/cjs/utils/index.js +3 -3
- package/dist/cjs/utils/object.js +1 -1
- package/dist/esm/cache/index.js +4 -0
- package/dist/esm/cache/options.js +6 -0
- package/dist/esm/create.js +334 -0
- package/dist/esm/define.js +14 -0
- package/dist/esm/extend.js +71 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/iterate.js +112 -0
- package/dist/esm/methods/index.js +333 -0
- package/dist/esm/methods/set.js +61 -0
- package/dist/esm/methods/v2.js +89 -0
- package/dist/esm/mixins/attr.js +26 -0
- package/dist/esm/mixins/classList.js +55 -0
- package/dist/esm/mixins/content.js +54 -0
- package/dist/esm/mixins/data.js +22 -0
- package/dist/esm/mixins/html.js +18 -0
- package/dist/esm/mixins/index.js +23 -0
- package/dist/esm/mixins/registry.js +105 -0
- package/dist/esm/mixins/scope.js +18 -0
- package/dist/esm/mixins/state.js +19 -0
- package/dist/esm/mixins/style.js +15 -0
- package/dist/esm/mixins/text.js +28 -0
- package/dist/esm/node.js +69 -0
- package/dist/esm/props/create.js +78 -0
- package/dist/esm/props/ignore.js +4 -0
- package/dist/esm/props/index.js +4 -0
- package/dist/esm/props/inherit.js +33 -0
- package/dist/esm/props/update.js +17 -0
- package/dist/esm/set.js +73 -0
- package/dist/esm/tree.js +11 -0
- package/dist/esm/update.js +255 -0
- package/dist/esm/utils/applyParam.js +25 -0
- package/dist/esm/utils/component.js +65 -0
- package/dist/esm/utils/extendUtils.js +122 -0
- package/dist/esm/utils/index.js +3 -0
- package/dist/esm/utils/object.js +159 -0
- package/dist/esm/utils/onlyResolveExtends.js +81 -0
- package/dist/esm/utils/propEvents.js +21 -0
- package/extend.js +1 -1
- package/iterate.js +2 -2
- package/methods/index.js +1 -1
- package/methods/set.js +18 -19
- package/mixins/attr.js +1 -1
- package/mixins/content.js +1 -1
- package/mixins/index.js +11 -11
- package/mixins/registry.js +9 -9
- package/mixins/text.js +1 -1
- package/node.js +6 -6
- package/package.json +6 -6
- package/props/create.js +2 -2
- package/props/index.js +4 -4
- package/props/update.js +2 -2
- package/set.js +4 -4
- package/update.js +8 -8
- package/utils/component.js +1 -1
- package/utils/index.js +3 -3
- package/utils/object.js +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { exec, isFunction, isObject, isUndefined } from "@domql/utils";
|
|
2
|
+
import { create } from "..";
|
|
3
|
+
import { REGISTRY } from "../mixins/index.js";
|
|
4
|
+
import { applyVariant, isVariant } from ".";
|
|
5
|
+
import { isMethod } from "../methods";
|
|
6
|
+
import { addMethods } from "../methods/set";
|
|
7
|
+
import { createState } from "@domql/state";
|
|
8
|
+
import { detectTag } from "@domql/render";
|
|
9
|
+
import { createProps } from "../props";
|
|
10
|
+
import { throughInitialDefine, throughInitialExec } from "../iterate";
|
|
11
|
+
const onlyResolveExtends = (element, parent, key, options) => {
|
|
12
|
+
const { __ref } = element;
|
|
13
|
+
element.tag = detectTag(element);
|
|
14
|
+
{
|
|
15
|
+
const { __ref: ref2 } = element;
|
|
16
|
+
if (!ref2.__cached)
|
|
17
|
+
ref2.__cached = {};
|
|
18
|
+
if (!ref2.__defineCache)
|
|
19
|
+
ref2.__defineCache = {};
|
|
20
|
+
if (!ref2.__exec)
|
|
21
|
+
ref2.__exec = {};
|
|
22
|
+
if (!ref2.__execProps)
|
|
23
|
+
ref2.__execProps = {};
|
|
24
|
+
if (!ref2.__class)
|
|
25
|
+
ref2.__class = {};
|
|
26
|
+
if (!ref2.__classNames)
|
|
27
|
+
ref2.__classNames = {};
|
|
28
|
+
if (!ref2.__attr)
|
|
29
|
+
ref2.__attr = {};
|
|
30
|
+
if (!ref2.__changes)
|
|
31
|
+
ref2.__changes = [];
|
|
32
|
+
if (!ref2.__children)
|
|
33
|
+
ref2.__children = [];
|
|
34
|
+
}
|
|
35
|
+
addMethods(element, parent, options);
|
|
36
|
+
createState(element, parent);
|
|
37
|
+
const ref = __ref;
|
|
38
|
+
if (isFunction(element.if)) {
|
|
39
|
+
const ifPassed = element.if(element, element.state, element.context);
|
|
40
|
+
if (!ifPassed) {
|
|
41
|
+
delete ref.__if;
|
|
42
|
+
} else
|
|
43
|
+
ref.__if = true;
|
|
44
|
+
} else
|
|
45
|
+
ref.__if = true;
|
|
46
|
+
if (element.node && ref.__if) {
|
|
47
|
+
parent[key || element.key] = element;
|
|
48
|
+
}
|
|
49
|
+
createProps(element, parent, options);
|
|
50
|
+
applyVariant(element, parent);
|
|
51
|
+
if (element.tag !== "string" && element.tag !== "fragment") {
|
|
52
|
+
throughInitialDefine(element);
|
|
53
|
+
throughInitialExec(element);
|
|
54
|
+
for (const param in element) {
|
|
55
|
+
const prop = element[param];
|
|
56
|
+
if (isUndefined(prop) || isMethod(param, element) || isObject(REGISTRY[param]) || isVariant(param))
|
|
57
|
+
continue;
|
|
58
|
+
const hasDefine = element.define && element.define[param];
|
|
59
|
+
const contextHasDefine = element.context && element.context.define && element.context.define[param];
|
|
60
|
+
const optionsHasDefine = options.define && options.define[param];
|
|
61
|
+
if (REGISTRY[param] && !optionsHasDefine) {
|
|
62
|
+
continue;
|
|
63
|
+
} else if (element[param] && !hasDefine && !optionsHasDefine && !contextHasDefine) {
|
|
64
|
+
create(exec(prop, element), element, param, options);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
parent[key || element.key] = element;
|
|
69
|
+
delete element.update;
|
|
70
|
+
delete element.__element;
|
|
71
|
+
if (element.props) {
|
|
72
|
+
delete element.props.update;
|
|
73
|
+
delete element.props.__element;
|
|
74
|
+
}
|
|
75
|
+
if (!options.keepRef)
|
|
76
|
+
delete element.__ref;
|
|
77
|
+
return element;
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
onlyResolveExtends
|
|
81
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isFunction, lowercaseFirstLetter } from "@domql/utils";
|
|
2
|
+
const propagateEventsFromProps = (element) => {
|
|
3
|
+
const { props, on } = element;
|
|
4
|
+
const eventKeysFromProps = Object.keys(props).filter((key) => key.startsWith("on"));
|
|
5
|
+
eventKeysFromProps.forEach((v) => {
|
|
6
|
+
const eventName = lowercaseFirstLetter(v.split("on")[1]);
|
|
7
|
+
const origEvent = on[eventName];
|
|
8
|
+
const funcFromProps = props[v];
|
|
9
|
+
if (isFunction(origEvent)) {
|
|
10
|
+
on[eventName] = (...args) => {
|
|
11
|
+
const originalEventRetunrs = origEvent(...args);
|
|
12
|
+
if (originalEventRetunrs !== false)
|
|
13
|
+
funcFromProps(...args);
|
|
14
|
+
};
|
|
15
|
+
} else
|
|
16
|
+
on[eventName] = funcFromProps;
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
propagateEventsFromProps
|
|
21
|
+
};
|
package/extend.js
CHANGED
package/iterate.js
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
isVariant
|
|
12
12
|
} from '@domql/utils'
|
|
13
13
|
|
|
14
|
-
import { METHODS_EXL, overwrite } from './utils'
|
|
15
|
-
import { isMethod } from './methods'
|
|
14
|
+
import { METHODS_EXL, overwrite } from './utils/index.js'
|
|
15
|
+
import { isMethod } from './methods/index.js'
|
|
16
16
|
|
|
17
17
|
export const throughInitialExec = (element, exclude = {}) => {
|
|
18
18
|
const { __ref: ref } = element
|
package/methods/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { triggerEventOn } from '@domql/event'
|
|
4
4
|
import { isDefined, isObject, isFunction, isObjectLike, isProduction, removeValueFromArray, deepClone } from '@domql/utils'
|
|
5
|
-
import { TREE } from '../tree'
|
|
5
|
+
import { TREE } from '../tree.js'
|
|
6
6
|
import { parseFilters, REGISTRY } from '../mixins/index.js'
|
|
7
7
|
const ENV = process.env.NODE_ENV
|
|
8
8
|
|
package/methods/set.js
CHANGED
|
@@ -2,33 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
import { merge, overwrite } from '@domql/utils'
|
|
4
4
|
|
|
5
|
-
import { set, reset } from '../set'
|
|
6
|
-
import { update } from '../update'
|
|
5
|
+
import { set, reset } from '../set.js'
|
|
6
|
+
import { update } from '../update.js'
|
|
7
7
|
|
|
8
|
+
import { removeContent, updateContent } from '../mixins/content.js'
|
|
8
9
|
import {
|
|
9
|
-
|
|
10
|
+
call,
|
|
11
|
+
error,
|
|
12
|
+
getPath,
|
|
13
|
+
getRef,
|
|
14
|
+
keys,
|
|
15
|
+
log,
|
|
10
16
|
lookdown,
|
|
11
17
|
lookdownAll,
|
|
12
|
-
|
|
13
|
-
|
|
18
|
+
lookup,
|
|
19
|
+
nextElement,
|
|
20
|
+
parse,
|
|
21
|
+
parseDeep,
|
|
22
|
+
previousElement,
|
|
23
|
+
remove,
|
|
14
24
|
setNodeStyles,
|
|
15
25
|
setProps,
|
|
16
|
-
remove,
|
|
17
26
|
spotByPath,
|
|
18
|
-
log,
|
|
19
|
-
verbose,
|
|
20
|
-
warn,
|
|
21
|
-
error,
|
|
22
27
|
variables,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
nextElement,
|
|
27
|
-
previousElement,
|
|
28
|
-
call
|
|
29
|
-
} from './'
|
|
30
|
-
|
|
31
|
-
import { removeContent, updateContent } from '../mixins/content'
|
|
28
|
+
verbose,
|
|
29
|
+
warn
|
|
30
|
+
} from './index.js'
|
|
32
31
|
|
|
33
32
|
export const addMethods = (element, parent, options = {}) => {
|
|
34
33
|
const proto = {
|
package/mixins/attr.js
CHANGED
package/mixins/content.js
CHANGED
package/mixins/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { attr } from './attr'
|
|
4
|
-
import { applyClasslist } from './classList'
|
|
5
|
-
import { setContent } from './content'
|
|
6
|
-
import { data } from './data'
|
|
7
|
-
import { html } from './html'
|
|
8
|
-
import { style } from './style'
|
|
9
|
-
import { text } from './text'
|
|
10
|
-
import { state } from './state'
|
|
11
|
-
import { scope } from './scope'
|
|
12
|
-
import { REGISTRY } from './registry'
|
|
3
|
+
import { attr } from './attr.js'
|
|
4
|
+
import { applyClasslist } from './classList.js'
|
|
5
|
+
import { setContent } from './content.js'
|
|
6
|
+
import { data } from './data.js'
|
|
7
|
+
import { html } from './html.js'
|
|
8
|
+
import { style } from './style.js'
|
|
9
|
+
import { text } from './text.js'
|
|
10
|
+
import { state } from './state.js'
|
|
11
|
+
import { scope } from './scope.js'
|
|
12
|
+
import { REGISTRY } from './registry.js'
|
|
13
13
|
|
|
14
14
|
export { REGISTRY as registry }
|
|
15
15
|
export { applyClasslist as classList }
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
scope
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export * from './registry'
|
|
28
|
+
export * from './registry.js'
|
package/mixins/registry.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import attr from './attr'
|
|
4
|
-
import { classList } from './classList'
|
|
5
|
-
import setContent from './content'
|
|
6
|
-
import data from './data'
|
|
7
|
-
import html from './html'
|
|
8
|
-
import scope from './scope'
|
|
9
|
-
import state from './state'
|
|
10
|
-
import style from './style'
|
|
11
|
-
import text from './text'
|
|
3
|
+
import attr from './attr.js'
|
|
4
|
+
import { classList } from './classList.js'
|
|
5
|
+
import setContent from './content.js'
|
|
6
|
+
import data from './data.js'
|
|
7
|
+
import html from './html.js'
|
|
8
|
+
import scope from './scope.js'
|
|
9
|
+
import state from './state.js'
|
|
10
|
+
import style from './style.js'
|
|
11
|
+
import text from './text.js'
|
|
12
12
|
|
|
13
13
|
export const REGISTRY = {
|
|
14
14
|
attr,
|
package/mixins/text.js
CHANGED
package/node.js
CHANGED
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
import { exec, isFunction, isObject, isUndefined, isVariant } from '@domql/utils'
|
|
4
4
|
import { applyEventsOnNode, triggerEventOn, applyAnimationFrame } from '@domql/event'
|
|
5
5
|
import { cacheNode } from '@domql/render'
|
|
6
|
-
import { isMethod } from './methods'
|
|
6
|
+
import { isMethod } from './methods/index.js'
|
|
7
7
|
|
|
8
|
-
import create from './create'
|
|
8
|
+
import create from './create.js'
|
|
9
9
|
|
|
10
10
|
import {
|
|
11
11
|
throughExecProps,
|
|
12
12
|
throughInitialDefine,
|
|
13
13
|
throughInitialExec
|
|
14
|
-
} from './iterate'
|
|
15
|
-
import { REGISTRY } from './mixins'
|
|
16
|
-
import { applyParam } from './utils/applyParam'
|
|
17
|
-
import { propagateEventsFromProps } from './utils/propEvents'
|
|
14
|
+
} from './iterate.js'
|
|
15
|
+
import { REGISTRY } from './mixins/index.js'
|
|
16
|
+
import { applyParam } from './utils/applyParam.js'
|
|
17
|
+
import { propagateEventsFromProps } from './utils/propEvents.js'
|
|
18
18
|
// import { defineSetter } from './methods'
|
|
19
19
|
|
|
20
20
|
const ENV = process.env.NODE_ENV
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.186",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "index.js",
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
|
|
24
24
|
"build:esm": "npx esbuild *.js **/*.js --target=es2019 --format=esm --outdir=dist/esm",
|
|
25
25
|
"build:cjs": "npx esbuild *.js **/*.js --target=node16 --format=cjs --outdir=dist/cjs",
|
|
26
|
-
"build": "npm run build:cjs",
|
|
26
|
+
"build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
|
|
27
27
|
"prepublish": "rimraf -I dist && npm run build && npm run copy:package:cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/event": "^2.5.
|
|
31
|
-
"@domql/render": "^2.5.
|
|
32
|
-
"@domql/state": "^2.5.
|
|
30
|
+
"@domql/event": "^2.5.186",
|
|
31
|
+
"@domql/render": "^2.5.186",
|
|
32
|
+
"@domql/state": "^2.5.186",
|
|
33
33
|
"@domql/utils": "^2.5.185"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "1fa4d0c2683c11578893632ca11a765c3997685e",
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.12.0"
|
|
38
38
|
}
|
package/props/create.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { exec, isArray, isObject, deepClone, deepMerge } from '@domql/utils'
|
|
4
|
-
import { IGNORE_PROPS_PARAMS } from './ignore'
|
|
4
|
+
import { IGNORE_PROPS_PARAMS } from './ignore.js'
|
|
5
5
|
|
|
6
|
-
import { inheritParentProps } from './inherit'
|
|
6
|
+
import { inheritParentProps } from './inherit.js'
|
|
7
7
|
|
|
8
8
|
const createPropsStack = (element, parent) => {
|
|
9
9
|
const { props, __ref: ref } = element
|
package/props/index.js
CHANGED
package/props/update.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { syncProps } from './create'
|
|
4
|
-
import { inheritParentProps } from './inherit'
|
|
3
|
+
import { syncProps } from './create.js'
|
|
4
|
+
import { inheritParentProps } from './inherit.js'
|
|
5
5
|
|
|
6
6
|
export const updateProps = (newProps, element, parent) => {
|
|
7
7
|
const { __ref } = element
|
package/set.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { deepContains, setContentKey } from '@domql/utils'
|
|
4
4
|
|
|
5
|
-
import { OPTIONS } from './cache/options'
|
|
6
|
-
import { create } from './create'
|
|
7
|
-
import { registry } from './mixins'
|
|
8
|
-
import { removeContent } from './mixins/content'
|
|
5
|
+
import { OPTIONS } from './cache/options.js'
|
|
6
|
+
import { create } from './create.js'
|
|
7
|
+
import { registry } from './mixins/index.js'
|
|
8
|
+
import { removeContent } from './mixins/content.js'
|
|
9
9
|
import { triggerEventOn, triggerEventOnUpdate } from '@domql/event'
|
|
10
10
|
|
|
11
11
|
export const resetElement = (params, element, options) => {
|
package/update.js
CHANGED
|
@@ -17,16 +17,16 @@ import {
|
|
|
17
17
|
} from '@domql/utils'
|
|
18
18
|
|
|
19
19
|
import { applyEvent, triggerEventOn, triggerEventOnUpdate } from '@domql/event'
|
|
20
|
-
import { isMethod } from './methods'
|
|
21
|
-
import { updateProps } from './props'
|
|
20
|
+
import { isMethod } from './methods/index.js'
|
|
21
|
+
import { updateProps } from './props/index.js'
|
|
22
22
|
import { createState, findInheritedState } from '@domql/state'
|
|
23
23
|
|
|
24
|
-
import { create } from './create'
|
|
25
|
-
import { throughExecProps, throughUpdatedDefine, throughUpdatedExec } from './iterate'
|
|
26
|
-
import { REGISTRY } from './mixins'
|
|
27
|
-
import { applyParam } from './utils/applyParam'
|
|
28
|
-
import { OPTIONS } from './cache/options'
|
|
29
|
-
import { METHODS_EXL, deepMerge } from './utils' // old utils (current)
|
|
24
|
+
import { create } from './create.js'
|
|
25
|
+
import { throughExecProps, throughUpdatedDefine, throughUpdatedExec } from './iterate.js'
|
|
26
|
+
import { REGISTRY } from './mixins/index.js'
|
|
27
|
+
import { applyParam } from './utils/applyParam.js'
|
|
28
|
+
import { OPTIONS } from './cache/options.js'
|
|
29
|
+
import { METHODS_EXL, deepMerge } from './utils/index.js' // old utils (current)
|
|
30
30
|
|
|
31
31
|
const snapshot = {
|
|
32
32
|
snapshotId: createSnapshotId
|
package/utils/component.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isVariant
|
|
11
11
|
} from '@domql/utils'
|
|
12
12
|
|
|
13
|
-
import { applyExtend } from '../extend'
|
|
13
|
+
import { applyExtend } from '../extend.js'
|
|
14
14
|
import { REGISTRY } from '../mixins/index.js'
|
|
15
15
|
|
|
16
16
|
export const createValidDomqlObjectFromSugar = (el, parent, key, options) => {
|
package/utils/index.js
CHANGED
package/utils/object.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
import { isArray, isObject, isObjectLike, joinArrays, deepClone } from '@domql/utils'
|
|
4
|
-
import { IGNORE_PROPS_PARAMS } from '../props'
|
|
4
|
+
import { IGNORE_PROPS_PARAMS } from '../props/index.js'
|
|
5
5
|
|
|
6
6
|
// breaks server build
|
|
7
7
|
// import { IGNORE_STATE_PARAMS } from '@domql/state'
|