@dooboostore/simple-web-component 1.0.22 → 1.0.24
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 +568 -32
- package/dist/cjs/decorators/applyNode.js +195 -26
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/attribute.js +21 -3
- package/dist/cjs/decorators/attribute.js.map +2 -2
- package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
- package/dist/cjs/decorators/classList.js +82 -19
- package/dist/cjs/decorators/classList.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +1 -2
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/index.js +0 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +25 -0
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/query.js +77 -2
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/queryAll.js +77 -2
- package/dist/cjs/decorators/queryAll.js.map +2 -2
- package/dist/cjs/decorators/setAttribute.js +4 -4
- package/dist/cjs/decorators/setAttribute.js.map +2 -2
- package/dist/cjs/decorators/style.js +70 -13
- package/dist/cjs/decorators/style.js.map +2 -2
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils/Utils.js +140 -1
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +195 -26
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/attribute.js +21 -3
- package/dist/esm/decorators/attribute.js.map +2 -2
- package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
- package/dist/esm/decorators/classList.js +82 -19
- package/dist/esm/decorators/classList.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +1 -2
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/index.js +0 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +25 -0
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/query.js +77 -2
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/queryAll.js +77 -2
- package/dist/esm/decorators/queryAll.js.map +2 -2
- package/dist/esm/decorators/setAttribute.js +4 -4
- package/dist/esm/decorators/setAttribute.js.map +2 -2
- package/dist/esm/decorators/style.js +70 -13
- package/dist/esm/decorators/style.js.map +2 -2
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/utils/Utils.js +140 -1
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +678 -168
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/applyNode.d.ts +107 -2
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/attribute.d.ts +11 -4
- package/dist/types/decorators/attribute.d.ts.map +1 -1
- package/dist/types/decorators/classList.d.ts +22 -10
- package/dist/types/decorators/classList.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +0 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +14 -0
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +68 -7
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/queryAll.d.ts +70 -1
- package/dist/types/decorators/queryAll.d.ts.map +1 -1
- package/dist/types/decorators/setAttribute.d.ts.map +1 -1
- package/dist/types/decorators/style.d.ts +37 -3
- package/dist/types/decorators/style.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +49 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +678 -168
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +2 -2
- package/src/decorators/applyNode.ts +319 -37
- package/src/decorators/attribute.ts +44 -11
- package/src/decorators/changedAttributeHost.ts +1 -1
- package/src/decorators/classList.ts +107 -22
- package/src/decorators/elementDefine.ts +1 -2
- package/src/decorators/index.ts +0 -1
- package/src/decorators/lifecycles.ts +40 -0
- package/src/decorators/query.ts +147 -7
- package/src/decorators/queryAll.ts +148 -2
- package/src/decorators/setAttribute.ts +6 -5
- package/src/decorators/style.ts +109 -13
- package/src/index.ts +6 -6
- package/src/utils/Utils.ts +144 -0
- package/dist/cjs/decorators/onConnectedInnerHtml.js +0 -48
- package/dist/cjs/decorators/onConnectedInnerHtml.js.map +0 -7
- package/dist/cjs/utils/TemplateUtils.js +0 -103
- package/dist/cjs/utils/TemplateUtils.js.map +0 -7
- package/dist/esm/decorators/onConnectedInnerHtml.js +0 -29
- package/dist/esm/decorators/onConnectedInnerHtml.js.map +0 -7
- package/dist/esm/utils/TemplateUtils.js +0 -84
- package/dist/esm/utils/TemplateUtils.js.map +0 -7
- package/dist/types/decorators/onConnectedInnerHtml.d.ts +0 -15
- package/dist/types/decorators/onConnectedInnerHtml.d.ts.map +0 -1
- package/dist/types/utils/TemplateUtils.d.ts +0 -54
- package/dist/types/utils/TemplateUtils.d.ts.map +0 -1
- package/src/decorators/onConnectedInnerHtml.ts +0 -42
- package/src/utils/TemplateUtils.ts +0 -83
|
@@ -1145,16 +1145,42 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1145
1145
|
STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
|
|
1146
1146
|
SWC_NOT_FOUND: () => SWC_NOT_FOUND,
|
|
1147
1147
|
SwcUtils: () => SwcUtils,
|
|
1148
|
-
TemplateUtils: () => TemplateUtils,
|
|
1149
1148
|
addClassList: () => addClassList,
|
|
1150
1149
|
addClassListHost: () => addClassListHost,
|
|
1151
1150
|
addEventListener: () => addEventListener,
|
|
1152
1151
|
addEventListenerHost: () => addEventListenerHost,
|
|
1152
|
+
allAppHost: () => allAppHost,
|
|
1153
|
+
allFirstAppHost: () => allFirstAppHost,
|
|
1154
|
+
allFirstHost: () => allFirstHost,
|
|
1155
|
+
allHost: () => allHost,
|
|
1156
|
+
allLastAppHost: () => allLastAppHost,
|
|
1157
|
+
allLastHost: () => allLastHost,
|
|
1158
|
+
allParentHost: () => allParentHost,
|
|
1159
|
+
appHost: () => appHost,
|
|
1160
|
+
applyAfterBeginNode: () => applyAfterBeginNode,
|
|
1161
|
+
applyAfterBeginNodeHost: () => applyAfterBeginNodeHost,
|
|
1162
|
+
applyAfterEndNode: () => applyAfterEndNode,
|
|
1163
|
+
applyAfterEndNodeHost: () => applyAfterEndNodeHost,
|
|
1164
|
+
applyBeforeBeginNode: () => applyBeforeBeginNode,
|
|
1165
|
+
applyBeforeBeginNodeHost: () => applyBeforeBeginNodeHost,
|
|
1166
|
+
applyBeforeEndNode: () => applyBeforeEndNode,
|
|
1167
|
+
applyBeforeEndNodeHost: () => applyBeforeEndNodeHost,
|
|
1168
|
+
applyInnerHtmlNode: () => applyInnerHtmlNode,
|
|
1169
|
+
applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
|
|
1170
|
+
applyInnerTextNode: () => applyInnerTextNode,
|
|
1171
|
+
applyInnerTextNodeHost: () => applyInnerTextNodeHost,
|
|
1153
1172
|
applyNode: () => applyNode,
|
|
1154
1173
|
applyNodeHost: () => applyNodeHost,
|
|
1174
|
+
applyRemoveNode: () => applyRemoveNode,
|
|
1175
|
+
applyRemoveNodeHost: () => applyRemoveNodeHost,
|
|
1176
|
+
applyReplaceChildrenNode: () => applyReplaceChildrenNode,
|
|
1177
|
+
applyReplaceChildrenNodeHost: () => applyReplaceChildrenNodeHost,
|
|
1178
|
+
applyReplaceNode: () => applyReplaceNode,
|
|
1179
|
+
applyReplaceNodeHost: () => applyReplaceNodeHost,
|
|
1155
1180
|
attribute: () => attribute,
|
|
1156
1181
|
attributeHost: () => attributeHost,
|
|
1157
1182
|
changedAttributeHost: () => changedAttributeHost,
|
|
1183
|
+
commentNode: () => commentNode,
|
|
1158
1184
|
createElement: () => createElement,
|
|
1159
1185
|
elementDefine: () => elementDefine,
|
|
1160
1186
|
emitCustomEvent: () => emitCustomEvent,
|
|
@@ -1167,6 +1193,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1167
1193
|
findAllLifecycleMetadata: () => findAllLifecycleMetadata,
|
|
1168
1194
|
findAllSetAttributeMetadata: () => findAllSetAttributeMetadata,
|
|
1169
1195
|
findAllStyleMetadata: () => findAllStyleMetadata,
|
|
1196
|
+
firstAppHost: () => firstAppHost,
|
|
1197
|
+
firstHost: () => firstHost,
|
|
1170
1198
|
getAddEventListenerMetadata: () => getAddEventListenerMetadata,
|
|
1171
1199
|
getChangedAttributeMetadata: () => getChangedAttributeMetadata,
|
|
1172
1200
|
getElementConfig: () => getElementConfig,
|
|
@@ -1175,23 +1203,20 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1175
1203
|
getQueryAllMetadata: () => getQueryAllMetadata,
|
|
1176
1204
|
getQueryMetadata: () => getQueryMetadata,
|
|
1177
1205
|
getSetAttributeMetadata: () => getSetAttributeMetadata,
|
|
1206
|
+
host: () => host,
|
|
1178
1207
|
htmlAElement: () => htmlAElement,
|
|
1179
1208
|
htmlArticleElement: () => htmlArticleElement,
|
|
1180
1209
|
htmlButtonElement: () => htmlButtonElement,
|
|
1181
1210
|
htmlDivElement: () => htmlDivElement,
|
|
1182
1211
|
htmlFragment: () => htmlFragment,
|
|
1183
|
-
|
|
1184
|
-
htmlH2Element: () => htmlH2Element,
|
|
1185
|
-
htmlH3Element: () => htmlH3Element,
|
|
1186
|
-
htmlH4Element: () => htmlH4Element,
|
|
1187
|
-
htmlH5Element: () => htmlH5Element,
|
|
1188
|
-
htmlH6Element: () => htmlH6Element,
|
|
1189
|
-
htmlInputElement: () => htmlInputElement,
|
|
1212
|
+
htmlHeadingElement: () => htmlHeadingElement,
|
|
1190
1213
|
htmlLiElement: () => htmlLiElement,
|
|
1191
1214
|
htmlPElement: () => htmlPElement,
|
|
1192
1215
|
htmlSectionElement: () => htmlSectionElement,
|
|
1193
1216
|
htmlSpanElement: () => htmlSpanElement,
|
|
1194
1217
|
htmlUlElement: () => htmlUlElement,
|
|
1218
|
+
lastAppHost: () => lastAppHost,
|
|
1219
|
+
lastHost: () => lastHost,
|
|
1195
1220
|
onAddEventListener: () => onAddEventListener,
|
|
1196
1221
|
onAdopted: () => onAdopted,
|
|
1197
1222
|
onAfterAdopted: () => onAfterAdopted,
|
|
@@ -1204,6 +1229,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1204
1229
|
onConnectedInnerHtml: () => onConnectedInnerHtml,
|
|
1205
1230
|
onConstructor: () => onConstructor,
|
|
1206
1231
|
onDisconnected: () => onDisconnected,
|
|
1232
|
+
parentHost: () => parentHost,
|
|
1207
1233
|
query: () => query,
|
|
1208
1234
|
queryAll: () => queryAll,
|
|
1209
1235
|
queryAllHost: () => queryAllHost,
|
|
@@ -1211,18 +1237,21 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1211
1237
|
removeClassList: () => removeClassList,
|
|
1212
1238
|
removeClassListHost: () => removeClassListHost,
|
|
1213
1239
|
removeStyle: () => removeStyle,
|
|
1240
|
+
removeStyleHost: () => removeStyleHost,
|
|
1214
1241
|
resolveTargetEls: () => resolveTargetEls,
|
|
1215
1242
|
setAttribute: () => setAttribute,
|
|
1216
1243
|
setAttributeHost: () => setAttributeHost,
|
|
1217
1244
|
setClassList: () => setClassList,
|
|
1218
1245
|
setClassListHost: () => setClassListHost,
|
|
1219
1246
|
setStyle: () => setStyle,
|
|
1247
|
+
setStyleHost: () => setStyleHost,
|
|
1220
1248
|
textNode: () => textNode,
|
|
1221
1249
|
toggleClassList: () => toggleClassList,
|
|
1222
1250
|
toggleClassListHost: () => toggleClassListHost,
|
|
1223
1251
|
updateClassList: () => updateClassList,
|
|
1224
1252
|
updateClassListHost: () => updateClassListHost,
|
|
1225
|
-
updateStyle: () => updateStyle
|
|
1253
|
+
updateStyle: () => updateStyle,
|
|
1254
|
+
updateStyleHost: () => updateStyleHost
|
|
1226
1255
|
});
|
|
1227
1256
|
var import_reflect_metadata2 = __toESM(require_Reflect(), 1);
|
|
1228
1257
|
|
|
@@ -5829,30 +5858,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5829
5858
|
})(Path = Expression2.Path || (Expression2.Path = {}));
|
|
5830
5859
|
})(Expression || (Expression = {}));
|
|
5831
5860
|
|
|
5832
|
-
// src/decorators/onConnectedInnerHtml.ts
|
|
5833
|
-
var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
|
|
5834
|
-
function onConnectedInnerHtml(arg1, arg2, arg3) {
|
|
5835
|
-
const decorator = (options, target, propertyKey) => {
|
|
5836
|
-
const constructor = target.constructor;
|
|
5837
|
-
let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
5838
|
-
if (!list) {
|
|
5839
|
-
list = [];
|
|
5840
|
-
ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
|
|
5841
|
-
}
|
|
5842
|
-
list.push({ propertyKey, options });
|
|
5843
|
-
};
|
|
5844
|
-
if (arg2) {
|
|
5845
|
-
return decorator({}, arg1, arg2);
|
|
5846
|
-
}
|
|
5847
|
-
return (target, propertyKey) => {
|
|
5848
|
-
decorator(arg1 || {}, target, propertyKey);
|
|
5849
|
-
};
|
|
5850
|
-
}
|
|
5851
|
-
var getOnConnectedInnerHtmlMetadata = (target) => {
|
|
5852
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
5853
|
-
return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
5854
|
-
};
|
|
5855
|
-
|
|
5856
5861
|
// src/decorators/addEventListener.ts
|
|
5857
5862
|
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:add-event-listener");
|
|
5858
5863
|
function addEventListener(selectorOrTarget, type, options = {}) {
|
|
@@ -5883,6 +5888,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5883
5888
|
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-before-adopted");
|
|
5884
5889
|
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol("simple-web-component:on-after-adopted");
|
|
5885
5890
|
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol("simple-web-component:on-add-event-listener");
|
|
5891
|
+
var INNER_HTML_METADATA_KEY = Symbol("simple-web-component:inner-html");
|
|
5886
5892
|
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
5887
5893
|
function createLifecycleDecorator(metadataKey) {
|
|
5888
5894
|
return (target, propertyKey) => {
|
|
@@ -5906,10 +5912,31 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5906
5912
|
var onAfterAdopted = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
|
|
5907
5913
|
var onAdopted = onAfterAdopted;
|
|
5908
5914
|
var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
|
|
5915
|
+
function onConnectedInnerHtml(arg1, arg2, arg3) {
|
|
5916
|
+
const decorator = (options, target, propertyKey) => {
|
|
5917
|
+
const constructor = target.constructor;
|
|
5918
|
+
let list = ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
5919
|
+
if (!list) {
|
|
5920
|
+
list = [];
|
|
5921
|
+
ReflectUtils.defineMetadata(INNER_HTML_METADATA_KEY, list, constructor);
|
|
5922
|
+
}
|
|
5923
|
+
list.push({ propertyKey, options });
|
|
5924
|
+
};
|
|
5925
|
+
if (arg2) {
|
|
5926
|
+
return decorator({}, arg1, arg2);
|
|
5927
|
+
}
|
|
5928
|
+
return (target, propertyKey) => {
|
|
5929
|
+
decorator(arg1 || {}, target, propertyKey);
|
|
5930
|
+
};
|
|
5931
|
+
}
|
|
5909
5932
|
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
5910
5933
|
const results = ReflectUtils.findAllMetadataFlatten(metadataKey, target);
|
|
5911
5934
|
return results.length > 0 ? results : void 0;
|
|
5912
5935
|
};
|
|
5936
|
+
var getOnConnectedInnerHtmlMetadata = (target) => {
|
|
5937
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
5938
|
+
return ReflectUtils.getMetadata(INNER_HTML_METADATA_KEY, constructor);
|
|
5939
|
+
};
|
|
5913
5940
|
|
|
5914
5941
|
// src/decorators/attribute.ts
|
|
5915
5942
|
var ATTRIBUTE_METADATA_KEY = Symbol("simple-web-component:attribute");
|
|
@@ -6013,7 +6040,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6013
6040
|
},
|
|
6014
6041
|
set(nv) {
|
|
6015
6042
|
const targetType = options.type || designType;
|
|
6016
|
-
console.log("---set", propertyKey, targetType, nv, this, this.__swc_syncing_init);
|
|
6017
6043
|
const attrName = options.name || String(propertyKey);
|
|
6018
6044
|
const conf = getElementConfig(this);
|
|
6019
6045
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
@@ -6041,8 +6067,27 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6041
6067
|
var findAllAttributeMetadata = (target) => {
|
|
6042
6068
|
return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
|
|
6043
6069
|
};
|
|
6044
|
-
function attributeHost(
|
|
6045
|
-
|
|
6070
|
+
function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
6071
|
+
if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
6072
|
+
const fieldName = String(propertyKeyOrOptions);
|
|
6073
|
+
return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
|
|
6074
|
+
}
|
|
6075
|
+
if (typeof targetOrAttrOrOptions === "string") {
|
|
6076
|
+
const attrName = targetOrAttrOrOptions;
|
|
6077
|
+
const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
|
|
6078
|
+
return attribute(":host", { ...options, name: attrName });
|
|
6079
|
+
} else if (typeof targetOrAttrOrOptions === "object") {
|
|
6080
|
+
const options = targetOrAttrOrOptions;
|
|
6081
|
+
return (target, propertyKey) => {
|
|
6082
|
+
const fieldName = String(propertyKey);
|
|
6083
|
+
return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
|
|
6084
|
+
};
|
|
6085
|
+
} else {
|
|
6086
|
+
return (target, propertyKey) => {
|
|
6087
|
+
const fieldName = String(propertyKey);
|
|
6088
|
+
return attribute(":host", { name: fieldName })(target, propertyKey);
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6046
6091
|
}
|
|
6047
6092
|
|
|
6048
6093
|
// src/decorators/changedAttributeHost.ts
|
|
@@ -6096,11 +6141,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6096
6141
|
const applyRoot = (t) => {
|
|
6097
6142
|
if (!t) return;
|
|
6098
6143
|
if (r === "auto") {
|
|
6099
|
-
targetEls.push(t
|
|
6100
|
-
|
|
6144
|
+
targetEls.push(t);
|
|
6145
|
+
} else {
|
|
6146
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6147
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
6101
6148
|
}
|
|
6102
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
6103
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
6104
6149
|
};
|
|
6105
6150
|
if (selector === ":window") targetEls.push(currentWin);
|
|
6106
6151
|
else if (selector === ":document") targetEls.push(currentWin.document);
|
|
@@ -6182,32 +6227,83 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6182
6227
|
const conf = getElementConfig(this);
|
|
6183
6228
|
const currentWin = this._resolveWindow?.(conf) || (typeof window !== "undefined" ? window : void 0);
|
|
6184
6229
|
const currentDoc = currentWin.document;
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6230
|
+
const pos = options.position || "beforeEnd";
|
|
6231
|
+
const r = options.root || "auto";
|
|
6232
|
+
const applyRoot = (t) => {
|
|
6233
|
+
if (!t || !(t instanceof HTMLElement))
|
|
6234
|
+
return t;
|
|
6235
|
+
if (r === "auto")
|
|
6236
|
+
return t.shadowRoot || t;
|
|
6237
|
+
if (r === "shadow")
|
|
6238
|
+
return t.shadowRoot;
|
|
6239
|
+
if (r === "light")
|
|
6240
|
+
return t;
|
|
6241
|
+
if (r === "all")
|
|
6242
|
+
return t.shadowRoot || t;
|
|
6243
|
+
return t;
|
|
6244
|
+
};
|
|
6245
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
6246
|
+
if (pos === "remove") {
|
|
6247
|
+
if (res) {
|
|
6248
|
+
if (selector === ":host" || !selector) {
|
|
6249
|
+
if (r === "shadow" && this.shadowRoot) {
|
|
6250
|
+
this.shadowRoot.replaceChildren();
|
|
6251
|
+
} else {
|
|
6252
|
+
this.remove();
|
|
6253
|
+
}
|
|
6254
|
+
} else {
|
|
6255
|
+
const targetRoot = applyRoot(this);
|
|
6256
|
+
if (targetRoot) {
|
|
6257
|
+
const targets = targetRoot.querySelectorAll(selector);
|
|
6258
|
+
targets.forEach((el) => el.remove());
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
}
|
|
6188
6262
|
} else {
|
|
6189
|
-
targetEl =
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
if (
|
|
6195
|
-
targetEl
|
|
6196
|
-
} else if (
|
|
6197
|
-
targetEl
|
|
6198
|
-
} else if (
|
|
6199
|
-
targetEl
|
|
6200
|
-
} else if (
|
|
6201
|
-
targetEl
|
|
6263
|
+
let targetEl = null;
|
|
6264
|
+
if (selector === ":host") {
|
|
6265
|
+
targetEl = applyRoot(this);
|
|
6266
|
+
} else if (selector === ":parentHost") {
|
|
6267
|
+
targetEl = applyRoot(hostSet.$parentHost);
|
|
6268
|
+
} else if (selector === ":appHost") {
|
|
6269
|
+
targetEl = applyRoot(hostSet.$appHost);
|
|
6270
|
+
} else if (selector === ":firstHost") {
|
|
6271
|
+
targetEl = applyRoot(hostSet.$firstHost);
|
|
6272
|
+
} else if (selector === ":lastHost") {
|
|
6273
|
+
targetEl = applyRoot(hostSet.$lastHost);
|
|
6274
|
+
} else if (selector === ":firstAppHost") {
|
|
6275
|
+
targetEl = applyRoot(hostSet.$firstHost);
|
|
6276
|
+
} else if (selector === ":lastAppHost") {
|
|
6277
|
+
targetEl = applyRoot(hostSet.$lastAppHost);
|
|
6202
6278
|
} else {
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6279
|
+
const targetRoot = applyRoot(this);
|
|
6280
|
+
targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6281
|
+
}
|
|
6282
|
+
if (targetEl) {
|
|
6283
|
+
const isShadowRoot = targetEl instanceof ShadowRoot;
|
|
6284
|
+
const nodes = normalizeNodes(res, currentDoc);
|
|
6285
|
+
if (pos === "replace") {
|
|
6286
|
+
if (!isShadowRoot) {
|
|
6287
|
+
targetEl.replaceWith(...nodes);
|
|
6288
|
+
}
|
|
6289
|
+
} else if (pos === "replaceChildren") {
|
|
6290
|
+
targetEl.replaceChildren(...nodes);
|
|
6291
|
+
} else if (pos === "innerHtml") {
|
|
6292
|
+
targetEl.innerHTML = res !== void 0 && res !== null ? String(res) : "";
|
|
6293
|
+
} else if (pos === "innerText") {
|
|
6294
|
+
if (targetEl.innerText !== void 0) {
|
|
6295
|
+
targetEl.innerText = res !== void 0 && res !== null ? String(res) : "";
|
|
6296
|
+
}
|
|
6297
|
+
} else {
|
|
6298
|
+
if (pos === "beforeEnd")
|
|
6299
|
+
targetEl.append(...nodes);
|
|
6300
|
+
else if (pos === "afterBegin")
|
|
6301
|
+
targetEl.prepend(...nodes);
|
|
6302
|
+
else if (pos === "beforeBegin" && !isShadowRoot)
|
|
6303
|
+
targetEl.before(...nodes);
|
|
6304
|
+
else if (pos === "afterEnd" && !isShadowRoot)
|
|
6305
|
+
targetEl.after(...nodes);
|
|
6306
|
+
}
|
|
6211
6307
|
}
|
|
6212
6308
|
}
|
|
6213
6309
|
}
|
|
@@ -6225,8 +6321,107 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6225
6321
|
});
|
|
6226
6322
|
return result;
|
|
6227
6323
|
};
|
|
6228
|
-
function applyNodeHost(
|
|
6229
|
-
|
|
6324
|
+
function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6325
|
+
console.log("vvvvv");
|
|
6326
|
+
if (propertyKey !== void 0 && typeof propertyKey === "string" || typeof propertyKey === "symbol") {
|
|
6327
|
+
return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
|
|
6328
|
+
}
|
|
6329
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6330
|
+
const options = targetOrOptions;
|
|
6331
|
+
return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
|
|
6332
|
+
} else {
|
|
6333
|
+
return applyNode(":host", { position: "beforeEnd" });
|
|
6334
|
+
}
|
|
6335
|
+
}
|
|
6336
|
+
function applyBeforeBeginNode(selector, options) {
|
|
6337
|
+
return applyNode(selector, { ...options, position: "beforeBegin" });
|
|
6338
|
+
}
|
|
6339
|
+
function applyAfterBeginNode(selector, options) {
|
|
6340
|
+
return applyNode(selector, { ...options, position: "afterBegin" });
|
|
6341
|
+
}
|
|
6342
|
+
function applyBeforeEndNode(selector, options) {
|
|
6343
|
+
return applyNode(selector, { ...options, position: "beforeEnd" });
|
|
6344
|
+
}
|
|
6345
|
+
function applyAfterEndNode(selector, options) {
|
|
6346
|
+
return applyNode(selector, { ...options, position: "afterEnd" });
|
|
6347
|
+
}
|
|
6348
|
+
function applyReplaceNode(selector, options) {
|
|
6349
|
+
return applyNode(selector, { ...options, position: "replace" });
|
|
6350
|
+
}
|
|
6351
|
+
function applyReplaceChildrenNode(selector, options) {
|
|
6352
|
+
return applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6353
|
+
}
|
|
6354
|
+
function applyInnerHtmlNode(selector, options) {
|
|
6355
|
+
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
6356
|
+
}
|
|
6357
|
+
function applyInnerTextNode(selector, options) {
|
|
6358
|
+
return applyNode(selector, { ...options, position: "innerText" });
|
|
6359
|
+
}
|
|
6360
|
+
function applyRemoveNode(selector, options) {
|
|
6361
|
+
return applyNode(selector, { ...options, position: "remove" });
|
|
6362
|
+
}
|
|
6363
|
+
function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6364
|
+
if (propertyKey !== void 0) {
|
|
6365
|
+
const decorator = applyNode(":host", { position: "beforeBegin" });
|
|
6366
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6367
|
+
}
|
|
6368
|
+
return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
|
|
6369
|
+
}
|
|
6370
|
+
function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6371
|
+
if (propertyKey !== void 0) {
|
|
6372
|
+
const decorator = applyNode(":host", { position: "afterBegin" });
|
|
6373
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6374
|
+
}
|
|
6375
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
|
|
6376
|
+
}
|
|
6377
|
+
function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6378
|
+
if (propertyKey !== void 0) {
|
|
6379
|
+
const decorator = applyNode(":host", { position: "beforeEnd" });
|
|
6380
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6381
|
+
}
|
|
6382
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
|
|
6383
|
+
}
|
|
6384
|
+
function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6385
|
+
if (propertyKey !== void 0) {
|
|
6386
|
+
const decorator = applyNode(":host", { position: "afterEnd" });
|
|
6387
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6388
|
+
}
|
|
6389
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
|
|
6390
|
+
}
|
|
6391
|
+
function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6392
|
+
if (propertyKey !== void 0) {
|
|
6393
|
+
const decorator = applyNode(":host", { position: "replace" });
|
|
6394
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6395
|
+
}
|
|
6396
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
|
|
6397
|
+
}
|
|
6398
|
+
function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6399
|
+
if (propertyKey !== void 0) {
|
|
6400
|
+
const decorator = applyNode(":host", { position: "replaceChildren" });
|
|
6401
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6402
|
+
}
|
|
6403
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
|
|
6404
|
+
}
|
|
6405
|
+
function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6406
|
+
if (propertyKey !== void 0) {
|
|
6407
|
+
const decorator = applyNode(":host", { position: "innerHtml" });
|
|
6408
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6409
|
+
}
|
|
6410
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
|
|
6411
|
+
}
|
|
6412
|
+
function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6413
|
+
if (propertyKey !== void 0) {
|
|
6414
|
+
const decorator = applyNode(":host", { position: "innerText" });
|
|
6415
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6416
|
+
}
|
|
6417
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
|
|
6418
|
+
}
|
|
6419
|
+
function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6420
|
+
if (propertyKey !== void 0) {
|
|
6421
|
+
const decorator = applyNode(":host", { position: "remove" });
|
|
6422
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6423
|
+
}
|
|
6424
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
|
|
6230
6425
|
}
|
|
6231
6426
|
|
|
6232
6427
|
// src/decorators/query.ts
|
|
@@ -6328,8 +6523,76 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6328
6523
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6329
6524
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
6330
6525
|
};
|
|
6331
|
-
function queryHost(
|
|
6332
|
-
|
|
6526
|
+
function queryHost(targetOrOptions, propertyKey) {
|
|
6527
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6528
|
+
return query(":host", {})(targetOrOptions, propertyKey);
|
|
6529
|
+
}
|
|
6530
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6531
|
+
return query(":host", targetOrOptions);
|
|
6532
|
+
} else {
|
|
6533
|
+
return query(":host", {});
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
var host = queryHost;
|
|
6537
|
+
function parentHost(targetOrOptions, propertyKey) {
|
|
6538
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6539
|
+
return query(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6540
|
+
}
|
|
6541
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6542
|
+
return query(":parentHost", targetOrOptions);
|
|
6543
|
+
} else {
|
|
6544
|
+
return query(":parentHost", {});
|
|
6545
|
+
}
|
|
6546
|
+
}
|
|
6547
|
+
function appHost(targetOrOptions, propertyKey) {
|
|
6548
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6549
|
+
return query(":appHost", {})(targetOrOptions, propertyKey);
|
|
6550
|
+
}
|
|
6551
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6552
|
+
return query(":appHost", targetOrOptions);
|
|
6553
|
+
} else {
|
|
6554
|
+
return query(":appHost", {});
|
|
6555
|
+
}
|
|
6556
|
+
}
|
|
6557
|
+
function firstHost(targetOrOptions, propertyKey) {
|
|
6558
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6559
|
+
return query(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6560
|
+
}
|
|
6561
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6562
|
+
return query(":firstHost", targetOrOptions);
|
|
6563
|
+
} else {
|
|
6564
|
+
return query(":firstHost", {});
|
|
6565
|
+
}
|
|
6566
|
+
}
|
|
6567
|
+
function lastHost(targetOrOptions, propertyKey) {
|
|
6568
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6569
|
+
return query(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6570
|
+
}
|
|
6571
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6572
|
+
return query(":lastHost", targetOrOptions);
|
|
6573
|
+
} else {
|
|
6574
|
+
return query(":lastHost", {});
|
|
6575
|
+
}
|
|
6576
|
+
}
|
|
6577
|
+
function firstAppHost(targetOrOptions, propertyKey) {
|
|
6578
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6579
|
+
return query(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6580
|
+
}
|
|
6581
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6582
|
+
return query(":firstAppHost", targetOrOptions);
|
|
6583
|
+
} else {
|
|
6584
|
+
return query(":firstAppHost", {});
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
function lastAppHost(targetOrOptions, propertyKey) {
|
|
6588
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6589
|
+
return query(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6590
|
+
}
|
|
6591
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6592
|
+
return query(":lastAppHost", targetOrOptions);
|
|
6593
|
+
} else {
|
|
6594
|
+
return query(":lastAppHost", {});
|
|
6595
|
+
}
|
|
6333
6596
|
}
|
|
6334
6597
|
|
|
6335
6598
|
// src/decorators/queryAll.ts
|
|
@@ -6428,14 +6691,82 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6428
6691
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6429
6692
|
return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
6430
6693
|
};
|
|
6431
|
-
function queryAllHost(
|
|
6432
|
-
|
|
6694
|
+
function queryAllHost(targetOrOptions, propertyKey) {
|
|
6695
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6696
|
+
return queryAll(":host", {})(targetOrOptions, propertyKey);
|
|
6697
|
+
}
|
|
6698
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6699
|
+
return queryAll(":host", targetOrOptions);
|
|
6700
|
+
} else {
|
|
6701
|
+
return queryAll(":host", {});
|
|
6702
|
+
}
|
|
6703
|
+
}
|
|
6704
|
+
var allHost = queryAllHost;
|
|
6705
|
+
function allParentHost(targetOrOptions, propertyKey) {
|
|
6706
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6707
|
+
return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6708
|
+
}
|
|
6709
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6710
|
+
return queryAll(":parentHost", targetOrOptions);
|
|
6711
|
+
} else {
|
|
6712
|
+
return queryAll(":parentHost", {});
|
|
6713
|
+
}
|
|
6714
|
+
}
|
|
6715
|
+
function allAppHost(targetOrOptions, propertyKey) {
|
|
6716
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6717
|
+
return queryAll(":appHost", {})(targetOrOptions, propertyKey);
|
|
6718
|
+
}
|
|
6719
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6720
|
+
return queryAll(":appHost", targetOrOptions);
|
|
6721
|
+
} else {
|
|
6722
|
+
return queryAll(":appHost", {});
|
|
6723
|
+
}
|
|
6724
|
+
}
|
|
6725
|
+
function allFirstHost(targetOrOptions, propertyKey) {
|
|
6726
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6727
|
+
return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6728
|
+
}
|
|
6729
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6730
|
+
return queryAll(":firstHost", targetOrOptions);
|
|
6731
|
+
} else {
|
|
6732
|
+
return queryAll(":firstHost", {});
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6735
|
+
function allLastHost(targetOrOptions, propertyKey) {
|
|
6736
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6737
|
+
return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6738
|
+
}
|
|
6739
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6740
|
+
return queryAll(":lastHost", targetOrOptions);
|
|
6741
|
+
} else {
|
|
6742
|
+
return queryAll(":lastHost", {});
|
|
6743
|
+
}
|
|
6744
|
+
}
|
|
6745
|
+
function allFirstAppHost(targetOrOptions, propertyKey) {
|
|
6746
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6747
|
+
return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6748
|
+
}
|
|
6749
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6750
|
+
return queryAll(":firstAppHost", targetOrOptions);
|
|
6751
|
+
} else {
|
|
6752
|
+
return queryAll(":firstAppHost", {});
|
|
6753
|
+
}
|
|
6754
|
+
}
|
|
6755
|
+
function allLastAppHost(targetOrOptions, propertyKey) {
|
|
6756
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6757
|
+
return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6758
|
+
}
|
|
6759
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6760
|
+
return queryAll(":lastAppHost", targetOrOptions);
|
|
6761
|
+
} else {
|
|
6762
|
+
return queryAll(":lastAppHost", {});
|
|
6763
|
+
}
|
|
6433
6764
|
}
|
|
6434
6765
|
|
|
6435
6766
|
// src/decorators/classList.ts
|
|
6436
6767
|
var CLASS_LIST_METADATA_KEY = Symbol("simple-web-component:class-list");
|
|
6437
6768
|
function createClassListDecorator(action) {
|
|
6438
|
-
return (selector) => {
|
|
6769
|
+
return (selector, options = {}) => {
|
|
6439
6770
|
return (target, propertyKey, descriptor) => {
|
|
6440
6771
|
const constructor = target.constructor;
|
|
6441
6772
|
let metaList = ReflectUtils.getOwnMetadata(CLASS_LIST_METADATA_KEY, constructor);
|
|
@@ -6443,19 +6774,52 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6443
6774
|
metaList = /* @__PURE__ */ new Map();
|
|
6444
6775
|
ReflectUtils.defineMetadata(CLASS_LIST_METADATA_KEY, metaList, constructor);
|
|
6445
6776
|
}
|
|
6446
|
-
metaList.set(propertyKey, { propertyKey, selector, action });
|
|
6777
|
+
metaList.set(propertyKey, { propertyKey, selector, action, options });
|
|
6447
6778
|
const original = descriptor.value;
|
|
6448
6779
|
descriptor.value = async function(...args) {
|
|
6449
6780
|
ensureInit2(this);
|
|
6450
6781
|
const res = await original.apply(this, args);
|
|
6451
6782
|
if (res !== void 0) {
|
|
6783
|
+
const r = options.root || "auto";
|
|
6452
6784
|
const hostSet = SwcUtils.getHostSet(this);
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6785
|
+
const targetEls = [];
|
|
6786
|
+
const applyRoot = (t) => {
|
|
6787
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
6788
|
+
if (r === "auto") {
|
|
6789
|
+
targetEls.push(t);
|
|
6790
|
+
} else {
|
|
6791
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6792
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6793
|
+
}
|
|
6794
|
+
}
|
|
6795
|
+
};
|
|
6796
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6797
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6798
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6799
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6800
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6801
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6802
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6803
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6804
|
+
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6805
|
+
else {
|
|
6806
|
+
if (r === "shadow") {
|
|
6807
|
+
const found = this.shadowRoot?.querySelectorAll(selector);
|
|
6808
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6809
|
+
} else if (r === "light") {
|
|
6810
|
+
const found = this.querySelectorAll(selector);
|
|
6811
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6812
|
+
} else if (r === "all") {
|
|
6813
|
+
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6814
|
+
const lFound = this.querySelectorAll(selector);
|
|
6815
|
+
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6816
|
+
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6817
|
+
} else {
|
|
6818
|
+
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6819
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6820
|
+
}
|
|
6821
|
+
}
|
|
6822
|
+
targetEls.forEach((targetEl) => {
|
|
6459
6823
|
if (action === "set") {
|
|
6460
6824
|
let classes = "";
|
|
6461
6825
|
if (typeof res === "object" && res !== null && !Array.isArray(res)) {
|
|
@@ -6483,23 +6847,53 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6483
6847
|
const classes = Array.isArray(res) ? res.map(String) : [String(res)];
|
|
6484
6848
|
classes.forEach((c) => targetEl.classList.toggle(c));
|
|
6485
6849
|
}
|
|
6486
|
-
}
|
|
6850
|
+
});
|
|
6487
6851
|
}
|
|
6488
6852
|
return res;
|
|
6489
6853
|
};
|
|
6490
6854
|
};
|
|
6491
6855
|
};
|
|
6492
6856
|
}
|
|
6493
|
-
var setClassList = createClassListDecorator("set");
|
|
6494
|
-
var updateClassList = createClassListDecorator("update");
|
|
6495
|
-
var addClassList = createClassListDecorator("add");
|
|
6496
|
-
var removeClassList = createClassListDecorator("remove");
|
|
6497
|
-
var toggleClassList = createClassListDecorator("toggle");
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6857
|
+
var setClassList = (selector, options = {}) => createClassListDecorator("set")(selector, options);
|
|
6858
|
+
var updateClassList = (selector, options = {}) => createClassListDecorator("update")(selector, options);
|
|
6859
|
+
var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
|
|
6860
|
+
var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
|
|
6861
|
+
var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
|
|
6862
|
+
function setClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6863
|
+
if (propertyKey !== void 0) {
|
|
6864
|
+
const decorator = createClassListDecorator("set")(":host", {});
|
|
6865
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6866
|
+
}
|
|
6867
|
+
return createClassListDecorator("set")(":host", targetOrOptions || {});
|
|
6868
|
+
}
|
|
6869
|
+
function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6870
|
+
if (propertyKey !== void 0) {
|
|
6871
|
+
const decorator = createClassListDecorator("update")(":host", {});
|
|
6872
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6873
|
+
}
|
|
6874
|
+
return createClassListDecorator("update")(":host", targetOrOptions || {});
|
|
6875
|
+
}
|
|
6876
|
+
function addClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6877
|
+
if (propertyKey !== void 0) {
|
|
6878
|
+
const decorator = createClassListDecorator("add")(":host", {});
|
|
6879
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6880
|
+
}
|
|
6881
|
+
return createClassListDecorator("add")(":host", targetOrOptions || {});
|
|
6882
|
+
}
|
|
6883
|
+
function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6884
|
+
if (propertyKey !== void 0) {
|
|
6885
|
+
const decorator = createClassListDecorator("remove")(":host", {});
|
|
6886
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6887
|
+
}
|
|
6888
|
+
return createClassListDecorator("remove")(":host", targetOrOptions || {});
|
|
6889
|
+
}
|
|
6890
|
+
function toggleClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6891
|
+
if (propertyKey !== void 0) {
|
|
6892
|
+
const decorator = createClassListDecorator("toggle")(":host", {});
|
|
6893
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6894
|
+
}
|
|
6895
|
+
return createClassListDecorator("toggle")(":host", targetOrOptions || {});
|
|
6896
|
+
}
|
|
6503
6897
|
var findAllClassListMetadata = (target) => {
|
|
6504
6898
|
const result = /* @__PURE__ */ new Map();
|
|
6505
6899
|
const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
|
|
@@ -6514,7 +6908,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6514
6908
|
// src/decorators/style.ts
|
|
6515
6909
|
var STYLE_METADATA_KEY = Symbol("simple-web-component:style");
|
|
6516
6910
|
function createStyleDecorator(action) {
|
|
6517
|
-
return (selector) => {
|
|
6911
|
+
return (selector, options = {}) => {
|
|
6518
6912
|
return (target, propertyKey, descriptor) => {
|
|
6519
6913
|
const constructor = target.constructor;
|
|
6520
6914
|
let metaList = ReflectUtils.getOwnMetadata(STYLE_METADATA_KEY, constructor);
|
|
@@ -6522,19 +6916,52 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6522
6916
|
metaList = /* @__PURE__ */ new Map();
|
|
6523
6917
|
ReflectUtils.defineMetadata(STYLE_METADATA_KEY, metaList, constructor);
|
|
6524
6918
|
}
|
|
6525
|
-
metaList.set(propertyKey, { propertyKey, selector, action });
|
|
6919
|
+
metaList.set(propertyKey, { propertyKey, selector, action, options });
|
|
6526
6920
|
const original = descriptor.value;
|
|
6527
6921
|
descriptor.value = async function(...args) {
|
|
6528
6922
|
ensureInit2(this);
|
|
6529
6923
|
const res = await original.apply(this, args);
|
|
6530
6924
|
if (res !== void 0) {
|
|
6925
|
+
const r = options.root || "auto";
|
|
6531
6926
|
const hostSet = SwcUtils.getHostSet(this);
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6927
|
+
const targetEls = [];
|
|
6928
|
+
const applyRoot = (t) => {
|
|
6929
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
6930
|
+
if (r === "auto") {
|
|
6931
|
+
targetEls.push(t);
|
|
6932
|
+
} else {
|
|
6933
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6934
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
};
|
|
6938
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6939
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6940
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6941
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6942
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6943
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6944
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6945
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6946
|
+
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6947
|
+
else {
|
|
6948
|
+
if (r === "shadow") {
|
|
6949
|
+
const found = this.shadowRoot?.querySelectorAll(selector);
|
|
6950
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6951
|
+
} else if (r === "light") {
|
|
6952
|
+
const found = this.querySelectorAll(selector);
|
|
6953
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6954
|
+
} else if (r === "all") {
|
|
6955
|
+
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6956
|
+
const lFound = this.querySelectorAll(selector);
|
|
6957
|
+
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6958
|
+
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6959
|
+
} else {
|
|
6960
|
+
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6961
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6962
|
+
}
|
|
6963
|
+
}
|
|
6964
|
+
targetEls.forEach((targetEl) => {
|
|
6538
6965
|
if (action === "set") {
|
|
6539
6966
|
targetEl.style.cssText = "";
|
|
6540
6967
|
if (typeof res === "object" && res !== null) {
|
|
@@ -6550,16 +6977,37 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6550
6977
|
const props = Array.isArray(res) ? res : [res];
|
|
6551
6978
|
props.forEach((p) => targetEl.style.removeProperty(String(p)));
|
|
6552
6979
|
}
|
|
6553
|
-
}
|
|
6980
|
+
});
|
|
6554
6981
|
}
|
|
6555
6982
|
return res;
|
|
6556
6983
|
};
|
|
6557
6984
|
};
|
|
6558
6985
|
};
|
|
6559
6986
|
}
|
|
6560
|
-
var setStyle = createStyleDecorator("set");
|
|
6561
|
-
|
|
6562
|
-
|
|
6987
|
+
var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
|
|
6988
|
+
function setStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6989
|
+
if (propertyKey !== void 0) {
|
|
6990
|
+
const decorator = createStyleDecorator("set")(":host", {});
|
|
6991
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6992
|
+
}
|
|
6993
|
+
return createStyleDecorator("set")(":host", targetOrOptions || {});
|
|
6994
|
+
}
|
|
6995
|
+
var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
|
|
6996
|
+
function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6997
|
+
if (propertyKey !== void 0) {
|
|
6998
|
+
const decorator = createStyleDecorator("update")(":host", {});
|
|
6999
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
7000
|
+
}
|
|
7001
|
+
return createStyleDecorator("update")(":host", targetOrOptions || {});
|
|
7002
|
+
}
|
|
7003
|
+
var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
|
|
7004
|
+
function removeStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
7005
|
+
if (propertyKey !== void 0) {
|
|
7006
|
+
const decorator = createStyleDecorator("remove")(":host", {});
|
|
7007
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
7008
|
+
}
|
|
7009
|
+
return createStyleDecorator("remove")(":host", targetOrOptions || {});
|
|
7010
|
+
}
|
|
6563
7011
|
var findAllStyleMetadata = (target) => {
|
|
6564
7012
|
const result = /* @__PURE__ */ new Map();
|
|
6565
7013
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -6573,6 +7021,131 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6573
7021
|
|
|
6574
7022
|
// src/utils/Utils.ts
|
|
6575
7023
|
var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
|
|
7024
|
+
var htmlFragment = (html, doc) => {
|
|
7025
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7026
|
+
if (!d) throw new Error("Document is not available");
|
|
7027
|
+
const template = d.createElement("template");
|
|
7028
|
+
template.innerHTML = html.trim();
|
|
7029
|
+
return template.content;
|
|
7030
|
+
};
|
|
7031
|
+
var textNode = (text, doc) => {
|
|
7032
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7033
|
+
if (!d) throw new Error("Document is not available");
|
|
7034
|
+
return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
|
|
7035
|
+
};
|
|
7036
|
+
var commentNode = (comment, doc) => {
|
|
7037
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
7038
|
+
if (!d) throw new Error("Document is not available");
|
|
7039
|
+
return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
|
|
7040
|
+
};
|
|
7041
|
+
var createElement = (tagName, options) => {
|
|
7042
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7043
|
+
if (!d) throw new Error("Document is not available");
|
|
7044
|
+
const el = d.createElement(tagName);
|
|
7045
|
+
if (options?.html) el.innerHTML = options.html;
|
|
7046
|
+
if (options?.attrs) {
|
|
7047
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7048
|
+
}
|
|
7049
|
+
return el;
|
|
7050
|
+
};
|
|
7051
|
+
var htmlDivElement = (html, options) => {
|
|
7052
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7053
|
+
if (!d) throw new Error("Document is not available");
|
|
7054
|
+
const el = d.createElement("div");
|
|
7055
|
+
el.innerHTML = html.trim();
|
|
7056
|
+
if (options?.attrs) {
|
|
7057
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7058
|
+
}
|
|
7059
|
+
return el;
|
|
7060
|
+
};
|
|
7061
|
+
var htmlSpanElement = (html, options) => {
|
|
7062
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7063
|
+
if (!d) throw new Error("Document is not available");
|
|
7064
|
+
const el = d.createElement("span");
|
|
7065
|
+
el.innerHTML = html.trim();
|
|
7066
|
+
if (options?.attrs) {
|
|
7067
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7068
|
+
}
|
|
7069
|
+
return el;
|
|
7070
|
+
};
|
|
7071
|
+
var htmlButtonElement = (html, options) => {
|
|
7072
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7073
|
+
if (!d) throw new Error("Document is not available");
|
|
7074
|
+
const el = d.createElement("button");
|
|
7075
|
+
el.innerHTML = html.trim();
|
|
7076
|
+
if (options?.attrs) {
|
|
7077
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7078
|
+
}
|
|
7079
|
+
return el;
|
|
7080
|
+
};
|
|
7081
|
+
var htmlUlElement = (options) => {
|
|
7082
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7083
|
+
if (!d) throw new Error("Document is not available");
|
|
7084
|
+
const el = d.createElement("ul");
|
|
7085
|
+
if (options?.attrs) {
|
|
7086
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7087
|
+
}
|
|
7088
|
+
return el;
|
|
7089
|
+
};
|
|
7090
|
+
var htmlLiElement = (html, options) => {
|
|
7091
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7092
|
+
if (!d) throw new Error("Document is not available");
|
|
7093
|
+
const el = d.createElement("li");
|
|
7094
|
+
el.innerHTML = html.trim();
|
|
7095
|
+
if (options?.attrs) {
|
|
7096
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7097
|
+
}
|
|
7098
|
+
return el;
|
|
7099
|
+
};
|
|
7100
|
+
var htmlAElement = (html, options) => {
|
|
7101
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7102
|
+
if (!d) throw new Error("Document is not available");
|
|
7103
|
+
const el = d.createElement("a");
|
|
7104
|
+
el.innerHTML = html.trim();
|
|
7105
|
+
if (options?.href) el.href = options.href;
|
|
7106
|
+
if (options?.attrs) {
|
|
7107
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7108
|
+
}
|
|
7109
|
+
return el;
|
|
7110
|
+
};
|
|
7111
|
+
var htmlPElement = (html, options) => {
|
|
7112
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7113
|
+
if (!d) throw new Error("Document is not available");
|
|
7114
|
+
const el = d.createElement("p");
|
|
7115
|
+
el.innerHTML = html.trim();
|
|
7116
|
+
if (options?.attrs) {
|
|
7117
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7118
|
+
}
|
|
7119
|
+
return el;
|
|
7120
|
+
};
|
|
7121
|
+
var htmlHeadingElement = (level, html, options) => {
|
|
7122
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7123
|
+
if (!d) throw new Error("Document is not available");
|
|
7124
|
+
const el = d.createElement(`h${level}`);
|
|
7125
|
+
el.innerHTML = html.trim();
|
|
7126
|
+
if (options?.attrs) {
|
|
7127
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7128
|
+
}
|
|
7129
|
+
return el;
|
|
7130
|
+
};
|
|
7131
|
+
var htmlSectionElement = (options) => {
|
|
7132
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7133
|
+
if (!d) throw new Error("Document is not available");
|
|
7134
|
+
const el = d.createElement("section");
|
|
7135
|
+
if (options?.attrs) {
|
|
7136
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7137
|
+
}
|
|
7138
|
+
return el;
|
|
7139
|
+
};
|
|
7140
|
+
var htmlArticleElement = (options) => {
|
|
7141
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
7142
|
+
if (!d) throw new Error("Document is not available");
|
|
7143
|
+
const el = d.createElement("article");
|
|
7144
|
+
if (options?.attrs) {
|
|
7145
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7146
|
+
}
|
|
7147
|
+
return el;
|
|
7148
|
+
};
|
|
6576
7149
|
var SwcUtils;
|
|
6577
7150
|
((SwcUtils2) => {
|
|
6578
7151
|
SwcUtils2.getHelperSet = (win) => {
|
|
@@ -6635,7 +7208,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6635
7208
|
};
|
|
6636
7209
|
SwcUtils2.getAppHosts = (el) => {
|
|
6637
7210
|
const hosts = (0, SwcUtils2.getHosts)(el);
|
|
6638
|
-
return hosts.filter((
|
|
7211
|
+
return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
|
|
6639
7212
|
};
|
|
6640
7213
|
SwcUtils2.getAppHost = (el) => {
|
|
6641
7214
|
const appHosts = (0, SwcUtils2.getAppHosts)(el);
|
|
@@ -6892,9 +7465,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6892
7465
|
if (!(node instanceof HTMLElement)) continue;
|
|
6893
7466
|
const script = node.getAttribute?.(attrName);
|
|
6894
7467
|
if (script && !getElementConfig(node)) {
|
|
6895
|
-
const
|
|
6896
|
-
if (
|
|
6897
|
-
await
|
|
7468
|
+
const host2 = SwcUtils.findNearestSwcHost(node);
|
|
7469
|
+
if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
|
|
7470
|
+
await host2.__swc_executeAttributeEvent(node, attrName, script, event);
|
|
6898
7471
|
event.__swc_handled = true;
|
|
6899
7472
|
break;
|
|
6900
7473
|
}
|
|
@@ -8092,69 +8665,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8092
8665
|
return /Mobi/i.test(targetWindow.navigator.userAgent);
|
|
8093
8666
|
};
|
|
8094
8667
|
})(ValidUtils2 || (ValidUtils2 = {}));
|
|
8095
|
-
|
|
8096
|
-
// src/utils/TemplateUtils.ts
|
|
8097
|
-
var TemplateUtils;
|
|
8098
|
-
((TemplateUtils2) => {
|
|
8099
|
-
TemplateUtils2.htmlFragment = (strings, ...values) => {
|
|
8100
|
-
const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8101
|
-
const template = document.createElement("template");
|
|
8102
|
-
template.innerHTML = raw.trim();
|
|
8103
|
-
return template.content;
|
|
8104
|
-
};
|
|
8105
|
-
TemplateUtils2.textNode = (strings, ...values) => {
|
|
8106
|
-
const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8107
|
-
return document.createTextNode(raw);
|
|
8108
|
-
};
|
|
8109
|
-
TemplateUtils2.createElement = (info, attrs = {}) => {
|
|
8110
|
-
const el = document.createElement(info.tagName);
|
|
8111
|
-
if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
|
|
8112
|
-
Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
8113
|
-
return el;
|
|
8114
|
-
};
|
|
8115
|
-
const createTagFunction = (tagName) => {
|
|
8116
|
-
return (strings, ...values) => {
|
|
8117
|
-
const el = document.createElement(tagName);
|
|
8118
|
-
el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8119
|
-
return el;
|
|
8120
|
-
};
|
|
8121
|
-
};
|
|
8122
|
-
TemplateUtils2.htmlDivElement = createTagFunction("div");
|
|
8123
|
-
TemplateUtils2.htmlSpanElement = createTagFunction("span");
|
|
8124
|
-
TemplateUtils2.htmlButtonElement = createTagFunction("button");
|
|
8125
|
-
TemplateUtils2.htmlUlElement = createTagFunction("ul");
|
|
8126
|
-
TemplateUtils2.htmlLiElement = createTagFunction("li");
|
|
8127
|
-
TemplateUtils2.htmlInputElement = createTagFunction("input");
|
|
8128
|
-
TemplateUtils2.htmlAElement = createTagFunction("a");
|
|
8129
|
-
TemplateUtils2.htmlPElement = createTagFunction("p");
|
|
8130
|
-
TemplateUtils2.htmlH1Element = createTagFunction("h1");
|
|
8131
|
-
TemplateUtils2.htmlH2Element = createTagFunction("h2");
|
|
8132
|
-
TemplateUtils2.htmlH3Element = createTagFunction("h3");
|
|
8133
|
-
TemplateUtils2.htmlH4Element = createTagFunction("h4");
|
|
8134
|
-
TemplateUtils2.htmlH5Element = createTagFunction("h5");
|
|
8135
|
-
TemplateUtils2.htmlH6Element = createTagFunction("h6");
|
|
8136
|
-
TemplateUtils2.htmlSectionElement = createTagFunction("section");
|
|
8137
|
-
TemplateUtils2.htmlArticleElement = createTagFunction("article");
|
|
8138
|
-
})(TemplateUtils || (TemplateUtils = {}));
|
|
8139
|
-
var htmlFragment = TemplateUtils.htmlFragment;
|
|
8140
|
-
var textNode = TemplateUtils.textNode;
|
|
8141
|
-
var createElement = TemplateUtils.createElement;
|
|
8142
|
-
var htmlDivElement = TemplateUtils.htmlDivElement;
|
|
8143
|
-
var htmlSpanElement = TemplateUtils.htmlSpanElement;
|
|
8144
|
-
var htmlButtonElement = TemplateUtils.htmlButtonElement;
|
|
8145
|
-
var htmlUlElement = TemplateUtils.htmlUlElement;
|
|
8146
|
-
var htmlLiElement = TemplateUtils.htmlLiElement;
|
|
8147
|
-
var htmlInputElement = TemplateUtils.htmlInputElement;
|
|
8148
|
-
var htmlAElement = TemplateUtils.htmlAElement;
|
|
8149
|
-
var htmlPElement = TemplateUtils.htmlPElement;
|
|
8150
|
-
var htmlH1Element = TemplateUtils.htmlH1Element;
|
|
8151
|
-
var htmlH2Element = TemplateUtils.htmlH2Element;
|
|
8152
|
-
var htmlH3Element = TemplateUtils.htmlH3Element;
|
|
8153
|
-
var htmlH4Element = TemplateUtils.htmlH4Element;
|
|
8154
|
-
var htmlH5Element = TemplateUtils.htmlH5Element;
|
|
8155
|
-
var htmlH6Element = TemplateUtils.htmlH6Element;
|
|
8156
|
-
var htmlSectionElement = TemplateUtils.htmlSectionElement;
|
|
8157
|
-
var htmlArticleElement = TemplateUtils.htmlArticleElement;
|
|
8158
8668
|
return __toCommonJS(bundle_entry_exports);
|
|
8159
8669
|
})();
|
|
8160
8670
|
/*! Bundled license information:
|