@dooboostore/simple-web-component 1.0.34 → 1.0.35
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 +23 -30
- package/dist/cjs/decorators/applyNode.js +4 -0
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/attribute.js +1 -1
- package/dist/cjs/decorators/attribute.js.map +2 -2
- package/dist/cjs/decorators/changedAttributeHost.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +225 -180
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/decorators/emitCustomEvent.js +10 -4
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +15 -17
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/elements/SwcAppEngine.js +8 -2
- package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +120 -65
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/SwcAsync.js +28 -18
- package/dist/cjs/elements/SwcAsync.js.map +2 -2
- package/dist/cjs/elements/SwcChoose.js +51 -32
- package/dist/cjs/elements/SwcChoose.js.map +2 -2
- package/dist/cjs/elements/SwcIf.js +52 -30
- package/dist/cjs/elements/SwcIf.js.map +2 -2
- package/dist/cjs/elements/SwcLoop.js +109 -35
- package/dist/cjs/elements/SwcLoop.js.map +2 -2
- package/dist/cjs/elements/register.js +244 -117
- package/dist/cjs/elements/register.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +4 -2
- package/dist/cjs/router/ElementRouter.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/Utils.js +18 -4
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +4 -0
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/attribute.js +1 -1
- package/dist/esm/decorators/attribute.js.map +2 -2
- package/dist/esm/decorators/changedAttributeHost.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +226 -181
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/decorators/emitCustomEvent.js +10 -4
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +15 -17
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/elements/SwcAppEngine.js +9 -2
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +122 -66
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/SwcAsync.js +28 -18
- package/dist/esm/elements/SwcAsync.js.map +2 -2
- package/dist/esm/elements/SwcChoose.js +51 -32
- package/dist/esm/elements/SwcChoose.js.map +2 -2
- package/dist/esm/elements/SwcIf.js +53 -31
- package/dist/esm/elements/SwcIf.js.map +2 -2
- package/dist/esm/elements/SwcLoop.js +110 -36
- package/dist/esm/elements/SwcLoop.js.map +2 -2
- package/dist/esm/elements/register.js +244 -117
- package/dist/esm/elements/register.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +5 -2
- package/dist/esm/router/ElementRouter.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/Utils.js +18 -4
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +319 -276
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/decorators/applyNode.d.ts +1 -0
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/changedAttributeHost.d.ts +1 -0
- package/dist/types/decorators/changedAttributeHost.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +10 -6
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +10 -7
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +4 -5
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/elements/SwcAppEngine.d.ts +4 -1
- package/dist/types/elements/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +11 -8
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +4 -1
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +319 -276
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +4 -4
- package/src/decorators/applyNode.ts +13 -1
- package/src/decorators/attribute.ts +1 -1
- package/src/decorators/changedAttributeHost.ts +3 -2
- package/src/decorators/elementDefine.ts +397 -354
- package/src/decorators/emitCustomEvent.ts +29 -15
- package/src/decorators/lifecycles.ts +11 -10
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +10 -10
- package/src/elements/SwcAppEngine.ts +10 -3
- package/src/elements/SwcAppMixin.ts +177 -97
- package/src/elements/SwcAsync.ts +28 -17
- package/src/elements/SwcChoose.ts +71 -34
- package/src/elements/SwcIf.ts +59 -22
- package/src/elements/SwcLoop.ts +140 -27
- package/src/elements/register.ts +296 -98
- package/src/types.ts +1 -0
- package/src/utils/Utils.ts +23 -5
- package/tsconfig.json +2 -2
|
@@ -1169,6 +1169,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1169
1169
|
applyClassHost: () => applyClassHost,
|
|
1170
1170
|
applyInnerHtmlNode: () => applyInnerHtmlNode,
|
|
1171
1171
|
applyInnerHtmlNodeHost: () => applyInnerHtmlNodeHost,
|
|
1172
|
+
applyInnerTextNode: () => applyInnerTextNode,
|
|
1172
1173
|
applyNode: () => applyNode,
|
|
1173
1174
|
applyNodeHost: () => applyNodeHost,
|
|
1174
1175
|
applyReplaceChildrenNode: () => applyReplaceChildrenNode,
|
|
@@ -1222,16 +1223,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1222
1223
|
lastHost: () => lastHost,
|
|
1223
1224
|
onAddEventListener: () => onAddEventListener,
|
|
1224
1225
|
onAdopted: () => onAdopted,
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
onAfterDisconnected: () => onAfterDisconnected,
|
|
1228
|
-
onBeforeAdopted: () => onBeforeAdopted,
|
|
1229
|
-
onBeforeConnected: () => onBeforeConnected,
|
|
1230
|
-
onBeforeDisconnected: () => onBeforeDisconnected,
|
|
1226
|
+
onAdoptedAfter: () => onAdoptedAfter,
|
|
1227
|
+
onAdoptedBefore: () => onAdoptedBefore,
|
|
1231
1228
|
onConnected: () => onConnected,
|
|
1229
|
+
onConnectedAfter: () => onConnectedAfter,
|
|
1230
|
+
onConnectedBefore: () => onConnectedBefore,
|
|
1232
1231
|
onConnectedInnerHtml: () => onConnectedInnerHtml,
|
|
1233
|
-
onConnectedSwcApp: () => onConnectedSwcApp,
|
|
1234
1232
|
onDisconnected: () => onDisconnected,
|
|
1233
|
+
onDisconnectedAfter: () => onDisconnectedAfter,
|
|
1234
|
+
onDisconnectedBefore: () => onDisconnectedBefore,
|
|
1235
1235
|
onInitialize: () => onInitialize,
|
|
1236
1236
|
parentHost: () => parentHost,
|
|
1237
1237
|
publishSwcAppMessage: () => publishSwcAppMessage,
|
|
@@ -5883,6 +5883,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5883
5883
|
})(Expression || (Expression = {}));
|
|
5884
5884
|
|
|
5885
5885
|
// ../core/dist/esm/expression/ActionExpression.js
|
|
5886
|
+
var DEFAULT_EXPRESSION_CONFIG = {
|
|
5887
|
+
"callReturn": { start: "{{=", end: "}}" },
|
|
5888
|
+
"call": { start: "{{@", end: "}}" },
|
|
5889
|
+
"replace": { start: "{{", end: "}}" }
|
|
5890
|
+
};
|
|
5886
5891
|
var ActionExpression = class {
|
|
5887
5892
|
constructor(value, config) {
|
|
5888
5893
|
this.originalTemplate = value || "";
|
|
@@ -5896,12 +5901,19 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5896
5901
|
}
|
|
5897
5902
|
this.maskingTemplate = value;
|
|
5898
5903
|
this.currentTemplate = value;
|
|
5899
|
-
|
|
5900
|
-
|
|
5904
|
+
const exprConfig = {
|
|
5905
|
+
"callReturn": config?.expression?.["callReturn"] || DEFAULT_EXPRESSION_CONFIG["callReturn"],
|
|
5906
|
+
"call": config?.expression?.call || DEFAULT_EXPRESSION_CONFIG.call,
|
|
5907
|
+
"replace": config?.expression?.replace || DEFAULT_EXPRESSION_CONFIG.replace
|
|
5908
|
+
};
|
|
5909
|
+
const types = ["callReturn", "call", "replace"];
|
|
5910
|
+
types.sort((a, b) => exprConfig[b].start.length - exprConfig[a].start.length);
|
|
5911
|
+
for (const type of types) {
|
|
5912
|
+
const marker = exprConfig[type];
|
|
5913
|
+
if (marker) {
|
|
5914
|
+
this.processExpressionType(type, marker.start, marker.end);
|
|
5915
|
+
}
|
|
5901
5916
|
}
|
|
5902
|
-
this.processCallReturnExpressions(this.currentTemplate);
|
|
5903
|
-
this.processCallExpressions(this.currentTemplate);
|
|
5904
|
-
this.processReplaceExpressions(this.currentTemplate);
|
|
5905
5917
|
this.sortExpressionsByPosition();
|
|
5906
5918
|
this.maskingTemplate = this.currentTemplate;
|
|
5907
5919
|
}
|
|
@@ -5912,45 +5924,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5912
5924
|
});
|
|
5913
5925
|
this.expressions.sort((a, b) => (a.index ?? 0) - (b.index ?? 0));
|
|
5914
5926
|
}
|
|
5915
|
-
|
|
5916
|
-
const
|
|
5917
|
-
const
|
|
5918
|
-
const
|
|
5927
|
+
processExpressionType(type, start, end) {
|
|
5928
|
+
const escapedStart = start.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5929
|
+
const escapedEnd = end.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5930
|
+
const regex = new RegExp(`${escapedStart}\\s*([\\s\\S]+?)\\s*${escapedEnd}`, "g");
|
|
5919
5931
|
let match;
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
const wrappedCallRegex = new RegExp(`${escapedWrap}\\{\\{@\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
|
|
5924
|
-
while ((match = wrappedCallRegex.exec(value)) !== null) {
|
|
5925
|
-
this.addExpression(match, "call", wrapChar);
|
|
5926
|
-
}
|
|
5927
|
-
const wrappedReplaceRegex = new RegExp(`${escapedWrap}\\{\\{(?![=@])\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
|
|
5928
|
-
while ((match = wrappedReplaceRegex.exec(value)) !== null) {
|
|
5929
|
-
this.addExpression(match, "replace", wrapChar);
|
|
5932
|
+
const valueToMatch = this.currentTemplate;
|
|
5933
|
+
while ((match = regex.exec(valueToMatch)) !== null) {
|
|
5934
|
+
this.addExpression(match, type);
|
|
5930
5935
|
}
|
|
5931
5936
|
}
|
|
5932
|
-
|
|
5933
|
-
const callReturnRegex = /(?<![a-zA-Z0-9$_@#.])\{\{=\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5934
|
-
let match;
|
|
5935
|
-
while ((match = callReturnRegex.exec(value)) !== null) {
|
|
5936
|
-
this.addExpression(match, "call-return");
|
|
5937
|
-
}
|
|
5938
|
-
}
|
|
5939
|
-
processCallExpressions(value) {
|
|
5940
|
-
const callRegex = /(?<![a-zA-Z0-9$_@#.])\{\{@\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5941
|
-
let match;
|
|
5942
|
-
while ((match = callRegex.exec(value)) !== null) {
|
|
5943
|
-
this.addExpression(match, "call");
|
|
5944
|
-
}
|
|
5945
|
-
}
|
|
5946
|
-
processReplaceExpressions(value) {
|
|
5947
|
-
const replaceRegex = /(?<![a-zA-Z0-9$_@#.])\{\{(?![=@])\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5948
|
-
let match;
|
|
5949
|
-
while ((match = replaceRegex.exec(value)) !== null) {
|
|
5950
|
-
this.addExpression(match, "replace");
|
|
5951
|
-
}
|
|
5952
|
-
}
|
|
5953
|
-
addExpression(match, type, wrap) {
|
|
5937
|
+
addExpression(match, type) {
|
|
5954
5938
|
const id = Math.random().toString(36).substr(2, 9);
|
|
5955
5939
|
const original = match[0];
|
|
5956
5940
|
const rawScript = match[1];
|
|
@@ -5965,13 +5949,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5965
5949
|
original,
|
|
5966
5950
|
script: rawScript.trim(),
|
|
5967
5951
|
expressionStart,
|
|
5968
|
-
expressionEnd
|
|
5969
|
-
...wrap && { wrap }
|
|
5952
|
+
expressionEnd
|
|
5970
5953
|
});
|
|
5971
5954
|
}
|
|
5972
|
-
/**
|
|
5973
|
-
* 구현 메서드
|
|
5974
|
-
*/
|
|
5975
5955
|
replace(idOrExpr, valueOrCallback) {
|
|
5976
5956
|
const id = typeof idOrExpr === "string" ? idOrExpr : idOrExpr.id;
|
|
5977
5957
|
let expr;
|
|
@@ -5987,9 +5967,6 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
5987
5967
|
}
|
|
5988
5968
|
return this.getUnprocessedTemplate();
|
|
5989
5969
|
}
|
|
5990
|
-
/**
|
|
5991
|
-
* 구현 메서드
|
|
5992
|
-
*/
|
|
5993
5970
|
getExpressions(typeOrOptions) {
|
|
5994
5971
|
if (!typeOrOptions) {
|
|
5995
5972
|
return this.expressions;
|
|
@@ -6000,13 +5977,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6000
5977
|
const options = typeOrOptions;
|
|
6001
5978
|
return this.expressions.filter((expr) => {
|
|
6002
5979
|
if (options.type && expr.type !== options.type) return false;
|
|
6003
|
-
if ("wrap" in options && expr.wrap !== options.wrap) return false;
|
|
6004
5980
|
return true;
|
|
6005
5981
|
});
|
|
6006
5982
|
}
|
|
6007
|
-
/**
|
|
6008
|
-
* 구현 메서드
|
|
6009
|
-
*/
|
|
6010
5983
|
getFirstExpression(typeOrOptions) {
|
|
6011
5984
|
if (!typeOrOptions) {
|
|
6012
5985
|
return this.getExpressions()[0];
|
|
@@ -6016,28 +5989,15 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6016
5989
|
}
|
|
6017
5990
|
return this.getExpressions(typeOrOptions)[0];
|
|
6018
5991
|
}
|
|
6019
|
-
/**
|
|
6020
|
-
* 원본 템플릿을 반환합니다.
|
|
6021
|
-
*/
|
|
6022
5992
|
getOriginalTemplate() {
|
|
6023
5993
|
return this.originalTemplate;
|
|
6024
5994
|
}
|
|
6025
|
-
/**
|
|
6026
|
-
* 마스킹 처리된 템플릿을 반환합니다.
|
|
6027
|
-
*/
|
|
6028
5995
|
getMaskingTemplate() {
|
|
6029
5996
|
return this.maskingTemplate;
|
|
6030
5997
|
}
|
|
6031
|
-
/**
|
|
6032
|
-
* 현재 처리 상태의 템플릿을 반환합니다.
|
|
6033
|
-
*/
|
|
6034
5998
|
getCurrentTemplate() {
|
|
6035
5999
|
return this.currentTemplate;
|
|
6036
6000
|
}
|
|
6037
|
-
/**
|
|
6038
|
-
* 미처리된 마커들을 원본으로 복원한 템플릿을 반환합니다.
|
|
6039
|
-
* replace() 호출 후 처리되지 않은 표현식들을 원본 형태로 되돌립니다.
|
|
6040
|
-
*/
|
|
6041
6001
|
getUnprocessedTemplate() {
|
|
6042
6002
|
let result = this.currentTemplate;
|
|
6043
6003
|
for (const expr of this.expressions) {
|
|
@@ -6100,17 +6060,16 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6100
6060
|
};
|
|
6101
6061
|
}
|
|
6102
6062
|
var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
|
|
6103
|
-
var
|
|
6104
|
-
var
|
|
6105
|
-
var onConnected =
|
|
6106
|
-
var
|
|
6107
|
-
var
|
|
6108
|
-
var onDisconnected =
|
|
6109
|
-
var
|
|
6110
|
-
var
|
|
6111
|
-
var onAdopted =
|
|
6063
|
+
var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
6064
|
+
var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
|
|
6065
|
+
var onConnected = onConnectedAfter;
|
|
6066
|
+
var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
6067
|
+
var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
6068
|
+
var onDisconnected = onDisconnectedAfter;
|
|
6069
|
+
var onAdoptedBefore = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
|
|
6070
|
+
var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
|
|
6071
|
+
var onAdopted = onAdoptedAfter;
|
|
6112
6072
|
var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
|
|
6113
|
-
var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
|
|
6114
6073
|
function onConnectedInnerHtml(arg1, arg2, arg3) {
|
|
6115
6074
|
const decorator = (options, target, propertyKey) => {
|
|
6116
6075
|
const constructor = target.constructor;
|
|
@@ -6266,13 +6225,25 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6266
6225
|
};
|
|
6267
6226
|
var SwcUtils;
|
|
6268
6227
|
((SwcUtils2) => {
|
|
6228
|
+
SwcUtils2.getParentContainer = (e) => {
|
|
6229
|
+
return e.parentElement ?? e.getRootNode();
|
|
6230
|
+
};
|
|
6269
6231
|
SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
|
|
6270
6232
|
return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
|
|
6271
6233
|
};
|
|
6272
|
-
SwcUtils2.parsePathPatternsSet = (pathPattern,
|
|
6234
|
+
SwcUtils2.parsePathPatternsSet = (pathPattern, urlAndRouter) => {
|
|
6235
|
+
urlAndRouter ?? (urlAndRouter = "/");
|
|
6236
|
+
const p = typeof urlAndRouter === "string" ? urlAndRouter : urlAndRouter.value.url;
|
|
6237
|
+
const searchParams = new URLSearchParams();
|
|
6238
|
+
const qs = p.split("?")[1];
|
|
6239
|
+
qs?.split("&").forEach((it) => {
|
|
6240
|
+
const [k, v] = it.split("=");
|
|
6241
|
+
searchParams.set(k, v);
|
|
6242
|
+
});
|
|
6273
6243
|
return {
|
|
6274
|
-
path,
|
|
6275
|
-
|
|
6244
|
+
path: p,
|
|
6245
|
+
searchParams,
|
|
6246
|
+
pathData: SwcUtils2.parsePathPatterns(pathPattern, p)
|
|
6276
6247
|
};
|
|
6277
6248
|
};
|
|
6278
6249
|
SwcUtils2.parsePathPatterns = (pathPattern, path) => {
|
|
@@ -6313,7 +6284,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6313
6284
|
return current;
|
|
6314
6285
|
};
|
|
6315
6286
|
SwcUtils2.findNearestSwcHost = (el) => {
|
|
6316
|
-
|
|
6287
|
+
const el1 = el;
|
|
6288
|
+
if (el1.__swc_host) return el1.__swc_host;
|
|
6317
6289
|
let current = el.parentElement || el.getRootNode?.()?.host;
|
|
6318
6290
|
const doc = el.ownerDocument;
|
|
6319
6291
|
const win = doc?.defaultView || (typeof window !== "undefined" ? window : void 0);
|
|
@@ -6404,6 +6376,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6404
6376
|
$hosts,
|
|
6405
6377
|
$firstHost,
|
|
6406
6378
|
$lastHost: $parentHost,
|
|
6379
|
+
$templateHost: el.__swc_template_host,
|
|
6407
6380
|
$appHost,
|
|
6408
6381
|
$appHosts,
|
|
6409
6382
|
$firstAppHost,
|
|
@@ -6514,11 +6487,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
6514
6487
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6515
6488
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
6516
6489
|
};
|
|
6517
|
-
function emitCustomEventHost(type,
|
|
6518
|
-
if (
|
|
6519
|
-
|
|
6490
|
+
function emitCustomEventHost(type, optionsOrAttributeaName) {
|
|
6491
|
+
if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
|
|
6492
|
+
return emitCustomEventHost(type, { attributeName: optionsOrAttributeaName });
|
|
6493
|
+
} else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
|
|
6494
|
+
if (!optionsOrAttributeaName.attributeName) {
|
|
6495
|
+
optionsOrAttributeaName.attributeName = `on-emit-${type}`;
|
|
6496
|
+
}
|
|
6497
|
+
return emitCustomEvent(":host", type, optionsOrAttributeaName);
|
|
6498
|
+
} else {
|
|
6499
|
+
return emitCustomEvent(":host", type, { attributeName: `on-emit-${type}` });
|
|
6520
6500
|
}
|
|
6521
|
-
return emitCustomEvent(":host", type, options);
|
|
6522
6501
|
}
|
|
6523
6502
|
|
|
6524
6503
|
// src/decorators/changedAttributeHost.ts
|
|
@@ -8009,7 +7988,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8009
7988
|
const app = useHostSet?.$appHost?.simpleApplication;
|
|
8010
7989
|
if (app) {
|
|
8011
7990
|
const otherStorage = /* @__PURE__ */ new Map();
|
|
8012
|
-
const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTSET" /* HOST_SET */, data: useHostSet }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOST" /* APP_HOST */, data: useHostSet.$appHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOSTS" /* APP_HOSTS */, data: useHostSet.$appHosts }), new SituationTypeContainer({
|
|
7991
|
+
const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTSET" /* HOST_SET */, data: useHostSet }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOST" /* APP_HOST */, data: useHostSet.$appHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOSTS" /* APP_HOSTS */, data: useHostSet.$appHosts }), new SituationTypeContainer({
|
|
7992
|
+
situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */,
|
|
7993
|
+
data: useHostSet.$host
|
|
7994
|
+
}), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTS" /* HOSTS */, data: useHostSet.$hosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTHOST" /* FIRST_HOST */, data: useHostSet.$firstHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTHOST" /* LAST_HOST */, data: useHostSet.$lastHost }), new SituationTypeContainer({
|
|
7995
|
+
situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */,
|
|
7996
|
+
data: useHostSet.$firstAppHost
|
|
7997
|
+
}), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
|
|
8013
7998
|
otherStorage.set(SituationTypeContainers, situations);
|
|
8014
7999
|
return app.simstanceManager.executeBindParameterSim(
|
|
8015
8000
|
{
|
|
@@ -8102,203 +8087,243 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8102
8087
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
8103
8088
|
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
|
|
8104
8089
|
const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
|
|
8105
|
-
const proto = constructor.prototype;
|
|
8106
8090
|
const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
|
|
8107
|
-
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
|
|
8108
|
-
...metadata.observedAttributes ?? [],
|
|
8109
|
-
...originalStaticObservedAttributes,
|
|
8110
|
-
...attrChangeMap.keys(),
|
|
8111
|
-
...attributeApplyNames,
|
|
8112
|
-
...hostAttributes,
|
|
8113
|
-
...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
|
|
8114
|
-
...swcLifecycleAttributes,
|
|
8115
|
-
...swcOnEvents
|
|
8116
|
-
])];
|
|
8091
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
8117
8092
|
const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
|
|
8093
|
+
const proto = constructor.prototype;
|
|
8118
8094
|
setupPrototype(proto);
|
|
8095
|
+
let helperHostSet = null;
|
|
8119
8096
|
const originalConnected = proto.connectedCallback;
|
|
8120
|
-
proto.connectedCallback = function() {
|
|
8097
|
+
proto.connectedCallback = async function() {
|
|
8121
8098
|
ensureInit(this);
|
|
8122
|
-
|
|
8123
|
-
const appHost2 =
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
|
|
8135
|
-
|
|
8136
|
-
|
|
8137
|
-
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8099
|
+
helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
8100
|
+
const appHost2 = helperHostSet.$appHost;
|
|
8101
|
+
try {
|
|
8102
|
+
if (appHost2 && typeof appHost2._connected === "function") {
|
|
8103
|
+
await appHost2._connected(this);
|
|
8104
|
+
} else if (appHost2 && typeof appHost2) {
|
|
8105
|
+
appHost2._connected_safari ?? (appHost2._connected_safari = []);
|
|
8106
|
+
appHost2._connected_safari.push(this);
|
|
8107
|
+
}
|
|
8108
|
+
const conf = getElementConfig(this);
|
|
8109
|
+
const currentWin = this._resolveWindow(conf);
|
|
8110
|
+
const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
|
|
8111
|
+
if (shadowMode && !this.shadowRoot) {
|
|
8112
|
+
const mode = shadowMode === true ? "open" : shadowMode;
|
|
8113
|
+
this.attachShadow({ mode });
|
|
8114
|
+
}
|
|
8115
|
+
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
8116
|
+
if (bMethods) {
|
|
8117
|
+
for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
|
|
8118
|
+
}
|
|
8119
|
+
this._executeSwcScript("swc-on-before-connected", helperHostSet);
|
|
8120
|
+
if (connectedInnerHtmlList.length > 0) {
|
|
8121
|
+
let sContent = "", lContent = "";
|
|
8122
|
+
for (const meta of connectedInnerHtmlList) {
|
|
8123
|
+
let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
|
|
8124
|
+
const actionExpression = new ActionExpression(res, {
|
|
8125
|
+
expression: {
|
|
8126
|
+
replace: {
|
|
8127
|
+
start: meta.options.replaceWrap?.start || "{%{",
|
|
8128
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
8129
|
+
},
|
|
8130
|
+
callReturn: {
|
|
8131
|
+
start: meta.options.replaceWrap?.start || "{%{=",
|
|
8132
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
8133
|
+
},
|
|
8134
|
+
call: {
|
|
8135
|
+
start: meta.options.replaceWrap?.start || "{%{@",
|
|
8136
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
8137
|
+
}
|
|
8138
|
+
}
|
|
8139
|
+
});
|
|
8140
|
+
actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
|
|
8141
|
+
try {
|
|
8142
|
+
const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
|
|
8143
|
+
actionExpression.replace(it, sr);
|
|
8144
|
+
} catch (e) {
|
|
8145
|
+
console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
|
|
8146
|
+
}
|
|
8147
|
+
});
|
|
8148
|
+
res = actionExpression.getUnprocessedTemplate();
|
|
8149
|
+
if (res !== void 0) {
|
|
8150
|
+
if (meta.options.useShadow || conf?.useShadow) sContent += res;
|
|
8151
|
+
else lContent += res;
|
|
8152
|
+
}
|
|
8153
|
+
}
|
|
8154
|
+
try {
|
|
8155
|
+
if (this.shadowRoot) {
|
|
8156
|
+
this.shadowRoot.innerHTML = sContent;
|
|
8157
|
+
}
|
|
8158
|
+
if (lContent) {
|
|
8159
|
+
this.innerHTML = lContent;
|
|
8160
|
+
}
|
|
8161
|
+
} catch (e) {
|
|
8162
|
+
console.error("[ElementDefine] innerHTML setting error:", e);
|
|
8143
8163
|
}
|
|
8144
8164
|
}
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8165
|
+
const root = this.getRootNode();
|
|
8166
|
+
if (!globalDelegatedRoots.has(root)) {
|
|
8167
|
+
DOM_EVENT_NAMES.forEach((type) => {
|
|
8168
|
+
root.addEventListener(type, handleGlobalSwcEvent);
|
|
8169
|
+
});
|
|
8170
|
+
globalDelegatedRoots.add(root);
|
|
8150
8171
|
}
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8172
|
+
const delegateListeners = [];
|
|
8173
|
+
const nonDelegateListeners = [];
|
|
8174
|
+
addEventListenerList.forEach((meta) => {
|
|
8175
|
+
if (meta.options.delegate && meta.selector !== ":window" && meta.selector !== ":document" && meta.selector !== ":parentHost" && meta.selector !== ":appHost" && meta.selector !== ":firstHost" && meta.selector !== ":lastHost" && meta.selector !== ":firstAppHost" && meta.selector !== ":lastAppHost" && meta.selector !== ":hosts" && meta.selector !== ":appHosts" && meta.selector !== ":host" && meta.selector !== "") {
|
|
8176
|
+
delegateListeners.push(meta);
|
|
8177
|
+
} else {
|
|
8178
|
+
nonDelegateListeners.push(meta);
|
|
8179
|
+
}
|
|
8156
8180
|
});
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
});
|
|
8195
|
-
const unifiedHandler = async (event) => {
|
|
8196
|
-
for (const meta of sortedMetaList) {
|
|
8197
|
-
const { selector, options } = meta;
|
|
8198
|
-
const matchedEl = event.target.closest(selector);
|
|
8199
|
-
if (matchedEl && br.contains(matchedEl)) {
|
|
8200
|
-
if (options.filter) {
|
|
8201
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
8202
|
-
if (!options.filter(event, helper)) {
|
|
8203
|
-
continue;
|
|
8181
|
+
const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
|
|
8182
|
+
delegateListeners.forEach((meta) => {
|
|
8183
|
+
const r = meta.options.root || "auto";
|
|
8184
|
+
const rootKey = `${meta.type}:${r}`;
|
|
8185
|
+
if (!delegatesByTypeAndRoot.has(rootKey)) {
|
|
8186
|
+
delegatesByTypeAndRoot.set(rootKey, []);
|
|
8187
|
+
}
|
|
8188
|
+
delegatesByTypeAndRoot.get(rootKey).push(meta);
|
|
8189
|
+
});
|
|
8190
|
+
delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
|
|
8191
|
+
const [type, rStr] = typeRootKey.split(":");
|
|
8192
|
+
const r = rStr === "auto" ? "auto" : rStr;
|
|
8193
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
8194
|
+
const bindRoots = [];
|
|
8195
|
+
if (r === "auto") bindRoots.push(this.shadowRoot || this);
|
|
8196
|
+
else if (r === "light") bindRoots.push(this);
|
|
8197
|
+
else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
8198
|
+
else if (r === "all") {
|
|
8199
|
+
bindRoots.push(this);
|
|
8200
|
+
if (this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
8201
|
+
}
|
|
8202
|
+
bindRoots.forEach((br) => {
|
|
8203
|
+
const sortedMetaList = [...metaList].sort((a, b) => {
|
|
8204
|
+
const aStop = a.options.stopPropagation ? 1 : 0;
|
|
8205
|
+
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
8206
|
+
return bStop - aStop;
|
|
8207
|
+
});
|
|
8208
|
+
const unifiedHandler = async (event) => {
|
|
8209
|
+
for (const meta of sortedMetaList) {
|
|
8210
|
+
const { selector, options } = meta;
|
|
8211
|
+
const matchedEl = event.target.closest(selector);
|
|
8212
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
8213
|
+
if (options.filter) {
|
|
8214
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
8215
|
+
if (!options.filter(event, helper)) {
|
|
8216
|
+
continue;
|
|
8217
|
+
}
|
|
8204
8218
|
}
|
|
8219
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
8220
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8221
|
+
if (options.preventDefault) event.preventDefault();
|
|
8222
|
+
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8223
|
+
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
8224
|
+
await this[meta.propertyKey](event, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
8225
|
+
if (event.cancelBubble) break;
|
|
8205
8226
|
}
|
|
8206
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
8207
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8208
|
-
if (options.preventDefault) event.preventDefault();
|
|
8209
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8210
|
-
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
8211
|
-
await this[meta.propertyKey](event, currentHostSet, matchedEl, args);
|
|
8212
|
-
if (event.cancelBubble) break;
|
|
8213
8227
|
}
|
|
8228
|
+
};
|
|
8229
|
+
br.addEventListener(type, unifiedHandler, opts);
|
|
8230
|
+
this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
|
|
8231
|
+
});
|
|
8232
|
+
});
|
|
8233
|
+
nonDelegateListeners.forEach((meta) => {
|
|
8234
|
+
const { selector, type, options } = meta;
|
|
8235
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
8236
|
+
const bindTargets = [];
|
|
8237
|
+
const r = options.root || "auto";
|
|
8238
|
+
const applyRootOption = (target) => {
|
|
8239
|
+
if (!target) return;
|
|
8240
|
+
if (r === "auto") {
|
|
8241
|
+
bindTargets.push(target.shadowRoot || target);
|
|
8242
|
+
} else {
|
|
8243
|
+
if (r === "light" || r === "all") bindTargets.push(target);
|
|
8244
|
+
if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
|
|
8214
8245
|
}
|
|
8215
8246
|
};
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
if (!
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
if (r === "light"
|
|
8231
|
-
if (
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
else if (selector === ":lastHost") applyRootOption(hostSet.$lastHost);
|
|
8240
|
-
else if (selector === ":firstAppHost") applyRootOption(hostSet.$firstAppHost);
|
|
8241
|
-
else if (selector === ":lastAppHost") applyRootOption(hostSet.$lastAppHost);
|
|
8242
|
-
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRootOption);
|
|
8243
|
-
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRootOption);
|
|
8244
|
-
else if (selector === ":host" || !selector) applyRootOption(this);
|
|
8245
|
-
else {
|
|
8246
|
-
const searchRoots = [];
|
|
8247
|
-
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
8248
|
-
else if (r === "light") searchRoots.push(this);
|
|
8249
|
-
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8250
|
-
else if (r === "all") {
|
|
8251
|
-
searchRoots.push(this);
|
|
8252
|
-
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8247
|
+
if (selector === ":window") bindTargets.push(currentWin);
|
|
8248
|
+
else if (selector === ":document") bindTargets.push(currentWin.document);
|
|
8249
|
+
else if (selector === ":parentHost") applyRootOption(helperHostSet.$parentHost);
|
|
8250
|
+
else if (selector === ":appHost") applyRootOption(helperHostSet.$appHost);
|
|
8251
|
+
else if (selector === ":firstHost") applyRootOption(helperHostSet.$firstHost);
|
|
8252
|
+
else if (selector === ":lastHost") applyRootOption(helperHostSet.$lastHost);
|
|
8253
|
+
else if (selector === ":firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
|
|
8254
|
+
else if (selector === ":lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
|
|
8255
|
+
else if (selector === ":hosts") helperHostSet.$hosts.forEach(applyRootOption);
|
|
8256
|
+
else if (selector === ":appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
|
|
8257
|
+
else if (selector === ":host" || !selector) applyRootOption(this);
|
|
8258
|
+
else {
|
|
8259
|
+
const searchRoots = [];
|
|
8260
|
+
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
8261
|
+
else if (r === "light") searchRoots.push(this);
|
|
8262
|
+
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8263
|
+
else if (r === "all") {
|
|
8264
|
+
searchRoots.push(this);
|
|
8265
|
+
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8266
|
+
}
|
|
8267
|
+
searchRoots.forEach((sr) => {
|
|
8268
|
+
sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
|
|
8269
|
+
});
|
|
8253
8270
|
}
|
|
8254
|
-
|
|
8255
|
-
|
|
8271
|
+
bindTargets.forEach((t) => {
|
|
8272
|
+
const handler = async (event) => {
|
|
8273
|
+
if (options.filter) {
|
|
8274
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
8275
|
+
if (!options.filter(event, { currentThis: this, helper })) {
|
|
8276
|
+
return;
|
|
8277
|
+
}
|
|
8278
|
+
}
|
|
8279
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
8280
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8281
|
+
if (options.preventDefault) event.preventDefault();
|
|
8282
|
+
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8283
|
+
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
8284
|
+
await this[meta.propertyKey](event, { currentHostSet, $$matchedElement: event.currentTarget }, args);
|
|
8285
|
+
};
|
|
8286
|
+
t.addEventListener(type, handler, opts);
|
|
8287
|
+
if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
|
|
8288
|
+
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
8289
|
+
}
|
|
8256
8290
|
});
|
|
8257
|
-
}
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8291
|
+
});
|
|
8292
|
+
if (originalConnected) await originalConnected.apply(this);
|
|
8293
|
+
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
|
|
8294
|
+
if (aMethods) {
|
|
8295
|
+
for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
|
|
8296
|
+
}
|
|
8297
|
+
this._executeSwcScript("swc-on-connected", helperHostSet);
|
|
8298
|
+
this._executeSwcScript("swc-on-after-connected", helperHostSet);
|
|
8299
|
+
this.__swc_connected = true;
|
|
8300
|
+
for (let [name2, metaList] of Array.from(attrChangeMap)) {
|
|
8301
|
+
for (const meta of metaList) {
|
|
8302
|
+
if (meta.options.while === "connected") {
|
|
8303
|
+
const val = getAttributeValue(this, name2, { type: meta.options.type });
|
|
8304
|
+
if (val !== null) {
|
|
8305
|
+
await this[meta.propertyKey](val, null, name2, helperHostSet);
|
|
8264
8306
|
}
|
|
8265
8307
|
}
|
|
8266
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
8267
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8268
|
-
if (options.preventDefault) event.preventDefault();
|
|
8269
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8270
|
-
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
8271
|
-
await this[meta.propertyKey](event, currentHostSet, args);
|
|
8272
|
-
};
|
|
8273
|
-
t.addEventListener(type, handler, opts);
|
|
8274
|
-
if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
|
|
8275
|
-
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
8276
8308
|
}
|
|
8277
|
-
}
|
|
8278
|
-
}
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
8283
|
-
}
|
|
8284
|
-
this._executeSwcScript("swc-on-connected", hostSet);
|
|
8285
|
-
this._executeSwcScript("swc-on-after-connected", hostSet);
|
|
8286
|
-
this.__swc_connected = true;
|
|
8287
|
-
const appHostss = SwcUtils.findAllParentAppHostsDirect(this);
|
|
8288
|
-
if (appHost2 && typeof appHost2._connected === "function") {
|
|
8289
|
-
appHost2._connected(this);
|
|
8290
|
-
} else if (appHost2 && typeof appHost2) {
|
|
8291
|
-
appHost2._connected_safari ?? (appHost2._connected_safari = []);
|
|
8292
|
-
appHost2._connected_safari.push(this);
|
|
8309
|
+
}
|
|
8310
|
+
} finally {
|
|
8311
|
+
if (appHost2 && typeof appHost2._connectedDone === "function") {
|
|
8312
|
+
await appHost2._connectedDone(this);
|
|
8313
|
+
}
|
|
8293
8314
|
}
|
|
8294
8315
|
};
|
|
8295
8316
|
const originalDisconnected = proto.disconnectedCallback;
|
|
8296
8317
|
proto.disconnectedCallback = function() {
|
|
8297
|
-
|
|
8298
|
-
|
|
8318
|
+
console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
|
|
8319
|
+
const appHost2 = helperHostSet.$appHost;
|
|
8320
|
+
if (appHost2 && typeof appHost2._disconnected === "function") {
|
|
8321
|
+
appHost2._disconnected(this);
|
|
8322
|
+
}
|
|
8323
|
+
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
8299
8324
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
8300
8325
|
if (bMethods) {
|
|
8301
|
-
for (const m of bMethods) this._invokeLifecycleMethod(m,
|
|
8326
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
8302
8327
|
}
|
|
8303
8328
|
if (this._boundListeners) {
|
|
8304
8329
|
this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
|
|
@@ -8307,15 +8332,11 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8307
8332
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
8308
8333
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
8309
8334
|
if (aMethods) {
|
|
8310
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m,
|
|
8335
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
8311
8336
|
}
|
|
8312
|
-
this._executeSwcScript("swc-on-disconnected",
|
|
8313
|
-
this._executeSwcScript("swc-on-after-disconnected",
|
|
8337
|
+
this._executeSwcScript("swc-on-disconnected", helperHostSet);
|
|
8338
|
+
this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
|
|
8314
8339
|
this.__swc_connected = false;
|
|
8315
|
-
const appHost2 = hostSet.$appHost;
|
|
8316
|
-
if (appHost2 && typeof appHost2._disconnected === "function") {
|
|
8317
|
-
appHost2._disconnected(this);
|
|
8318
|
-
}
|
|
8319
8340
|
};
|
|
8320
8341
|
const originalAdopted = proto.adoptedCallback;
|
|
8321
8342
|
proto.adoptedCallback = function() {
|
|
@@ -8340,12 +8361,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8340
8361
|
let processedVal = newVal;
|
|
8341
8362
|
if (newVal !== null) {
|
|
8342
8363
|
const ae = new ActionExpression(newVal);
|
|
8343
|
-
const expr = ae.getFirstExpression("
|
|
8364
|
+
const expr = ae.getFirstExpression("callReturn");
|
|
8344
8365
|
if (expr) {
|
|
8345
8366
|
const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
|
|
8346
8367
|
const helperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
|
|
8368
|
+
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
8347
8369
|
try {
|
|
8348
|
-
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
8349
8370
|
const result = FunctionUtils.executeReturn({
|
|
8350
8371
|
script,
|
|
8351
8372
|
context: this,
|
|
@@ -8371,6 +8392,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8371
8392
|
const metaList = attrChangeMap.get(name2);
|
|
8372
8393
|
if (metaList && Array.isArray(metaList)) {
|
|
8373
8394
|
for (const meta of metaList) {
|
|
8395
|
+
if (meta.options.while === "connected" && !this.__swc_connected) {
|
|
8396
|
+
continue;
|
|
8397
|
+
}
|
|
8374
8398
|
const convertedVal = convertAttributeValue(processedVal, meta.options.type);
|
|
8375
8399
|
this[meta.propertyKey](convertedVal, old, name2, hSet);
|
|
8376
8400
|
}
|
|
@@ -8404,7 +8428,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8404
8428
|
if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
|
|
8405
8429
|
let domVal = primaryTarget.getAttribute(attrName);
|
|
8406
8430
|
const ae = new ActionExpression(domVal);
|
|
8407
|
-
const expr = ae.getFirstExpression("
|
|
8431
|
+
const expr = ae.getFirstExpression("callReturn");
|
|
8408
8432
|
if (expr) {
|
|
8409
8433
|
try {
|
|
8410
8434
|
const result = FunctionUtils.executeReturn({
|
|
@@ -8666,6 +8690,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8666
8690
|
function applyInnerHtmlNode(selector, options = {}) {
|
|
8667
8691
|
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
8668
8692
|
}
|
|
8693
|
+
function applyInnerTextNode(selector, options = {}) {
|
|
8694
|
+
return applyNode(selector, { ...options, position: "innerText" });
|
|
8695
|
+
}
|
|
8669
8696
|
|
|
8670
8697
|
// src/decorators/applyClass.ts
|
|
8671
8698
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -9010,7 +9037,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9010
9037
|
list = [];
|
|
9011
9038
|
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
9012
9039
|
}
|
|
9013
|
-
list.push({ propertyKey,
|
|
9040
|
+
list.push({ propertyKey, options });
|
|
9014
9041
|
return descriptor;
|
|
9015
9042
|
};
|
|
9016
9043
|
}
|
|
@@ -9021,7 +9048,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9021
9048
|
let options = {};
|
|
9022
9049
|
if (Array.isArray(targetOrOptions)) {
|
|
9023
9050
|
options.path = targetOrOptions;
|
|
9024
|
-
} else if (typeof targetOrOptions === "string") {
|
|
9051
|
+
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
9025
9052
|
options.path = targetOrOptions;
|
|
9026
9053
|
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
9027
9054
|
options = targetOrOptions;
|
|
@@ -9167,6 +9194,22 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
9167
9194
|
return typeof obj?.hasActivate === "function";
|
|
9168
9195
|
};
|
|
9169
9196
|
})(RouterAction || (RouterAction = {}));
|
|
9197
|
+
|
|
9198
|
+
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
9199
|
+
var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
|
|
9200
|
+
|
|
9201
|
+
// ../simple-boot/dist/esm/fetch/ApiService.js
|
|
9202
|
+
var ApiServiceInterceptor;
|
|
9203
|
+
((ApiServiceInterceptor2) => {
|
|
9204
|
+
ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
|
|
9205
|
+
ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
|
|
9206
|
+
try {
|
|
9207
|
+
return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
|
|
9208
|
+
} catch (e) {
|
|
9209
|
+
return [];
|
|
9210
|
+
}
|
|
9211
|
+
};
|
|
9212
|
+
})(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
|
|
9170
9213
|
return __toCommonJS(bundle_entry_exports);
|
|
9171
9214
|
})();
|
|
9172
9215
|
/*! Bundled license information:
|