domql 3.5.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/iife/index.js +192 -49
- package/package.json +9 -8
package/dist/iife/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var Domql = (() => {
|
|
|
36
36
|
return (typeof HTMLElement === "object" ? obj instanceof window2.HTMLElement : obj && typeof obj === "object" && obj !== null && obj.nodeType === 1 && typeof obj.nodeName === "string") || false;
|
|
37
37
|
};
|
|
38
38
|
var isDOMNode = (obj) => {
|
|
39
|
-
return typeof window2 !== "undefined" && (obj instanceof window2.Node || obj instanceof window2.Window || obj === window2 || obj === document);
|
|
39
|
+
return typeof window2 !== "undefined" && (window2.Node && obj instanceof window2.Node || window2.Window && obj instanceof window2.Window || obj === window2 || obj === document);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// ../utils/dist/esm/types.js
|
|
@@ -780,6 +780,7 @@ var Domql = (() => {
|
|
|
780
780
|
|
|
781
781
|
// ../utils/dist/esm/extends.js
|
|
782
782
|
var ENV2 = process.env.NODE_ENV;
|
|
783
|
+
var isSourcemapEnabled = (options) => options.sourcemap !== false && ENV2 !== "production";
|
|
783
784
|
var createExtendsFromKeys = (key) => {
|
|
784
785
|
if (key.includes("+")) {
|
|
785
786
|
return key.split("+").filter(matchesComponentNaming);
|
|
@@ -853,17 +854,17 @@ var Domql = (() => {
|
|
|
853
854
|
}
|
|
854
855
|
return setHashedExtend(extend, stack);
|
|
855
856
|
};
|
|
856
|
-
var extractArrayExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
|
|
857
|
+
var extractArrayExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set(), nameStack, componentNameMap) => {
|
|
857
858
|
for (const each of extend) {
|
|
858
859
|
if (isArray(each)) {
|
|
859
|
-
extractArrayExtend(each, stack, context, processed);
|
|
860
|
+
extractArrayExtend(each, stack, context, processed, nameStack, componentNameMap);
|
|
860
861
|
} else {
|
|
861
|
-
flattenExtend(each, stack, context, processed);
|
|
862
|
+
flattenExtend(each, stack, context, processed, nameStack, void 0, componentNameMap);
|
|
862
863
|
}
|
|
863
864
|
}
|
|
864
865
|
return stack;
|
|
865
866
|
};
|
|
866
|
-
var deepExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
|
|
867
|
+
var deepExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set(), nameStack, currentName, componentNameMap) => {
|
|
867
868
|
const extendOflattenExtend = extend.extends || extend.extend;
|
|
868
869
|
const cleanExtend = { ...extend };
|
|
869
870
|
delete cleanExtend.extends;
|
|
@@ -875,26 +876,32 @@ var Domql = (() => {
|
|
|
875
876
|
}
|
|
876
877
|
if (hasKeys) {
|
|
877
878
|
stack.push(cleanExtend);
|
|
879
|
+
if (nameStack) nameStack.push(currentName);
|
|
878
880
|
}
|
|
879
881
|
if (extendOflattenExtend) {
|
|
880
|
-
flattenExtend(extendOflattenExtend, stack, context, processed);
|
|
882
|
+
flattenExtend(extendOflattenExtend, stack, context, processed, nameStack, currentName, componentNameMap);
|
|
881
883
|
}
|
|
882
884
|
return stack;
|
|
883
885
|
};
|
|
884
|
-
var flattenExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set()) => {
|
|
886
|
+
var flattenExtend = (extend, stack, context, processed = /* @__PURE__ */ new Set(), nameStack, parentName, componentNameMap) => {
|
|
885
887
|
if (!extend) return stack;
|
|
886
888
|
if (processed.has(extend)) return stack;
|
|
887
889
|
if (isArray(extend)) {
|
|
888
|
-
return extractArrayExtend(extend, stack, context, processed);
|
|
890
|
+
return extractArrayExtend(extend, stack, context, processed, nameStack, componentNameMap);
|
|
889
891
|
}
|
|
892
|
+
let currentName = parentName;
|
|
890
893
|
if (isString(extend)) {
|
|
894
|
+
currentName = extend;
|
|
891
895
|
extend = mapStringsWithContextComponents(extend, context);
|
|
896
|
+
} else if (componentNameMap && isObject(extend) && componentNameMap.has(extend)) {
|
|
897
|
+
currentName = componentNameMap.get(extend);
|
|
892
898
|
}
|
|
893
899
|
processed.add(extend);
|
|
894
900
|
if (extend?.extends || extend?.extend) {
|
|
895
|
-
deepExtend(extend, stack, context, processed);
|
|
901
|
+
deepExtend(extend, stack, context, processed, nameStack, currentName, componentNameMap);
|
|
896
902
|
} else if (extend) {
|
|
897
903
|
stack.push(extend);
|
|
904
|
+
if (nameStack) nameStack.push(currentName);
|
|
898
905
|
}
|
|
899
906
|
return stack;
|
|
900
907
|
};
|
|
@@ -907,7 +914,7 @@ var Domql = (() => {
|
|
|
907
914
|
"childExtend",
|
|
908
915
|
"childExtendRecursive"
|
|
909
916
|
]);
|
|
910
|
-
var deepMergeExtends = (element, extend) => {
|
|
917
|
+
var deepMergeExtends = (element, extend, sourcemap, sourceName, preBuiltSourcemap) => {
|
|
911
918
|
extend = deepClone(extend);
|
|
912
919
|
for (const e in extend) {
|
|
913
920
|
if (MERGE_EXTENDS_SKIP.has(e)) continue;
|
|
@@ -917,11 +924,23 @@ var Domql = (() => {
|
|
|
917
924
|
if (Object.prototype.hasOwnProperty.call(extend, e) && e !== "__proto__" && e !== "constructor" && e !== "prototype") {
|
|
918
925
|
if (elementProp === void 0) {
|
|
919
926
|
element[e] = extendProp;
|
|
927
|
+
if (sourcemap && sourceName) {
|
|
928
|
+
if (isObject(extendProp) && !isArray(extendProp)) {
|
|
929
|
+
sourcemap[e] = sourcemap[e] || {};
|
|
930
|
+
trackSourcemapDeep(sourcemap[e], extendProp, sourceName);
|
|
931
|
+
} else {
|
|
932
|
+
sourcemap[e] = sourceName;
|
|
933
|
+
}
|
|
934
|
+
} else if (sourcemap && preBuiltSourcemap?.[e]) {
|
|
935
|
+
sourcemap[e] = preBuiltSourcemap[e];
|
|
936
|
+
}
|
|
920
937
|
} else if (isObject(elementProp) && isObject(extendProp)) {
|
|
938
|
+
const nestedSourcemap = sourcemap ? sourcemap[e] = sourcemap[e] || {} : void 0;
|
|
939
|
+
const nestedPreBuilt = preBuiltSourcemap?.[e];
|
|
921
940
|
if (matchesComponentNaming(e)) {
|
|
922
|
-
element[e] = deepMergeExtends(elementProp, extendProp);
|
|
941
|
+
element[e] = deepMergeExtends(elementProp, extendProp, nestedSourcemap, sourceName, nestedPreBuilt);
|
|
923
942
|
} else {
|
|
924
|
-
deepMergeExtends(elementProp, extendProp);
|
|
943
|
+
deepMergeExtends(elementProp, extendProp, nestedSourcemap, sourceName, nestedPreBuilt);
|
|
925
944
|
}
|
|
926
945
|
}
|
|
927
946
|
if (e === "extends" || e === "childExtends" || e === "childExtendsRecursive") {
|
|
@@ -936,10 +955,24 @@ var Domql = (() => {
|
|
|
936
955
|
}
|
|
937
956
|
return element;
|
|
938
957
|
};
|
|
939
|
-
var
|
|
940
|
-
|
|
958
|
+
var trackSourcemapDeep = (sourcemap, obj, sourceName) => {
|
|
959
|
+
for (const key in obj) {
|
|
960
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
961
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
|
|
962
|
+
const val = obj[key];
|
|
963
|
+
if (isObject(val) && !isArray(val)) {
|
|
964
|
+
sourcemap[key] = sourcemap[key] || {};
|
|
965
|
+
trackSourcemapDeep(sourcemap[key], val, sourceName);
|
|
966
|
+
} else {
|
|
967
|
+
sourcemap[key] = sourceName;
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
var cloneAndMergeArrayExtend = (stack, sourcemap, extendNames) => {
|
|
972
|
+
return stack.reduce((acc, current, i) => {
|
|
941
973
|
const cloned = deepClone(current);
|
|
942
|
-
|
|
974
|
+
const sourceName = extendNames ? extendNames[i] : void 0;
|
|
975
|
+
return deepMergeExtends(acc, cloned, sourcemap, sourceName);
|
|
943
976
|
}, {});
|
|
944
977
|
};
|
|
945
978
|
var mapStringsWithContextComponents = (extend, context, options = {}, variant) => {
|
|
@@ -959,11 +992,12 @@ var Domql = (() => {
|
|
|
959
992
|
}
|
|
960
993
|
return extend;
|
|
961
994
|
};
|
|
962
|
-
var getExtendsStack = (extend, context) => {
|
|
995
|
+
var getExtendsStack = (extend, context, nameStack, componentNameMap) => {
|
|
963
996
|
if (!extend) return [];
|
|
964
997
|
if (extend.__hash) return getHashedExtend(extend) || [];
|
|
965
998
|
const processed = /* @__PURE__ */ new Set();
|
|
966
|
-
const stack = flattenExtend(extend, [], context, processed);
|
|
999
|
+
const stack = flattenExtend(extend, [], context, processed, nameStack, void 0, componentNameMap);
|
|
1000
|
+
if (nameStack) return stack;
|
|
967
1001
|
return getExtendsStackRegistry(extend, stack);
|
|
968
1002
|
};
|
|
969
1003
|
var createElementExtends = (element, parent, options = {}) => {
|
|
@@ -1041,6 +1075,8 @@ var Domql = (() => {
|
|
|
1041
1075
|
const { props, __ref: ref } = element;
|
|
1042
1076
|
const context = element.context || parent.context;
|
|
1043
1077
|
const variant = element.variant || props?.variant;
|
|
1078
|
+
const sourcemap = isSourcemapEnabled(options);
|
|
1079
|
+
const originalExtendNames = sourcemap ? [...ref.__extends] : null;
|
|
1044
1080
|
const __extends = removeDuplicatesInArray(
|
|
1045
1081
|
ref.__extends.map((val, i) => {
|
|
1046
1082
|
return mapStringsWithContextComponents(
|
|
@@ -1051,15 +1087,40 @@ var Domql = (() => {
|
|
|
1051
1087
|
);
|
|
1052
1088
|
})
|
|
1053
1089
|
);
|
|
1054
|
-
|
|
1055
|
-
|
|
1090
|
+
if (sourcemap) {
|
|
1091
|
+
const componentNameMap = /* @__PURE__ */ new WeakMap();
|
|
1092
|
+
for (let i = 0; i < __extends.length; i++) {
|
|
1093
|
+
const resolved = __extends[i];
|
|
1094
|
+
const originalName = originalExtendNames[i];
|
|
1095
|
+
if (resolved && isObject(resolved) && isString(originalName)) {
|
|
1096
|
+
componentNameMap.set(resolved, originalName);
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
const nameStack = [];
|
|
1100
|
+
const stack = getExtendsStack(__extends, context, nameStack, componentNameMap);
|
|
1101
|
+
ref.__extendsStack = stack;
|
|
1102
|
+
ref.__extendsNames = nameStack;
|
|
1103
|
+
} else {
|
|
1104
|
+
const stack = getExtendsStack(__extends, context);
|
|
1105
|
+
ref.__extendsStack = stack;
|
|
1106
|
+
}
|
|
1056
1107
|
return ref.__extendsStack;
|
|
1057
1108
|
};
|
|
1058
1109
|
var finalizeExtends = (element, parent, options = {}) => {
|
|
1059
1110
|
const { __ref: ref } = element;
|
|
1060
1111
|
const { __extendsStack } = ref;
|
|
1061
|
-
|
|
1062
|
-
|
|
1112
|
+
if (isSourcemapEnabled(options)) {
|
|
1113
|
+
const sourcemapAcc = {};
|
|
1114
|
+
const extendNames = ref.__extendsNames || [];
|
|
1115
|
+
const flattenExtends = cloneAndMergeArrayExtend(__extendsStack, sourcemapAcc, extendNames);
|
|
1116
|
+
const appliedSourcemap = {};
|
|
1117
|
+
deepMergeExtends(element, flattenExtends, appliedSourcemap, void 0, sourcemapAcc);
|
|
1118
|
+
ref.__sourcemap = appliedSourcemap;
|
|
1119
|
+
} else {
|
|
1120
|
+
const flattenExtends = cloneAndMergeArrayExtend(__extendsStack);
|
|
1121
|
+
deepMergeExtends(element, flattenExtends);
|
|
1122
|
+
}
|
|
1123
|
+
return element;
|
|
1063
1124
|
};
|
|
1064
1125
|
var applyExtends = (element, parent, options = {}) => {
|
|
1065
1126
|
createElementExtends(element, parent, options);
|
|
@@ -1098,6 +1159,31 @@ var Domql = (() => {
|
|
|
1098
1159
|
// ../utils/dist/esm/props.js
|
|
1099
1160
|
var RE_UPPER = /^[A-Z]/;
|
|
1100
1161
|
var RE_DIGITS = /^\d+$/;
|
|
1162
|
+
var CSS_SELECTOR_PREFIXES = /* @__PURE__ */ new Set([":", "@", "[", "*", "+", "~", "&", ">", "$", "-", ".", "!"]);
|
|
1163
|
+
var ELEMENT_INDICATOR_KEYS = /* @__PURE__ */ new Set([
|
|
1164
|
+
"extend",
|
|
1165
|
+
"props",
|
|
1166
|
+
"text",
|
|
1167
|
+
"tag",
|
|
1168
|
+
"on",
|
|
1169
|
+
"if",
|
|
1170
|
+
"childExtend",
|
|
1171
|
+
"children",
|
|
1172
|
+
"childrenAs",
|
|
1173
|
+
"state",
|
|
1174
|
+
"html",
|
|
1175
|
+
"attr",
|
|
1176
|
+
"define",
|
|
1177
|
+
"content"
|
|
1178
|
+
]);
|
|
1179
|
+
var looksLikeElement = (value) => {
|
|
1180
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1181
|
+
for (const k in value) {
|
|
1182
|
+
if (ELEMENT_INDICATOR_KEYS.has(k)) return true;
|
|
1183
|
+
if (RE_UPPER.test(k)) return true;
|
|
1184
|
+
}
|
|
1185
|
+
return false;
|
|
1186
|
+
};
|
|
1101
1187
|
var createProps = (element, parent, key) => {
|
|
1102
1188
|
const { props, __ref: ref } = element;
|
|
1103
1189
|
ref.__propsStack = [];
|
|
@@ -1120,11 +1206,27 @@ var Domql = (() => {
|
|
|
1120
1206
|
delete obj[key];
|
|
1121
1207
|
continue;
|
|
1122
1208
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
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
|
+
}
|
|
1227
|
+
const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key) || looksLikeElement(value);
|
|
1126
1228
|
const isBuiltin = DOMQ_PROPERTIES.has(key);
|
|
1127
|
-
if (!isElement && !isBuiltin
|
|
1229
|
+
if (!isElement && !isBuiltin) {
|
|
1128
1230
|
obj.props[key] = value;
|
|
1129
1231
|
delete obj[key];
|
|
1130
1232
|
cachedKeys.push(key);
|
|
@@ -1144,8 +1246,13 @@ var Domql = (() => {
|
|
|
1144
1246
|
continue;
|
|
1145
1247
|
}
|
|
1146
1248
|
if (cachedKeys.includes(key)) continue;
|
|
1147
|
-
|
|
1148
|
-
const
|
|
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);
|
|
1149
1256
|
const isElement = RE_UPPER.test(key) || RE_DIGITS.test(key);
|
|
1150
1257
|
const isBuiltin = DOMQ_PROPERTIES.has(key);
|
|
1151
1258
|
if (isElement || isBuiltin || hasDefine || hasGlobalDefine) {
|
|
@@ -1180,7 +1287,7 @@ var Domql = (() => {
|
|
|
1180
1287
|
const parentProps = parent.props;
|
|
1181
1288
|
if (!parentProps) return propsStack;
|
|
1182
1289
|
const matchParentKeyProps = parentProps[element.key];
|
|
1183
|
-
const matchParentChildProps = parentProps.childProps;
|
|
1290
|
+
const matchParentChildProps = parentProps.childProps || parent.childProps;
|
|
1184
1291
|
const ignoreChildProps = element.props?.ignoreChildProps;
|
|
1185
1292
|
if (matchParentChildProps && !ignoreChildProps) {
|
|
1186
1293
|
const childProps = objectizeStringProperty(matchParentChildProps);
|
|
@@ -2130,7 +2237,8 @@ ${element}` : "";
|
|
|
2130
2237
|
}
|
|
2131
2238
|
};
|
|
2132
2239
|
var startFrameLoop = (frameListeners) => {
|
|
2133
|
-
|
|
2240
|
+
const raf = typeof window !== "undefined" && window.requestAnimationFrame;
|
|
2241
|
+
if (_frameRunning || !raf) return;
|
|
2134
2242
|
_frameRunning = true;
|
|
2135
2243
|
function requestFrame() {
|
|
2136
2244
|
if (frameListeners.size === 0) {
|
|
@@ -2138,9 +2246,9 @@ ${element}` : "";
|
|
|
2138
2246
|
return;
|
|
2139
2247
|
}
|
|
2140
2248
|
processFrameListeners(frameListeners);
|
|
2141
|
-
|
|
2249
|
+
raf(requestFrame);
|
|
2142
2250
|
}
|
|
2143
|
-
|
|
2251
|
+
raf(requestFrame);
|
|
2144
2252
|
};
|
|
2145
2253
|
var applyAnimationFrame = (element) => {
|
|
2146
2254
|
if (!element) {
|
|
@@ -2518,7 +2626,7 @@ ${element}` : "";
|
|
|
2518
2626
|
|
|
2519
2627
|
// ../element/dist/esm/mixins/html.js
|
|
2520
2628
|
function html(param, element, node) {
|
|
2521
|
-
const prop = exec(element?.props?.html
|
|
2629
|
+
const prop = exec(param ?? element?.props?.html, element);
|
|
2522
2630
|
const { __ref } = element;
|
|
2523
2631
|
if (prop !== __ref.__html) {
|
|
2524
2632
|
if (node.nodeName === "SVG") node.textContent = prop;
|
|
@@ -2609,7 +2717,9 @@ ${element}` : "";
|
|
|
2609
2717
|
extends: {},
|
|
2610
2718
|
children: {},
|
|
2611
2719
|
content: {},
|
|
2720
|
+
childExtend: {},
|
|
2612
2721
|
childExtends: {},
|
|
2722
|
+
childExtendRecursive: {},
|
|
2613
2723
|
childExtendsRecursive: {},
|
|
2614
2724
|
props: {},
|
|
2615
2725
|
if: {},
|
|
@@ -2823,6 +2933,16 @@ ${element}` : "";
|
|
|
2823
2933
|
};
|
|
2824
2934
|
var set = function(params, options = {}, el) {
|
|
2825
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) {
|
|
2826
2946
|
const { __ref: ref } = element;
|
|
2827
2947
|
const contentElementKey = setContentKey(element, options);
|
|
2828
2948
|
const content = element[contentElementKey];
|
|
@@ -2848,18 +2968,20 @@ ${element}` : "";
|
|
|
2848
2968
|
}
|
|
2849
2969
|
return;
|
|
2850
2970
|
}
|
|
2851
|
-
if (!params) return element;
|
|
2971
|
+
if (!params || typeof params !== "object") return element;
|
|
2852
2972
|
let { childExtends, props, tag } = params;
|
|
2853
2973
|
if (!props) props = params.props = {};
|
|
2854
2974
|
if (tag === "fragment") {
|
|
2855
|
-
|
|
2856
|
-
|
|
2975
|
+
const elementChildExtends = element.childExtends || element.childExtend;
|
|
2976
|
+
if (!childExtends && elementChildExtends) {
|
|
2977
|
+
params.childExtends = elementChildExtends;
|
|
2857
2978
|
props.ignoreChildExtends = true;
|
|
2858
2979
|
}
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
props.
|
|
2980
|
+
const elementChildProps = element.childProps || element.props?.childProps;
|
|
2981
|
+
if (!props?.childProps && elementChildProps) {
|
|
2982
|
+
props.childProps = elementChildProps;
|
|
2862
2983
|
}
|
|
2984
|
+
props.ignoreChildProps = true;
|
|
2863
2985
|
}
|
|
2864
2986
|
if (lazyLoad) {
|
|
2865
2987
|
window.requestAnimationFrame(() => {
|
|
@@ -3467,6 +3589,34 @@ ${element}` : "";
|
|
|
3467
3589
|
triggerEventOn("update", element, options);
|
|
3468
3590
|
}
|
|
3469
3591
|
};
|
|
3592
|
+
var findSiblingAttachOptions = (element, parent) => {
|
|
3593
|
+
const { __children } = parent.__ref || {};
|
|
3594
|
+
if (!__children) return false;
|
|
3595
|
+
const currentIndex = __children.indexOf(element.key);
|
|
3596
|
+
let previousNode;
|
|
3597
|
+
for (let i = currentIndex - 1; i >= 0; i--) {
|
|
3598
|
+
const sibling = parent[__children[i]];
|
|
3599
|
+
if (sibling?.node?.parentNode) {
|
|
3600
|
+
previousNode = sibling.node;
|
|
3601
|
+
break;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
if (previousNode) {
|
|
3605
|
+
return { position: "after", node: previousNode };
|
|
3606
|
+
}
|
|
3607
|
+
let nextNode;
|
|
3608
|
+
for (let i = currentIndex + 1; i < __children.length; i++) {
|
|
3609
|
+
const sibling = parent[__children[i]];
|
|
3610
|
+
if (sibling?.node?.parentNode) {
|
|
3611
|
+
nextNode = sibling.node;
|
|
3612
|
+
break;
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
if (nextNode) {
|
|
3616
|
+
return { position: "before", node: nextNode };
|
|
3617
|
+
}
|
|
3618
|
+
return false;
|
|
3619
|
+
};
|
|
3470
3620
|
var checkIfOnUpdate = (element, parent, options) => {
|
|
3471
3621
|
if (!isFunction(element.if) && !isFunction(element.props?.if) || !parent) {
|
|
3472
3622
|
return;
|
|
@@ -3503,16 +3653,7 @@ ${element}` : "";
|
|
|
3503
3653
|
} else if (element[contentKey]?.parseDeep) {
|
|
3504
3654
|
element[contentKey] = element[contentKey].parseDeep();
|
|
3505
3655
|
}
|
|
3506
|
-
const
|
|
3507
|
-
const previousNode = previousElement2?.node;
|
|
3508
|
-
const hasPrevious = previousNode?.parentNode;
|
|
3509
|
-
const nextElement2 = element.nextElement();
|
|
3510
|
-
const nextNode = nextElement2?.node;
|
|
3511
|
-
const hasNext = nextNode?.parentNode;
|
|
3512
|
-
const attachOptions = (hasPrevious || hasNext) && {
|
|
3513
|
-
position: hasPrevious ? "after" : hasNext ? "before" : null,
|
|
3514
|
-
node: hasPrevious && previousNode || hasNext && nextNode
|
|
3515
|
-
};
|
|
3656
|
+
const attachOptions = findSiblingAttachOptions(element, parent);
|
|
3516
3657
|
delete element.__ref;
|
|
3517
3658
|
delete element.parent;
|
|
3518
3659
|
const createdElement = create(
|
|
@@ -4620,7 +4761,9 @@ ${element}` : "";
|
|
|
4620
4761
|
};
|
|
4621
4762
|
var addElementIntoParentChildren = (element, parent) => {
|
|
4622
4763
|
if (parent.__ref && parent.__ref.__children) {
|
|
4623
|
-
parent.__ref.__children.
|
|
4764
|
+
if (!parent.__ref.__children.includes(element.key)) {
|
|
4765
|
+
parent.__ref.__children.push(element.key);
|
|
4766
|
+
}
|
|
4624
4767
|
}
|
|
4625
4768
|
};
|
|
4626
4769
|
var _uniqIdCounter = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "domql",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/esm/index.js",
|
|
11
|
-
"require": "./dist/cjs/index.js"
|
|
12
|
-
"browser": "./dist/esm/index.js",
|
|
13
|
-
"default": "./dist/esm/index.js"
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
14
12
|
}
|
|
15
13
|
},
|
|
16
14
|
"source": "index.js",
|
|
@@ -27,13 +25,16 @@
|
|
|
27
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"
|
|
28
26
|
},
|
|
29
27
|
"dependencies": {
|
|
30
|
-
"@domql/element": "^3.
|
|
31
|
-
"@domql/state": "^3.
|
|
32
|
-
"@domql/utils": "^3.
|
|
28
|
+
"@domql/element": "^3.6.3",
|
|
29
|
+
"@domql/state": "^3.6.3",
|
|
30
|
+
"@domql/utils": "^3.6.3"
|
|
33
31
|
},
|
|
34
32
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
35
33
|
"browser": "./dist/esm/index.js",
|
|
36
34
|
"unpkg": "./dist/iife/index.js",
|
|
37
35
|
"jsdelivr": "./dist/iife/index.js",
|
|
38
|
-
"sideEffects": false
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
}
|
|
39
40
|
}
|