@domql/element 3.6.1 → 3.6.3
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/mixins/registry.js +2 -0
- package/dist/cjs/set.js +17 -5
- package/dist/esm/mixins/registry.js +2 -0
- package/dist/esm/set.js +17 -5
- package/dist/iife/index.js +47 -11
- package/mixins/registry.js +2 -0
- package/package.json +5 -5
- package/set.js +24 -5
package/dist/cjs/set.js
CHANGED
|
@@ -105,6 +105,16 @@ const removeContent = function(el, opts = {}) {
|
|
|
105
105
|
};
|
|
106
106
|
const set = function(params, options = {}, el) {
|
|
107
107
|
const element = el || this;
|
|
108
|
+
const { __ref: ref } = element;
|
|
109
|
+
if (ref.__settingContent) return element;
|
|
110
|
+
ref.__settingContent = true;
|
|
111
|
+
try {
|
|
112
|
+
return _setInner(params, options, element);
|
|
113
|
+
} finally {
|
|
114
|
+
ref.__settingContent = false;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const _setInner = function(params, options, element) {
|
|
108
118
|
const { __ref: ref } = element;
|
|
109
119
|
const contentElementKey = setContentKey(element, options);
|
|
110
120
|
const content = element[contentElementKey];
|
|
@@ -134,14 +144,16 @@ const set = function(params, options = {}, el) {
|
|
|
134
144
|
let { childExtends, props, tag } = params;
|
|
135
145
|
if (!props) props = params.props = {};
|
|
136
146
|
if (tag === "fragment") {
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
const elementChildExtends = element.childExtends || element.childExtend;
|
|
148
|
+
if (!childExtends && elementChildExtends) {
|
|
149
|
+
params.childExtends = elementChildExtends;
|
|
139
150
|
props.ignoreChildExtends = true;
|
|
140
151
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
props.
|
|
152
|
+
const elementChildProps = element.childProps || element.props?.childProps;
|
|
153
|
+
if (!props?.childProps && elementChildProps) {
|
|
154
|
+
props.childProps = elementChildProps;
|
|
144
155
|
}
|
|
156
|
+
props.ignoreChildProps = true;
|
|
145
157
|
}
|
|
146
158
|
if (lazyLoad) {
|
|
147
159
|
window.requestAnimationFrame(() => {
|
package/dist/esm/set.js
CHANGED
|
@@ -75,6 +75,16 @@ const removeContent = function(el, opts = {}) {
|
|
|
75
75
|
};
|
|
76
76
|
const set = function(params, options = {}, el) {
|
|
77
77
|
const element = el || this;
|
|
78
|
+
const { __ref: ref } = element;
|
|
79
|
+
if (ref.__settingContent) return element;
|
|
80
|
+
ref.__settingContent = true;
|
|
81
|
+
try {
|
|
82
|
+
return _setInner(params, options, element);
|
|
83
|
+
} finally {
|
|
84
|
+
ref.__settingContent = false;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const _setInner = function(params, options, element) {
|
|
78
88
|
const { __ref: ref } = element;
|
|
79
89
|
const contentElementKey = setContentKey(element, options);
|
|
80
90
|
const content = element[contentElementKey];
|
|
@@ -104,14 +114,16 @@ const set = function(params, options = {}, el) {
|
|
|
104
114
|
let { childExtends, props, tag } = params;
|
|
105
115
|
if (!props) props = params.props = {};
|
|
106
116
|
if (tag === "fragment") {
|
|
107
|
-
|
|
108
|
-
|
|
117
|
+
const elementChildExtends = element.childExtends || element.childExtend;
|
|
118
|
+
if (!childExtends && elementChildExtends) {
|
|
119
|
+
params.childExtends = elementChildExtends;
|
|
109
120
|
props.ignoreChildExtends = true;
|
|
110
121
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
props.
|
|
122
|
+
const elementChildProps = element.childProps || element.props?.childProps;
|
|
123
|
+
if (!props?.childProps && elementChildProps) {
|
|
124
|
+
props.childProps = elementChildProps;
|
|
114
125
|
}
|
|
126
|
+
props.ignoreChildProps = true;
|
|
115
127
|
}
|
|
116
128
|
if (lazyLoad) {
|
|
117
129
|
window.requestAnimationFrame(() => {
|
package/dist/iife/index.js
CHANGED
|
@@ -1180,6 +1180,7 @@ var DomqlElement = (() => {
|
|
|
1180
1180
|
// ../utils/dist/esm/props.js
|
|
1181
1181
|
var RE_UPPER = /^[A-Z]/;
|
|
1182
1182
|
var RE_DIGITS = /^\d+$/;
|
|
1183
|
+
var CSS_SELECTOR_PREFIXES = /* @__PURE__ */ new Set([":", "@", "[", "*", "+", "~", "&", ">", "$", "-", ".", "!"]);
|
|
1183
1184
|
var ELEMENT_INDICATOR_KEYS = /* @__PURE__ */ new Set([
|
|
1184
1185
|
"extend",
|
|
1185
1186
|
"props",
|
|
@@ -1226,11 +1227,27 @@ var DomqlElement = (() => {
|
|
|
1226
1227
|
delete obj[key];
|
|
1227
1228
|
continue;
|
|
1228
1229
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1230
|
+
if (key === "childProps") {
|
|
1231
|
+
obj.props[key] = value;
|
|
1232
|
+
delete obj[key];
|
|
1233
|
+
cachedKeys.push(key);
|
|
1234
|
+
continue;
|
|
1235
|
+
}
|
|
1236
|
+
const defineValue = this.define?.[key];
|
|
1237
|
+
const globalDefineValue = this.context?.define?.[key];
|
|
1238
|
+
const hasDefine = isObject(defineValue) || isFunction(defineValue);
|
|
1239
|
+
const hasGlobalDefine = isObject(globalDefineValue) || isFunction(globalDefineValue);
|
|
1240
|
+
if (hasDefine || hasGlobalDefine) continue;
|
|
1241
|
+
const firstChar = key.charAt(0);
|
|
1242
|
+
if (CSS_SELECTOR_PREFIXES.has(firstChar)) {
|
|
1243
|
+
obj.props[key] = value;
|
|
1244
|
+
delete obj[key];
|
|
1245
|
+
cachedKeys.push(key);
|
|
1246
|
+
continue;
|
|
1247
|
+
}
|
|
1231
1248
|
const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key) || looksLikeElement(value);
|
|
1232
1249
|
const isBuiltin = DOMQ_PROPERTIES.has(key);
|
|
1233
|
-
if (!isElement && !isBuiltin
|
|
1250
|
+
if (!isElement && !isBuiltin) {
|
|
1234
1251
|
obj.props[key] = value;
|
|
1235
1252
|
delete obj[key];
|
|
1236
1253
|
cachedKeys.push(key);
|
|
@@ -1250,8 +1267,13 @@ var DomqlElement = (() => {
|
|
|
1250
1267
|
continue;
|
|
1251
1268
|
}
|
|
1252
1269
|
if (cachedKeys.includes(key)) continue;
|
|
1253
|
-
|
|
1254
|
-
const
|
|
1270
|
+
if (key === "childProps") continue;
|
|
1271
|
+
const firstChar = key.charAt(0);
|
|
1272
|
+
if (CSS_SELECTOR_PREFIXES.has(firstChar)) continue;
|
|
1273
|
+
const defineValue = this.define?.[key];
|
|
1274
|
+
const globalDefineValue = this.context?.define?.[key];
|
|
1275
|
+
const hasDefine = isObject(defineValue) || isFunction(defineValue);
|
|
1276
|
+
const hasGlobalDefine = isObject(globalDefineValue) || isFunction(globalDefineValue);
|
|
1255
1277
|
const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key);
|
|
1256
1278
|
const isBuiltin = DOMQ_PROPERTIES.has(key);
|
|
1257
1279
|
if (isElement || isBuiltin || hasDefine || hasGlobalDefine) {
|
|
@@ -1286,7 +1308,7 @@ var DomqlElement = (() => {
|
|
|
1286
1308
|
const parentProps = parent.props;
|
|
1287
1309
|
if (!parentProps) return propsStack;
|
|
1288
1310
|
const matchParentKeyProps = parentProps[element.key];
|
|
1289
|
-
const matchParentChildProps = parentProps.childProps;
|
|
1311
|
+
const matchParentChildProps = parentProps.childProps || parent.childProps;
|
|
1290
1312
|
const ignoreChildProps = element.props?.ignoreChildProps;
|
|
1291
1313
|
if (matchParentChildProps && !ignoreChildProps) {
|
|
1292
1314
|
const childProps = objectizeStringProperty(matchParentChildProps);
|
|
@@ -2721,7 +2743,9 @@ ${element}` : "";
|
|
|
2721
2743
|
extends: {},
|
|
2722
2744
|
children: {},
|
|
2723
2745
|
content: {},
|
|
2746
|
+
childExtend: {},
|
|
2724
2747
|
childExtends: {},
|
|
2748
|
+
childExtendRecursive: {},
|
|
2725
2749
|
childExtendsRecursive: {},
|
|
2726
2750
|
props: {},
|
|
2727
2751
|
if: {},
|
|
@@ -2935,6 +2959,16 @@ ${element}` : "";
|
|
|
2935
2959
|
};
|
|
2936
2960
|
var set = function(params, options = {}, el) {
|
|
2937
2961
|
const element = el || this;
|
|
2962
|
+
const { __ref: ref } = element;
|
|
2963
|
+
if (ref.__settingContent) return element;
|
|
2964
|
+
ref.__settingContent = true;
|
|
2965
|
+
try {
|
|
2966
|
+
return _setInner(params, options, element);
|
|
2967
|
+
} finally {
|
|
2968
|
+
ref.__settingContent = false;
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2971
|
+
var _setInner = function(params, options, element) {
|
|
2938
2972
|
const { __ref: ref } = element;
|
|
2939
2973
|
const contentElementKey = setContentKey(element, options);
|
|
2940
2974
|
const content = element[contentElementKey];
|
|
@@ -2964,14 +2998,16 @@ ${element}` : "";
|
|
|
2964
2998
|
let { childExtends, props, tag } = params;
|
|
2965
2999
|
if (!props) props = params.props = {};
|
|
2966
3000
|
if (tag === "fragment") {
|
|
2967
|
-
|
|
2968
|
-
|
|
3001
|
+
const elementChildExtends = element.childExtends || element.childExtend;
|
|
3002
|
+
if (!childExtends && elementChildExtends) {
|
|
3003
|
+
params.childExtends = elementChildExtends;
|
|
2969
3004
|
props.ignoreChildExtends = true;
|
|
2970
3005
|
}
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
props.
|
|
3006
|
+
const elementChildProps = element.childProps || element.props?.childProps;
|
|
3007
|
+
if (!props?.childProps && elementChildProps) {
|
|
3008
|
+
props.childProps = elementChildProps;
|
|
2974
3009
|
}
|
|
3010
|
+
props.ignoreChildProps = true;
|
|
2975
3011
|
}
|
|
2976
3012
|
if (lazyLoad) {
|
|
2977
3013
|
window.requestAnimationFrame(() => {
|
package/mixins/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/element",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.3",
|
|
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.3",
|
|
50
|
+
"@domql/state": "^3.6.3",
|
|
51
|
+
"@domql/utils": "^3.6.3",
|
|
52
|
+
"attrs-in-props": "^3.6.3"
|
|
53
53
|
},
|
|
54
54
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
55
55
|
"devDependencies": {
|
package/set.js
CHANGED
|
@@ -98,6 +98,20 @@ export const set = function (params, options = {}, el) {
|
|
|
98
98
|
const element = el || this
|
|
99
99
|
const { __ref: ref } = element
|
|
100
100
|
|
|
101
|
+
// Guard against infinite set loops
|
|
102
|
+
if (ref.__settingContent) return element
|
|
103
|
+
ref.__settingContent = true
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
return _setInner(params, options, element)
|
|
107
|
+
} finally {
|
|
108
|
+
ref.__settingContent = false
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const _setInner = function (params, options, element) {
|
|
113
|
+
const { __ref: ref } = element
|
|
114
|
+
|
|
101
115
|
const contentElementKey = setContentKey(element, options)
|
|
102
116
|
const content = element[contentElementKey]
|
|
103
117
|
const __contentRef = content && content.__ref
|
|
@@ -136,15 +150,20 @@ export const set = function (params, options = {}, el) {
|
|
|
136
150
|
if (!props) props = params.props = {}
|
|
137
151
|
|
|
138
152
|
if (tag === 'fragment') {
|
|
139
|
-
|
|
140
|
-
|
|
153
|
+
const elementChildExtends = element.childExtends || element.childExtend
|
|
154
|
+
if (!childExtends && elementChildExtends) {
|
|
155
|
+
params.childExtends = elementChildExtends
|
|
141
156
|
props.ignoreChildExtends = true
|
|
142
157
|
}
|
|
143
158
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
props.
|
|
159
|
+
const elementChildProps = element.childProps || element.props?.childProps
|
|
160
|
+
if (!props?.childProps && elementChildProps) {
|
|
161
|
+
props.childProps = elementChildProps
|
|
147
162
|
}
|
|
163
|
+
|
|
164
|
+
// Prevent the fragment from inheriting parent's childProps via inheritParentProps
|
|
165
|
+
// (childProps is already forwarded explicitly above for the fragment's children)
|
|
166
|
+
props.ignoreChildProps = true
|
|
148
167
|
}
|
|
149
168
|
|
|
150
169
|
if (lazyLoad) {
|