@dooboostore/simple-web-component 1.0.23 → 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 +238 -44
- package/dist/cjs/decorators/applyNode.js +129 -34
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/attribute.js +21 -2
- package/dist/cjs/decorators/attribute.js.map +2 -2
- package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
- package/dist/cjs/decorators/classList.js +60 -17
- package/dist/cjs/decorators/classList.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 +46 -15
- 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 +129 -34
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/attribute.js +21 -2
- package/dist/esm/decorators/attribute.js.map +2 -2
- package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
- package/dist/esm/decorators/classList.js +60 -17
- package/dist/esm/decorators/classList.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 +46 -15
- 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 +542 -155
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/applyNode.d.ts +49 -27
- 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 +15 -5
- package/dist/types/decorators/classList.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +68 -4
- 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 +17 -8
- 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 +542 -155
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +3 -3
- package/src/decorators/applyNode.ts +179 -60
- package/src/decorators/attribute.ts +43 -10
- package/src/decorators/changedAttributeHost.ts +1 -1
- package/src/decorators/classList.ts +79 -17
- package/src/decorators/query.ts +147 -5
- package/src/decorators/queryAll.ts +148 -2
- package/src/decorators/setAttribute.ts +6 -5
- package/src/decorators/style.ts +67 -22
- package/src/index.ts +6 -6
- package/src/utils/Utils.ts +144 -0
- package/dist/cjs/utils/TemplateUtils.js +0 -109
- package/dist/cjs/utils/TemplateUtils.js.map +0 -7
- package/dist/esm/utils/TemplateUtils.js +0 -90
- package/dist/esm/utils/TemplateUtils.js.map +0 -7
- package/dist/types/utils/TemplateUtils.d.ts +0 -59
- package/dist/types/utils/TemplateUtils.d.ts.map +0 -1
- package/src/utils/TemplateUtils.ts +0 -92
|
@@ -5924,8 +5924,27 @@ function attribute(selector, options = {}) {
|
|
|
5924
5924
|
var findAllAttributeMetadata = (target) => {
|
|
5925
5925
|
return ReflectUtils.findAllMetadata(ATTRIBUTE_METADATA_KEY, target).flat();
|
|
5926
5926
|
};
|
|
5927
|
-
function attributeHost(
|
|
5928
|
-
|
|
5927
|
+
function attributeHost(targetOrAttrOrOptions, propertyKeyOrOptions) {
|
|
5928
|
+
if (propertyKeyOrOptions !== void 0 && (typeof propertyKeyOrOptions === "string" || typeof propertyKeyOrOptions === "symbol")) {
|
|
5929
|
+
const fieldName = String(propertyKeyOrOptions);
|
|
5930
|
+
return attribute(":host", { name: fieldName })(targetOrAttrOrOptions, propertyKeyOrOptions);
|
|
5931
|
+
}
|
|
5932
|
+
if (typeof targetOrAttrOrOptions === "string") {
|
|
5933
|
+
const attrName = targetOrAttrOrOptions;
|
|
5934
|
+
const options = typeof propertyKeyOrOptions === "object" ? propertyKeyOrOptions : {};
|
|
5935
|
+
return attribute(":host", { ...options, name: attrName });
|
|
5936
|
+
} else if (typeof targetOrAttrOrOptions === "object") {
|
|
5937
|
+
const options = targetOrAttrOrOptions;
|
|
5938
|
+
return (target, propertyKey) => {
|
|
5939
|
+
const fieldName = String(propertyKey);
|
|
5940
|
+
return attribute(":host", { ...options, name: fieldName })(target, propertyKey);
|
|
5941
|
+
};
|
|
5942
|
+
} else {
|
|
5943
|
+
return (target, propertyKey) => {
|
|
5944
|
+
const fieldName = String(propertyKey);
|
|
5945
|
+
return attribute(":host", { name: fieldName })(target, propertyKey);
|
|
5946
|
+
};
|
|
5947
|
+
}
|
|
5929
5948
|
}
|
|
5930
5949
|
|
|
5931
5950
|
// src/decorators/changedAttributeHost.ts
|
|
@@ -5979,11 +5998,11 @@ function setAttribute(selector, name, options = {}) {
|
|
|
5979
5998
|
const applyRoot = (t) => {
|
|
5980
5999
|
if (!t) return;
|
|
5981
6000
|
if (r === "auto") {
|
|
5982
|
-
targetEls.push(t
|
|
5983
|
-
|
|
6001
|
+
targetEls.push(t);
|
|
6002
|
+
} else {
|
|
6003
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6004
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
5984
6005
|
}
|
|
5985
|
-
if (r === "light" || r === "all") targetEls.push(t);
|
|
5986
|
-
if ((r === "shadow" || r === "all") && t.shadowRoot) targetEls.push(t.shadowRoot);
|
|
5987
6006
|
};
|
|
5988
6007
|
if (selector === ":window") targetEls.push(currentWin);
|
|
5989
6008
|
else if (selector === ":document") targetEls.push(currentWin.document);
|
|
@@ -6067,15 +6086,20 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
|
6067
6086
|
const currentDoc = currentWin.document;
|
|
6068
6087
|
const pos = options.position || "beforeEnd";
|
|
6069
6088
|
const r = options.root || "auto";
|
|
6070
|
-
const
|
|
6089
|
+
const applyRoot = (t) => {
|
|
6090
|
+
if (!t || !(t instanceof HTMLElement))
|
|
6091
|
+
return t;
|
|
6092
|
+
if (r === "auto")
|
|
6093
|
+
return t.shadowRoot || t;
|
|
6071
6094
|
if (r === "shadow")
|
|
6072
|
-
return
|
|
6095
|
+
return t.shadowRoot;
|
|
6073
6096
|
if (r === "light")
|
|
6074
|
-
return
|
|
6097
|
+
return t;
|
|
6075
6098
|
if (r === "all")
|
|
6076
|
-
return
|
|
6077
|
-
return
|
|
6099
|
+
return t.shadowRoot || t;
|
|
6100
|
+
return t;
|
|
6078
6101
|
};
|
|
6102
|
+
const hostSet = SwcUtils.getHostSet(this);
|
|
6079
6103
|
if (pos === "remove") {
|
|
6080
6104
|
if (res) {
|
|
6081
6105
|
if (selector === ":host" || !selector) {
|
|
@@ -6085,7 +6109,7 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
|
6085
6109
|
this.remove();
|
|
6086
6110
|
}
|
|
6087
6111
|
} else {
|
|
6088
|
-
const targetRoot =
|
|
6112
|
+
const targetRoot = applyRoot(this);
|
|
6089
6113
|
if (targetRoot) {
|
|
6090
6114
|
const targets = targetRoot.querySelectorAll(selector);
|
|
6091
6115
|
targets.forEach((el) => el.remove());
|
|
@@ -6094,14 +6118,22 @@ function applyNode(selector, options = { position: "beforeEnd" }) {
|
|
|
6094
6118
|
}
|
|
6095
6119
|
} else {
|
|
6096
6120
|
let targetEl = null;
|
|
6097
|
-
if (selector === ":host"
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6121
|
+
if (selector === ":host") {
|
|
6122
|
+
targetEl = applyRoot(this);
|
|
6123
|
+
} else if (selector === ":parentHost") {
|
|
6124
|
+
targetEl = applyRoot(hostSet.$parentHost);
|
|
6125
|
+
} else if (selector === ":appHost") {
|
|
6126
|
+
targetEl = applyRoot(hostSet.$appHost);
|
|
6127
|
+
} else if (selector === ":firstHost") {
|
|
6128
|
+
targetEl = applyRoot(hostSet.$firstHost);
|
|
6129
|
+
} else if (selector === ":lastHost") {
|
|
6130
|
+
targetEl = applyRoot(hostSet.$lastHost);
|
|
6131
|
+
} else if (selector === ":firstAppHost") {
|
|
6132
|
+
targetEl = applyRoot(hostSet.$firstHost);
|
|
6133
|
+
} else if (selector === ":lastAppHost") {
|
|
6134
|
+
targetEl = applyRoot(hostSet.$lastAppHost);
|
|
6103
6135
|
} else {
|
|
6104
|
-
const targetRoot =
|
|
6136
|
+
const targetRoot = applyRoot(this);
|
|
6105
6137
|
targetEl = targetRoot ? targetRoot.querySelector(selector) : null;
|
|
6106
6138
|
}
|
|
6107
6139
|
if (targetEl) {
|
|
@@ -6146,27 +6178,108 @@ var findAllApplyNodeMetadata = (target) => {
|
|
|
6146
6178
|
});
|
|
6147
6179
|
return result;
|
|
6148
6180
|
};
|
|
6149
|
-
function applyNodeHost(
|
|
6150
|
-
|
|
6181
|
+
function applyNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6182
|
+
console.log("vvvvv");
|
|
6183
|
+
if (propertyKey !== void 0 && typeof propertyKey === "string" || typeof propertyKey === "symbol") {
|
|
6184
|
+
return applyNode(":host", { position: "beforeEnd" })(targetOrOptions, propertyKey, descriptor);
|
|
6185
|
+
}
|
|
6186
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6187
|
+
const options = targetOrOptions;
|
|
6188
|
+
return applyNode(":host", { ...options, position: options.position || "beforeEnd" });
|
|
6189
|
+
} else {
|
|
6190
|
+
return applyNode(":host", { position: "beforeEnd" });
|
|
6191
|
+
}
|
|
6192
|
+
}
|
|
6193
|
+
function applyBeforeBeginNode(selector, options) {
|
|
6194
|
+
return applyNode(selector, { ...options, position: "beforeBegin" });
|
|
6195
|
+
}
|
|
6196
|
+
function applyAfterBeginNode(selector, options) {
|
|
6197
|
+
return applyNode(selector, { ...options, position: "afterBegin" });
|
|
6198
|
+
}
|
|
6199
|
+
function applyBeforeEndNode(selector, options) {
|
|
6200
|
+
return applyNode(selector, { ...options, position: "beforeEnd" });
|
|
6201
|
+
}
|
|
6202
|
+
function applyAfterEndNode(selector, options) {
|
|
6203
|
+
return applyNode(selector, { ...options, position: "afterEnd" });
|
|
6204
|
+
}
|
|
6205
|
+
function applyReplaceNode(selector, options) {
|
|
6206
|
+
return applyNode(selector, { ...options, position: "replace" });
|
|
6207
|
+
}
|
|
6208
|
+
function applyReplaceChildrenNode(selector, options) {
|
|
6209
|
+
return applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6210
|
+
}
|
|
6211
|
+
function applyInnerHtmlNode(selector, options) {
|
|
6212
|
+
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
6213
|
+
}
|
|
6214
|
+
function applyInnerTextNode(selector, options) {
|
|
6215
|
+
return applyNode(selector, { ...options, position: "innerText" });
|
|
6216
|
+
}
|
|
6217
|
+
function applyRemoveNode(selector, options) {
|
|
6218
|
+
return applyNode(selector, { ...options, position: "remove" });
|
|
6219
|
+
}
|
|
6220
|
+
function applyBeforeBeginNodeHost(targetOrOptions, propertyKey, descriptor) {
|
|
6221
|
+
if (propertyKey !== void 0) {
|
|
6222
|
+
const decorator = applyNode(":host", { position: "beforeBegin" });
|
|
6223
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6224
|
+
}
|
|
6225
|
+
return applyNode(":host", { ...targetOrOptions || {}, position: "beforeBegin" });
|
|
6226
|
+
}
|
|
6227
|
+
function applyAfterBeginNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6228
|
+
if (propertyKey !== void 0) {
|
|
6229
|
+
const decorator = applyNode(":host", { position: "afterBegin" });
|
|
6230
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6231
|
+
}
|
|
6232
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterBegin" });
|
|
6233
|
+
}
|
|
6234
|
+
function applyBeforeEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6235
|
+
if (propertyKey !== void 0) {
|
|
6236
|
+
const decorator = applyNode(":host", { position: "beforeEnd" });
|
|
6237
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6238
|
+
}
|
|
6239
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "beforeEnd" });
|
|
6240
|
+
}
|
|
6241
|
+
function applyAfterEndNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6242
|
+
if (propertyKey !== void 0) {
|
|
6243
|
+
const decorator = applyNode(":host", { position: "afterEnd" });
|
|
6244
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6245
|
+
}
|
|
6246
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "afterEnd" });
|
|
6247
|
+
}
|
|
6248
|
+
function applyReplaceNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6249
|
+
if (propertyKey !== void 0) {
|
|
6250
|
+
const decorator = applyNode(":host", { position: "replace" });
|
|
6251
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6252
|
+
}
|
|
6253
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "replace" });
|
|
6254
|
+
}
|
|
6255
|
+
function applyReplaceChildrenNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6256
|
+
if (propertyKey !== void 0) {
|
|
6257
|
+
const decorator = applyNode(":host", { position: "replaceChildren" });
|
|
6258
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6259
|
+
}
|
|
6260
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "replaceChildren" });
|
|
6261
|
+
}
|
|
6262
|
+
function applyInnerHtmlNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6263
|
+
if (propertyKey !== void 0) {
|
|
6264
|
+
const decorator = applyNode(":host", { position: "innerHtml" });
|
|
6265
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6266
|
+
}
|
|
6267
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerHtml" });
|
|
6268
|
+
}
|
|
6269
|
+
function applyInnerTextNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6270
|
+
if (propertyKey !== void 0) {
|
|
6271
|
+
const decorator = applyNode(":host", { position: "innerText" });
|
|
6272
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6273
|
+
}
|
|
6274
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "innerText" });
|
|
6275
|
+
}
|
|
6276
|
+
function applyRemoveNodeHost(optionsOrTarget, propertyKey, descriptor) {
|
|
6277
|
+
if (propertyKey !== void 0) {
|
|
6278
|
+
const decorator = applyNode(":host", { position: "remove" });
|
|
6279
|
+
return decorator(optionsOrTarget, propertyKey, descriptor);
|
|
6280
|
+
}
|
|
6281
|
+
return applyNode(":host", { ...optionsOrTarget || {}, position: "remove" });
|
|
6151
6282
|
}
|
|
6152
|
-
var applyBeforeBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeBegin" });
|
|
6153
|
-
var applyAfterBeginNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterBegin" });
|
|
6154
|
-
var applyBeforeEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "beforeEnd" });
|
|
6155
|
-
var applyAfterEndNode = (selector, options = {}) => applyNode(selector, { ...options, position: "afterEnd" });
|
|
6156
|
-
var applyReplaceNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replace" });
|
|
6157
|
-
var applyReplaceChildrenNode = (selector, options = {}) => applyNode(selector, { ...options, position: "replaceChildren" });
|
|
6158
|
-
var applyInnerHtmlNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerHtml" });
|
|
6159
|
-
var applyInnerTextNode = (selector, options = {}) => applyNode(selector, { ...options, position: "innerText" });
|
|
6160
|
-
var applyRemoveNode = (selector, options = {}) => applyNode(selector, { ...options, position: "remove" });
|
|
6161
|
-
var applyBeforeBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeBegin" });
|
|
6162
|
-
var applyAfterBeginNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterBegin" });
|
|
6163
|
-
var applyBeforeEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "beforeEnd" });
|
|
6164
|
-
var applyAfterEndNodeHost = (options = {}) => applyNode(":host", { ...options, position: "afterEnd" });
|
|
6165
|
-
var applyReplaceNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replace" });
|
|
6166
|
-
var applyReplaceChildrenNodeHost = (options = {}) => applyNode(":host", { ...options, position: "replaceChildren" });
|
|
6167
|
-
var applyInnerHtmlNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerHtml" });
|
|
6168
|
-
var applyInnerTextNodeHost = (options = {}) => applyNode(":host", { ...options, position: "innerText" });
|
|
6169
|
-
var applyRemoveNodeHost = (options = {}) => applyNode(":host", { ...options, position: "remove" });
|
|
6170
6283
|
|
|
6171
6284
|
// src/decorators/query.ts
|
|
6172
6285
|
var QUERY_METADATA_KEY = Symbol("simple-web-component:query");
|
|
@@ -6267,8 +6380,76 @@ var getQueryMetadata = (target) => {
|
|
|
6267
6380
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6268
6381
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor);
|
|
6269
6382
|
};
|
|
6270
|
-
function queryHost(
|
|
6271
|
-
|
|
6383
|
+
function queryHost(targetOrOptions, propertyKey) {
|
|
6384
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6385
|
+
return query(":host", {})(targetOrOptions, propertyKey);
|
|
6386
|
+
}
|
|
6387
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6388
|
+
return query(":host", targetOrOptions);
|
|
6389
|
+
} else {
|
|
6390
|
+
return query(":host", {});
|
|
6391
|
+
}
|
|
6392
|
+
}
|
|
6393
|
+
var host = queryHost;
|
|
6394
|
+
function parentHost(targetOrOptions, propertyKey) {
|
|
6395
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6396
|
+
return query(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6397
|
+
}
|
|
6398
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6399
|
+
return query(":parentHost", targetOrOptions);
|
|
6400
|
+
} else {
|
|
6401
|
+
return query(":parentHost", {});
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
function appHost(targetOrOptions, propertyKey) {
|
|
6405
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6406
|
+
return query(":appHost", {})(targetOrOptions, propertyKey);
|
|
6407
|
+
}
|
|
6408
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6409
|
+
return query(":appHost", targetOrOptions);
|
|
6410
|
+
} else {
|
|
6411
|
+
return query(":appHost", {});
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
function firstHost(targetOrOptions, propertyKey) {
|
|
6415
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6416
|
+
return query(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6417
|
+
}
|
|
6418
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6419
|
+
return query(":firstHost", targetOrOptions);
|
|
6420
|
+
} else {
|
|
6421
|
+
return query(":firstHost", {});
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6424
|
+
function lastHost(targetOrOptions, propertyKey) {
|
|
6425
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6426
|
+
return query(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6427
|
+
}
|
|
6428
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6429
|
+
return query(":lastHost", targetOrOptions);
|
|
6430
|
+
} else {
|
|
6431
|
+
return query(":lastHost", {});
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
function firstAppHost(targetOrOptions, propertyKey) {
|
|
6435
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6436
|
+
return query(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6437
|
+
}
|
|
6438
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6439
|
+
return query(":firstAppHost", targetOrOptions);
|
|
6440
|
+
} else {
|
|
6441
|
+
return query(":firstAppHost", {});
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
function lastAppHost(targetOrOptions, propertyKey) {
|
|
6445
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6446
|
+
return query(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6447
|
+
}
|
|
6448
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6449
|
+
return query(":lastAppHost", targetOrOptions);
|
|
6450
|
+
} else {
|
|
6451
|
+
return query(":lastAppHost", {});
|
|
6452
|
+
}
|
|
6272
6453
|
}
|
|
6273
6454
|
|
|
6274
6455
|
// src/decorators/queryAll.ts
|
|
@@ -6367,8 +6548,76 @@ var getQueryAllMetadata = (target) => {
|
|
|
6367
6548
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6368
6549
|
return ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
6369
6550
|
};
|
|
6370
|
-
function queryAllHost(
|
|
6371
|
-
|
|
6551
|
+
function queryAllHost(targetOrOptions, propertyKey) {
|
|
6552
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6553
|
+
return queryAll(":host", {})(targetOrOptions, propertyKey);
|
|
6554
|
+
}
|
|
6555
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6556
|
+
return queryAll(":host", targetOrOptions);
|
|
6557
|
+
} else {
|
|
6558
|
+
return queryAll(":host", {});
|
|
6559
|
+
}
|
|
6560
|
+
}
|
|
6561
|
+
var allHost = queryAllHost;
|
|
6562
|
+
function allParentHost(targetOrOptions, propertyKey) {
|
|
6563
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6564
|
+
return queryAll(":parentHost", {})(targetOrOptions, propertyKey);
|
|
6565
|
+
}
|
|
6566
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6567
|
+
return queryAll(":parentHost", targetOrOptions);
|
|
6568
|
+
} else {
|
|
6569
|
+
return queryAll(":parentHost", {});
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
function allAppHost(targetOrOptions, propertyKey) {
|
|
6573
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6574
|
+
return queryAll(":appHost", {})(targetOrOptions, propertyKey);
|
|
6575
|
+
}
|
|
6576
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6577
|
+
return queryAll(":appHost", targetOrOptions);
|
|
6578
|
+
} else {
|
|
6579
|
+
return queryAll(":appHost", {});
|
|
6580
|
+
}
|
|
6581
|
+
}
|
|
6582
|
+
function allFirstHost(targetOrOptions, propertyKey) {
|
|
6583
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6584
|
+
return queryAll(":firstHost", {})(targetOrOptions, propertyKey);
|
|
6585
|
+
}
|
|
6586
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6587
|
+
return queryAll(":firstHost", targetOrOptions);
|
|
6588
|
+
} else {
|
|
6589
|
+
return queryAll(":firstHost", {});
|
|
6590
|
+
}
|
|
6591
|
+
}
|
|
6592
|
+
function allLastHost(targetOrOptions, propertyKey) {
|
|
6593
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6594
|
+
return queryAll(":lastHost", {})(targetOrOptions, propertyKey);
|
|
6595
|
+
}
|
|
6596
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6597
|
+
return queryAll(":lastHost", targetOrOptions);
|
|
6598
|
+
} else {
|
|
6599
|
+
return queryAll(":lastHost", {});
|
|
6600
|
+
}
|
|
6601
|
+
}
|
|
6602
|
+
function allFirstAppHost(targetOrOptions, propertyKey) {
|
|
6603
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6604
|
+
return queryAll(":firstAppHost", {})(targetOrOptions, propertyKey);
|
|
6605
|
+
}
|
|
6606
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6607
|
+
return queryAll(":firstAppHost", targetOrOptions);
|
|
6608
|
+
} else {
|
|
6609
|
+
return queryAll(":firstAppHost", {});
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
function allLastAppHost(targetOrOptions, propertyKey) {
|
|
6613
|
+
if (propertyKey !== void 0 && (typeof propertyKey === "string" || typeof propertyKey === "symbol")) {
|
|
6614
|
+
return queryAll(":lastAppHost", {})(targetOrOptions, propertyKey);
|
|
6615
|
+
}
|
|
6616
|
+
if (typeof targetOrOptions === "object" && targetOrOptions !== null) {
|
|
6617
|
+
return queryAll(":lastAppHost", targetOrOptions);
|
|
6618
|
+
} else {
|
|
6619
|
+
return queryAll(":lastAppHost", {});
|
|
6620
|
+
}
|
|
6372
6621
|
}
|
|
6373
6622
|
|
|
6374
6623
|
// src/decorators/classList.ts
|
|
@@ -6391,27 +6640,40 @@ function createClassListDecorator(action) {
|
|
|
6391
6640
|
const r = options.root || "auto";
|
|
6392
6641
|
const hostSet = SwcUtils.getHostSet(this);
|
|
6393
6642
|
const targetEls = [];
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6643
|
+
const applyRoot = (t) => {
|
|
6644
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
6645
|
+
if (r === "auto") {
|
|
6646
|
+
targetEls.push(t);
|
|
6647
|
+
} else {
|
|
6648
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6649
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6650
|
+
}
|
|
6651
|
+
}
|
|
6652
|
+
};
|
|
6653
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6654
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6655
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6656
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6657
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6658
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6659
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6660
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6661
|
+
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6662
|
+
else {
|
|
6401
6663
|
if (r === "shadow") {
|
|
6402
6664
|
const found = this.shadowRoot?.querySelectorAll(selector);
|
|
6403
|
-
if (found) targetEls.push(...found);
|
|
6665
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6404
6666
|
} else if (r === "light") {
|
|
6405
6667
|
const found = this.querySelectorAll(selector);
|
|
6406
|
-
if (found) targetEls.push(...found);
|
|
6668
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6407
6669
|
} else if (r === "all") {
|
|
6408
6670
|
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6409
6671
|
const lFound = this.querySelectorAll(selector);
|
|
6410
|
-
if (sFound) targetEls.push(...sFound);
|
|
6411
|
-
if (lFound) targetEls.push(...lFound);
|
|
6672
|
+
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6673
|
+
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6412
6674
|
} else {
|
|
6413
6675
|
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6414
|
-
if (found) targetEls.push(...found);
|
|
6676
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6415
6677
|
}
|
|
6416
6678
|
}
|
|
6417
6679
|
targetEls.forEach((targetEl) => {
|
|
@@ -6454,11 +6716,41 @@ var updateClassList = (selector, options = {}) => createClassListDecorator("upda
|
|
|
6454
6716
|
var addClassList = (selector, options = {}) => createClassListDecorator("add")(selector, options);
|
|
6455
6717
|
var removeClassList = (selector, options = {}) => createClassListDecorator("remove")(selector, options);
|
|
6456
6718
|
var toggleClassList = (selector, options = {}) => createClassListDecorator("toggle")(selector, options);
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6719
|
+
function setClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6720
|
+
if (propertyKey !== void 0) {
|
|
6721
|
+
const decorator = createClassListDecorator("set")(":host", {});
|
|
6722
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6723
|
+
}
|
|
6724
|
+
return createClassListDecorator("set")(":host", targetOrOptions || {});
|
|
6725
|
+
}
|
|
6726
|
+
function updateClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6727
|
+
if (propertyKey !== void 0) {
|
|
6728
|
+
const decorator = createClassListDecorator("update")(":host", {});
|
|
6729
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6730
|
+
}
|
|
6731
|
+
return createClassListDecorator("update")(":host", targetOrOptions || {});
|
|
6732
|
+
}
|
|
6733
|
+
function addClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6734
|
+
if (propertyKey !== void 0) {
|
|
6735
|
+
const decorator = createClassListDecorator("add")(":host", {});
|
|
6736
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6737
|
+
}
|
|
6738
|
+
return createClassListDecorator("add")(":host", targetOrOptions || {});
|
|
6739
|
+
}
|
|
6740
|
+
function removeClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6741
|
+
if (propertyKey !== void 0) {
|
|
6742
|
+
const decorator = createClassListDecorator("remove")(":host", {});
|
|
6743
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6744
|
+
}
|
|
6745
|
+
return createClassListDecorator("remove")(":host", targetOrOptions || {});
|
|
6746
|
+
}
|
|
6747
|
+
function toggleClassListHost(targetOrOptions, propertyKey, descriptor) {
|
|
6748
|
+
if (propertyKey !== void 0) {
|
|
6749
|
+
const decorator = createClassListDecorator("toggle")(":host", {});
|
|
6750
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6751
|
+
}
|
|
6752
|
+
return createClassListDecorator("toggle")(":host", targetOrOptions || {});
|
|
6753
|
+
}
|
|
6462
6754
|
var findAllClassListMetadata = (target) => {
|
|
6463
6755
|
const result = /* @__PURE__ */ new Map();
|
|
6464
6756
|
const maps = ReflectUtils.findAllMetadata(CLASS_LIST_METADATA_KEY, target);
|
|
@@ -6490,27 +6782,40 @@ function createStyleDecorator(action) {
|
|
|
6490
6782
|
const r = options.root || "auto";
|
|
6491
6783
|
const hostSet = SwcUtils.getHostSet(this);
|
|
6492
6784
|
const targetEls = [];
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6785
|
+
const applyRoot = (t) => {
|
|
6786
|
+
if (!t || !(t instanceof HTMLElement)) return;
|
|
6787
|
+
if (r === "auto") {
|
|
6788
|
+
targetEls.push(t);
|
|
6789
|
+
} else {
|
|
6790
|
+
if (r === "light" || r === "all") targetEls.push(t);
|
|
6791
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) {
|
|
6792
|
+
}
|
|
6793
|
+
}
|
|
6794
|
+
};
|
|
6795
|
+
if (selector === ":parentHost") applyRoot(hostSet.$parentHost);
|
|
6796
|
+
else if (selector === ":appHost") applyRoot(hostSet.$appHost);
|
|
6797
|
+
else if (selector === ":firstHost") applyRoot(hostSet.$firstHost);
|
|
6798
|
+
else if (selector === ":lastHost") applyRoot(hostSet.$lastHost);
|
|
6799
|
+
else if (selector === ":firstAppHost") applyRoot(hostSet.$firstAppHost);
|
|
6800
|
+
else if (selector === ":lastAppHost") applyRoot(hostSet.$lastAppHost);
|
|
6801
|
+
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRoot);
|
|
6802
|
+
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRoot);
|
|
6803
|
+
else if (selector === ":host" || !selector) applyRoot(this);
|
|
6804
|
+
else {
|
|
6500
6805
|
if (r === "shadow") {
|
|
6501
6806
|
const found = this.shadowRoot?.querySelectorAll(selector);
|
|
6502
|
-
if (found) targetEls.push(...found);
|
|
6807
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6503
6808
|
} else if (r === "light") {
|
|
6504
6809
|
const found = this.querySelectorAll(selector);
|
|
6505
|
-
if (found) targetEls.push(...found);
|
|
6810
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6506
6811
|
} else if (r === "all") {
|
|
6507
6812
|
const sFound = this.shadowRoot?.querySelectorAll(selector);
|
|
6508
6813
|
const lFound = this.querySelectorAll(selector);
|
|
6509
|
-
if (sFound) targetEls.push(...sFound);
|
|
6510
|
-
if (lFound) targetEls.push(...lFound);
|
|
6814
|
+
if (sFound) targetEls.push(...Array.from(sFound));
|
|
6815
|
+
if (lFound) targetEls.push(...Array.from(lFound));
|
|
6511
6816
|
} else {
|
|
6512
6817
|
const found = (this.shadowRoot || this).querySelectorAll(selector);
|
|
6513
|
-
if (found) targetEls.push(...found);
|
|
6818
|
+
if (found) targetEls.push(...Array.from(found));
|
|
6514
6819
|
}
|
|
6515
6820
|
}
|
|
6516
6821
|
targetEls.forEach((targetEl) => {
|
|
@@ -6537,11 +6842,29 @@ function createStyleDecorator(action) {
|
|
|
6537
6842
|
};
|
|
6538
6843
|
}
|
|
6539
6844
|
var setStyle = (selector, options = {}) => createStyleDecorator("set")(selector, options);
|
|
6540
|
-
|
|
6845
|
+
function setStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6846
|
+
if (propertyKey !== void 0) {
|
|
6847
|
+
const decorator = createStyleDecorator("set")(":host", {});
|
|
6848
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6849
|
+
}
|
|
6850
|
+
return createStyleDecorator("set")(":host", targetOrOptions || {});
|
|
6851
|
+
}
|
|
6541
6852
|
var updateStyle = (selector, options = {}) => createStyleDecorator("update")(selector, options);
|
|
6542
|
-
|
|
6853
|
+
function updateStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6854
|
+
if (propertyKey !== void 0) {
|
|
6855
|
+
const decorator = createStyleDecorator("update")(":host", {});
|
|
6856
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6857
|
+
}
|
|
6858
|
+
return createStyleDecorator("update")(":host", targetOrOptions || {});
|
|
6859
|
+
}
|
|
6543
6860
|
var removeStyle = (selector, options = {}) => createStyleDecorator("remove")(selector, options);
|
|
6544
|
-
|
|
6861
|
+
function removeStyleHost(targetOrOptions, propertyKey, descriptor) {
|
|
6862
|
+
if (propertyKey !== void 0) {
|
|
6863
|
+
const decorator = createStyleDecorator("remove")(":host", {});
|
|
6864
|
+
return decorator(targetOrOptions, propertyKey, descriptor);
|
|
6865
|
+
}
|
|
6866
|
+
return createStyleDecorator("remove")(":host", targetOrOptions || {});
|
|
6867
|
+
}
|
|
6545
6868
|
var findAllStyleMetadata = (target) => {
|
|
6546
6869
|
const result = /* @__PURE__ */ new Map();
|
|
6547
6870
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -6555,6 +6878,131 @@ var findAllStyleMetadata = (target) => {
|
|
|
6555
6878
|
|
|
6556
6879
|
// src/utils/Utils.ts
|
|
6557
6880
|
var SWC_NOT_FOUND = Symbol("SWC_NOT_FOUND");
|
|
6881
|
+
var htmlFragment = (html, doc) => {
|
|
6882
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
6883
|
+
if (!d) throw new Error("Document is not available");
|
|
6884
|
+
const template = d.createElement("template");
|
|
6885
|
+
template.innerHTML = html.trim();
|
|
6886
|
+
return template.content;
|
|
6887
|
+
};
|
|
6888
|
+
var textNode = (text, doc) => {
|
|
6889
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
6890
|
+
if (!d) throw new Error("Document is not available");
|
|
6891
|
+
return d.createTextNode(text !== void 0 && text !== null ? String(text) : "");
|
|
6892
|
+
};
|
|
6893
|
+
var commentNode = (comment, doc) => {
|
|
6894
|
+
const d = doc || (typeof document !== "undefined" ? document : void 0);
|
|
6895
|
+
if (!d) throw new Error("Document is not available");
|
|
6896
|
+
return d.createComment(comment !== void 0 && comment !== null ? String(comment) : "");
|
|
6897
|
+
};
|
|
6898
|
+
var createElement = (tagName, options) => {
|
|
6899
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6900
|
+
if (!d) throw new Error("Document is not available");
|
|
6901
|
+
const el = d.createElement(tagName);
|
|
6902
|
+
if (options?.html) el.innerHTML = options.html;
|
|
6903
|
+
if (options?.attrs) {
|
|
6904
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6905
|
+
}
|
|
6906
|
+
return el;
|
|
6907
|
+
};
|
|
6908
|
+
var htmlDivElement = (html, options) => {
|
|
6909
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6910
|
+
if (!d) throw new Error("Document is not available");
|
|
6911
|
+
const el = d.createElement("div");
|
|
6912
|
+
el.innerHTML = html.trim();
|
|
6913
|
+
if (options?.attrs) {
|
|
6914
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6915
|
+
}
|
|
6916
|
+
return el;
|
|
6917
|
+
};
|
|
6918
|
+
var htmlSpanElement = (html, options) => {
|
|
6919
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6920
|
+
if (!d) throw new Error("Document is not available");
|
|
6921
|
+
const el = d.createElement("span");
|
|
6922
|
+
el.innerHTML = html.trim();
|
|
6923
|
+
if (options?.attrs) {
|
|
6924
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6925
|
+
}
|
|
6926
|
+
return el;
|
|
6927
|
+
};
|
|
6928
|
+
var htmlButtonElement = (html, options) => {
|
|
6929
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6930
|
+
if (!d) throw new Error("Document is not available");
|
|
6931
|
+
const el = d.createElement("button");
|
|
6932
|
+
el.innerHTML = html.trim();
|
|
6933
|
+
if (options?.attrs) {
|
|
6934
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6935
|
+
}
|
|
6936
|
+
return el;
|
|
6937
|
+
};
|
|
6938
|
+
var htmlUlElement = (options) => {
|
|
6939
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6940
|
+
if (!d) throw new Error("Document is not available");
|
|
6941
|
+
const el = d.createElement("ul");
|
|
6942
|
+
if (options?.attrs) {
|
|
6943
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6944
|
+
}
|
|
6945
|
+
return el;
|
|
6946
|
+
};
|
|
6947
|
+
var htmlLiElement = (html, options) => {
|
|
6948
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6949
|
+
if (!d) throw new Error("Document is not available");
|
|
6950
|
+
const el = d.createElement("li");
|
|
6951
|
+
el.innerHTML = html.trim();
|
|
6952
|
+
if (options?.attrs) {
|
|
6953
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6954
|
+
}
|
|
6955
|
+
return el;
|
|
6956
|
+
};
|
|
6957
|
+
var htmlAElement = (html, options) => {
|
|
6958
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6959
|
+
if (!d) throw new Error("Document is not available");
|
|
6960
|
+
const el = d.createElement("a");
|
|
6961
|
+
el.innerHTML = html.trim();
|
|
6962
|
+
if (options?.href) el.href = options.href;
|
|
6963
|
+
if (options?.attrs) {
|
|
6964
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6965
|
+
}
|
|
6966
|
+
return el;
|
|
6967
|
+
};
|
|
6968
|
+
var htmlPElement = (html, options) => {
|
|
6969
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6970
|
+
if (!d) throw new Error("Document is not available");
|
|
6971
|
+
const el = d.createElement("p");
|
|
6972
|
+
el.innerHTML = html.trim();
|
|
6973
|
+
if (options?.attrs) {
|
|
6974
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6975
|
+
}
|
|
6976
|
+
return el;
|
|
6977
|
+
};
|
|
6978
|
+
var htmlHeadingElement = (level, html, options) => {
|
|
6979
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6980
|
+
if (!d) throw new Error("Document is not available");
|
|
6981
|
+
const el = d.createElement(`h${level}`);
|
|
6982
|
+
el.innerHTML = html.trim();
|
|
6983
|
+
if (options?.attrs) {
|
|
6984
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6985
|
+
}
|
|
6986
|
+
return el;
|
|
6987
|
+
};
|
|
6988
|
+
var htmlSectionElement = (options) => {
|
|
6989
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6990
|
+
if (!d) throw new Error("Document is not available");
|
|
6991
|
+
const el = d.createElement("section");
|
|
6992
|
+
if (options?.attrs) {
|
|
6993
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
6994
|
+
}
|
|
6995
|
+
return el;
|
|
6996
|
+
};
|
|
6997
|
+
var htmlArticleElement = (options) => {
|
|
6998
|
+
const d = options?.doc || (typeof document !== "undefined" ? document : void 0);
|
|
6999
|
+
if (!d) throw new Error("Document is not available");
|
|
7000
|
+
const el = d.createElement("article");
|
|
7001
|
+
if (options?.attrs) {
|
|
7002
|
+
Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
7003
|
+
}
|
|
7004
|
+
return el;
|
|
7005
|
+
};
|
|
6558
7006
|
var SwcUtils;
|
|
6559
7007
|
((SwcUtils2) => {
|
|
6560
7008
|
SwcUtils2.getHelperSet = (win) => {
|
|
@@ -6617,7 +7065,7 @@ var SwcUtils;
|
|
|
6617
7065
|
};
|
|
6618
7066
|
SwcUtils2.getAppHosts = (el) => {
|
|
6619
7067
|
const hosts = (0, SwcUtils2.getHosts)(el);
|
|
6620
|
-
return hosts.filter((
|
|
7068
|
+
return hosts.filter((host2) => host2.tagName.toLowerCase() === "swc-app" || host2.getAttribute("is")?.startsWith("swc-app-"));
|
|
6621
7069
|
};
|
|
6622
7070
|
SwcUtils2.getAppHost = (el) => {
|
|
6623
7071
|
const appHosts = (0, SwcUtils2.getAppHosts)(el);
|
|
@@ -6874,9 +7322,9 @@ var handleGlobalSwcEvent = async (event) => {
|
|
|
6874
7322
|
if (!(node instanceof HTMLElement)) continue;
|
|
6875
7323
|
const script = node.getAttribute?.(attrName);
|
|
6876
7324
|
if (script && !getElementConfig(node)) {
|
|
6877
|
-
const
|
|
6878
|
-
if (
|
|
6879
|
-
await
|
|
7325
|
+
const host2 = SwcUtils.findNearestSwcHost(node);
|
|
7326
|
+
if (host2 && host2.isConnected && typeof host2.__swc_executeAttributeEvent === "function") {
|
|
7327
|
+
await host2.__swc_executeAttributeEvent(node, attrName, script, event);
|
|
6880
7328
|
event.__swc_handled = true;
|
|
6881
7329
|
break;
|
|
6882
7330
|
}
|
|
@@ -8074,74 +8522,6 @@ var ValidUtils2;
|
|
|
8074
8522
|
return /Mobi/i.test(targetWindow.navigator.userAgent);
|
|
8075
8523
|
};
|
|
8076
8524
|
})(ValidUtils2 || (ValidUtils2 = {}));
|
|
8077
|
-
|
|
8078
|
-
// src/utils/TemplateUtils.ts
|
|
8079
|
-
var TemplateUtils;
|
|
8080
|
-
((TemplateUtils2) => {
|
|
8081
|
-
TemplateUtils2.htmlFragment = (strings, ...values) => {
|
|
8082
|
-
const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8083
|
-
const template = document.createElement("template");
|
|
8084
|
-
template.innerHTML = raw.trim();
|
|
8085
|
-
return template.content;
|
|
8086
|
-
};
|
|
8087
|
-
TemplateUtils2.textNode = (strings, ...values) => {
|
|
8088
|
-
const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8089
|
-
return document.createTextNode(raw);
|
|
8090
|
-
};
|
|
8091
|
-
TemplateUtils2.commentNode = (strings, ...values) => {
|
|
8092
|
-
const raw = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8093
|
-
return document.createComment(raw);
|
|
8094
|
-
};
|
|
8095
|
-
TemplateUtils2.createElement = (info, attrs = {}) => {
|
|
8096
|
-
const el = document.createElement(info.tagName);
|
|
8097
|
-
if (info.innerHtml !== void 0) el.innerHTML = info.innerHtml;
|
|
8098
|
-
Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));
|
|
8099
|
-
return el;
|
|
8100
|
-
};
|
|
8101
|
-
const createTagFunction = (tagName) => {
|
|
8102
|
-
return (strings, ...values) => {
|
|
8103
|
-
const el = document.createElement(tagName);
|
|
8104
|
-
el.innerHTML = strings.reduce((acc, str, i) => acc + str + (values[i] !== void 0 ? values[i] : ""), "");
|
|
8105
|
-
return el;
|
|
8106
|
-
};
|
|
8107
|
-
};
|
|
8108
|
-
TemplateUtils2.htmlDivElement = createTagFunction("div");
|
|
8109
|
-
TemplateUtils2.htmlSpanElement = createTagFunction("span");
|
|
8110
|
-
TemplateUtils2.htmlButtonElement = createTagFunction("button");
|
|
8111
|
-
TemplateUtils2.htmlUlElement = createTagFunction("ul");
|
|
8112
|
-
TemplateUtils2.htmlLiElement = createTagFunction("li");
|
|
8113
|
-
TemplateUtils2.htmlInputElement = createTagFunction("input");
|
|
8114
|
-
TemplateUtils2.htmlAElement = createTagFunction("a");
|
|
8115
|
-
TemplateUtils2.htmlPElement = createTagFunction("p");
|
|
8116
|
-
TemplateUtils2.htmlH1Element = createTagFunction("h1");
|
|
8117
|
-
TemplateUtils2.htmlH2Element = createTagFunction("h2");
|
|
8118
|
-
TemplateUtils2.htmlH3Element = createTagFunction("h3");
|
|
8119
|
-
TemplateUtils2.htmlH4Element = createTagFunction("h4");
|
|
8120
|
-
TemplateUtils2.htmlH5Element = createTagFunction("h5");
|
|
8121
|
-
TemplateUtils2.htmlH6Element = createTagFunction("h6");
|
|
8122
|
-
TemplateUtils2.htmlSectionElement = createTagFunction("section");
|
|
8123
|
-
TemplateUtils2.htmlArticleElement = createTagFunction("article");
|
|
8124
|
-
})(TemplateUtils || (TemplateUtils = {}));
|
|
8125
|
-
var htmlFragment = TemplateUtils.htmlFragment;
|
|
8126
|
-
var textNode = TemplateUtils.textNode;
|
|
8127
|
-
var commentNode = TemplateUtils.commentNode;
|
|
8128
|
-
var createElement = TemplateUtils.createElement;
|
|
8129
|
-
var htmlDivElement = TemplateUtils.htmlDivElement;
|
|
8130
|
-
var htmlSpanElement = TemplateUtils.htmlSpanElement;
|
|
8131
|
-
var htmlButtonElement = TemplateUtils.htmlButtonElement;
|
|
8132
|
-
var htmlUlElement = TemplateUtils.htmlUlElement;
|
|
8133
|
-
var htmlLiElement = TemplateUtils.htmlLiElement;
|
|
8134
|
-
var htmlInputElement = TemplateUtils.htmlInputElement;
|
|
8135
|
-
var htmlAElement = TemplateUtils.htmlAElement;
|
|
8136
|
-
var htmlPElement = TemplateUtils.htmlPElement;
|
|
8137
|
-
var htmlH1Element = TemplateUtils.htmlH1Element;
|
|
8138
|
-
var htmlH2Element = TemplateUtils.htmlH2Element;
|
|
8139
|
-
var htmlH3Element = TemplateUtils.htmlH3Element;
|
|
8140
|
-
var htmlH4Element = TemplateUtils.htmlH4Element;
|
|
8141
|
-
var htmlH5Element = TemplateUtils.htmlH5Element;
|
|
8142
|
-
var htmlH6Element = TemplateUtils.htmlH6Element;
|
|
8143
|
-
var htmlSectionElement = TemplateUtils.htmlSectionElement;
|
|
8144
|
-
var htmlArticleElement = TemplateUtils.htmlArticleElement;
|
|
8145
8525
|
export {
|
|
8146
8526
|
ADD_EVENT_LISTENER_METADATA_KEY,
|
|
8147
8527
|
APPLY_NODE_METADATA_KEY,
|
|
@@ -8170,11 +8550,18 @@ export {
|
|
|
8170
8550
|
STYLE_METADATA_KEY,
|
|
8171
8551
|
SWC_NOT_FOUND,
|
|
8172
8552
|
SwcUtils,
|
|
8173
|
-
TemplateUtils,
|
|
8174
8553
|
addClassList,
|
|
8175
8554
|
addClassListHost,
|
|
8176
8555
|
addEventListener,
|
|
8177
8556
|
addEventListenerHost,
|
|
8557
|
+
allAppHost,
|
|
8558
|
+
allFirstAppHost,
|
|
8559
|
+
allFirstHost,
|
|
8560
|
+
allHost,
|
|
8561
|
+
allLastAppHost,
|
|
8562
|
+
allLastHost,
|
|
8563
|
+
allParentHost,
|
|
8564
|
+
appHost,
|
|
8178
8565
|
applyAfterBeginNode,
|
|
8179
8566
|
applyAfterBeginNodeHost,
|
|
8180
8567
|
applyAfterEndNode,
|
|
@@ -8211,6 +8598,8 @@ export {
|
|
|
8211
8598
|
findAllLifecycleMetadata,
|
|
8212
8599
|
findAllSetAttributeMetadata,
|
|
8213
8600
|
findAllStyleMetadata,
|
|
8601
|
+
firstAppHost,
|
|
8602
|
+
firstHost,
|
|
8214
8603
|
getAddEventListenerMetadata,
|
|
8215
8604
|
getChangedAttributeMetadata,
|
|
8216
8605
|
getElementConfig,
|
|
@@ -8219,23 +8608,20 @@ export {
|
|
|
8219
8608
|
getQueryAllMetadata,
|
|
8220
8609
|
getQueryMetadata,
|
|
8221
8610
|
getSetAttributeMetadata,
|
|
8611
|
+
host,
|
|
8222
8612
|
htmlAElement,
|
|
8223
8613
|
htmlArticleElement,
|
|
8224
8614
|
htmlButtonElement,
|
|
8225
8615
|
htmlDivElement,
|
|
8226
8616
|
htmlFragment,
|
|
8227
|
-
|
|
8228
|
-
htmlH2Element,
|
|
8229
|
-
htmlH3Element,
|
|
8230
|
-
htmlH4Element,
|
|
8231
|
-
htmlH5Element,
|
|
8232
|
-
htmlH6Element,
|
|
8233
|
-
htmlInputElement,
|
|
8617
|
+
htmlHeadingElement,
|
|
8234
8618
|
htmlLiElement,
|
|
8235
8619
|
htmlPElement,
|
|
8236
8620
|
htmlSectionElement,
|
|
8237
8621
|
htmlSpanElement,
|
|
8238
8622
|
htmlUlElement,
|
|
8623
|
+
lastAppHost,
|
|
8624
|
+
lastHost,
|
|
8239
8625
|
onAddEventListener,
|
|
8240
8626
|
onAdopted,
|
|
8241
8627
|
onAfterAdopted,
|
|
@@ -8248,6 +8634,7 @@ export {
|
|
|
8248
8634
|
onConnectedInnerHtml,
|
|
8249
8635
|
onConstructor,
|
|
8250
8636
|
onDisconnected,
|
|
8637
|
+
parentHost,
|
|
8251
8638
|
query,
|
|
8252
8639
|
queryAll,
|
|
8253
8640
|
queryAllHost,
|