@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
|
@@ -5727,6 +5727,11 @@ var Expression;
|
|
|
5727
5727
|
})(Expression || (Expression = {}));
|
|
5728
5728
|
|
|
5729
5729
|
// ../core/dist/esm/expression/ActionExpression.js
|
|
5730
|
+
var DEFAULT_EXPRESSION_CONFIG = {
|
|
5731
|
+
"callReturn": { start: "{{=", end: "}}" },
|
|
5732
|
+
"call": { start: "{{@", end: "}}" },
|
|
5733
|
+
"replace": { start: "{{", end: "}}" }
|
|
5734
|
+
};
|
|
5730
5735
|
var ActionExpression = class {
|
|
5731
5736
|
constructor(value, config) {
|
|
5732
5737
|
this.originalTemplate = value || "";
|
|
@@ -5740,12 +5745,19 @@ var ActionExpression = class {
|
|
|
5740
5745
|
}
|
|
5741
5746
|
this.maskingTemplate = value;
|
|
5742
5747
|
this.currentTemplate = value;
|
|
5743
|
-
|
|
5744
|
-
|
|
5748
|
+
const exprConfig = {
|
|
5749
|
+
"callReturn": config?.expression?.["callReturn"] || DEFAULT_EXPRESSION_CONFIG["callReturn"],
|
|
5750
|
+
"call": config?.expression?.call || DEFAULT_EXPRESSION_CONFIG.call,
|
|
5751
|
+
"replace": config?.expression?.replace || DEFAULT_EXPRESSION_CONFIG.replace
|
|
5752
|
+
};
|
|
5753
|
+
const types = ["callReturn", "call", "replace"];
|
|
5754
|
+
types.sort((a, b) => exprConfig[b].start.length - exprConfig[a].start.length);
|
|
5755
|
+
for (const type of types) {
|
|
5756
|
+
const marker = exprConfig[type];
|
|
5757
|
+
if (marker) {
|
|
5758
|
+
this.processExpressionType(type, marker.start, marker.end);
|
|
5759
|
+
}
|
|
5745
5760
|
}
|
|
5746
|
-
this.processCallReturnExpressions(this.currentTemplate);
|
|
5747
|
-
this.processCallExpressions(this.currentTemplate);
|
|
5748
|
-
this.processReplaceExpressions(this.currentTemplate);
|
|
5749
5761
|
this.sortExpressionsByPosition();
|
|
5750
5762
|
this.maskingTemplate = this.currentTemplate;
|
|
5751
5763
|
}
|
|
@@ -5756,45 +5768,17 @@ var ActionExpression = class {
|
|
|
5756
5768
|
});
|
|
5757
5769
|
this.expressions.sort((a, b) => (a.index ?? 0) - (b.index ?? 0));
|
|
5758
5770
|
}
|
|
5759
|
-
|
|
5760
|
-
const
|
|
5761
|
-
const
|
|
5762
|
-
const
|
|
5771
|
+
processExpressionType(type, start, end) {
|
|
5772
|
+
const escapedStart = start.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5773
|
+
const escapedEnd = end.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
5774
|
+
const regex = new RegExp(`${escapedStart}\\s*([\\s\\S]+?)\\s*${escapedEnd}`, "g");
|
|
5763
5775
|
let match;
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
const wrappedCallRegex = new RegExp(`${escapedWrap}\\{\\{@\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
|
|
5768
|
-
while ((match = wrappedCallRegex.exec(value)) !== null) {
|
|
5769
|
-
this.addExpression(match, "call", wrapChar);
|
|
5770
|
-
}
|
|
5771
|
-
const wrappedReplaceRegex = new RegExp(`${escapedWrap}\\{\\{(?![=@])\\s*(.+?)\\s*\\}\\}${escapedWrap}`, "g");
|
|
5772
|
-
while ((match = wrappedReplaceRegex.exec(value)) !== null) {
|
|
5773
|
-
this.addExpression(match, "replace", wrapChar);
|
|
5776
|
+
const valueToMatch = this.currentTemplate;
|
|
5777
|
+
while ((match = regex.exec(valueToMatch)) !== null) {
|
|
5778
|
+
this.addExpression(match, type);
|
|
5774
5779
|
}
|
|
5775
5780
|
}
|
|
5776
|
-
|
|
5777
|
-
const callReturnRegex = /(?<![a-zA-Z0-9$_@#.])\{\{=\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5778
|
-
let match;
|
|
5779
|
-
while ((match = callReturnRegex.exec(value)) !== null) {
|
|
5780
|
-
this.addExpression(match, "call-return");
|
|
5781
|
-
}
|
|
5782
|
-
}
|
|
5783
|
-
processCallExpressions(value) {
|
|
5784
|
-
const callRegex = /(?<![a-zA-Z0-9$_@#.])\{\{@\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5785
|
-
let match;
|
|
5786
|
-
while ((match = callRegex.exec(value)) !== null) {
|
|
5787
|
-
this.addExpression(match, "call");
|
|
5788
|
-
}
|
|
5789
|
-
}
|
|
5790
|
-
processReplaceExpressions(value) {
|
|
5791
|
-
const replaceRegex = /(?<![a-zA-Z0-9$_@#.])\{\{(?![=@])\s*(.+?)\s*\}\}(?![a-zA-Z0-9$_@#.])/g;
|
|
5792
|
-
let match;
|
|
5793
|
-
while ((match = replaceRegex.exec(value)) !== null) {
|
|
5794
|
-
this.addExpression(match, "replace");
|
|
5795
|
-
}
|
|
5796
|
-
}
|
|
5797
|
-
addExpression(match, type, wrap) {
|
|
5781
|
+
addExpression(match, type) {
|
|
5798
5782
|
const id = Math.random().toString(36).substr(2, 9);
|
|
5799
5783
|
const original = match[0];
|
|
5800
5784
|
const rawScript = match[1];
|
|
@@ -5809,13 +5793,9 @@ var ActionExpression = class {
|
|
|
5809
5793
|
original,
|
|
5810
5794
|
script: rawScript.trim(),
|
|
5811
5795
|
expressionStart,
|
|
5812
|
-
expressionEnd
|
|
5813
|
-
...wrap && { wrap }
|
|
5796
|
+
expressionEnd
|
|
5814
5797
|
});
|
|
5815
5798
|
}
|
|
5816
|
-
/**
|
|
5817
|
-
* 구현 메서드
|
|
5818
|
-
*/
|
|
5819
5799
|
replace(idOrExpr, valueOrCallback) {
|
|
5820
5800
|
const id = typeof idOrExpr === "string" ? idOrExpr : idOrExpr.id;
|
|
5821
5801
|
let expr;
|
|
@@ -5831,9 +5811,6 @@ var ActionExpression = class {
|
|
|
5831
5811
|
}
|
|
5832
5812
|
return this.getUnprocessedTemplate();
|
|
5833
5813
|
}
|
|
5834
|
-
/**
|
|
5835
|
-
* 구현 메서드
|
|
5836
|
-
*/
|
|
5837
5814
|
getExpressions(typeOrOptions) {
|
|
5838
5815
|
if (!typeOrOptions) {
|
|
5839
5816
|
return this.expressions;
|
|
@@ -5844,13 +5821,9 @@ var ActionExpression = class {
|
|
|
5844
5821
|
const options = typeOrOptions;
|
|
5845
5822
|
return this.expressions.filter((expr) => {
|
|
5846
5823
|
if (options.type && expr.type !== options.type) return false;
|
|
5847
|
-
if ("wrap" in options && expr.wrap !== options.wrap) return false;
|
|
5848
5824
|
return true;
|
|
5849
5825
|
});
|
|
5850
5826
|
}
|
|
5851
|
-
/**
|
|
5852
|
-
* 구현 메서드
|
|
5853
|
-
*/
|
|
5854
5827
|
getFirstExpression(typeOrOptions) {
|
|
5855
5828
|
if (!typeOrOptions) {
|
|
5856
5829
|
return this.getExpressions()[0];
|
|
@@ -5860,28 +5833,15 @@ var ActionExpression = class {
|
|
|
5860
5833
|
}
|
|
5861
5834
|
return this.getExpressions(typeOrOptions)[0];
|
|
5862
5835
|
}
|
|
5863
|
-
/**
|
|
5864
|
-
* 원본 템플릿을 반환합니다.
|
|
5865
|
-
*/
|
|
5866
5836
|
getOriginalTemplate() {
|
|
5867
5837
|
return this.originalTemplate;
|
|
5868
5838
|
}
|
|
5869
|
-
/**
|
|
5870
|
-
* 마스킹 처리된 템플릿을 반환합니다.
|
|
5871
|
-
*/
|
|
5872
5839
|
getMaskingTemplate() {
|
|
5873
5840
|
return this.maskingTemplate;
|
|
5874
5841
|
}
|
|
5875
|
-
/**
|
|
5876
|
-
* 현재 처리 상태의 템플릿을 반환합니다.
|
|
5877
|
-
*/
|
|
5878
5842
|
getCurrentTemplate() {
|
|
5879
5843
|
return this.currentTemplate;
|
|
5880
5844
|
}
|
|
5881
|
-
/**
|
|
5882
|
-
* 미처리된 마커들을 원본으로 복원한 템플릿을 반환합니다.
|
|
5883
|
-
* replace() 호출 후 처리되지 않은 표현식들을 원본 형태로 되돌립니다.
|
|
5884
|
-
*/
|
|
5885
5845
|
getUnprocessedTemplate() {
|
|
5886
5846
|
let result = this.currentTemplate;
|
|
5887
5847
|
for (const expr of this.expressions) {
|
|
@@ -5944,17 +5904,16 @@ function createLifecycleDecorator(metadataKey) {
|
|
|
5944
5904
|
};
|
|
5945
5905
|
}
|
|
5946
5906
|
var onInitialize = createLifecycleDecorator(ON_INITIALIZE_METADATA_KEY);
|
|
5947
|
-
var
|
|
5948
|
-
var
|
|
5949
|
-
var onConnected =
|
|
5950
|
-
var
|
|
5951
|
-
var
|
|
5952
|
-
var onDisconnected =
|
|
5953
|
-
var
|
|
5954
|
-
var
|
|
5955
|
-
var onAdopted =
|
|
5907
|
+
var onConnectedBefore = createLifecycleDecorator(ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
5908
|
+
var onConnectedAfter = createLifecycleDecorator(ON_AFTER_CONNECTED_METADATA_KEY);
|
|
5909
|
+
var onConnected = onConnectedAfter;
|
|
5910
|
+
var onDisconnectedBefore = createLifecycleDecorator(ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
5911
|
+
var onDisconnectedAfter = createLifecycleDecorator(ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
5912
|
+
var onDisconnected = onDisconnectedAfter;
|
|
5913
|
+
var onAdoptedBefore = createLifecycleDecorator(ON_BEFORE_ADOPTED_METADATA_KEY);
|
|
5914
|
+
var onAdoptedAfter = createLifecycleDecorator(ON_AFTER_ADOPTED_METADATA_KEY);
|
|
5915
|
+
var onAdopted = onAdoptedAfter;
|
|
5956
5916
|
var onAddEventListener = createLifecycleDecorator(ON_ADD_EVENT_LISTENER_METADATA_KEY);
|
|
5957
|
-
var onConnectedSwcApp = createLifecycleDecorator(ON_CONNECTED_SWC_APP_METADATA_KEY);
|
|
5958
5917
|
function onConnectedInnerHtml(arg1, arg2, arg3) {
|
|
5959
5918
|
const decorator = (options, target, propertyKey) => {
|
|
5960
5919
|
const constructor = target.constructor;
|
|
@@ -6110,13 +6069,25 @@ var htmlArticleElement = (options) => {
|
|
|
6110
6069
|
};
|
|
6111
6070
|
var SwcUtils;
|
|
6112
6071
|
((SwcUtils2) => {
|
|
6072
|
+
SwcUtils2.getParentContainer = (e) => {
|
|
6073
|
+
return e.parentElement ?? e.getRootNode();
|
|
6074
|
+
};
|
|
6113
6075
|
SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
|
|
6114
6076
|
return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
|
|
6115
6077
|
};
|
|
6116
|
-
SwcUtils2.parsePathPatternsSet = (pathPattern,
|
|
6078
|
+
SwcUtils2.parsePathPatternsSet = (pathPattern, urlAndRouter) => {
|
|
6079
|
+
urlAndRouter ?? (urlAndRouter = "/");
|
|
6080
|
+
const p = typeof urlAndRouter === "string" ? urlAndRouter : urlAndRouter.value.url;
|
|
6081
|
+
const searchParams = new URLSearchParams();
|
|
6082
|
+
const qs = p.split("?")[1];
|
|
6083
|
+
qs?.split("&").forEach((it) => {
|
|
6084
|
+
const [k, v] = it.split("=");
|
|
6085
|
+
searchParams.set(k, v);
|
|
6086
|
+
});
|
|
6117
6087
|
return {
|
|
6118
|
-
path,
|
|
6119
|
-
|
|
6088
|
+
path: p,
|
|
6089
|
+
searchParams,
|
|
6090
|
+
pathData: SwcUtils2.parsePathPatterns(pathPattern, p)
|
|
6120
6091
|
};
|
|
6121
6092
|
};
|
|
6122
6093
|
SwcUtils2.parsePathPatterns = (pathPattern, path) => {
|
|
@@ -6157,7 +6128,8 @@ var SwcUtils;
|
|
|
6157
6128
|
return current;
|
|
6158
6129
|
};
|
|
6159
6130
|
SwcUtils2.findNearestSwcHost = (el) => {
|
|
6160
|
-
|
|
6131
|
+
const el1 = el;
|
|
6132
|
+
if (el1.__swc_host) return el1.__swc_host;
|
|
6161
6133
|
let current = el.parentElement || el.getRootNode?.()?.host;
|
|
6162
6134
|
const doc = el.ownerDocument;
|
|
6163
6135
|
const win = doc?.defaultView || (typeof window !== "undefined" ? window : void 0);
|
|
@@ -6248,6 +6220,7 @@ var SwcUtils;
|
|
|
6248
6220
|
$hosts,
|
|
6249
6221
|
$firstHost,
|
|
6250
6222
|
$lastHost: $parentHost,
|
|
6223
|
+
$templateHost: el.__swc_template_host,
|
|
6251
6224
|
$appHost,
|
|
6252
6225
|
$appHosts,
|
|
6253
6226
|
$firstAppHost,
|
|
@@ -6358,11 +6331,17 @@ var getEmitCustomEventMetadataList = (target) => {
|
|
|
6358
6331
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
6359
6332
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
6360
6333
|
};
|
|
6361
|
-
function emitCustomEventHost(type,
|
|
6362
|
-
if (
|
|
6363
|
-
|
|
6334
|
+
function emitCustomEventHost(type, optionsOrAttributeaName) {
|
|
6335
|
+
if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "string") {
|
|
6336
|
+
return emitCustomEventHost(type, { attributeName: optionsOrAttributeaName });
|
|
6337
|
+
} else if (optionsOrAttributeaName && typeof optionsOrAttributeaName === "object") {
|
|
6338
|
+
if (!optionsOrAttributeaName.attributeName) {
|
|
6339
|
+
optionsOrAttributeaName.attributeName = `on-emit-${type}`;
|
|
6340
|
+
}
|
|
6341
|
+
return emitCustomEvent(":host", type, optionsOrAttributeaName);
|
|
6342
|
+
} else {
|
|
6343
|
+
return emitCustomEvent(":host", type, { attributeName: `on-emit-${type}` });
|
|
6364
6344
|
}
|
|
6365
|
-
return emitCustomEvent(":host", type, options);
|
|
6366
6345
|
}
|
|
6367
6346
|
|
|
6368
6347
|
// src/decorators/changedAttributeHost.ts
|
|
@@ -7853,7 +7832,13 @@ var setupPrototype = (proto) => {
|
|
|
7853
7832
|
const app = useHostSet?.$appHost?.simpleApplication;
|
|
7854
7833
|
if (app) {
|
|
7855
7834
|
const otherStorage = /* @__PURE__ */ new Map();
|
|
7856
|
-
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({
|
|
7835
|
+
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({
|
|
7836
|
+
situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */,
|
|
7837
|
+
data: useHostSet.$host
|
|
7838
|
+
}), 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({
|
|
7839
|
+
situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */,
|
|
7840
|
+
data: useHostSet.$firstAppHost
|
|
7841
|
+
}), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
|
|
7857
7842
|
otherStorage.set(SituationTypeContainers, situations);
|
|
7858
7843
|
return app.simstanceManager.executeBindParameterSim(
|
|
7859
7844
|
{
|
|
@@ -7946,203 +7931,243 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7946
7931
|
const swcOnEvents = DOM_EVENT_NAMES.map((e) => `swc-on-${e}`);
|
|
7947
7932
|
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.options.name).filter(Boolean);
|
|
7948
7933
|
const hostAttributes = attributeList.filter((it) => it.selector === ":host").map((it) => it.options.name || String(it.propertyKey));
|
|
7949
|
-
const proto = constructor.prototype;
|
|
7950
7934
|
const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
|
|
7951
|
-
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([
|
|
7952
|
-
...metadata.observedAttributes ?? [],
|
|
7953
|
-
...originalStaticObservedAttributes,
|
|
7954
|
-
...attrChangeMap.keys(),
|
|
7955
|
-
...attributeApplyNames,
|
|
7956
|
-
...hostAttributes,
|
|
7957
|
-
...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean),
|
|
7958
|
-
...swcLifecycleAttributes,
|
|
7959
|
-
...swcOnEvents
|
|
7960
|
-
])];
|
|
7935
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
7961
7936
|
const connectedInnerHtmlList = getOnConnectedInnerHtmlMetadata(constructor) || [];
|
|
7937
|
+
const proto = constructor.prototype;
|
|
7962
7938
|
setupPrototype(proto);
|
|
7939
|
+
let helperHostSet = null;
|
|
7963
7940
|
const originalConnected = proto.connectedCallback;
|
|
7964
|
-
proto.connectedCallback = function() {
|
|
7941
|
+
proto.connectedCallback = async function() {
|
|
7965
7942
|
ensureInit(this);
|
|
7966
|
-
|
|
7967
|
-
const appHost2 =
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7943
|
+
helperHostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
7944
|
+
const appHost2 = helperHostSet.$appHost;
|
|
7945
|
+
try {
|
|
7946
|
+
if (appHost2 && typeof appHost2._connected === "function") {
|
|
7947
|
+
await appHost2._connected(this);
|
|
7948
|
+
} else if (appHost2 && typeof appHost2) {
|
|
7949
|
+
appHost2._connected_safari ?? (appHost2._connected_safari = []);
|
|
7950
|
+
appHost2._connected_safari.push(this);
|
|
7951
|
+
}
|
|
7952
|
+
const conf = getElementConfig(this);
|
|
7953
|
+
const currentWin = this._resolveWindow(conf);
|
|
7954
|
+
const shadowMode = conf?.useShadow || connectedInnerHtmlList.find((it) => it.options.useShadow)?.options.useShadow;
|
|
7955
|
+
if (shadowMode && !this.shadowRoot) {
|
|
7956
|
+
const mode = shadowMode === true ? "open" : shadowMode;
|
|
7957
|
+
this.attachShadow({ mode });
|
|
7958
|
+
}
|
|
7959
|
+
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_CONNECTED_METADATA_KEY);
|
|
7960
|
+
if (bMethods) {
|
|
7961
|
+
for (const m of bMethods) await this._invokeLifecycleMethod(m, helperHostSet);
|
|
7962
|
+
}
|
|
7963
|
+
this._executeSwcScript("swc-on-before-connected", helperHostSet);
|
|
7964
|
+
if (connectedInnerHtmlList.length > 0) {
|
|
7965
|
+
let sContent = "", lContent = "";
|
|
7966
|
+
for (const meta of connectedInnerHtmlList) {
|
|
7967
|
+
let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
|
|
7968
|
+
const actionExpression = new ActionExpression(res, {
|
|
7969
|
+
expression: {
|
|
7970
|
+
replace: {
|
|
7971
|
+
start: meta.options.replaceWrap?.start || "{%{",
|
|
7972
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
7973
|
+
},
|
|
7974
|
+
callReturn: {
|
|
7975
|
+
start: meta.options.replaceWrap?.start || "{%{=",
|
|
7976
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
7977
|
+
},
|
|
7978
|
+
call: {
|
|
7979
|
+
start: meta.options.replaceWrap?.start || "{%{@",
|
|
7980
|
+
end: meta.options.replaceWrap?.end || "}%}"
|
|
7981
|
+
}
|
|
7982
|
+
}
|
|
7983
|
+
});
|
|
7984
|
+
actionExpression.getExpressions().filter((it) => it.type === "replace").forEach((it) => {
|
|
7985
|
+
try {
|
|
7986
|
+
const sr = FunctionUtils.executeReturn({ script: it.script, context: this, args: helperHostSet });
|
|
7987
|
+
actionExpression.replace(it, sr);
|
|
7988
|
+
} catch (e) {
|
|
7989
|
+
console.error(`[SWC] Failed to execute connectedInnerHTML:`, e);
|
|
7990
|
+
}
|
|
7991
|
+
});
|
|
7992
|
+
res = actionExpression.getUnprocessedTemplate();
|
|
7993
|
+
if (res !== void 0) {
|
|
7994
|
+
if (meta.options.useShadow || conf?.useShadow) sContent += res;
|
|
7995
|
+
else lContent += res;
|
|
7996
|
+
}
|
|
7997
|
+
}
|
|
7998
|
+
try {
|
|
7999
|
+
if (this.shadowRoot) {
|
|
8000
|
+
this.shadowRoot.innerHTML = sContent;
|
|
8001
|
+
}
|
|
8002
|
+
if (lContent) {
|
|
8003
|
+
this.innerHTML = lContent;
|
|
8004
|
+
}
|
|
8005
|
+
} catch (e) {
|
|
8006
|
+
console.error("[ElementDefine] innerHTML setting error:", e);
|
|
7987
8007
|
}
|
|
7988
8008
|
}
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
|
|
8009
|
+
const root = this.getRootNode();
|
|
8010
|
+
if (!globalDelegatedRoots.has(root)) {
|
|
8011
|
+
DOM_EVENT_NAMES.forEach((type) => {
|
|
8012
|
+
root.addEventListener(type, handleGlobalSwcEvent);
|
|
8013
|
+
});
|
|
8014
|
+
globalDelegatedRoots.add(root);
|
|
7994
8015
|
}
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8016
|
+
const delegateListeners = [];
|
|
8017
|
+
const nonDelegateListeners = [];
|
|
8018
|
+
addEventListenerList.forEach((meta) => {
|
|
8019
|
+
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 !== "") {
|
|
8020
|
+
delegateListeners.push(meta);
|
|
8021
|
+
} else {
|
|
8022
|
+
nonDelegateListeners.push(meta);
|
|
8023
|
+
}
|
|
8000
8024
|
});
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
});
|
|
8039
|
-
const unifiedHandler = async (event) => {
|
|
8040
|
-
for (const meta of sortedMetaList) {
|
|
8041
|
-
const { selector, options } = meta;
|
|
8042
|
-
const matchedEl = event.target.closest(selector);
|
|
8043
|
-
if (matchedEl && br.contains(matchedEl)) {
|
|
8044
|
-
if (options.filter) {
|
|
8045
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
8046
|
-
if (!options.filter(event, helper)) {
|
|
8047
|
-
continue;
|
|
8025
|
+
const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
|
|
8026
|
+
delegateListeners.forEach((meta) => {
|
|
8027
|
+
const r = meta.options.root || "auto";
|
|
8028
|
+
const rootKey = `${meta.type}:${r}`;
|
|
8029
|
+
if (!delegatesByTypeAndRoot.has(rootKey)) {
|
|
8030
|
+
delegatesByTypeAndRoot.set(rootKey, []);
|
|
8031
|
+
}
|
|
8032
|
+
delegatesByTypeAndRoot.get(rootKey).push(meta);
|
|
8033
|
+
});
|
|
8034
|
+
delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
|
|
8035
|
+
const [type, rStr] = typeRootKey.split(":");
|
|
8036
|
+
const r = rStr === "auto" ? "auto" : rStr;
|
|
8037
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
8038
|
+
const bindRoots = [];
|
|
8039
|
+
if (r === "auto") bindRoots.push(this.shadowRoot || this);
|
|
8040
|
+
else if (r === "light") bindRoots.push(this);
|
|
8041
|
+
else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
8042
|
+
else if (r === "all") {
|
|
8043
|
+
bindRoots.push(this);
|
|
8044
|
+
if (this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
8045
|
+
}
|
|
8046
|
+
bindRoots.forEach((br) => {
|
|
8047
|
+
const sortedMetaList = [...metaList].sort((a, b) => {
|
|
8048
|
+
const aStop = a.options.stopPropagation ? 1 : 0;
|
|
8049
|
+
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
8050
|
+
return bStop - aStop;
|
|
8051
|
+
});
|
|
8052
|
+
const unifiedHandler = async (event) => {
|
|
8053
|
+
for (const meta of sortedMetaList) {
|
|
8054
|
+
const { selector, options } = meta;
|
|
8055
|
+
const matchedEl = event.target.closest(selector);
|
|
8056
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
8057
|
+
if (options.filter) {
|
|
8058
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
8059
|
+
if (!options.filter(event, helper)) {
|
|
8060
|
+
continue;
|
|
8061
|
+
}
|
|
8048
8062
|
}
|
|
8063
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
8064
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8065
|
+
if (options.preventDefault) event.preventDefault();
|
|
8066
|
+
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8067
|
+
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
8068
|
+
await this[meta.propertyKey](event, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
8069
|
+
if (event.cancelBubble) break;
|
|
8049
8070
|
}
|
|
8050
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
8051
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8052
|
-
if (options.preventDefault) event.preventDefault();
|
|
8053
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8054
|
-
const args = { event, ...currentHostSet, $el: matchedEl, $root: br };
|
|
8055
|
-
await this[meta.propertyKey](event, currentHostSet, matchedEl, args);
|
|
8056
|
-
if (event.cancelBubble) break;
|
|
8057
8071
|
}
|
|
8072
|
+
};
|
|
8073
|
+
br.addEventListener(type, unifiedHandler, opts);
|
|
8074
|
+
this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
|
|
8075
|
+
});
|
|
8076
|
+
});
|
|
8077
|
+
nonDelegateListeners.forEach((meta) => {
|
|
8078
|
+
const { selector, type, options } = meta;
|
|
8079
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
8080
|
+
const bindTargets = [];
|
|
8081
|
+
const r = options.root || "auto";
|
|
8082
|
+
const applyRootOption = (target) => {
|
|
8083
|
+
if (!target) return;
|
|
8084
|
+
if (r === "auto") {
|
|
8085
|
+
bindTargets.push(target.shadowRoot || target);
|
|
8086
|
+
} else {
|
|
8087
|
+
if (r === "light" || r === "all") bindTargets.push(target);
|
|
8088
|
+
if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
|
|
8058
8089
|
}
|
|
8059
8090
|
};
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
if (!
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
if (r === "light"
|
|
8075
|
-
if (
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
else if (selector === ":lastHost") applyRootOption(hostSet.$lastHost);
|
|
8084
|
-
else if (selector === ":firstAppHost") applyRootOption(hostSet.$firstAppHost);
|
|
8085
|
-
else if (selector === ":lastAppHost") applyRootOption(hostSet.$lastAppHost);
|
|
8086
|
-
else if (selector === ":hosts") hostSet.$hosts.forEach(applyRootOption);
|
|
8087
|
-
else if (selector === ":appHosts") hostSet.$appHosts.forEach(applyRootOption);
|
|
8088
|
-
else if (selector === ":host" || !selector) applyRootOption(this);
|
|
8089
|
-
else {
|
|
8090
|
-
const searchRoots = [];
|
|
8091
|
-
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
8092
|
-
else if (r === "light") searchRoots.push(this);
|
|
8093
|
-
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8094
|
-
else if (r === "all") {
|
|
8095
|
-
searchRoots.push(this);
|
|
8096
|
-
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8091
|
+
if (selector === ":window") bindTargets.push(currentWin);
|
|
8092
|
+
else if (selector === ":document") bindTargets.push(currentWin.document);
|
|
8093
|
+
else if (selector === ":parentHost") applyRootOption(helperHostSet.$parentHost);
|
|
8094
|
+
else if (selector === ":appHost") applyRootOption(helperHostSet.$appHost);
|
|
8095
|
+
else if (selector === ":firstHost") applyRootOption(helperHostSet.$firstHost);
|
|
8096
|
+
else if (selector === ":lastHost") applyRootOption(helperHostSet.$lastHost);
|
|
8097
|
+
else if (selector === ":firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
|
|
8098
|
+
else if (selector === ":lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
|
|
8099
|
+
else if (selector === ":hosts") helperHostSet.$hosts.forEach(applyRootOption);
|
|
8100
|
+
else if (selector === ":appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
|
|
8101
|
+
else if (selector === ":host" || !selector) applyRootOption(this);
|
|
8102
|
+
else {
|
|
8103
|
+
const searchRoots = [];
|
|
8104
|
+
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
8105
|
+
else if (r === "light") searchRoots.push(this);
|
|
8106
|
+
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8107
|
+
else if (r === "all") {
|
|
8108
|
+
searchRoots.push(this);
|
|
8109
|
+
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
8110
|
+
}
|
|
8111
|
+
searchRoots.forEach((sr) => {
|
|
8112
|
+
sr.querySelectorAll(selector).forEach((el) => bindTargets.push(el));
|
|
8113
|
+
});
|
|
8097
8114
|
}
|
|
8098
|
-
|
|
8099
|
-
|
|
8115
|
+
bindTargets.forEach((t) => {
|
|
8116
|
+
const handler = async (event) => {
|
|
8117
|
+
if (options.filter) {
|
|
8118
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
8119
|
+
if (!options.filter(event, { currentThis: this, helper })) {
|
|
8120
|
+
return;
|
|
8121
|
+
}
|
|
8122
|
+
}
|
|
8123
|
+
if (options.stopPropagation) event.stopPropagation();
|
|
8124
|
+
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8125
|
+
if (options.preventDefault) event.preventDefault();
|
|
8126
|
+
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8127
|
+
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
8128
|
+
await this[meta.propertyKey](event, { currentHostSet, $$matchedElement: event.currentTarget }, args);
|
|
8129
|
+
};
|
|
8130
|
+
t.addEventListener(type, handler, opts);
|
|
8131
|
+
if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
|
|
8132
|
+
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
8133
|
+
}
|
|
8100
8134
|
});
|
|
8101
|
-
}
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8135
|
+
});
|
|
8136
|
+
if (originalConnected) await originalConnected.apply(this);
|
|
8137
|
+
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_CONNECTED_METADATA_KEY);
|
|
8138
|
+
if (aMethods) {
|
|
8139
|
+
for (const m of aMethods) await this._invokeLifecycleMethod(m, helperHostSet);
|
|
8140
|
+
}
|
|
8141
|
+
this._executeSwcScript("swc-on-connected", helperHostSet);
|
|
8142
|
+
this._executeSwcScript("swc-on-after-connected", helperHostSet);
|
|
8143
|
+
this.__swc_connected = true;
|
|
8144
|
+
for (let [name2, metaList] of Array.from(attrChangeMap)) {
|
|
8145
|
+
for (const meta of metaList) {
|
|
8146
|
+
if (meta.options.while === "connected") {
|
|
8147
|
+
const val = getAttributeValue(this, name2, { type: meta.options.type });
|
|
8148
|
+
if (val !== null) {
|
|
8149
|
+
await this[meta.propertyKey](val, null, name2, helperHostSet);
|
|
8108
8150
|
}
|
|
8109
8151
|
}
|
|
8110
|
-
if (options.stopPropagation) event.stopPropagation();
|
|
8111
|
-
if (options.stopImmediatePropagation) event.stopImmediatePropagation();
|
|
8112
|
-
if (options.preventDefault) event.preventDefault();
|
|
8113
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
8114
|
-
const args = { event, ...currentHostSet, $el: t, $root: t };
|
|
8115
|
-
await this[meta.propertyKey](event, currentHostSet, args);
|
|
8116
|
-
};
|
|
8117
|
-
t.addEventListener(type, handler, opts);
|
|
8118
|
-
if (options.removeOnDisconnected === true || t === currentWin || t === currentWin.document) {
|
|
8119
|
-
this._boundListeners.push({ target: t, type, handler, options: opts });
|
|
8120
8152
|
}
|
|
8121
|
-
}
|
|
8122
|
-
}
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8126
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m, hostSet);
|
|
8127
|
-
}
|
|
8128
|
-
this._executeSwcScript("swc-on-connected", hostSet);
|
|
8129
|
-
this._executeSwcScript("swc-on-after-connected", hostSet);
|
|
8130
|
-
this.__swc_connected = true;
|
|
8131
|
-
const appHostss = SwcUtils.findAllParentAppHostsDirect(this);
|
|
8132
|
-
if (appHost2 && typeof appHost2._connected === "function") {
|
|
8133
|
-
appHost2._connected(this);
|
|
8134
|
-
} else if (appHost2 && typeof appHost2) {
|
|
8135
|
-
appHost2._connected_safari ?? (appHost2._connected_safari = []);
|
|
8136
|
-
appHost2._connected_safari.push(this);
|
|
8153
|
+
}
|
|
8154
|
+
} finally {
|
|
8155
|
+
if (appHost2 && typeof appHost2._connectedDone === "function") {
|
|
8156
|
+
await appHost2._connectedDone(this);
|
|
8157
|
+
}
|
|
8137
8158
|
}
|
|
8138
8159
|
};
|
|
8139
8160
|
const originalDisconnected = proto.disconnectedCallback;
|
|
8140
8161
|
proto.disconnectedCallback = function() {
|
|
8141
|
-
|
|
8142
|
-
|
|
8162
|
+
console.log("disconnnnnnnnnnnnnnnnnnn", helperHostSet, this);
|
|
8163
|
+
const appHost2 = helperHostSet.$appHost;
|
|
8164
|
+
if (appHost2 && typeof appHost2._disconnected === "function") {
|
|
8165
|
+
appHost2._disconnected(this);
|
|
8166
|
+
}
|
|
8167
|
+
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
8143
8168
|
const bMethods = findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY);
|
|
8144
8169
|
if (bMethods) {
|
|
8145
|
-
for (const m of bMethods) this._invokeLifecycleMethod(m,
|
|
8170
|
+
for (const m of bMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
8146
8171
|
}
|
|
8147
8172
|
if (this._boundListeners) {
|
|
8148
8173
|
this._boundListeners.forEach((l) => l.target.removeEventListener(l.type, l.handler, l.options));
|
|
@@ -8151,15 +8176,11 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
8151
8176
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
8152
8177
|
const aMethods = findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY);
|
|
8153
8178
|
if (aMethods) {
|
|
8154
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m,
|
|
8179
|
+
for (const m of aMethods) this._invokeLifecycleMethod(m, helperHostSet);
|
|
8155
8180
|
}
|
|
8156
|
-
this._executeSwcScript("swc-on-disconnected",
|
|
8157
|
-
this._executeSwcScript("swc-on-after-disconnected",
|
|
8181
|
+
this._executeSwcScript("swc-on-disconnected", helperHostSet);
|
|
8182
|
+
this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
|
|
8158
8183
|
this.__swc_connected = false;
|
|
8159
|
-
const appHost2 = hostSet.$appHost;
|
|
8160
|
-
if (appHost2 && typeof appHost2._disconnected === "function") {
|
|
8161
|
-
appHost2._disconnected(this);
|
|
8162
|
-
}
|
|
8163
8184
|
};
|
|
8164
8185
|
const originalAdopted = proto.adoptedCallback;
|
|
8165
8186
|
proto.adoptedCallback = function() {
|
|
@@ -8184,12 +8205,12 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
8184
8205
|
let processedVal = newVal;
|
|
8185
8206
|
if (newVal !== null) {
|
|
8186
8207
|
const ae = new ActionExpression(newVal);
|
|
8187
|
-
const expr = ae.getFirstExpression("
|
|
8208
|
+
const expr = ae.getFirstExpression("callReturn");
|
|
8188
8209
|
if (expr) {
|
|
8189
8210
|
const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
|
|
8190
8211
|
const helperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
|
|
8212
|
+
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
8191
8213
|
try {
|
|
8192
|
-
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
8193
8214
|
const result = FunctionUtils.executeReturn({
|
|
8194
8215
|
script,
|
|
8195
8216
|
context: this,
|
|
@@ -8215,6 +8236,9 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
8215
8236
|
const metaList = attrChangeMap.get(name2);
|
|
8216
8237
|
if (metaList && Array.isArray(metaList)) {
|
|
8217
8238
|
for (const meta of metaList) {
|
|
8239
|
+
if (meta.options.while === "connected" && !this.__swc_connected) {
|
|
8240
|
+
continue;
|
|
8241
|
+
}
|
|
8218
8242
|
const convertedVal = convertAttributeValue(processedVal, meta.options.type);
|
|
8219
8243
|
this[meta.propertyKey](convertedVal, old, name2, hSet);
|
|
8220
8244
|
}
|
|
@@ -8248,7 +8272,7 @@ var getAttributeValue = (inst, attrName, options) => {
|
|
|
8248
8272
|
if (primaryTarget && typeof primaryTarget.hasAttribute === "function" && primaryTarget.hasAttribute(attrName)) {
|
|
8249
8273
|
let domVal = primaryTarget.getAttribute(attrName);
|
|
8250
8274
|
const ae = new ActionExpression(domVal);
|
|
8251
|
-
const expr = ae.getFirstExpression("
|
|
8275
|
+
const expr = ae.getFirstExpression("callReturn");
|
|
8252
8276
|
if (expr) {
|
|
8253
8277
|
try {
|
|
8254
8278
|
const result = FunctionUtils.executeReturn({
|
|
@@ -8510,6 +8534,9 @@ function applyReplaceChildrenNode(selector, options = {}) {
|
|
|
8510
8534
|
function applyInnerHtmlNode(selector, options = {}) {
|
|
8511
8535
|
return applyNode(selector, { ...options, position: "innerHtml" });
|
|
8512
8536
|
}
|
|
8537
|
+
function applyInnerTextNode(selector, options = {}) {
|
|
8538
|
+
return applyNode(selector, { ...options, position: "innerText" });
|
|
8539
|
+
}
|
|
8513
8540
|
|
|
8514
8541
|
// src/decorators/applyClass.ts
|
|
8515
8542
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -8854,7 +8881,7 @@ function createSubscribeSwcAppRouteChangeWhileConnected(options) {
|
|
|
8854
8881
|
list = [];
|
|
8855
8882
|
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
8856
8883
|
}
|
|
8857
|
-
list.push({ propertyKey,
|
|
8884
|
+
list.push({ propertyKey, options });
|
|
8858
8885
|
return descriptor;
|
|
8859
8886
|
};
|
|
8860
8887
|
}
|
|
@@ -8865,7 +8892,7 @@ function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKey,
|
|
|
8865
8892
|
let options = {};
|
|
8866
8893
|
if (Array.isArray(targetOrOptions)) {
|
|
8867
8894
|
options.path = targetOrOptions;
|
|
8868
|
-
} else if (typeof targetOrOptions === "string") {
|
|
8895
|
+
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
8869
8896
|
options.path = targetOrOptions;
|
|
8870
8897
|
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
8871
8898
|
options = targetOrOptions;
|
|
@@ -9011,6 +9038,22 @@ var RouterAction;
|
|
|
9011
9038
|
return typeof obj?.hasActivate === "function";
|
|
9012
9039
|
};
|
|
9013
9040
|
})(RouterAction || (RouterAction = {}));
|
|
9041
|
+
|
|
9042
|
+
// ../simple-boot/dist/esm/decorators/cache/CacheDecorator.js
|
|
9043
|
+
var CacheMetadataKey = Symbol.for("simple-boot:cache-metadata");
|
|
9044
|
+
|
|
9045
|
+
// ../simple-boot/dist/esm/fetch/ApiService.js
|
|
9046
|
+
var ApiServiceInterceptor;
|
|
9047
|
+
((ApiServiceInterceptor2) => {
|
|
9048
|
+
ApiServiceInterceptor2.TOKEN = Symbol.for("simple-boot:api-service-interceptor-token");
|
|
9049
|
+
ApiServiceInterceptor2.resolveAll = (simstanceManager) => {
|
|
9050
|
+
try {
|
|
9051
|
+
return (simstanceManager.findSims(ApiServiceInterceptor2.TOKEN) ?? []).map((it) => it.getValue()).filter(ValidUtils.isDefined);
|
|
9052
|
+
} catch (e) {
|
|
9053
|
+
return [];
|
|
9054
|
+
}
|
|
9055
|
+
};
|
|
9056
|
+
})(ApiServiceInterceptor || (ApiServiceInterceptor = {}));
|
|
9014
9057
|
export {
|
|
9015
9058
|
ADD_EVENT_LISTENER_METADATA_KEY,
|
|
9016
9059
|
APPLY_NODE_METADATA_KEY,
|
|
@@ -9063,6 +9106,7 @@ export {
|
|
|
9063
9106
|
applyClassHost,
|
|
9064
9107
|
applyInnerHtmlNode,
|
|
9065
9108
|
applyInnerHtmlNodeHost,
|
|
9109
|
+
applyInnerTextNode,
|
|
9066
9110
|
applyNode,
|
|
9067
9111
|
applyNodeHost,
|
|
9068
9112
|
applyReplaceChildrenNode,
|
|
@@ -9116,16 +9160,15 @@ export {
|
|
|
9116
9160
|
lastHost,
|
|
9117
9161
|
onAddEventListener,
|
|
9118
9162
|
onAdopted,
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
onAfterDisconnected,
|
|
9122
|
-
onBeforeAdopted,
|
|
9123
|
-
onBeforeConnected,
|
|
9124
|
-
onBeforeDisconnected,
|
|
9163
|
+
onAdoptedAfter,
|
|
9164
|
+
onAdoptedBefore,
|
|
9125
9165
|
onConnected,
|
|
9166
|
+
onConnectedAfter,
|
|
9167
|
+
onConnectedBefore,
|
|
9126
9168
|
onConnectedInnerHtml,
|
|
9127
|
-
onConnectedSwcApp,
|
|
9128
9169
|
onDisconnected,
|
|
9170
|
+
onDisconnectedAfter,
|
|
9171
|
+
onDisconnectedBefore,
|
|
9129
9172
|
onInitialize,
|
|
9130
9173
|
parentHost,
|
|
9131
9174
|
publishSwcAppMessage,
|