domql 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.
Files changed (2) hide show
  1. package/dist/iife/index.js +47 -11
  2. package/package.json +4 -4
@@ -1159,6 +1159,7 @@ var Domql = (() => {
1159
1159
  // ../utils/dist/esm/props.js
1160
1160
  var RE_UPPER = /^[A-Z]/;
1161
1161
  var RE_DIGITS = /^\d+$/;
1162
+ var CSS_SELECTOR_PREFIXES = /* @__PURE__ */ new Set([":", "@", "[", "*", "+", "~", "&", ">", "$", "-", ".", "!"]);
1162
1163
  var ELEMENT_INDICATOR_KEYS = /* @__PURE__ */ new Set([
1163
1164
  "extend",
1164
1165
  "props",
@@ -1205,11 +1206,27 @@ var Domql = (() => {
1205
1206
  delete obj[key];
1206
1207
  continue;
1207
1208
  }
1208
- const hasDefine = isObject(this.define?.[key]);
1209
- const hasGlobalDefine = isObject(this.context?.define?.[key]);
1209
+ if (key === "childProps") {
1210
+ obj.props[key] = value;
1211
+ delete obj[key];
1212
+ cachedKeys.push(key);
1213
+ continue;
1214
+ }
1215
+ const defineValue = this.define?.[key];
1216
+ const globalDefineValue = this.context?.define?.[key];
1217
+ const hasDefine = isObject(defineValue) || isFunction(defineValue);
1218
+ const hasGlobalDefine = isObject(globalDefineValue) || isFunction(globalDefineValue);
1219
+ if (hasDefine || hasGlobalDefine) continue;
1220
+ const firstChar = key.charAt(0);
1221
+ if (CSS_SELECTOR_PREFIXES.has(firstChar)) {
1222
+ obj.props[key] = value;
1223
+ delete obj[key];
1224
+ cachedKeys.push(key);
1225
+ continue;
1226
+ }
1210
1227
  const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key) || looksLikeElement(value);
1211
1228
  const isBuiltin = DOMQ_PROPERTIES.has(key);
1212
- if (!isElement && !isBuiltin && !hasDefine && !hasGlobalDefine) {
1229
+ if (!isElement && !isBuiltin) {
1213
1230
  obj.props[key] = value;
1214
1231
  delete obj[key];
1215
1232
  cachedKeys.push(key);
@@ -1229,8 +1246,13 @@ var Domql = (() => {
1229
1246
  continue;
1230
1247
  }
1231
1248
  if (cachedKeys.includes(key)) continue;
1232
- const hasDefine = isObject(this.define?.[key]);
1233
- const hasGlobalDefine = isObject(this.context?.define?.[key]);
1249
+ if (key === "childProps") continue;
1250
+ const firstChar = key.charAt(0);
1251
+ if (CSS_SELECTOR_PREFIXES.has(firstChar)) continue;
1252
+ const defineValue = this.define?.[key];
1253
+ const globalDefineValue = this.context?.define?.[key];
1254
+ const hasDefine = isObject(defineValue) || isFunction(defineValue);
1255
+ const hasGlobalDefine = isObject(globalDefineValue) || isFunction(globalDefineValue);
1234
1256
  const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key);
1235
1257
  const isBuiltin = DOMQ_PROPERTIES.has(key);
1236
1258
  if (isElement || isBuiltin || hasDefine || hasGlobalDefine) {
@@ -1265,7 +1287,7 @@ var Domql = (() => {
1265
1287
  const parentProps = parent.props;
1266
1288
  if (!parentProps) return propsStack;
1267
1289
  const matchParentKeyProps = parentProps[element.key];
1268
- const matchParentChildProps = parentProps.childProps;
1290
+ const matchParentChildProps = parentProps.childProps || parent.childProps;
1269
1291
  const ignoreChildProps = element.props?.ignoreChildProps;
1270
1292
  if (matchParentChildProps && !ignoreChildProps) {
1271
1293
  const childProps = objectizeStringProperty(matchParentChildProps);
@@ -2695,7 +2717,9 @@ ${element}` : "";
2695
2717
  extends: {},
2696
2718
  children: {},
2697
2719
  content: {},
2720
+ childExtend: {},
2698
2721
  childExtends: {},
2722
+ childExtendRecursive: {},
2699
2723
  childExtendsRecursive: {},
2700
2724
  props: {},
2701
2725
  if: {},
@@ -2909,6 +2933,16 @@ ${element}` : "";
2909
2933
  };
2910
2934
  var set = function(params, options = {}, el) {
2911
2935
  const element = el || this;
2936
+ const { __ref: ref } = element;
2937
+ if (ref.__settingContent) return element;
2938
+ ref.__settingContent = true;
2939
+ try {
2940
+ return _setInner(params, options, element);
2941
+ } finally {
2942
+ ref.__settingContent = false;
2943
+ }
2944
+ };
2945
+ var _setInner = function(params, options, element) {
2912
2946
  const { __ref: ref } = element;
2913
2947
  const contentElementKey = setContentKey(element, options);
2914
2948
  const content = element[contentElementKey];
@@ -2938,14 +2972,16 @@ ${element}` : "";
2938
2972
  let { childExtends, props, tag } = params;
2939
2973
  if (!props) props = params.props = {};
2940
2974
  if (tag === "fragment") {
2941
- if (!childExtends && element.childExtends) {
2942
- params.childExtends = element.childExtends;
2975
+ const elementChildExtends = element.childExtends || element.childExtend;
2976
+ if (!childExtends && elementChildExtends) {
2977
+ params.childExtends = elementChildExtends;
2943
2978
  props.ignoreChildExtends = true;
2944
2979
  }
2945
- if (!props?.childProps && element.props?.childProps) {
2946
- props.childProps = element.props.childProps;
2947
- props.ignoreChildProps = true;
2980
+ const elementChildProps = element.childProps || element.props?.childProps;
2981
+ if (!props?.childProps && elementChildProps) {
2982
+ props.childProps = elementChildProps;
2948
2983
  }
2984
+ props.ignoreChildProps = true;
2949
2985
  }
2950
2986
  if (lazyLoad) {
2951
2987
  window.requestAnimationFrame(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "domql",
3
- "version": "3.6.1",
3
+ "version": "3.6.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -25,9 +25,9 @@
25
25
  "build:iife": "cross-env NODE_ENV=$NODE_ENV esbuild index.js --bundle --target=es2020 --format=iife --global-name=Domql --outfile=dist/iife/index.js --define:process.env.NODE_ENV=process.env.NODE_ENV"
26
26
  },
27
27
  "dependencies": {
28
- "@domql/element": "^3.6.1",
29
- "@domql/state": "^3.6.1",
30
- "@domql/utils": "^3.6.1"
28
+ "@domql/element": "^3.6.3",
29
+ "@domql/state": "^3.6.3",
30
+ "@domql/utils": "^3.6.3"
31
31
  },
32
32
  "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
33
33
  "browser": "./dist/esm/index.js",