@dooboostore/simple-web-component 1.0.47 → 1.0.49
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 +223 -27
- package/dist/cjs/config/config.js +1 -1
- package/dist/cjs/config/config.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +412 -16
- package/dist/cjs/decorators/addEventListener.js.map +3 -3
- package/dist/cjs/decorators/applyAttribute.js +25 -0
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +49 -18
- package/dist/cjs/decorators/applyClass.js.map +3 -3
- package/dist/cjs/decorators/applyNode.js +67 -1
- package/dist/cjs/decorators/applyNode.js.map +3 -3
- package/dist/cjs/decorators/applyProperty.js +101 -3
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +36 -5
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/changedAttribute.js +39 -0
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +244 -225
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +55 -0
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/index.js +5 -1
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +209 -0
- package/dist/cjs/decorators/intersectionObserver.js.map +7 -0
- package/dist/cjs/decorators/mutationObserver.js +244 -0
- package/dist/cjs/decorators/mutationObserver.js.map +7 -0
- package/dist/cjs/decorators/query.js +129 -102
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/resizeObserver.js +191 -0
- package/dist/cjs/decorators/resizeObserver.js.map +7 -0
- package/dist/cjs/decorators/setInterval.js +82 -0
- package/dist/cjs/decorators/setInterval.js.map +7 -0
- package/dist/cjs/decorators/setTimeout.js +82 -0
- package/dist/cjs/decorators/setTimeout.js.map +7 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/cjs/examples/RxJSOperatorsExample.js +285 -0
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/config/config.js +1 -1
- package/dist/esm/config/config.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +413 -16
- package/dist/esm/decorators/addEventListener.js.map +3 -3
- package/dist/esm/decorators/applyAttribute.js +25 -0
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +49 -18
- package/dist/esm/decorators/applyClass.js.map +3 -3
- package/dist/esm/decorators/applyNode.js +67 -1
- package/dist/esm/decorators/applyNode.js.map +3 -3
- package/dist/esm/decorators/applyProperty.js +101 -3
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +36 -5
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/changedAttribute.js +40 -0
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +249 -230
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +55 -0
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/index.js +5 -1
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +191 -0
- package/dist/esm/decorators/intersectionObserver.js.map +7 -0
- package/dist/esm/decorators/mutationObserver.js +226 -0
- package/dist/esm/decorators/mutationObserver.js.map +7 -0
- package/dist/esm/decorators/query.js +129 -102
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/resizeObserver.js +173 -0
- package/dist/esm/decorators/resizeObserver.js.map +7 -0
- package/dist/esm/decorators/setInterval.js +64 -0
- package/dist/esm/decorators/setInterval.js.map +7 -0
- package/dist/esm/decorators/setTimeout.js +64 -0
- package/dist/esm/decorators/setTimeout.js.map +7 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js +9 -0
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +2 -2
- package/dist/esm/examples/RxJSOperatorsExample.js +266 -0
- package/dist/esm/examples/RxJSOperatorsExample.js.map +7 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +2413 -889
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/config/config.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +93 -23
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +22 -34
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +34 -34
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +30 -20
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +57 -34
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +25 -12
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/changedAttribute.d.ts +11 -0
- package/dist/types/decorators/changedAttribute.d.ts.map +1 -1
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/decorators/emitCustomEvent.d.ts +28 -4
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/index.d.ts +5 -1
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +49 -0
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -0
- package/dist/types/decorators/mutationObserver.d.ts +46 -0
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -0
- package/dist/types/decorators/query.d.ts +63 -8
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/resizeObserver.d.ts +48 -0
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -0
- package/dist/types/decorators/setInterval.d.ts +29 -0
- package/dist/types/decorators/setInterval.d.ts.map +1 -0
- package/dist/types/decorators/setTimeout.d.ts +29 -0
- package/dist/types/decorators/setTimeout.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +7 -1
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +6 -0
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +1 -1
- package/dist/types/examples/RxJSOperatorsExample.d.ts +94 -0
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +104 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +2413 -889
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +8 -6
- package/src/config/config.ts +1 -1
- package/src/decorators/addEventListener.ts +426 -23
- package/src/decorators/applyAttribute.ts +50 -36
- package/src/decorators/applyClass.ts +76 -26
- package/src/decorators/applyNode.ts +114 -36
- package/src/decorators/applyProperty.ts +152 -40
- package/src/decorators/applyStyle.ts +64 -17
- package/src/decorators/changedAttribute.ts +46 -0
- package/src/decorators/elementDefine.ts +301 -317
- package/src/decorators/emitCustomEvent.ts +73 -5
- package/src/decorators/index.ts +5 -1
- package/src/decorators/intersectionObserver.ts +259 -0
- package/src/decorators/mutationObserver.ts +304 -0
- package/src/decorators/query.ts +182 -117
- package/src/decorators/resizeObserver.ts +235 -0
- package/src/decorators/setInterval.ts +80 -0
- package/src/decorators/setTimeout.ts +80 -0
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +17 -0
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +19 -0
- package/src/examples/RxJSOperatorsExample.ts +279 -0
- package/src/types/index.ts +141 -0
- package/dist/cjs/decorators/queryAll.js +0 -181
- package/dist/cjs/decorators/queryAll.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAppMixin.js +0 -1
- package/dist/cjs/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsync.js +0 -1
- package/dist/cjs/elements/tt/SwcAsync.js.map +0 -7
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChoose.js +0 -1
- package/dist/cjs/elements/tt/SwcChoose.js.map +0 -7
- package/dist/cjs/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIf.js +0 -1
- package/dist/cjs/elements/tt/SwcIf.js.map +0 -7
- package/dist/cjs/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoop.js +0 -1
- package/dist/cjs/elements/tt/SwcLoop.js.map +0 -7
- package/dist/cjs/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/cjs/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/cjs/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/cjs/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/cjs/elements/tt/register.js +0 -1
- package/dist/cjs/elements/tt/register.js.map +0 -7
- package/dist/esm/decorators/queryAll.js +0 -162
- package/dist/esm/decorators/queryAll.js.map +0 -7
- package/dist/esm/elements/tt/SwcAppMixin.js +0 -1
- package/dist/esm/elements/tt/SwcAppMixin.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsync.js +0 -1
- package/dist/esm/elements/tt/SwcAsync.js.map +0 -7
- package/dist/esm/elements/tt/SwcAsyncTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcAsyncTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcChoose.js +0 -1
- package/dist/esm/elements/tt/SwcChoose.js.map +0 -7
- package/dist/esm/elements/tt/SwcChooseTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcChooseTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcIf.js +0 -1
- package/dist/esm/elements/tt/SwcIf.js.map +0 -7
- package/dist/esm/elements/tt/SwcIfTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcIfTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoop.js +0 -1
- package/dist/esm/elements/tt/SwcLoop.js.map +0 -7
- package/dist/esm/elements/tt/SwcLoopTemplate.js +0 -1
- package/dist/esm/elements/tt/SwcLoopTemplate.js.map +0 -7
- package/dist/esm/elements/tt/SwcSubTemplates.js +0 -1
- package/dist/esm/elements/tt/SwcSubTemplates.js.map +0 -7
- package/dist/esm/elements/tt/register.js +0 -1
- package/dist/esm/elements/tt/register.js.map +0 -7
- package/dist/types/decorators/queryAll.d.ts +0 -22
- package/dist/types/decorators/queryAll.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts +0 -1
- package/dist/types/elements/tt/SwcAppMixin.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsync.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcAsyncTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts +0 -1
- package/dist/types/elements/tt/SwcChoose.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcChooseTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts +0 -1
- package/dist/types/elements/tt/SwcIf.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcIfTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoop.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts +0 -1
- package/dist/types/elements/tt/SwcLoopTemplate.d.ts.map +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts +0 -1
- package/dist/types/elements/tt/SwcSubTemplates.d.ts.map +0 -1
- package/dist/types/elements/tt/register.d.ts +0 -1
- package/dist/types/elements/tt/register.d.ts.map +0 -1
- package/src/decorators/queryAll.ts +0 -186
- package/src/elements/tt/SwcAppMixin.ts +0 -13
- package/src/elements/tt/SwcAsync.ts +0 -139
- package/src/elements/tt/SwcAsyncTemplate.ts +0 -126
- package/src/elements/tt/SwcChoose.ts +0 -182
- package/src/elements/tt/SwcChooseTemplate.ts +0 -229
- package/src/elements/tt/SwcIf.ts +0 -145
- package/src/elements/tt/SwcIfTemplate.ts +0 -158
- package/src/elements/tt/SwcLoop.ts +0 -222
- package/src/elements/tt/SwcLoopTemplate.ts +0 -255
- package/src/elements/tt/SwcSubTemplates.ts +0 -6
- package/src/elements/tt/register.ts +0 -720
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
32
|
|
|
33
|
-
//
|
|
33
|
+
// ../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
|
|
34
34
|
var require_Reflect = __commonJS({
|
|
35
|
-
"
|
|
35
|
+
"../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js"() {
|
|
36
36
|
var Reflect2;
|
|
37
37
|
(function(Reflect3) {
|
|
38
38
|
(function(factory) {
|
|
@@ -1159,6 +1159,7 @@ __export(esm_exports, {
|
|
|
1159
1159
|
Fetcher: () => Fetcher,
|
|
1160
1160
|
FormValidator: () => FormValidator,
|
|
1161
1161
|
FunctionUtils: () => FunctionUtils,
|
|
1162
|
+
HashUtils: () => HashUtils,
|
|
1162
1163
|
HttpFetcher: () => HttpFetcher,
|
|
1163
1164
|
HttpJsonFetcher: () => HttpJsonFetcher,
|
|
1164
1165
|
HttpResponseError: () => HttpResponseError,
|
|
@@ -1239,6 +1240,7 @@ __export(esm_exports, {
|
|
|
1239
1240
|
isCssCommentItem: () => isCssCommentItem,
|
|
1240
1241
|
isCssDeclarationItem: () => isCssDeclarationItem,
|
|
1241
1242
|
isCssRuleItem: () => isCssRuleItem,
|
|
1243
|
+
isDefined: () => isDefined,
|
|
1242
1244
|
isHttpResponseError: () => isHttpResponseError,
|
|
1243
1245
|
isPoint2DType: () => isPoint2DType,
|
|
1244
1246
|
isPoint3DType: () => isPoint3DType,
|
|
@@ -1935,8 +1937,8 @@ var ObjectPathParser = class _ObjectPathParser {
|
|
|
1935
1937
|
const funcCall = this.parseFunctionCall(true);
|
|
1936
1938
|
memberExpr.addChild(funcCall);
|
|
1937
1939
|
} else {
|
|
1938
|
-
const
|
|
1939
|
-
memberExpr.addChild(
|
|
1940
|
+
const prop2 = this.parsePropertyAccess(true);
|
|
1941
|
+
memberExpr.addChild(prop2);
|
|
1940
1942
|
}
|
|
1941
1943
|
} else if (char === ".") {
|
|
1942
1944
|
this.advance();
|
|
@@ -1944,8 +1946,8 @@ var ObjectPathParser = class _ObjectPathParser {
|
|
|
1944
1946
|
const paren = this.parseParenthesizedAccess(false);
|
|
1945
1947
|
memberExpr.addChild(paren);
|
|
1946
1948
|
} else {
|
|
1947
|
-
const
|
|
1948
|
-
memberExpr.addChild(
|
|
1949
|
+
const prop2 = this.parsePropertyAccess(false);
|
|
1950
|
+
memberExpr.addChild(prop2);
|
|
1949
1951
|
}
|
|
1950
1952
|
} else if (char === "[") {
|
|
1951
1953
|
const bracket = this.parseBracketAccess(false);
|
|
@@ -1999,13 +2001,13 @@ var ObjectPathParser = class _ObjectPathParser {
|
|
|
1999
2001
|
}
|
|
2000
2002
|
parsePropertyAccess(isOptional) {
|
|
2001
2003
|
const start = this.pos;
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
+
const prop2 = new Token("property_access", "", start, start);
|
|
2005
|
+
prop2.isOptional = isOptional;
|
|
2004
2006
|
const identifier = this.parseIdentifier();
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
return
|
|
2007
|
+
prop2.addChild(identifier);
|
|
2008
|
+
prop2.end = this.pos;
|
|
2009
|
+
prop2.value = this.input.substring(start, this.pos);
|
|
2010
|
+
return prop2;
|
|
2009
2011
|
}
|
|
2010
2012
|
parseBracketAccess(isOptional) {
|
|
2011
2013
|
const start = this.pos;
|
|
@@ -2101,8 +2103,8 @@ var ObjectPathParser = class _ObjectPathParser {
|
|
|
2101
2103
|
const funcCall = this.parseFunctionCall(true);
|
|
2102
2104
|
memberExpr.addChild(funcCall);
|
|
2103
2105
|
} else {
|
|
2104
|
-
const
|
|
2105
|
-
memberExpr.addChild(
|
|
2106
|
+
const prop2 = this.parsePropertyAccess(true);
|
|
2107
|
+
memberExpr.addChild(prop2);
|
|
2106
2108
|
}
|
|
2107
2109
|
} else if (char === ".") {
|
|
2108
2110
|
this.advance();
|
|
@@ -2110,8 +2112,8 @@ var ObjectPathParser = class _ObjectPathParser {
|
|
|
2110
2112
|
const parenAccess = this.parseParenthesizedAccess(false);
|
|
2111
2113
|
memberExpr.addChild(parenAccess);
|
|
2112
2114
|
} else {
|
|
2113
|
-
const
|
|
2114
|
-
memberExpr.addChild(
|
|
2115
|
+
const prop2 = this.parsePropertyAccess(false);
|
|
2116
|
+
memberExpr.addChild(prop2);
|
|
2115
2117
|
}
|
|
2116
2118
|
} else if (char === "[") {
|
|
2117
2119
|
const bracket = this.parseBracketAccess(false);
|
|
@@ -2815,17 +2817,17 @@ var ObjectUtils;
|
|
|
2815
2817
|
};
|
|
2816
2818
|
const handler = new GetDetectProxy(prefix);
|
|
2817
2819
|
return new Proxy(dummyFunction, {
|
|
2818
|
-
get: (target,
|
|
2819
|
-
if (
|
|
2820
|
+
get: (target, prop2, receiver) => {
|
|
2821
|
+
if (prop2 === Symbol.toPrimitive) {
|
|
2820
2822
|
return () => "";
|
|
2821
2823
|
}
|
|
2822
|
-
if (
|
|
2824
|
+
if (prop2 === "valueOf") {
|
|
2823
2825
|
return () => handler.createSafeProxy(prefix);
|
|
2824
2826
|
}
|
|
2825
|
-
if (
|
|
2827
|
+
if (prop2 === "toString") {
|
|
2826
2828
|
return () => "";
|
|
2827
2829
|
}
|
|
2828
|
-
return handler.get(target,
|
|
2830
|
+
return handler.get(target, prop2, receiver);
|
|
2829
2831
|
},
|
|
2830
2832
|
set: handler.set.bind(handler),
|
|
2831
2833
|
apply: handler.apply.bind(handler)
|
|
@@ -3198,6 +3200,12 @@ var Vector = class _Vector {
|
|
|
3198
3200
|
this.z = z ?? 0;
|
|
3199
3201
|
}
|
|
3200
3202
|
}
|
|
3203
|
+
/**
|
|
3204
|
+
* 성분 대입 (파괴적). 벡터 전달 시 그 성분을 복사.
|
|
3205
|
+
* @example
|
|
3206
|
+
* v.set(1, 2, 3); // v = (1, 2, 3)
|
|
3207
|
+
* v.set(otherVector); // v = other와 동일 성분
|
|
3208
|
+
*/
|
|
3201
3209
|
set(v, y = 0, z = 0) {
|
|
3202
3210
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3203
3211
|
this.set(v.x || 0, v.y || 0, v.z || 0);
|
|
@@ -3208,16 +3216,45 @@ var Vector = class _Vector {
|
|
|
3208
3216
|
}
|
|
3209
3217
|
return this;
|
|
3210
3218
|
}
|
|
3219
|
+
/**
|
|
3220
|
+
* 복사본 반환 (비파괴). 파괴적 메서드와 조합해 원본 보존용.
|
|
3221
|
+
* @example
|
|
3222
|
+
* const s = a.get(); s.add(b); // s = a+b, a는 그대로
|
|
3223
|
+
*/
|
|
3211
3224
|
get() {
|
|
3212
3225
|
return new _Vector(this.x, this.y, this.z);
|
|
3213
3226
|
}
|
|
3214
|
-
|
|
3215
|
-
|
|
3227
|
+
/**
|
|
3228
|
+
* 노름(norm). 평평한 공간(유클리드 공간)에서의 직선 거리.
|
|
3229
|
+
* - 수식: ‖v‖ = √(x² + y² + z²)
|
|
3230
|
+
* - 2D에서는 피타고라스 정리 그 자체. 3D는 두 번 적용한 것과 같음.
|
|
3231
|
+
* (바닥 대각선 √(x²+y²) → 공간 대각선 √((바닥)²+z²))
|
|
3232
|
+
* - "유클리드"는 평평한 공간의 기하학을 말함 (좌표계는 데카르트의 것, 유클리드는 좌표 없이 기하학을 세움).
|
|
3233
|
+
* 휘어진 공간(구면·쌍곡)에서는 이 공식이 성립하지 않음.
|
|
3234
|
+
* @example
|
|
3235
|
+
* new Vector(3, 4, 0).norm(); // 5
|
|
3236
|
+
* new Vector(6, 8, 0).norm(); // 10
|
|
3237
|
+
*/
|
|
3238
|
+
norm() {
|
|
3216
3239
|
const x = this.x;
|
|
3217
3240
|
const y = this.y;
|
|
3218
3241
|
const z = this.z;
|
|
3219
3242
|
return Math.sqrt(x * x + y * y + z * z);
|
|
3220
3243
|
}
|
|
3244
|
+
/**
|
|
3245
|
+
* norm()의 별칭 (p5.js 호환).
|
|
3246
|
+
* @example
|
|
3247
|
+
* new Vector(3, 4, 0).mag(); // 5
|
|
3248
|
+
*/
|
|
3249
|
+
mag() {
|
|
3250
|
+
return this.norm();
|
|
3251
|
+
}
|
|
3252
|
+
/**
|
|
3253
|
+
* 덧셈 (파괴적). 성분별 합. 기하학적으로 평행사변형의 대각선.
|
|
3254
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
3255
|
+
* @example
|
|
3256
|
+
* const a = new Vector(4, 2); a.add(new Vector(-2, 3)); // a = (2, 5)
|
|
3257
|
+
*/
|
|
3221
3258
|
add(v, y = 0, z = 0) {
|
|
3222
3259
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3223
3260
|
this.x += v.x;
|
|
@@ -3229,12 +3266,24 @@ var Vector = class _Vector {
|
|
|
3229
3266
|
this.z += z;
|
|
3230
3267
|
}
|
|
3231
3268
|
}
|
|
3269
|
+
/**
|
|
3270
|
+
* 덧셈 결과의 새 벡터 반환 (비파괴).
|
|
3271
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
3272
|
+
* @example
|
|
3273
|
+
* const s = a.toAdd(a, b); // s = a+b, a·b는 그대로
|
|
3274
|
+
*/
|
|
3232
3275
|
toAdd(v1, v2) {
|
|
3233
3276
|
return new _Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
3234
3277
|
}
|
|
3235
3278
|
// public static add(v1: Vector, v2: Vector): Vector {
|
|
3236
3279
|
// return new Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
3237
3280
|
// }
|
|
3281
|
+
/**
|
|
3282
|
+
* 뺄셈 (파괴적). a - b는 "a에서 b를 되돌리는" 벡터.
|
|
3283
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
3284
|
+
* @example
|
|
3285
|
+
* const a = new Vector(4, 2); a.sub(new Vector(1, 1)); // a = (3, 1)
|
|
3286
|
+
*/
|
|
3238
3287
|
sub(v, y = 0, z = 0) {
|
|
3239
3288
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3240
3289
|
this.x -= v.x;
|
|
@@ -3246,6 +3295,12 @@ var Vector = class _Vector {
|
|
|
3246
3295
|
this.z -= z;
|
|
3247
3296
|
}
|
|
3248
3297
|
}
|
|
3298
|
+
/**
|
|
3299
|
+
* 뺄셈 결과의 새 벡터 반환 (비파괴).
|
|
3300
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
3301
|
+
* @example
|
|
3302
|
+
* const d = a.toSub(b); // d = a-b, a·b는 그대로
|
|
3303
|
+
*/
|
|
3249
3304
|
toSub(v2) {
|
|
3250
3305
|
const v1 = this;
|
|
3251
3306
|
return new _Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
@@ -3254,6 +3309,12 @@ var Vector = class _Vector {
|
|
|
3254
3309
|
// public static sub(v1: Vector, v2: Vector): Vector {
|
|
3255
3310
|
// return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
3256
3311
|
// }
|
|
3312
|
+
/**
|
|
3313
|
+
* 스칼라배 또는 성분별 곱 (파괴적). 스칼라 k>1이면 늘어나고, 0<k<1이면 줄어듦. k<0이면 반대 방향.
|
|
3314
|
+
* - 수식(스칼라): k·v = (k·x, k·y, k·z)
|
|
3315
|
+
* @example
|
|
3316
|
+
* const v = new Vector(1, 2); v.mult(3); // v = (3, 6)
|
|
3317
|
+
*/
|
|
3257
3318
|
mult(v) {
|
|
3258
3319
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3259
3320
|
this.x *= v.x;
|
|
@@ -3266,6 +3327,12 @@ var Vector = class _Vector {
|
|
|
3266
3327
|
}
|
|
3267
3328
|
return this;
|
|
3268
3329
|
}
|
|
3330
|
+
/**
|
|
3331
|
+
* 성분별 곱 결과의 새 벡터 반환 (비파괴).
|
|
3332
|
+
* - 수식: (ax·bx, ay·by, az·bz)
|
|
3333
|
+
* @example
|
|
3334
|
+
* const m = a.toMult(b); // m = 성분별 곱, a·b는 그대로
|
|
3335
|
+
*/
|
|
3269
3336
|
toMult(v2) {
|
|
3270
3337
|
const v1 = this;
|
|
3271
3338
|
return new _Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
@@ -3273,6 +3340,12 @@ var Vector = class _Vector {
|
|
|
3273
3340
|
// public static mult(v1: Vector, v2: Vector) {
|
|
3274
3341
|
// return new Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
3275
3342
|
// }
|
|
3343
|
+
/**
|
|
3344
|
+
* 스칼라 나눗셈 또는 성분별 나눗셈 (파괴적). 정규화의 핵심 연산.
|
|
3345
|
+
* - 수식(스칼라): v/k = (x/k, y/k, z/k)
|
|
3346
|
+
* @example
|
|
3347
|
+
* const v = new Vector(6, 8); v.div(2); // v = (3, 4)
|
|
3348
|
+
*/
|
|
3276
3349
|
div(v) {
|
|
3277
3350
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3278
3351
|
this.x /= v.x;
|
|
@@ -3285,6 +3358,12 @@ var Vector = class _Vector {
|
|
|
3285
3358
|
}
|
|
3286
3359
|
return this;
|
|
3287
3360
|
}
|
|
3361
|
+
/**
|
|
3362
|
+
* 스칼라 나눗셈 결과의 새 벡터 반환 (비파괴).
|
|
3363
|
+
* - 수식: v/k = (x/k, y/k, z/k)
|
|
3364
|
+
* @example
|
|
3365
|
+
* const h = v.toDiv(2); // h = v/2, v는 그대로
|
|
3366
|
+
*/
|
|
3288
3367
|
toDiv(d) {
|
|
3289
3368
|
const v = this;
|
|
3290
3369
|
const rv = v.get();
|
|
@@ -3300,10 +3379,22 @@ var Vector = class _Vector {
|
|
|
3300
3379
|
// rv.z /= d;
|
|
3301
3380
|
// return rv;
|
|
3302
3381
|
// }
|
|
3382
|
+
/**
|
|
3383
|
+
* 두 점(벡터) 사이 거리. 차 벡터의 크기.
|
|
3384
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
3385
|
+
* @example
|
|
3386
|
+
* new Vector(0, 0).dist(new Vector(3, 4)); // 5
|
|
3387
|
+
*/
|
|
3303
3388
|
dist(v) {
|
|
3304
3389
|
const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
|
|
3305
3390
|
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3306
3391
|
}
|
|
3392
|
+
/**
|
|
3393
|
+
* 두 점(벡터) 사이 거리 (toDist는 dist와 동일, 비파괴).
|
|
3394
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
3395
|
+
* @example
|
|
3396
|
+
* a.toDist(b); // a와 b 사이 거리
|
|
3397
|
+
*/
|
|
3307
3398
|
toDist(v2) {
|
|
3308
3399
|
const v1 = this;
|
|
3309
3400
|
const dx = v1.x - v2.x, dy = v1.y - v2.y, dz = v1.z - v2.z;
|
|
@@ -3315,36 +3406,90 @@ var Vector = class _Vector {
|
|
|
3315
3406
|
// dz = v1.z - v2.z;
|
|
3316
3407
|
// return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3317
3408
|
// }
|
|
3318
|
-
|
|
3409
|
+
/**
|
|
3410
|
+
* 내적(dot product). 두 벡터가 같은 방향을 향하는 정도.
|
|
3411
|
+
* - 수식: a·b = ax·bx + ay·by + az·bz = |a||b|cosθ
|
|
3412
|
+
* - θ=90°면 0(직교), 0°면 최대(같은 방향).
|
|
3413
|
+
* - 벡터 전달 시 y·z 생략 가능, 스칼라(x) 전달 시 y·z와 함께 사용.
|
|
3414
|
+
* @example
|
|
3415
|
+
* new Vector(5, 12).dot(new Vector(-5, 12)); // -25+144 = 119
|
|
3416
|
+
* new Vector(1, 0).dot(new Vector(0, 1)); // 0 (직각)
|
|
3417
|
+
* new Vector(1, 2).dot(3, 4); // 1*3+2*4 = 11
|
|
3418
|
+
*/
|
|
3419
|
+
dot(v, y = 0, z = 0) {
|
|
3319
3420
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3320
3421
|
return this.x * v.x + this.y * v.y + this.z * v.z;
|
|
3321
3422
|
}
|
|
3322
3423
|
;
|
|
3323
3424
|
return this.x * v + this.y * y + this.z * z;
|
|
3324
3425
|
}
|
|
3426
|
+
/**
|
|
3427
|
+
* 외적(cross product). 두 벡터에 수직인 벡터. 오른손 법칙 방향.
|
|
3428
|
+
* - 수식: a×b = (ay·bz − az·by, az·bx − ax·bz, ax·by − ay·bx)
|
|
3429
|
+
* - 2D에서는 z값 = ax·by − ay·bx (부호 있는 면적, 회전 방향 판정용).
|
|
3430
|
+
* @example
|
|
3431
|
+
* new Vector(1, 0, 0).cross(new Vector(0, 1, 0)); // (0, 0, 1)
|
|
3432
|
+
*/
|
|
3325
3433
|
cross(v) {
|
|
3326
3434
|
const x = this.x, y = this.y, z = this.z;
|
|
3327
3435
|
return new _Vector(y * v.z - v.y * z, z * v.x - v.z * x, x * v.y - v.x * y);
|
|
3328
3436
|
}
|
|
3437
|
+
/**
|
|
3438
|
+
* 정규화 (파괴적). 방향은 그대로, 크기를 1로. 단위벡터 v̂ 생성.
|
|
3439
|
+
* - 수식: v̂ = v / |v|
|
|
3440
|
+
* - 영벡터(|v|=0)는 0으로 나누지 않고 그대로 둠.
|
|
3441
|
+
* @example
|
|
3442
|
+
* const v = new Vector(6, 8); v.normalize(); // v = (0.6, 0.8), |v| = 1
|
|
3443
|
+
*/
|
|
3329
3444
|
normalize() {
|
|
3330
|
-
const m = this.
|
|
3445
|
+
const m = this.norm();
|
|
3331
3446
|
if (m > 0) this.div(m);
|
|
3332
3447
|
}
|
|
3448
|
+
/**
|
|
3449
|
+
* 크기 상한 (파괴적). 속도가 high를 넘으면 방향 유지한 채 high로 자름. 물리 시뮬레이션 최고속도용.
|
|
3450
|
+
* - 수식: |v| > high → v = v̂ · high
|
|
3451
|
+
* @example
|
|
3452
|
+
* const v = new Vector(6, 8); v.limit(5); // |v|=10 → 5, v = (3, 4)
|
|
3453
|
+
*/
|
|
3333
3454
|
limit(high) {
|
|
3334
|
-
if (this.
|
|
3455
|
+
if (this.norm() > high) {
|
|
3335
3456
|
this.normalize();
|
|
3336
3457
|
this.mult(high);
|
|
3337
3458
|
}
|
|
3338
3459
|
}
|
|
3460
|
+
/**
|
|
3461
|
+
* 2D 방향각. +x축 기준 반시계 방향 라디안 (-π ~ π).
|
|
3462
|
+
* - 수식: θ = atan2(y, x)
|
|
3463
|
+
* @example
|
|
3464
|
+
* new Vector(1, 1).heading2D(); // π/4 (45°)
|
|
3465
|
+
* new Vector(-1, 0).heading2D(); // π (180°)
|
|
3466
|
+
*/
|
|
3339
3467
|
heading2D() {
|
|
3340
3468
|
return -Math.atan2(-this.y, this.x);
|
|
3341
3469
|
}
|
|
3470
|
+
/**
|
|
3471
|
+
* 무작위 방향 단위벡터 반환 (새 Vector, 자신은 변경 안 함).
|
|
3472
|
+
* @example
|
|
3473
|
+
* const r = new Vector().random2D(); // |r| = 1, 방향 랜덤
|
|
3474
|
+
*/
|
|
3342
3475
|
random2D() {
|
|
3343
3476
|
return this.fromAngle(Math.random() * (2 * Math.PI));
|
|
3344
3477
|
}
|
|
3478
|
+
/**
|
|
3479
|
+
* 각도→벡터. 각도 θ, 길이 L인 2D 벡터 반환 (새 Vector).
|
|
3480
|
+
* - 수식: (L·cosθ, L·sinθ, 0)
|
|
3481
|
+
* @example
|
|
3482
|
+
* new Vector().fromAngle(Math.PI / 3, 2); // (1, 1.73, 0)
|
|
3483
|
+
*/
|
|
3345
3484
|
fromAngle(angle, length = 1) {
|
|
3346
3485
|
return new _Vector(length * Math.cos(angle), length * Math.sin(angle), 0);
|
|
3347
3486
|
}
|
|
3487
|
+
/**
|
|
3488
|
+
* 구면좌표→3D 벡터 (새 Vector 반환, p5.js 컨벤션).
|
|
3489
|
+
* - 수식: (L·sinθ·sinφ, −L·cosθ, L·sinθ·cosφ)
|
|
3490
|
+
* @example
|
|
3491
|
+
* new Vector().fromAngles(Math.PI / 2, Math.PI / 2, 1); // (1, 0, 0)
|
|
3492
|
+
*/
|
|
3348
3493
|
fromAngles(theta, phi, length = 1) {
|
|
3349
3494
|
const cosPhi = Math.cos(phi);
|
|
3350
3495
|
const sinPhi = Math.sin(phi);
|
|
@@ -3356,18 +3501,43 @@ var Vector = class _Vector {
|
|
|
3356
3501
|
length * sinTheta * cosPhi
|
|
3357
3502
|
);
|
|
3358
3503
|
}
|
|
3504
|
+
/**
|
|
3505
|
+
* 성분 배열 반환. [x, y, z] 순서.
|
|
3506
|
+
* @example
|
|
3507
|
+
* new Vector(1, 2, 3).array(); // [1, 2, 3]
|
|
3508
|
+
*/
|
|
3359
3509
|
array() {
|
|
3360
3510
|
return [this.x, this.y, this.z];
|
|
3361
3511
|
}
|
|
3512
|
+
/**
|
|
3513
|
+
* Point3D로 변환 (위치 의미로 바꿀 때).
|
|
3514
|
+
* @example
|
|
3515
|
+
* new Vector(1, 2, 3).toPoint3D(); // Point3D(1, 2, 3)
|
|
3516
|
+
*/
|
|
3362
3517
|
toPoint3D() {
|
|
3363
3518
|
return new Point3D(this.x, this.y, this.z);
|
|
3364
3519
|
}
|
|
3520
|
+
/**
|
|
3521
|
+
* Point2D로 변환 (z 버림).
|
|
3522
|
+
* @example
|
|
3523
|
+
* new Vector(1, 2, 3).toPoint2D(); // Point2D(1, 2)
|
|
3524
|
+
*/
|
|
3365
3525
|
toPoint2D() {
|
|
3366
3526
|
return new Point2D(this.x, this.y);
|
|
3367
3527
|
}
|
|
3528
|
+
/**
|
|
3529
|
+
* 복사본 반환 (get()과 동일, 비파괴).
|
|
3530
|
+
* @example
|
|
3531
|
+
* const c = v.copy(); // v와 같은 성분의 새 벡터
|
|
3532
|
+
*/
|
|
3368
3533
|
copy() {
|
|
3369
3534
|
return new _Vector(this.x, this.y, this.z);
|
|
3370
3535
|
}
|
|
3536
|
+
/**
|
|
3537
|
+
* 문자열 표현. "[x, y, z]" 형식.
|
|
3538
|
+
* @example
|
|
3539
|
+
* new Vector(1, 2).toString(); // "[1, 2, 0]"
|
|
3540
|
+
*/
|
|
3371
3541
|
toString() {
|
|
3372
3542
|
return "[" + this.x + ", " + this.y + ", " + this.z + "]";
|
|
3373
3543
|
}
|
|
@@ -8213,7 +8383,7 @@ var StoreLoader = class {
|
|
|
8213
8383
|
|
|
8214
8384
|
// ../core/dist/esm/url/UrlUtils.js
|
|
8215
8385
|
var UrlUtils;
|
|
8216
|
-
((UrlUtils2)
|
|
8386
|
+
(function(UrlUtils2) {
|
|
8217
8387
|
UrlUtils2.origin = (fullurl) => {
|
|
8218
8388
|
return new URL(fullurl).origin;
|
|
8219
8389
|
};
|
|
@@ -8251,15 +8421,28 @@ var UrlUtils;
|
|
|
8251
8421
|
});
|
|
8252
8422
|
return searchParams;
|
|
8253
8423
|
};
|
|
8424
|
+
UrlUtils2.toAbsoluteUrl = (relative, base) => {
|
|
8425
|
+
return new URL(relative, base);
|
|
8426
|
+
};
|
|
8427
|
+
function toAbsoluteRequest(input, base) {
|
|
8428
|
+
if (input instanceof URL) {
|
|
8429
|
+
return UrlUtils2.toAbsoluteUrl(input.href, base);
|
|
8430
|
+
}
|
|
8431
|
+
if (typeof input === "string") {
|
|
8432
|
+
return UrlUtils2.toAbsoluteUrl(input, base).href;
|
|
8433
|
+
}
|
|
8434
|
+
return new Request(UrlUtils2.toAbsoluteUrl(input.url, base).href, input);
|
|
8435
|
+
}
|
|
8436
|
+
UrlUtils2.toAbsoluteRequest = toAbsoluteRequest;
|
|
8254
8437
|
UrlUtils2.manipulateSearchParams = (searchParams, options) => {
|
|
8255
8438
|
if (options?.delete) {
|
|
8256
|
-
|
|
8439
|
+
UrlUtils2.deleteSearchParam(searchParams, options.delete);
|
|
8257
8440
|
}
|
|
8258
8441
|
if (options?.append) {
|
|
8259
|
-
|
|
8442
|
+
UrlUtils2.appendSearchParam(searchParams, options.append);
|
|
8260
8443
|
}
|
|
8261
8444
|
if (options?.upsert) {
|
|
8262
|
-
|
|
8445
|
+
UrlUtils2.upsertSearchParam(searchParams, options.upsert);
|
|
8263
8446
|
}
|
|
8264
8447
|
return searchParams;
|
|
8265
8448
|
};
|
|
@@ -8981,10 +9164,10 @@ var CssParser = class _CssParser extends CssNode {
|
|
|
8981
9164
|
if (remaining && remaining.includes(":")) {
|
|
8982
9165
|
const parts = remaining.split(":");
|
|
8983
9166
|
if (parts.length >= 2) {
|
|
8984
|
-
const
|
|
9167
|
+
const prop2 = parts[0].trim();
|
|
8985
9168
|
const val = parts.slice(1).join(":").trim();
|
|
8986
|
-
if (
|
|
8987
|
-
content.push({ type: "declaration", property:
|
|
9169
|
+
if (prop2 && val) {
|
|
9170
|
+
content.push({ type: "declaration", property: prop2, value: val });
|
|
8988
9171
|
}
|
|
8989
9172
|
}
|
|
8990
9173
|
}
|
|
@@ -9025,10 +9208,10 @@ var CssParser = class _CssParser extends CssNode {
|
|
|
9025
9208
|
} else if (statement.includes(":")) {
|
|
9026
9209
|
const parts = statement.split(":");
|
|
9027
9210
|
if (parts.length >= 2) {
|
|
9028
|
-
const
|
|
9211
|
+
const prop2 = parts[0].trim();
|
|
9029
9212
|
const val = parts.slice(1).join(":").trim();
|
|
9030
|
-
if (
|
|
9031
|
-
content.push({ type: "declaration", property:
|
|
9213
|
+
if (prop2 && val) {
|
|
9214
|
+
content.push({ type: "declaration", property: prop2, value: val });
|
|
9032
9215
|
}
|
|
9033
9216
|
}
|
|
9034
9217
|
}
|
|
@@ -9127,7 +9310,7 @@ var CssParser = class _CssParser extends CssNode {
|
|
|
9127
9310
|
}
|
|
9128
9311
|
static _declarationsToCSS(declarations, indent) {
|
|
9129
9312
|
const indentStr = " ".repeat(indent);
|
|
9130
|
-
return Object.entries(declarations).map(([
|
|
9313
|
+
return Object.entries(declarations).map(([prop2, value]) => `${indentStr}${_CssParser._camelToKebab(prop2)}: ${value};`).join("\n");
|
|
9131
9314
|
}
|
|
9132
9315
|
static _camelToKebab(camelCase) {
|
|
9133
9316
|
return camelCase.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
@@ -10653,59 +10836,29 @@ function getExpression(value, config) {
|
|
|
10653
10836
|
};
|
|
10654
10837
|
}
|
|
10655
10838
|
|
|
10839
|
+
// ../core/dist/esm/hash/HashUtils.js
|
|
10840
|
+
var HashUtils;
|
|
10841
|
+
((HashUtils2) => {
|
|
10842
|
+
const core53 = (str, seed) => {
|
|
10843
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
10844
|
+
for (let i = 0; i < str.length; i++) {
|
|
10845
|
+
const ch = str.charCodeAt(i);
|
|
10846
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
10847
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
10848
|
+
}
|
|
10849
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
10850
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
10851
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, "0");
|
|
10852
|
+
};
|
|
10853
|
+
HashUtils2.hash53 = (str, seed = 0, xyz = 16) => `${core53(str, seed)}${core53(str, seed + 1)}`.slice(0, Math.max(1, xyz));
|
|
10854
|
+
})(HashUtils || (HashUtils = {}));
|
|
10855
|
+
|
|
10656
10856
|
// ../core/dist/esm/index.js
|
|
10657
10857
|
var src_default = {
|
|
10658
10858
|
// Core utilities are exported as named exports above
|
|
10659
10859
|
// Use: import { Observable, Subject, Promises, ... } from '@dooboostore/core'
|
|
10660
10860
|
};
|
|
10661
10861
|
|
|
10662
|
-
// src/decorators/addEventListener.ts
|
|
10663
|
-
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
10664
|
-
function addEventListener(selectorOrTarget, type, options = {}) {
|
|
10665
|
-
return (targetObj, propertyKey, descriptor) => {
|
|
10666
|
-
const constructor = targetObj.constructor;
|
|
10667
|
-
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10668
|
-
if (!listeners) {
|
|
10669
|
-
listeners = [];
|
|
10670
|
-
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
10671
|
-
}
|
|
10672
|
-
listeners.push({ propertyKey, selector: selectorOrTarget, type, options });
|
|
10673
|
-
};
|
|
10674
|
-
}
|
|
10675
|
-
function addEventListenerDelegateLightDom(selector, type, options) {
|
|
10676
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
10677
|
-
}
|
|
10678
|
-
function addEventListenerDelegateShadowDom(selector, type, options) {
|
|
10679
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
10680
|
-
}
|
|
10681
|
-
function addEventListenerDelegateAllDom(selector, type, options) {
|
|
10682
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
10683
|
-
}
|
|
10684
|
-
function addEventListenerDelegate(selector, type, options) {
|
|
10685
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
10686
|
-
}
|
|
10687
|
-
var event = addEventListener;
|
|
10688
|
-
var eventDelegateLightDom = addEventListenerDelegateLightDom;
|
|
10689
|
-
var eventDelegateShadowDom = addEventListenerDelegateShadowDom;
|
|
10690
|
-
var eventDelegateAllDom = addEventListenerDelegateAllDom;
|
|
10691
|
-
var eventDelegate = addEventListenerDelegate;
|
|
10692
|
-
function addEventListenerThis(type, options) {
|
|
10693
|
-
return addEventListener("$this", type, options);
|
|
10694
|
-
}
|
|
10695
|
-
function addEventListenerAppHost(type, options) {
|
|
10696
|
-
return addEventListener("$appHost", type, options);
|
|
10697
|
-
}
|
|
10698
|
-
function addEventListenerWindow(type, options) {
|
|
10699
|
-
return addEventListener("$window", type, options);
|
|
10700
|
-
}
|
|
10701
|
-
function addEventListenerDocument(type, options) {
|
|
10702
|
-
return addEventListener("$document", type, options);
|
|
10703
|
-
}
|
|
10704
|
-
var getAddEventListenerMetadata = (target) => {
|
|
10705
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
10706
|
-
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10707
|
-
};
|
|
10708
|
-
|
|
10709
10862
|
// ../core/dist/esm/message/operators/debounceTime.js
|
|
10710
10863
|
function debounceTime(duration, config) {
|
|
10711
10864
|
return (source) => {
|
|
@@ -10855,157 +11008,6 @@ function throttleTime2(duration, config) {
|
|
|
10855
11008
|
};
|
|
10856
11009
|
}
|
|
10857
11010
|
|
|
10858
|
-
// src/decorators/lifecycles.ts
|
|
10859
|
-
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
10860
|
-
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
10861
|
-
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
10862
|
-
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
10863
|
-
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
10864
|
-
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
10865
|
-
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
10866
|
-
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
10867
|
-
var ON_CONNECTED_BODY_METADATA_KEY = Symbol.for("simple-web-component:on-connected-body");
|
|
10868
|
-
var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
|
|
10869
|
-
var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
|
|
10870
|
-
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
10871
|
-
function onConnectedBefore(arg1, arg2, arg3) {
|
|
10872
|
-
const decorator2 = (options, target, propertyKey) => {
|
|
10873
|
-
const constructor = target.constructor;
|
|
10874
|
-
let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
|
|
10875
|
-
if (!list) {
|
|
10876
|
-
list = [];
|
|
10877
|
-
ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
|
|
10878
|
-
}
|
|
10879
|
-
list.push({ propertyKey, options });
|
|
10880
|
-
};
|
|
10881
|
-
if (arg2) {
|
|
10882
|
-
return decorator2({}, arg1, arg2);
|
|
10883
|
-
}
|
|
10884
|
-
return (target, propertyKey) => {
|
|
10885
|
-
decorator2(arg1 || {}, target, propertyKey);
|
|
10886
|
-
};
|
|
10887
|
-
}
|
|
10888
|
-
function onConnectedAfter(arg1, arg2, arg3) {
|
|
10889
|
-
const decorator2 = (options, target, propertyKey) => {
|
|
10890
|
-
const constructor = target.constructor;
|
|
10891
|
-
let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
|
|
10892
|
-
if (!list) {
|
|
10893
|
-
list = [];
|
|
10894
|
-
ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
|
|
10895
|
-
}
|
|
10896
|
-
list.push({ propertyKey, options });
|
|
10897
|
-
};
|
|
10898
|
-
if (arg2) {
|
|
10899
|
-
return decorator2({}, arg1, arg2);
|
|
10900
|
-
}
|
|
10901
|
-
return (target, propertyKey) => {
|
|
10902
|
-
decorator2(arg1 || {}, target, propertyKey);
|
|
10903
|
-
};
|
|
10904
|
-
}
|
|
10905
|
-
function createLifecycleDecoratorWithOptions(metadataKey) {
|
|
10906
|
-
return function(optionOrTarget, propertyKey) {
|
|
10907
|
-
if (propertyKey) {
|
|
10908
|
-
const constructor = optionOrTarget.constructor;
|
|
10909
|
-
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
10910
|
-
if (!list) {
|
|
10911
|
-
list = [];
|
|
10912
|
-
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
10913
|
-
}
|
|
10914
|
-
list.push({ propertyKey, order: 0 });
|
|
10915
|
-
return;
|
|
10916
|
-
}
|
|
10917
|
-
return (target, propertyKey2) => {
|
|
10918
|
-
const constructor = target.constructor;
|
|
10919
|
-
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
10920
|
-
if (!list) {
|
|
10921
|
-
list = [];
|
|
10922
|
-
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
10923
|
-
}
|
|
10924
|
-
list.push({ propertyKey: propertyKey2, order: optionOrTarget?.order ?? 0 });
|
|
10925
|
-
};
|
|
10926
|
-
};
|
|
10927
|
-
}
|
|
10928
|
-
function onInitialize(optionOrTarget, propertyKey) {
|
|
10929
|
-
return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10930
|
-
}
|
|
10931
|
-
function onDisconnectedBefore(optionOrTarget, propertyKey) {
|
|
10932
|
-
return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10933
|
-
}
|
|
10934
|
-
function onDisconnectedAfter(optionOrTarget, propertyKey) {
|
|
10935
|
-
return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10936
|
-
}
|
|
10937
|
-
var onDisconnected = onDisconnectedAfter;
|
|
10938
|
-
function onAdoptedBefore(optionOrTarget, propertyKey) {
|
|
10939
|
-
return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10940
|
-
}
|
|
10941
|
-
function onAdoptedAfter(optionOrTarget, propertyKey) {
|
|
10942
|
-
return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10943
|
-
}
|
|
10944
|
-
var onAdopted = onAdoptedAfter;
|
|
10945
|
-
function onConnectedSwcApp(optionOrTarget, propertyKey) {
|
|
10946
|
-
return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10947
|
-
}
|
|
10948
|
-
function onConnectedCompleted(optionOrTarget, propertyKey) {
|
|
10949
|
-
return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
10950
|
-
}
|
|
10951
|
-
var decorator = (options, target, propertyKey) => {
|
|
10952
|
-
const constructor = target.constructor;
|
|
10953
|
-
let list = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor);
|
|
10954
|
-
if (!list) {
|
|
10955
|
-
list = [];
|
|
10956
|
-
ReflectUtils.defineMetadata(ON_CONNECTED_BODY_METADATA_KEY, list, constructor);
|
|
10957
|
-
}
|
|
10958
|
-
list.push({ propertyKey, options });
|
|
10959
|
-
};
|
|
10960
|
-
function onConnectedBodyShadow(optionOrTarget, propertyKey, arg3) {
|
|
10961
|
-
if (propertyKey) {
|
|
10962
|
-
return decorator({ useShadow: true }, optionOrTarget, propertyKey);
|
|
10963
|
-
}
|
|
10964
|
-
return (target, propertyKey2) => {
|
|
10965
|
-
decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
|
|
10966
|
-
};
|
|
10967
|
-
}
|
|
10968
|
-
function onConnectedBodyLight(optionOrTarget, propertyKey, arg3) {
|
|
10969
|
-
if (propertyKey) {
|
|
10970
|
-
return decorator({ useShadow: false }, optionOrTarget, propertyKey);
|
|
10971
|
-
}
|
|
10972
|
-
return (target, propertyKey2) => {
|
|
10973
|
-
decorator({ ...optionOrTarget ?? {}, useShadow: false }, target, propertyKey2);
|
|
10974
|
-
};
|
|
10975
|
-
}
|
|
10976
|
-
function onConnectedBody(optionOrTarget, propertyKey, arg3) {
|
|
10977
|
-
if (propertyKey) {
|
|
10978
|
-
return decorator({}, optionOrTarget, propertyKey);
|
|
10979
|
-
}
|
|
10980
|
-
return (target, propertyKey2) => {
|
|
10981
|
-
decorator(optionOrTarget || {}, target, propertyKey2);
|
|
10982
|
-
};
|
|
10983
|
-
}
|
|
10984
|
-
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
10985
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
10986
|
-
const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) ?? [];
|
|
10987
|
-
return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
10988
|
-
};
|
|
10989
|
-
var findAllOnConnectedMetadata = (target) => {
|
|
10990
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
10991
|
-
const results = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor) ?? [];
|
|
10992
|
-
return [...results].sort((a, b) => {
|
|
10993
|
-
const orderA = a.options?.order ?? 0;
|
|
10994
|
-
const orderB = b.options?.order ?? 0;
|
|
10995
|
-
return orderA - orderB;
|
|
10996
|
-
});
|
|
10997
|
-
};
|
|
10998
|
-
var findAllOnConnectedBeforeMetadata = (target) => {
|
|
10999
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11000
|
-
const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
11001
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
11002
|
-
};
|
|
11003
|
-
var findAllOnConnectedAfterMetadata = (target) => {
|
|
11004
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11005
|
-
const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
11006
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
11007
|
-
};
|
|
11008
|
-
|
|
11009
11011
|
// ../core-web/dist/esm/index.js
|
|
11010
11012
|
var esm_exports2 = {};
|
|
11011
11013
|
__export(esm_exports2, {
|
|
@@ -11163,7 +11165,7 @@ var ElementUtils;
|
|
|
11163
11165
|
return Array.from(documentFragment.childNodes);
|
|
11164
11166
|
};
|
|
11165
11167
|
ElementUtils2.cloneNodeList = (documentFragment) => {
|
|
11166
|
-
return Array.from(documentFragment.childNodes).map((
|
|
11168
|
+
return Array.from(documentFragment.childNodes).map((node2) => node2.cloneNode(true));
|
|
11167
11169
|
};
|
|
11168
11170
|
ElementUtils2.querySelector = (e, selector) => {
|
|
11169
11171
|
const elements = ElementUtils2.querySelectorAll(e, selector);
|
|
@@ -11226,12 +11228,12 @@ var ElementUtils;
|
|
|
11226
11228
|
return attribute2;
|
|
11227
11229
|
};
|
|
11228
11230
|
ElementUtils2.getStyleToObject = (input) => {
|
|
11229
|
-
const
|
|
11231
|
+
const style2 = {};
|
|
11230
11232
|
for (let i = 0; i < input.style.length; i++) {
|
|
11231
11233
|
const key = input.style[i];
|
|
11232
|
-
|
|
11234
|
+
style2[key] = input.style[key];
|
|
11233
11235
|
}
|
|
11234
|
-
return
|
|
11236
|
+
return style2;
|
|
11235
11237
|
};
|
|
11236
11238
|
})(ElementUtils || (ElementUtils = {}));
|
|
11237
11239
|
|
|
@@ -11265,26 +11267,26 @@ var ElementApply = class _ElementApply {
|
|
|
11265
11267
|
}
|
|
11266
11268
|
return variables;
|
|
11267
11269
|
}
|
|
11268
|
-
getTarget(
|
|
11269
|
-
if (
|
|
11270
|
-
const fullStr =
|
|
11270
|
+
getTarget(node2, id) {
|
|
11271
|
+
if (node2.nodeType === this.window.Node.COMMENT_NODE || node2.data?.trim?.()?.startsWith(`ea:${this.id}:start:html`) || node2.data?.trim?.()?.startsWith(`ea:${this.id}:start:text`)) {
|
|
11272
|
+
const fullStr = node2.data?.trim?.();
|
|
11271
11273
|
let [prefix, ...rest] = fullStr?.split(" ") ?? [];
|
|
11272
11274
|
prefix = prefix.trim?.();
|
|
11273
11275
|
const script = rest.join(" ");
|
|
11274
11276
|
const [eaPrefix, eaId, startEnd, type] = prefix?.split(":") ?? [];
|
|
11275
11277
|
const endPrefix = `${eaPrefix}:${eaId}:end:${type}`;
|
|
11276
|
-
let next =
|
|
11278
|
+
let next = node2.nextSibling;
|
|
11277
11279
|
while (next) {
|
|
11278
11280
|
if (next.nodeType === Node.COMMENT_NODE && next.data?.trim?.()?.startsWith(endPrefix)) {
|
|
11279
|
-
return { nodeType: "comment", type, start:
|
|
11281
|
+
return { nodeType: "comment", type, start: node2, end: next, script: script ?? "", variables: this.findVariables(script) };
|
|
11280
11282
|
}
|
|
11281
11283
|
next = next.nextSibling;
|
|
11282
11284
|
}
|
|
11283
|
-
} else if (
|
|
11284
|
-
const aa =
|
|
11285
|
+
} else if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
11286
|
+
const aa = node2.getAttributeNames().filter((name) => {
|
|
11285
11287
|
return name.startsWith(`ea:${id}:attribute:`) || name.startsWith(`ea:${id}:event:`) || name.startsWith(`ea:${id}:property:`);
|
|
11286
11288
|
});
|
|
11287
|
-
const element =
|
|
11289
|
+
const element = node2;
|
|
11288
11290
|
const types = aa.map((attrName) => {
|
|
11289
11291
|
const [eaPrefix, eaId, type, name] = attrName?.split(":") ?? [];
|
|
11290
11292
|
if (eaPrefix === "ea" && eaId === id && (type === "attribute" || type === "event" || type === "property") && name) {
|
|
@@ -11316,8 +11318,8 @@ var ElementApply = class _ElementApply {
|
|
|
11316
11318
|
const targets = [];
|
|
11317
11319
|
targetRoots.forEach((el) => {
|
|
11318
11320
|
const walker = this.document.createTreeWalker(el, this.window.NodeFilter.SHOW_ELEMENT | this.window.NodeFilter.SHOW_COMMENT, {
|
|
11319
|
-
acceptNode: (
|
|
11320
|
-
const target = this.getTarget(
|
|
11321
|
+
acceptNode: (node2) => {
|
|
11322
|
+
const target = this.getTarget(node2, this.id);
|
|
11321
11323
|
if (target) {
|
|
11322
11324
|
targets.push(target);
|
|
11323
11325
|
return this.window.NodeFilter.FILTER_ACCEPT;
|
|
@@ -11480,18 +11482,18 @@ var NodeUtils;
|
|
|
11480
11482
|
FindNodesFilterResult2["NO_MATCH_AND_CONTINUE"] = "NO_MATCH_AND_CONTINUE";
|
|
11481
11483
|
FindNodesFilterResult2["NO_MATCH_AND_SKIP_CHILDREN"] = "NO_MATCH_AND_SKIP_CHILDREN";
|
|
11482
11484
|
})(FindNodesFilterResult = NodeUtils2.FindNodesFilterResult || (NodeUtils2.FindNodesFilterResult = {}));
|
|
11483
|
-
NodeUtils2.removeAllChildNode = (
|
|
11484
|
-
while (
|
|
11485
|
-
|
|
11485
|
+
NodeUtils2.removeAllChildNode = (node2) => {
|
|
11486
|
+
while (node2?.firstChild) {
|
|
11487
|
+
node2.firstChild.remove();
|
|
11486
11488
|
}
|
|
11487
11489
|
};
|
|
11488
|
-
NodeUtils2.removeAllChildNodeAndAppend = (
|
|
11489
|
-
(0, NodeUtils2.removeAllChildNode)(
|
|
11490
|
+
NodeUtils2.removeAllChildNodeAndAppend = (node2, newNode) => {
|
|
11491
|
+
(0, NodeUtils2.removeAllChildNode)(node2);
|
|
11490
11492
|
if (Array.isArray(newNode)) {
|
|
11491
|
-
newNode.forEach((it) =>
|
|
11493
|
+
newNode.forEach((it) => node2.appendChild(it));
|
|
11492
11494
|
return;
|
|
11493
11495
|
}
|
|
11494
|
-
|
|
11496
|
+
node2.appendChild(newNode);
|
|
11495
11497
|
};
|
|
11496
11498
|
NodeUtils2.appendChild = (parentNode, childNode) => {
|
|
11497
11499
|
return parentNode.appendChild(childNode);
|
|
@@ -11507,11 +11509,11 @@ var NodeUtils;
|
|
|
11507
11509
|
};
|
|
11508
11510
|
NodeUtils2.findNodes = (rootNode, filter) => {
|
|
11509
11511
|
const foundNodes = [];
|
|
11510
|
-
function traverse(
|
|
11511
|
-
if (!
|
|
11512
|
+
function traverse(node2) {
|
|
11513
|
+
if (!node2) {
|
|
11512
11514
|
return;
|
|
11513
11515
|
}
|
|
11514
|
-
|
|
11516
|
+
node2.childNodes.forEach((child) => {
|
|
11515
11517
|
const result = filter(child);
|
|
11516
11518
|
if (result === "MATCH_AND_CONTINUE" || result === "MATCH_AND_SKIP_CHILDREN") {
|
|
11517
11519
|
foundNodes.push(child);
|
|
@@ -11754,26 +11756,26 @@ var NodeSlot = class _NodeSlot {
|
|
|
11754
11756
|
if (!doc || !win) return result;
|
|
11755
11757
|
const find = (target) => {
|
|
11756
11758
|
const walker = doc.createTreeWalker(target, win.NodeFilter.SHOW_COMMENT, null, false);
|
|
11757
|
-
let
|
|
11759
|
+
let node2 = walker.nextNode();
|
|
11758
11760
|
const markerData = targetId ? _NodeSlot.startEndMarkerData(this.id, targetId) : { start: this.startMarkerData, end: this.endMarkerData };
|
|
11759
11761
|
const startPrefix = markerData.start + ":";
|
|
11760
|
-
while (
|
|
11761
|
-
const data =
|
|
11762
|
+
while (node2) {
|
|
11763
|
+
const data = node2.data;
|
|
11762
11764
|
if (data && data.indexOf(startPrefix) === 0) {
|
|
11763
11765
|
const uid = data.substring(startPrefix.length);
|
|
11764
11766
|
const expectedEnd = `${markerData.end}:${uid}`;
|
|
11765
|
-
let sibling =
|
|
11767
|
+
let sibling = node2.nextSibling;
|
|
11766
11768
|
let foundEnd = null;
|
|
11767
11769
|
while (sibling) {
|
|
11768
|
-
if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode ===
|
|
11770
|
+
if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode === node2.parentNode) {
|
|
11769
11771
|
foundEnd = sibling;
|
|
11770
11772
|
break;
|
|
11771
11773
|
}
|
|
11772
11774
|
sibling = sibling.nextSibling;
|
|
11773
11775
|
}
|
|
11774
|
-
result.push(new Slot(
|
|
11776
|
+
result.push(new Slot(node2, foundEnd));
|
|
11775
11777
|
}
|
|
11776
|
-
|
|
11778
|
+
node2 = walker.nextNode();
|
|
11777
11779
|
}
|
|
11778
11780
|
};
|
|
11779
11781
|
if (this.host.shadowRoot) {
|
|
@@ -13094,7 +13096,7 @@ var StyleCssUtils;
|
|
|
13094
13096
|
try {
|
|
13095
13097
|
Array.from(sheet.cssRules).forEach((rule) => {
|
|
13096
13098
|
if ("style" in rule && rule.style instanceof CSSStyleDeclaration) {
|
|
13097
|
-
Array.from(rule.style).filter((
|
|
13099
|
+
Array.from(rule.style).filter((prop2) => prop2.startsWith("--")).forEach((prop2) => variables.add(prop2));
|
|
13098
13100
|
}
|
|
13099
13101
|
});
|
|
13100
13102
|
} catch (e) {
|
|
@@ -13103,7 +13105,7 @@ var StyleCssUtils;
|
|
|
13103
13105
|
});
|
|
13104
13106
|
}
|
|
13105
13107
|
const computedStyles = config.window.getComputedStyle(targetElement);
|
|
13106
|
-
Array.from(computedStyles).filter((
|
|
13108
|
+
Array.from(computedStyles).filter((prop2) => prop2.startsWith("--")).forEach((it) => {
|
|
13107
13109
|
variables.add(it);
|
|
13108
13110
|
});
|
|
13109
13111
|
return Array.from(variables).map((it) => [it, computedStyles.getPropertyValue(it)]);
|
|
@@ -13466,9 +13468,9 @@ var SwcUtils;
|
|
|
13466
13468
|
} else if (htmlOrNode) {
|
|
13467
13469
|
const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];
|
|
13468
13470
|
const window2 = document2.defaultView;
|
|
13469
|
-
nodes.forEach((
|
|
13470
|
-
|
|
13471
|
-
const nodes2 = document2.createTreeWalker(
|
|
13471
|
+
nodes.forEach((node2) => {
|
|
13472
|
+
node2.normalize();
|
|
13473
|
+
const nodes2 = document2.createTreeWalker(node2, window2.NodeFilter.SHOW_ELEMENT | window2.NodeFilter.SHOW_COMMENT);
|
|
13472
13474
|
const getSlotData = (s) => {
|
|
13473
13475
|
return s.match(/^\[\[([\s\S]+)\]\]$/)?.[1]?.trim();
|
|
13474
13476
|
};
|
|
@@ -13644,10 +13646,1116 @@ var SwcUtils;
|
|
|
13644
13646
|
};
|
|
13645
13647
|
})(SwcUtils || (SwcUtils = {}));
|
|
13646
13648
|
|
|
13647
|
-
// src/decorators/
|
|
13648
|
-
var
|
|
13649
|
-
function
|
|
13650
|
-
|
|
13649
|
+
// src/decorators/addEventListener.ts
|
|
13650
|
+
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
13651
|
+
function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
13652
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
13653
|
+
let selector;
|
|
13654
|
+
let types;
|
|
13655
|
+
let opts = {};
|
|
13656
|
+
if (typeof typeOrOptions === "string" || Array.isArray(typeOrOptions)) {
|
|
13657
|
+
selector = selectorOrType;
|
|
13658
|
+
types = Array.isArray(typeOrOptions) ? typeOrOptions : [typeOrOptions];
|
|
13659
|
+
opts = maybeOptions ?? {};
|
|
13660
|
+
} else {
|
|
13661
|
+
selector = "$this";
|
|
13662
|
+
if (Array.isArray(selectorOrType)) types = selectorOrType;
|
|
13663
|
+
else types = [selectorOrType];
|
|
13664
|
+
opts = typeOrOptions ?? {};
|
|
13665
|
+
}
|
|
13666
|
+
const constructor = targetObj.constructor;
|
|
13667
|
+
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
13668
|
+
if (!listeners) {
|
|
13669
|
+
listeners = [];
|
|
13670
|
+
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
13671
|
+
}
|
|
13672
|
+
for (const type of types) listeners.push({ propertyKey, selector, type, options: opts });
|
|
13673
|
+
};
|
|
13674
|
+
}
|
|
13675
|
+
function addEventListenerDelegateLight(selector, type, options) {
|
|
13676
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
13677
|
+
}
|
|
13678
|
+
function addEventListenerDelegateShadow(selector, type, options) {
|
|
13679
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
13680
|
+
}
|
|
13681
|
+
function addEventListenerDelegateAll(selector, type, options) {
|
|
13682
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
13683
|
+
}
|
|
13684
|
+
function addEventListenerDelegate(selector, type, options) {
|
|
13685
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
13686
|
+
}
|
|
13687
|
+
function addEventListenerMutationLight(selector, type, options) {
|
|
13688
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: "mutation" });
|
|
13689
|
+
}
|
|
13690
|
+
function addEventListenerMutationShadow(selector, type, options) {
|
|
13691
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: "mutation" });
|
|
13692
|
+
}
|
|
13693
|
+
function addEventListenerMutationAll(selector, type, options) {
|
|
13694
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: "mutation" });
|
|
13695
|
+
}
|
|
13696
|
+
function addEventListenerMutation(selector, type, options) {
|
|
13697
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: "mutation" });
|
|
13698
|
+
}
|
|
13699
|
+
function addEventListenerLight(selector, type, options) {
|
|
13700
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light" });
|
|
13701
|
+
}
|
|
13702
|
+
function addEventListenerShadow(selector, type, options) {
|
|
13703
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow" });
|
|
13704
|
+
}
|
|
13705
|
+
function addEventListenerAll(selector, type, options) {
|
|
13706
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all" });
|
|
13707
|
+
}
|
|
13708
|
+
function addEventListenerThis(type, options) {
|
|
13709
|
+
return addEventListener("$this", type, options);
|
|
13710
|
+
}
|
|
13711
|
+
function addEventListenerAppHost(type, options) {
|
|
13712
|
+
return addEventListener("$appHost", type, options);
|
|
13713
|
+
}
|
|
13714
|
+
function addEventListenerWindow(type, options) {
|
|
13715
|
+
return addEventListener("$window", type, options);
|
|
13716
|
+
}
|
|
13717
|
+
function addEventListenerDocument(type, options) {
|
|
13718
|
+
return addEventListener("$document", type, options);
|
|
13719
|
+
}
|
|
13720
|
+
var event = addEventListener;
|
|
13721
|
+
var eventDelegateLight = addEventListenerDelegateLight;
|
|
13722
|
+
var eventDelegateShadow = addEventListenerDelegateShadow;
|
|
13723
|
+
var eventDelegateAll = addEventListenerDelegateAll;
|
|
13724
|
+
var eventDelegate = addEventListenerDelegate;
|
|
13725
|
+
var eventMutationLight = addEventListenerMutationLight;
|
|
13726
|
+
var eventMutationShadow = addEventListenerMutationShadow;
|
|
13727
|
+
var eventMutationAll = addEventListenerMutationAll;
|
|
13728
|
+
var eventMutation = addEventListenerMutation;
|
|
13729
|
+
var eventLight = addEventListenerLight;
|
|
13730
|
+
var eventShadow = addEventListenerShadow;
|
|
13731
|
+
var eventAll = addEventListenerAll;
|
|
13732
|
+
var eventAppHost = addEventListenerAppHost;
|
|
13733
|
+
var eventWindow = addEventListenerWindow;
|
|
13734
|
+
var eventDocument = addEventListenerDocument;
|
|
13735
|
+
var eventThis = addEventListenerThis;
|
|
13736
|
+
var getAddEventListenerMetadata = (target) => {
|
|
13737
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
13738
|
+
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
13739
|
+
};
|
|
13740
|
+
var EventListenerLifeCycler = class {
|
|
13741
|
+
constructor() {
|
|
13742
|
+
/** 인스턴스별 boundListeners 상태 (시클러는 elementDefine 시 1회 생성되어 공유되므로) */
|
|
13743
|
+
__publicField(this, "boundListenersMap", /* @__PURE__ */ new WeakMap());
|
|
13744
|
+
/** 인스턴스별 delegate:'mutation' 바인딩 추적 WeakSet — MutationObserverLifeCycler 에서 참조 */
|
|
13745
|
+
__publicField(this, "eventBoundSetsMap", /* @__PURE__ */ new WeakMap());
|
|
13746
|
+
}
|
|
13747
|
+
// ── 외부(MutationObserverLifeCycler)에서 직접 사용하는 공개 헬퍼 ──
|
|
13748
|
+
/** 인스턴스별 boundListeners 를 반환한다 (없으면 생성). */
|
|
13749
|
+
getBoundListeners(inst) {
|
|
13750
|
+
let list = this.boundListenersMap.get(inst);
|
|
13751
|
+
if (!list) {
|
|
13752
|
+
list = [];
|
|
13753
|
+
this.boundListenersMap.set(inst, list);
|
|
13754
|
+
}
|
|
13755
|
+
return list;
|
|
13756
|
+
}
|
|
13757
|
+
/** 인스턴스별 eventBoundSets 를 반환한다 (없으면 생성). */
|
|
13758
|
+
getEventBoundSets(inst) {
|
|
13759
|
+
let map = this.eventBoundSetsMap.get(inst);
|
|
13760
|
+
if (!map) {
|
|
13761
|
+
map = /* @__PURE__ */ new Map();
|
|
13762
|
+
this.eventBoundSetsMap.set(inst, map);
|
|
13763
|
+
}
|
|
13764
|
+
return map;
|
|
13765
|
+
}
|
|
13766
|
+
/**
|
|
13767
|
+
* target 에 meta 이벤트를 직접 바인딩한다.
|
|
13768
|
+
* delegate:'mutation' 초기/동적 바인딩에서 호출된다.
|
|
13769
|
+
*/
|
|
13770
|
+
bindDirect(helperHostSet, target, meta) {
|
|
13771
|
+
const inst = helperHostSet.$this;
|
|
13772
|
+
const currentWin = helperHostSet.$w;
|
|
13773
|
+
const { type, options } = meta;
|
|
13774
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
13775
|
+
const handler = async (event2) => {
|
|
13776
|
+
if (options.filter) {
|
|
13777
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, target);
|
|
13778
|
+
if (!options.filter(event2, { currentThis: inst, helper })) return;
|
|
13779
|
+
}
|
|
13780
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
13781
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
13782
|
+
if (options.preventDefault) event2.preventDefault();
|
|
13783
|
+
const currentHostSet = SwcUtils.getHostSet(inst);
|
|
13784
|
+
await inst[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, { event: event2, ...currentHostSet, $el: target, $root: target });
|
|
13785
|
+
};
|
|
13786
|
+
const eventSubject = new Subject();
|
|
13787
|
+
let eventStream = eventSubject;
|
|
13788
|
+
if (options.debounceTime && options.debounceTime > 0)
|
|
13789
|
+
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
13790
|
+
if (options.throttleTime && options.throttleTime > 0)
|
|
13791
|
+
eventStream = eventStream.pipe(throttleTime2(options.throttleTime));
|
|
13792
|
+
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
13793
|
+
eventStream = typeof options.distinctUntilChanged === "function" ? eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged)) : eventStream.pipe(distinctUntilChanged());
|
|
13794
|
+
}
|
|
13795
|
+
const subscription = eventStream.subscribe({
|
|
13796
|
+
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
13797
|
+
error: (err) => console.error("Event stream error:", err)
|
|
13798
|
+
});
|
|
13799
|
+
const wrappedHandler = (event2) => eventSubject.next(event2);
|
|
13800
|
+
target.addEventListener(type, wrappedHandler, opts);
|
|
13801
|
+
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
13802
|
+
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
13803
|
+
}
|
|
13804
|
+
/** target + meta 조합 리스너를 제거한다. MutationObserver 추적 요소 제거 시 호출. */
|
|
13805
|
+
unbindDirect(helperHostSet, target, meta) {
|
|
13806
|
+
const inst = helperHostSet.$this;
|
|
13807
|
+
const list = this.getBoundListeners(inst);
|
|
13808
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
13809
|
+
const l = list[i];
|
|
13810
|
+
if (l.target === target && l.type === meta.type && l.meta === meta) {
|
|
13811
|
+
try {
|
|
13812
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
13813
|
+
l.subscription?.unsubscribe?.();
|
|
13814
|
+
} catch (e) {
|
|
13815
|
+
console.error("[SWC] unbindDirect error:", e);
|
|
13816
|
+
}
|
|
13817
|
+
for (const r of l.onRemoves ?? []) {
|
|
13818
|
+
try {
|
|
13819
|
+
r.fn(l.target, r.opts);
|
|
13820
|
+
} catch (e) {
|
|
13821
|
+
console.error("[SWC] unbindDirect removeListener error:", e);
|
|
13822
|
+
}
|
|
13823
|
+
}
|
|
13824
|
+
list.splice(i, 1);
|
|
13825
|
+
}
|
|
13826
|
+
}
|
|
13827
|
+
}
|
|
13828
|
+
/**
|
|
13829
|
+
* 메타데이터 목록을 delegate / mutationDelegate / nonDelegate 로 분류한다.
|
|
13830
|
+
* MutationObserverLifeCycler 에서 mutationDelegate 목록을 꺼낼 때 사용한다.
|
|
13831
|
+
*/
|
|
13832
|
+
classifyListeners(metaList) {
|
|
13833
|
+
const isSpecial = (sel) => [
|
|
13834
|
+
"$window",
|
|
13835
|
+
"$document",
|
|
13836
|
+
"$host",
|
|
13837
|
+
"$appHost",
|
|
13838
|
+
"$firstHost",
|
|
13839
|
+
"$lastHost",
|
|
13840
|
+
"$firstAppHost",
|
|
13841
|
+
"$lastAppHost",
|
|
13842
|
+
"$hosts",
|
|
13843
|
+
"$appHosts",
|
|
13844
|
+
"$this",
|
|
13845
|
+
""
|
|
13846
|
+
].includes(sel);
|
|
13847
|
+
const delegateListeners = [];
|
|
13848
|
+
const mutationDelegateListeners = [];
|
|
13849
|
+
const nonDelegateListeners = [];
|
|
13850
|
+
for (const meta of metaList) {
|
|
13851
|
+
const isStr = typeof meta.selector === "string";
|
|
13852
|
+
const mode = meta.options.delegate;
|
|
13853
|
+
if (mode && isStr && !isSpecial(meta.selector)) {
|
|
13854
|
+
mode === "mutation" ? mutationDelegateListeners.push(meta) : delegateListeners.push(meta);
|
|
13855
|
+
} else {
|
|
13856
|
+
nonDelegateListeners.push(meta);
|
|
13857
|
+
}
|
|
13858
|
+
}
|
|
13859
|
+
return { delegateListeners, mutationDelegateListeners, nonDelegateListeners };
|
|
13860
|
+
}
|
|
13861
|
+
// ── ElementDefineLifeCycler 구현 ──
|
|
13862
|
+
onConnected(helperHostSet) {
|
|
13863
|
+
const inst = helperHostSet.$this;
|
|
13864
|
+
const currentWin = helperHostSet.$w;
|
|
13865
|
+
this.boundListenersMap.delete(inst);
|
|
13866
|
+
this.eventBoundSetsMap.delete(inst);
|
|
13867
|
+
const allMeta = getAddEventListenerMetadata(inst) ?? [];
|
|
13868
|
+
const { delegateListeners, nonDelegateListeners, mutationDelegateListeners } = this.classifyListeners(allMeta);
|
|
13869
|
+
const groups = /* @__PURE__ */ new Map();
|
|
13870
|
+
for (const meta of delegateListeners) {
|
|
13871
|
+
const key = `${meta.type}:${meta.options.root || "auto"}`;
|
|
13872
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
13873
|
+
groups.get(key).push(meta);
|
|
13874
|
+
}
|
|
13875
|
+
groups.forEach((metaList, key) => {
|
|
13876
|
+
const ci = key.indexOf(":");
|
|
13877
|
+
const type = key.slice(0, ci);
|
|
13878
|
+
const r = key.slice(ci + 1);
|
|
13879
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
13880
|
+
const roots = [];
|
|
13881
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
13882
|
+
else if (r === "light") roots.push(inst);
|
|
13883
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
13884
|
+
else if (r === "all") {
|
|
13885
|
+
roots.push(inst);
|
|
13886
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
13887
|
+
}
|
|
13888
|
+
for (const br of roots) {
|
|
13889
|
+
const sorted = [...metaList].sort((a, b) => (b.options.stopPropagation ? 1 : 0) - (a.options.stopPropagation ? 1 : 0));
|
|
13890
|
+
const handler = async (event2) => {
|
|
13891
|
+
for (const m of sorted) {
|
|
13892
|
+
const matchedEl = event2.target?.closest(m.selector);
|
|
13893
|
+
console.log("[DBG][delegate] type=", event2.type, "| evtTarget=", event2.target?.tagName, "| sel=", m.selector, "| matchedEl=", matchedEl?.className || matchedEl?.tagName, "| brContains=", br.contains?.(matchedEl), "| brTag=", br.tagName || br.constructor?.name);
|
|
13894
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
13895
|
+
if (m.options.filter) {
|
|
13896
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
13897
|
+
if (!m.options.filter(event2, { currentThis: inst, helper })) continue;
|
|
13898
|
+
}
|
|
13899
|
+
if (m.options.stopPropagation) event2.stopPropagation();
|
|
13900
|
+
if (m.options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
13901
|
+
if (m.options.preventDefault) event2.preventDefault();
|
|
13902
|
+
const hs = SwcUtils.getHostSet(inst);
|
|
13903
|
+
await inst[m.propertyKey](event2, { ...hs, $matchedElement: matchedEl }, { event: event2, ...hs, $el: matchedEl, $root: br });
|
|
13904
|
+
if (event2.cancelBubble) break;
|
|
13905
|
+
}
|
|
13906
|
+
}
|
|
13907
|
+
};
|
|
13908
|
+
br.addEventListener(type, handler, opts);
|
|
13909
|
+
if (type === "click") {
|
|
13910
|
+
console.log("[DBG][eventCycler] bound click on br=", br.tagName || br.constructor?.name, "| inst=", inst.tagName || inst.constructor?.name, "| isSame=", br === inst);
|
|
13911
|
+
}
|
|
13912
|
+
const onRemoves = sorted.filter((m) => m.options.removeListener).map((m) => ({ fn: m.options.removeListener, opts: m.options }));
|
|
13913
|
+
this.getBoundListeners(inst).push({ target: br, type, handler, options: opts, onRemoves });
|
|
13914
|
+
}
|
|
13915
|
+
});
|
|
13916
|
+
for (const meta of nonDelegateListeners) {
|
|
13917
|
+
const { selector, options } = meta;
|
|
13918
|
+
const r = options.root || "auto";
|
|
13919
|
+
const bindTargets = [];
|
|
13920
|
+
let resolvedSel = null;
|
|
13921
|
+
if (typeof selector === "function") {
|
|
13922
|
+
const result = selector(inst, helperHostSet);
|
|
13923
|
+
if (typeof result === "string") resolvedSel = result;
|
|
13924
|
+
else if (result instanceof currentWin.Element) bindTargets.push(result);
|
|
13925
|
+
else if (result instanceof currentWin.NodeList) bindTargets.push(...Array.from(result));
|
|
13926
|
+
else if (Array.isArray(result)) bindTargets.push(...result);
|
|
13927
|
+
} else {
|
|
13928
|
+
resolvedSel = selector;
|
|
13929
|
+
}
|
|
13930
|
+
const applyRoot = (t) => {
|
|
13931
|
+
if (!t) return;
|
|
13932
|
+
if (r === "auto") bindTargets.push(t.shadowRoot || t);
|
|
13933
|
+
else {
|
|
13934
|
+
if (r === "light" || r === "all") bindTargets.push(t);
|
|
13935
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) bindTargets.push(t.shadowRoot);
|
|
13936
|
+
}
|
|
13937
|
+
};
|
|
13938
|
+
if (resolvedSel) {
|
|
13939
|
+
if (resolvedSel === "$window") bindTargets.push(currentWin);
|
|
13940
|
+
else if (resolvedSel === "$document") bindTargets.push(currentWin.document);
|
|
13941
|
+
else if (resolvedSel === "$host") applyRoot(helperHostSet.$host);
|
|
13942
|
+
else if (resolvedSel === "$parentHost") applyRoot(helperHostSet.$parentHost);
|
|
13943
|
+
else if (resolvedSel === "$appHost") applyRoot(helperHostSet.$appHost);
|
|
13944
|
+
else if (resolvedSel === "$firstHost") applyRoot(helperHostSet.$firstHost);
|
|
13945
|
+
else if (resolvedSel === "$lastHost") applyRoot(helperHostSet.$lastHost);
|
|
13946
|
+
else if (resolvedSel === "$firstAppHost") applyRoot(helperHostSet.$firstAppHost);
|
|
13947
|
+
else if (resolvedSel === "$lastAppHost") applyRoot(helperHostSet.$lastAppHost);
|
|
13948
|
+
else if (resolvedSel === "$hosts") helperHostSet.$hosts.forEach(applyRoot);
|
|
13949
|
+
else if (resolvedSel === "$appHosts") helperHostSet.$appHosts.forEach(applyRoot);
|
|
13950
|
+
else if (resolvedSel === "$this" || !resolvedSel) applyRoot(inst);
|
|
13951
|
+
else {
|
|
13952
|
+
const searchRoots = [];
|
|
13953
|
+
if (r === "auto") searchRoots.push(inst.shadowRoot || inst);
|
|
13954
|
+
else if (r === "light") searchRoots.push(inst);
|
|
13955
|
+
else if (r === "shadow" && inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
13956
|
+
else if (r === "all") {
|
|
13957
|
+
searchRoots.push(inst);
|
|
13958
|
+
if (inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
13959
|
+
}
|
|
13960
|
+
for (const sr of searchRoots) sr.querySelectorAll(resolvedSel).forEach((el) => bindTargets.push(el));
|
|
13961
|
+
}
|
|
13962
|
+
}
|
|
13963
|
+
for (const t of bindTargets) this.bindDirect(helperHostSet, t, meta);
|
|
13964
|
+
}
|
|
13965
|
+
if (mutationDelegateListeners.length > 0) {
|
|
13966
|
+
const shadowEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
13967
|
+
const r = m.options.root || "auto";
|
|
13968
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
13969
|
+
});
|
|
13970
|
+
const lightEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
13971
|
+
const r = m.options.root || "auto";
|
|
13972
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
13973
|
+
});
|
|
13974
|
+
const buildMutationEntry = (root, eventDelegates) => {
|
|
13975
|
+
if (eventDelegates.length === 0) return null;
|
|
13976
|
+
const boundSets = this.getEventBoundSets(inst);
|
|
13977
|
+
const callback = (mutations, obs) => {
|
|
13978
|
+
for (const m of eventDelegates) {
|
|
13979
|
+
let boundSet = boundSets.get(m);
|
|
13980
|
+
if (!boundSet) {
|
|
13981
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
13982
|
+
boundSets.set(m, boundSet);
|
|
13983
|
+
}
|
|
13984
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
13985
|
+
const matchesSel = (n) => {
|
|
13986
|
+
if (!n || n.nodeType !== 1) return false;
|
|
13987
|
+
if (isThis) return true;
|
|
13988
|
+
return typeof m.selector === "string" && n.matches?.(m.selector);
|
|
13989
|
+
};
|
|
13990
|
+
const bindEl = (el) => {
|
|
13991
|
+
if (!boundSet.has(el)) {
|
|
13992
|
+
this.bindDirect(helperHostSet, el, m);
|
|
13993
|
+
boundSet.add(el);
|
|
13994
|
+
}
|
|
13995
|
+
};
|
|
13996
|
+
const unbindEl = (el) => {
|
|
13997
|
+
if (boundSet.has(el)) {
|
|
13998
|
+
this.unbindDirect(helperHostSet, el, m);
|
|
13999
|
+
boundSet.delete(el);
|
|
14000
|
+
}
|
|
14001
|
+
};
|
|
14002
|
+
for (const mut of mutations) {
|
|
14003
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
14004
|
+
if (n.nodeType !== 1) return;
|
|
14005
|
+
if (matchesSel(n)) bindEl(n);
|
|
14006
|
+
else if (!isThis && typeof m.selector === "string") n.querySelectorAll?.(m.selector).forEach(bindEl);
|
|
14007
|
+
});
|
|
14008
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
14009
|
+
if (n.nodeType !== 1) return;
|
|
14010
|
+
const el = n;
|
|
14011
|
+
if (matchesSel(el)) unbindEl(el);
|
|
14012
|
+
else if (!isThis && typeof m.selector === "string") el.querySelectorAll?.(m.selector).forEach(unbindEl);
|
|
14013
|
+
});
|
|
14014
|
+
}
|
|
14015
|
+
}
|
|
14016
|
+
};
|
|
14017
|
+
for (const m of eventDelegates) {
|
|
14018
|
+
let boundSet = boundSets.get(m);
|
|
14019
|
+
if (!boundSet) {
|
|
14020
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
14021
|
+
boundSets.set(m, boundSet);
|
|
14022
|
+
}
|
|
14023
|
+
if (typeof m.selector !== "string") continue;
|
|
14024
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14025
|
+
this.bindDirect(helperHostSet, root, m);
|
|
14026
|
+
boundSet.add(root);
|
|
14027
|
+
} else {
|
|
14028
|
+
root.querySelectorAll(m.selector).forEach((el) => {
|
|
14029
|
+
if (!boundSet.has(el)) {
|
|
14030
|
+
this.bindDirect(helperHostSet, el, m);
|
|
14031
|
+
boundSet.add(el);
|
|
14032
|
+
}
|
|
14033
|
+
});
|
|
14034
|
+
}
|
|
14035
|
+
}
|
|
14036
|
+
return { target: root, options: { childList: true, subtree: true }, callback };
|
|
14037
|
+
};
|
|
14038
|
+
const shadowEntry = inst.shadowRoot ? buildMutationEntry(inst.shadowRoot, shadowEventDelegates) : null;
|
|
14039
|
+
const lightEntry = buildMutationEntry(inst, lightEventDelegates);
|
|
14040
|
+
const mutationObserverSet = [shadowEntry, lightEntry].filter(Boolean);
|
|
14041
|
+
if (mutationObserverSet.length > 0) return { mutationObserverSet };
|
|
14042
|
+
}
|
|
14043
|
+
return void 0;
|
|
14044
|
+
}
|
|
14045
|
+
onDisconnected(helperHostSet) {
|
|
14046
|
+
const inst = helperHostSet.$this;
|
|
14047
|
+
const list = this.boundListenersMap.get(inst) ?? [];
|
|
14048
|
+
for (const l of list) {
|
|
14049
|
+
try {
|
|
14050
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
14051
|
+
l.subscription?.unsubscribe?.();
|
|
14052
|
+
} catch (e) {
|
|
14053
|
+
console.error("[SWC] EventListenerLifeCycler cleanup error:", e);
|
|
14054
|
+
}
|
|
14055
|
+
for (const r of l.onRemoves ?? []) {
|
|
14056
|
+
try {
|
|
14057
|
+
r.fn(l.target, r.opts);
|
|
14058
|
+
} catch (e) {
|
|
14059
|
+
console.error("[SWC] removeListener error:", e);
|
|
14060
|
+
}
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
14063
|
+
this.boundListenersMap.delete(inst);
|
|
14064
|
+
this.eventBoundSetsMap.delete(inst);
|
|
14065
|
+
}
|
|
14066
|
+
};
|
|
14067
|
+
|
|
14068
|
+
// src/decorators/mutationObserver.ts
|
|
14069
|
+
var MUTATION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:mutation-observer");
|
|
14070
|
+
function mutationObserver(selectorOrOptions, maybeOptions) {
|
|
14071
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14072
|
+
let selector = "$this";
|
|
14073
|
+
let options = {};
|
|
14074
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14075
|
+
selector = selectorOrOptions;
|
|
14076
|
+
options = maybeOptions ?? {};
|
|
14077
|
+
} else {
|
|
14078
|
+
selector = "$this";
|
|
14079
|
+
options = selectorOrOptions ?? {};
|
|
14080
|
+
}
|
|
14081
|
+
const constructor = targetObj.constructor;
|
|
14082
|
+
let observers = ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
14083
|
+
if (!observers) {
|
|
14084
|
+
observers = [];
|
|
14085
|
+
ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14086
|
+
}
|
|
14087
|
+
observers.push({ propertyKey, selector, options });
|
|
14088
|
+
};
|
|
14089
|
+
}
|
|
14090
|
+
function mutationObserverThis(options) {
|
|
14091
|
+
return mutationObserver("$this", options);
|
|
14092
|
+
}
|
|
14093
|
+
function mutationObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14094
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14095
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14096
|
+
}
|
|
14097
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14098
|
+
}
|
|
14099
|
+
function mutationObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14100
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14101
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14102
|
+
}
|
|
14103
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14104
|
+
}
|
|
14105
|
+
function mutationObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14106
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14107
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14108
|
+
}
|
|
14109
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14110
|
+
}
|
|
14111
|
+
function mutationObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14112
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14113
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14114
|
+
}
|
|
14115
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14116
|
+
}
|
|
14117
|
+
function mutationObserverLight(selectorOrOptions, maybeOptions) {
|
|
14118
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14119
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14120
|
+
}
|
|
14121
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14122
|
+
}
|
|
14123
|
+
function mutationObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14124
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14125
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14126
|
+
}
|
|
14127
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14128
|
+
}
|
|
14129
|
+
function mutationObserverAll(selectorOrOptions, maybeOptions) {
|
|
14130
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14131
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14132
|
+
}
|
|
14133
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14134
|
+
}
|
|
14135
|
+
function getMutationObserverMetadata(target) {
|
|
14136
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14137
|
+
return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
14138
|
+
}
|
|
14139
|
+
var MutationObserverLifeCycler = class {
|
|
14140
|
+
constructor() {
|
|
14141
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14142
|
+
}
|
|
14143
|
+
onConnected(helperHostSet) {
|
|
14144
|
+
const inst = helperHostSet.$this;
|
|
14145
|
+
const currentWin = helperHostSet.$w;
|
|
14146
|
+
const removeObserverCallbacks = [];
|
|
14147
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14148
|
+
const allMeta = getMutationObserverMetadata(inst) ?? [];
|
|
14149
|
+
if (allMeta.length === 0) return;
|
|
14150
|
+
const shadowMetas = allMeta.filter((m) => {
|
|
14151
|
+
const r = m.options.root || "auto";
|
|
14152
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
14153
|
+
});
|
|
14154
|
+
const lightMetas = allMeta.filter((m) => {
|
|
14155
|
+
const r = m.options.root || "auto";
|
|
14156
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
14157
|
+
});
|
|
14158
|
+
const buildSet = (root, metas) => {
|
|
14159
|
+
if (metas.length === 0) return null;
|
|
14160
|
+
const initFrom = (o) => {
|
|
14161
|
+
const init = {
|
|
14162
|
+
childList: o.childList,
|
|
14163
|
+
attributes: o.attributes,
|
|
14164
|
+
characterData: o.characterData,
|
|
14165
|
+
subtree: o.subtree,
|
|
14166
|
+
attributeFilter: o.attributeFilter,
|
|
14167
|
+
attributeOldValue: o.attributeOldValue,
|
|
14168
|
+
characterDataOldValue: o.characterDataOldValue
|
|
14169
|
+
};
|
|
14170
|
+
if (!init.childList && !init.attributes && !init.characterData) init.childList = true;
|
|
14171
|
+
return init;
|
|
14172
|
+
};
|
|
14173
|
+
const fnObservedSets = /* @__PURE__ */ new Map();
|
|
14174
|
+
const callback = (mutations, obs) => {
|
|
14175
|
+
for (const meta of metas) {
|
|
14176
|
+
const { selector, options } = meta;
|
|
14177
|
+
let matchedEls = [];
|
|
14178
|
+
const typeMatches = (m) => {
|
|
14179
|
+
const has = !!(options.childList || options.attributes || options.characterData);
|
|
14180
|
+
if (m.type === "childList") return has ? !!options.childList : true;
|
|
14181
|
+
if (m.type === "attributes") return !!options.attributes;
|
|
14182
|
+
if (m.type === "characterData") return !!options.characterData;
|
|
14183
|
+
return true;
|
|
14184
|
+
};
|
|
14185
|
+
const collect = (matchesSel) => mutations.flatMap((m) => {
|
|
14186
|
+
if (!typeMatches(m)) return [];
|
|
14187
|
+
const els = [];
|
|
14188
|
+
if (matchesSel(m.target)) els.push(m.target);
|
|
14189
|
+
Array.from(m.addedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
14190
|
+
Array.from(m.removedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
14191
|
+
return els;
|
|
14192
|
+
});
|
|
14193
|
+
if (options.delegate && typeof selector === "string") {
|
|
14194
|
+
const isThis = selector === "$this" || selector === "";
|
|
14195
|
+
matchedEls = collect((n) => {
|
|
14196
|
+
if (!n || n.nodeType !== 1) return false;
|
|
14197
|
+
if (isThis) return true;
|
|
14198
|
+
const el = n;
|
|
14199
|
+
return el.matches?.(selector) || !!el.closest?.(selector);
|
|
14200
|
+
});
|
|
14201
|
+
} else if (typeof selector === "string") {
|
|
14202
|
+
const isThis = selector === "$this" || selector === "";
|
|
14203
|
+
matchedEls = collect((n) => {
|
|
14204
|
+
if (!n || n.nodeType !== 1) return false;
|
|
14205
|
+
if (isThis) return true;
|
|
14206
|
+
return n.matches?.(selector);
|
|
14207
|
+
});
|
|
14208
|
+
} else if (typeof selector === "function") {
|
|
14209
|
+
const set = fnObservedSets.get(meta);
|
|
14210
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1 && (set ? set.has(t) : false));
|
|
14211
|
+
} else {
|
|
14212
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1);
|
|
14213
|
+
}
|
|
14214
|
+
if (matchedEls.length === 0) continue;
|
|
14215
|
+
if (options.filter) {
|
|
14216
|
+
if (!options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14217
|
+
}
|
|
14218
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14219
|
+
inst[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root });
|
|
14220
|
+
}
|
|
14221
|
+
};
|
|
14222
|
+
const observeTargets = [];
|
|
14223
|
+
if (metas.some((m) => m.options.delegate)) {
|
|
14224
|
+
observeTargets.push({ target: root, options: { childList: true, subtree: true } });
|
|
14225
|
+
}
|
|
14226
|
+
for (const m of metas.filter((m2) => !m2.options.delegate)) {
|
|
14227
|
+
const { selector, options } = m;
|
|
14228
|
+
const mInit = initFrom(options);
|
|
14229
|
+
if (typeof selector === "string") {
|
|
14230
|
+
if (selector === "$this" || selector === "") {
|
|
14231
|
+
observeTargets.push({ target: root, options: mInit });
|
|
14232
|
+
} else {
|
|
14233
|
+
root.querySelectorAll(selector).forEach((el) => observeTargets.push({ target: el, options: mInit }));
|
|
14234
|
+
}
|
|
14235
|
+
} else if (typeof selector === "function") {
|
|
14236
|
+
const res = selector(inst, helperHostSet);
|
|
14237
|
+
let targets = [];
|
|
14238
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14239
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14240
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14241
|
+
const set = /* @__PURE__ */ new WeakSet();
|
|
14242
|
+
for (const el of targets) {
|
|
14243
|
+
set.add(el);
|
|
14244
|
+
observeTargets.push({ target: el, options: mInit });
|
|
14245
|
+
}
|
|
14246
|
+
fnObservedSets.set(m, set);
|
|
14247
|
+
}
|
|
14248
|
+
}
|
|
14249
|
+
for (const m of metas) {
|
|
14250
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14251
|
+
}
|
|
14252
|
+
return { callback, observeTargets };
|
|
14253
|
+
};
|
|
14254
|
+
const shadowSet = inst.shadowRoot ? buildSet(inst.shadowRoot, shadowMetas) : null;
|
|
14255
|
+
const lightSet = buildSet(inst, lightMetas);
|
|
14256
|
+
const mutationObserverSet = [
|
|
14257
|
+
...(shadowSet?.observeTargets ?? []).map((t) => ({ ...t, callback: shadowSet.callback })),
|
|
14258
|
+
...(lightSet?.observeTargets ?? []).map((t) => ({ ...t, callback: lightSet.callback }))
|
|
14259
|
+
];
|
|
14260
|
+
if (mutationObserverSet.length === 0) return;
|
|
14261
|
+
return { mutationObserverSet };
|
|
14262
|
+
}
|
|
14263
|
+
onDisconnected(helperHostSet) {
|
|
14264
|
+
const inst = helperHostSet.$this;
|
|
14265
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14266
|
+
try {
|
|
14267
|
+
cb.fn(cb.target, cb.opts);
|
|
14268
|
+
} catch (e) {
|
|
14269
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14270
|
+
}
|
|
14271
|
+
}
|
|
14272
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14273
|
+
}
|
|
14274
|
+
};
|
|
14275
|
+
|
|
14276
|
+
// src/decorators/resizeObserver.ts
|
|
14277
|
+
var RESIZE_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:resize-observer");
|
|
14278
|
+
function resizeObserver(selectorOrOptions, maybeOptions) {
|
|
14279
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14280
|
+
let selector = "$this";
|
|
14281
|
+
let options = {};
|
|
14282
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14283
|
+
selector = selectorOrOptions;
|
|
14284
|
+
options = maybeOptions ?? {};
|
|
14285
|
+
} else {
|
|
14286
|
+
selector = "$this";
|
|
14287
|
+
options = selectorOrOptions ?? {};
|
|
14288
|
+
}
|
|
14289
|
+
const constructor = targetObj.constructor;
|
|
14290
|
+
let observers = ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
14291
|
+
if (!observers) {
|
|
14292
|
+
observers = [];
|
|
14293
|
+
ReflectUtils.defineMetadata(RESIZE_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14294
|
+
}
|
|
14295
|
+
observers.push({ propertyKey, selector, options });
|
|
14296
|
+
};
|
|
14297
|
+
}
|
|
14298
|
+
function resizeObserverThis(options) {
|
|
14299
|
+
return resizeObserver("$this", options);
|
|
14300
|
+
}
|
|
14301
|
+
function resizeObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14302
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14303
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14304
|
+
}
|
|
14305
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14306
|
+
}
|
|
14307
|
+
function resizeObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14308
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14309
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14310
|
+
}
|
|
14311
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14312
|
+
}
|
|
14313
|
+
function resizeObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14314
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14315
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14316
|
+
}
|
|
14317
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14318
|
+
}
|
|
14319
|
+
function resizeObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14320
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14321
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14322
|
+
}
|
|
14323
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14324
|
+
}
|
|
14325
|
+
function resizeObserverLight(selectorOrOptions, maybeOptions) {
|
|
14326
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14327
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14328
|
+
}
|
|
14329
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14330
|
+
}
|
|
14331
|
+
function resizeObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14332
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14333
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14334
|
+
}
|
|
14335
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14336
|
+
}
|
|
14337
|
+
function resizeObserverAll(selectorOrOptions, maybeOptions) {
|
|
14338
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14339
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14340
|
+
}
|
|
14341
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14342
|
+
}
|
|
14343
|
+
function getResizeObserverMetadata(target) {
|
|
14344
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14345
|
+
return ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
14346
|
+
}
|
|
14347
|
+
var ResizeObserverLifeCycler = class {
|
|
14348
|
+
constructor() {
|
|
14349
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14350
|
+
}
|
|
14351
|
+
onConnected(helperHostSet) {
|
|
14352
|
+
const inst = helperHostSet.$this;
|
|
14353
|
+
const currentWin = helperHostSet.$w;
|
|
14354
|
+
const removeObserverCallbacks = [];
|
|
14355
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14356
|
+
const allMeta = getResizeObserverMetadata(inst) ?? [];
|
|
14357
|
+
if (allMeta.length === 0) return;
|
|
14358
|
+
const root = inst.shadowRoot || inst;
|
|
14359
|
+
for (const m of allMeta) {
|
|
14360
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14361
|
+
}
|
|
14362
|
+
const callback = (entries, obs) => {
|
|
14363
|
+
for (const m of allMeta) {
|
|
14364
|
+
let matchedEls;
|
|
14365
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14366
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
14367
|
+
matchedEls = entries.map((e) => e.target).filter((el) => {
|
|
14368
|
+
if (!el || el.nodeType !== 1) return false;
|
|
14369
|
+
if (isThis) return true;
|
|
14370
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
14371
|
+
});
|
|
14372
|
+
} else {
|
|
14373
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
14374
|
+
}
|
|
14375
|
+
if (matchedEls.length === 0) continue;
|
|
14376
|
+
if (m.options.filter) {
|
|
14377
|
+
if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14378
|
+
}
|
|
14379
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14380
|
+
inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });
|
|
14381
|
+
}
|
|
14382
|
+
};
|
|
14383
|
+
const resizeObserverSet = [];
|
|
14384
|
+
for (const m of allMeta) {
|
|
14385
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14386
|
+
resizeObserverSet.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, options: m.options.box ? { box: m.options.box } : void 0, callback });
|
|
14387
|
+
continue;
|
|
14388
|
+
}
|
|
14389
|
+
let targets = [];
|
|
14390
|
+
if (typeof m.selector === "function") {
|
|
14391
|
+
const res = m.selector(inst, helperHostSet);
|
|
14392
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14393
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14394
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14395
|
+
} else if (typeof m.selector === "string") {
|
|
14396
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14397
|
+
targets = [inst];
|
|
14398
|
+
} else {
|
|
14399
|
+
const r = m.options.root || "auto";
|
|
14400
|
+
const scopes = [];
|
|
14401
|
+
if (r === "auto") scopes.push(inst.shadowRoot || inst);
|
|
14402
|
+
else if (r === "light") scopes.push(inst);
|
|
14403
|
+
else if (r === "shadow" && inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14404
|
+
else if (r === "all") {
|
|
14405
|
+
scopes.push(inst);
|
|
14406
|
+
if (inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14407
|
+
}
|
|
14408
|
+
for (const s of scopes) {
|
|
14409
|
+
const found = s?.querySelectorAll?.(m.selector);
|
|
14410
|
+
if (found?.length) targets.push(...Array.from(found));
|
|
14411
|
+
}
|
|
14412
|
+
}
|
|
14413
|
+
}
|
|
14414
|
+
for (const el of targets) resizeObserverSet.push({ target: el, options: m.options.box ? { box: m.options.box } : void 0, callback });
|
|
14415
|
+
}
|
|
14416
|
+
return { resizeObserverSet };
|
|
14417
|
+
}
|
|
14418
|
+
onDisconnected(helperHostSet) {
|
|
14419
|
+
const inst = helperHostSet.$this;
|
|
14420
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14421
|
+
try {
|
|
14422
|
+
cb.fn(cb.target, cb.opts);
|
|
14423
|
+
} catch (e) {
|
|
14424
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14425
|
+
}
|
|
14426
|
+
}
|
|
14427
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14428
|
+
}
|
|
14429
|
+
};
|
|
14430
|
+
|
|
14431
|
+
// src/decorators/intersectionObserver.ts
|
|
14432
|
+
var INTERSECTION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:intersection-observer");
|
|
14433
|
+
function intersectionObserver(selectorOrOptions, maybeOptions) {
|
|
14434
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14435
|
+
let selector = "$this";
|
|
14436
|
+
let options = {};
|
|
14437
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14438
|
+
selector = selectorOrOptions;
|
|
14439
|
+
options = maybeOptions ?? {};
|
|
14440
|
+
} else {
|
|
14441
|
+
selector = "$this";
|
|
14442
|
+
options = selectorOrOptions ?? {};
|
|
14443
|
+
}
|
|
14444
|
+
const constructor = targetObj.constructor;
|
|
14445
|
+
let observers = ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
14446
|
+
if (!observers) {
|
|
14447
|
+
observers = [];
|
|
14448
|
+
ReflectUtils.defineMetadata(INTERSECTION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14449
|
+
}
|
|
14450
|
+
observers.push({ propertyKey, selector, options });
|
|
14451
|
+
};
|
|
14452
|
+
}
|
|
14453
|
+
function intersectionObserverThis(options) {
|
|
14454
|
+
return intersectionObserver("$this", options);
|
|
14455
|
+
}
|
|
14456
|
+
function intersectionObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14457
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14458
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14459
|
+
}
|
|
14460
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14461
|
+
}
|
|
14462
|
+
function intersectionObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14463
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14464
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14465
|
+
}
|
|
14466
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14467
|
+
}
|
|
14468
|
+
function intersectionObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14469
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14470
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14471
|
+
}
|
|
14472
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14473
|
+
}
|
|
14474
|
+
function intersectionObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14475
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14476
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14477
|
+
}
|
|
14478
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14479
|
+
}
|
|
14480
|
+
function intersectionObserverLight(selectorOrOptions, maybeOptions) {
|
|
14481
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14482
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14483
|
+
}
|
|
14484
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14485
|
+
}
|
|
14486
|
+
function intersectionObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14487
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14488
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14489
|
+
}
|
|
14490
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14491
|
+
}
|
|
14492
|
+
function intersectionObserverAll(selectorOrOptions, maybeOptions) {
|
|
14493
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14494
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14495
|
+
}
|
|
14496
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14497
|
+
}
|
|
14498
|
+
function getIntersectionObserverMetadata(target) {
|
|
14499
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14500
|
+
return ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
14501
|
+
}
|
|
14502
|
+
var IntersectionObserverLifeCycler = class {
|
|
14503
|
+
constructor() {
|
|
14504
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14505
|
+
}
|
|
14506
|
+
onConnected(helperHostSet) {
|
|
14507
|
+
const inst = helperHostSet.$this;
|
|
14508
|
+
const currentWin = helperHostSet.$w;
|
|
14509
|
+
const removeObserverCallbacks = [];
|
|
14510
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14511
|
+
const allMeta = getIntersectionObserverMetadata(inst) ?? [];
|
|
14512
|
+
if (allMeta.length === 0) return;
|
|
14513
|
+
const root = inst.shadowRoot || inst;
|
|
14514
|
+
for (const m of allMeta) {
|
|
14515
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14516
|
+
}
|
|
14517
|
+
const buildCallback = (metas) => {
|
|
14518
|
+
return (entries, obs) => {
|
|
14519
|
+
for (const m of metas) {
|
|
14520
|
+
let matchedEls;
|
|
14521
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14522
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
14523
|
+
matchedEls = entries.map((e) => e.target).filter((el) => {
|
|
14524
|
+
if (!el || el.nodeType !== 1) return false;
|
|
14525
|
+
if (isThis) return true;
|
|
14526
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
14527
|
+
});
|
|
14528
|
+
} else {
|
|
14529
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
14530
|
+
}
|
|
14531
|
+
if (matchedEls.length === 0) continue;
|
|
14532
|
+
if (m.options.filter) {
|
|
14533
|
+
if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14534
|
+
}
|
|
14535
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14536
|
+
inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });
|
|
14537
|
+
}
|
|
14538
|
+
};
|
|
14539
|
+
};
|
|
14540
|
+
const groups = /* @__PURE__ */ new Map();
|
|
14541
|
+
for (const m of allMeta) {
|
|
14542
|
+
const obsOptions = {
|
|
14543
|
+
root: m.options.intersectionRoot ?? null,
|
|
14544
|
+
rootMargin: m.options.rootMargin,
|
|
14545
|
+
threshold: m.options.threshold
|
|
14546
|
+
};
|
|
14547
|
+
const key = JSON.stringify([obsOptions.root, obsOptions.rootMargin, obsOptions.threshold]);
|
|
14548
|
+
if (!groups.has(key)) groups.set(key, { options: obsOptions, metas: [] });
|
|
14549
|
+
groups.get(key).metas.push(m);
|
|
14550
|
+
}
|
|
14551
|
+
const intersectionObserverSet = [];
|
|
14552
|
+
for (const [, group] of groups) {
|
|
14553
|
+
const callback = buildCallback(group.metas);
|
|
14554
|
+
const observeTargets = [];
|
|
14555
|
+
for (const m of group.metas) {
|
|
14556
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14557
|
+
observeTargets.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, callback });
|
|
14558
|
+
continue;
|
|
14559
|
+
}
|
|
14560
|
+
let targets = [];
|
|
14561
|
+
if (typeof m.selector === "function") {
|
|
14562
|
+
const res = m.selector(inst, helperHostSet);
|
|
14563
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14564
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14565
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14566
|
+
} else if (typeof m.selector === "string") {
|
|
14567
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14568
|
+
targets = [inst];
|
|
14569
|
+
} else {
|
|
14570
|
+
const r = m.options.root || "auto";
|
|
14571
|
+
const scopes = [];
|
|
14572
|
+
if (r === "auto") scopes.push(inst.shadowRoot || inst);
|
|
14573
|
+
else if (r === "light") scopes.push(inst);
|
|
14574
|
+
else if (r === "shadow" && inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14575
|
+
else if (r === "all") {
|
|
14576
|
+
scopes.push(inst);
|
|
14577
|
+
if (inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14578
|
+
}
|
|
14579
|
+
for (const s of scopes) {
|
|
14580
|
+
const found = s?.querySelectorAll?.(m.selector);
|
|
14581
|
+
if (found?.length) targets.push(...Array.from(found));
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
}
|
|
14585
|
+
for (const el of targets) observeTargets.push({ target: el, callback });
|
|
14586
|
+
}
|
|
14587
|
+
intersectionObserverSet.push({ options: group.options, observeTargets });
|
|
14588
|
+
}
|
|
14589
|
+
return { intersectionObserverSet };
|
|
14590
|
+
}
|
|
14591
|
+
onDisconnected(helperHostSet) {
|
|
14592
|
+
const inst = helperHostSet.$this;
|
|
14593
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14594
|
+
try {
|
|
14595
|
+
cb.fn(cb.target, cb.opts);
|
|
14596
|
+
} catch (e) {
|
|
14597
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14598
|
+
}
|
|
14599
|
+
}
|
|
14600
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14601
|
+
}
|
|
14602
|
+
};
|
|
14603
|
+
|
|
14604
|
+
// src/decorators/lifecycles.ts
|
|
14605
|
+
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
14606
|
+
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
14607
|
+
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
14608
|
+
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
14609
|
+
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
14610
|
+
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
14611
|
+
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
14612
|
+
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
14613
|
+
var ON_CONNECTED_BODY_METADATA_KEY = Symbol.for("simple-web-component:on-connected-body");
|
|
14614
|
+
var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
|
|
14615
|
+
var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
|
|
14616
|
+
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
14617
|
+
function onConnectedBefore(arg1, arg2, arg3) {
|
|
14618
|
+
const decorator2 = (options, target, propertyKey) => {
|
|
14619
|
+
const constructor = target.constructor;
|
|
14620
|
+
let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
|
|
14621
|
+
if (!list) {
|
|
14622
|
+
list = [];
|
|
14623
|
+
ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
|
|
14624
|
+
}
|
|
14625
|
+
list.push({ propertyKey, options });
|
|
14626
|
+
};
|
|
14627
|
+
if (arg2) {
|
|
14628
|
+
return decorator2({}, arg1, arg2);
|
|
14629
|
+
}
|
|
14630
|
+
return (target, propertyKey) => {
|
|
14631
|
+
decorator2(arg1 || {}, target, propertyKey);
|
|
14632
|
+
};
|
|
14633
|
+
}
|
|
14634
|
+
function onConnectedAfter(arg1, arg2, arg3) {
|
|
14635
|
+
const decorator2 = (options, target, propertyKey) => {
|
|
14636
|
+
const constructor = target.constructor;
|
|
14637
|
+
let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
|
|
14638
|
+
if (!list) {
|
|
14639
|
+
list = [];
|
|
14640
|
+
ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
|
|
14641
|
+
}
|
|
14642
|
+
list.push({ propertyKey, options });
|
|
14643
|
+
};
|
|
14644
|
+
if (arg2) {
|
|
14645
|
+
return decorator2({}, arg1, arg2);
|
|
14646
|
+
}
|
|
14647
|
+
return (target, propertyKey) => {
|
|
14648
|
+
decorator2(arg1 || {}, target, propertyKey);
|
|
14649
|
+
};
|
|
14650
|
+
}
|
|
14651
|
+
function createLifecycleDecoratorWithOptions(metadataKey) {
|
|
14652
|
+
return function(optionOrTarget, propertyKey) {
|
|
14653
|
+
if (propertyKey) {
|
|
14654
|
+
const constructor = optionOrTarget.constructor;
|
|
14655
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
14656
|
+
if (!list) {
|
|
14657
|
+
list = [];
|
|
14658
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
14659
|
+
}
|
|
14660
|
+
list.push({ propertyKey, order: 0 });
|
|
14661
|
+
return;
|
|
14662
|
+
}
|
|
14663
|
+
return (target, propertyKey2) => {
|
|
14664
|
+
const constructor = target.constructor;
|
|
14665
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
14666
|
+
if (!list) {
|
|
14667
|
+
list = [];
|
|
14668
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
14669
|
+
}
|
|
14670
|
+
list.push({ propertyKey: propertyKey2, order: optionOrTarget?.order ?? 0 });
|
|
14671
|
+
};
|
|
14672
|
+
};
|
|
14673
|
+
}
|
|
14674
|
+
function onInitialize(optionOrTarget, propertyKey) {
|
|
14675
|
+
return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14676
|
+
}
|
|
14677
|
+
function onDisconnectedBefore(optionOrTarget, propertyKey) {
|
|
14678
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14679
|
+
}
|
|
14680
|
+
function onDisconnectedAfter(optionOrTarget, propertyKey) {
|
|
14681
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14682
|
+
}
|
|
14683
|
+
var onDisconnected = onDisconnectedAfter;
|
|
14684
|
+
function onAdoptedBefore(optionOrTarget, propertyKey) {
|
|
14685
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14686
|
+
}
|
|
14687
|
+
function onAdoptedAfter(optionOrTarget, propertyKey) {
|
|
14688
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14689
|
+
}
|
|
14690
|
+
var onAdopted = onAdoptedAfter;
|
|
14691
|
+
function onConnectedSwcApp(optionOrTarget, propertyKey) {
|
|
14692
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14693
|
+
}
|
|
14694
|
+
function onConnectedCompleted(optionOrTarget, propertyKey) {
|
|
14695
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
14696
|
+
}
|
|
14697
|
+
var decorator = (options, target, propertyKey) => {
|
|
14698
|
+
const constructor = target.constructor;
|
|
14699
|
+
let list = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor);
|
|
14700
|
+
if (!list) {
|
|
14701
|
+
list = [];
|
|
14702
|
+
ReflectUtils.defineMetadata(ON_CONNECTED_BODY_METADATA_KEY, list, constructor);
|
|
14703
|
+
}
|
|
14704
|
+
list.push({ propertyKey, options });
|
|
14705
|
+
};
|
|
14706
|
+
function onConnectedBodyShadow(optionOrTarget, propertyKey, arg3) {
|
|
14707
|
+
if (propertyKey) {
|
|
14708
|
+
return decorator({ useShadow: true }, optionOrTarget, propertyKey);
|
|
14709
|
+
}
|
|
14710
|
+
return (target, propertyKey2) => {
|
|
14711
|
+
decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
|
|
14712
|
+
};
|
|
14713
|
+
}
|
|
14714
|
+
function onConnectedBodyLight(optionOrTarget, propertyKey, arg3) {
|
|
14715
|
+
if (propertyKey) {
|
|
14716
|
+
return decorator({ useShadow: false }, optionOrTarget, propertyKey);
|
|
14717
|
+
}
|
|
14718
|
+
return (target, propertyKey2) => {
|
|
14719
|
+
decorator({ ...optionOrTarget ?? {}, useShadow: false }, target, propertyKey2);
|
|
14720
|
+
};
|
|
14721
|
+
}
|
|
14722
|
+
function onConnectedBody(optionOrTarget, propertyKey, arg3) {
|
|
14723
|
+
if (propertyKey) {
|
|
14724
|
+
return decorator({}, optionOrTarget, propertyKey);
|
|
14725
|
+
}
|
|
14726
|
+
return (target, propertyKey2) => {
|
|
14727
|
+
decorator(optionOrTarget || {}, target, propertyKey2);
|
|
14728
|
+
};
|
|
14729
|
+
}
|
|
14730
|
+
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
14731
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14732
|
+
const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) ?? [];
|
|
14733
|
+
return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
14734
|
+
};
|
|
14735
|
+
var findAllOnConnectedMetadata = (target) => {
|
|
14736
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14737
|
+
const results = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor) ?? [];
|
|
14738
|
+
return [...results].sort((a, b) => {
|
|
14739
|
+
const orderA = a.options?.order ?? 0;
|
|
14740
|
+
const orderB = b.options?.order ?? 0;
|
|
14741
|
+
return orderA - orderB;
|
|
14742
|
+
});
|
|
14743
|
+
};
|
|
14744
|
+
var findAllOnConnectedBeforeMetadata = (target) => {
|
|
14745
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14746
|
+
const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
14747
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
14748
|
+
};
|
|
14749
|
+
var findAllOnConnectedAfterMetadata = (target) => {
|
|
14750
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14751
|
+
const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
14752
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
14753
|
+
};
|
|
14754
|
+
|
|
14755
|
+
// src/decorators/emitCustomEvent.ts
|
|
14756
|
+
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
|
|
14757
|
+
function emitCustomEvent(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor) {
|
|
14758
|
+
if (typeof selectorOrTarget === "object" && typeof typeOrPropertyKey === "string" && typeof optionsOrDescriptor === "object" && "value" in optionsOrDescriptor) {
|
|
13651
14759
|
throw new Error(`@emitCustomEvent decorator cannot be used on properties. (Property: ${String(typeOrPropertyKey)})`);
|
|
13652
14760
|
}
|
|
13653
14761
|
if ((typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") && typeof typeOrPropertyKey === "string") {
|
|
@@ -13771,6 +14879,53 @@ var getEmitCustomEventMetadataList = (target) => {
|
|
|
13771
14879
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
13772
14880
|
};
|
|
13773
14881
|
var emit = emitCustomEvent;
|
|
14882
|
+
function emitThis(type, options) {
|
|
14883
|
+
return emitCustomEvent("$this", type, options);
|
|
14884
|
+
}
|
|
14885
|
+
function emitAppHost(type, options) {
|
|
14886
|
+
return emitCustomEvent("$appHost", type, options);
|
|
14887
|
+
}
|
|
14888
|
+
function emitWindow(type, options) {
|
|
14889
|
+
return emitCustomEvent("$window", type, options);
|
|
14890
|
+
}
|
|
14891
|
+
function emitDocument(type, options) {
|
|
14892
|
+
return emitCustomEvent("$document", type, options);
|
|
14893
|
+
}
|
|
14894
|
+
function emitLight(selector, type, options) {
|
|
14895
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "light" });
|
|
14896
|
+
}
|
|
14897
|
+
function emitShadow(selector, type, options) {
|
|
14898
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "shadow" });
|
|
14899
|
+
}
|
|
14900
|
+
function emitAll(selector, type, options) {
|
|
14901
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "all" });
|
|
14902
|
+
}
|
|
14903
|
+
var EmitCustomEventLifeCycler = class {
|
|
14904
|
+
constructor() {
|
|
14905
|
+
this.hostEmitMeta = null;
|
|
14906
|
+
}
|
|
14907
|
+
getHostEmitMeta(inst) {
|
|
14908
|
+
if (!this.hostEmitMeta) {
|
|
14909
|
+
const all = getEmitCustomEventMetadataList(inst) ?? [];
|
|
14910
|
+
this.hostEmitMeta = all.filter((m) => m.selector === "$this" || m.selector === "");
|
|
14911
|
+
}
|
|
14912
|
+
return this.hostEmitMeta;
|
|
14913
|
+
}
|
|
14914
|
+
/** observedAttributes 에 포함할 attributeName 목록 */
|
|
14915
|
+
getObservedAttributeNames(inst) {
|
|
14916
|
+
return this.getHostEmitMeta(inst).map((m) => m.options.attributeName).filter(Boolean);
|
|
14917
|
+
}
|
|
14918
|
+
onConnected(_helperHostSet) {
|
|
14919
|
+
}
|
|
14920
|
+
/** attributeChangedCallback 에서 elementDefine 이 직접 호출 */
|
|
14921
|
+
onAttributeChanged(helperHostSet, name, _old, newVal) {
|
|
14922
|
+
const inst = helperHostSet.$this;
|
|
14923
|
+
const matched = this.getHostEmitMeta(inst).find((m) => m.options.attributeName === name);
|
|
14924
|
+
if (matched && newVal !== null) {
|
|
14925
|
+
inst._bindAttributeEvent?.(inst, name, newVal, matched.type);
|
|
14926
|
+
}
|
|
14927
|
+
}
|
|
14928
|
+
};
|
|
13774
14929
|
|
|
13775
14930
|
// src/decorators/changedAttribute.ts
|
|
13776
14931
|
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
|
|
@@ -13817,9 +14972,115 @@ var findAllAttributeChangedMetadata = (target) => {
|
|
|
13817
14972
|
var convertAttributeValue = (val, type) => {
|
|
13818
14973
|
return convertValue(val, type);
|
|
13819
14974
|
};
|
|
14975
|
+
var ChangedAttributeLifeCycler = class {
|
|
14976
|
+
constructor() {
|
|
14977
|
+
__publicField(this, "attrChangeMap", null);
|
|
14978
|
+
}
|
|
14979
|
+
/** 클래스 메타데이터 기반 attrChangeMap 을 lazy 로드한다 (공유 시클러 캐시). */
|
|
14980
|
+
getAttrChangeMap(inst) {
|
|
14981
|
+
if (!this.attrChangeMap) this.attrChangeMap = findAllAttributeChangedMetadata(inst);
|
|
14982
|
+
return this.attrChangeMap;
|
|
14983
|
+
}
|
|
14984
|
+
/** observedAttributes 에 포함할 attribute 이름 목록 */
|
|
14985
|
+
getObservedAttributeNames(inst) {
|
|
14986
|
+
return Array.from(this.getAttrChangeMap(inst).keys());
|
|
14987
|
+
}
|
|
14988
|
+
onConnected(helperHostSet) {
|
|
14989
|
+
const inst = helperHostSet.$this;
|
|
14990
|
+
for (const [name, metaList] of this.getAttrChangeMap(inst)) {
|
|
14991
|
+
for (const meta of metaList) {
|
|
14992
|
+
if (meta.options.while === "connected") {
|
|
14993
|
+
const val = getAttributeValue(inst, name, { type: meta.options.type });
|
|
14994
|
+
if (val !== null) inst[meta.propertyKey](val, null, name, helperHostSet);
|
|
14995
|
+
}
|
|
14996
|
+
}
|
|
14997
|
+
}
|
|
14998
|
+
}
|
|
14999
|
+
/** attributeChangedCallback 에서 elementDefine 이 직접 호출 */
|
|
15000
|
+
onAttributeChanged(helperHostSet, name, old, newVal) {
|
|
15001
|
+
const inst = helperHostSet.$this;
|
|
15002
|
+
const metaList = this.getAttrChangeMap(inst).get(name);
|
|
15003
|
+
if (!metaList) return;
|
|
15004
|
+
for (const meta of metaList) {
|
|
15005
|
+
if (meta.options.while === "connected" && !inst.__swc_connected) continue;
|
|
15006
|
+
inst[meta.propertyKey](convertAttributeValue(newVal, meta.options.type), old, name, helperHostSet);
|
|
15007
|
+
}
|
|
15008
|
+
}
|
|
15009
|
+
};
|
|
13820
15010
|
|
|
13821
15011
|
// src/decorators/query.ts
|
|
13822
15012
|
var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
15013
|
+
var resolveQueryElements = (inst, selector, options, win) => {
|
|
15014
|
+
const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
|
|
15015
|
+
let all = [];
|
|
15016
|
+
if (typeof selector === "function") {
|
|
15017
|
+
const result = selector(inst, hostSet);
|
|
15018
|
+
if (result instanceof win.NodeList)
|
|
15019
|
+
all = Array.from(result).filter((e) => e instanceof win.HTMLElement);
|
|
15020
|
+
else if (Array.isArray(result))
|
|
15021
|
+
all = result.filter((e) => e instanceof win.HTMLElement);
|
|
15022
|
+
else if (result instanceof win.HTMLElement)
|
|
15023
|
+
all = [result];
|
|
15024
|
+
} else if (typeof selector === "string") {
|
|
15025
|
+
const r = options?.root || "auto";
|
|
15026
|
+
if (selector === "$this")
|
|
15027
|
+
all = [inst];
|
|
15028
|
+
else if (selector === "$host")
|
|
15029
|
+
all = hostSet.$host ? [hostSet.$host] : [];
|
|
15030
|
+
else if (selector === "$parentHost")
|
|
15031
|
+
all = hostSet.$parentHost ? [hostSet.$parentHost] : [];
|
|
15032
|
+
else if (selector === "$appHost")
|
|
15033
|
+
all = hostSet.$appHost ? [hostSet.$appHost] : [];
|
|
15034
|
+
else if (selector === "$firstHost")
|
|
15035
|
+
all = hostSet.$firstHost ? [hostSet.$firstHost] : [];
|
|
15036
|
+
else if (selector === "$lastHost")
|
|
15037
|
+
all = hostSet.$lastHost ? [hostSet.$lastHost] : [];
|
|
15038
|
+
else if (selector === "$firstAppHost")
|
|
15039
|
+
all = hostSet.$firstAppHost ? [hostSet.$firstAppHost] : [];
|
|
15040
|
+
else if (selector === "$lastAppHost")
|
|
15041
|
+
all = hostSet.$lastAppHost ? [hostSet.$lastAppHost] : [];
|
|
15042
|
+
else if (selector === "$hosts")
|
|
15043
|
+
all = hostSet.$hosts.filter(Boolean);
|
|
15044
|
+
else if (selector === "$appHosts")
|
|
15045
|
+
all = hostSet.$appHosts.filter(Boolean);
|
|
15046
|
+
else {
|
|
15047
|
+
const scopes = [];
|
|
15048
|
+
if (r === "auto")
|
|
15049
|
+
scopes.push(inst.shadowRoot || inst);
|
|
15050
|
+
else if (r === "light")
|
|
15051
|
+
scopes.push(inst);
|
|
15052
|
+
else if (r === "shadow" && inst.shadowRoot)
|
|
15053
|
+
scopes.push(inst.shadowRoot);
|
|
15054
|
+
else if (r === "all") {
|
|
15055
|
+
scopes.push(inst);
|
|
15056
|
+
if (inst.shadowRoot)
|
|
15057
|
+
scopes.push(inst.shadowRoot);
|
|
15058
|
+
}
|
|
15059
|
+
for (const scope of scopes) {
|
|
15060
|
+
const found = scope?.querySelectorAll?.(selector);
|
|
15061
|
+
if (found?.length)
|
|
15062
|
+
all.push(...Array.from(found).filter((e) => e instanceof win.HTMLElement));
|
|
15063
|
+
}
|
|
15064
|
+
}
|
|
15065
|
+
}
|
|
15066
|
+
if (options?.filter) {
|
|
15067
|
+
all = all.filter((el) => options.filter(el, { currentThis: inst, helper: hostSet }));
|
|
15068
|
+
}
|
|
15069
|
+
return all;
|
|
15070
|
+
};
|
|
15071
|
+
var pickElements = (all, pick) => {
|
|
15072
|
+
if (pick === "all")
|
|
15073
|
+
return all;
|
|
15074
|
+
if (pick === "even")
|
|
15075
|
+
return all.filter((_, i) => i % 2 === 0);
|
|
15076
|
+
if (pick === "odd")
|
|
15077
|
+
return all.filter((_, i) => i % 2 === 1);
|
|
15078
|
+
if (typeof pick === "number")
|
|
15079
|
+
return all[pick] ?? null;
|
|
15080
|
+
if (pick === "last")
|
|
15081
|
+
return all.length ? all[all.length - 1] : null;
|
|
15082
|
+
return all.length ? all[0] : null;
|
|
15083
|
+
};
|
|
13823
15084
|
function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
13824
15085
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
13825
15086
|
throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
|
|
@@ -13841,112 +15102,26 @@ function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
|
13841
15102
|
ensureInit(this);
|
|
13842
15103
|
const config = getElementConfig(this);
|
|
13843
15104
|
const win = config?.window || window;
|
|
13844
|
-
const
|
|
13845
|
-
|
|
13846
|
-
|
|
13847
|
-
if (typeof selectorOrTarget === "
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
} else if (result instanceof win.NodeList || Array.isArray(result)) {
|
|
13852
|
-
resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? result[0] : null;
|
|
13853
|
-
}
|
|
13854
|
-
} else {
|
|
13855
|
-
resolvedSelector = selectorOrTarget;
|
|
13856
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
13857
|
-
const applyRoot = (t) => {
|
|
13858
|
-
if (!t || !(t instanceof HTMLElement))
|
|
13859
|
-
return t;
|
|
13860
|
-
if (r === "auto")
|
|
13861
|
-
return t.shadowRoot || t;
|
|
13862
|
-
if (r === "shadow")
|
|
13863
|
-
return t.shadowRoot;
|
|
13864
|
-
if (r === "light")
|
|
13865
|
-
return t;
|
|
13866
|
-
if (r === "all")
|
|
13867
|
-
return t.shadowRoot || t;
|
|
13868
|
-
return t;
|
|
13869
|
-
};
|
|
13870
|
-
if (resolvedSelector === "$this")
|
|
13871
|
-
resolvedElement = applyRoot(this);
|
|
13872
|
-
else if (resolvedSelector === "$host")
|
|
13873
|
-
resolvedElement = applyRoot(hostSet.$host);
|
|
13874
|
-
else if (resolvedSelector === "$parentHost")
|
|
13875
|
-
resolvedElement = applyRoot(hostSet.$parentHost);
|
|
13876
|
-
else if (resolvedSelector === "$appHost")
|
|
13877
|
-
resolvedElement = applyRoot(hostSet.$appHost);
|
|
13878
|
-
else if (resolvedSelector === "$firstHost")
|
|
13879
|
-
resolvedElement = applyRoot(hostSet.$firstHost);
|
|
13880
|
-
else if (resolvedSelector === "$lastHost")
|
|
13881
|
-
resolvedElement = applyRoot(hostSet.$lastHost);
|
|
13882
|
-
else if (resolvedSelector === "$firstAppHost")
|
|
13883
|
-
resolvedElement = applyRoot(hostSet.$firstAppHost);
|
|
13884
|
-
else if (resolvedSelector === "$lastAppHost")
|
|
13885
|
-
resolvedElement = applyRoot(hostSet.$lastAppHost);
|
|
13886
|
-
else if (resolvedSelector === "$window")
|
|
13887
|
-
return win;
|
|
13888
|
-
else if (resolvedSelector === "$document")
|
|
13889
|
-
return win.document;
|
|
13890
|
-
else {
|
|
13891
|
-
if (r === "shadow")
|
|
13892
|
-
resolvedElement = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
13893
|
-
else if (r === "light")
|
|
13894
|
-
resolvedElement = this.querySelector(resolvedSelector);
|
|
13895
|
-
else if (r === "all") {
|
|
13896
|
-
const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
13897
|
-
resolvedElement = shadowMatch || this.querySelector(resolvedSelector);
|
|
13898
|
-
} else
|
|
13899
|
-
resolvedElement = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
13900
|
-
}
|
|
13901
|
-
}
|
|
13902
|
-
if (resolvedElement instanceof win.HTMLElement && optionsOrPropertyKey?.filter) {
|
|
13903
|
-
const shouldInclude = optionsOrPropertyKey.filter(resolvedElement, { currentThis: this, helper: hostSet });
|
|
13904
|
-
if (!shouldInclude) {
|
|
13905
|
-
return null;
|
|
13906
|
-
}
|
|
13907
|
-
}
|
|
13908
|
-
return resolvedElement;
|
|
15105
|
+
const options = optionsOrPropertyKey || {};
|
|
15106
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$window")
|
|
15107
|
+
return win;
|
|
15108
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$document")
|
|
15109
|
+
return win.document;
|
|
15110
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
15111
|
+
return pickElements(all, options.pick ?? "first");
|
|
13909
15112
|
},
|
|
13910
15113
|
set(nv) {
|
|
13911
15114
|
ensureInit(this);
|
|
13912
|
-
if (nv === null || nv === void 0) {
|
|
15115
|
+
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
13913
15116
|
const config = getElementConfig(this);
|
|
13914
15117
|
const win = config?.window || window;
|
|
13915
|
-
const
|
|
13916
|
-
|
|
13917
|
-
|
|
13918
|
-
|
|
13919
|
-
|
|
13920
|
-
|
|
13921
|
-
|
|
13922
|
-
if (el instanceof win.Element) {
|
|
13923
|
-
el.remove();
|
|
13924
|
-
}
|
|
13925
|
-
}
|
|
13926
|
-
return;
|
|
13927
|
-
}
|
|
13928
|
-
const resolvedSelector = selectorOrTarget;
|
|
13929
|
-
if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
|
|
13930
|
-
return;
|
|
13931
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
13932
|
-
const targets = [];
|
|
13933
|
-
if (r === "shadow") {
|
|
13934
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
13935
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
13936
|
-
} else if (r === "light") {
|
|
13937
|
-
if (this.querySelector(resolvedSelector))
|
|
13938
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
13939
|
-
} else if (r === "all") {
|
|
13940
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
13941
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
13942
|
-
if (this.querySelector(resolvedSelector))
|
|
13943
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
13944
|
-
} else {
|
|
13945
|
-
const el = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
13946
|
-
if (el)
|
|
13947
|
-
targets.push(el);
|
|
13948
|
-
}
|
|
13949
|
-
targets.forEach((t) => t.remove());
|
|
15118
|
+
const options = optionsOrPropertyKey || {};
|
|
15119
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
15120
|
+
const picked = pickElements(all, options.pick ?? "first");
|
|
15121
|
+
if (Array.isArray(picked))
|
|
15122
|
+
picked.forEach((t) => t.remove());
|
|
15123
|
+
else if (picked)
|
|
15124
|
+
picked.remove();
|
|
13950
15125
|
}
|
|
13951
15126
|
},
|
|
13952
15127
|
enumerable: true,
|
|
@@ -13960,161 +15135,36 @@ var getQueryMetadata = (target) => {
|
|
|
13960
15135
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
13961
15136
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];
|
|
13962
15137
|
};
|
|
13963
|
-
|
|
13964
|
-
// src/decorators/queryAll.ts
|
|
13965
|
-
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
15138
|
+
var QUERY_ALL_METADATA_KEY = QUERY_METADATA_KEY;
|
|
13966
15139
|
function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
13967
15140
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
13968
|
-
|
|
15141
|
+
return query(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
13969
15142
|
}
|
|
13970
15143
|
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
13971
|
-
return (
|
|
13972
|
-
if (descriptor2 !== void 0) {
|
|
13973
|
-
throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
|
|
13974
|
-
}
|
|
13975
|
-
const constructor = targetObj.constructor;
|
|
13976
|
-
let queries = ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
13977
|
-
if (!queries) {
|
|
13978
|
-
queries = [];
|
|
13979
|
-
ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
|
|
13980
|
-
}
|
|
13981
|
-
queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
|
|
13982
|
-
Object.defineProperty(targetObj, propertyKey, {
|
|
13983
|
-
get() {
|
|
13984
|
-
ensureInit(this);
|
|
13985
|
-
const config = getElementConfig(this);
|
|
13986
|
-
const win = config?.window || window;
|
|
13987
|
-
const hostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
13988
|
-
let resolvedSelector;
|
|
13989
|
-
let resolvedElements = [];
|
|
13990
|
-
if (typeof selectorOrTarget === "function") {
|
|
13991
|
-
const result = selectorOrTarget(this, hostSet);
|
|
13992
|
-
if (result instanceof win.NodeList) {
|
|
13993
|
-
resolvedElements = Array.from(result).filter((el) => el instanceof win.HTMLElement);
|
|
13994
|
-
} else if (Array.isArray(result)) {
|
|
13995
|
-
resolvedElements = result.filter((el) => el instanceof win.HTMLElement);
|
|
13996
|
-
}
|
|
13997
|
-
} else {
|
|
13998
|
-
resolvedSelector = selectorOrTarget;
|
|
13999
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14000
|
-
const applyRoot = (t) => {
|
|
14001
|
-
if (!t)
|
|
14002
|
-
return [];
|
|
14003
|
-
const items = Array.isArray(t) ? t : [t];
|
|
14004
|
-
const results = [];
|
|
14005
|
-
items.forEach((it) => {
|
|
14006
|
-
if (!(it instanceof HTMLElement)) {
|
|
14007
|
-
results.push(it);
|
|
14008
|
-
return;
|
|
14009
|
-
}
|
|
14010
|
-
if (r === "auto")
|
|
14011
|
-
results.push(it.shadowRoot || it);
|
|
14012
|
-
else {
|
|
14013
|
-
if (r === "light" || r === "all")
|
|
14014
|
-
results.push(it);
|
|
14015
|
-
if ((r === "shadow" || r === "all") && it.shadowRoot)
|
|
14016
|
-
results.push(it.shadowRoot);
|
|
14017
|
-
}
|
|
14018
|
-
});
|
|
14019
|
-
return results;
|
|
14020
|
-
};
|
|
14021
|
-
if (resolvedSelector === "$hosts")
|
|
14022
|
-
resolvedElements = applyRoot(hostSet.$hosts).filter((el) => el instanceof HTMLElement);
|
|
14023
|
-
else if (resolvedSelector === "$appHosts")
|
|
14024
|
-
resolvedElements = applyRoot(hostSet.$appHosts).filter((el) => el instanceof HTMLElement);
|
|
14025
|
-
else if (resolvedSelector === "$host")
|
|
14026
|
-
resolvedElements = applyRoot(hostSet.$host).filter((el) => el instanceof HTMLElement);
|
|
14027
|
-
else if (resolvedSelector === "$parentHost")
|
|
14028
|
-
resolvedElements = applyRoot(hostSet.$parentHost).filter((el) => el instanceof HTMLElement);
|
|
14029
|
-
else if (resolvedSelector === "$appHost")
|
|
14030
|
-
resolvedElements = applyRoot(hostSet.$appHost).filter((el) => el instanceof HTMLElement);
|
|
14031
|
-
else if (resolvedSelector === "$firstHost")
|
|
14032
|
-
resolvedElements = applyRoot(hostSet.$firstHost).filter((el) => el instanceof HTMLElement);
|
|
14033
|
-
else if (resolvedSelector === "$lastHost")
|
|
14034
|
-
resolvedElements = applyRoot(hostSet.$lastHost).filter((el) => el instanceof HTMLElement);
|
|
14035
|
-
else if (resolvedSelector === "$firstAppHost")
|
|
14036
|
-
resolvedElements = applyRoot(hostSet.$firstAppHost).filter((el) => el instanceof HTMLElement);
|
|
14037
|
-
else if (resolvedSelector === "$lastAppHost")
|
|
14038
|
-
resolvedElements = applyRoot(hostSet.$lastAppHost).filter((el) => el instanceof HTMLElement);
|
|
14039
|
-
else if (resolvedSelector === "$window")
|
|
14040
|
-
return [win];
|
|
14041
|
-
else if (resolvedSelector === "$document")
|
|
14042
|
-
return [win.document];
|
|
14043
|
-
else if (resolvedSelector === "$this")
|
|
14044
|
-
resolvedElements = applyRoot(this).filter((el) => el instanceof HTMLElement);
|
|
14045
|
-
else {
|
|
14046
|
-
if (r === "shadow")
|
|
14047
|
-
resolvedElements = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14048
|
-
else if (r === "light")
|
|
14049
|
-
resolvedElements = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14050
|
-
else if (r === "all") {
|
|
14051
|
-
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14052
|
-
const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14053
|
-
resolvedElements = [...sNodes, ...lNodes];
|
|
14054
|
-
} else
|
|
14055
|
-
resolvedElements = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
|
|
14056
|
-
}
|
|
14057
|
-
}
|
|
14058
|
-
if (optionsOrPropertyKey?.filter) {
|
|
14059
|
-
resolvedElements = resolvedElements.filter((el) => {
|
|
14060
|
-
if (!(el instanceof win.HTMLElement))
|
|
14061
|
-
return true;
|
|
14062
|
-
return optionsOrPropertyKey.filter(el, { currentThis: this, helper: hostSet });
|
|
14063
|
-
});
|
|
14064
|
-
}
|
|
14065
|
-
return resolvedElements;
|
|
14066
|
-
},
|
|
14067
|
-
set(nv) {
|
|
14068
|
-
ensureInit(this);
|
|
14069
|
-
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
14070
|
-
const config = getElementConfig(this);
|
|
14071
|
-
const win = config?.window || window;
|
|
14072
|
-
const hostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
14073
|
-
if (typeof selectorOrTarget === "function") {
|
|
14074
|
-
const result = selectorOrTarget(this, hostSet);
|
|
14075
|
-
if (result instanceof win.NodeList) {
|
|
14076
|
-
Array.from(result).forEach((el) => {
|
|
14077
|
-
if (el instanceof win.Element)
|
|
14078
|
-
el.remove();
|
|
14079
|
-
});
|
|
14080
|
-
} else if (Array.isArray(result)) {
|
|
14081
|
-
result.forEach((el) => {
|
|
14082
|
-
if (el instanceof win.Element)
|
|
14083
|
-
el.remove();
|
|
14084
|
-
});
|
|
14085
|
-
}
|
|
14086
|
-
return;
|
|
14087
|
-
}
|
|
14088
|
-
const resolvedSelector = selectorOrTarget;
|
|
14089
|
-
if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
|
|
14090
|
-
return;
|
|
14091
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14092
|
-
let targets = [];
|
|
14093
|
-
if (r === "shadow")
|
|
14094
|
-
targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14095
|
-
else if (r === "light")
|
|
14096
|
-
targets = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14097
|
-
else if (r === "all") {
|
|
14098
|
-
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14099
|
-
const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14100
|
-
targets = [...sNodes, ...lNodes];
|
|
14101
|
-
} else {
|
|
14102
|
-
targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
|
|
14103
|
-
}
|
|
14104
|
-
targets.forEach((t) => t.remove());
|
|
14105
|
-
}
|
|
14106
|
-
},
|
|
14107
|
-
enumerable: true,
|
|
14108
|
-
configurable: true
|
|
14109
|
-
});
|
|
14110
|
-
};
|
|
15144
|
+
return query(selectorOrTarget, { ...optionsOrPropertyKey ?? {}, pick: "all" });
|
|
14111
15145
|
}
|
|
14112
|
-
return
|
|
15146
|
+
return query({ ...selectorOrTarget ?? {}, pick: "all" });
|
|
14113
15147
|
}
|
|
14114
|
-
var getQueryAllMetadata =
|
|
14115
|
-
|
|
14116
|
-
return
|
|
14117
|
-
}
|
|
15148
|
+
var getQueryAllMetadata = getQueryMetadata;
|
|
15149
|
+
function queryShadow(selector, options) {
|
|
15150
|
+
return query(selector, { ...options ?? {}, root: "shadow" });
|
|
15151
|
+
}
|
|
15152
|
+
function queryLight(selector, options) {
|
|
15153
|
+
return query(selector, { ...options ?? {}, root: "light" });
|
|
15154
|
+
}
|
|
15155
|
+
function queryAllRoots(selector, options) {
|
|
15156
|
+
return query(selector, { ...options ?? {}, root: "all" });
|
|
15157
|
+
}
|
|
15158
|
+
function queryAllShadow(selector, options) {
|
|
15159
|
+
return query(selector, { ...options ?? {}, root: "shadow", pick: "all" });
|
|
15160
|
+
}
|
|
15161
|
+
function queryAllLight(selector, options) {
|
|
15162
|
+
return query(selector, { ...options ?? {}, root: "light", pick: "all" });
|
|
15163
|
+
}
|
|
15164
|
+
function queryAllAll(selector, options) {
|
|
15165
|
+
return query(selector, { ...options ?? {}, root: "all", pick: "all" });
|
|
15166
|
+
}
|
|
15167
|
+
var queryIn = (root, pick) => (selector, options) => query(selector, { ...options ?? {}, root, ...pick !== void 0 ? { pick } : {} });
|
|
14118
15168
|
|
|
14119
15169
|
// src/config/config.ts
|
|
14120
15170
|
var HTML_TAG_ENTRIES = [
|
|
@@ -14176,7 +15226,7 @@ var HTML_TAG_ENTRIES = [
|
|
|
14176
15226
|
["HTMLHeadingElement", "h1"],
|
|
14177
15227
|
["HTMLBodyElement", "body"]
|
|
14178
15228
|
];
|
|
14179
|
-
var DOM_EVENT_NAMES = ["click", "dblclick", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "contextmenu", "keydown", "keypress", "keyup", "blur", "change", "focus", "focusin", "focusout", "input", "invalid", "reset", "search", "select", "submit", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop", "copy", "cut", "paste", "abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting", "scroll", "resize", "load", "
|
|
15229
|
+
var DOM_EVENT_NAMES = ["click", "dblclick", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "contextmenu", "keydown", "keypress", "keyup", "blur", "change", "focus", "focusin", "focusout", "input", "invalid", "reset", "search", "select", "submit", "drag", "dragend", "dragenter", "dragleave", "dragover", "dragstart", "drop", "copy", "cut", "paste", "abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting", "scroll", "resize", "load", "hashchange", "connected"];
|
|
14180
15230
|
var BROWSER_GLOBALS = ["window", "document", "Node", "Element", "HTMLElement", "DocumentFragment", "CustomEvent", "customElements", "NodeFilter", ...HTML_TAG_ENTRIES.map(([className]) => className)];
|
|
14181
15231
|
|
|
14182
15232
|
// ../simple-boot/dist/esm/decorators/inject/Inject.js
|
|
@@ -14444,6 +15494,12 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
14444
15494
|
return;
|
|
14445
15495
|
}
|
|
14446
15496
|
const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
|
|
15497
|
+
if (finalOptions.setType === "call") {
|
|
15498
|
+
if (typeof targetEl[targetPropertyKey] !== "function") return;
|
|
15499
|
+
if (Array.isArray(resolvedRes)) targetEl[targetPropertyKey].apply(targetEl, resolvedRes);
|
|
15500
|
+
else targetEl[targetPropertyKey].call(targetEl, resolvedRes);
|
|
15501
|
+
return;
|
|
15502
|
+
}
|
|
14447
15503
|
targetEl[targetPropertyKey] = resolvedRes;
|
|
14448
15504
|
});
|
|
14449
15505
|
return resolvedValue;
|
|
@@ -14488,7 +15544,11 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
14488
15544
|
}
|
|
14489
15545
|
return true;
|
|
14490
15546
|
});
|
|
14491
|
-
const values = filtered.map((el) =>
|
|
15547
|
+
const values = filtered.map((el) => {
|
|
15548
|
+
const raw = el[targetPropertyKey];
|
|
15549
|
+
if (finalOptions.getType === "call" && typeof raw === "function") return raw.call(el);
|
|
15550
|
+
return raw;
|
|
15551
|
+
});
|
|
14492
15552
|
return values.length === 1 ? values[0] : values;
|
|
14493
15553
|
},
|
|
14494
15554
|
set(value) {
|
|
@@ -14499,30 +15559,309 @@ function applyProperty(selector, targetPropertyKeyOrOptions, options) {
|
|
|
14499
15559
|
};
|
|
14500
15560
|
}
|
|
14501
15561
|
function property(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor) {
|
|
14502
|
-
if (optionsOrDescriptor !== void 0 && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
15562
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
14503
15563
|
return applyProperty("$this", void 0, {})(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
14504
15564
|
}
|
|
14505
15565
|
if (typeof selectorOrTarget === "string") {
|
|
14506
15566
|
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
14507
15567
|
}
|
|
15568
|
+
if (typeof selectorOrTarget === "function") {
|
|
15569
|
+
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
15570
|
+
}
|
|
14508
15571
|
return applyProperty("$this", void 0, selectorOrTarget);
|
|
14509
15572
|
}
|
|
14510
15573
|
function setProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined) {
|
|
14511
15574
|
if (typeof selectorOrOptions === "string") {
|
|
14512
15575
|
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
14513
15576
|
}
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
|
|
14525
|
-
|
|
15577
|
+
if (typeof selectorOrOptions === "function") {
|
|
15578
|
+
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
15579
|
+
}
|
|
15580
|
+
return applyProperty("$this", void 0, selectorOrOptions);
|
|
15581
|
+
}
|
|
15582
|
+
function callProperty(selectorOrTarget, targetMethodKeyOrOptions, optionsOrUndefined) {
|
|
15583
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15584
|
+
if (typeof targetMethodKeyOrOptions === "string" || typeof targetMethodKeyOrOptions === "symbol") {
|
|
15585
|
+
return applyProperty(selectorOrTarget, targetMethodKeyOrOptions, { ...optionsOrUndefined ?? {}, setType: "call" });
|
|
15586
|
+
}
|
|
15587
|
+
return applyProperty(selectorOrTarget, { ...optionsOrUndefined ?? targetMethodKeyOrOptions ?? {}, setType: "call" });
|
|
15588
|
+
}
|
|
15589
|
+
return applyProperty("$this", void 0, { ...selectorOrTarget ?? {}, setType: "call" });
|
|
15590
|
+
}
|
|
15591
|
+
function callPropertyLight(selector, targetMethodKeyOrOptions, options) {
|
|
15592
|
+
if (targetMethodKeyOrOptions != null && typeof targetMethodKeyOrOptions !== "string" && typeof targetMethodKeyOrOptions !== "symbol") {
|
|
15593
|
+
return callProperty(selector, void 0, { ...targetMethodKeyOrOptions ?? {}, root: "light" });
|
|
15594
|
+
}
|
|
15595
|
+
return callProperty(selector, targetMethodKeyOrOptions, { ...options ?? {}, root: "light" });
|
|
15596
|
+
}
|
|
15597
|
+
function callPropertyShadow(selector, targetMethodKeyOrOptions, options) {
|
|
15598
|
+
if (targetMethodKeyOrOptions != null && typeof targetMethodKeyOrOptions !== "string" && typeof targetMethodKeyOrOptions !== "symbol") {
|
|
15599
|
+
return callProperty(selector, void 0, { ...targetMethodKeyOrOptions ?? {}, root: "shadow" });
|
|
15600
|
+
}
|
|
15601
|
+
return callProperty(selector, targetMethodKeyOrOptions, { ...options ?? {}, root: "shadow" });
|
|
15602
|
+
}
|
|
15603
|
+
function callPropertyAll(selector, targetMethodKey, options) {
|
|
15604
|
+
return callProperty(selector, targetMethodKey, { ...options ?? {}, root: "all" });
|
|
15605
|
+
}
|
|
15606
|
+
var findAllPropertyMetadata = (target) => {
|
|
15607
|
+
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
15608
|
+
return ReflectUtils.findAllMetadata(PROPERTY_METADATA_KEY, actualTarget).flat();
|
|
15609
|
+
};
|
|
15610
|
+
var findAllPropertyApplyMetadata = (target) => {
|
|
15611
|
+
const result = /* @__PURE__ */ new Map();
|
|
15612
|
+
findAllPropertyMetadata(target).forEach((meta) => {
|
|
15613
|
+
result.set(meta.propertyKey, meta);
|
|
15614
|
+
});
|
|
15615
|
+
return result;
|
|
15616
|
+
};
|
|
15617
|
+
var prop = applyProperty;
|
|
15618
|
+
function propThis(targetPropertyKey, options) {
|
|
15619
|
+
return applyProperty("$this", targetPropertyKey, options);
|
|
15620
|
+
}
|
|
15621
|
+
function propAppHost(targetPropertyKey, options) {
|
|
15622
|
+
return applyProperty("$appHost", targetPropertyKey, options);
|
|
15623
|
+
}
|
|
15624
|
+
function propWindow(targetPropertyKey, options) {
|
|
15625
|
+
return applyProperty("$window", targetPropertyKey, options);
|
|
15626
|
+
}
|
|
15627
|
+
function propDocument(targetPropertyKey, options) {
|
|
15628
|
+
return applyProperty("$document", targetPropertyKey, options);
|
|
15629
|
+
}
|
|
15630
|
+
function propLight(selector, targetPropertyKey, options) {
|
|
15631
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15632
|
+
}
|
|
15633
|
+
function propShadow(selector, targetPropertyKey, options) {
|
|
15634
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15635
|
+
}
|
|
15636
|
+
function propAll(selector, targetPropertyKey, options) {
|
|
15637
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15638
|
+
}
|
|
15639
|
+
function setPropertyLight(selector, targetPropertyKey, options) {
|
|
15640
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15641
|
+
}
|
|
15642
|
+
function setPropertyShadow(selector, targetPropertyKey, options) {
|
|
15643
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15644
|
+
}
|
|
15645
|
+
function setPropertyAll(selector, targetPropertyKey, options) {
|
|
15646
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15647
|
+
}
|
|
15648
|
+
function propertyLight(selector, targetPropertyKey, options) {
|
|
15649
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15650
|
+
}
|
|
15651
|
+
function propertyShadow(selector, targetPropertyKey, options) {
|
|
15652
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15653
|
+
}
|
|
15654
|
+
function propertyAll(selector, targetPropertyKey, options) {
|
|
15655
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15656
|
+
}
|
|
15657
|
+
|
|
15658
|
+
// src/decorators/subscribeSwcAppMessageWhileConnected.ts
|
|
15659
|
+
var SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-message-while-connected");
|
|
15660
|
+
function createSubscribeSwcAppMessageWhileConnected(options, messageType) {
|
|
15661
|
+
return (target, propertyKey, descriptor) => {
|
|
15662
|
+
const filter = options?.filter;
|
|
15663
|
+
const constructor = target.constructor;
|
|
15664
|
+
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
15665
|
+
if (!list) {
|
|
15666
|
+
list = [];
|
|
15667
|
+
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
15668
|
+
}
|
|
15669
|
+
list.push({ propertyKey, messageType, filter });
|
|
15670
|
+
return descriptor;
|
|
15671
|
+
};
|
|
15672
|
+
}
|
|
15673
|
+
function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions, optionsOrPropertyKey, descriptor) {
|
|
15674
|
+
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && optionsOrPropertyKey && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol") && descriptor) {
|
|
15675
|
+
const target = targetOrMessageTypeOrOptions;
|
|
15676
|
+
const propertyKey = optionsOrPropertyKey;
|
|
15677
|
+
return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);
|
|
15678
|
+
}
|
|
15679
|
+
let messageType;
|
|
15680
|
+
let options = {};
|
|
15681
|
+
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
15682
|
+
messageType = targetOrMessageTypeOrOptions;
|
|
15683
|
+
if (optionsOrPropertyKey && typeof optionsOrPropertyKey === "object") {
|
|
15684
|
+
options = optionsOrPropertyKey;
|
|
15685
|
+
}
|
|
15686
|
+
} else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object") {
|
|
15687
|
+
options = targetOrMessageTypeOrOptions;
|
|
15688
|
+
}
|
|
15689
|
+
return createSubscribeSwcAppMessageWhileConnected(options, messageType);
|
|
15690
|
+
}
|
|
15691
|
+
var receiveMessage = subscribeSwcAppMessageWhileConnected;
|
|
15692
|
+
var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
15693
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15694
|
+
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
15695
|
+
};
|
|
15696
|
+
var MessageSubscribeLifeCycler = class {
|
|
15697
|
+
onConnected(_helperHostSet) {
|
|
15698
|
+
}
|
|
15699
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
15700
|
+
getMetadata(helperHostSet) {
|
|
15701
|
+
return getSubscribeSwcAppMessageWhileConnectedMetadata(helperHostSet.$this);
|
|
15702
|
+
}
|
|
15703
|
+
};
|
|
15704
|
+
|
|
15705
|
+
// src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
|
|
15706
|
+
var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
|
|
15707
|
+
function createSubscribeSwcAppRouteChangeWhileConnected(options) {
|
|
15708
|
+
return (target, propertyKey, descriptor) => {
|
|
15709
|
+
const pathPattern = options?.path;
|
|
15710
|
+
const filter = options?.filter;
|
|
15711
|
+
const constructor = target.constructor;
|
|
15712
|
+
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
15713
|
+
if (!list) {
|
|
15714
|
+
list = [];
|
|
15715
|
+
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
15716
|
+
}
|
|
15717
|
+
list.push({ propertyKey, options });
|
|
15718
|
+
return descriptor;
|
|
15719
|
+
};
|
|
15720
|
+
}
|
|
15721
|
+
function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOrConfig, descriptor) {
|
|
15722
|
+
if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === "string" || typeof propertyKeyOrConfig === "symbol")) {
|
|
15723
|
+
return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);
|
|
15724
|
+
}
|
|
15725
|
+
let options = {};
|
|
15726
|
+
if (Array.isArray(targetOrOptions)) {
|
|
15727
|
+
options.path = targetOrOptions;
|
|
15728
|
+
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
15729
|
+
options = { ...options, ...propertyKeyOrConfig };
|
|
15730
|
+
}
|
|
15731
|
+
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
15732
|
+
options.path = targetOrOptions;
|
|
15733
|
+
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
15734
|
+
options = { ...options, ...propertyKeyOrConfig };
|
|
15735
|
+
}
|
|
15736
|
+
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
15737
|
+
options = targetOrOptions;
|
|
15738
|
+
}
|
|
15739
|
+
return createSubscribeSwcAppRouteChangeWhileConnected(options);
|
|
15740
|
+
}
|
|
15741
|
+
var changedRoute = subscribeSwcAppRouteChangeWhileConnected;
|
|
15742
|
+
var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
15743
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15744
|
+
const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
15745
|
+
if (!results) return [];
|
|
15746
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
15747
|
+
};
|
|
15748
|
+
var RouteSubscribeLifeCycler = class {
|
|
15749
|
+
onConnected(_helperHostSet) {
|
|
15750
|
+
}
|
|
15751
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
15752
|
+
getMetadata(helperHostSet) {
|
|
15753
|
+
return getSubscribeSwcAppRouteChangeWhileConnectedMetadata(helperHostSet.$this);
|
|
15754
|
+
}
|
|
15755
|
+
};
|
|
15756
|
+
|
|
15757
|
+
// src/decorators/setInterval.ts
|
|
15758
|
+
var SET_INTERVAL_METADATA_KEY = Symbol.for("simple-web-component:set-interval");
|
|
15759
|
+
function setInterval2(interval2, options = {}) {
|
|
15760
|
+
return (target, propertyKey) => {
|
|
15761
|
+
const constructor = target.constructor;
|
|
15762
|
+
let metaList = ReflectUtils.getOwnMetadata(SET_INTERVAL_METADATA_KEY, constructor);
|
|
15763
|
+
if (!metaList) {
|
|
15764
|
+
metaList = [];
|
|
15765
|
+
ReflectUtils.defineMetadata(SET_INTERVAL_METADATA_KEY, metaList, constructor);
|
|
15766
|
+
}
|
|
15767
|
+
metaList.push({ propertyKey, interval: interval2, options });
|
|
15768
|
+
};
|
|
15769
|
+
}
|
|
15770
|
+
var findAllSetIntervalMetadata = (target) => {
|
|
15771
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15772
|
+
return (ReflectUtils.findAllMetadata(SET_INTERVAL_METADATA_KEY, constructor) || []).flat();
|
|
15773
|
+
};
|
|
15774
|
+
var SetIntervalLifeCycler = class {
|
|
15775
|
+
constructor() {
|
|
15776
|
+
__publicField(this, "activeMap", /* @__PURE__ */ new WeakMap());
|
|
15777
|
+
}
|
|
15778
|
+
onConnected(helperHostSet) {
|
|
15779
|
+
const inst = helperHostSet.$this;
|
|
15780
|
+
const ids = [];
|
|
15781
|
+
for (const meta of findAllSetIntervalMetadata(inst)) {
|
|
15782
|
+
const id = helperHostSet.$w.setInterval(() => {
|
|
15783
|
+
const args = meta.options.parameter?.(helperHostSet) ?? [];
|
|
15784
|
+
try {
|
|
15785
|
+
const res = inst[meta.propertyKey](...args);
|
|
15786
|
+
const vk = meta.options.valueKey;
|
|
15787
|
+
if (vk && res && typeof res === "object" && typeof res[vk] === "function") {
|
|
15788
|
+
res[vk](id);
|
|
15789
|
+
}
|
|
15790
|
+
} catch (e) {
|
|
15791
|
+
console.error("[SWC] setInterval tick error:", e);
|
|
15792
|
+
}
|
|
15793
|
+
}, meta.interval);
|
|
15794
|
+
meta.options.created?.(helperHostSet, id);
|
|
15795
|
+
ids.push(id);
|
|
15796
|
+
}
|
|
15797
|
+
this.activeMap.set(inst, ids);
|
|
15798
|
+
}
|
|
15799
|
+
onDisconnected(helperHostSet) {
|
|
15800
|
+
const inst = helperHostSet.$this;
|
|
15801
|
+
for (const id of this.activeMap.get(inst) ?? []) {
|
|
15802
|
+
try {
|
|
15803
|
+
helperHostSet.$w.clearInterval(id);
|
|
15804
|
+
} catch (e) {
|
|
15805
|
+
console.error("[SWC] clearInterval error:", e);
|
|
15806
|
+
}
|
|
15807
|
+
}
|
|
15808
|
+
this.activeMap.delete(inst);
|
|
15809
|
+
}
|
|
15810
|
+
};
|
|
15811
|
+
|
|
15812
|
+
// src/decorators/setTimeout.ts
|
|
15813
|
+
var SET_TIMEOUT_METADATA_KEY = Symbol.for("simple-web-component:set-timeout");
|
|
15814
|
+
function setTimeout2(delay, options = {}) {
|
|
15815
|
+
return (target, propertyKey) => {
|
|
15816
|
+
const constructor = target.constructor;
|
|
15817
|
+
let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor);
|
|
15818
|
+
if (!metaList) {
|
|
15819
|
+
metaList = [];
|
|
15820
|
+
ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);
|
|
15821
|
+
}
|
|
15822
|
+
metaList.push({ propertyKey, delay, options });
|
|
15823
|
+
};
|
|
15824
|
+
}
|
|
15825
|
+
var findAllSetTimeoutMetadata = (target) => {
|
|
15826
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15827
|
+
return (ReflectUtils.findAllMetadata(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();
|
|
15828
|
+
};
|
|
15829
|
+
var SetTimeoutLifeCycler = class {
|
|
15830
|
+
constructor() {
|
|
15831
|
+
__publicField(this, "activeMap", /* @__PURE__ */ new WeakMap());
|
|
15832
|
+
}
|
|
15833
|
+
onConnected(helperHostSet) {
|
|
15834
|
+
const inst = helperHostSet.$this;
|
|
15835
|
+
const ids = [];
|
|
15836
|
+
for (const meta of findAllSetTimeoutMetadata(inst)) {
|
|
15837
|
+
const id = helperHostSet.$w.setTimeout(() => {
|
|
15838
|
+
const args = meta.options.parameter?.(helperHostSet) ?? [];
|
|
15839
|
+
try {
|
|
15840
|
+
const res = inst[meta.propertyKey](...args);
|
|
15841
|
+
const vk = meta.options.valueKey;
|
|
15842
|
+
if (vk && res && typeof res === "object" && typeof res[vk] === "function") {
|
|
15843
|
+
res[vk](id);
|
|
15844
|
+
}
|
|
15845
|
+
} catch (e) {
|
|
15846
|
+
console.error("[SWC] setTimeout fire error:", e);
|
|
15847
|
+
}
|
|
15848
|
+
}, meta.delay);
|
|
15849
|
+
meta.options.created?.(helperHostSet, id);
|
|
15850
|
+
ids.push(id);
|
|
15851
|
+
}
|
|
15852
|
+
this.activeMap.set(inst, ids);
|
|
15853
|
+
}
|
|
15854
|
+
onDisconnected(helperHostSet) {
|
|
15855
|
+
const inst = helperHostSet.$this;
|
|
15856
|
+
for (const id of this.activeMap.get(inst) ?? []) {
|
|
15857
|
+
try {
|
|
15858
|
+
helperHostSet.$w.clearTimeout(id);
|
|
15859
|
+
} catch (e) {
|
|
15860
|
+
console.error("[SWC] clearTimeout error:", e);
|
|
15861
|
+
}
|
|
15862
|
+
}
|
|
15863
|
+
this.activeMap.delete(inst);
|
|
15864
|
+
}
|
|
14526
15865
|
};
|
|
14527
15866
|
|
|
14528
15867
|
// src/decorators/elementDefine.ts
|
|
@@ -14535,7 +15874,6 @@ var ensureInit = (inst) => {
|
|
|
14535
15874
|
if (!inst.__swc_initialized) {
|
|
14536
15875
|
inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? "s" + Math.random().toString(36).substring(2, 11).toLowerCase();
|
|
14537
15876
|
inst._emitHandlers = /* @__PURE__ */ new Map();
|
|
14538
|
-
inst._boundListeners = [];
|
|
14539
15877
|
inst.__swc_initialized = true;
|
|
14540
15878
|
const target = inst instanceof Function ? inst : inst.constructor;
|
|
14541
15879
|
const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
|
|
@@ -14583,13 +15921,13 @@ var handleGlobalSwcEvent = async (event2) => {
|
|
|
14583
15921
|
const path = event2.composedPath();
|
|
14584
15922
|
const type = event2.type;
|
|
14585
15923
|
const attrName = `swc-on-${type}`;
|
|
14586
|
-
for (const
|
|
14587
|
-
if (!(
|
|
14588
|
-
const script =
|
|
14589
|
-
if (script && !getElementConfig(
|
|
14590
|
-
const host = SwcUtils.findNearestSwcHostIncludingSelf(
|
|
15924
|
+
for (const node2 of path) {
|
|
15925
|
+
if (!(node2 instanceof HTMLElement)) continue;
|
|
15926
|
+
const script = node2.getAttribute?.(attrName);
|
|
15927
|
+
if (script && !getElementConfig(node2)) {
|
|
15928
|
+
const host = SwcUtils.findNearestSwcHostIncludingSelf(node2);
|
|
14591
15929
|
if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
|
|
14592
|
-
await host.__swc_executeAttributeEvent(
|
|
15930
|
+
await host.__swc_executeAttributeEvent(node2, attrName, script, event2);
|
|
14593
15931
|
event2.__swc_handled = true;
|
|
14594
15932
|
break;
|
|
14595
15933
|
}
|
|
@@ -14600,8 +15938,8 @@ function buildEnv(configWindow) {
|
|
|
14600
15938
|
const win = configWindow;
|
|
14601
15939
|
const doc = win?.document;
|
|
14602
15940
|
const builtInTagMap = /* @__PURE__ */ new Map();
|
|
14603
|
-
for (const [
|
|
14604
|
-
if (win?.[
|
|
15941
|
+
for (const [cls2, tag] of HTML_TAG_ENTRIES) {
|
|
15942
|
+
if (win?.[cls2]) builtInTagMap.set(win[cls2], tag);
|
|
14605
15943
|
}
|
|
14606
15944
|
const domHelpers = SwcUtils.getHelperSet(win);
|
|
14607
15945
|
return { win, doc, builtInTagMap, domHelpers };
|
|
@@ -14734,10 +16072,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
14734
16072
|
}
|
|
14735
16073
|
metadata.extends = extendsTagName;
|
|
14736
16074
|
}
|
|
14737
|
-
const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
|
|
14738
|
-
const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === "$this" || meta.selector === "");
|
|
14739
|
-
const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
|
|
14740
|
-
const attrChangeMap = findAllAttributeChangedMetadata(constructor);
|
|
14741
16075
|
const attributeList = findAllAttributeMetadata(constructor);
|
|
14742
16076
|
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
14743
16077
|
const swcLifecycleAttributes = ["swc-on-constructor", "swc-on-connected", "swc-on-disconnected", "swc-on-before-connected", "swc-on-after-connected", "swc-on-before-disconnected", "swc-on-after-disconnected", "swc-on-before-adopted", "swc-on-after-adopted", "swc-on-attribute-changed"];
|
|
@@ -14745,10 +16079,222 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
14745
16079
|
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
|
|
14746
16080
|
const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
|
|
14747
16081
|
const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
|
|
14748
|
-
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
14749
16082
|
const proto = constructor.prototype;
|
|
14750
16083
|
setupPrototype(proto, win);
|
|
14751
16084
|
let helperHostSet = null;
|
|
16085
|
+
const eventCycler = new EventListenerLifeCycler();
|
|
16086
|
+
const cyclers = [
|
|
16087
|
+
eventCycler,
|
|
16088
|
+
new ChangedAttributeLifeCycler(),
|
|
16089
|
+
new EmitCustomEventLifeCycler(),
|
|
16090
|
+
new ResizeObserverLifeCycler(),
|
|
16091
|
+
new IntersectionObserverLifeCycler(),
|
|
16092
|
+
new MutationObserverLifeCycler(),
|
|
16093
|
+
new MessageSubscribeLifeCycler(),
|
|
16094
|
+
new RouteSubscribeLifeCycler(),
|
|
16095
|
+
new SetIntervalLifeCycler(),
|
|
16096
|
+
new SetTimeoutLifeCycler()
|
|
16097
|
+
];
|
|
16098
|
+
const cyclerObservedAttributes = cyclers.flatMap((c) => c.getObservedAttributeNames?.(constructor) ?? []);
|
|
16099
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...cyclerObservedAttributes, ...attributeApplyNames, ...hostAttributes, ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
16100
|
+
const buildObservers = async (helperHostSet2) => {
|
|
16101
|
+
const inst = helperHostSet2.$this;
|
|
16102
|
+
const observers = [];
|
|
16103
|
+
let resizeObserverSet = [];
|
|
16104
|
+
let mutationObserverSet = [];
|
|
16105
|
+
let intersectionObserverSet = [];
|
|
16106
|
+
const resolveDelegateRoots = (delegateRoot) => {
|
|
16107
|
+
const r = delegateRoot || "auto";
|
|
16108
|
+
const roots = [];
|
|
16109
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
16110
|
+
else if (r === "light") roots.push(inst);
|
|
16111
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
16112
|
+
else if (r === "all") {
|
|
16113
|
+
roots.push(inst);
|
|
16114
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
16115
|
+
}
|
|
16116
|
+
return roots;
|
|
16117
|
+
};
|
|
16118
|
+
for (const c of cyclers) {
|
|
16119
|
+
const result = await c.onConnected?.(helperHostSet2, resizeObserverSet);
|
|
16120
|
+
if (!result) continue;
|
|
16121
|
+
if (result.resizeObserverSet?.length) resizeObserverSet = [...resizeObserverSet, ...result.resizeObserverSet];
|
|
16122
|
+
if (result.mutationObserverSet?.length) mutationObserverSet = [...mutationObserverSet, ...result.mutationObserverSet];
|
|
16123
|
+
if (result.intersectionObserverSet?.length) intersectionObserverSet = [...intersectionObserverSet, ...result.intersectionObserverSet];
|
|
16124
|
+
}
|
|
16125
|
+
const resizeDelegates = (resizeObserverSet ?? []).filter((t) => t.delegate && typeof t.target === "string");
|
|
16126
|
+
let resizeObserve;
|
|
16127
|
+
let resizeUnobserve;
|
|
16128
|
+
const resizeObserved = /* @__PURE__ */ new WeakSet();
|
|
16129
|
+
if (resizeObserverSet?.length) {
|
|
16130
|
+
const roCallbacks = [...new Set(resizeObserverSet.map((e) => e.callback))];
|
|
16131
|
+
const ro = new win.ResizeObserver((entries, obs) => {
|
|
16132
|
+
for (const cb of roCallbacks) cb(entries, obs);
|
|
16133
|
+
});
|
|
16134
|
+
for (const e of resizeObserverSet) {
|
|
16135
|
+
if (e.delegate) continue;
|
|
16136
|
+
if (typeof e.target === "string") {
|
|
16137
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16138
|
+
for (const sr of scope) {
|
|
16139
|
+
sr.querySelectorAll(e.target).forEach((el) => {
|
|
16140
|
+
if (!resizeObserved.has(el)) {
|
|
16141
|
+
ro.observe(el, e.options);
|
|
16142
|
+
resizeObserved.add(el);
|
|
16143
|
+
}
|
|
16144
|
+
});
|
|
16145
|
+
}
|
|
16146
|
+
continue;
|
|
16147
|
+
}
|
|
16148
|
+
ro.observe(e.target, e.options);
|
|
16149
|
+
if (e.target instanceof Element) resizeObserved.add(e.target);
|
|
16150
|
+
}
|
|
16151
|
+
resizeObserve = (el, opts) => {
|
|
16152
|
+
if (resizeObserved.has(el)) return;
|
|
16153
|
+
ro.observe(el, opts);
|
|
16154
|
+
resizeObserved.add(el);
|
|
16155
|
+
};
|
|
16156
|
+
resizeUnobserve = (el) => {
|
|
16157
|
+
if (!resizeObserved.has(el)) return;
|
|
16158
|
+
ro.unobserve(el);
|
|
16159
|
+
resizeObserved.delete(el);
|
|
16160
|
+
};
|
|
16161
|
+
observers.push(ro);
|
|
16162
|
+
}
|
|
16163
|
+
const intersectionDelegates = [];
|
|
16164
|
+
for (const group of intersectionObserverSet) {
|
|
16165
|
+
const ioCallbacks = [...new Set(group.observeTargets.map((e) => e.callback))];
|
|
16166
|
+
const io = new win.IntersectionObserver((entries, obs) => {
|
|
16167
|
+
for (const cb of ioCallbacks) cb(entries, obs);
|
|
16168
|
+
}, group.options);
|
|
16169
|
+
const ioObserved = /* @__PURE__ */ new WeakSet();
|
|
16170
|
+
for (const e of group.observeTargets) {
|
|
16171
|
+
if (e.delegate) {
|
|
16172
|
+
const target = e.target;
|
|
16173
|
+
const observe = (el) => {
|
|
16174
|
+
if (ioObserved.has(el)) return;
|
|
16175
|
+
io.observe(el);
|
|
16176
|
+
ioObserved.add(el);
|
|
16177
|
+
};
|
|
16178
|
+
const unobserve = (el) => {
|
|
16179
|
+
if (!ioObserved.has(el)) return;
|
|
16180
|
+
io.unobserve(el);
|
|
16181
|
+
ioObserved.delete(el);
|
|
16182
|
+
};
|
|
16183
|
+
intersectionDelegates.push({ target, delegateRoot: e.delegateRoot, observe, unobserve });
|
|
16184
|
+
continue;
|
|
16185
|
+
}
|
|
16186
|
+
if (typeof e.target === "string") {
|
|
16187
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16188
|
+
for (const sr of scope) {
|
|
16189
|
+
sr.querySelectorAll(e.target).forEach((el) => {
|
|
16190
|
+
if (!ioObserved.has(el)) {
|
|
16191
|
+
io.observe(el);
|
|
16192
|
+
ioObserved.add(el);
|
|
16193
|
+
}
|
|
16194
|
+
});
|
|
16195
|
+
}
|
|
16196
|
+
continue;
|
|
16197
|
+
}
|
|
16198
|
+
io.observe(e.target);
|
|
16199
|
+
if (e.target instanceof Element) ioObserved.add(e.target);
|
|
16200
|
+
}
|
|
16201
|
+
observers.push(io);
|
|
16202
|
+
}
|
|
16203
|
+
const handleResizeDelegate = (n, observe) => {
|
|
16204
|
+
if (!resizeObserve || !resizeUnobserve || n.nodeType !== 1) return;
|
|
16205
|
+
const el = n;
|
|
16206
|
+
for (const d of resizeDelegates) {
|
|
16207
|
+
const isThis = d.target === "$this" || d.target === "";
|
|
16208
|
+
const matchesSel = (node2) => {
|
|
16209
|
+
if (!node2 || node2.nodeType !== 1) return false;
|
|
16210
|
+
if (isThis) return true;
|
|
16211
|
+
return node2.matches?.(d.target) || !!node2.closest?.(d.target);
|
|
16212
|
+
};
|
|
16213
|
+
if (matchesSel(el)) {
|
|
16214
|
+
observe ? resizeObserve(el, d.options) : resizeUnobserve(el);
|
|
16215
|
+
} else if (!isThis) {
|
|
16216
|
+
el.querySelectorAll(d.target).forEach((sub) => {
|
|
16217
|
+
observe ? resizeObserve(sub, d.options) : resizeUnobserve(sub);
|
|
16218
|
+
});
|
|
16219
|
+
}
|
|
16220
|
+
}
|
|
16221
|
+
};
|
|
16222
|
+
const handleIntersectionDelegate = (n, observe) => {
|
|
16223
|
+
if (n.nodeType !== 1) return;
|
|
16224
|
+
const el = n;
|
|
16225
|
+
for (const d of intersectionDelegates) {
|
|
16226
|
+
const isThis = d.target === "$this" || d.target === "";
|
|
16227
|
+
const matchesSel = (node2) => {
|
|
16228
|
+
if (!node2 || node2.nodeType !== 1) return false;
|
|
16229
|
+
if (isThis) return true;
|
|
16230
|
+
return node2.matches?.(d.target) || !!node2.closest?.(d.target);
|
|
16231
|
+
};
|
|
16232
|
+
if (matchesSel(el)) {
|
|
16233
|
+
observe ? d.observe(el) : d.unobserve(el);
|
|
16234
|
+
} else if (!isThis) {
|
|
16235
|
+
el.querySelectorAll(d.target).forEach((sub) => {
|
|
16236
|
+
observe ? d.observe(sub) : d.unobserve(sub);
|
|
16237
|
+
});
|
|
16238
|
+
}
|
|
16239
|
+
}
|
|
16240
|
+
};
|
|
16241
|
+
if (mutationObserverSet?.length || resizeDelegates.length > 0 || intersectionDelegates.length > 0) {
|
|
16242
|
+
const callbacks = [...new Set((mutationObserverSet ?? []).map((e) => e.callback))];
|
|
16243
|
+
const mo = new win.MutationObserver((mutations, obs) => {
|
|
16244
|
+
for (const mut of mutations) {
|
|
16245
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
16246
|
+
handleResizeDelegate(n, true);
|
|
16247
|
+
handleIntersectionDelegate(n, true);
|
|
16248
|
+
});
|
|
16249
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
16250
|
+
handleResizeDelegate(n, false);
|
|
16251
|
+
handleIntersectionDelegate(n, false);
|
|
16252
|
+
});
|
|
16253
|
+
}
|
|
16254
|
+
for (const cb of callbacks) cb(mutations, obs);
|
|
16255
|
+
});
|
|
16256
|
+
const moObserveTargets = /* @__PURE__ */ new Map();
|
|
16257
|
+
const mergeMutationInit = (existing, next) => {
|
|
16258
|
+
if (!existing) return next;
|
|
16259
|
+
const mergedFilter = existing.attributeFilter || next.attributeFilter ? [.../* @__PURE__ */ new Set([...existing.attributeFilter ?? [], ...next.attributeFilter ?? []])] : void 0;
|
|
16260
|
+
return {
|
|
16261
|
+
childList: existing.childList || next.childList,
|
|
16262
|
+
attributes: existing.attributes || next.attributes,
|
|
16263
|
+
characterData: existing.characterData || next.characterData,
|
|
16264
|
+
subtree: existing.subtree || next.subtree,
|
|
16265
|
+
attributeOldValue: existing.attributeOldValue || next.attributeOldValue,
|
|
16266
|
+
characterDataOldValue: existing.characterDataOldValue || next.characterDataOldValue,
|
|
16267
|
+
attributeFilter: mergedFilter
|
|
16268
|
+
};
|
|
16269
|
+
};
|
|
16270
|
+
const addObserveTarget = (target, options) => {
|
|
16271
|
+
moObserveTargets.set(target, mergeMutationInit(moObserveTargets.get(target), options));
|
|
16272
|
+
};
|
|
16273
|
+
for (const e of mutationObserverSet ?? []) {
|
|
16274
|
+
if (e.delegate) continue;
|
|
16275
|
+
const init = e.options ?? { childList: true };
|
|
16276
|
+
if (typeof e.target === "string") {
|
|
16277
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16278
|
+
for (const sr of scope) {
|
|
16279
|
+
sr.querySelectorAll(e.target).forEach((el) => addObserveTarget(el, init));
|
|
16280
|
+
}
|
|
16281
|
+
continue;
|
|
16282
|
+
}
|
|
16283
|
+
addObserveTarget(e.target, init);
|
|
16284
|
+
}
|
|
16285
|
+
for (const d of resizeDelegates) {
|
|
16286
|
+
for (const r of resolveDelegateRoots(d.delegateRoot)) addObserveTarget(r, { childList: true, subtree: true });
|
|
16287
|
+
}
|
|
16288
|
+
for (const d of intersectionDelegates) {
|
|
16289
|
+
for (const r of resolveDelegateRoots(d.delegateRoot)) addObserveTarget(r, { childList: true, subtree: true });
|
|
16290
|
+
}
|
|
16291
|
+
for (const [target, options] of moObserveTargets) {
|
|
16292
|
+
mo.observe(target, options);
|
|
16293
|
+
}
|
|
16294
|
+
observers.push(mo);
|
|
16295
|
+
}
|
|
16296
|
+
inst.__swc_observers = observers;
|
|
16297
|
+
};
|
|
14752
16298
|
const originalConnected = proto.connectedCallback;
|
|
14753
16299
|
proto.connectedCallback = async function() {
|
|
14754
16300
|
ensureInit(this);
|
|
@@ -14764,14 +16310,12 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
14764
16310
|
}
|
|
14765
16311
|
const conf = getElementConfig(this);
|
|
14766
16312
|
const currentWin = this._resolveWindow(conf);
|
|
14767
|
-
const
|
|
14768
|
-
for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16313
|
+
for (const m of findAllOnConnectedBeforeMetadata(this)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
14769
16314
|
this._executeSwcScript("swc-on-before-connected", helperHostSet);
|
|
14770
16315
|
const targetConnectedList = useSsr ? [] : findAllOnConnectedMetadata(constructor);
|
|
14771
16316
|
const shadowMode = conf?.useShadow || targetConnectedList.find((it) => it.options.useShadow)?.options.useShadow;
|
|
14772
16317
|
if (shadowMode && !this.shadowRoot) {
|
|
14773
16318
|
const mode = shadowMode === true ? "open" : shadowMode;
|
|
14774
|
-
console.log("tagName=", this.tagName, "mode", mode, this.shadowRoot);
|
|
14775
16319
|
this.attachShadow({ mode });
|
|
14776
16320
|
}
|
|
14777
16321
|
const stateContext = { ...helperHostSet };
|
|
@@ -14780,7 +16324,6 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
14780
16324
|
});
|
|
14781
16325
|
const shadowChildren = [];
|
|
14782
16326
|
const lightChildren = [];
|
|
14783
|
-
console.log("targetConnectList", this.tagName, targetConnectedList.length);
|
|
14784
16327
|
if (targetConnectedList.length > 0) {
|
|
14785
16328
|
for (const meta of targetConnectedList) {
|
|
14786
16329
|
let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
|
|
@@ -14821,188 +16364,14 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
14821
16364
|
});
|
|
14822
16365
|
globalDelegatedRoots.add(root);
|
|
14823
16366
|
}
|
|
14824
|
-
|
|
14825
|
-
const nonDelegateListeners = [];
|
|
14826
|
-
addEventListenerList.forEach((meta) => {
|
|
14827
|
-
const isStringSelector = typeof meta.selector === "string";
|
|
14828
|
-
if (meta.options.delegate && isStringSelector && meta.selector !== "$window" && meta.selector !== "$document" && meta.selector !== "$host" && meta.selector !== "$appHost" && meta.selector !== "$firstHost" && meta.selector !== "$lastHost" && meta.selector !== "$firstAppHost" && meta.selector !== "$lastAppHost" && meta.selector !== "$hosts" && meta.selector !== "$appHosts" && meta.selector !== "$this" && meta.selector !== "") {
|
|
14829
|
-
delegateListeners.push(meta);
|
|
14830
|
-
} else {
|
|
14831
|
-
nonDelegateListeners.push(meta);
|
|
14832
|
-
}
|
|
14833
|
-
});
|
|
14834
|
-
const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
|
|
14835
|
-
delegateListeners.forEach((meta) => {
|
|
14836
|
-
const r = meta.options.root || "auto";
|
|
14837
|
-
const rootKey = `${meta.type}:${r}`;
|
|
14838
|
-
if (!delegatesByTypeAndRoot.has(rootKey)) {
|
|
14839
|
-
delegatesByTypeAndRoot.set(rootKey, []);
|
|
14840
|
-
}
|
|
14841
|
-
delegatesByTypeAndRoot.get(rootKey).push(meta);
|
|
14842
|
-
});
|
|
14843
|
-
delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
|
|
14844
|
-
const [type, rStr] = typeRootKey.split(":");
|
|
14845
|
-
const r = rStr === "auto" ? "auto" : rStr;
|
|
14846
|
-
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
14847
|
-
const bindRoots = [];
|
|
14848
|
-
if (r === "auto") bindRoots.push(this.shadowRoot || this);
|
|
14849
|
-
else if (r === "light") bindRoots.push(this);
|
|
14850
|
-
else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
14851
|
-
else if (r === "all") {
|
|
14852
|
-
bindRoots.push(this);
|
|
14853
|
-
if (this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
14854
|
-
}
|
|
14855
|
-
bindRoots.forEach((br) => {
|
|
14856
|
-
const sortedMetaList = [...metaList].sort((a, b) => {
|
|
14857
|
-
const aStop = a.options.stopPropagation ? 1 : 0;
|
|
14858
|
-
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
14859
|
-
return bStop - aStop;
|
|
14860
|
-
});
|
|
14861
|
-
const unifiedHandler = async (event2) => {
|
|
14862
|
-
for (const meta of sortedMetaList) {
|
|
14863
|
-
const { selector, options } = meta;
|
|
14864
|
-
const matchedEl = event2.target?.closest(selector);
|
|
14865
|
-
if (matchedEl && br.contains(matchedEl)) {
|
|
14866
|
-
if (options.filter) {
|
|
14867
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
14868
|
-
if (!options.filter(event2, helper)) {
|
|
14869
|
-
continue;
|
|
14870
|
-
}
|
|
14871
|
-
}
|
|
14872
|
-
if (options.stopPropagation) event2.stopPropagation();
|
|
14873
|
-
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
14874
|
-
if (options.preventDefault) event2.preventDefault();
|
|
14875
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
14876
|
-
const args = { event: event2, ...currentHostSet, $el: matchedEl, $root: br };
|
|
14877
|
-
await this[meta.propertyKey](event2, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
14878
|
-
if (event2.cancelBubble) break;
|
|
14879
|
-
}
|
|
14880
|
-
}
|
|
14881
|
-
};
|
|
14882
|
-
br.addEventListener(type, unifiedHandler, opts);
|
|
14883
|
-
this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
|
|
14884
|
-
});
|
|
14885
|
-
});
|
|
14886
|
-
nonDelegateListeners.forEach((meta) => {
|
|
14887
|
-
const { selector, type, options } = meta;
|
|
14888
|
-
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
14889
|
-
const bindTargets = [];
|
|
14890
|
-
const r = options.root || "auto";
|
|
14891
|
-
let resolvedSelector = null;
|
|
14892
|
-
if (typeof selector === "function") {
|
|
14893
|
-
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
14894
|
-
const result = selector(this, hostSet);
|
|
14895
|
-
if (typeof result === "string") {
|
|
14896
|
-
resolvedSelector = result;
|
|
14897
|
-
} else if (result instanceof currentWin.Element) {
|
|
14898
|
-
bindTargets.push(result);
|
|
14899
|
-
} else if (result instanceof currentWin.NodeList) {
|
|
14900
|
-
bindTargets.push(...Array.from(result));
|
|
14901
|
-
} else if (Array.isArray(result)) {
|
|
14902
|
-
bindTargets.push(...result);
|
|
14903
|
-
}
|
|
14904
|
-
} else {
|
|
14905
|
-
resolvedSelector = selector;
|
|
14906
|
-
}
|
|
14907
|
-
const applyRootOption = (target) => {
|
|
14908
|
-
if (!target) return;
|
|
14909
|
-
if (r === "auto") {
|
|
14910
|
-
bindTargets.push(target.shadowRoot || target);
|
|
14911
|
-
} else {
|
|
14912
|
-
if (r === "light" || r === "all") bindTargets.push(target);
|
|
14913
|
-
if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
|
|
14914
|
-
}
|
|
14915
|
-
};
|
|
14916
|
-
if (resolvedSelector) {
|
|
14917
|
-
if (resolvedSelector === "$window") bindTargets.push(currentWin);
|
|
14918
|
-
else if (resolvedSelector === "$document") bindTargets.push(currentWin.document);
|
|
14919
|
-
else if (resolvedSelector === "$host") applyRootOption(helperHostSet.$host);
|
|
14920
|
-
else if (resolvedSelector === "$parentHost") applyRootOption(helperHostSet.$parentHost);
|
|
14921
|
-
else if (resolvedSelector === "$appHost") applyRootOption(helperHostSet.$appHost);
|
|
14922
|
-
else if (resolvedSelector === "$firstHost") applyRootOption(helperHostSet.$firstHost);
|
|
14923
|
-
else if (resolvedSelector === "$lastHost") applyRootOption(helperHostSet.$lastHost);
|
|
14924
|
-
else if (resolvedSelector === "$firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
|
|
14925
|
-
else if (resolvedSelector === "$lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
|
|
14926
|
-
else if (resolvedSelector === "$hosts") helperHostSet.$hosts.forEach(applyRootOption);
|
|
14927
|
-
else if (resolvedSelector === "$appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
|
|
14928
|
-
else if (resolvedSelector === "$this" || !resolvedSelector) applyRootOption(this);
|
|
14929
|
-
else {
|
|
14930
|
-
const searchRoots = [];
|
|
14931
|
-
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
14932
|
-
else if (r === "light") searchRoots.push(this);
|
|
14933
|
-
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
14934
|
-
else if (r === "all") {
|
|
14935
|
-
searchRoots.push(this);
|
|
14936
|
-
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
14937
|
-
}
|
|
14938
|
-
searchRoots.forEach((sr) => {
|
|
14939
|
-
sr.querySelectorAll(resolvedSelector).forEach((el) => bindTargets.push(el));
|
|
14940
|
-
});
|
|
14941
|
-
}
|
|
14942
|
-
}
|
|
14943
|
-
bindTargets.forEach((t) => {
|
|
14944
|
-
const handler = async (event2) => {
|
|
14945
|
-
if (options.filter) {
|
|
14946
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
14947
|
-
if (!options.filter(event2, { currentThis: this, helper })) {
|
|
14948
|
-
return;
|
|
14949
|
-
}
|
|
14950
|
-
}
|
|
14951
|
-
if (options.stopPropagation) event2.stopPropagation();
|
|
14952
|
-
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
14953
|
-
if (options.preventDefault) event2.preventDefault();
|
|
14954
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
14955
|
-
const args = { event: event2, ...currentHostSet, $el: t, $root: t };
|
|
14956
|
-
await this[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, args);
|
|
14957
|
-
};
|
|
14958
|
-
const eventSubject = new Subject();
|
|
14959
|
-
let eventStream = eventSubject;
|
|
14960
|
-
if (options.debounceTime !== void 0 && options.debounceTime > 0) {
|
|
14961
|
-
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
14962
|
-
}
|
|
14963
|
-
if (options.throttleTime !== void 0 && options.throttleTime > 0) {
|
|
14964
|
-
eventStream = eventStream.pipe(throttleTime2(options.throttleTime));
|
|
14965
|
-
}
|
|
14966
|
-
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
14967
|
-
if (typeof options.distinctUntilChanged === "function") {
|
|
14968
|
-
eventStream = eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged));
|
|
14969
|
-
} else {
|
|
14970
|
-
eventStream = eventStream.pipe(distinctUntilChanged());
|
|
14971
|
-
}
|
|
14972
|
-
}
|
|
14973
|
-
const subscription = eventStream.subscribe({
|
|
14974
|
-
next: (event2) => {
|
|
14975
|
-
handler(event2).catch((err) => console.error("Event handler error:", err));
|
|
14976
|
-
},
|
|
14977
|
-
error: (err) => console.error("Event stream error:", err)
|
|
14978
|
-
});
|
|
14979
|
-
const wrappedHandler = (event2) => {
|
|
14980
|
-
eventSubject.next(event2);
|
|
14981
|
-
};
|
|
14982
|
-
t.addEventListener(type, wrappedHandler, opts);
|
|
14983
|
-
this._boundListeners.push({ target: t, type, handler: wrappedHandler, options: opts, subscription });
|
|
14984
|
-
});
|
|
14985
|
-
});
|
|
16367
|
+
await buildObservers(SwcUtils.getHelperAndHostSet(win, this));
|
|
14986
16368
|
if (originalConnected) await originalConnected.apply(this);
|
|
14987
|
-
const
|
|
14988
|
-
for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16369
|
+
for (const m of findAllOnConnectedAfterMetadata(this)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
14989
16370
|
this._executeSwcScript("swc-on-connected", helperHostSet);
|
|
14990
16371
|
this._executeSwcScript("swc-on-after-connected", helperHostSet);
|
|
14991
16372
|
this.__swc_connected = true;
|
|
14992
|
-
for (let [name2, metaList] of Array.from(attrChangeMap)) {
|
|
14993
|
-
for (const meta of metaList) {
|
|
14994
|
-
if (meta.options.while === "connected") {
|
|
14995
|
-
const val = getAttributeValue(this, name2, { type: meta.options.type });
|
|
14996
|
-
if (val !== null) {
|
|
14997
|
-
await this[meta.propertyKey](val, null, name2, helperHostSet);
|
|
14998
|
-
}
|
|
14999
|
-
}
|
|
15000
|
-
}
|
|
15001
|
-
}
|
|
15002
16373
|
} finally {
|
|
15003
|
-
for (
|
|
15004
|
-
await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15005
|
-
}
|
|
16374
|
+
for (const m of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15006
16375
|
if (appHost && typeof appHost._connectedDone === "function") {
|
|
15007
16376
|
await appHost._connectedDone(this);
|
|
15008
16377
|
}
|
|
@@ -15010,26 +16379,24 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
15010
16379
|
};
|
|
15011
16380
|
const originalDisconnected = proto.disconnectedCallback;
|
|
15012
16381
|
proto.disconnectedCallback = function() {
|
|
15013
|
-
const appHost = helperHostSet
|
|
16382
|
+
const appHost = helperHostSet?.$appHost;
|
|
15014
16383
|
if (appHost && typeof appHost._disconnected === "function") {
|
|
15015
16384
|
appHost._disconnected(this);
|
|
15016
16385
|
}
|
|
15017
16386
|
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
15018
|
-
const
|
|
15019
|
-
for (const
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
});
|
|
15027
|
-
this._boundListeners = [];
|
|
16387
|
+
for (const m of findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16388
|
+
for (const c of cyclers) c.onDisconnected?.(helperHostSet);
|
|
16389
|
+
for (const o of this.__swc_observers ?? []) {
|
|
16390
|
+
try {
|
|
16391
|
+
o?.disconnect?.();
|
|
16392
|
+
} catch (e) {
|
|
16393
|
+
console.error("[SWC] observer disconnect error:", e);
|
|
16394
|
+
}
|
|
15028
16395
|
}
|
|
16396
|
+
this.__swc_observers = [];
|
|
15029
16397
|
new ElementApply(this, { id: this._swcId }).removeAllEventListener();
|
|
15030
16398
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
15031
|
-
const
|
|
15032
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16399
|
+
for (const m of findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15033
16400
|
this._executeSwcScript("swc-on-disconnected", helperHostSet);
|
|
15034
16401
|
this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
|
|
15035
16402
|
this.__swc_connected = false;
|
|
@@ -15038,35 +16405,34 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
15038
16405
|
proto.adoptedCallback = function() {
|
|
15039
16406
|
const hostSet = SwcUtils.getHostSet(this);
|
|
15040
16407
|
this._executeSwcScript("swc-on-before-adopted", hostSet);
|
|
15041
|
-
const
|
|
15042
|
-
for (const
|
|
16408
|
+
for (const m of findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
16409
|
+
for (const c of cyclers) c.onAdopted?.(helperHostSet);
|
|
15043
16410
|
if (originalAdopted) originalAdopted.apply(this);
|
|
15044
|
-
const
|
|
15045
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
16411
|
+
for (const m of findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
15046
16412
|
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
15047
16413
|
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
15048
16414
|
};
|
|
15049
16415
|
const originalAttributeChanged = proto.attributeChangedCallback;
|
|
15050
16416
|
proto.attributeChangedCallback = function(name2, old, newVal) {
|
|
15051
16417
|
if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
|
|
15052
|
-
const
|
|
16418
|
+
const helperAndHostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
15053
16419
|
let processedVal = newVal;
|
|
15054
16420
|
if (newVal !== null) {
|
|
15055
16421
|
const ae = new ActionExpression(newVal);
|
|
15056
16422
|
const expr = ae.getFirstExpression("callReturn");
|
|
15057
16423
|
if (expr) {
|
|
15058
16424
|
const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
|
|
15059
|
-
const
|
|
16425
|
+
const exprHelperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
|
|
15060
16426
|
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
15061
16427
|
try {
|
|
15062
16428
|
const result = FunctionUtils.executeReturn({
|
|
15063
16429
|
script,
|
|
15064
16430
|
context: this,
|
|
15065
|
-
args:
|
|
16431
|
+
args: exprHelperAndHostSet
|
|
15066
16432
|
});
|
|
15067
16433
|
processedVal = result;
|
|
15068
16434
|
} catch (e) {
|
|
15069
|
-
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}: ${
|
|
16435
|
+
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}: ${exprHelperAndHostSet}`, e);
|
|
15070
16436
|
processedVal = newVal;
|
|
15071
16437
|
}
|
|
15072
16438
|
}
|
|
@@ -15077,20 +16443,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
15077
16443
|
this._bindAttributeEvent(this, name2, newVal, eventName);
|
|
15078
16444
|
}
|
|
15079
16445
|
}
|
|
15080
|
-
const
|
|
15081
|
-
if (hostCustomEventMeta && newVal !== null) {
|
|
15082
|
-
this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
|
|
15083
|
-
}
|
|
15084
|
-
const metaList = attrChangeMap.get(name2);
|
|
15085
|
-
if (metaList && Array.isArray(metaList)) {
|
|
15086
|
-
for (const meta of metaList) {
|
|
15087
|
-
if (meta.options.while === "connected" && !this.__swc_connected) {
|
|
15088
|
-
continue;
|
|
15089
|
-
}
|
|
15090
|
-
const convertedVal = convertAttributeValue(processedVal, meta.options.type);
|
|
15091
|
-
this[meta.propertyKey](convertedVal, old, name2, hSet);
|
|
15092
|
-
}
|
|
15093
|
-
}
|
|
16446
|
+
for (const c of cyclers) c.onAttributeChanged?.(helperAndHostSet, name2, old, processedVal);
|
|
15094
16447
|
};
|
|
15095
16448
|
Object.defineProperty(constructor, "observedAttributes", {
|
|
15096
16449
|
get: () => mergedObservedAttributes,
|
|
@@ -15320,6 +16673,9 @@ function attribute(selectorOrAttributeOrTarget, attributeNameOrOptions, optionsO
|
|
|
15320
16673
|
return applyAttribute("$this", void 0, selectorOrAttributeOrTarget);
|
|
15321
16674
|
}
|
|
15322
16675
|
function setAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined) {
|
|
16676
|
+
if (typeof selectorOrAttributeOrOptions === "function") {
|
|
16677
|
+
return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined);
|
|
16678
|
+
}
|
|
15323
16679
|
if (typeof selectorOrAttributeOrOptions === "string") {
|
|
15324
16680
|
const isSelector = isCssSelector(selectorOrAttributeOrOptions);
|
|
15325
16681
|
if (isSelector) {
|
|
@@ -15342,6 +16698,22 @@ var findAllAttributeApplyMetadata = (target) => {
|
|
|
15342
16698
|
});
|
|
15343
16699
|
return result;
|
|
15344
16700
|
};
|
|
16701
|
+
var attr = applyAttribute;
|
|
16702
|
+
function attrThis(targetAttributeName, options) {
|
|
16703
|
+
return applyAttribute("$this", targetAttributeName, options);
|
|
16704
|
+
}
|
|
16705
|
+
function attrAppHost(targetAttributeName, options) {
|
|
16706
|
+
return applyAttribute("$appHost", targetAttributeName, options);
|
|
16707
|
+
}
|
|
16708
|
+
function attrLight(selector, targetAttributeName, options) {
|
|
16709
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "light" });
|
|
16710
|
+
}
|
|
16711
|
+
function attrShadow(selector, targetAttributeName, options) {
|
|
16712
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "shadow" });
|
|
16713
|
+
}
|
|
16714
|
+
function attrAll(selector, targetAttributeName, options) {
|
|
16715
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "all" });
|
|
16716
|
+
}
|
|
15345
16717
|
|
|
15346
16718
|
// src/decorators/applyNode.ts
|
|
15347
16719
|
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
@@ -15632,6 +17004,23 @@ function clearChildrenLight(selectorOrOptions, maybeOptions, descriptor) {
|
|
|
15632
17004
|
}
|
|
15633
17005
|
return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
|
|
15634
17006
|
}
|
|
17007
|
+
var apply = applyNode;
|
|
17008
|
+
var node = applyNode;
|
|
17009
|
+
function applyThis(options) {
|
|
17010
|
+
return applyNode("$this", options);
|
|
17011
|
+
}
|
|
17012
|
+
function applyAppHost(options) {
|
|
17013
|
+
return applyNode("$appHost", options);
|
|
17014
|
+
}
|
|
17015
|
+
function applyLight(selector, options) {
|
|
17016
|
+
return applyNode(selector, { ...options ?? {}, root: "light" });
|
|
17017
|
+
}
|
|
17018
|
+
function applyShadow(selector, options) {
|
|
17019
|
+
return applyNode(selector, { ...options ?? {}, root: "shadow" });
|
|
17020
|
+
}
|
|
17021
|
+
function applyAll(selector, options) {
|
|
17022
|
+
return applyNode(selector, { ...options ?? {}, root: "all" });
|
|
17023
|
+
}
|
|
15635
17024
|
var findAllApplyNodeMetadata = (target) => {
|
|
15636
17025
|
const result = /* @__PURE__ */ new Map();
|
|
15637
17026
|
const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
|
|
@@ -15642,6 +17031,44 @@ var findAllApplyNodeMetadata = (target) => {
|
|
|
15642
17031
|
});
|
|
15643
17032
|
return result;
|
|
15644
17033
|
};
|
|
17034
|
+
var filterScopeOf = (target) => {
|
|
17035
|
+
if (target && typeof target.querySelector === "function") {
|
|
17036
|
+
return target;
|
|
17037
|
+
}
|
|
17038
|
+
const host = target?.host;
|
|
17039
|
+
return host && typeof host.querySelector === "function" ? host : null;
|
|
17040
|
+
};
|
|
17041
|
+
var tagNameOf = (node2) => {
|
|
17042
|
+
const tag = node2?.tagName;
|
|
17043
|
+
return typeof tag === "string" ? tag.toLowerCase() : null;
|
|
17044
|
+
};
|
|
17045
|
+
var skipIfSameTagPresent = (target, newValue) => {
|
|
17046
|
+
const nodes = (Array.isArray(newValue) ? newValue : [newValue]).filter((n) => tagNameOf(n) !== null);
|
|
17047
|
+
if (nodes.length === 0) return true;
|
|
17048
|
+
const scope = filterScopeOf(target);
|
|
17049
|
+
if (!scope) return true;
|
|
17050
|
+
return !nodes.some((n) => scope.querySelector(tagNameOf(n)));
|
|
17051
|
+
};
|
|
17052
|
+
var skipIfExists = (selector) => (target) => {
|
|
17053
|
+
const scope = filterScopeOf(target);
|
|
17054
|
+
if (!scope) return true;
|
|
17055
|
+
return !scope.querySelector(selector);
|
|
17056
|
+
};
|
|
17057
|
+
var skipIfEmpty = (_target, newValue) => {
|
|
17058
|
+
if (newValue === null || newValue === void 0 || newValue === false) return false;
|
|
17059
|
+
if (typeof newValue === "string") return newValue.trim().length > 0;
|
|
17060
|
+
if (Array.isArray(newValue)) return newValue.length > 0;
|
|
17061
|
+
return true;
|
|
17062
|
+
};
|
|
17063
|
+
var applyIfChanged = (target, newValue) => {
|
|
17064
|
+
const textOf = (v) => {
|
|
17065
|
+
if (typeof v === "string") return v;
|
|
17066
|
+
if (Array.isArray(v)) return v.map(textOf).join("");
|
|
17067
|
+
return typeof v?.textContent === "string" ? v.textContent : "";
|
|
17068
|
+
};
|
|
17069
|
+
const current = typeof target?.textContent === "string" ? target.textContent : "";
|
|
17070
|
+
return current !== textOf(newValue);
|
|
17071
|
+
};
|
|
15645
17072
|
|
|
15646
17073
|
// src/decorators/applyClass.ts
|
|
15647
17074
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -15661,6 +17088,9 @@ var resolveSelector2 = (selector, inst, win) => {
|
|
|
15661
17088
|
if (result === null) {
|
|
15662
17089
|
return [];
|
|
15663
17090
|
}
|
|
17091
|
+
if (result instanceof win.Node) {
|
|
17092
|
+
return [];
|
|
17093
|
+
}
|
|
15664
17094
|
return result;
|
|
15665
17095
|
}
|
|
15666
17096
|
return selector;
|
|
@@ -15742,7 +17172,7 @@ function createClassDecorator(action) {
|
|
|
15742
17172
|
if (classMap && typeof classMap === "string") {
|
|
15743
17173
|
classes = resolvedRes ? classMap : "";
|
|
15744
17174
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15745
|
-
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([
|
|
17175
|
+
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls2]) => cls2).join(" ");
|
|
15746
17176
|
} else {
|
|
15747
17177
|
classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
|
|
15748
17178
|
}
|
|
@@ -15751,9 +17181,9 @@ function createClassDecorator(action) {
|
|
|
15751
17181
|
if (classMap && typeof classMap === "string") {
|
|
15752
17182
|
targetEl.classList.toggle(classMap, !!resolvedRes);
|
|
15753
17183
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15754
|
-
Object.entries(resolvedRes).forEach(([
|
|
17184
|
+
Object.entries(resolvedRes).forEach(([cls2, force]) => {
|
|
15755
17185
|
const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
15756
|
-
targetEl.classList.toggle(
|
|
17186
|
+
targetEl.classList.toggle(cls2, isActive);
|
|
15757
17187
|
});
|
|
15758
17188
|
} else {
|
|
15759
17189
|
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
@@ -15765,11 +17195,11 @@ function createClassDecorator(action) {
|
|
|
15765
17195
|
if (action === "add") targetEl.classList.add(classMap);
|
|
15766
17196
|
else targetEl.classList.remove(classMap);
|
|
15767
17197
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15768
|
-
Object.entries(resolvedRes).forEach(([
|
|
17198
|
+
Object.entries(resolvedRes).forEach(([cls2, force]) => {
|
|
15769
17199
|
const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
15770
17200
|
if (shouldExecute) {
|
|
15771
|
-
if (action === "add") targetEl.classList.add(
|
|
15772
|
-
else targetEl.classList.remove(
|
|
17201
|
+
if (action === "add") targetEl.classList.add(cls2);
|
|
17202
|
+
else targetEl.classList.remove(cls2);
|
|
15773
17203
|
}
|
|
15774
17204
|
});
|
|
15775
17205
|
} else {
|
|
@@ -15793,10 +17223,10 @@ function createClassDecorator(action) {
|
|
|
15793
17223
|
};
|
|
15794
17224
|
}
|
|
15795
17225
|
function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
15796
|
-
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
17226
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
15797
17227
|
return createClassDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
15798
17228
|
}
|
|
15799
|
-
if (typeof selectorOrTarget === "string") {
|
|
17229
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15800
17230
|
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
15801
17231
|
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
15802
17232
|
return createClassDecorator(action2)(selectorOrTarget, options2);
|
|
@@ -15806,50 +17236,72 @@ function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor)
|
|
|
15806
17236
|
return createClassDecorator(action)("$this", options);
|
|
15807
17237
|
}
|
|
15808
17238
|
function setClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
15809
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17239
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
15810
17240
|
return createClassDecorator("set")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15811
17241
|
}
|
|
15812
|
-
if (typeof selectorOrTarget === "string") {
|
|
17242
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15813
17243
|
return createClassDecorator("set")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15814
17244
|
}
|
|
15815
17245
|
return createClassDecorator("set")("$this", selectorOrTarget);
|
|
15816
17246
|
}
|
|
15817
17247
|
function updateClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
15818
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17248
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
15819
17249
|
return createClassDecorator("update")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15820
17250
|
}
|
|
15821
|
-
if (typeof selectorOrTarget === "string") {
|
|
17251
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15822
17252
|
return createClassDecorator("update")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15823
17253
|
}
|
|
15824
17254
|
return createClassDecorator("update")("$this", selectorOrTarget);
|
|
15825
17255
|
}
|
|
15826
17256
|
function addClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
15827
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17257
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
15828
17258
|
return createClassDecorator("add")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15829
17259
|
}
|
|
15830
|
-
if (typeof selectorOrTarget === "string") {
|
|
17260
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15831
17261
|
return createClassDecorator("add")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15832
17262
|
}
|
|
15833
17263
|
return createClassDecorator("add")("$this", selectorOrTarget);
|
|
15834
17264
|
}
|
|
15835
17265
|
function removeClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
15836
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17266
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
15837
17267
|
return createClassDecorator("remove")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15838
17268
|
}
|
|
15839
|
-
if (typeof selectorOrTarget === "string") {
|
|
17269
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15840
17270
|
return createClassDecorator("remove")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15841
17271
|
}
|
|
15842
17272
|
return createClassDecorator("remove")("$this", selectorOrTarget);
|
|
15843
17273
|
}
|
|
15844
17274
|
function toggleClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
15845
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17275
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
15846
17276
|
return createClassDecorator("toggle")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15847
17277
|
}
|
|
15848
|
-
if (typeof selectorOrTarget === "string") {
|
|
17278
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15849
17279
|
return createClassDecorator("toggle")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
15850
17280
|
}
|
|
15851
17281
|
return createClassDecorator("toggle")("$this", selectorOrTarget);
|
|
15852
17282
|
}
|
|
17283
|
+
var cls = applyClass;
|
|
17284
|
+
function clsThis(action, options) {
|
|
17285
|
+
return applyClass("$this", action, options);
|
|
17286
|
+
}
|
|
17287
|
+
function clsAppHost(action, options) {
|
|
17288
|
+
return applyClass("$appHost", action, options);
|
|
17289
|
+
}
|
|
17290
|
+
function clsLight(selector, actionOrOptions, options) {
|
|
17291
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17292
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17293
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "light" });
|
|
17294
|
+
}
|
|
17295
|
+
function clsShadow(selector, actionOrOptions, options) {
|
|
17296
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17297
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17298
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "shadow" });
|
|
17299
|
+
}
|
|
17300
|
+
function clsAll(selector, actionOrOptions, options) {
|
|
17301
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17302
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17303
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "all" });
|
|
17304
|
+
}
|
|
15853
17305
|
var findAllClassMetadata = (target) => {
|
|
15854
17306
|
const result = /* @__PURE__ */ new Map();
|
|
15855
17307
|
const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
|
|
@@ -15879,6 +17331,9 @@ var resolveSelector3 = (selector, inst, win) => {
|
|
|
15879
17331
|
if (result === null) {
|
|
15880
17332
|
return [];
|
|
15881
17333
|
}
|
|
17334
|
+
if (result instanceof win.Node) {
|
|
17335
|
+
return [];
|
|
17336
|
+
}
|
|
15882
17337
|
return result;
|
|
15883
17338
|
}
|
|
15884
17339
|
return selector;
|
|
@@ -15951,12 +17406,12 @@ function createStyleDecorator(action) {
|
|
|
15951
17406
|
if (action === "set" || action === "update") {
|
|
15952
17407
|
if (action === "set") targetEl.style.cssText = "";
|
|
15953
17408
|
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15954
|
-
Object.entries(resolvedRes).forEach(([
|
|
17409
|
+
Object.entries(resolvedRes).forEach(([prop2, val]) => {
|
|
15955
17410
|
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
15956
17411
|
if (finalVal === null || finalVal === void 0) {
|
|
15957
|
-
targetEl.style.removeProperty(
|
|
17412
|
+
targetEl.style.removeProperty(prop2);
|
|
15958
17413
|
} else {
|
|
15959
|
-
targetEl.style[
|
|
17414
|
+
targetEl.style[prop2] = String(finalVal);
|
|
15960
17415
|
}
|
|
15961
17416
|
});
|
|
15962
17417
|
} else if (typeof resolvedRes === "string") {
|
|
@@ -15964,10 +17419,10 @@ function createStyleDecorator(action) {
|
|
|
15964
17419
|
}
|
|
15965
17420
|
} else if (action === "remove") {
|
|
15966
17421
|
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15967
|
-
Object.entries(resolvedRes).forEach(([
|
|
17422
|
+
Object.entries(resolvedRes).forEach(([prop2, val]) => {
|
|
15968
17423
|
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
15969
17424
|
if (shouldRemove) {
|
|
15970
|
-
targetEl.style.removeProperty(
|
|
17425
|
+
targetEl.style.removeProperty(prop2);
|
|
15971
17426
|
}
|
|
15972
17427
|
});
|
|
15973
17428
|
} else {
|
|
@@ -15990,10 +17445,10 @@ function createStyleDecorator(action) {
|
|
|
15990
17445
|
};
|
|
15991
17446
|
}
|
|
15992
17447
|
function applyStyle(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
15993
|
-
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
17448
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
15994
17449
|
return createStyleDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
15995
17450
|
}
|
|
15996
|
-
if (typeof selectorOrTarget === "string") {
|
|
17451
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15997
17452
|
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
15998
17453
|
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
15999
17454
|
return createStyleDecorator(action2)(selectorOrTarget, options2);
|
|
@@ -16006,7 +17461,7 @@ function setStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
|
16006
17461
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16007
17462
|
return createStyleDecorator("set")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16008
17463
|
}
|
|
16009
|
-
if (typeof selectorOrTarget === "string") {
|
|
17464
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16010
17465
|
return createStyleDecorator("set")(selectorOrTarget, optionsOrPropertyKey);
|
|
16011
17466
|
}
|
|
16012
17467
|
return createStyleDecorator("set")("$this", selectorOrTarget);
|
|
@@ -16015,7 +17470,7 @@ function updateStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
|
16015
17470
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16016
17471
|
return createStyleDecorator("update")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16017
17472
|
}
|
|
16018
|
-
if (typeof selectorOrTarget === "string") {
|
|
17473
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16019
17474
|
return createStyleDecorator("update")(selectorOrTarget, optionsOrPropertyKey);
|
|
16020
17475
|
}
|
|
16021
17476
|
return createStyleDecorator("update")("$this", selectorOrTarget);
|
|
@@ -16024,11 +17479,33 @@ function removeStyle(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
|
16024
17479
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16025
17480
|
return createStyleDecorator("remove")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16026
17481
|
}
|
|
16027
|
-
if (typeof selectorOrTarget === "string") {
|
|
17482
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16028
17483
|
return createStyleDecorator("remove")(selectorOrTarget, optionsOrPropertyKey);
|
|
16029
17484
|
}
|
|
16030
17485
|
return createStyleDecorator("remove")("$this", selectorOrTarget);
|
|
16031
17486
|
}
|
|
17487
|
+
var style = applyStyle;
|
|
17488
|
+
function styleThis(action, options) {
|
|
17489
|
+
return applyStyle("$this", action, options);
|
|
17490
|
+
}
|
|
17491
|
+
function styleAppHost(action, options) {
|
|
17492
|
+
return applyStyle("$appHost", action, options);
|
|
17493
|
+
}
|
|
17494
|
+
function styleLight(selector, actionOrOptions, options) {
|
|
17495
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17496
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17497
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "light" });
|
|
17498
|
+
}
|
|
17499
|
+
function styleShadow(selector, actionOrOptions, options) {
|
|
17500
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17501
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17502
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "shadow" });
|
|
17503
|
+
}
|
|
17504
|
+
function styleAll(selector, actionOrOptions, options) {
|
|
17505
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17506
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17507
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "all" });
|
|
17508
|
+
}
|
|
16032
17509
|
var findAllStyleMetadata = (target) => {
|
|
16033
17510
|
const result = /* @__PURE__ */ new Map();
|
|
16034
17511
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -16040,89 +17517,6 @@ var findAllStyleMetadata = (target) => {
|
|
|
16040
17517
|
return result;
|
|
16041
17518
|
};
|
|
16042
17519
|
|
|
16043
|
-
// src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
|
|
16044
|
-
var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
|
|
16045
|
-
function createSubscribeSwcAppRouteChangeWhileConnected(options) {
|
|
16046
|
-
return (target, propertyKey, descriptor) => {
|
|
16047
|
-
const pathPattern = options?.path;
|
|
16048
|
-
const filter = options?.filter;
|
|
16049
|
-
const constructor = target.constructor;
|
|
16050
|
-
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16051
|
-
if (!list) {
|
|
16052
|
-
list = [];
|
|
16053
|
-
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
16054
|
-
}
|
|
16055
|
-
list.push({ propertyKey, options });
|
|
16056
|
-
return descriptor;
|
|
16057
|
-
};
|
|
16058
|
-
}
|
|
16059
|
-
function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOrConfig, descriptor) {
|
|
16060
|
-
if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === "string" || typeof propertyKeyOrConfig === "symbol")) {
|
|
16061
|
-
return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);
|
|
16062
|
-
}
|
|
16063
|
-
let options = {};
|
|
16064
|
-
if (Array.isArray(targetOrOptions)) {
|
|
16065
|
-
options.path = targetOrOptions;
|
|
16066
|
-
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
16067
|
-
options = { ...options, ...propertyKeyOrConfig };
|
|
16068
|
-
}
|
|
16069
|
-
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
16070
|
-
options.path = targetOrOptions;
|
|
16071
|
-
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
16072
|
-
options = { ...options, ...propertyKeyOrConfig };
|
|
16073
|
-
}
|
|
16074
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
16075
|
-
options = targetOrOptions;
|
|
16076
|
-
}
|
|
16077
|
-
return createSubscribeSwcAppRouteChangeWhileConnected(options);
|
|
16078
|
-
}
|
|
16079
|
-
var changedRoute = subscribeSwcAppRouteChangeWhileConnected;
|
|
16080
|
-
var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
16081
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
16082
|
-
const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16083
|
-
if (!results) return [];
|
|
16084
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
16085
|
-
};
|
|
16086
|
-
|
|
16087
|
-
// src/decorators/subscribeSwcAppMessageWhileConnected.ts
|
|
16088
|
-
var SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-message-while-connected");
|
|
16089
|
-
function createSubscribeSwcAppMessageWhileConnected(options, messageType) {
|
|
16090
|
-
return (target, propertyKey, descriptor) => {
|
|
16091
|
-
const filter = options?.filter;
|
|
16092
|
-
const constructor = target.constructor;
|
|
16093
|
-
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16094
|
-
if (!list) {
|
|
16095
|
-
list = [];
|
|
16096
|
-
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
16097
|
-
}
|
|
16098
|
-
list.push({ propertyKey, messageType, filter });
|
|
16099
|
-
return descriptor;
|
|
16100
|
-
};
|
|
16101
|
-
}
|
|
16102
|
-
function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions, optionsOrPropertyKey, descriptor) {
|
|
16103
|
-
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && optionsOrPropertyKey && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol") && descriptor) {
|
|
16104
|
-
const target = targetOrMessageTypeOrOptions;
|
|
16105
|
-
const propertyKey = optionsOrPropertyKey;
|
|
16106
|
-
return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);
|
|
16107
|
-
}
|
|
16108
|
-
let messageType;
|
|
16109
|
-
let options = {};
|
|
16110
|
-
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
16111
|
-
messageType = targetOrMessageTypeOrOptions;
|
|
16112
|
-
if (optionsOrPropertyKey && typeof optionsOrPropertyKey === "object") {
|
|
16113
|
-
options = optionsOrPropertyKey;
|
|
16114
|
-
}
|
|
16115
|
-
} else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object") {
|
|
16116
|
-
options = targetOrMessageTypeOrOptions;
|
|
16117
|
-
}
|
|
16118
|
-
return createSubscribeSwcAppMessageWhileConnected(options, messageType);
|
|
16119
|
-
}
|
|
16120
|
-
var receiveMessage = subscribeSwcAppMessageWhileConnected;
|
|
16121
|
-
var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
16122
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
16123
|
-
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16124
|
-
};
|
|
16125
|
-
|
|
16126
17520
|
// src/decorators/publishSwcAppMessage.ts
|
|
16127
17521
|
var PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for("simple-web-component:publish-swc-app-message");
|
|
16128
17522
|
function createPublishSwcAppMessage(messageType, options) {
|
|
@@ -16747,9 +18141,9 @@ var SimProxyHandler = class {
|
|
|
16747
18141
|
return target[name];
|
|
16748
18142
|
}
|
|
16749
18143
|
}
|
|
16750
|
-
set(obj,
|
|
18144
|
+
set(obj, prop2, value, receiver) {
|
|
16751
18145
|
value = this.simstanceManager?.proxy(value);
|
|
16752
|
-
obj[
|
|
18146
|
+
obj[prop2] = value;
|
|
16753
18147
|
return true;
|
|
16754
18148
|
}
|
|
16755
18149
|
apply(target, thisArg, argumentsList) {
|
|
@@ -19511,13 +20905,21 @@ export {
|
|
|
19511
20905
|
ATTRIBUTE_METADATA_KEY,
|
|
19512
20906
|
BROWSER_GLOBALS,
|
|
19513
20907
|
CLASS_METADATA_KEY,
|
|
20908
|
+
ChangedAttributeLifeCycler,
|
|
19514
20909
|
esm_exports as Core,
|
|
19515
20910
|
esm_exports2 as CoreWeb,
|
|
19516
20911
|
DOM_EVENT_NAMES,
|
|
19517
20912
|
ELEMENT_CONFIG_KEY,
|
|
19518
20913
|
EMIT_CUSTOM_EVENT_METADATA_KEY,
|
|
20914
|
+
EmitCustomEventLifeCycler,
|
|
20915
|
+
EventListenerLifeCycler,
|
|
19519
20916
|
HTML_TAG_ENTRIES,
|
|
20917
|
+
INTERSECTION_OBSERVER_METADATA_KEY,
|
|
19520
20918
|
InjectSituationType2 as InjectSituationType,
|
|
20919
|
+
IntersectionObserverLifeCycler,
|
|
20920
|
+
MUTATION_OBSERVER_METADATA_KEY,
|
|
20921
|
+
MessageSubscribeLifeCycler,
|
|
20922
|
+
MutationObserverLifeCycler,
|
|
19521
20923
|
ON_ADD_EVENT_LISTENER_METADATA_KEY,
|
|
19522
20924
|
ON_AFTER_ADOPTED_METADATA_KEY,
|
|
19523
20925
|
ON_AFTER_CONNECTED_METADATA_KEY,
|
|
@@ -19534,11 +20936,18 @@ export {
|
|
|
19534
20936
|
PUBLISH_SWC_APP_MESSAGE_METADATA_KEY,
|
|
19535
20937
|
QUERY_ALL_METADATA_KEY,
|
|
19536
20938
|
QUERY_METADATA_KEY,
|
|
20939
|
+
RESIZE_OBSERVER_METADATA_KEY,
|
|
20940
|
+
ResizeObserverLifeCycler,
|
|
20941
|
+
RouteSubscribeLifeCycler,
|
|
20942
|
+
SET_INTERVAL_METADATA_KEY,
|
|
20943
|
+
SET_TIMEOUT_METADATA_KEY,
|
|
19537
20944
|
STATE_METADATA_KEY,
|
|
19538
20945
|
STYLE_METADATA_KEY,
|
|
19539
20946
|
SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY,
|
|
19540
20947
|
SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY,
|
|
19541
20948
|
SWC_NOT_FOUND,
|
|
20949
|
+
SetIntervalLifeCycler,
|
|
20950
|
+
SetTimeoutLifeCycler,
|
|
19542
20951
|
esm_exports3 as SimpleBoot,
|
|
19543
20952
|
SwcApp,
|
|
19544
20953
|
SwcAppArticle,
|
|
@@ -19555,30 +20964,60 @@ export {
|
|
|
19555
20964
|
SwcUtils,
|
|
19556
20965
|
addClass,
|
|
19557
20966
|
addEventListener,
|
|
20967
|
+
addEventListenerAll,
|
|
19558
20968
|
addEventListenerAppHost,
|
|
19559
20969
|
addEventListenerDelegate,
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
20970
|
+
addEventListenerDelegateAll,
|
|
20971
|
+
addEventListenerDelegateLight,
|
|
20972
|
+
addEventListenerDelegateShadow,
|
|
19563
20973
|
addEventListenerDocument,
|
|
20974
|
+
addEventListenerLight,
|
|
20975
|
+
addEventListenerMutation,
|
|
20976
|
+
addEventListenerMutationAll,
|
|
20977
|
+
addEventListenerMutationLight,
|
|
20978
|
+
addEventListenerMutationShadow,
|
|
20979
|
+
addEventListenerShadow,
|
|
19564
20980
|
addEventListenerThis,
|
|
19565
20981
|
addEventListenerWindow,
|
|
19566
20982
|
appendHtmlSlot,
|
|
19567
20983
|
appendSlot,
|
|
19568
20984
|
appendTextSlot,
|
|
20985
|
+
apply,
|
|
20986
|
+
applyAll,
|
|
20987
|
+
applyAppHost,
|
|
19569
20988
|
applyAttribute,
|
|
19570
20989
|
applyClass,
|
|
20990
|
+
applyIfChanged,
|
|
20991
|
+
applyLight,
|
|
19571
20992
|
applyNode,
|
|
19572
20993
|
applyProperty,
|
|
20994
|
+
applyShadow,
|
|
19573
20995
|
applySlot,
|
|
19574
20996
|
applyStyle,
|
|
20997
|
+
applyThis,
|
|
20998
|
+
attr,
|
|
20999
|
+
attrAll,
|
|
21000
|
+
attrAppHost,
|
|
21001
|
+
attrLight,
|
|
21002
|
+
attrShadow,
|
|
21003
|
+
attrThis,
|
|
19575
21004
|
attribute,
|
|
21005
|
+
callProperty,
|
|
21006
|
+
callPropertyAll,
|
|
21007
|
+
callPropertyLight,
|
|
21008
|
+
callPropertyShadow,
|
|
19576
21009
|
changedAttribute,
|
|
19577
21010
|
changedRoute,
|
|
19578
21011
|
clearChildrenLight,
|
|
19579
21012
|
clearChildrenNode,
|
|
19580
21013
|
clearNode,
|
|
19581
21014
|
clearSlot,
|
|
21015
|
+
cls,
|
|
21016
|
+
clsAll,
|
|
21017
|
+
clsAppHost,
|
|
21018
|
+
clsLight,
|
|
21019
|
+
clsShadow,
|
|
21020
|
+
clsThis,
|
|
19582
21021
|
commentNode,
|
|
19583
21022
|
convertAttributeValue,
|
|
19584
21023
|
convertValue2 as convertValue,
|
|
@@ -19596,13 +21035,31 @@ export {
|
|
|
19596
21035
|
defineSwcAppSection,
|
|
19597
21036
|
elementDefine,
|
|
19598
21037
|
emit,
|
|
21038
|
+
emitAll,
|
|
21039
|
+
emitAppHost,
|
|
19599
21040
|
emitCustomEvent,
|
|
21041
|
+
emitDocument,
|
|
21042
|
+
emitLight,
|
|
21043
|
+
emitShadow,
|
|
21044
|
+
emitThis,
|
|
21045
|
+
emitWindow,
|
|
19600
21046
|
ensureInit,
|
|
19601
21047
|
event,
|
|
21048
|
+
eventAll,
|
|
21049
|
+
eventAppHost,
|
|
19602
21050
|
eventDelegate,
|
|
19603
|
-
|
|
19604
|
-
|
|
19605
|
-
|
|
21051
|
+
eventDelegateAll,
|
|
21052
|
+
eventDelegateLight,
|
|
21053
|
+
eventDelegateShadow,
|
|
21054
|
+
eventDocument,
|
|
21055
|
+
eventLight,
|
|
21056
|
+
eventMutation,
|
|
21057
|
+
eventMutationAll,
|
|
21058
|
+
eventMutationLight,
|
|
21059
|
+
eventMutationShadow,
|
|
21060
|
+
eventShadow,
|
|
21061
|
+
eventThis,
|
|
21062
|
+
eventWindow,
|
|
19606
21063
|
findAllApplyNodeMetadata,
|
|
19607
21064
|
findAllApplySlotMetadata,
|
|
19608
21065
|
findAllAttributeApplyMetadata,
|
|
@@ -19615,6 +21072,8 @@ export {
|
|
|
19615
21072
|
findAllOnConnectedMetadata,
|
|
19616
21073
|
findAllPropertyApplyMetadata,
|
|
19617
21074
|
findAllPropertyMetadata,
|
|
21075
|
+
findAllSetIntervalMetadata,
|
|
21076
|
+
findAllSetTimeoutMetadata,
|
|
19618
21077
|
findAllStateMetadata,
|
|
19619
21078
|
findAllStyleMetadata,
|
|
19620
21079
|
getAddEventListenerMetadata,
|
|
@@ -19622,9 +21081,12 @@ export {
|
|
|
19622
21081
|
getChangedAttributeMetadata,
|
|
19623
21082
|
getElementConfig,
|
|
19624
21083
|
getEmitCustomEventMetadataList,
|
|
21084
|
+
getIntersectionObserverMetadata,
|
|
21085
|
+
getMutationObserverMetadata,
|
|
19625
21086
|
getPublishSwcAppMessageMetadata,
|
|
19626
21087
|
getQueryAllMetadata,
|
|
19627
21088
|
getQueryMetadata,
|
|
21089
|
+
getResizeObserverMetadata,
|
|
19628
21090
|
getSubscribeSwcAppMessageWhileConnectedMetadata,
|
|
19629
21091
|
getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
|
|
19630
21092
|
html,
|
|
@@ -19650,7 +21112,26 @@ export {
|
|
|
19650
21112
|
insertBeforeEnd,
|
|
19651
21113
|
insertBeforeEndLight,
|
|
19652
21114
|
insertBeforeEndShadow,
|
|
21115
|
+
intersectionObserver,
|
|
21116
|
+
intersectionObserverAll,
|
|
21117
|
+
intersectionObserverDelegate,
|
|
21118
|
+
intersectionObserverDelegateAll,
|
|
21119
|
+
intersectionObserverDelegateLight,
|
|
21120
|
+
intersectionObserverDelegateShadow,
|
|
21121
|
+
intersectionObserverLight,
|
|
21122
|
+
intersectionObserverShadow,
|
|
21123
|
+
intersectionObserverThis,
|
|
19653
21124
|
isSSR,
|
|
21125
|
+
mutationObserver,
|
|
21126
|
+
mutationObserverAll,
|
|
21127
|
+
mutationObserverDelegate,
|
|
21128
|
+
mutationObserverDelegateAll,
|
|
21129
|
+
mutationObserverDelegateLight,
|
|
21130
|
+
mutationObserverDelegateShadow,
|
|
21131
|
+
mutationObserverLight,
|
|
21132
|
+
mutationObserverShadow,
|
|
21133
|
+
mutationObserverThis,
|
|
21134
|
+
node,
|
|
19654
21135
|
onAdopted,
|
|
19655
21136
|
onAdoptedAfter,
|
|
19656
21137
|
onAdoptedBefore,
|
|
@@ -19665,14 +21146,33 @@ export {
|
|
|
19665
21146
|
onDisconnectedAfter,
|
|
19666
21147
|
onDisconnectedBefore,
|
|
19667
21148
|
onInitialize,
|
|
21149
|
+
pickElements,
|
|
19668
21150
|
prependHtmlSlot,
|
|
19669
21151
|
prependSlot,
|
|
19670
21152
|
prependTextSlot,
|
|
21153
|
+
prop,
|
|
21154
|
+
propAll,
|
|
21155
|
+
propAppHost,
|
|
21156
|
+
propDocument,
|
|
21157
|
+
propLight,
|
|
21158
|
+
propShadow,
|
|
21159
|
+
propThis,
|
|
21160
|
+
propWindow,
|
|
19671
21161
|
property,
|
|
21162
|
+
propertyAll,
|
|
21163
|
+
propertyLight,
|
|
21164
|
+
propertyShadow,
|
|
19672
21165
|
publishMessage,
|
|
19673
21166
|
publishSwcAppMessage,
|
|
19674
21167
|
query,
|
|
19675
21168
|
queryAll,
|
|
21169
|
+
queryAllAll,
|
|
21170
|
+
queryAllLight,
|
|
21171
|
+
queryAllRoots,
|
|
21172
|
+
queryAllShadow,
|
|
21173
|
+
queryIn,
|
|
21174
|
+
queryLight,
|
|
21175
|
+
queryShadow,
|
|
19676
21176
|
receiveMessage,
|
|
19677
21177
|
removeClass,
|
|
19678
21178
|
removeSSRAttribute,
|
|
@@ -19682,14 +21182,38 @@ export {
|
|
|
19682
21182
|
replaceChildrenLight,
|
|
19683
21183
|
replaceChildrenSlot,
|
|
19684
21184
|
replaceChildrenTextSlot,
|
|
21185
|
+
resizeObserver,
|
|
21186
|
+
resizeObserverAll,
|
|
21187
|
+
resizeObserverDelegate,
|
|
21188
|
+
resizeObserverDelegateAll,
|
|
21189
|
+
resizeObserverDelegateLight,
|
|
21190
|
+
resizeObserverDelegateShadow,
|
|
21191
|
+
resizeObserverLight,
|
|
21192
|
+
resizeObserverShadow,
|
|
21193
|
+
resizeObserverThis,
|
|
19685
21194
|
resolveAttributeTargets,
|
|
19686
21195
|
resolvePropertyTargets,
|
|
21196
|
+
resolveQueryElements,
|
|
19687
21197
|
setAttribute,
|
|
19688
21198
|
setClass,
|
|
21199
|
+
setInterval2 as setInterval,
|
|
19689
21200
|
setProperty,
|
|
21201
|
+
setPropertyAll,
|
|
21202
|
+
setPropertyLight,
|
|
21203
|
+
setPropertyShadow,
|
|
19690
21204
|
setSSRAttribute,
|
|
19691
21205
|
setStyle,
|
|
21206
|
+
setTimeout2 as setTimeout,
|
|
21207
|
+
skipIfEmpty,
|
|
21208
|
+
skipIfExists,
|
|
21209
|
+
skipIfSameTagPresent,
|
|
19692
21210
|
state,
|
|
21211
|
+
style,
|
|
21212
|
+
styleAll,
|
|
21213
|
+
styleAppHost,
|
|
21214
|
+
styleLight,
|
|
21215
|
+
styleShadow,
|
|
21216
|
+
styleThis,
|
|
19693
21217
|
subscribeSwcAppMessageWhileConnected,
|
|
19694
21218
|
subscribeSwcAppRouteChangeWhileConnected,
|
|
19695
21219
|
swcAppArticleTagName,
|