@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
|
@@ -32,9 +32,9 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
32
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
33
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
34
34
|
|
|
35
|
-
//
|
|
35
|
+
// ../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js
|
|
36
36
|
var require_Reflect = __commonJS({
|
|
37
|
-
"
|
|
37
|
+
"../../../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js"() {
|
|
38
38
|
var Reflect2;
|
|
39
39
|
(function(Reflect3) {
|
|
40
40
|
(function(factory) {
|
|
@@ -1127,13 +1127,21 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1127
1127
|
ATTRIBUTE_METADATA_KEY: () => ATTRIBUTE_METADATA_KEY,
|
|
1128
1128
|
BROWSER_GLOBALS: () => BROWSER_GLOBALS,
|
|
1129
1129
|
CLASS_METADATA_KEY: () => CLASS_METADATA_KEY,
|
|
1130
|
+
ChangedAttributeLifeCycler: () => ChangedAttributeLifeCycler,
|
|
1130
1131
|
Core: () => esm_exports,
|
|
1131
1132
|
CoreWeb: () => esm_exports2,
|
|
1132
1133
|
DOM_EVENT_NAMES: () => DOM_EVENT_NAMES,
|
|
1133
1134
|
ELEMENT_CONFIG_KEY: () => ELEMENT_CONFIG_KEY,
|
|
1134
1135
|
EMIT_CUSTOM_EVENT_METADATA_KEY: () => EMIT_CUSTOM_EVENT_METADATA_KEY,
|
|
1136
|
+
EmitCustomEventLifeCycler: () => EmitCustomEventLifeCycler,
|
|
1137
|
+
EventListenerLifeCycler: () => EventListenerLifeCycler,
|
|
1135
1138
|
HTML_TAG_ENTRIES: () => HTML_TAG_ENTRIES,
|
|
1139
|
+
INTERSECTION_OBSERVER_METADATA_KEY: () => INTERSECTION_OBSERVER_METADATA_KEY,
|
|
1136
1140
|
InjectSituationType: () => InjectSituationType2,
|
|
1141
|
+
IntersectionObserverLifeCycler: () => IntersectionObserverLifeCycler,
|
|
1142
|
+
MUTATION_OBSERVER_METADATA_KEY: () => MUTATION_OBSERVER_METADATA_KEY,
|
|
1143
|
+
MessageSubscribeLifeCycler: () => MessageSubscribeLifeCycler,
|
|
1144
|
+
MutationObserverLifeCycler: () => MutationObserverLifeCycler,
|
|
1137
1145
|
ON_ADD_EVENT_LISTENER_METADATA_KEY: () => ON_ADD_EVENT_LISTENER_METADATA_KEY,
|
|
1138
1146
|
ON_AFTER_ADOPTED_METADATA_KEY: () => ON_AFTER_ADOPTED_METADATA_KEY,
|
|
1139
1147
|
ON_AFTER_CONNECTED_METADATA_KEY: () => ON_AFTER_CONNECTED_METADATA_KEY,
|
|
@@ -1150,11 +1158,18 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1150
1158
|
PUBLISH_SWC_APP_MESSAGE_METADATA_KEY: () => PUBLISH_SWC_APP_MESSAGE_METADATA_KEY,
|
|
1151
1159
|
QUERY_ALL_METADATA_KEY: () => QUERY_ALL_METADATA_KEY,
|
|
1152
1160
|
QUERY_METADATA_KEY: () => QUERY_METADATA_KEY,
|
|
1161
|
+
RESIZE_OBSERVER_METADATA_KEY: () => RESIZE_OBSERVER_METADATA_KEY,
|
|
1162
|
+
ResizeObserverLifeCycler: () => ResizeObserverLifeCycler,
|
|
1163
|
+
RouteSubscribeLifeCycler: () => RouteSubscribeLifeCycler,
|
|
1164
|
+
SET_INTERVAL_METADATA_KEY: () => SET_INTERVAL_METADATA_KEY,
|
|
1165
|
+
SET_TIMEOUT_METADATA_KEY: () => SET_TIMEOUT_METADATA_KEY,
|
|
1153
1166
|
STATE_METADATA_KEY: () => STATE_METADATA_KEY,
|
|
1154
1167
|
STYLE_METADATA_KEY: () => STYLE_METADATA_KEY,
|
|
1155
1168
|
SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY: () => SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY,
|
|
1156
1169
|
SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY: () => SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY,
|
|
1157
1170
|
SWC_NOT_FOUND: () => SWC_NOT_FOUND,
|
|
1171
|
+
SetIntervalLifeCycler: () => SetIntervalLifeCycler,
|
|
1172
|
+
SetTimeoutLifeCycler: () => SetTimeoutLifeCycler,
|
|
1158
1173
|
SimpleBoot: () => esm_exports3,
|
|
1159
1174
|
SwcApp: () => SwcApp,
|
|
1160
1175
|
SwcAppArticle: () => SwcAppArticle,
|
|
@@ -1171,30 +1186,60 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1171
1186
|
SwcUtils: () => SwcUtils,
|
|
1172
1187
|
addClass: () => addClass,
|
|
1173
1188
|
addEventListener: () => addEventListener,
|
|
1189
|
+
addEventListenerAll: () => addEventListenerAll,
|
|
1174
1190
|
addEventListenerAppHost: () => addEventListenerAppHost,
|
|
1175
1191
|
addEventListenerDelegate: () => addEventListenerDelegate,
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1192
|
+
addEventListenerDelegateAll: () => addEventListenerDelegateAll,
|
|
1193
|
+
addEventListenerDelegateLight: () => addEventListenerDelegateLight,
|
|
1194
|
+
addEventListenerDelegateShadow: () => addEventListenerDelegateShadow,
|
|
1179
1195
|
addEventListenerDocument: () => addEventListenerDocument,
|
|
1196
|
+
addEventListenerLight: () => addEventListenerLight,
|
|
1197
|
+
addEventListenerMutation: () => addEventListenerMutation,
|
|
1198
|
+
addEventListenerMutationAll: () => addEventListenerMutationAll,
|
|
1199
|
+
addEventListenerMutationLight: () => addEventListenerMutationLight,
|
|
1200
|
+
addEventListenerMutationShadow: () => addEventListenerMutationShadow,
|
|
1201
|
+
addEventListenerShadow: () => addEventListenerShadow,
|
|
1180
1202
|
addEventListenerThis: () => addEventListenerThis,
|
|
1181
1203
|
addEventListenerWindow: () => addEventListenerWindow,
|
|
1182
1204
|
appendHtmlSlot: () => appendHtmlSlot,
|
|
1183
1205
|
appendSlot: () => appendSlot,
|
|
1184
1206
|
appendTextSlot: () => appendTextSlot,
|
|
1207
|
+
apply: () => apply,
|
|
1208
|
+
applyAll: () => applyAll,
|
|
1209
|
+
applyAppHost: () => applyAppHost,
|
|
1185
1210
|
applyAttribute: () => applyAttribute,
|
|
1186
1211
|
applyClass: () => applyClass,
|
|
1212
|
+
applyIfChanged: () => applyIfChanged,
|
|
1213
|
+
applyLight: () => applyLight,
|
|
1187
1214
|
applyNode: () => applyNode,
|
|
1188
1215
|
applyProperty: () => applyProperty,
|
|
1216
|
+
applyShadow: () => applyShadow,
|
|
1189
1217
|
applySlot: () => applySlot,
|
|
1190
1218
|
applyStyle: () => applyStyle,
|
|
1219
|
+
applyThis: () => applyThis,
|
|
1220
|
+
attr: () => attr,
|
|
1221
|
+
attrAll: () => attrAll,
|
|
1222
|
+
attrAppHost: () => attrAppHost,
|
|
1223
|
+
attrLight: () => attrLight,
|
|
1224
|
+
attrShadow: () => attrShadow,
|
|
1225
|
+
attrThis: () => attrThis,
|
|
1191
1226
|
attribute: () => attribute,
|
|
1227
|
+
callProperty: () => callProperty,
|
|
1228
|
+
callPropertyAll: () => callPropertyAll,
|
|
1229
|
+
callPropertyLight: () => callPropertyLight,
|
|
1230
|
+
callPropertyShadow: () => callPropertyShadow,
|
|
1192
1231
|
changedAttribute: () => changedAttribute,
|
|
1193
1232
|
changedRoute: () => changedRoute,
|
|
1194
1233
|
clearChildrenLight: () => clearChildrenLight,
|
|
1195
1234
|
clearChildrenNode: () => clearChildrenNode,
|
|
1196
1235
|
clearNode: () => clearNode,
|
|
1197
1236
|
clearSlot: () => clearSlot,
|
|
1237
|
+
cls: () => cls,
|
|
1238
|
+
clsAll: () => clsAll,
|
|
1239
|
+
clsAppHost: () => clsAppHost,
|
|
1240
|
+
clsLight: () => clsLight,
|
|
1241
|
+
clsShadow: () => clsShadow,
|
|
1242
|
+
clsThis: () => clsThis,
|
|
1198
1243
|
commentNode: () => commentNode,
|
|
1199
1244
|
convertAttributeValue: () => convertAttributeValue,
|
|
1200
1245
|
convertValue: () => convertValue2,
|
|
@@ -1212,13 +1257,31 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1212
1257
|
defineSwcAppSection: () => defineSwcAppSection,
|
|
1213
1258
|
elementDefine: () => elementDefine,
|
|
1214
1259
|
emit: () => emit,
|
|
1260
|
+
emitAll: () => emitAll,
|
|
1261
|
+
emitAppHost: () => emitAppHost,
|
|
1215
1262
|
emitCustomEvent: () => emitCustomEvent,
|
|
1263
|
+
emitDocument: () => emitDocument,
|
|
1264
|
+
emitLight: () => emitLight,
|
|
1265
|
+
emitShadow: () => emitShadow,
|
|
1266
|
+
emitThis: () => emitThis,
|
|
1267
|
+
emitWindow: () => emitWindow,
|
|
1216
1268
|
ensureInit: () => ensureInit,
|
|
1217
1269
|
event: () => event,
|
|
1270
|
+
eventAll: () => eventAll,
|
|
1271
|
+
eventAppHost: () => eventAppHost,
|
|
1218
1272
|
eventDelegate: () => eventDelegate,
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1273
|
+
eventDelegateAll: () => eventDelegateAll,
|
|
1274
|
+
eventDelegateLight: () => eventDelegateLight,
|
|
1275
|
+
eventDelegateShadow: () => eventDelegateShadow,
|
|
1276
|
+
eventDocument: () => eventDocument,
|
|
1277
|
+
eventLight: () => eventLight,
|
|
1278
|
+
eventMutation: () => eventMutation,
|
|
1279
|
+
eventMutationAll: () => eventMutationAll,
|
|
1280
|
+
eventMutationLight: () => eventMutationLight,
|
|
1281
|
+
eventMutationShadow: () => eventMutationShadow,
|
|
1282
|
+
eventShadow: () => eventShadow,
|
|
1283
|
+
eventThis: () => eventThis,
|
|
1284
|
+
eventWindow: () => eventWindow,
|
|
1222
1285
|
findAllApplyNodeMetadata: () => findAllApplyNodeMetadata,
|
|
1223
1286
|
findAllApplySlotMetadata: () => findAllApplySlotMetadata,
|
|
1224
1287
|
findAllAttributeApplyMetadata: () => findAllAttributeApplyMetadata,
|
|
@@ -1231,6 +1294,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1231
1294
|
findAllOnConnectedMetadata: () => findAllOnConnectedMetadata,
|
|
1232
1295
|
findAllPropertyApplyMetadata: () => findAllPropertyApplyMetadata,
|
|
1233
1296
|
findAllPropertyMetadata: () => findAllPropertyMetadata,
|
|
1297
|
+
findAllSetIntervalMetadata: () => findAllSetIntervalMetadata,
|
|
1298
|
+
findAllSetTimeoutMetadata: () => findAllSetTimeoutMetadata,
|
|
1234
1299
|
findAllStateMetadata: () => findAllStateMetadata,
|
|
1235
1300
|
findAllStyleMetadata: () => findAllStyleMetadata,
|
|
1236
1301
|
getAddEventListenerMetadata: () => getAddEventListenerMetadata,
|
|
@@ -1238,9 +1303,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1238
1303
|
getChangedAttributeMetadata: () => getChangedAttributeMetadata,
|
|
1239
1304
|
getElementConfig: () => getElementConfig,
|
|
1240
1305
|
getEmitCustomEventMetadataList: () => getEmitCustomEventMetadataList,
|
|
1306
|
+
getIntersectionObserverMetadata: () => getIntersectionObserverMetadata,
|
|
1307
|
+
getMutationObserverMetadata: () => getMutationObserverMetadata,
|
|
1241
1308
|
getPublishSwcAppMessageMetadata: () => getPublishSwcAppMessageMetadata,
|
|
1242
1309
|
getQueryAllMetadata: () => getQueryAllMetadata,
|
|
1243
1310
|
getQueryMetadata: () => getQueryMetadata,
|
|
1311
|
+
getResizeObserverMetadata: () => getResizeObserverMetadata,
|
|
1244
1312
|
getSubscribeSwcAppMessageWhileConnectedMetadata: () => getSubscribeSwcAppMessageWhileConnectedMetadata,
|
|
1245
1313
|
getSubscribeSwcAppRouteChangeWhileConnectedMetadata: () => getSubscribeSwcAppRouteChangeWhileConnectedMetadata,
|
|
1246
1314
|
html: () => html,
|
|
@@ -1266,7 +1334,26 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1266
1334
|
insertBeforeEnd: () => insertBeforeEnd,
|
|
1267
1335
|
insertBeforeEndLight: () => insertBeforeEndLight,
|
|
1268
1336
|
insertBeforeEndShadow: () => insertBeforeEndShadow,
|
|
1337
|
+
intersectionObserver: () => intersectionObserver,
|
|
1338
|
+
intersectionObserverAll: () => intersectionObserverAll,
|
|
1339
|
+
intersectionObserverDelegate: () => intersectionObserverDelegate,
|
|
1340
|
+
intersectionObserverDelegateAll: () => intersectionObserverDelegateAll,
|
|
1341
|
+
intersectionObserverDelegateLight: () => intersectionObserverDelegateLight,
|
|
1342
|
+
intersectionObserverDelegateShadow: () => intersectionObserverDelegateShadow,
|
|
1343
|
+
intersectionObserverLight: () => intersectionObserverLight,
|
|
1344
|
+
intersectionObserverShadow: () => intersectionObserverShadow,
|
|
1345
|
+
intersectionObserverThis: () => intersectionObserverThis,
|
|
1269
1346
|
isSSR: () => isSSR,
|
|
1347
|
+
mutationObserver: () => mutationObserver,
|
|
1348
|
+
mutationObserverAll: () => mutationObserverAll,
|
|
1349
|
+
mutationObserverDelegate: () => mutationObserverDelegate,
|
|
1350
|
+
mutationObserverDelegateAll: () => mutationObserverDelegateAll,
|
|
1351
|
+
mutationObserverDelegateLight: () => mutationObserverDelegateLight,
|
|
1352
|
+
mutationObserverDelegateShadow: () => mutationObserverDelegateShadow,
|
|
1353
|
+
mutationObserverLight: () => mutationObserverLight,
|
|
1354
|
+
mutationObserverShadow: () => mutationObserverShadow,
|
|
1355
|
+
mutationObserverThis: () => mutationObserverThis,
|
|
1356
|
+
node: () => node,
|
|
1270
1357
|
onAdopted: () => onAdopted,
|
|
1271
1358
|
onAdoptedAfter: () => onAdoptedAfter,
|
|
1272
1359
|
onAdoptedBefore: () => onAdoptedBefore,
|
|
@@ -1281,14 +1368,33 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1281
1368
|
onDisconnectedAfter: () => onDisconnectedAfter,
|
|
1282
1369
|
onDisconnectedBefore: () => onDisconnectedBefore,
|
|
1283
1370
|
onInitialize: () => onInitialize,
|
|
1371
|
+
pickElements: () => pickElements,
|
|
1284
1372
|
prependHtmlSlot: () => prependHtmlSlot,
|
|
1285
1373
|
prependSlot: () => prependSlot,
|
|
1286
1374
|
prependTextSlot: () => prependTextSlot,
|
|
1375
|
+
prop: () => prop,
|
|
1376
|
+
propAll: () => propAll,
|
|
1377
|
+
propAppHost: () => propAppHost,
|
|
1378
|
+
propDocument: () => propDocument,
|
|
1379
|
+
propLight: () => propLight,
|
|
1380
|
+
propShadow: () => propShadow,
|
|
1381
|
+
propThis: () => propThis,
|
|
1382
|
+
propWindow: () => propWindow,
|
|
1287
1383
|
property: () => property,
|
|
1384
|
+
propertyAll: () => propertyAll,
|
|
1385
|
+
propertyLight: () => propertyLight,
|
|
1386
|
+
propertyShadow: () => propertyShadow,
|
|
1288
1387
|
publishMessage: () => publishMessage,
|
|
1289
1388
|
publishSwcAppMessage: () => publishSwcAppMessage,
|
|
1290
1389
|
query: () => query,
|
|
1291
1390
|
queryAll: () => queryAll,
|
|
1391
|
+
queryAllAll: () => queryAllAll,
|
|
1392
|
+
queryAllLight: () => queryAllLight,
|
|
1393
|
+
queryAllRoots: () => queryAllRoots,
|
|
1394
|
+
queryAllShadow: () => queryAllShadow,
|
|
1395
|
+
queryIn: () => queryIn,
|
|
1396
|
+
queryLight: () => queryLight,
|
|
1397
|
+
queryShadow: () => queryShadow,
|
|
1292
1398
|
receiveMessage: () => receiveMessage,
|
|
1293
1399
|
removeClass: () => removeClass,
|
|
1294
1400
|
removeSSRAttribute: () => removeSSRAttribute,
|
|
@@ -1298,14 +1404,38 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1298
1404
|
replaceChildrenLight: () => replaceChildrenLight,
|
|
1299
1405
|
replaceChildrenSlot: () => replaceChildrenSlot,
|
|
1300
1406
|
replaceChildrenTextSlot: () => replaceChildrenTextSlot,
|
|
1407
|
+
resizeObserver: () => resizeObserver,
|
|
1408
|
+
resizeObserverAll: () => resizeObserverAll,
|
|
1409
|
+
resizeObserverDelegate: () => resizeObserverDelegate,
|
|
1410
|
+
resizeObserverDelegateAll: () => resizeObserverDelegateAll,
|
|
1411
|
+
resizeObserverDelegateLight: () => resizeObserverDelegateLight,
|
|
1412
|
+
resizeObserverDelegateShadow: () => resizeObserverDelegateShadow,
|
|
1413
|
+
resizeObserverLight: () => resizeObserverLight,
|
|
1414
|
+
resizeObserverShadow: () => resizeObserverShadow,
|
|
1415
|
+
resizeObserverThis: () => resizeObserverThis,
|
|
1301
1416
|
resolveAttributeTargets: () => resolveAttributeTargets,
|
|
1302
1417
|
resolvePropertyTargets: () => resolvePropertyTargets,
|
|
1418
|
+
resolveQueryElements: () => resolveQueryElements,
|
|
1303
1419
|
setAttribute: () => setAttribute,
|
|
1304
1420
|
setClass: () => setClass,
|
|
1421
|
+
setInterval: () => setInterval2,
|
|
1305
1422
|
setProperty: () => setProperty,
|
|
1423
|
+
setPropertyAll: () => setPropertyAll,
|
|
1424
|
+
setPropertyLight: () => setPropertyLight,
|
|
1425
|
+
setPropertyShadow: () => setPropertyShadow,
|
|
1306
1426
|
setSSRAttribute: () => setSSRAttribute,
|
|
1307
1427
|
setStyle: () => setStyle,
|
|
1428
|
+
setTimeout: () => setTimeout2,
|
|
1429
|
+
skipIfEmpty: () => skipIfEmpty,
|
|
1430
|
+
skipIfExists: () => skipIfExists,
|
|
1431
|
+
skipIfSameTagPresent: () => skipIfSameTagPresent,
|
|
1308
1432
|
state: () => state,
|
|
1433
|
+
style: () => style,
|
|
1434
|
+
styleAll: () => styleAll,
|
|
1435
|
+
styleAppHost: () => styleAppHost,
|
|
1436
|
+
styleLight: () => styleLight,
|
|
1437
|
+
styleShadow: () => styleShadow,
|
|
1438
|
+
styleThis: () => styleThis,
|
|
1309
1439
|
subscribeSwcAppMessageWhileConnected: () => subscribeSwcAppMessageWhileConnected,
|
|
1310
1440
|
subscribeSwcAppRouteChangeWhileConnected: () => subscribeSwcAppRouteChangeWhileConnected,
|
|
1311
1441
|
swcAppArticleTagName: () => swcAppArticleTagName,
|
|
@@ -1367,6 +1497,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1367
1497
|
Fetcher: () => Fetcher,
|
|
1368
1498
|
FormValidator: () => FormValidator,
|
|
1369
1499
|
FunctionUtils: () => FunctionUtils,
|
|
1500
|
+
HashUtils: () => HashUtils,
|
|
1370
1501
|
HttpFetcher: () => HttpFetcher,
|
|
1371
1502
|
HttpJsonFetcher: () => HttpJsonFetcher,
|
|
1372
1503
|
HttpResponseError: () => HttpResponseError,
|
|
@@ -1447,6 +1578,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
1447
1578
|
isCssCommentItem: () => isCssCommentItem,
|
|
1448
1579
|
isCssDeclarationItem: () => isCssDeclarationItem,
|
|
1449
1580
|
isCssRuleItem: () => isCssRuleItem,
|
|
1581
|
+
isDefined: () => isDefined,
|
|
1450
1582
|
isHttpResponseError: () => isHttpResponseError,
|
|
1451
1583
|
isPoint2DType: () => isPoint2DType,
|
|
1452
1584
|
isPoint3DType: () => isPoint3DType,
|
|
@@ -2143,8 +2275,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2143
2275
|
const funcCall = this.parseFunctionCall(true);
|
|
2144
2276
|
memberExpr.addChild(funcCall);
|
|
2145
2277
|
} else {
|
|
2146
|
-
const
|
|
2147
|
-
memberExpr.addChild(
|
|
2278
|
+
const prop2 = this.parsePropertyAccess(true);
|
|
2279
|
+
memberExpr.addChild(prop2);
|
|
2148
2280
|
}
|
|
2149
2281
|
} else if (char === ".") {
|
|
2150
2282
|
this.advance();
|
|
@@ -2152,8 +2284,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2152
2284
|
const paren = this.parseParenthesizedAccess(false);
|
|
2153
2285
|
memberExpr.addChild(paren);
|
|
2154
2286
|
} else {
|
|
2155
|
-
const
|
|
2156
|
-
memberExpr.addChild(
|
|
2287
|
+
const prop2 = this.parsePropertyAccess(false);
|
|
2288
|
+
memberExpr.addChild(prop2);
|
|
2157
2289
|
}
|
|
2158
2290
|
} else if (char === "[") {
|
|
2159
2291
|
const bracket = this.parseBracketAccess(false);
|
|
@@ -2207,13 +2339,13 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2207
2339
|
}
|
|
2208
2340
|
parsePropertyAccess(isOptional) {
|
|
2209
2341
|
const start = this.pos;
|
|
2210
|
-
const
|
|
2211
|
-
|
|
2342
|
+
const prop2 = new Token("property_access", "", start, start);
|
|
2343
|
+
prop2.isOptional = isOptional;
|
|
2212
2344
|
const identifier = this.parseIdentifier();
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
return
|
|
2345
|
+
prop2.addChild(identifier);
|
|
2346
|
+
prop2.end = this.pos;
|
|
2347
|
+
prop2.value = this.input.substring(start, this.pos);
|
|
2348
|
+
return prop2;
|
|
2217
2349
|
}
|
|
2218
2350
|
parseBracketAccess(isOptional) {
|
|
2219
2351
|
const start = this.pos;
|
|
@@ -2309,8 +2441,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2309
2441
|
const funcCall = this.parseFunctionCall(true);
|
|
2310
2442
|
memberExpr.addChild(funcCall);
|
|
2311
2443
|
} else {
|
|
2312
|
-
const
|
|
2313
|
-
memberExpr.addChild(
|
|
2444
|
+
const prop2 = this.parsePropertyAccess(true);
|
|
2445
|
+
memberExpr.addChild(prop2);
|
|
2314
2446
|
}
|
|
2315
2447
|
} else if (char === ".") {
|
|
2316
2448
|
this.advance();
|
|
@@ -2318,8 +2450,8 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
2318
2450
|
const parenAccess = this.parseParenthesizedAccess(false);
|
|
2319
2451
|
memberExpr.addChild(parenAccess);
|
|
2320
2452
|
} else {
|
|
2321
|
-
const
|
|
2322
|
-
memberExpr.addChild(
|
|
2453
|
+
const prop2 = this.parsePropertyAccess(false);
|
|
2454
|
+
memberExpr.addChild(prop2);
|
|
2323
2455
|
}
|
|
2324
2456
|
} else if (char === "[") {
|
|
2325
2457
|
const bracket = this.parseBracketAccess(false);
|
|
@@ -3023,17 +3155,17 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3023
3155
|
};
|
|
3024
3156
|
const handler = new GetDetectProxy(prefix);
|
|
3025
3157
|
return new Proxy(dummyFunction, {
|
|
3026
|
-
get: (target,
|
|
3027
|
-
if (
|
|
3158
|
+
get: (target, prop2, receiver) => {
|
|
3159
|
+
if (prop2 === Symbol.toPrimitive) {
|
|
3028
3160
|
return () => "";
|
|
3029
3161
|
}
|
|
3030
|
-
if (
|
|
3162
|
+
if (prop2 === "valueOf") {
|
|
3031
3163
|
return () => handler.createSafeProxy(prefix);
|
|
3032
3164
|
}
|
|
3033
|
-
if (
|
|
3165
|
+
if (prop2 === "toString") {
|
|
3034
3166
|
return () => "";
|
|
3035
3167
|
}
|
|
3036
|
-
return handler.get(target,
|
|
3168
|
+
return handler.get(target, prop2, receiver);
|
|
3037
3169
|
},
|
|
3038
3170
|
set: handler.set.bind(handler),
|
|
3039
3171
|
apply: handler.apply.bind(handler)
|
|
@@ -3406,6 +3538,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3406
3538
|
this.z = z ?? 0;
|
|
3407
3539
|
}
|
|
3408
3540
|
}
|
|
3541
|
+
/**
|
|
3542
|
+
* 성분 대입 (파괴적). 벡터 전달 시 그 성분을 복사.
|
|
3543
|
+
* @example
|
|
3544
|
+
* v.set(1, 2, 3); // v = (1, 2, 3)
|
|
3545
|
+
* v.set(otherVector); // v = other와 동일 성분
|
|
3546
|
+
*/
|
|
3409
3547
|
set(v, y = 0, z = 0) {
|
|
3410
3548
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3411
3549
|
this.set(v.x || 0, v.y || 0, v.z || 0);
|
|
@@ -3416,16 +3554,45 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3416
3554
|
}
|
|
3417
3555
|
return this;
|
|
3418
3556
|
}
|
|
3557
|
+
/**
|
|
3558
|
+
* 복사본 반환 (비파괴). 파괴적 메서드와 조합해 원본 보존용.
|
|
3559
|
+
* @example
|
|
3560
|
+
* const s = a.get(); s.add(b); // s = a+b, a는 그대로
|
|
3561
|
+
*/
|
|
3419
3562
|
get() {
|
|
3420
3563
|
return new _Vector(this.x, this.y, this.z);
|
|
3421
3564
|
}
|
|
3422
|
-
|
|
3423
|
-
|
|
3565
|
+
/**
|
|
3566
|
+
* 노름(norm). 평평한 공간(유클리드 공간)에서의 직선 거리.
|
|
3567
|
+
* - 수식: ‖v‖ = √(x² + y² + z²)
|
|
3568
|
+
* - 2D에서는 피타고라스 정리 그 자체. 3D는 두 번 적용한 것과 같음.
|
|
3569
|
+
* (바닥 대각선 √(x²+y²) → 공간 대각선 √((바닥)²+z²))
|
|
3570
|
+
* - "유클리드"는 평평한 공간의 기하학을 말함 (좌표계는 데카르트의 것, 유클리드는 좌표 없이 기하학을 세움).
|
|
3571
|
+
* 휘어진 공간(구면·쌍곡)에서는 이 공식이 성립하지 않음.
|
|
3572
|
+
* @example
|
|
3573
|
+
* new Vector(3, 4, 0).norm(); // 5
|
|
3574
|
+
* new Vector(6, 8, 0).norm(); // 10
|
|
3575
|
+
*/
|
|
3576
|
+
norm() {
|
|
3424
3577
|
const x = this.x;
|
|
3425
3578
|
const y = this.y;
|
|
3426
3579
|
const z = this.z;
|
|
3427
3580
|
return Math.sqrt(x * x + y * y + z * z);
|
|
3428
3581
|
}
|
|
3582
|
+
/**
|
|
3583
|
+
* norm()의 별칭 (p5.js 호환).
|
|
3584
|
+
* @example
|
|
3585
|
+
* new Vector(3, 4, 0).mag(); // 5
|
|
3586
|
+
*/
|
|
3587
|
+
mag() {
|
|
3588
|
+
return this.norm();
|
|
3589
|
+
}
|
|
3590
|
+
/**
|
|
3591
|
+
* 덧셈 (파괴적). 성분별 합. 기하학적으로 평행사변형의 대각선.
|
|
3592
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
3593
|
+
* @example
|
|
3594
|
+
* const a = new Vector(4, 2); a.add(new Vector(-2, 3)); // a = (2, 5)
|
|
3595
|
+
*/
|
|
3429
3596
|
add(v, y = 0, z = 0) {
|
|
3430
3597
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3431
3598
|
this.x += v.x;
|
|
@@ -3437,12 +3604,24 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3437
3604
|
this.z += z;
|
|
3438
3605
|
}
|
|
3439
3606
|
}
|
|
3607
|
+
/**
|
|
3608
|
+
* 덧셈 결과의 새 벡터 반환 (비파괴).
|
|
3609
|
+
* - 수식: a + b = (ax+bx, ay+by, az+bz)
|
|
3610
|
+
* @example
|
|
3611
|
+
* const s = a.toAdd(a, b); // s = a+b, a·b는 그대로
|
|
3612
|
+
*/
|
|
3440
3613
|
toAdd(v1, v2) {
|
|
3441
3614
|
return new _Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
3442
3615
|
}
|
|
3443
3616
|
// public static add(v1: Vector, v2: Vector): Vector {
|
|
3444
3617
|
// return new Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
|
|
3445
3618
|
// }
|
|
3619
|
+
/**
|
|
3620
|
+
* 뺄셈 (파괴적). a - b는 "a에서 b를 되돌리는" 벡터.
|
|
3621
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
3622
|
+
* @example
|
|
3623
|
+
* const a = new Vector(4, 2); a.sub(new Vector(1, 1)); // a = (3, 1)
|
|
3624
|
+
*/
|
|
3446
3625
|
sub(v, y = 0, z = 0) {
|
|
3447
3626
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3448
3627
|
this.x -= v.x;
|
|
@@ -3454,6 +3633,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3454
3633
|
this.z -= z;
|
|
3455
3634
|
}
|
|
3456
3635
|
}
|
|
3636
|
+
/**
|
|
3637
|
+
* 뺄셈 결과의 새 벡터 반환 (비파괴).
|
|
3638
|
+
* - 수식: a - b = (ax-bx, ay-by, az-bz)
|
|
3639
|
+
* @example
|
|
3640
|
+
* const d = a.toSub(b); // d = a-b, a·b는 그대로
|
|
3641
|
+
*/
|
|
3457
3642
|
toSub(v2) {
|
|
3458
3643
|
const v1 = this;
|
|
3459
3644
|
return new _Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
@@ -3462,6 +3647,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3462
3647
|
// public static sub(v1: Vector, v2: Vector): Vector {
|
|
3463
3648
|
// return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
|
|
3464
3649
|
// }
|
|
3650
|
+
/**
|
|
3651
|
+
* 스칼라배 또는 성분별 곱 (파괴적). 스칼라 k>1이면 늘어나고, 0<k<1이면 줄어듦. k<0이면 반대 방향.
|
|
3652
|
+
* - 수식(스칼라): k·v = (k·x, k·y, k·z)
|
|
3653
|
+
* @example
|
|
3654
|
+
* const v = new Vector(1, 2); v.mult(3); // v = (3, 6)
|
|
3655
|
+
*/
|
|
3465
3656
|
mult(v) {
|
|
3466
3657
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3467
3658
|
this.x *= v.x;
|
|
@@ -3474,6 +3665,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3474
3665
|
}
|
|
3475
3666
|
return this;
|
|
3476
3667
|
}
|
|
3668
|
+
/**
|
|
3669
|
+
* 성분별 곱 결과의 새 벡터 반환 (비파괴).
|
|
3670
|
+
* - 수식: (ax·bx, ay·by, az·bz)
|
|
3671
|
+
* @example
|
|
3672
|
+
* const m = a.toMult(b); // m = 성분별 곱, a·b는 그대로
|
|
3673
|
+
*/
|
|
3477
3674
|
toMult(v2) {
|
|
3478
3675
|
const v1 = this;
|
|
3479
3676
|
return new _Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
@@ -3481,6 +3678,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3481
3678
|
// public static mult(v1: Vector, v2: Vector) {
|
|
3482
3679
|
// return new Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
|
|
3483
3680
|
// }
|
|
3681
|
+
/**
|
|
3682
|
+
* 스칼라 나눗셈 또는 성분별 나눗셈 (파괴적). 정규화의 핵심 연산.
|
|
3683
|
+
* - 수식(스칼라): v/k = (x/k, y/k, z/k)
|
|
3684
|
+
* @example
|
|
3685
|
+
* const v = new Vector(6, 8); v.div(2); // v = (3, 4)
|
|
3686
|
+
*/
|
|
3484
3687
|
div(v) {
|
|
3485
3688
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3486
3689
|
this.x /= v.x;
|
|
@@ -3493,6 +3696,12 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3493
3696
|
}
|
|
3494
3697
|
return this;
|
|
3495
3698
|
}
|
|
3699
|
+
/**
|
|
3700
|
+
* 스칼라 나눗셈 결과의 새 벡터 반환 (비파괴).
|
|
3701
|
+
* - 수식: v/k = (x/k, y/k, z/k)
|
|
3702
|
+
* @example
|
|
3703
|
+
* const h = v.toDiv(2); // h = v/2, v는 그대로
|
|
3704
|
+
*/
|
|
3496
3705
|
toDiv(d) {
|
|
3497
3706
|
const v = this;
|
|
3498
3707
|
const rv = v.get();
|
|
@@ -3508,10 +3717,22 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3508
3717
|
// rv.z /= d;
|
|
3509
3718
|
// return rv;
|
|
3510
3719
|
// }
|
|
3720
|
+
/**
|
|
3721
|
+
* 두 점(벡터) 사이 거리. 차 벡터의 크기.
|
|
3722
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
3723
|
+
* @example
|
|
3724
|
+
* new Vector(0, 0).dist(new Vector(3, 4)); // 5
|
|
3725
|
+
*/
|
|
3511
3726
|
dist(v) {
|
|
3512
3727
|
const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
|
|
3513
3728
|
return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3514
3729
|
}
|
|
3730
|
+
/**
|
|
3731
|
+
* 두 점(벡터) 사이 거리 (toDist는 dist와 동일, 비파괴).
|
|
3732
|
+
* - 수식: d = √((dx)² + (dy)² + (dz)²)
|
|
3733
|
+
* @example
|
|
3734
|
+
* a.toDist(b); // a와 b 사이 거리
|
|
3735
|
+
*/
|
|
3515
3736
|
toDist(v2) {
|
|
3516
3737
|
const v1 = this;
|
|
3517
3738
|
const dx = v1.x - v2.x, dy = v1.y - v2.y, dz = v1.z - v2.z;
|
|
@@ -3523,36 +3744,90 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3523
3744
|
// dz = v1.z - v2.z;
|
|
3524
3745
|
// return Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
3525
3746
|
// }
|
|
3526
|
-
|
|
3747
|
+
/**
|
|
3748
|
+
* 내적(dot product). 두 벡터가 같은 방향을 향하는 정도.
|
|
3749
|
+
* - 수식: a·b = ax·bx + ay·by + az·bz = |a||b|cosθ
|
|
3750
|
+
* - θ=90°면 0(직교), 0°면 최대(같은 방향).
|
|
3751
|
+
* - 벡터 전달 시 y·z 생략 가능, 스칼라(x) 전달 시 y·z와 함께 사용.
|
|
3752
|
+
* @example
|
|
3753
|
+
* new Vector(5, 12).dot(new Vector(-5, 12)); // -25+144 = 119
|
|
3754
|
+
* new Vector(1, 0).dot(new Vector(0, 1)); // 0 (직각)
|
|
3755
|
+
* new Vector(1, 2).dot(3, 4); // 1*3+2*4 = 11
|
|
3756
|
+
*/
|
|
3757
|
+
dot(v, y = 0, z = 0) {
|
|
3527
3758
|
if (v instanceof _Vector || v instanceof Point3D) {
|
|
3528
3759
|
return this.x * v.x + this.y * v.y + this.z * v.z;
|
|
3529
3760
|
}
|
|
3530
3761
|
;
|
|
3531
3762
|
return this.x * v + this.y * y + this.z * z;
|
|
3532
3763
|
}
|
|
3764
|
+
/**
|
|
3765
|
+
* 외적(cross product). 두 벡터에 수직인 벡터. 오른손 법칙 방향.
|
|
3766
|
+
* - 수식: a×b = (ay·bz − az·by, az·bx − ax·bz, ax·by − ay·bx)
|
|
3767
|
+
* - 2D에서는 z값 = ax·by − ay·bx (부호 있는 면적, 회전 방향 판정용).
|
|
3768
|
+
* @example
|
|
3769
|
+
* new Vector(1, 0, 0).cross(new Vector(0, 1, 0)); // (0, 0, 1)
|
|
3770
|
+
*/
|
|
3533
3771
|
cross(v) {
|
|
3534
3772
|
const x = this.x, y = this.y, z = this.z;
|
|
3535
3773
|
return new _Vector(y * v.z - v.y * z, z * v.x - v.z * x, x * v.y - v.x * y);
|
|
3536
3774
|
}
|
|
3775
|
+
/**
|
|
3776
|
+
* 정규화 (파괴적). 방향은 그대로, 크기를 1로. 단위벡터 v̂ 생성.
|
|
3777
|
+
* - 수식: v̂ = v / |v|
|
|
3778
|
+
* - 영벡터(|v|=0)는 0으로 나누지 않고 그대로 둠.
|
|
3779
|
+
* @example
|
|
3780
|
+
* const v = new Vector(6, 8); v.normalize(); // v = (0.6, 0.8), |v| = 1
|
|
3781
|
+
*/
|
|
3537
3782
|
normalize() {
|
|
3538
|
-
const m = this.
|
|
3783
|
+
const m = this.norm();
|
|
3539
3784
|
if (m > 0) this.div(m);
|
|
3540
3785
|
}
|
|
3786
|
+
/**
|
|
3787
|
+
* 크기 상한 (파괴적). 속도가 high를 넘으면 방향 유지한 채 high로 자름. 물리 시뮬레이션 최고속도용.
|
|
3788
|
+
* - 수식: |v| > high → v = v̂ · high
|
|
3789
|
+
* @example
|
|
3790
|
+
* const v = new Vector(6, 8); v.limit(5); // |v|=10 → 5, v = (3, 4)
|
|
3791
|
+
*/
|
|
3541
3792
|
limit(high) {
|
|
3542
|
-
if (this.
|
|
3793
|
+
if (this.norm() > high) {
|
|
3543
3794
|
this.normalize();
|
|
3544
3795
|
this.mult(high);
|
|
3545
3796
|
}
|
|
3546
3797
|
}
|
|
3798
|
+
/**
|
|
3799
|
+
* 2D 방향각. +x축 기준 반시계 방향 라디안 (-π ~ π).
|
|
3800
|
+
* - 수식: θ = atan2(y, x)
|
|
3801
|
+
* @example
|
|
3802
|
+
* new Vector(1, 1).heading2D(); // π/4 (45°)
|
|
3803
|
+
* new Vector(-1, 0).heading2D(); // π (180°)
|
|
3804
|
+
*/
|
|
3547
3805
|
heading2D() {
|
|
3548
3806
|
return -Math.atan2(-this.y, this.x);
|
|
3549
3807
|
}
|
|
3808
|
+
/**
|
|
3809
|
+
* 무작위 방향 단위벡터 반환 (새 Vector, 자신은 변경 안 함).
|
|
3810
|
+
* @example
|
|
3811
|
+
* const r = new Vector().random2D(); // |r| = 1, 방향 랜덤
|
|
3812
|
+
*/
|
|
3550
3813
|
random2D() {
|
|
3551
3814
|
return this.fromAngle(Math.random() * (2 * Math.PI));
|
|
3552
3815
|
}
|
|
3816
|
+
/**
|
|
3817
|
+
* 각도→벡터. 각도 θ, 길이 L인 2D 벡터 반환 (새 Vector).
|
|
3818
|
+
* - 수식: (L·cosθ, L·sinθ, 0)
|
|
3819
|
+
* @example
|
|
3820
|
+
* new Vector().fromAngle(Math.PI / 3, 2); // (1, 1.73, 0)
|
|
3821
|
+
*/
|
|
3553
3822
|
fromAngle(angle, length = 1) {
|
|
3554
3823
|
return new _Vector(length * Math.cos(angle), length * Math.sin(angle), 0);
|
|
3555
3824
|
}
|
|
3825
|
+
/**
|
|
3826
|
+
* 구면좌표→3D 벡터 (새 Vector 반환, p5.js 컨벤션).
|
|
3827
|
+
* - 수식: (L·sinθ·sinφ, −L·cosθ, L·sinθ·cosφ)
|
|
3828
|
+
* @example
|
|
3829
|
+
* new Vector().fromAngles(Math.PI / 2, Math.PI / 2, 1); // (1, 0, 0)
|
|
3830
|
+
*/
|
|
3556
3831
|
fromAngles(theta, phi, length = 1) {
|
|
3557
3832
|
const cosPhi = Math.cos(phi);
|
|
3558
3833
|
const sinPhi = Math.sin(phi);
|
|
@@ -3564,18 +3839,43 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
3564
3839
|
length * sinTheta * cosPhi
|
|
3565
3840
|
);
|
|
3566
3841
|
}
|
|
3842
|
+
/**
|
|
3843
|
+
* 성분 배열 반환. [x, y, z] 순서.
|
|
3844
|
+
* @example
|
|
3845
|
+
* new Vector(1, 2, 3).array(); // [1, 2, 3]
|
|
3846
|
+
*/
|
|
3567
3847
|
array() {
|
|
3568
3848
|
return [this.x, this.y, this.z];
|
|
3569
3849
|
}
|
|
3850
|
+
/**
|
|
3851
|
+
* Point3D로 변환 (위치 의미로 바꿀 때).
|
|
3852
|
+
* @example
|
|
3853
|
+
* new Vector(1, 2, 3).toPoint3D(); // Point3D(1, 2, 3)
|
|
3854
|
+
*/
|
|
3570
3855
|
toPoint3D() {
|
|
3571
3856
|
return new Point3D(this.x, this.y, this.z);
|
|
3572
3857
|
}
|
|
3858
|
+
/**
|
|
3859
|
+
* Point2D로 변환 (z 버림).
|
|
3860
|
+
* @example
|
|
3861
|
+
* new Vector(1, 2, 3).toPoint2D(); // Point2D(1, 2)
|
|
3862
|
+
*/
|
|
3573
3863
|
toPoint2D() {
|
|
3574
3864
|
return new Point2D(this.x, this.y);
|
|
3575
3865
|
}
|
|
3866
|
+
/**
|
|
3867
|
+
* 복사본 반환 (get()과 동일, 비파괴).
|
|
3868
|
+
* @example
|
|
3869
|
+
* const c = v.copy(); // v와 같은 성분의 새 벡터
|
|
3870
|
+
*/
|
|
3576
3871
|
copy() {
|
|
3577
3872
|
return new _Vector(this.x, this.y, this.z);
|
|
3578
3873
|
}
|
|
3874
|
+
/**
|
|
3875
|
+
* 문자열 표현. "[x, y, z]" 형식.
|
|
3876
|
+
* @example
|
|
3877
|
+
* new Vector(1, 2).toString(); // "[1, 2, 0]"
|
|
3878
|
+
*/
|
|
3579
3879
|
toString() {
|
|
3580
3880
|
return "[" + this.x + ", " + this.y + ", " + this.z + "]";
|
|
3581
3881
|
}
|
|
@@ -8421,7 +8721,7 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8421
8721
|
|
|
8422
8722
|
// ../core/dist/esm/url/UrlUtils.js
|
|
8423
8723
|
var UrlUtils;
|
|
8424
|
-
((UrlUtils2)
|
|
8724
|
+
(function(UrlUtils2) {
|
|
8425
8725
|
UrlUtils2.origin = (fullurl) => {
|
|
8426
8726
|
return new URL(fullurl).origin;
|
|
8427
8727
|
};
|
|
@@ -8459,15 +8759,28 @@ var dooboostoreSimpleWebComponent = (() => {
|
|
|
8459
8759
|
});
|
|
8460
8760
|
return searchParams;
|
|
8461
8761
|
};
|
|
8762
|
+
UrlUtils2.toAbsoluteUrl = (relative, base) => {
|
|
8763
|
+
return new URL(relative, base);
|
|
8764
|
+
};
|
|
8765
|
+
function toAbsoluteRequest(input, base) {
|
|
8766
|
+
if (input instanceof URL) {
|
|
8767
|
+
return UrlUtils2.toAbsoluteUrl(input.href, base);
|
|
8768
|
+
}
|
|
8769
|
+
if (typeof input === "string") {
|
|
8770
|
+
return UrlUtils2.toAbsoluteUrl(input, base).href;
|
|
8771
|
+
}
|
|
8772
|
+
return new Request(UrlUtils2.toAbsoluteUrl(input.url, base).href, input);
|
|
8773
|
+
}
|
|
8774
|
+
UrlUtils2.toAbsoluteRequest = toAbsoluteRequest;
|
|
8462
8775
|
UrlUtils2.manipulateSearchParams = (searchParams, options) => {
|
|
8463
8776
|
if (options?.delete) {
|
|
8464
|
-
|
|
8777
|
+
UrlUtils2.deleteSearchParam(searchParams, options.delete);
|
|
8465
8778
|
}
|
|
8466
8779
|
if (options?.append) {
|
|
8467
|
-
|
|
8780
|
+
UrlUtils2.appendSearchParam(searchParams, options.append);
|
|
8468
8781
|
}
|
|
8469
8782
|
if (options?.upsert) {
|
|
8470
|
-
|
|
8783
|
+
UrlUtils2.upsertSearchParam(searchParams, options.upsert);
|
|
8471
8784
|
}
|
|
8472
8785
|
return searchParams;
|
|
8473
8786
|
};
|
|
@@ -9189,10 +9502,10 @@ ${indentStr}}`;
|
|
|
9189
9502
|
if (remaining && remaining.includes(":")) {
|
|
9190
9503
|
const parts = remaining.split(":");
|
|
9191
9504
|
if (parts.length >= 2) {
|
|
9192
|
-
const
|
|
9505
|
+
const prop2 = parts[0].trim();
|
|
9193
9506
|
const val = parts.slice(1).join(":").trim();
|
|
9194
|
-
if (
|
|
9195
|
-
content.push({ type: "declaration", property:
|
|
9507
|
+
if (prop2 && val) {
|
|
9508
|
+
content.push({ type: "declaration", property: prop2, value: val });
|
|
9196
9509
|
}
|
|
9197
9510
|
}
|
|
9198
9511
|
}
|
|
@@ -9233,10 +9546,10 @@ ${indentStr}}`;
|
|
|
9233
9546
|
} else if (statement.includes(":")) {
|
|
9234
9547
|
const parts = statement.split(":");
|
|
9235
9548
|
if (parts.length >= 2) {
|
|
9236
|
-
const
|
|
9549
|
+
const prop2 = parts[0].trim();
|
|
9237
9550
|
const val = parts.slice(1).join(":").trim();
|
|
9238
|
-
if (
|
|
9239
|
-
content.push({ type: "declaration", property:
|
|
9551
|
+
if (prop2 && val) {
|
|
9552
|
+
content.push({ type: "declaration", property: prop2, value: val });
|
|
9240
9553
|
}
|
|
9241
9554
|
}
|
|
9242
9555
|
}
|
|
@@ -9335,7 +9648,7 @@ ${indentStr}}`;
|
|
|
9335
9648
|
}
|
|
9336
9649
|
static _declarationsToCSS(declarations, indent) {
|
|
9337
9650
|
const indentStr = " ".repeat(indent);
|
|
9338
|
-
return Object.entries(declarations).map(([
|
|
9651
|
+
return Object.entries(declarations).map(([prop2, value]) => `${indentStr}${_CssParser._camelToKebab(prop2)}: ${value};`).join("\n");
|
|
9339
9652
|
}
|
|
9340
9653
|
static _camelToKebab(camelCase) {
|
|
9341
9654
|
return camelCase.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
@@ -10861,59 +11174,29 @@ ${indentStr}}`;
|
|
|
10861
11174
|
};
|
|
10862
11175
|
}
|
|
10863
11176
|
|
|
11177
|
+
// ../core/dist/esm/hash/HashUtils.js
|
|
11178
|
+
var HashUtils;
|
|
11179
|
+
((HashUtils2) => {
|
|
11180
|
+
const core53 = (str, seed) => {
|
|
11181
|
+
let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
|
|
11182
|
+
for (let i = 0; i < str.length; i++) {
|
|
11183
|
+
const ch = str.charCodeAt(i);
|
|
11184
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
11185
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
11186
|
+
}
|
|
11187
|
+
h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
|
|
11188
|
+
h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
|
|
11189
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, "0");
|
|
11190
|
+
};
|
|
11191
|
+
HashUtils2.hash53 = (str, seed = 0, xyz = 16) => `${core53(str, seed)}${core53(str, seed + 1)}`.slice(0, Math.max(1, xyz));
|
|
11192
|
+
})(HashUtils || (HashUtils = {}));
|
|
11193
|
+
|
|
10864
11194
|
// ../core/dist/esm/index.js
|
|
10865
11195
|
var src_default = {
|
|
10866
11196
|
// Core utilities are exported as named exports above
|
|
10867
11197
|
// Use: import { Observable, Subject, Promises, ... } from '@dooboostore/core'
|
|
10868
11198
|
};
|
|
10869
11199
|
|
|
10870
|
-
// src/decorators/addEventListener.ts
|
|
10871
|
-
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
10872
|
-
function addEventListener(selectorOrTarget, type, options = {}) {
|
|
10873
|
-
return (targetObj, propertyKey, descriptor) => {
|
|
10874
|
-
const constructor = targetObj.constructor;
|
|
10875
|
-
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10876
|
-
if (!listeners) {
|
|
10877
|
-
listeners = [];
|
|
10878
|
-
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
10879
|
-
}
|
|
10880
|
-
listeners.push({ propertyKey, selector: selectorOrTarget, type, options });
|
|
10881
|
-
};
|
|
10882
|
-
}
|
|
10883
|
-
function addEventListenerDelegateLightDom(selector, type, options) {
|
|
10884
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
10885
|
-
}
|
|
10886
|
-
function addEventListenerDelegateShadowDom(selector, type, options) {
|
|
10887
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
10888
|
-
}
|
|
10889
|
-
function addEventListenerDelegateAllDom(selector, type, options) {
|
|
10890
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
10891
|
-
}
|
|
10892
|
-
function addEventListenerDelegate(selector, type, options) {
|
|
10893
|
-
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
10894
|
-
}
|
|
10895
|
-
var event = addEventListener;
|
|
10896
|
-
var eventDelegateLightDom = addEventListenerDelegateLightDom;
|
|
10897
|
-
var eventDelegateShadowDom = addEventListenerDelegateShadowDom;
|
|
10898
|
-
var eventDelegateAllDom = addEventListenerDelegateAllDom;
|
|
10899
|
-
var eventDelegate = addEventListenerDelegate;
|
|
10900
|
-
function addEventListenerThis(type, options) {
|
|
10901
|
-
return addEventListener("$this", type, options);
|
|
10902
|
-
}
|
|
10903
|
-
function addEventListenerAppHost(type, options) {
|
|
10904
|
-
return addEventListener("$appHost", type, options);
|
|
10905
|
-
}
|
|
10906
|
-
function addEventListenerWindow(type, options) {
|
|
10907
|
-
return addEventListener("$window", type, options);
|
|
10908
|
-
}
|
|
10909
|
-
function addEventListenerDocument(type, options) {
|
|
10910
|
-
return addEventListener("$document", type, options);
|
|
10911
|
-
}
|
|
10912
|
-
var getAddEventListenerMetadata = (target) => {
|
|
10913
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
10914
|
-
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
10915
|
-
};
|
|
10916
|
-
|
|
10917
11200
|
// ../core/dist/esm/message/operators/debounceTime.js
|
|
10918
11201
|
function debounceTime(duration, config) {
|
|
10919
11202
|
return (source) => {
|
|
@@ -11063,157 +11346,6 @@ ${indentStr}}`;
|
|
|
11063
11346
|
};
|
|
11064
11347
|
}
|
|
11065
11348
|
|
|
11066
|
-
// src/decorators/lifecycles.ts
|
|
11067
|
-
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
11068
|
-
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
11069
|
-
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
11070
|
-
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
11071
|
-
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
11072
|
-
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
11073
|
-
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
11074
|
-
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
11075
|
-
var ON_CONNECTED_BODY_METADATA_KEY = Symbol.for("simple-web-component:on-connected-body");
|
|
11076
|
-
var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
|
|
11077
|
-
var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
|
|
11078
|
-
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
11079
|
-
function onConnectedBefore(arg1, arg2, arg3) {
|
|
11080
|
-
const decorator2 = (options, target, propertyKey) => {
|
|
11081
|
-
const constructor = target.constructor;
|
|
11082
|
-
let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
|
|
11083
|
-
if (!list) {
|
|
11084
|
-
list = [];
|
|
11085
|
-
ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
|
|
11086
|
-
}
|
|
11087
|
-
list.push({ propertyKey, options });
|
|
11088
|
-
};
|
|
11089
|
-
if (arg2) {
|
|
11090
|
-
return decorator2({}, arg1, arg2);
|
|
11091
|
-
}
|
|
11092
|
-
return (target, propertyKey) => {
|
|
11093
|
-
decorator2(arg1 || {}, target, propertyKey);
|
|
11094
|
-
};
|
|
11095
|
-
}
|
|
11096
|
-
function onConnectedAfter(arg1, arg2, arg3) {
|
|
11097
|
-
const decorator2 = (options, target, propertyKey) => {
|
|
11098
|
-
const constructor = target.constructor;
|
|
11099
|
-
let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
|
|
11100
|
-
if (!list) {
|
|
11101
|
-
list = [];
|
|
11102
|
-
ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
|
|
11103
|
-
}
|
|
11104
|
-
list.push({ propertyKey, options });
|
|
11105
|
-
};
|
|
11106
|
-
if (arg2) {
|
|
11107
|
-
return decorator2({}, arg1, arg2);
|
|
11108
|
-
}
|
|
11109
|
-
return (target, propertyKey) => {
|
|
11110
|
-
decorator2(arg1 || {}, target, propertyKey);
|
|
11111
|
-
};
|
|
11112
|
-
}
|
|
11113
|
-
function createLifecycleDecoratorWithOptions(metadataKey) {
|
|
11114
|
-
return function(optionOrTarget, propertyKey) {
|
|
11115
|
-
if (propertyKey) {
|
|
11116
|
-
const constructor = optionOrTarget.constructor;
|
|
11117
|
-
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
11118
|
-
if (!list) {
|
|
11119
|
-
list = [];
|
|
11120
|
-
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
11121
|
-
}
|
|
11122
|
-
list.push({ propertyKey, order: 0 });
|
|
11123
|
-
return;
|
|
11124
|
-
}
|
|
11125
|
-
return (target, propertyKey2) => {
|
|
11126
|
-
const constructor = target.constructor;
|
|
11127
|
-
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
11128
|
-
if (!list) {
|
|
11129
|
-
list = [];
|
|
11130
|
-
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
11131
|
-
}
|
|
11132
|
-
list.push({ propertyKey: propertyKey2, order: optionOrTarget?.order ?? 0 });
|
|
11133
|
-
};
|
|
11134
|
-
};
|
|
11135
|
-
}
|
|
11136
|
-
function onInitialize(optionOrTarget, propertyKey) {
|
|
11137
|
-
return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11138
|
-
}
|
|
11139
|
-
function onDisconnectedBefore(optionOrTarget, propertyKey) {
|
|
11140
|
-
return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11141
|
-
}
|
|
11142
|
-
function onDisconnectedAfter(optionOrTarget, propertyKey) {
|
|
11143
|
-
return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11144
|
-
}
|
|
11145
|
-
var onDisconnected = onDisconnectedAfter;
|
|
11146
|
-
function onAdoptedBefore(optionOrTarget, propertyKey) {
|
|
11147
|
-
return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11148
|
-
}
|
|
11149
|
-
function onAdoptedAfter(optionOrTarget, propertyKey) {
|
|
11150
|
-
return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11151
|
-
}
|
|
11152
|
-
var onAdopted = onAdoptedAfter;
|
|
11153
|
-
function onConnectedSwcApp(optionOrTarget, propertyKey) {
|
|
11154
|
-
return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11155
|
-
}
|
|
11156
|
-
function onConnectedCompleted(optionOrTarget, propertyKey) {
|
|
11157
|
-
return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
11158
|
-
}
|
|
11159
|
-
var decorator = (options, target, propertyKey) => {
|
|
11160
|
-
const constructor = target.constructor;
|
|
11161
|
-
let list = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor);
|
|
11162
|
-
if (!list) {
|
|
11163
|
-
list = [];
|
|
11164
|
-
ReflectUtils.defineMetadata(ON_CONNECTED_BODY_METADATA_KEY, list, constructor);
|
|
11165
|
-
}
|
|
11166
|
-
list.push({ propertyKey, options });
|
|
11167
|
-
};
|
|
11168
|
-
function onConnectedBodyShadow(optionOrTarget, propertyKey, arg3) {
|
|
11169
|
-
if (propertyKey) {
|
|
11170
|
-
return decorator({ useShadow: true }, optionOrTarget, propertyKey);
|
|
11171
|
-
}
|
|
11172
|
-
return (target, propertyKey2) => {
|
|
11173
|
-
decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
|
|
11174
|
-
};
|
|
11175
|
-
}
|
|
11176
|
-
function onConnectedBodyLight(optionOrTarget, propertyKey, arg3) {
|
|
11177
|
-
if (propertyKey) {
|
|
11178
|
-
return decorator({ useShadow: false }, optionOrTarget, propertyKey);
|
|
11179
|
-
}
|
|
11180
|
-
return (target, propertyKey2) => {
|
|
11181
|
-
decorator({ ...optionOrTarget ?? {}, useShadow: false }, target, propertyKey2);
|
|
11182
|
-
};
|
|
11183
|
-
}
|
|
11184
|
-
function onConnectedBody(optionOrTarget, propertyKey, arg3) {
|
|
11185
|
-
if (propertyKey) {
|
|
11186
|
-
return decorator({}, optionOrTarget, propertyKey);
|
|
11187
|
-
}
|
|
11188
|
-
return (target, propertyKey2) => {
|
|
11189
|
-
decorator(optionOrTarget || {}, target, propertyKey2);
|
|
11190
|
-
};
|
|
11191
|
-
}
|
|
11192
|
-
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
11193
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11194
|
-
const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) ?? [];
|
|
11195
|
-
return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
11196
|
-
};
|
|
11197
|
-
var findAllOnConnectedMetadata = (target) => {
|
|
11198
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11199
|
-
const results = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor) ?? [];
|
|
11200
|
-
return [...results].sort((a, b) => {
|
|
11201
|
-
const orderA = a.options?.order ?? 0;
|
|
11202
|
-
const orderB = b.options?.order ?? 0;
|
|
11203
|
-
return orderA - orderB;
|
|
11204
|
-
});
|
|
11205
|
-
};
|
|
11206
|
-
var findAllOnConnectedBeforeMetadata = (target) => {
|
|
11207
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11208
|
-
const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
11209
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
11210
|
-
};
|
|
11211
|
-
var findAllOnConnectedAfterMetadata = (target) => {
|
|
11212
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
11213
|
-
const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
11214
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
11215
|
-
};
|
|
11216
|
-
|
|
11217
11349
|
// ../core-web/dist/esm/index.js
|
|
11218
11350
|
var esm_exports2 = {};
|
|
11219
11351
|
__export(esm_exports2, {
|
|
@@ -11371,7 +11503,7 @@ ${indentStr}}`;
|
|
|
11371
11503
|
return Array.from(documentFragment.childNodes);
|
|
11372
11504
|
};
|
|
11373
11505
|
ElementUtils2.cloneNodeList = (documentFragment) => {
|
|
11374
|
-
return Array.from(documentFragment.childNodes).map((
|
|
11506
|
+
return Array.from(documentFragment.childNodes).map((node2) => node2.cloneNode(true));
|
|
11375
11507
|
};
|
|
11376
11508
|
ElementUtils2.querySelector = (e, selector) => {
|
|
11377
11509
|
const elements = ElementUtils2.querySelectorAll(e, selector);
|
|
@@ -11434,12 +11566,12 @@ ${indentStr}}`;
|
|
|
11434
11566
|
return attribute2;
|
|
11435
11567
|
};
|
|
11436
11568
|
ElementUtils2.getStyleToObject = (input) => {
|
|
11437
|
-
const
|
|
11569
|
+
const style2 = {};
|
|
11438
11570
|
for (let i = 0; i < input.style.length; i++) {
|
|
11439
11571
|
const key = input.style[i];
|
|
11440
|
-
|
|
11572
|
+
style2[key] = input.style[key];
|
|
11441
11573
|
}
|
|
11442
|
-
return
|
|
11574
|
+
return style2;
|
|
11443
11575
|
};
|
|
11444
11576
|
})(ElementUtils || (ElementUtils = {}));
|
|
11445
11577
|
|
|
@@ -11473,26 +11605,26 @@ ${indentStr}}`;
|
|
|
11473
11605
|
}
|
|
11474
11606
|
return variables;
|
|
11475
11607
|
}
|
|
11476
|
-
getTarget(
|
|
11477
|
-
if (
|
|
11478
|
-
const fullStr =
|
|
11608
|
+
getTarget(node2, id) {
|
|
11609
|
+
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`)) {
|
|
11610
|
+
const fullStr = node2.data?.trim?.();
|
|
11479
11611
|
let [prefix, ...rest] = fullStr?.split(" ") ?? [];
|
|
11480
11612
|
prefix = prefix.trim?.();
|
|
11481
11613
|
const script = rest.join(" ");
|
|
11482
11614
|
const [eaPrefix, eaId, startEnd, type] = prefix?.split(":") ?? [];
|
|
11483
11615
|
const endPrefix = `${eaPrefix}:${eaId}:end:${type}`;
|
|
11484
|
-
let next =
|
|
11616
|
+
let next = node2.nextSibling;
|
|
11485
11617
|
while (next) {
|
|
11486
11618
|
if (next.nodeType === Node.COMMENT_NODE && next.data?.trim?.()?.startsWith(endPrefix)) {
|
|
11487
|
-
return { nodeType: "comment", type, start:
|
|
11619
|
+
return { nodeType: "comment", type, start: node2, end: next, script: script ?? "", variables: this.findVariables(script) };
|
|
11488
11620
|
}
|
|
11489
11621
|
next = next.nextSibling;
|
|
11490
11622
|
}
|
|
11491
|
-
} else if (
|
|
11492
|
-
const aa =
|
|
11623
|
+
} else if (node2.nodeType === Node.ELEMENT_NODE) {
|
|
11624
|
+
const aa = node2.getAttributeNames().filter((name) => {
|
|
11493
11625
|
return name.startsWith(`ea:${id}:attribute:`) || name.startsWith(`ea:${id}:event:`) || name.startsWith(`ea:${id}:property:`);
|
|
11494
11626
|
});
|
|
11495
|
-
const element =
|
|
11627
|
+
const element = node2;
|
|
11496
11628
|
const types = aa.map((attrName) => {
|
|
11497
11629
|
const [eaPrefix, eaId, type, name] = attrName?.split(":") ?? [];
|
|
11498
11630
|
if (eaPrefix === "ea" && eaId === id && (type === "attribute" || type === "event" || type === "property") && name) {
|
|
@@ -11524,8 +11656,8 @@ ${indentStr}}`;
|
|
|
11524
11656
|
const targets = [];
|
|
11525
11657
|
targetRoots.forEach((el) => {
|
|
11526
11658
|
const walker = this.document.createTreeWalker(el, this.window.NodeFilter.SHOW_ELEMENT | this.window.NodeFilter.SHOW_COMMENT, {
|
|
11527
|
-
acceptNode: (
|
|
11528
|
-
const target = this.getTarget(
|
|
11659
|
+
acceptNode: (node2) => {
|
|
11660
|
+
const target = this.getTarget(node2, this.id);
|
|
11529
11661
|
if (target) {
|
|
11530
11662
|
targets.push(target);
|
|
11531
11663
|
return this.window.NodeFilter.FILTER_ACCEPT;
|
|
@@ -11688,18 +11820,18 @@ ${indentStr}}`;
|
|
|
11688
11820
|
FindNodesFilterResult2["NO_MATCH_AND_CONTINUE"] = "NO_MATCH_AND_CONTINUE";
|
|
11689
11821
|
FindNodesFilterResult2["NO_MATCH_AND_SKIP_CHILDREN"] = "NO_MATCH_AND_SKIP_CHILDREN";
|
|
11690
11822
|
})(FindNodesFilterResult = NodeUtils2.FindNodesFilterResult || (NodeUtils2.FindNodesFilterResult = {}));
|
|
11691
|
-
NodeUtils2.removeAllChildNode = (
|
|
11692
|
-
while (
|
|
11693
|
-
|
|
11823
|
+
NodeUtils2.removeAllChildNode = (node2) => {
|
|
11824
|
+
while (node2?.firstChild) {
|
|
11825
|
+
node2.firstChild.remove();
|
|
11694
11826
|
}
|
|
11695
11827
|
};
|
|
11696
|
-
NodeUtils2.removeAllChildNodeAndAppend = (
|
|
11697
|
-
(0, NodeUtils2.removeAllChildNode)(
|
|
11828
|
+
NodeUtils2.removeAllChildNodeAndAppend = (node2, newNode) => {
|
|
11829
|
+
(0, NodeUtils2.removeAllChildNode)(node2);
|
|
11698
11830
|
if (Array.isArray(newNode)) {
|
|
11699
|
-
newNode.forEach((it) =>
|
|
11831
|
+
newNode.forEach((it) => node2.appendChild(it));
|
|
11700
11832
|
return;
|
|
11701
11833
|
}
|
|
11702
|
-
|
|
11834
|
+
node2.appendChild(newNode);
|
|
11703
11835
|
};
|
|
11704
11836
|
NodeUtils2.appendChild = (parentNode, childNode) => {
|
|
11705
11837
|
return parentNode.appendChild(childNode);
|
|
@@ -11715,11 +11847,11 @@ ${indentStr}}`;
|
|
|
11715
11847
|
};
|
|
11716
11848
|
NodeUtils2.findNodes = (rootNode, filter) => {
|
|
11717
11849
|
const foundNodes = [];
|
|
11718
|
-
function traverse(
|
|
11719
|
-
if (!
|
|
11850
|
+
function traverse(node2) {
|
|
11851
|
+
if (!node2) {
|
|
11720
11852
|
return;
|
|
11721
11853
|
}
|
|
11722
|
-
|
|
11854
|
+
node2.childNodes.forEach((child) => {
|
|
11723
11855
|
const result = filter(child);
|
|
11724
11856
|
if (result === "MATCH_AND_CONTINUE" || result === "MATCH_AND_SKIP_CHILDREN") {
|
|
11725
11857
|
foundNodes.push(child);
|
|
@@ -11962,26 +12094,26 @@ ${indentStr}}`;
|
|
|
11962
12094
|
if (!doc || !win) return result;
|
|
11963
12095
|
const find = (target) => {
|
|
11964
12096
|
const walker = doc.createTreeWalker(target, win.NodeFilter.SHOW_COMMENT, null, false);
|
|
11965
|
-
let
|
|
12097
|
+
let node2 = walker.nextNode();
|
|
11966
12098
|
const markerData = targetId ? _NodeSlot.startEndMarkerData(this.id, targetId) : { start: this.startMarkerData, end: this.endMarkerData };
|
|
11967
12099
|
const startPrefix = markerData.start + ":";
|
|
11968
|
-
while (
|
|
11969
|
-
const data =
|
|
12100
|
+
while (node2) {
|
|
12101
|
+
const data = node2.data;
|
|
11970
12102
|
if (data && data.indexOf(startPrefix) === 0) {
|
|
11971
12103
|
const uid = data.substring(startPrefix.length);
|
|
11972
12104
|
const expectedEnd = `${markerData.end}:${uid}`;
|
|
11973
|
-
let sibling =
|
|
12105
|
+
let sibling = node2.nextSibling;
|
|
11974
12106
|
let foundEnd = null;
|
|
11975
12107
|
while (sibling) {
|
|
11976
|
-
if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode ===
|
|
12108
|
+
if (sibling.nodeType === win.Node.COMMENT_NODE && sibling.data === expectedEnd && sibling.parentNode === node2.parentNode) {
|
|
11977
12109
|
foundEnd = sibling;
|
|
11978
12110
|
break;
|
|
11979
12111
|
}
|
|
11980
12112
|
sibling = sibling.nextSibling;
|
|
11981
12113
|
}
|
|
11982
|
-
result.push(new Slot(
|
|
12114
|
+
result.push(new Slot(node2, foundEnd));
|
|
11983
12115
|
}
|
|
11984
|
-
|
|
12116
|
+
node2 = walker.nextNode();
|
|
11985
12117
|
}
|
|
11986
12118
|
};
|
|
11987
12119
|
if (this.host.shadowRoot) {
|
|
@@ -13302,7 +13434,7 @@ ${indentStr}}`;
|
|
|
13302
13434
|
try {
|
|
13303
13435
|
Array.from(sheet.cssRules).forEach((rule) => {
|
|
13304
13436
|
if ("style" in rule && rule.style instanceof CSSStyleDeclaration) {
|
|
13305
|
-
Array.from(rule.style).filter((
|
|
13437
|
+
Array.from(rule.style).filter((prop2) => prop2.startsWith("--")).forEach((prop2) => variables.add(prop2));
|
|
13306
13438
|
}
|
|
13307
13439
|
});
|
|
13308
13440
|
} catch (e) {
|
|
@@ -13311,7 +13443,7 @@ ${indentStr}}`;
|
|
|
13311
13443
|
});
|
|
13312
13444
|
}
|
|
13313
13445
|
const computedStyles = config.window.getComputedStyle(targetElement);
|
|
13314
|
-
Array.from(computedStyles).filter((
|
|
13446
|
+
Array.from(computedStyles).filter((prop2) => prop2.startsWith("--")).forEach((it) => {
|
|
13315
13447
|
variables.add(it);
|
|
13316
13448
|
});
|
|
13317
13449
|
return Array.from(variables).map((it) => [it, computedStyles.getPropertyValue(it)]);
|
|
@@ -13674,9 +13806,9 @@ ${indentStr}}`;
|
|
|
13674
13806
|
} else if (htmlOrNode) {
|
|
13675
13807
|
const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];
|
|
13676
13808
|
const window2 = document2.defaultView;
|
|
13677
|
-
nodes.forEach((
|
|
13678
|
-
|
|
13679
|
-
const nodes2 = document2.createTreeWalker(
|
|
13809
|
+
nodes.forEach((node2) => {
|
|
13810
|
+
node2.normalize();
|
|
13811
|
+
const nodes2 = document2.createTreeWalker(node2, window2.NodeFilter.SHOW_ELEMENT | window2.NodeFilter.SHOW_COMMENT);
|
|
13680
13812
|
const getSlotData = (s) => {
|
|
13681
13813
|
return s.match(/^\[\[([\s\S]+)\]\]$/)?.[1]?.trim();
|
|
13682
13814
|
};
|
|
@@ -13852,10 +13984,1116 @@ ${indentStr}}`;
|
|
|
13852
13984
|
};
|
|
13853
13985
|
})(SwcUtils || (SwcUtils = {}));
|
|
13854
13986
|
|
|
13855
|
-
// src/decorators/
|
|
13856
|
-
var
|
|
13857
|
-
function
|
|
13858
|
-
|
|
13987
|
+
// src/decorators/addEventListener.ts
|
|
13988
|
+
var ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:add-event-listener");
|
|
13989
|
+
function addEventListener(selectorOrType, typeOrOptions, maybeOptions) {
|
|
13990
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
13991
|
+
let selector;
|
|
13992
|
+
let types;
|
|
13993
|
+
let opts = {};
|
|
13994
|
+
if (typeof typeOrOptions === "string" || Array.isArray(typeOrOptions)) {
|
|
13995
|
+
selector = selectorOrType;
|
|
13996
|
+
types = Array.isArray(typeOrOptions) ? typeOrOptions : [typeOrOptions];
|
|
13997
|
+
opts = maybeOptions ?? {};
|
|
13998
|
+
} else {
|
|
13999
|
+
selector = "$this";
|
|
14000
|
+
if (Array.isArray(selectorOrType)) types = selectorOrType;
|
|
14001
|
+
else types = [selectorOrType];
|
|
14002
|
+
opts = typeOrOptions ?? {};
|
|
14003
|
+
}
|
|
14004
|
+
const constructor = targetObj.constructor;
|
|
14005
|
+
let listeners = ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
14006
|
+
if (!listeners) {
|
|
14007
|
+
listeners = [];
|
|
14008
|
+
ReflectUtils.defineMetadata(ADD_EVENT_LISTENER_METADATA_KEY, listeners, constructor);
|
|
14009
|
+
}
|
|
14010
|
+
for (const type of types) listeners.push({ propertyKey, selector, type, options: opts });
|
|
14011
|
+
};
|
|
14012
|
+
}
|
|
14013
|
+
function addEventListenerDelegateLight(selector, type, options) {
|
|
14014
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: true });
|
|
14015
|
+
}
|
|
14016
|
+
function addEventListenerDelegateShadow(selector, type, options) {
|
|
14017
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: true });
|
|
14018
|
+
}
|
|
14019
|
+
function addEventListenerDelegateAll(selector, type, options) {
|
|
14020
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: true });
|
|
14021
|
+
}
|
|
14022
|
+
function addEventListenerDelegate(selector, type, options) {
|
|
14023
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: true });
|
|
14024
|
+
}
|
|
14025
|
+
function addEventListenerMutationLight(selector, type, options) {
|
|
14026
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light", delegate: "mutation" });
|
|
14027
|
+
}
|
|
14028
|
+
function addEventListenerMutationShadow(selector, type, options) {
|
|
14029
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow", delegate: "mutation" });
|
|
14030
|
+
}
|
|
14031
|
+
function addEventListenerMutationAll(selector, type, options) {
|
|
14032
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all", delegate: "mutation" });
|
|
14033
|
+
}
|
|
14034
|
+
function addEventListenerMutation(selector, type, options) {
|
|
14035
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "auto", delegate: "mutation" });
|
|
14036
|
+
}
|
|
14037
|
+
function addEventListenerLight(selector, type, options) {
|
|
14038
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "light" });
|
|
14039
|
+
}
|
|
14040
|
+
function addEventListenerShadow(selector, type, options) {
|
|
14041
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "shadow" });
|
|
14042
|
+
}
|
|
14043
|
+
function addEventListenerAll(selector, type, options) {
|
|
14044
|
+
return addEventListener(selector, type, { ...options ?? {}, root: "all" });
|
|
14045
|
+
}
|
|
14046
|
+
function addEventListenerThis(type, options) {
|
|
14047
|
+
return addEventListener("$this", type, options);
|
|
14048
|
+
}
|
|
14049
|
+
function addEventListenerAppHost(type, options) {
|
|
14050
|
+
return addEventListener("$appHost", type, options);
|
|
14051
|
+
}
|
|
14052
|
+
function addEventListenerWindow(type, options) {
|
|
14053
|
+
return addEventListener("$window", type, options);
|
|
14054
|
+
}
|
|
14055
|
+
function addEventListenerDocument(type, options) {
|
|
14056
|
+
return addEventListener("$document", type, options);
|
|
14057
|
+
}
|
|
14058
|
+
var event = addEventListener;
|
|
14059
|
+
var eventDelegateLight = addEventListenerDelegateLight;
|
|
14060
|
+
var eventDelegateShadow = addEventListenerDelegateShadow;
|
|
14061
|
+
var eventDelegateAll = addEventListenerDelegateAll;
|
|
14062
|
+
var eventDelegate = addEventListenerDelegate;
|
|
14063
|
+
var eventMutationLight = addEventListenerMutationLight;
|
|
14064
|
+
var eventMutationShadow = addEventListenerMutationShadow;
|
|
14065
|
+
var eventMutationAll = addEventListenerMutationAll;
|
|
14066
|
+
var eventMutation = addEventListenerMutation;
|
|
14067
|
+
var eventLight = addEventListenerLight;
|
|
14068
|
+
var eventShadow = addEventListenerShadow;
|
|
14069
|
+
var eventAll = addEventListenerAll;
|
|
14070
|
+
var eventAppHost = addEventListenerAppHost;
|
|
14071
|
+
var eventWindow = addEventListenerWindow;
|
|
14072
|
+
var eventDocument = addEventListenerDocument;
|
|
14073
|
+
var eventThis = addEventListenerThis;
|
|
14074
|
+
var getAddEventListenerMetadata = (target) => {
|
|
14075
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14076
|
+
return ReflectUtils.getMetadata(ADD_EVENT_LISTENER_METADATA_KEY, constructor);
|
|
14077
|
+
};
|
|
14078
|
+
var EventListenerLifeCycler = class {
|
|
14079
|
+
constructor() {
|
|
14080
|
+
/** 인스턴스별 boundListeners 상태 (시클러는 elementDefine 시 1회 생성되어 공유되므로) */
|
|
14081
|
+
__publicField(this, "boundListenersMap", /* @__PURE__ */ new WeakMap());
|
|
14082
|
+
/** 인스턴스별 delegate:'mutation' 바인딩 추적 WeakSet — MutationObserverLifeCycler 에서 참조 */
|
|
14083
|
+
__publicField(this, "eventBoundSetsMap", /* @__PURE__ */ new WeakMap());
|
|
14084
|
+
}
|
|
14085
|
+
// ── 외부(MutationObserverLifeCycler)에서 직접 사용하는 공개 헬퍼 ──
|
|
14086
|
+
/** 인스턴스별 boundListeners 를 반환한다 (없으면 생성). */
|
|
14087
|
+
getBoundListeners(inst) {
|
|
14088
|
+
let list = this.boundListenersMap.get(inst);
|
|
14089
|
+
if (!list) {
|
|
14090
|
+
list = [];
|
|
14091
|
+
this.boundListenersMap.set(inst, list);
|
|
14092
|
+
}
|
|
14093
|
+
return list;
|
|
14094
|
+
}
|
|
14095
|
+
/** 인스턴스별 eventBoundSets 를 반환한다 (없으면 생성). */
|
|
14096
|
+
getEventBoundSets(inst) {
|
|
14097
|
+
let map = this.eventBoundSetsMap.get(inst);
|
|
14098
|
+
if (!map) {
|
|
14099
|
+
map = /* @__PURE__ */ new Map();
|
|
14100
|
+
this.eventBoundSetsMap.set(inst, map);
|
|
14101
|
+
}
|
|
14102
|
+
return map;
|
|
14103
|
+
}
|
|
14104
|
+
/**
|
|
14105
|
+
* target 에 meta 이벤트를 직접 바인딩한다.
|
|
14106
|
+
* delegate:'mutation' 초기/동적 바인딩에서 호출된다.
|
|
14107
|
+
*/
|
|
14108
|
+
bindDirect(helperHostSet, target, meta) {
|
|
14109
|
+
const inst = helperHostSet.$this;
|
|
14110
|
+
const currentWin = helperHostSet.$w;
|
|
14111
|
+
const { type, options } = meta;
|
|
14112
|
+
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
14113
|
+
const handler = async (event2) => {
|
|
14114
|
+
if (options.filter) {
|
|
14115
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, target);
|
|
14116
|
+
if (!options.filter(event2, { currentThis: inst, helper })) return;
|
|
14117
|
+
}
|
|
14118
|
+
if (options.stopPropagation) event2.stopPropagation();
|
|
14119
|
+
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
14120
|
+
if (options.preventDefault) event2.preventDefault();
|
|
14121
|
+
const currentHostSet = SwcUtils.getHostSet(inst);
|
|
14122
|
+
await inst[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, { event: event2, ...currentHostSet, $el: target, $root: target });
|
|
14123
|
+
};
|
|
14124
|
+
const eventSubject = new Subject();
|
|
14125
|
+
let eventStream = eventSubject;
|
|
14126
|
+
if (options.debounceTime && options.debounceTime > 0)
|
|
14127
|
+
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
14128
|
+
if (options.throttleTime && options.throttleTime > 0)
|
|
14129
|
+
eventStream = eventStream.pipe(throttleTime2(options.throttleTime));
|
|
14130
|
+
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
14131
|
+
eventStream = typeof options.distinctUntilChanged === "function" ? eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged)) : eventStream.pipe(distinctUntilChanged());
|
|
14132
|
+
}
|
|
14133
|
+
const subscription = eventStream.subscribe({
|
|
14134
|
+
next: (e) => handler(e).catch((err) => console.error("Event handler error:", err)),
|
|
14135
|
+
error: (err) => console.error("Event stream error:", err)
|
|
14136
|
+
});
|
|
14137
|
+
const wrappedHandler = (event2) => eventSubject.next(event2);
|
|
14138
|
+
target.addEventListener(type, wrappedHandler, opts);
|
|
14139
|
+
const onRemoves = options.removeListener ? [{ fn: options.removeListener, opts: options }] : [];
|
|
14140
|
+
this.getBoundListeners(inst).push({ target, type, handler: wrappedHandler, options: opts, subscription, onRemoves, meta });
|
|
14141
|
+
}
|
|
14142
|
+
/** target + meta 조합 리스너를 제거한다. MutationObserver 추적 요소 제거 시 호출. */
|
|
14143
|
+
unbindDirect(helperHostSet, target, meta) {
|
|
14144
|
+
const inst = helperHostSet.$this;
|
|
14145
|
+
const list = this.getBoundListeners(inst);
|
|
14146
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
14147
|
+
const l = list[i];
|
|
14148
|
+
if (l.target === target && l.type === meta.type && l.meta === meta) {
|
|
14149
|
+
try {
|
|
14150
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
14151
|
+
l.subscription?.unsubscribe?.();
|
|
14152
|
+
} catch (e) {
|
|
14153
|
+
console.error("[SWC] unbindDirect error:", e);
|
|
14154
|
+
}
|
|
14155
|
+
for (const r of l.onRemoves ?? []) {
|
|
14156
|
+
try {
|
|
14157
|
+
r.fn(l.target, r.opts);
|
|
14158
|
+
} catch (e) {
|
|
14159
|
+
console.error("[SWC] unbindDirect removeListener error:", e);
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
list.splice(i, 1);
|
|
14163
|
+
}
|
|
14164
|
+
}
|
|
14165
|
+
}
|
|
14166
|
+
/**
|
|
14167
|
+
* 메타데이터 목록을 delegate / mutationDelegate / nonDelegate 로 분류한다.
|
|
14168
|
+
* MutationObserverLifeCycler 에서 mutationDelegate 목록을 꺼낼 때 사용한다.
|
|
14169
|
+
*/
|
|
14170
|
+
classifyListeners(metaList) {
|
|
14171
|
+
const isSpecial = (sel) => [
|
|
14172
|
+
"$window",
|
|
14173
|
+
"$document",
|
|
14174
|
+
"$host",
|
|
14175
|
+
"$appHost",
|
|
14176
|
+
"$firstHost",
|
|
14177
|
+
"$lastHost",
|
|
14178
|
+
"$firstAppHost",
|
|
14179
|
+
"$lastAppHost",
|
|
14180
|
+
"$hosts",
|
|
14181
|
+
"$appHosts",
|
|
14182
|
+
"$this",
|
|
14183
|
+
""
|
|
14184
|
+
].includes(sel);
|
|
14185
|
+
const delegateListeners = [];
|
|
14186
|
+
const mutationDelegateListeners = [];
|
|
14187
|
+
const nonDelegateListeners = [];
|
|
14188
|
+
for (const meta of metaList) {
|
|
14189
|
+
const isStr = typeof meta.selector === "string";
|
|
14190
|
+
const mode = meta.options.delegate;
|
|
14191
|
+
if (mode && isStr && !isSpecial(meta.selector)) {
|
|
14192
|
+
mode === "mutation" ? mutationDelegateListeners.push(meta) : delegateListeners.push(meta);
|
|
14193
|
+
} else {
|
|
14194
|
+
nonDelegateListeners.push(meta);
|
|
14195
|
+
}
|
|
14196
|
+
}
|
|
14197
|
+
return { delegateListeners, mutationDelegateListeners, nonDelegateListeners };
|
|
14198
|
+
}
|
|
14199
|
+
// ── ElementDefineLifeCycler 구현 ──
|
|
14200
|
+
onConnected(helperHostSet) {
|
|
14201
|
+
const inst = helperHostSet.$this;
|
|
14202
|
+
const currentWin = helperHostSet.$w;
|
|
14203
|
+
this.boundListenersMap.delete(inst);
|
|
14204
|
+
this.eventBoundSetsMap.delete(inst);
|
|
14205
|
+
const allMeta = getAddEventListenerMetadata(inst) ?? [];
|
|
14206
|
+
const { delegateListeners, nonDelegateListeners, mutationDelegateListeners } = this.classifyListeners(allMeta);
|
|
14207
|
+
const groups = /* @__PURE__ */ new Map();
|
|
14208
|
+
for (const meta of delegateListeners) {
|
|
14209
|
+
const key = `${meta.type}:${meta.options.root || "auto"}`;
|
|
14210
|
+
if (!groups.has(key)) groups.set(key, []);
|
|
14211
|
+
groups.get(key).push(meta);
|
|
14212
|
+
}
|
|
14213
|
+
groups.forEach((metaList, key) => {
|
|
14214
|
+
const ci = key.indexOf(":");
|
|
14215
|
+
const type = key.slice(0, ci);
|
|
14216
|
+
const r = key.slice(ci + 1);
|
|
14217
|
+
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
14218
|
+
const roots = [];
|
|
14219
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
14220
|
+
else if (r === "light") roots.push(inst);
|
|
14221
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
14222
|
+
else if (r === "all") {
|
|
14223
|
+
roots.push(inst);
|
|
14224
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
14225
|
+
}
|
|
14226
|
+
for (const br of roots) {
|
|
14227
|
+
const sorted = [...metaList].sort((a, b) => (b.options.stopPropagation ? 1 : 0) - (a.options.stopPropagation ? 1 : 0));
|
|
14228
|
+
const handler = async (event2) => {
|
|
14229
|
+
for (const m of sorted) {
|
|
14230
|
+
const matchedEl = event2.target?.closest(m.selector);
|
|
14231
|
+
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);
|
|
14232
|
+
if (matchedEl && br.contains(matchedEl)) {
|
|
14233
|
+
if (m.options.filter) {
|
|
14234
|
+
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
14235
|
+
if (!m.options.filter(event2, { currentThis: inst, helper })) continue;
|
|
14236
|
+
}
|
|
14237
|
+
if (m.options.stopPropagation) event2.stopPropagation();
|
|
14238
|
+
if (m.options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
14239
|
+
if (m.options.preventDefault) event2.preventDefault();
|
|
14240
|
+
const hs = SwcUtils.getHostSet(inst);
|
|
14241
|
+
await inst[m.propertyKey](event2, { ...hs, $matchedElement: matchedEl }, { event: event2, ...hs, $el: matchedEl, $root: br });
|
|
14242
|
+
if (event2.cancelBubble) break;
|
|
14243
|
+
}
|
|
14244
|
+
}
|
|
14245
|
+
};
|
|
14246
|
+
br.addEventListener(type, handler, opts);
|
|
14247
|
+
if (type === "click") {
|
|
14248
|
+
console.log("[DBG][eventCycler] bound click on br=", br.tagName || br.constructor?.name, "| inst=", inst.tagName || inst.constructor?.name, "| isSame=", br === inst);
|
|
14249
|
+
}
|
|
14250
|
+
const onRemoves = sorted.filter((m) => m.options.removeListener).map((m) => ({ fn: m.options.removeListener, opts: m.options }));
|
|
14251
|
+
this.getBoundListeners(inst).push({ target: br, type, handler, options: opts, onRemoves });
|
|
14252
|
+
}
|
|
14253
|
+
});
|
|
14254
|
+
for (const meta of nonDelegateListeners) {
|
|
14255
|
+
const { selector, options } = meta;
|
|
14256
|
+
const r = options.root || "auto";
|
|
14257
|
+
const bindTargets = [];
|
|
14258
|
+
let resolvedSel = null;
|
|
14259
|
+
if (typeof selector === "function") {
|
|
14260
|
+
const result = selector(inst, helperHostSet);
|
|
14261
|
+
if (typeof result === "string") resolvedSel = result;
|
|
14262
|
+
else if (result instanceof currentWin.Element) bindTargets.push(result);
|
|
14263
|
+
else if (result instanceof currentWin.NodeList) bindTargets.push(...Array.from(result));
|
|
14264
|
+
else if (Array.isArray(result)) bindTargets.push(...result);
|
|
14265
|
+
} else {
|
|
14266
|
+
resolvedSel = selector;
|
|
14267
|
+
}
|
|
14268
|
+
const applyRoot = (t) => {
|
|
14269
|
+
if (!t) return;
|
|
14270
|
+
if (r === "auto") bindTargets.push(t.shadowRoot || t);
|
|
14271
|
+
else {
|
|
14272
|
+
if (r === "light" || r === "all") bindTargets.push(t);
|
|
14273
|
+
if ((r === "shadow" || r === "all") && t.shadowRoot) bindTargets.push(t.shadowRoot);
|
|
14274
|
+
}
|
|
14275
|
+
};
|
|
14276
|
+
if (resolvedSel) {
|
|
14277
|
+
if (resolvedSel === "$window") bindTargets.push(currentWin);
|
|
14278
|
+
else if (resolvedSel === "$document") bindTargets.push(currentWin.document);
|
|
14279
|
+
else if (resolvedSel === "$host") applyRoot(helperHostSet.$host);
|
|
14280
|
+
else if (resolvedSel === "$parentHost") applyRoot(helperHostSet.$parentHost);
|
|
14281
|
+
else if (resolvedSel === "$appHost") applyRoot(helperHostSet.$appHost);
|
|
14282
|
+
else if (resolvedSel === "$firstHost") applyRoot(helperHostSet.$firstHost);
|
|
14283
|
+
else if (resolvedSel === "$lastHost") applyRoot(helperHostSet.$lastHost);
|
|
14284
|
+
else if (resolvedSel === "$firstAppHost") applyRoot(helperHostSet.$firstAppHost);
|
|
14285
|
+
else if (resolvedSel === "$lastAppHost") applyRoot(helperHostSet.$lastAppHost);
|
|
14286
|
+
else if (resolvedSel === "$hosts") helperHostSet.$hosts.forEach(applyRoot);
|
|
14287
|
+
else if (resolvedSel === "$appHosts") helperHostSet.$appHosts.forEach(applyRoot);
|
|
14288
|
+
else if (resolvedSel === "$this" || !resolvedSel) applyRoot(inst);
|
|
14289
|
+
else {
|
|
14290
|
+
const searchRoots = [];
|
|
14291
|
+
if (r === "auto") searchRoots.push(inst.shadowRoot || inst);
|
|
14292
|
+
else if (r === "light") searchRoots.push(inst);
|
|
14293
|
+
else if (r === "shadow" && inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
14294
|
+
else if (r === "all") {
|
|
14295
|
+
searchRoots.push(inst);
|
|
14296
|
+
if (inst.shadowRoot) searchRoots.push(inst.shadowRoot);
|
|
14297
|
+
}
|
|
14298
|
+
for (const sr of searchRoots) sr.querySelectorAll(resolvedSel).forEach((el) => bindTargets.push(el));
|
|
14299
|
+
}
|
|
14300
|
+
}
|
|
14301
|
+
for (const t of bindTargets) this.bindDirect(helperHostSet, t, meta);
|
|
14302
|
+
}
|
|
14303
|
+
if (mutationDelegateListeners.length > 0) {
|
|
14304
|
+
const shadowEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
14305
|
+
const r = m.options.root || "auto";
|
|
14306
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
14307
|
+
});
|
|
14308
|
+
const lightEventDelegates = mutationDelegateListeners.filter((m) => {
|
|
14309
|
+
const r = m.options.root || "auto";
|
|
14310
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
14311
|
+
});
|
|
14312
|
+
const buildMutationEntry = (root, eventDelegates) => {
|
|
14313
|
+
if (eventDelegates.length === 0) return null;
|
|
14314
|
+
const boundSets = this.getEventBoundSets(inst);
|
|
14315
|
+
const callback = (mutations, obs) => {
|
|
14316
|
+
for (const m of eventDelegates) {
|
|
14317
|
+
let boundSet = boundSets.get(m);
|
|
14318
|
+
if (!boundSet) {
|
|
14319
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
14320
|
+
boundSets.set(m, boundSet);
|
|
14321
|
+
}
|
|
14322
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
14323
|
+
const matchesSel = (n) => {
|
|
14324
|
+
if (!n || n.nodeType !== 1) return false;
|
|
14325
|
+
if (isThis) return true;
|
|
14326
|
+
return typeof m.selector === "string" && n.matches?.(m.selector);
|
|
14327
|
+
};
|
|
14328
|
+
const bindEl = (el) => {
|
|
14329
|
+
if (!boundSet.has(el)) {
|
|
14330
|
+
this.bindDirect(helperHostSet, el, m);
|
|
14331
|
+
boundSet.add(el);
|
|
14332
|
+
}
|
|
14333
|
+
};
|
|
14334
|
+
const unbindEl = (el) => {
|
|
14335
|
+
if (boundSet.has(el)) {
|
|
14336
|
+
this.unbindDirect(helperHostSet, el, m);
|
|
14337
|
+
boundSet.delete(el);
|
|
14338
|
+
}
|
|
14339
|
+
};
|
|
14340
|
+
for (const mut of mutations) {
|
|
14341
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
14342
|
+
if (n.nodeType !== 1) return;
|
|
14343
|
+
if (matchesSel(n)) bindEl(n);
|
|
14344
|
+
else if (!isThis && typeof m.selector === "string") n.querySelectorAll?.(m.selector).forEach(bindEl);
|
|
14345
|
+
});
|
|
14346
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
14347
|
+
if (n.nodeType !== 1) return;
|
|
14348
|
+
const el = n;
|
|
14349
|
+
if (matchesSel(el)) unbindEl(el);
|
|
14350
|
+
else if (!isThis && typeof m.selector === "string") el.querySelectorAll?.(m.selector).forEach(unbindEl);
|
|
14351
|
+
});
|
|
14352
|
+
}
|
|
14353
|
+
}
|
|
14354
|
+
};
|
|
14355
|
+
for (const m of eventDelegates) {
|
|
14356
|
+
let boundSet = boundSets.get(m);
|
|
14357
|
+
if (!boundSet) {
|
|
14358
|
+
boundSet = /* @__PURE__ */ new WeakSet();
|
|
14359
|
+
boundSets.set(m, boundSet);
|
|
14360
|
+
}
|
|
14361
|
+
if (typeof m.selector !== "string") continue;
|
|
14362
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14363
|
+
this.bindDirect(helperHostSet, root, m);
|
|
14364
|
+
boundSet.add(root);
|
|
14365
|
+
} else {
|
|
14366
|
+
root.querySelectorAll(m.selector).forEach((el) => {
|
|
14367
|
+
if (!boundSet.has(el)) {
|
|
14368
|
+
this.bindDirect(helperHostSet, el, m);
|
|
14369
|
+
boundSet.add(el);
|
|
14370
|
+
}
|
|
14371
|
+
});
|
|
14372
|
+
}
|
|
14373
|
+
}
|
|
14374
|
+
return { target: root, options: { childList: true, subtree: true }, callback };
|
|
14375
|
+
};
|
|
14376
|
+
const shadowEntry = inst.shadowRoot ? buildMutationEntry(inst.shadowRoot, shadowEventDelegates) : null;
|
|
14377
|
+
const lightEntry = buildMutationEntry(inst, lightEventDelegates);
|
|
14378
|
+
const mutationObserverSet = [shadowEntry, lightEntry].filter(Boolean);
|
|
14379
|
+
if (mutationObserverSet.length > 0) return { mutationObserverSet };
|
|
14380
|
+
}
|
|
14381
|
+
return void 0;
|
|
14382
|
+
}
|
|
14383
|
+
onDisconnected(helperHostSet) {
|
|
14384
|
+
const inst = helperHostSet.$this;
|
|
14385
|
+
const list = this.boundListenersMap.get(inst) ?? [];
|
|
14386
|
+
for (const l of list) {
|
|
14387
|
+
try {
|
|
14388
|
+
l.target.removeEventListener(l.type, l.handler, l.options);
|
|
14389
|
+
l.subscription?.unsubscribe?.();
|
|
14390
|
+
} catch (e) {
|
|
14391
|
+
console.error("[SWC] EventListenerLifeCycler cleanup error:", e);
|
|
14392
|
+
}
|
|
14393
|
+
for (const r of l.onRemoves ?? []) {
|
|
14394
|
+
try {
|
|
14395
|
+
r.fn(l.target, r.opts);
|
|
14396
|
+
} catch (e) {
|
|
14397
|
+
console.error("[SWC] removeListener error:", e);
|
|
14398
|
+
}
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
this.boundListenersMap.delete(inst);
|
|
14402
|
+
this.eventBoundSetsMap.delete(inst);
|
|
14403
|
+
}
|
|
14404
|
+
};
|
|
14405
|
+
|
|
14406
|
+
// src/decorators/mutationObserver.ts
|
|
14407
|
+
var MUTATION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:mutation-observer");
|
|
14408
|
+
function mutationObserver(selectorOrOptions, maybeOptions) {
|
|
14409
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14410
|
+
let selector = "$this";
|
|
14411
|
+
let options = {};
|
|
14412
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14413
|
+
selector = selectorOrOptions;
|
|
14414
|
+
options = maybeOptions ?? {};
|
|
14415
|
+
} else {
|
|
14416
|
+
selector = "$this";
|
|
14417
|
+
options = selectorOrOptions ?? {};
|
|
14418
|
+
}
|
|
14419
|
+
const constructor = targetObj.constructor;
|
|
14420
|
+
let observers = ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
14421
|
+
if (!observers) {
|
|
14422
|
+
observers = [];
|
|
14423
|
+
ReflectUtils.defineMetadata(MUTATION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14424
|
+
}
|
|
14425
|
+
observers.push({ propertyKey, selector, options });
|
|
14426
|
+
};
|
|
14427
|
+
}
|
|
14428
|
+
function mutationObserverThis(options) {
|
|
14429
|
+
return mutationObserver("$this", options);
|
|
14430
|
+
}
|
|
14431
|
+
function mutationObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14432
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14433
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14434
|
+
}
|
|
14435
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14436
|
+
}
|
|
14437
|
+
function mutationObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14438
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14439
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14440
|
+
}
|
|
14441
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14442
|
+
}
|
|
14443
|
+
function mutationObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14444
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14445
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14446
|
+
}
|
|
14447
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14448
|
+
}
|
|
14449
|
+
function mutationObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14450
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14451
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14452
|
+
}
|
|
14453
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14454
|
+
}
|
|
14455
|
+
function mutationObserverLight(selectorOrOptions, maybeOptions) {
|
|
14456
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14457
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14458
|
+
}
|
|
14459
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14460
|
+
}
|
|
14461
|
+
function mutationObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14462
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14463
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14464
|
+
}
|
|
14465
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14466
|
+
}
|
|
14467
|
+
function mutationObserverAll(selectorOrOptions, maybeOptions) {
|
|
14468
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14469
|
+
return mutationObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14470
|
+
}
|
|
14471
|
+
return mutationObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14472
|
+
}
|
|
14473
|
+
function getMutationObserverMetadata(target) {
|
|
14474
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14475
|
+
return ReflectUtils.getMetadata(MUTATION_OBSERVER_METADATA_KEY, constructor);
|
|
14476
|
+
}
|
|
14477
|
+
var MutationObserverLifeCycler = class {
|
|
14478
|
+
constructor() {
|
|
14479
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14480
|
+
}
|
|
14481
|
+
onConnected(helperHostSet) {
|
|
14482
|
+
const inst = helperHostSet.$this;
|
|
14483
|
+
const currentWin = helperHostSet.$w;
|
|
14484
|
+
const removeObserverCallbacks = [];
|
|
14485
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14486
|
+
const allMeta = getMutationObserverMetadata(inst) ?? [];
|
|
14487
|
+
if (allMeta.length === 0) return;
|
|
14488
|
+
const shadowMetas = allMeta.filter((m) => {
|
|
14489
|
+
const r = m.options.root || "auto";
|
|
14490
|
+
return inst.shadowRoot && (r === "shadow" || r === "all" || r === "auto");
|
|
14491
|
+
});
|
|
14492
|
+
const lightMetas = allMeta.filter((m) => {
|
|
14493
|
+
const r = m.options.root || "auto";
|
|
14494
|
+
return r === "light" || r === "all" || !inst.shadowRoot && r === "auto";
|
|
14495
|
+
});
|
|
14496
|
+
const buildSet = (root, metas) => {
|
|
14497
|
+
if (metas.length === 0) return null;
|
|
14498
|
+
const initFrom = (o) => {
|
|
14499
|
+
const init = {
|
|
14500
|
+
childList: o.childList,
|
|
14501
|
+
attributes: o.attributes,
|
|
14502
|
+
characterData: o.characterData,
|
|
14503
|
+
subtree: o.subtree,
|
|
14504
|
+
attributeFilter: o.attributeFilter,
|
|
14505
|
+
attributeOldValue: o.attributeOldValue,
|
|
14506
|
+
characterDataOldValue: o.characterDataOldValue
|
|
14507
|
+
};
|
|
14508
|
+
if (!init.childList && !init.attributes && !init.characterData) init.childList = true;
|
|
14509
|
+
return init;
|
|
14510
|
+
};
|
|
14511
|
+
const fnObservedSets = /* @__PURE__ */ new Map();
|
|
14512
|
+
const callback = (mutations, obs) => {
|
|
14513
|
+
for (const meta of metas) {
|
|
14514
|
+
const { selector, options } = meta;
|
|
14515
|
+
let matchedEls = [];
|
|
14516
|
+
const typeMatches = (m) => {
|
|
14517
|
+
const has = !!(options.childList || options.attributes || options.characterData);
|
|
14518
|
+
if (m.type === "childList") return has ? !!options.childList : true;
|
|
14519
|
+
if (m.type === "attributes") return !!options.attributes;
|
|
14520
|
+
if (m.type === "characterData") return !!options.characterData;
|
|
14521
|
+
return true;
|
|
14522
|
+
};
|
|
14523
|
+
const collect = (matchesSel) => mutations.flatMap((m) => {
|
|
14524
|
+
if (!typeMatches(m)) return [];
|
|
14525
|
+
const els = [];
|
|
14526
|
+
if (matchesSel(m.target)) els.push(m.target);
|
|
14527
|
+
Array.from(m.addedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
14528
|
+
Array.from(m.removedNodes || []).filter(matchesSel).forEach((n) => els.push(n));
|
|
14529
|
+
return els;
|
|
14530
|
+
});
|
|
14531
|
+
if (options.delegate && typeof selector === "string") {
|
|
14532
|
+
const isThis = selector === "$this" || selector === "";
|
|
14533
|
+
matchedEls = collect((n) => {
|
|
14534
|
+
if (!n || n.nodeType !== 1) return false;
|
|
14535
|
+
if (isThis) return true;
|
|
14536
|
+
const el = n;
|
|
14537
|
+
return el.matches?.(selector) || !!el.closest?.(selector);
|
|
14538
|
+
});
|
|
14539
|
+
} else if (typeof selector === "string") {
|
|
14540
|
+
const isThis = selector === "$this" || selector === "";
|
|
14541
|
+
matchedEls = collect((n) => {
|
|
14542
|
+
if (!n || n.nodeType !== 1) return false;
|
|
14543
|
+
if (isThis) return true;
|
|
14544
|
+
return n.matches?.(selector);
|
|
14545
|
+
});
|
|
14546
|
+
} else if (typeof selector === "function") {
|
|
14547
|
+
const set = fnObservedSets.get(meta);
|
|
14548
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1 && (set ? set.has(t) : false));
|
|
14549
|
+
} else {
|
|
14550
|
+
matchedEls = mutations.filter((m) => typeMatches(m)).map((m) => m.target).filter((t) => t && t.nodeType === 1);
|
|
14551
|
+
}
|
|
14552
|
+
if (matchedEls.length === 0) continue;
|
|
14553
|
+
if (options.filter) {
|
|
14554
|
+
if (!options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14555
|
+
}
|
|
14556
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14557
|
+
inst[meta.propertyKey](matchedEls, mutations, obs, { ...hostSet, $root: root });
|
|
14558
|
+
}
|
|
14559
|
+
};
|
|
14560
|
+
const observeTargets = [];
|
|
14561
|
+
if (metas.some((m) => m.options.delegate)) {
|
|
14562
|
+
observeTargets.push({ target: root, options: { childList: true, subtree: true } });
|
|
14563
|
+
}
|
|
14564
|
+
for (const m of metas.filter((m2) => !m2.options.delegate)) {
|
|
14565
|
+
const { selector, options } = m;
|
|
14566
|
+
const mInit = initFrom(options);
|
|
14567
|
+
if (typeof selector === "string") {
|
|
14568
|
+
if (selector === "$this" || selector === "") {
|
|
14569
|
+
observeTargets.push({ target: root, options: mInit });
|
|
14570
|
+
} else {
|
|
14571
|
+
root.querySelectorAll(selector).forEach((el) => observeTargets.push({ target: el, options: mInit }));
|
|
14572
|
+
}
|
|
14573
|
+
} else if (typeof selector === "function") {
|
|
14574
|
+
const res = selector(inst, helperHostSet);
|
|
14575
|
+
let targets = [];
|
|
14576
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14577
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14578
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14579
|
+
const set = /* @__PURE__ */ new WeakSet();
|
|
14580
|
+
for (const el of targets) {
|
|
14581
|
+
set.add(el);
|
|
14582
|
+
observeTargets.push({ target: el, options: mInit });
|
|
14583
|
+
}
|
|
14584
|
+
fnObservedSets.set(m, set);
|
|
14585
|
+
}
|
|
14586
|
+
}
|
|
14587
|
+
for (const m of metas) {
|
|
14588
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14589
|
+
}
|
|
14590
|
+
return { callback, observeTargets };
|
|
14591
|
+
};
|
|
14592
|
+
const shadowSet = inst.shadowRoot ? buildSet(inst.shadowRoot, shadowMetas) : null;
|
|
14593
|
+
const lightSet = buildSet(inst, lightMetas);
|
|
14594
|
+
const mutationObserverSet = [
|
|
14595
|
+
...(shadowSet?.observeTargets ?? []).map((t) => ({ ...t, callback: shadowSet.callback })),
|
|
14596
|
+
...(lightSet?.observeTargets ?? []).map((t) => ({ ...t, callback: lightSet.callback }))
|
|
14597
|
+
];
|
|
14598
|
+
if (mutationObserverSet.length === 0) return;
|
|
14599
|
+
return { mutationObserverSet };
|
|
14600
|
+
}
|
|
14601
|
+
onDisconnected(helperHostSet) {
|
|
14602
|
+
const inst = helperHostSet.$this;
|
|
14603
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14604
|
+
try {
|
|
14605
|
+
cb.fn(cb.target, cb.opts);
|
|
14606
|
+
} catch (e) {
|
|
14607
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14608
|
+
}
|
|
14609
|
+
}
|
|
14610
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14611
|
+
}
|
|
14612
|
+
};
|
|
14613
|
+
|
|
14614
|
+
// src/decorators/resizeObserver.ts
|
|
14615
|
+
var RESIZE_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:resize-observer");
|
|
14616
|
+
function resizeObserver(selectorOrOptions, maybeOptions) {
|
|
14617
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14618
|
+
let selector = "$this";
|
|
14619
|
+
let options = {};
|
|
14620
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14621
|
+
selector = selectorOrOptions;
|
|
14622
|
+
options = maybeOptions ?? {};
|
|
14623
|
+
} else {
|
|
14624
|
+
selector = "$this";
|
|
14625
|
+
options = selectorOrOptions ?? {};
|
|
14626
|
+
}
|
|
14627
|
+
const constructor = targetObj.constructor;
|
|
14628
|
+
let observers = ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
14629
|
+
if (!observers) {
|
|
14630
|
+
observers = [];
|
|
14631
|
+
ReflectUtils.defineMetadata(RESIZE_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14632
|
+
}
|
|
14633
|
+
observers.push({ propertyKey, selector, options });
|
|
14634
|
+
};
|
|
14635
|
+
}
|
|
14636
|
+
function resizeObserverThis(options) {
|
|
14637
|
+
return resizeObserver("$this", options);
|
|
14638
|
+
}
|
|
14639
|
+
function resizeObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14640
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14641
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14642
|
+
}
|
|
14643
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14644
|
+
}
|
|
14645
|
+
function resizeObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14646
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14647
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14648
|
+
}
|
|
14649
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14650
|
+
}
|
|
14651
|
+
function resizeObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14652
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14653
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14654
|
+
}
|
|
14655
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14656
|
+
}
|
|
14657
|
+
function resizeObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14658
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14659
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14660
|
+
}
|
|
14661
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14662
|
+
}
|
|
14663
|
+
function resizeObserverLight(selectorOrOptions, maybeOptions) {
|
|
14664
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14665
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14666
|
+
}
|
|
14667
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14668
|
+
}
|
|
14669
|
+
function resizeObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14670
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14671
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14672
|
+
}
|
|
14673
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14674
|
+
}
|
|
14675
|
+
function resizeObserverAll(selectorOrOptions, maybeOptions) {
|
|
14676
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14677
|
+
return resizeObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14678
|
+
}
|
|
14679
|
+
return resizeObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14680
|
+
}
|
|
14681
|
+
function getResizeObserverMetadata(target) {
|
|
14682
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14683
|
+
return ReflectUtils.getMetadata(RESIZE_OBSERVER_METADATA_KEY, constructor);
|
|
14684
|
+
}
|
|
14685
|
+
var ResizeObserverLifeCycler = class {
|
|
14686
|
+
constructor() {
|
|
14687
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14688
|
+
}
|
|
14689
|
+
onConnected(helperHostSet) {
|
|
14690
|
+
const inst = helperHostSet.$this;
|
|
14691
|
+
const currentWin = helperHostSet.$w;
|
|
14692
|
+
const removeObserverCallbacks = [];
|
|
14693
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14694
|
+
const allMeta = getResizeObserverMetadata(inst) ?? [];
|
|
14695
|
+
if (allMeta.length === 0) return;
|
|
14696
|
+
const root = inst.shadowRoot || inst;
|
|
14697
|
+
for (const m of allMeta) {
|
|
14698
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14699
|
+
}
|
|
14700
|
+
const callback = (entries, obs) => {
|
|
14701
|
+
for (const m of allMeta) {
|
|
14702
|
+
let matchedEls;
|
|
14703
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14704
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
14705
|
+
matchedEls = entries.map((e) => e.target).filter((el) => {
|
|
14706
|
+
if (!el || el.nodeType !== 1) return false;
|
|
14707
|
+
if (isThis) return true;
|
|
14708
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
14709
|
+
});
|
|
14710
|
+
} else {
|
|
14711
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
14712
|
+
}
|
|
14713
|
+
if (matchedEls.length === 0) continue;
|
|
14714
|
+
if (m.options.filter) {
|
|
14715
|
+
if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14716
|
+
}
|
|
14717
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14718
|
+
inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });
|
|
14719
|
+
}
|
|
14720
|
+
};
|
|
14721
|
+
const resizeObserverSet = [];
|
|
14722
|
+
for (const m of allMeta) {
|
|
14723
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14724
|
+
resizeObserverSet.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, options: m.options.box ? { box: m.options.box } : void 0, callback });
|
|
14725
|
+
continue;
|
|
14726
|
+
}
|
|
14727
|
+
let targets = [];
|
|
14728
|
+
if (typeof m.selector === "function") {
|
|
14729
|
+
const res = m.selector(inst, helperHostSet);
|
|
14730
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14731
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14732
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14733
|
+
} else if (typeof m.selector === "string") {
|
|
14734
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14735
|
+
targets = [inst];
|
|
14736
|
+
} else {
|
|
14737
|
+
const r = m.options.root || "auto";
|
|
14738
|
+
const scopes = [];
|
|
14739
|
+
if (r === "auto") scopes.push(inst.shadowRoot || inst);
|
|
14740
|
+
else if (r === "light") scopes.push(inst);
|
|
14741
|
+
else if (r === "shadow" && inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14742
|
+
else if (r === "all") {
|
|
14743
|
+
scopes.push(inst);
|
|
14744
|
+
if (inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14745
|
+
}
|
|
14746
|
+
for (const s of scopes) {
|
|
14747
|
+
const found = s?.querySelectorAll?.(m.selector);
|
|
14748
|
+
if (found?.length) targets.push(...Array.from(found));
|
|
14749
|
+
}
|
|
14750
|
+
}
|
|
14751
|
+
}
|
|
14752
|
+
for (const el of targets) resizeObserverSet.push({ target: el, options: m.options.box ? { box: m.options.box } : void 0, callback });
|
|
14753
|
+
}
|
|
14754
|
+
return { resizeObserverSet };
|
|
14755
|
+
}
|
|
14756
|
+
onDisconnected(helperHostSet) {
|
|
14757
|
+
const inst = helperHostSet.$this;
|
|
14758
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14759
|
+
try {
|
|
14760
|
+
cb.fn(cb.target, cb.opts);
|
|
14761
|
+
} catch (e) {
|
|
14762
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14763
|
+
}
|
|
14764
|
+
}
|
|
14765
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14766
|
+
}
|
|
14767
|
+
};
|
|
14768
|
+
|
|
14769
|
+
// src/decorators/intersectionObserver.ts
|
|
14770
|
+
var INTERSECTION_OBSERVER_METADATA_KEY = Symbol.for("simple-web-component:intersection-observer");
|
|
14771
|
+
function intersectionObserver(selectorOrOptions, maybeOptions) {
|
|
14772
|
+
return (targetObj, propertyKey, descriptor) => {
|
|
14773
|
+
let selector = "$this";
|
|
14774
|
+
let options = {};
|
|
14775
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14776
|
+
selector = selectorOrOptions;
|
|
14777
|
+
options = maybeOptions ?? {};
|
|
14778
|
+
} else {
|
|
14779
|
+
selector = "$this";
|
|
14780
|
+
options = selectorOrOptions ?? {};
|
|
14781
|
+
}
|
|
14782
|
+
const constructor = targetObj.constructor;
|
|
14783
|
+
let observers = ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
14784
|
+
if (!observers) {
|
|
14785
|
+
observers = [];
|
|
14786
|
+
ReflectUtils.defineMetadata(INTERSECTION_OBSERVER_METADATA_KEY, observers, constructor);
|
|
14787
|
+
}
|
|
14788
|
+
observers.push({ propertyKey, selector, options });
|
|
14789
|
+
};
|
|
14790
|
+
}
|
|
14791
|
+
function intersectionObserverThis(options) {
|
|
14792
|
+
return intersectionObserver("$this", options);
|
|
14793
|
+
}
|
|
14794
|
+
function intersectionObserverDelegateLight(selectorOrOptions, maybeOptions) {
|
|
14795
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14796
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light", delegate: true });
|
|
14797
|
+
}
|
|
14798
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light", delegate: true });
|
|
14799
|
+
}
|
|
14800
|
+
function intersectionObserverDelegateShadow(selectorOrOptions, maybeOptions) {
|
|
14801
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14802
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow", delegate: true });
|
|
14803
|
+
}
|
|
14804
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow", delegate: true });
|
|
14805
|
+
}
|
|
14806
|
+
function intersectionObserverDelegateAll(selectorOrOptions, maybeOptions) {
|
|
14807
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14808
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all", delegate: true });
|
|
14809
|
+
}
|
|
14810
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all", delegate: true });
|
|
14811
|
+
}
|
|
14812
|
+
function intersectionObserverDelegate(selectorOrOptions, maybeOptions) {
|
|
14813
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14814
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "auto", delegate: true });
|
|
14815
|
+
}
|
|
14816
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "auto", delegate: true });
|
|
14817
|
+
}
|
|
14818
|
+
function intersectionObserverLight(selectorOrOptions, maybeOptions) {
|
|
14819
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14820
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "light" });
|
|
14821
|
+
}
|
|
14822
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "light" });
|
|
14823
|
+
}
|
|
14824
|
+
function intersectionObserverShadow(selectorOrOptions, maybeOptions) {
|
|
14825
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14826
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "shadow" });
|
|
14827
|
+
}
|
|
14828
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "shadow" });
|
|
14829
|
+
}
|
|
14830
|
+
function intersectionObserverAll(selectorOrOptions, maybeOptions) {
|
|
14831
|
+
if (typeof selectorOrOptions === "string" || typeof selectorOrOptions === "function") {
|
|
14832
|
+
return intersectionObserver(selectorOrOptions, { ...maybeOptions ?? {}, root: "all" });
|
|
14833
|
+
}
|
|
14834
|
+
return intersectionObserver({ ...selectorOrOptions ?? {}, root: "all" });
|
|
14835
|
+
}
|
|
14836
|
+
function getIntersectionObserverMetadata(target) {
|
|
14837
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
14838
|
+
return ReflectUtils.getMetadata(INTERSECTION_OBSERVER_METADATA_KEY, constructor);
|
|
14839
|
+
}
|
|
14840
|
+
var IntersectionObserverLifeCycler = class {
|
|
14841
|
+
constructor() {
|
|
14842
|
+
__publicField(this, "removeObserverCallbacksMap", /* @__PURE__ */ new WeakMap());
|
|
14843
|
+
}
|
|
14844
|
+
onConnected(helperHostSet) {
|
|
14845
|
+
const inst = helperHostSet.$this;
|
|
14846
|
+
const currentWin = helperHostSet.$w;
|
|
14847
|
+
const removeObserverCallbacks = [];
|
|
14848
|
+
this.removeObserverCallbacksMap.set(inst, removeObserverCallbacks);
|
|
14849
|
+
const allMeta = getIntersectionObserverMetadata(inst) ?? [];
|
|
14850
|
+
if (allMeta.length === 0) return;
|
|
14851
|
+
const root = inst.shadowRoot || inst;
|
|
14852
|
+
for (const m of allMeta) {
|
|
14853
|
+
if (m.options.removeObserver) removeObserverCallbacks.push({ fn: m.options.removeObserver, target: root, opts: m.options });
|
|
14854
|
+
}
|
|
14855
|
+
const buildCallback = (metas) => {
|
|
14856
|
+
return (entries, obs) => {
|
|
14857
|
+
for (const m of metas) {
|
|
14858
|
+
let matchedEls;
|
|
14859
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14860
|
+
const isThis = m.selector === "$this" || m.selector === "";
|
|
14861
|
+
matchedEls = entries.map((e) => e.target).filter((el) => {
|
|
14862
|
+
if (!el || el.nodeType !== 1) return false;
|
|
14863
|
+
if (isThis) return true;
|
|
14864
|
+
return el.matches?.(m.selector) || !!el.closest?.(m.selector);
|
|
14865
|
+
});
|
|
14866
|
+
} else {
|
|
14867
|
+
matchedEls = entries.map((e) => e.target).filter((t) => t && t.nodeType === 1);
|
|
14868
|
+
}
|
|
14869
|
+
if (matchedEls.length === 0) continue;
|
|
14870
|
+
if (m.options.filter) {
|
|
14871
|
+
if (!m.options.filter(matchedEls, { currentThis: inst, helper: helperHostSet })) continue;
|
|
14872
|
+
}
|
|
14873
|
+
const hostSet = SwcUtils.getHostSet(inst);
|
|
14874
|
+
inst[m.propertyKey](matchedEls, entries, obs, { ...hostSet, $root: root });
|
|
14875
|
+
}
|
|
14876
|
+
};
|
|
14877
|
+
};
|
|
14878
|
+
const groups = /* @__PURE__ */ new Map();
|
|
14879
|
+
for (const m of allMeta) {
|
|
14880
|
+
const obsOptions = {
|
|
14881
|
+
root: m.options.intersectionRoot ?? null,
|
|
14882
|
+
rootMargin: m.options.rootMargin,
|
|
14883
|
+
threshold: m.options.threshold
|
|
14884
|
+
};
|
|
14885
|
+
const key = JSON.stringify([obsOptions.root, obsOptions.rootMargin, obsOptions.threshold]);
|
|
14886
|
+
if (!groups.has(key)) groups.set(key, { options: obsOptions, metas: [] });
|
|
14887
|
+
groups.get(key).metas.push(m);
|
|
14888
|
+
}
|
|
14889
|
+
const intersectionObserverSet = [];
|
|
14890
|
+
for (const [, group] of groups) {
|
|
14891
|
+
const callback = buildCallback(group.metas);
|
|
14892
|
+
const observeTargets = [];
|
|
14893
|
+
for (const m of group.metas) {
|
|
14894
|
+
if (m.options.delegate && typeof m.selector === "string") {
|
|
14895
|
+
observeTargets.push({ target: m.selector, delegate: true, delegateRoot: m.options.root, callback });
|
|
14896
|
+
continue;
|
|
14897
|
+
}
|
|
14898
|
+
let targets = [];
|
|
14899
|
+
if (typeof m.selector === "function") {
|
|
14900
|
+
const res = m.selector(inst, helperHostSet);
|
|
14901
|
+
if (res instanceof currentWin.HTMLElement) targets = [res];
|
|
14902
|
+
else if (res instanceof currentWin.NodeList) targets = Array.from(res).filter((e) => e instanceof currentWin.HTMLElement);
|
|
14903
|
+
else if (Array.isArray(res)) targets = res.filter((e) => e instanceof currentWin.HTMLElement);
|
|
14904
|
+
} else if (typeof m.selector === "string") {
|
|
14905
|
+
if (m.selector === "$this" || m.selector === "") {
|
|
14906
|
+
targets = [inst];
|
|
14907
|
+
} else {
|
|
14908
|
+
const r = m.options.root || "auto";
|
|
14909
|
+
const scopes = [];
|
|
14910
|
+
if (r === "auto") scopes.push(inst.shadowRoot || inst);
|
|
14911
|
+
else if (r === "light") scopes.push(inst);
|
|
14912
|
+
else if (r === "shadow" && inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14913
|
+
else if (r === "all") {
|
|
14914
|
+
scopes.push(inst);
|
|
14915
|
+
if (inst.shadowRoot) scopes.push(inst.shadowRoot);
|
|
14916
|
+
}
|
|
14917
|
+
for (const s of scopes) {
|
|
14918
|
+
const found = s?.querySelectorAll?.(m.selector);
|
|
14919
|
+
if (found?.length) targets.push(...Array.from(found));
|
|
14920
|
+
}
|
|
14921
|
+
}
|
|
14922
|
+
}
|
|
14923
|
+
for (const el of targets) observeTargets.push({ target: el, callback });
|
|
14924
|
+
}
|
|
14925
|
+
intersectionObserverSet.push({ options: group.options, observeTargets });
|
|
14926
|
+
}
|
|
14927
|
+
return { intersectionObserverSet };
|
|
14928
|
+
}
|
|
14929
|
+
onDisconnected(helperHostSet) {
|
|
14930
|
+
const inst = helperHostSet.$this;
|
|
14931
|
+
for (const cb of this.removeObserverCallbacksMap.get(inst) ?? []) {
|
|
14932
|
+
try {
|
|
14933
|
+
cb.fn(cb.target, cb.opts);
|
|
14934
|
+
} catch (e) {
|
|
14935
|
+
console.error("[SWC] removeObserver error:", e);
|
|
14936
|
+
}
|
|
14937
|
+
}
|
|
14938
|
+
this.removeObserverCallbacksMap.delete(inst);
|
|
14939
|
+
}
|
|
14940
|
+
};
|
|
14941
|
+
|
|
14942
|
+
// src/decorators/lifecycles.ts
|
|
14943
|
+
var ON_INITIALIZE_METADATA_KEY = Symbol.for("simple-web-component:on-constructor");
|
|
14944
|
+
var ON_BEFORE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-connected");
|
|
14945
|
+
var ON_AFTER_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-connected");
|
|
14946
|
+
var ON_BEFORE_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-disconnected");
|
|
14947
|
+
var ON_AFTER_DISCONNECTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-disconnected");
|
|
14948
|
+
var ON_BEFORE_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-before-adopted");
|
|
14949
|
+
var ON_AFTER_ADOPTED_METADATA_KEY = Symbol.for("simple-web-component:on-after-adopted");
|
|
14950
|
+
var ON_ADD_EVENT_LISTENER_METADATA_KEY = Symbol.for("simple-web-component:on-add-event-listener");
|
|
14951
|
+
var ON_CONNECTED_BODY_METADATA_KEY = Symbol.for("simple-web-component:on-connected-body");
|
|
14952
|
+
var ON_CONNECTED_SWC_APP_METADATA_KEY = Symbol.for("simple-web-component:on-connected-swc-app");
|
|
14953
|
+
var ON_CONNECTED_COMPLETED_METADATA_KEY = Symbol.for("simple-web-component:on-completed");
|
|
14954
|
+
var ATTRIBUTE_CHANGED_WILDCARD = "*";
|
|
14955
|
+
function onConnectedBefore(arg1, arg2, arg3) {
|
|
14956
|
+
const decorator2 = (options, target, propertyKey) => {
|
|
14957
|
+
const constructor = target.constructor;
|
|
14958
|
+
let list = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor);
|
|
14959
|
+
if (!list) {
|
|
14960
|
+
list = [];
|
|
14961
|
+
ReflectUtils.defineMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, list, constructor);
|
|
14962
|
+
}
|
|
14963
|
+
list.push({ propertyKey, options });
|
|
14964
|
+
};
|
|
14965
|
+
if (arg2) {
|
|
14966
|
+
return decorator2({}, arg1, arg2);
|
|
14967
|
+
}
|
|
14968
|
+
return (target, propertyKey) => {
|
|
14969
|
+
decorator2(arg1 || {}, target, propertyKey);
|
|
14970
|
+
};
|
|
14971
|
+
}
|
|
14972
|
+
function onConnectedAfter(arg1, arg2, arg3) {
|
|
14973
|
+
const decorator2 = (options, target, propertyKey) => {
|
|
14974
|
+
const constructor = target.constructor;
|
|
14975
|
+
let list = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor);
|
|
14976
|
+
if (!list) {
|
|
14977
|
+
list = [];
|
|
14978
|
+
ReflectUtils.defineMetadata(ON_AFTER_CONNECTED_METADATA_KEY, list, constructor);
|
|
14979
|
+
}
|
|
14980
|
+
list.push({ propertyKey, options });
|
|
14981
|
+
};
|
|
14982
|
+
if (arg2) {
|
|
14983
|
+
return decorator2({}, arg1, arg2);
|
|
14984
|
+
}
|
|
14985
|
+
return (target, propertyKey) => {
|
|
14986
|
+
decorator2(arg1 || {}, target, propertyKey);
|
|
14987
|
+
};
|
|
14988
|
+
}
|
|
14989
|
+
function createLifecycleDecoratorWithOptions(metadataKey) {
|
|
14990
|
+
return function(optionOrTarget, propertyKey) {
|
|
14991
|
+
if (propertyKey) {
|
|
14992
|
+
const constructor = optionOrTarget.constructor;
|
|
14993
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
14994
|
+
if (!list) {
|
|
14995
|
+
list = [];
|
|
14996
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
14997
|
+
}
|
|
14998
|
+
list.push({ propertyKey, order: 0 });
|
|
14999
|
+
return;
|
|
15000
|
+
}
|
|
15001
|
+
return (target, propertyKey2) => {
|
|
15002
|
+
const constructor = target.constructor;
|
|
15003
|
+
let list = ReflectUtils.getOwnMetadata(metadataKey, constructor);
|
|
15004
|
+
if (!list) {
|
|
15005
|
+
list = [];
|
|
15006
|
+
ReflectUtils.defineMetadata(metadataKey, list, constructor);
|
|
15007
|
+
}
|
|
15008
|
+
list.push({ propertyKey: propertyKey2, order: optionOrTarget?.order ?? 0 });
|
|
15009
|
+
};
|
|
15010
|
+
};
|
|
15011
|
+
}
|
|
15012
|
+
function onInitialize(optionOrTarget, propertyKey) {
|
|
15013
|
+
return createLifecycleDecoratorWithOptions(ON_INITIALIZE_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15014
|
+
}
|
|
15015
|
+
function onDisconnectedBefore(optionOrTarget, propertyKey) {
|
|
15016
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15017
|
+
}
|
|
15018
|
+
function onDisconnectedAfter(optionOrTarget, propertyKey) {
|
|
15019
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_DISCONNECTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15020
|
+
}
|
|
15021
|
+
var onDisconnected = onDisconnectedAfter;
|
|
15022
|
+
function onAdoptedBefore(optionOrTarget, propertyKey) {
|
|
15023
|
+
return createLifecycleDecoratorWithOptions(ON_BEFORE_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15024
|
+
}
|
|
15025
|
+
function onAdoptedAfter(optionOrTarget, propertyKey) {
|
|
15026
|
+
return createLifecycleDecoratorWithOptions(ON_AFTER_ADOPTED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15027
|
+
}
|
|
15028
|
+
var onAdopted = onAdoptedAfter;
|
|
15029
|
+
function onConnectedSwcApp(optionOrTarget, propertyKey) {
|
|
15030
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_SWC_APP_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15031
|
+
}
|
|
15032
|
+
function onConnectedCompleted(optionOrTarget, propertyKey) {
|
|
15033
|
+
return createLifecycleDecoratorWithOptions(ON_CONNECTED_COMPLETED_METADATA_KEY)(optionOrTarget, propertyKey);
|
|
15034
|
+
}
|
|
15035
|
+
var decorator = (options, target, propertyKey) => {
|
|
15036
|
+
const constructor = target.constructor;
|
|
15037
|
+
let list = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor);
|
|
15038
|
+
if (!list) {
|
|
15039
|
+
list = [];
|
|
15040
|
+
ReflectUtils.defineMetadata(ON_CONNECTED_BODY_METADATA_KEY, list, constructor);
|
|
15041
|
+
}
|
|
15042
|
+
list.push({ propertyKey, options });
|
|
15043
|
+
};
|
|
15044
|
+
function onConnectedBodyShadow(optionOrTarget, propertyKey, arg3) {
|
|
15045
|
+
if (propertyKey) {
|
|
15046
|
+
return decorator({ useShadow: true }, optionOrTarget, propertyKey);
|
|
15047
|
+
}
|
|
15048
|
+
return (target, propertyKey2) => {
|
|
15049
|
+
decorator({ ...optionOrTarget ?? {}, useShadow: true }, target, propertyKey2);
|
|
15050
|
+
};
|
|
15051
|
+
}
|
|
15052
|
+
function onConnectedBodyLight(optionOrTarget, propertyKey, arg3) {
|
|
15053
|
+
if (propertyKey) {
|
|
15054
|
+
return decorator({ useShadow: false }, optionOrTarget, propertyKey);
|
|
15055
|
+
}
|
|
15056
|
+
return (target, propertyKey2) => {
|
|
15057
|
+
decorator({ ...optionOrTarget ?? {}, useShadow: false }, target, propertyKey2);
|
|
15058
|
+
};
|
|
15059
|
+
}
|
|
15060
|
+
function onConnectedBody(optionOrTarget, propertyKey, arg3) {
|
|
15061
|
+
if (propertyKey) {
|
|
15062
|
+
return decorator({}, optionOrTarget, propertyKey);
|
|
15063
|
+
}
|
|
15064
|
+
return (target, propertyKey2) => {
|
|
15065
|
+
decorator(optionOrTarget || {}, target, propertyKey2);
|
|
15066
|
+
};
|
|
15067
|
+
}
|
|
15068
|
+
var findAllLifecycleMetadata = (target, metadataKey) => {
|
|
15069
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15070
|
+
const results = ReflectUtils.getOwnMetadata(metadataKey, constructor) ?? [];
|
|
15071
|
+
return [...results].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
15072
|
+
};
|
|
15073
|
+
var findAllOnConnectedMetadata = (target) => {
|
|
15074
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15075
|
+
const results = ReflectUtils.getMetadata(ON_CONNECTED_BODY_METADATA_KEY, constructor) ?? [];
|
|
15076
|
+
return [...results].sort((a, b) => {
|
|
15077
|
+
const orderA = a.options?.order ?? 0;
|
|
15078
|
+
const orderB = b.options?.order ?? 0;
|
|
15079
|
+
return orderA - orderB;
|
|
15080
|
+
});
|
|
15081
|
+
};
|
|
15082
|
+
var findAllOnConnectedBeforeMetadata = (target) => {
|
|
15083
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15084
|
+
const results = ReflectUtils.getMetadata(ON_BEFORE_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
15085
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
15086
|
+
};
|
|
15087
|
+
var findAllOnConnectedAfterMetadata = (target) => {
|
|
15088
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
15089
|
+
const results = ReflectUtils.getMetadata(ON_AFTER_CONNECTED_METADATA_KEY, constructor) ?? [];
|
|
15090
|
+
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
15091
|
+
};
|
|
15092
|
+
|
|
15093
|
+
// src/decorators/emitCustomEvent.ts
|
|
15094
|
+
var EMIT_CUSTOM_EVENT_METADATA_KEY = Symbol.for("simple-web-component:emit-custom-event");
|
|
15095
|
+
function emitCustomEvent(selectorOrTarget, typeOrPropertyKey, optionsOrDescriptor) {
|
|
15096
|
+
if (typeof selectorOrTarget === "object" && typeof typeOrPropertyKey === "string" && typeof optionsOrDescriptor === "object" && "value" in optionsOrDescriptor) {
|
|
13859
15097
|
throw new Error(`@emitCustomEvent decorator cannot be used on properties. (Property: ${String(typeOrPropertyKey)})`);
|
|
13860
15098
|
}
|
|
13861
15099
|
if ((typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") && typeof typeOrPropertyKey === "string") {
|
|
@@ -13979,6 +15217,53 @@ ${indentStr}}`;
|
|
|
13979
15217
|
return ReflectUtils.getMetadata(EMIT_CUSTOM_EVENT_METADATA_KEY, constructor);
|
|
13980
15218
|
};
|
|
13981
15219
|
var emit = emitCustomEvent;
|
|
15220
|
+
function emitThis(type, options) {
|
|
15221
|
+
return emitCustomEvent("$this", type, options);
|
|
15222
|
+
}
|
|
15223
|
+
function emitAppHost(type, options) {
|
|
15224
|
+
return emitCustomEvent("$appHost", type, options);
|
|
15225
|
+
}
|
|
15226
|
+
function emitWindow(type, options) {
|
|
15227
|
+
return emitCustomEvent("$window", type, options);
|
|
15228
|
+
}
|
|
15229
|
+
function emitDocument(type, options) {
|
|
15230
|
+
return emitCustomEvent("$document", type, options);
|
|
15231
|
+
}
|
|
15232
|
+
function emitLight(selector, type, options) {
|
|
15233
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "light" });
|
|
15234
|
+
}
|
|
15235
|
+
function emitShadow(selector, type, options) {
|
|
15236
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "shadow" });
|
|
15237
|
+
}
|
|
15238
|
+
function emitAll(selector, type, options) {
|
|
15239
|
+
return emitCustomEvent(selector, type, { ...options ?? {}, root: "all" });
|
|
15240
|
+
}
|
|
15241
|
+
var EmitCustomEventLifeCycler = class {
|
|
15242
|
+
constructor() {
|
|
15243
|
+
this.hostEmitMeta = null;
|
|
15244
|
+
}
|
|
15245
|
+
getHostEmitMeta(inst) {
|
|
15246
|
+
if (!this.hostEmitMeta) {
|
|
15247
|
+
const all = getEmitCustomEventMetadataList(inst) ?? [];
|
|
15248
|
+
this.hostEmitMeta = all.filter((m) => m.selector === "$this" || m.selector === "");
|
|
15249
|
+
}
|
|
15250
|
+
return this.hostEmitMeta;
|
|
15251
|
+
}
|
|
15252
|
+
/** observedAttributes 에 포함할 attributeName 목록 */
|
|
15253
|
+
getObservedAttributeNames(inst) {
|
|
15254
|
+
return this.getHostEmitMeta(inst).map((m) => m.options.attributeName).filter(Boolean);
|
|
15255
|
+
}
|
|
15256
|
+
onConnected(_helperHostSet) {
|
|
15257
|
+
}
|
|
15258
|
+
/** attributeChangedCallback 에서 elementDefine 이 직접 호출 */
|
|
15259
|
+
onAttributeChanged(helperHostSet, name, _old, newVal) {
|
|
15260
|
+
const inst = helperHostSet.$this;
|
|
15261
|
+
const matched = this.getHostEmitMeta(inst).find((m) => m.options.attributeName === name);
|
|
15262
|
+
if (matched && newVal !== null) {
|
|
15263
|
+
inst._bindAttributeEvent?.(inst, name, newVal, matched.type);
|
|
15264
|
+
}
|
|
15265
|
+
}
|
|
15266
|
+
};
|
|
13982
15267
|
|
|
13983
15268
|
// src/decorators/changedAttribute.ts
|
|
13984
15269
|
var ON_ATTRIBUTE_CHANGED_METADATA_KEY = Symbol.for("simple-web-component:on-attribute-changed");
|
|
@@ -14025,9 +15310,115 @@ ${indentStr}}`;
|
|
|
14025
15310
|
var convertAttributeValue = (val, type) => {
|
|
14026
15311
|
return convertValue(val, type);
|
|
14027
15312
|
};
|
|
15313
|
+
var ChangedAttributeLifeCycler = class {
|
|
15314
|
+
constructor() {
|
|
15315
|
+
__publicField(this, "attrChangeMap", null);
|
|
15316
|
+
}
|
|
15317
|
+
/** 클래스 메타데이터 기반 attrChangeMap 을 lazy 로드한다 (공유 시클러 캐시). */
|
|
15318
|
+
getAttrChangeMap(inst) {
|
|
15319
|
+
if (!this.attrChangeMap) this.attrChangeMap = findAllAttributeChangedMetadata(inst);
|
|
15320
|
+
return this.attrChangeMap;
|
|
15321
|
+
}
|
|
15322
|
+
/** observedAttributes 에 포함할 attribute 이름 목록 */
|
|
15323
|
+
getObservedAttributeNames(inst) {
|
|
15324
|
+
return Array.from(this.getAttrChangeMap(inst).keys());
|
|
15325
|
+
}
|
|
15326
|
+
onConnected(helperHostSet) {
|
|
15327
|
+
const inst = helperHostSet.$this;
|
|
15328
|
+
for (const [name, metaList] of this.getAttrChangeMap(inst)) {
|
|
15329
|
+
for (const meta of metaList) {
|
|
15330
|
+
if (meta.options.while === "connected") {
|
|
15331
|
+
const val = getAttributeValue(inst, name, { type: meta.options.type });
|
|
15332
|
+
if (val !== null) inst[meta.propertyKey](val, null, name, helperHostSet);
|
|
15333
|
+
}
|
|
15334
|
+
}
|
|
15335
|
+
}
|
|
15336
|
+
}
|
|
15337
|
+
/** attributeChangedCallback 에서 elementDefine 이 직접 호출 */
|
|
15338
|
+
onAttributeChanged(helperHostSet, name, old, newVal) {
|
|
15339
|
+
const inst = helperHostSet.$this;
|
|
15340
|
+
const metaList = this.getAttrChangeMap(inst).get(name);
|
|
15341
|
+
if (!metaList) return;
|
|
15342
|
+
for (const meta of metaList) {
|
|
15343
|
+
if (meta.options.while === "connected" && !inst.__swc_connected) continue;
|
|
15344
|
+
inst[meta.propertyKey](convertAttributeValue(newVal, meta.options.type), old, name, helperHostSet);
|
|
15345
|
+
}
|
|
15346
|
+
}
|
|
15347
|
+
};
|
|
14028
15348
|
|
|
14029
15349
|
// src/decorators/query.ts
|
|
14030
15350
|
var QUERY_METADATA_KEY = Symbol.for("simple-web-component:query");
|
|
15351
|
+
var resolveQueryElements = (inst, selector, options, win) => {
|
|
15352
|
+
const hostSet = SwcUtils.getHelperAndHostSet(win, inst);
|
|
15353
|
+
let all = [];
|
|
15354
|
+
if (typeof selector === "function") {
|
|
15355
|
+
const result = selector(inst, hostSet);
|
|
15356
|
+
if (result instanceof win.NodeList)
|
|
15357
|
+
all = Array.from(result).filter((e) => e instanceof win.HTMLElement);
|
|
15358
|
+
else if (Array.isArray(result))
|
|
15359
|
+
all = result.filter((e) => e instanceof win.HTMLElement);
|
|
15360
|
+
else if (result instanceof win.HTMLElement)
|
|
15361
|
+
all = [result];
|
|
15362
|
+
} else if (typeof selector === "string") {
|
|
15363
|
+
const r = options?.root || "auto";
|
|
15364
|
+
if (selector === "$this")
|
|
15365
|
+
all = [inst];
|
|
15366
|
+
else if (selector === "$host")
|
|
15367
|
+
all = hostSet.$host ? [hostSet.$host] : [];
|
|
15368
|
+
else if (selector === "$parentHost")
|
|
15369
|
+
all = hostSet.$parentHost ? [hostSet.$parentHost] : [];
|
|
15370
|
+
else if (selector === "$appHost")
|
|
15371
|
+
all = hostSet.$appHost ? [hostSet.$appHost] : [];
|
|
15372
|
+
else if (selector === "$firstHost")
|
|
15373
|
+
all = hostSet.$firstHost ? [hostSet.$firstHost] : [];
|
|
15374
|
+
else if (selector === "$lastHost")
|
|
15375
|
+
all = hostSet.$lastHost ? [hostSet.$lastHost] : [];
|
|
15376
|
+
else if (selector === "$firstAppHost")
|
|
15377
|
+
all = hostSet.$firstAppHost ? [hostSet.$firstAppHost] : [];
|
|
15378
|
+
else if (selector === "$lastAppHost")
|
|
15379
|
+
all = hostSet.$lastAppHost ? [hostSet.$lastAppHost] : [];
|
|
15380
|
+
else if (selector === "$hosts")
|
|
15381
|
+
all = hostSet.$hosts.filter(Boolean);
|
|
15382
|
+
else if (selector === "$appHosts")
|
|
15383
|
+
all = hostSet.$appHosts.filter(Boolean);
|
|
15384
|
+
else {
|
|
15385
|
+
const scopes = [];
|
|
15386
|
+
if (r === "auto")
|
|
15387
|
+
scopes.push(inst.shadowRoot || inst);
|
|
15388
|
+
else if (r === "light")
|
|
15389
|
+
scopes.push(inst);
|
|
15390
|
+
else if (r === "shadow" && inst.shadowRoot)
|
|
15391
|
+
scopes.push(inst.shadowRoot);
|
|
15392
|
+
else if (r === "all") {
|
|
15393
|
+
scopes.push(inst);
|
|
15394
|
+
if (inst.shadowRoot)
|
|
15395
|
+
scopes.push(inst.shadowRoot);
|
|
15396
|
+
}
|
|
15397
|
+
for (const scope of scopes) {
|
|
15398
|
+
const found = scope?.querySelectorAll?.(selector);
|
|
15399
|
+
if (found?.length)
|
|
15400
|
+
all.push(...Array.from(found).filter((e) => e instanceof win.HTMLElement));
|
|
15401
|
+
}
|
|
15402
|
+
}
|
|
15403
|
+
}
|
|
15404
|
+
if (options?.filter) {
|
|
15405
|
+
all = all.filter((el) => options.filter(el, { currentThis: inst, helper: hostSet }));
|
|
15406
|
+
}
|
|
15407
|
+
return all;
|
|
15408
|
+
};
|
|
15409
|
+
var pickElements = (all, pick) => {
|
|
15410
|
+
if (pick === "all")
|
|
15411
|
+
return all;
|
|
15412
|
+
if (pick === "even")
|
|
15413
|
+
return all.filter((_, i) => i % 2 === 0);
|
|
15414
|
+
if (pick === "odd")
|
|
15415
|
+
return all.filter((_, i) => i % 2 === 1);
|
|
15416
|
+
if (typeof pick === "number")
|
|
15417
|
+
return all[pick] ?? null;
|
|
15418
|
+
if (pick === "last")
|
|
15419
|
+
return all.length ? all[all.length - 1] : null;
|
|
15420
|
+
return all.length ? all[0] : null;
|
|
15421
|
+
};
|
|
14031
15422
|
function query(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
14032
15423
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
14033
15424
|
throw new Error(`@query decorator cannot be used on methods. (Method: ${String(optionsOrPropertyKey)})`);
|
|
@@ -14049,112 +15440,26 @@ ${indentStr}}`;
|
|
|
14049
15440
|
ensureInit(this);
|
|
14050
15441
|
const config = getElementConfig(this);
|
|
14051
15442
|
const win = config?.window || window;
|
|
14052
|
-
const
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
if (typeof selectorOrTarget === "
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
} else if (result instanceof win.NodeList || Array.isArray(result)) {
|
|
14060
|
-
resolvedElement = result.length > 0 && result[0] instanceof win.HTMLElement ? result[0] : null;
|
|
14061
|
-
}
|
|
14062
|
-
} else {
|
|
14063
|
-
resolvedSelector = selectorOrTarget;
|
|
14064
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14065
|
-
const applyRoot = (t) => {
|
|
14066
|
-
if (!t || !(t instanceof HTMLElement))
|
|
14067
|
-
return t;
|
|
14068
|
-
if (r === "auto")
|
|
14069
|
-
return t.shadowRoot || t;
|
|
14070
|
-
if (r === "shadow")
|
|
14071
|
-
return t.shadowRoot;
|
|
14072
|
-
if (r === "light")
|
|
14073
|
-
return t;
|
|
14074
|
-
if (r === "all")
|
|
14075
|
-
return t.shadowRoot || t;
|
|
14076
|
-
return t;
|
|
14077
|
-
};
|
|
14078
|
-
if (resolvedSelector === "$this")
|
|
14079
|
-
resolvedElement = applyRoot(this);
|
|
14080
|
-
else if (resolvedSelector === "$host")
|
|
14081
|
-
resolvedElement = applyRoot(hostSet.$host);
|
|
14082
|
-
else if (resolvedSelector === "$parentHost")
|
|
14083
|
-
resolvedElement = applyRoot(hostSet.$parentHost);
|
|
14084
|
-
else if (resolvedSelector === "$appHost")
|
|
14085
|
-
resolvedElement = applyRoot(hostSet.$appHost);
|
|
14086
|
-
else if (resolvedSelector === "$firstHost")
|
|
14087
|
-
resolvedElement = applyRoot(hostSet.$firstHost);
|
|
14088
|
-
else if (resolvedSelector === "$lastHost")
|
|
14089
|
-
resolvedElement = applyRoot(hostSet.$lastHost);
|
|
14090
|
-
else if (resolvedSelector === "$firstAppHost")
|
|
14091
|
-
resolvedElement = applyRoot(hostSet.$firstAppHost);
|
|
14092
|
-
else if (resolvedSelector === "$lastAppHost")
|
|
14093
|
-
resolvedElement = applyRoot(hostSet.$lastAppHost);
|
|
14094
|
-
else if (resolvedSelector === "$window")
|
|
14095
|
-
return win;
|
|
14096
|
-
else if (resolvedSelector === "$document")
|
|
14097
|
-
return win.document;
|
|
14098
|
-
else {
|
|
14099
|
-
if (r === "shadow")
|
|
14100
|
-
resolvedElement = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
14101
|
-
else if (r === "light")
|
|
14102
|
-
resolvedElement = this.querySelector(resolvedSelector);
|
|
14103
|
-
else if (r === "all") {
|
|
14104
|
-
const shadowMatch = this.shadowRoot ? this.shadowRoot.querySelector(resolvedSelector) : null;
|
|
14105
|
-
resolvedElement = shadowMatch || this.querySelector(resolvedSelector);
|
|
14106
|
-
} else
|
|
14107
|
-
resolvedElement = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
14108
|
-
}
|
|
14109
|
-
}
|
|
14110
|
-
if (resolvedElement instanceof win.HTMLElement && optionsOrPropertyKey?.filter) {
|
|
14111
|
-
const shouldInclude = optionsOrPropertyKey.filter(resolvedElement, { currentThis: this, helper: hostSet });
|
|
14112
|
-
if (!shouldInclude) {
|
|
14113
|
-
return null;
|
|
14114
|
-
}
|
|
14115
|
-
}
|
|
14116
|
-
return resolvedElement;
|
|
15443
|
+
const options = optionsOrPropertyKey || {};
|
|
15444
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$window")
|
|
15445
|
+
return win;
|
|
15446
|
+
if (typeof selectorOrTarget === "string" && selectorOrTarget === "$document")
|
|
15447
|
+
return win.document;
|
|
15448
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
15449
|
+
return pickElements(all, options.pick ?? "first");
|
|
14117
15450
|
},
|
|
14118
15451
|
set(nv) {
|
|
14119
15452
|
ensureInit(this);
|
|
14120
|
-
if (nv === null || nv === void 0) {
|
|
15453
|
+
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
14121
15454
|
const config = getElementConfig(this);
|
|
14122
15455
|
const win = config?.window || window;
|
|
14123
|
-
const
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
if (el instanceof win.Element) {
|
|
14131
|
-
el.remove();
|
|
14132
|
-
}
|
|
14133
|
-
}
|
|
14134
|
-
return;
|
|
14135
|
-
}
|
|
14136
|
-
const resolvedSelector = selectorOrTarget;
|
|
14137
|
-
if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
|
|
14138
|
-
return;
|
|
14139
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14140
|
-
const targets = [];
|
|
14141
|
-
if (r === "shadow") {
|
|
14142
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
14143
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
14144
|
-
} else if (r === "light") {
|
|
14145
|
-
if (this.querySelector(resolvedSelector))
|
|
14146
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
14147
|
-
} else if (r === "all") {
|
|
14148
|
-
if (this.shadowRoot?.querySelector(resolvedSelector))
|
|
14149
|
-
targets.push(this.shadowRoot.querySelector(resolvedSelector));
|
|
14150
|
-
if (this.querySelector(resolvedSelector))
|
|
14151
|
-
targets.push(this.querySelector(resolvedSelector));
|
|
14152
|
-
} else {
|
|
14153
|
-
const el = (this.shadowRoot || this).querySelector(resolvedSelector);
|
|
14154
|
-
if (el)
|
|
14155
|
-
targets.push(el);
|
|
14156
|
-
}
|
|
14157
|
-
targets.forEach((t) => t.remove());
|
|
15456
|
+
const options = optionsOrPropertyKey || {};
|
|
15457
|
+
const all = resolveQueryElements(this, selectorOrTarget, options, win);
|
|
15458
|
+
const picked = pickElements(all, options.pick ?? "first");
|
|
15459
|
+
if (Array.isArray(picked))
|
|
15460
|
+
picked.forEach((t) => t.remove());
|
|
15461
|
+
else if (picked)
|
|
15462
|
+
picked.remove();
|
|
14158
15463
|
}
|
|
14159
15464
|
},
|
|
14160
15465
|
enumerable: true,
|
|
@@ -14168,161 +15473,36 @@ ${indentStr}}`;
|
|
|
14168
15473
|
const constructor = target instanceof Function ? target : target.constructor;
|
|
14169
15474
|
return ReflectUtils.getMetadata(QUERY_METADATA_KEY, constructor) ?? [];
|
|
14170
15475
|
};
|
|
14171
|
-
|
|
14172
|
-
// src/decorators/queryAll.ts
|
|
14173
|
-
var QUERY_ALL_METADATA_KEY = Symbol.for("simple-web-component:query-all");
|
|
15476
|
+
var QUERY_ALL_METADATA_KEY = QUERY_METADATA_KEY;
|
|
14174
15477
|
function queryAll(selectorOrTarget, optionsOrPropertyKey, descriptor) {
|
|
14175
15478
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
14176
|
-
|
|
15479
|
+
return query(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
14177
15480
|
}
|
|
14178
15481
|
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
14179
|
-
return (
|
|
14180
|
-
if (descriptor2 !== void 0) {
|
|
14181
|
-
throw new Error(`@queryAll decorator cannot be used on methods. (Method: ${String(propertyKey)})`);
|
|
14182
|
-
}
|
|
14183
|
-
const constructor = targetObj.constructor;
|
|
14184
|
-
let queries = ReflectUtils.getMetadata(QUERY_ALL_METADATA_KEY, constructor);
|
|
14185
|
-
if (!queries) {
|
|
14186
|
-
queries = [];
|
|
14187
|
-
ReflectUtils.defineMetadata(QUERY_ALL_METADATA_KEY, queries, constructor);
|
|
14188
|
-
}
|
|
14189
|
-
queries.push({ propertyKey, selector: selectorOrTarget, options: optionsOrPropertyKey || {} });
|
|
14190
|
-
Object.defineProperty(targetObj, propertyKey, {
|
|
14191
|
-
get() {
|
|
14192
|
-
ensureInit(this);
|
|
14193
|
-
const config = getElementConfig(this);
|
|
14194
|
-
const win = config?.window || window;
|
|
14195
|
-
const hostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
14196
|
-
let resolvedSelector;
|
|
14197
|
-
let resolvedElements = [];
|
|
14198
|
-
if (typeof selectorOrTarget === "function") {
|
|
14199
|
-
const result = selectorOrTarget(this, hostSet);
|
|
14200
|
-
if (result instanceof win.NodeList) {
|
|
14201
|
-
resolvedElements = Array.from(result).filter((el) => el instanceof win.HTMLElement);
|
|
14202
|
-
} else if (Array.isArray(result)) {
|
|
14203
|
-
resolvedElements = result.filter((el) => el instanceof win.HTMLElement);
|
|
14204
|
-
}
|
|
14205
|
-
} else {
|
|
14206
|
-
resolvedSelector = selectorOrTarget;
|
|
14207
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14208
|
-
const applyRoot = (t) => {
|
|
14209
|
-
if (!t)
|
|
14210
|
-
return [];
|
|
14211
|
-
const items = Array.isArray(t) ? t : [t];
|
|
14212
|
-
const results = [];
|
|
14213
|
-
items.forEach((it) => {
|
|
14214
|
-
if (!(it instanceof HTMLElement)) {
|
|
14215
|
-
results.push(it);
|
|
14216
|
-
return;
|
|
14217
|
-
}
|
|
14218
|
-
if (r === "auto")
|
|
14219
|
-
results.push(it.shadowRoot || it);
|
|
14220
|
-
else {
|
|
14221
|
-
if (r === "light" || r === "all")
|
|
14222
|
-
results.push(it);
|
|
14223
|
-
if ((r === "shadow" || r === "all") && it.shadowRoot)
|
|
14224
|
-
results.push(it.shadowRoot);
|
|
14225
|
-
}
|
|
14226
|
-
});
|
|
14227
|
-
return results;
|
|
14228
|
-
};
|
|
14229
|
-
if (resolvedSelector === "$hosts")
|
|
14230
|
-
resolvedElements = applyRoot(hostSet.$hosts).filter((el) => el instanceof HTMLElement);
|
|
14231
|
-
else if (resolvedSelector === "$appHosts")
|
|
14232
|
-
resolvedElements = applyRoot(hostSet.$appHosts).filter((el) => el instanceof HTMLElement);
|
|
14233
|
-
else if (resolvedSelector === "$host")
|
|
14234
|
-
resolvedElements = applyRoot(hostSet.$host).filter((el) => el instanceof HTMLElement);
|
|
14235
|
-
else if (resolvedSelector === "$parentHost")
|
|
14236
|
-
resolvedElements = applyRoot(hostSet.$parentHost).filter((el) => el instanceof HTMLElement);
|
|
14237
|
-
else if (resolvedSelector === "$appHost")
|
|
14238
|
-
resolvedElements = applyRoot(hostSet.$appHost).filter((el) => el instanceof HTMLElement);
|
|
14239
|
-
else if (resolvedSelector === "$firstHost")
|
|
14240
|
-
resolvedElements = applyRoot(hostSet.$firstHost).filter((el) => el instanceof HTMLElement);
|
|
14241
|
-
else if (resolvedSelector === "$lastHost")
|
|
14242
|
-
resolvedElements = applyRoot(hostSet.$lastHost).filter((el) => el instanceof HTMLElement);
|
|
14243
|
-
else if (resolvedSelector === "$firstAppHost")
|
|
14244
|
-
resolvedElements = applyRoot(hostSet.$firstAppHost).filter((el) => el instanceof HTMLElement);
|
|
14245
|
-
else if (resolvedSelector === "$lastAppHost")
|
|
14246
|
-
resolvedElements = applyRoot(hostSet.$lastAppHost).filter((el) => el instanceof HTMLElement);
|
|
14247
|
-
else if (resolvedSelector === "$window")
|
|
14248
|
-
return [win];
|
|
14249
|
-
else if (resolvedSelector === "$document")
|
|
14250
|
-
return [win.document];
|
|
14251
|
-
else if (resolvedSelector === "$this")
|
|
14252
|
-
resolvedElements = applyRoot(this).filter((el) => el instanceof HTMLElement);
|
|
14253
|
-
else {
|
|
14254
|
-
if (r === "shadow")
|
|
14255
|
-
resolvedElements = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14256
|
-
else if (r === "light")
|
|
14257
|
-
resolvedElements = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14258
|
-
else if (r === "all") {
|
|
14259
|
-
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14260
|
-
const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14261
|
-
resolvedElements = [...sNodes, ...lNodes];
|
|
14262
|
-
} else
|
|
14263
|
-
resolvedElements = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
|
|
14264
|
-
}
|
|
14265
|
-
}
|
|
14266
|
-
if (optionsOrPropertyKey?.filter) {
|
|
14267
|
-
resolvedElements = resolvedElements.filter((el) => {
|
|
14268
|
-
if (!(el instanceof win.HTMLElement))
|
|
14269
|
-
return true;
|
|
14270
|
-
return optionsOrPropertyKey.filter(el, { currentThis: this, helper: hostSet });
|
|
14271
|
-
});
|
|
14272
|
-
}
|
|
14273
|
-
return resolvedElements;
|
|
14274
|
-
},
|
|
14275
|
-
set(nv) {
|
|
14276
|
-
ensureInit(this);
|
|
14277
|
-
if (nv === null || nv === void 0 || Array.isArray(nv) && nv.length === 0) {
|
|
14278
|
-
const config = getElementConfig(this);
|
|
14279
|
-
const win = config?.window || window;
|
|
14280
|
-
const hostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
14281
|
-
if (typeof selectorOrTarget === "function") {
|
|
14282
|
-
const result = selectorOrTarget(this, hostSet);
|
|
14283
|
-
if (result instanceof win.NodeList) {
|
|
14284
|
-
Array.from(result).forEach((el) => {
|
|
14285
|
-
if (el instanceof win.Element)
|
|
14286
|
-
el.remove();
|
|
14287
|
-
});
|
|
14288
|
-
} else if (Array.isArray(result)) {
|
|
14289
|
-
result.forEach((el) => {
|
|
14290
|
-
if (el instanceof win.Element)
|
|
14291
|
-
el.remove();
|
|
14292
|
-
});
|
|
14293
|
-
}
|
|
14294
|
-
return;
|
|
14295
|
-
}
|
|
14296
|
-
const resolvedSelector = selectorOrTarget;
|
|
14297
|
-
if (resolvedSelector.startsWith("$") && resolvedSelector !== "$this")
|
|
14298
|
-
return;
|
|
14299
|
-
const r = optionsOrPropertyKey?.root || "auto";
|
|
14300
|
-
let targets = [];
|
|
14301
|
-
if (r === "shadow")
|
|
14302
|
-
targets = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14303
|
-
else if (r === "light")
|
|
14304
|
-
targets = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14305
|
-
else if (r === "all") {
|
|
14306
|
-
const sNodes = this.shadowRoot ? Array.from(this.shadowRoot.querySelectorAll(resolvedSelector)) : [];
|
|
14307
|
-
const lNodes = Array.from(this.querySelectorAll(resolvedSelector));
|
|
14308
|
-
targets = [...sNodes, ...lNodes];
|
|
14309
|
-
} else {
|
|
14310
|
-
targets = Array.from((this.shadowRoot || this).querySelectorAll(resolvedSelector));
|
|
14311
|
-
}
|
|
14312
|
-
targets.forEach((t) => t.remove());
|
|
14313
|
-
}
|
|
14314
|
-
},
|
|
14315
|
-
enumerable: true,
|
|
14316
|
-
configurable: true
|
|
14317
|
-
});
|
|
14318
|
-
};
|
|
15482
|
+
return query(selectorOrTarget, { ...optionsOrPropertyKey ?? {}, pick: "all" });
|
|
14319
15483
|
}
|
|
14320
|
-
return
|
|
15484
|
+
return query({ ...selectorOrTarget ?? {}, pick: "all" });
|
|
14321
15485
|
}
|
|
14322
|
-
var getQueryAllMetadata =
|
|
14323
|
-
|
|
14324
|
-
return
|
|
14325
|
-
}
|
|
15486
|
+
var getQueryAllMetadata = getQueryMetadata;
|
|
15487
|
+
function queryShadow(selector, options) {
|
|
15488
|
+
return query(selector, { ...options ?? {}, root: "shadow" });
|
|
15489
|
+
}
|
|
15490
|
+
function queryLight(selector, options) {
|
|
15491
|
+
return query(selector, { ...options ?? {}, root: "light" });
|
|
15492
|
+
}
|
|
15493
|
+
function queryAllRoots(selector, options) {
|
|
15494
|
+
return query(selector, { ...options ?? {}, root: "all" });
|
|
15495
|
+
}
|
|
15496
|
+
function queryAllShadow(selector, options) {
|
|
15497
|
+
return query(selector, { ...options ?? {}, root: "shadow", pick: "all" });
|
|
15498
|
+
}
|
|
15499
|
+
function queryAllLight(selector, options) {
|
|
15500
|
+
return query(selector, { ...options ?? {}, root: "light", pick: "all" });
|
|
15501
|
+
}
|
|
15502
|
+
function queryAllAll(selector, options) {
|
|
15503
|
+
return query(selector, { ...options ?? {}, root: "all", pick: "all" });
|
|
15504
|
+
}
|
|
15505
|
+
var queryIn = (root, pick) => (selector, options) => query(selector, { ...options ?? {}, root, ...pick !== void 0 ? { pick } : {} });
|
|
14326
15506
|
|
|
14327
15507
|
// src/config/config.ts
|
|
14328
15508
|
var HTML_TAG_ENTRIES = [
|
|
@@ -14384,7 +15564,7 @@ ${indentStr}}`;
|
|
|
14384
15564
|
["HTMLHeadingElement", "h1"],
|
|
14385
15565
|
["HTMLBodyElement", "body"]
|
|
14386
15566
|
];
|
|
14387
|
-
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", "
|
|
15567
|
+
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"];
|
|
14388
15568
|
var BROWSER_GLOBALS = ["window", "document", "Node", "Element", "HTMLElement", "DocumentFragment", "CustomEvent", "customElements", "NodeFilter", ...HTML_TAG_ENTRIES.map(([className]) => className)];
|
|
14389
15569
|
|
|
14390
15570
|
// ../simple-boot/dist/esm/decorators/inject/Inject.js
|
|
@@ -14652,6 +15832,12 @@ ${indentStr}}`;
|
|
|
14652
15832
|
return;
|
|
14653
15833
|
}
|
|
14654
15834
|
const resolvedRes = typeof resolvedValue === "function" ? resolvedValue(targetEl, hostSet) : resolvedValue;
|
|
15835
|
+
if (finalOptions.setType === "call") {
|
|
15836
|
+
if (typeof targetEl[targetPropertyKey] !== "function") return;
|
|
15837
|
+
if (Array.isArray(resolvedRes)) targetEl[targetPropertyKey].apply(targetEl, resolvedRes);
|
|
15838
|
+
else targetEl[targetPropertyKey].call(targetEl, resolvedRes);
|
|
15839
|
+
return;
|
|
15840
|
+
}
|
|
14655
15841
|
targetEl[targetPropertyKey] = resolvedRes;
|
|
14656
15842
|
});
|
|
14657
15843
|
return resolvedValue;
|
|
@@ -14696,7 +15882,11 @@ ${indentStr}}`;
|
|
|
14696
15882
|
}
|
|
14697
15883
|
return true;
|
|
14698
15884
|
});
|
|
14699
|
-
const values = filtered.map((el) =>
|
|
15885
|
+
const values = filtered.map((el) => {
|
|
15886
|
+
const raw = el[targetPropertyKey];
|
|
15887
|
+
if (finalOptions.getType === "call" && typeof raw === "function") return raw.call(el);
|
|
15888
|
+
return raw;
|
|
15889
|
+
});
|
|
14700
15890
|
return values.length === 1 ? values[0] : values;
|
|
14701
15891
|
},
|
|
14702
15892
|
set(value) {
|
|
@@ -14707,30 +15897,309 @@ ${indentStr}}`;
|
|
|
14707
15897
|
};
|
|
14708
15898
|
}
|
|
14709
15899
|
function property(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor) {
|
|
14710
|
-
if (optionsOrDescriptor !== void 0 && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
15900
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof targetPropertyKeyOrOptions === "string" || typeof targetPropertyKeyOrOptions === "symbol")) {
|
|
14711
15901
|
return applyProperty("$this", void 0, {})(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
14712
15902
|
}
|
|
14713
15903
|
if (typeof selectorOrTarget === "string") {
|
|
14714
15904
|
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
14715
15905
|
}
|
|
15906
|
+
if (typeof selectorOrTarget === "function") {
|
|
15907
|
+
return applyProperty(selectorOrTarget, targetPropertyKeyOrOptions, optionsOrDescriptor);
|
|
15908
|
+
}
|
|
14716
15909
|
return applyProperty("$this", void 0, selectorOrTarget);
|
|
14717
15910
|
}
|
|
14718
15911
|
function setProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined) {
|
|
14719
15912
|
if (typeof selectorOrOptions === "string") {
|
|
14720
15913
|
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
14721
15914
|
}
|
|
14722
|
-
|
|
14723
|
-
|
|
14724
|
-
|
|
14725
|
-
|
|
14726
|
-
|
|
14727
|
-
|
|
14728
|
-
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14732
|
-
|
|
14733
|
-
|
|
15915
|
+
if (typeof selectorOrOptions === "function") {
|
|
15916
|
+
return applyProperty(selectorOrOptions, targetPropertyKeyOrOptions, optionsOrUndefined);
|
|
15917
|
+
}
|
|
15918
|
+
return applyProperty("$this", void 0, selectorOrOptions);
|
|
15919
|
+
}
|
|
15920
|
+
function callProperty(selectorOrTarget, targetMethodKeyOrOptions, optionsOrUndefined) {
|
|
15921
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
15922
|
+
if (typeof targetMethodKeyOrOptions === "string" || typeof targetMethodKeyOrOptions === "symbol") {
|
|
15923
|
+
return applyProperty(selectorOrTarget, targetMethodKeyOrOptions, { ...optionsOrUndefined ?? {}, setType: "call" });
|
|
15924
|
+
}
|
|
15925
|
+
return applyProperty(selectorOrTarget, { ...optionsOrUndefined ?? targetMethodKeyOrOptions ?? {}, setType: "call" });
|
|
15926
|
+
}
|
|
15927
|
+
return applyProperty("$this", void 0, { ...selectorOrTarget ?? {}, setType: "call" });
|
|
15928
|
+
}
|
|
15929
|
+
function callPropertyLight(selector, targetMethodKeyOrOptions, options) {
|
|
15930
|
+
if (targetMethodKeyOrOptions != null && typeof targetMethodKeyOrOptions !== "string" && typeof targetMethodKeyOrOptions !== "symbol") {
|
|
15931
|
+
return callProperty(selector, void 0, { ...targetMethodKeyOrOptions ?? {}, root: "light" });
|
|
15932
|
+
}
|
|
15933
|
+
return callProperty(selector, targetMethodKeyOrOptions, { ...options ?? {}, root: "light" });
|
|
15934
|
+
}
|
|
15935
|
+
function callPropertyShadow(selector, targetMethodKeyOrOptions, options) {
|
|
15936
|
+
if (targetMethodKeyOrOptions != null && typeof targetMethodKeyOrOptions !== "string" && typeof targetMethodKeyOrOptions !== "symbol") {
|
|
15937
|
+
return callProperty(selector, void 0, { ...targetMethodKeyOrOptions ?? {}, root: "shadow" });
|
|
15938
|
+
}
|
|
15939
|
+
return callProperty(selector, targetMethodKeyOrOptions, { ...options ?? {}, root: "shadow" });
|
|
15940
|
+
}
|
|
15941
|
+
function callPropertyAll(selector, targetMethodKey, options) {
|
|
15942
|
+
return callProperty(selector, targetMethodKey, { ...options ?? {}, root: "all" });
|
|
15943
|
+
}
|
|
15944
|
+
var findAllPropertyMetadata = (target) => {
|
|
15945
|
+
const actualTarget = target instanceof Function ? target : target.constructor;
|
|
15946
|
+
return ReflectUtils.findAllMetadata(PROPERTY_METADATA_KEY, actualTarget).flat();
|
|
15947
|
+
};
|
|
15948
|
+
var findAllPropertyApplyMetadata = (target) => {
|
|
15949
|
+
const result = /* @__PURE__ */ new Map();
|
|
15950
|
+
findAllPropertyMetadata(target).forEach((meta) => {
|
|
15951
|
+
result.set(meta.propertyKey, meta);
|
|
15952
|
+
});
|
|
15953
|
+
return result;
|
|
15954
|
+
};
|
|
15955
|
+
var prop = applyProperty;
|
|
15956
|
+
function propThis(targetPropertyKey, options) {
|
|
15957
|
+
return applyProperty("$this", targetPropertyKey, options);
|
|
15958
|
+
}
|
|
15959
|
+
function propAppHost(targetPropertyKey, options) {
|
|
15960
|
+
return applyProperty("$appHost", targetPropertyKey, options);
|
|
15961
|
+
}
|
|
15962
|
+
function propWindow(targetPropertyKey, options) {
|
|
15963
|
+
return applyProperty("$window", targetPropertyKey, options);
|
|
15964
|
+
}
|
|
15965
|
+
function propDocument(targetPropertyKey, options) {
|
|
15966
|
+
return applyProperty("$document", targetPropertyKey, options);
|
|
15967
|
+
}
|
|
15968
|
+
function propLight(selector, targetPropertyKey, options) {
|
|
15969
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15970
|
+
}
|
|
15971
|
+
function propShadow(selector, targetPropertyKey, options) {
|
|
15972
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15973
|
+
}
|
|
15974
|
+
function propAll(selector, targetPropertyKey, options) {
|
|
15975
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15976
|
+
}
|
|
15977
|
+
function setPropertyLight(selector, targetPropertyKey, options) {
|
|
15978
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15979
|
+
}
|
|
15980
|
+
function setPropertyShadow(selector, targetPropertyKey, options) {
|
|
15981
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15982
|
+
}
|
|
15983
|
+
function setPropertyAll(selector, targetPropertyKey, options) {
|
|
15984
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15985
|
+
}
|
|
15986
|
+
function propertyLight(selector, targetPropertyKey, options) {
|
|
15987
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "light" });
|
|
15988
|
+
}
|
|
15989
|
+
function propertyShadow(selector, targetPropertyKey, options) {
|
|
15990
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "shadow" });
|
|
15991
|
+
}
|
|
15992
|
+
function propertyAll(selector, targetPropertyKey, options) {
|
|
15993
|
+
return applyProperty(selector, targetPropertyKey, { ...options ?? {}, root: "all" });
|
|
15994
|
+
}
|
|
15995
|
+
|
|
15996
|
+
// src/decorators/subscribeSwcAppMessageWhileConnected.ts
|
|
15997
|
+
var SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-message-while-connected");
|
|
15998
|
+
function createSubscribeSwcAppMessageWhileConnected(options, messageType) {
|
|
15999
|
+
return (target, propertyKey, descriptor) => {
|
|
16000
|
+
const filter = options?.filter;
|
|
16001
|
+
const constructor = target.constructor;
|
|
16002
|
+
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16003
|
+
if (!list) {
|
|
16004
|
+
list = [];
|
|
16005
|
+
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
16006
|
+
}
|
|
16007
|
+
list.push({ propertyKey, messageType, filter });
|
|
16008
|
+
return descriptor;
|
|
16009
|
+
};
|
|
16010
|
+
}
|
|
16011
|
+
function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions, optionsOrPropertyKey, descriptor) {
|
|
16012
|
+
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && optionsOrPropertyKey && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol") && descriptor) {
|
|
16013
|
+
const target = targetOrMessageTypeOrOptions;
|
|
16014
|
+
const propertyKey = optionsOrPropertyKey;
|
|
16015
|
+
return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);
|
|
16016
|
+
}
|
|
16017
|
+
let messageType;
|
|
16018
|
+
let options = {};
|
|
16019
|
+
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
16020
|
+
messageType = targetOrMessageTypeOrOptions;
|
|
16021
|
+
if (optionsOrPropertyKey && typeof optionsOrPropertyKey === "object") {
|
|
16022
|
+
options = optionsOrPropertyKey;
|
|
16023
|
+
}
|
|
16024
|
+
} else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object") {
|
|
16025
|
+
options = targetOrMessageTypeOrOptions;
|
|
16026
|
+
}
|
|
16027
|
+
return createSubscribeSwcAppMessageWhileConnected(options, messageType);
|
|
16028
|
+
}
|
|
16029
|
+
var receiveMessage = subscribeSwcAppMessageWhileConnected;
|
|
16030
|
+
var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
16031
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
16032
|
+
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16033
|
+
};
|
|
16034
|
+
var MessageSubscribeLifeCycler = class {
|
|
16035
|
+
onConnected(_helperHostSet) {
|
|
16036
|
+
}
|
|
16037
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
16038
|
+
getMetadata(helperHostSet) {
|
|
16039
|
+
return getSubscribeSwcAppMessageWhileConnectedMetadata(helperHostSet.$this);
|
|
16040
|
+
}
|
|
16041
|
+
};
|
|
16042
|
+
|
|
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
|
+
var RouteSubscribeLifeCycler = class {
|
|
16087
|
+
onConnected(_helperHostSet) {
|
|
16088
|
+
}
|
|
16089
|
+
/** SwcAppMixin 이 구독 대상 메타를 꺼낼 때 사용 */
|
|
16090
|
+
getMetadata(helperHostSet) {
|
|
16091
|
+
return getSubscribeSwcAppRouteChangeWhileConnectedMetadata(helperHostSet.$this);
|
|
16092
|
+
}
|
|
16093
|
+
};
|
|
16094
|
+
|
|
16095
|
+
// src/decorators/setInterval.ts
|
|
16096
|
+
var SET_INTERVAL_METADATA_KEY = Symbol.for("simple-web-component:set-interval");
|
|
16097
|
+
function setInterval2(interval2, options = {}) {
|
|
16098
|
+
return (target, propertyKey) => {
|
|
16099
|
+
const constructor = target.constructor;
|
|
16100
|
+
let metaList = ReflectUtils.getOwnMetadata(SET_INTERVAL_METADATA_KEY, constructor);
|
|
16101
|
+
if (!metaList) {
|
|
16102
|
+
metaList = [];
|
|
16103
|
+
ReflectUtils.defineMetadata(SET_INTERVAL_METADATA_KEY, metaList, constructor);
|
|
16104
|
+
}
|
|
16105
|
+
metaList.push({ propertyKey, interval: interval2, options });
|
|
16106
|
+
};
|
|
16107
|
+
}
|
|
16108
|
+
var findAllSetIntervalMetadata = (target) => {
|
|
16109
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
16110
|
+
return (ReflectUtils.findAllMetadata(SET_INTERVAL_METADATA_KEY, constructor) || []).flat();
|
|
16111
|
+
};
|
|
16112
|
+
var SetIntervalLifeCycler = class {
|
|
16113
|
+
constructor() {
|
|
16114
|
+
__publicField(this, "activeMap", /* @__PURE__ */ new WeakMap());
|
|
16115
|
+
}
|
|
16116
|
+
onConnected(helperHostSet) {
|
|
16117
|
+
const inst = helperHostSet.$this;
|
|
16118
|
+
const ids = [];
|
|
16119
|
+
for (const meta of findAllSetIntervalMetadata(inst)) {
|
|
16120
|
+
const id = helperHostSet.$w.setInterval(() => {
|
|
16121
|
+
const args = meta.options.parameter?.(helperHostSet) ?? [];
|
|
16122
|
+
try {
|
|
16123
|
+
const res = inst[meta.propertyKey](...args);
|
|
16124
|
+
const vk = meta.options.valueKey;
|
|
16125
|
+
if (vk && res && typeof res === "object" && typeof res[vk] === "function") {
|
|
16126
|
+
res[vk](id);
|
|
16127
|
+
}
|
|
16128
|
+
} catch (e) {
|
|
16129
|
+
console.error("[SWC] setInterval tick error:", e);
|
|
16130
|
+
}
|
|
16131
|
+
}, meta.interval);
|
|
16132
|
+
meta.options.created?.(helperHostSet, id);
|
|
16133
|
+
ids.push(id);
|
|
16134
|
+
}
|
|
16135
|
+
this.activeMap.set(inst, ids);
|
|
16136
|
+
}
|
|
16137
|
+
onDisconnected(helperHostSet) {
|
|
16138
|
+
const inst = helperHostSet.$this;
|
|
16139
|
+
for (const id of this.activeMap.get(inst) ?? []) {
|
|
16140
|
+
try {
|
|
16141
|
+
helperHostSet.$w.clearInterval(id);
|
|
16142
|
+
} catch (e) {
|
|
16143
|
+
console.error("[SWC] clearInterval error:", e);
|
|
16144
|
+
}
|
|
16145
|
+
}
|
|
16146
|
+
this.activeMap.delete(inst);
|
|
16147
|
+
}
|
|
16148
|
+
};
|
|
16149
|
+
|
|
16150
|
+
// src/decorators/setTimeout.ts
|
|
16151
|
+
var SET_TIMEOUT_METADATA_KEY = Symbol.for("simple-web-component:set-timeout");
|
|
16152
|
+
function setTimeout2(delay, options = {}) {
|
|
16153
|
+
return (target, propertyKey) => {
|
|
16154
|
+
const constructor = target.constructor;
|
|
16155
|
+
let metaList = ReflectUtils.getOwnMetadata(SET_TIMEOUT_METADATA_KEY, constructor);
|
|
16156
|
+
if (!metaList) {
|
|
16157
|
+
metaList = [];
|
|
16158
|
+
ReflectUtils.defineMetadata(SET_TIMEOUT_METADATA_KEY, metaList, constructor);
|
|
16159
|
+
}
|
|
16160
|
+
metaList.push({ propertyKey, delay, options });
|
|
16161
|
+
};
|
|
16162
|
+
}
|
|
16163
|
+
var findAllSetTimeoutMetadata = (target) => {
|
|
16164
|
+
const constructor = target instanceof Function ? target : target.constructor;
|
|
16165
|
+
return (ReflectUtils.findAllMetadata(SET_TIMEOUT_METADATA_KEY, constructor) || []).flat();
|
|
16166
|
+
};
|
|
16167
|
+
var SetTimeoutLifeCycler = class {
|
|
16168
|
+
constructor() {
|
|
16169
|
+
__publicField(this, "activeMap", /* @__PURE__ */ new WeakMap());
|
|
16170
|
+
}
|
|
16171
|
+
onConnected(helperHostSet) {
|
|
16172
|
+
const inst = helperHostSet.$this;
|
|
16173
|
+
const ids = [];
|
|
16174
|
+
for (const meta of findAllSetTimeoutMetadata(inst)) {
|
|
16175
|
+
const id = helperHostSet.$w.setTimeout(() => {
|
|
16176
|
+
const args = meta.options.parameter?.(helperHostSet) ?? [];
|
|
16177
|
+
try {
|
|
16178
|
+
const res = inst[meta.propertyKey](...args);
|
|
16179
|
+
const vk = meta.options.valueKey;
|
|
16180
|
+
if (vk && res && typeof res === "object" && typeof res[vk] === "function") {
|
|
16181
|
+
res[vk](id);
|
|
16182
|
+
}
|
|
16183
|
+
} catch (e) {
|
|
16184
|
+
console.error("[SWC] setTimeout fire error:", e);
|
|
16185
|
+
}
|
|
16186
|
+
}, meta.delay);
|
|
16187
|
+
meta.options.created?.(helperHostSet, id);
|
|
16188
|
+
ids.push(id);
|
|
16189
|
+
}
|
|
16190
|
+
this.activeMap.set(inst, ids);
|
|
16191
|
+
}
|
|
16192
|
+
onDisconnected(helperHostSet) {
|
|
16193
|
+
const inst = helperHostSet.$this;
|
|
16194
|
+
for (const id of this.activeMap.get(inst) ?? []) {
|
|
16195
|
+
try {
|
|
16196
|
+
helperHostSet.$w.clearTimeout(id);
|
|
16197
|
+
} catch (e) {
|
|
16198
|
+
console.error("[SWC] clearTimeout error:", e);
|
|
16199
|
+
}
|
|
16200
|
+
}
|
|
16201
|
+
this.activeMap.delete(inst);
|
|
16202
|
+
}
|
|
14734
16203
|
};
|
|
14735
16204
|
|
|
14736
16205
|
// src/decorators/elementDefine.ts
|
|
@@ -14743,7 +16212,6 @@ ${indentStr}}`;
|
|
|
14743
16212
|
if (!inst.__swc_initialized) {
|
|
14744
16213
|
inst._swcId = inst?.getAttribute?.("swc-use-ssr") ?? "s" + Math.random().toString(36).substring(2, 11).toLowerCase();
|
|
14745
16214
|
inst._emitHandlers = /* @__PURE__ */ new Map();
|
|
14746
|
-
inst._boundListeners = [];
|
|
14747
16215
|
inst.__swc_initialized = true;
|
|
14748
16216
|
const target = inst instanceof Function ? inst : inst.constructor;
|
|
14749
16217
|
const attributeAllList = findAllAttributeMetadata(target).filter((it) => it.type === "property");
|
|
@@ -14791,13 +16259,13 @@ ${indentStr}}`;
|
|
|
14791
16259
|
const path = event2.composedPath();
|
|
14792
16260
|
const type = event2.type;
|
|
14793
16261
|
const attrName = `swc-on-${type}`;
|
|
14794
|
-
for (const
|
|
14795
|
-
if (!(
|
|
14796
|
-
const script =
|
|
14797
|
-
if (script && !getElementConfig(
|
|
14798
|
-
const host = SwcUtils.findNearestSwcHostIncludingSelf(
|
|
16262
|
+
for (const node2 of path) {
|
|
16263
|
+
if (!(node2 instanceof HTMLElement)) continue;
|
|
16264
|
+
const script = node2.getAttribute?.(attrName);
|
|
16265
|
+
if (script && !getElementConfig(node2)) {
|
|
16266
|
+
const host = SwcUtils.findNearestSwcHostIncludingSelf(node2);
|
|
14799
16267
|
if (host && host.isConnected && typeof host.__swc_executeAttributeEvent === "function") {
|
|
14800
|
-
await host.__swc_executeAttributeEvent(
|
|
16268
|
+
await host.__swc_executeAttributeEvent(node2, attrName, script, event2);
|
|
14801
16269
|
event2.__swc_handled = true;
|
|
14802
16270
|
break;
|
|
14803
16271
|
}
|
|
@@ -14808,8 +16276,8 @@ ${indentStr}}`;
|
|
|
14808
16276
|
const win = configWindow;
|
|
14809
16277
|
const doc = win?.document;
|
|
14810
16278
|
const builtInTagMap = /* @__PURE__ */ new Map();
|
|
14811
|
-
for (const [
|
|
14812
|
-
if (win?.[
|
|
16279
|
+
for (const [cls2, tag] of HTML_TAG_ENTRIES) {
|
|
16280
|
+
if (win?.[cls2]) builtInTagMap.set(win[cls2], tag);
|
|
14813
16281
|
}
|
|
14814
16282
|
const domHelpers = SwcUtils.getHelperSet(win);
|
|
14815
16283
|
return { win, doc, builtInTagMap, domHelpers };
|
|
@@ -14942,10 +16410,6 @@ ${indentStr}}`;
|
|
|
14942
16410
|
}
|
|
14943
16411
|
metadata.extends = extendsTagName;
|
|
14944
16412
|
}
|
|
14945
|
-
const emitCustomEventList = getEmitCustomEventMetadataList(constructor) || [];
|
|
14946
|
-
const emitHostCustomEventList = emitCustomEventList.filter((meta) => meta.selector === "$this" || meta.selector === "");
|
|
14947
|
-
const addEventListenerList = getAddEventListenerMetadata(constructor) || [];
|
|
14948
|
-
const attrChangeMap = findAllAttributeChangedMetadata(constructor);
|
|
14949
16413
|
const attributeList = findAllAttributeMetadata(constructor);
|
|
14950
16414
|
const applyAttributeMap = findAllAttributeApplyMetadata(constructor);
|
|
14951
16415
|
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"];
|
|
@@ -14953,10 +16417,222 @@ ${indentStr}}`;
|
|
|
14953
16417
|
const attributeApplyNames = Array.from(applyAttributeMap.values()).map((it) => it.targetAttributeName).filter(Boolean);
|
|
14954
16418
|
const hostAttributes = attributeList.filter((it) => it.selector === "$this").map((it) => it.propertyKey || String(it.propertyKey));
|
|
14955
16419
|
const originalStaticObservedAttributes = constructor.observedAttributes ?? [];
|
|
14956
|
-
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...attrChangeMap.keys(), ...attributeApplyNames, ...hostAttributes, ...emitHostCustomEventList.map((it) => it.options.attributeName).filter(Boolean), ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
14957
16420
|
const proto = constructor.prototype;
|
|
14958
16421
|
setupPrototype(proto, win);
|
|
14959
16422
|
let helperHostSet = null;
|
|
16423
|
+
const eventCycler = new EventListenerLifeCycler();
|
|
16424
|
+
const cyclers = [
|
|
16425
|
+
eventCycler,
|
|
16426
|
+
new ChangedAttributeLifeCycler(),
|
|
16427
|
+
new EmitCustomEventLifeCycler(),
|
|
16428
|
+
new ResizeObserverLifeCycler(),
|
|
16429
|
+
new IntersectionObserverLifeCycler(),
|
|
16430
|
+
new MutationObserverLifeCycler(),
|
|
16431
|
+
new MessageSubscribeLifeCycler(),
|
|
16432
|
+
new RouteSubscribeLifeCycler(),
|
|
16433
|
+
new SetIntervalLifeCycler(),
|
|
16434
|
+
new SetTimeoutLifeCycler()
|
|
16435
|
+
];
|
|
16436
|
+
const cyclerObservedAttributes = cyclers.flatMap((c) => c.getObservedAttributeNames?.(constructor) ?? []);
|
|
16437
|
+
const mergedObservedAttributes = [.../* @__PURE__ */ new Set([...metadata.observedAttributes ?? [], ...originalStaticObservedAttributes, ...cyclerObservedAttributes, ...attributeApplyNames, ...hostAttributes, ...swcLifecycleAttributes, ...swcOnEvents])];
|
|
16438
|
+
const buildObservers = async (helperHostSet2) => {
|
|
16439
|
+
const inst = helperHostSet2.$this;
|
|
16440
|
+
const observers = [];
|
|
16441
|
+
let resizeObserverSet = [];
|
|
16442
|
+
let mutationObserverSet = [];
|
|
16443
|
+
let intersectionObserverSet = [];
|
|
16444
|
+
const resolveDelegateRoots = (delegateRoot) => {
|
|
16445
|
+
const r = delegateRoot || "auto";
|
|
16446
|
+
const roots = [];
|
|
16447
|
+
if (r === "auto") roots.push(inst.shadowRoot || inst);
|
|
16448
|
+
else if (r === "light") roots.push(inst);
|
|
16449
|
+
else if (r === "shadow" && inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
16450
|
+
else if (r === "all") {
|
|
16451
|
+
roots.push(inst);
|
|
16452
|
+
if (inst.shadowRoot) roots.push(inst.shadowRoot);
|
|
16453
|
+
}
|
|
16454
|
+
return roots;
|
|
16455
|
+
};
|
|
16456
|
+
for (const c of cyclers) {
|
|
16457
|
+
const result = await c.onConnected?.(helperHostSet2, resizeObserverSet);
|
|
16458
|
+
if (!result) continue;
|
|
16459
|
+
if (result.resizeObserverSet?.length) resizeObserverSet = [...resizeObserverSet, ...result.resizeObserverSet];
|
|
16460
|
+
if (result.mutationObserverSet?.length) mutationObserverSet = [...mutationObserverSet, ...result.mutationObserverSet];
|
|
16461
|
+
if (result.intersectionObserverSet?.length) intersectionObserverSet = [...intersectionObserverSet, ...result.intersectionObserverSet];
|
|
16462
|
+
}
|
|
16463
|
+
const resizeDelegates = (resizeObserverSet ?? []).filter((t) => t.delegate && typeof t.target === "string");
|
|
16464
|
+
let resizeObserve;
|
|
16465
|
+
let resizeUnobserve;
|
|
16466
|
+
const resizeObserved = /* @__PURE__ */ new WeakSet();
|
|
16467
|
+
if (resizeObserverSet?.length) {
|
|
16468
|
+
const roCallbacks = [...new Set(resizeObserverSet.map((e) => e.callback))];
|
|
16469
|
+
const ro = new win.ResizeObserver((entries, obs) => {
|
|
16470
|
+
for (const cb of roCallbacks) cb(entries, obs);
|
|
16471
|
+
});
|
|
16472
|
+
for (const e of resizeObserverSet) {
|
|
16473
|
+
if (e.delegate) continue;
|
|
16474
|
+
if (typeof e.target === "string") {
|
|
16475
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16476
|
+
for (const sr of scope) {
|
|
16477
|
+
sr.querySelectorAll(e.target).forEach((el) => {
|
|
16478
|
+
if (!resizeObserved.has(el)) {
|
|
16479
|
+
ro.observe(el, e.options);
|
|
16480
|
+
resizeObserved.add(el);
|
|
16481
|
+
}
|
|
16482
|
+
});
|
|
16483
|
+
}
|
|
16484
|
+
continue;
|
|
16485
|
+
}
|
|
16486
|
+
ro.observe(e.target, e.options);
|
|
16487
|
+
if (e.target instanceof Element) resizeObserved.add(e.target);
|
|
16488
|
+
}
|
|
16489
|
+
resizeObserve = (el, opts) => {
|
|
16490
|
+
if (resizeObserved.has(el)) return;
|
|
16491
|
+
ro.observe(el, opts);
|
|
16492
|
+
resizeObserved.add(el);
|
|
16493
|
+
};
|
|
16494
|
+
resizeUnobserve = (el) => {
|
|
16495
|
+
if (!resizeObserved.has(el)) return;
|
|
16496
|
+
ro.unobserve(el);
|
|
16497
|
+
resizeObserved.delete(el);
|
|
16498
|
+
};
|
|
16499
|
+
observers.push(ro);
|
|
16500
|
+
}
|
|
16501
|
+
const intersectionDelegates = [];
|
|
16502
|
+
for (const group of intersectionObserverSet) {
|
|
16503
|
+
const ioCallbacks = [...new Set(group.observeTargets.map((e) => e.callback))];
|
|
16504
|
+
const io = new win.IntersectionObserver((entries, obs) => {
|
|
16505
|
+
for (const cb of ioCallbacks) cb(entries, obs);
|
|
16506
|
+
}, group.options);
|
|
16507
|
+
const ioObserved = /* @__PURE__ */ new WeakSet();
|
|
16508
|
+
for (const e of group.observeTargets) {
|
|
16509
|
+
if (e.delegate) {
|
|
16510
|
+
const target = e.target;
|
|
16511
|
+
const observe = (el) => {
|
|
16512
|
+
if (ioObserved.has(el)) return;
|
|
16513
|
+
io.observe(el);
|
|
16514
|
+
ioObserved.add(el);
|
|
16515
|
+
};
|
|
16516
|
+
const unobserve = (el) => {
|
|
16517
|
+
if (!ioObserved.has(el)) return;
|
|
16518
|
+
io.unobserve(el);
|
|
16519
|
+
ioObserved.delete(el);
|
|
16520
|
+
};
|
|
16521
|
+
intersectionDelegates.push({ target, delegateRoot: e.delegateRoot, observe, unobserve });
|
|
16522
|
+
continue;
|
|
16523
|
+
}
|
|
16524
|
+
if (typeof e.target === "string") {
|
|
16525
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16526
|
+
for (const sr of scope) {
|
|
16527
|
+
sr.querySelectorAll(e.target).forEach((el) => {
|
|
16528
|
+
if (!ioObserved.has(el)) {
|
|
16529
|
+
io.observe(el);
|
|
16530
|
+
ioObserved.add(el);
|
|
16531
|
+
}
|
|
16532
|
+
});
|
|
16533
|
+
}
|
|
16534
|
+
continue;
|
|
16535
|
+
}
|
|
16536
|
+
io.observe(e.target);
|
|
16537
|
+
if (e.target instanceof Element) ioObserved.add(e.target);
|
|
16538
|
+
}
|
|
16539
|
+
observers.push(io);
|
|
16540
|
+
}
|
|
16541
|
+
const handleResizeDelegate = (n, observe) => {
|
|
16542
|
+
if (!resizeObserve || !resizeUnobserve || n.nodeType !== 1) return;
|
|
16543
|
+
const el = n;
|
|
16544
|
+
for (const d of resizeDelegates) {
|
|
16545
|
+
const isThis = d.target === "$this" || d.target === "";
|
|
16546
|
+
const matchesSel = (node2) => {
|
|
16547
|
+
if (!node2 || node2.nodeType !== 1) return false;
|
|
16548
|
+
if (isThis) return true;
|
|
16549
|
+
return node2.matches?.(d.target) || !!node2.closest?.(d.target);
|
|
16550
|
+
};
|
|
16551
|
+
if (matchesSel(el)) {
|
|
16552
|
+
observe ? resizeObserve(el, d.options) : resizeUnobserve(el);
|
|
16553
|
+
} else if (!isThis) {
|
|
16554
|
+
el.querySelectorAll(d.target).forEach((sub) => {
|
|
16555
|
+
observe ? resizeObserve(sub, d.options) : resizeUnobserve(sub);
|
|
16556
|
+
});
|
|
16557
|
+
}
|
|
16558
|
+
}
|
|
16559
|
+
};
|
|
16560
|
+
const handleIntersectionDelegate = (n, observe) => {
|
|
16561
|
+
if (n.nodeType !== 1) return;
|
|
16562
|
+
const el = n;
|
|
16563
|
+
for (const d of intersectionDelegates) {
|
|
16564
|
+
const isThis = d.target === "$this" || d.target === "";
|
|
16565
|
+
const matchesSel = (node2) => {
|
|
16566
|
+
if (!node2 || node2.nodeType !== 1) return false;
|
|
16567
|
+
if (isThis) return true;
|
|
16568
|
+
return node2.matches?.(d.target) || !!node2.closest?.(d.target);
|
|
16569
|
+
};
|
|
16570
|
+
if (matchesSel(el)) {
|
|
16571
|
+
observe ? d.observe(el) : d.unobserve(el);
|
|
16572
|
+
} else if (!isThis) {
|
|
16573
|
+
el.querySelectorAll(d.target).forEach((sub) => {
|
|
16574
|
+
observe ? d.observe(sub) : d.unobserve(sub);
|
|
16575
|
+
});
|
|
16576
|
+
}
|
|
16577
|
+
}
|
|
16578
|
+
};
|
|
16579
|
+
if (mutationObserverSet?.length || resizeDelegates.length > 0 || intersectionDelegates.length > 0) {
|
|
16580
|
+
const callbacks = [...new Set((mutationObserverSet ?? []).map((e) => e.callback))];
|
|
16581
|
+
const mo = new win.MutationObserver((mutations, obs) => {
|
|
16582
|
+
for (const mut of mutations) {
|
|
16583
|
+
Array.from(mut.addedNodes || []).forEach((n) => {
|
|
16584
|
+
handleResizeDelegate(n, true);
|
|
16585
|
+
handleIntersectionDelegate(n, true);
|
|
16586
|
+
});
|
|
16587
|
+
Array.from(mut.removedNodes || []).forEach((n) => {
|
|
16588
|
+
handleResizeDelegate(n, false);
|
|
16589
|
+
handleIntersectionDelegate(n, false);
|
|
16590
|
+
});
|
|
16591
|
+
}
|
|
16592
|
+
for (const cb of callbacks) cb(mutations, obs);
|
|
16593
|
+
});
|
|
16594
|
+
const moObserveTargets = /* @__PURE__ */ new Map();
|
|
16595
|
+
const mergeMutationInit = (existing, next) => {
|
|
16596
|
+
if (!existing) return next;
|
|
16597
|
+
const mergedFilter = existing.attributeFilter || next.attributeFilter ? [.../* @__PURE__ */ new Set([...existing.attributeFilter ?? [], ...next.attributeFilter ?? []])] : void 0;
|
|
16598
|
+
return {
|
|
16599
|
+
childList: existing.childList || next.childList,
|
|
16600
|
+
attributes: existing.attributes || next.attributes,
|
|
16601
|
+
characterData: existing.characterData || next.characterData,
|
|
16602
|
+
subtree: existing.subtree || next.subtree,
|
|
16603
|
+
attributeOldValue: existing.attributeOldValue || next.attributeOldValue,
|
|
16604
|
+
characterDataOldValue: existing.characterDataOldValue || next.characterDataOldValue,
|
|
16605
|
+
attributeFilter: mergedFilter
|
|
16606
|
+
};
|
|
16607
|
+
};
|
|
16608
|
+
const addObserveTarget = (target, options) => {
|
|
16609
|
+
moObserveTargets.set(target, mergeMutationInit(moObserveTargets.get(target), options));
|
|
16610
|
+
};
|
|
16611
|
+
for (const e of mutationObserverSet ?? []) {
|
|
16612
|
+
if (e.delegate) continue;
|
|
16613
|
+
const init = e.options ?? { childList: true };
|
|
16614
|
+
if (typeof e.target === "string") {
|
|
16615
|
+
const scope = resolveDelegateRoots(e.delegateRoot);
|
|
16616
|
+
for (const sr of scope) {
|
|
16617
|
+
sr.querySelectorAll(e.target).forEach((el) => addObserveTarget(el, init));
|
|
16618
|
+
}
|
|
16619
|
+
continue;
|
|
16620
|
+
}
|
|
16621
|
+
addObserveTarget(e.target, init);
|
|
16622
|
+
}
|
|
16623
|
+
for (const d of resizeDelegates) {
|
|
16624
|
+
for (const r of resolveDelegateRoots(d.delegateRoot)) addObserveTarget(r, { childList: true, subtree: true });
|
|
16625
|
+
}
|
|
16626
|
+
for (const d of intersectionDelegates) {
|
|
16627
|
+
for (const r of resolveDelegateRoots(d.delegateRoot)) addObserveTarget(r, { childList: true, subtree: true });
|
|
16628
|
+
}
|
|
16629
|
+
for (const [target, options] of moObserveTargets) {
|
|
16630
|
+
mo.observe(target, options);
|
|
16631
|
+
}
|
|
16632
|
+
observers.push(mo);
|
|
16633
|
+
}
|
|
16634
|
+
inst.__swc_observers = observers;
|
|
16635
|
+
};
|
|
14960
16636
|
const originalConnected = proto.connectedCallback;
|
|
14961
16637
|
proto.connectedCallback = async function() {
|
|
14962
16638
|
ensureInit(this);
|
|
@@ -14972,14 +16648,12 @@ ${indentStr}}`;
|
|
|
14972
16648
|
}
|
|
14973
16649
|
const conf = getElementConfig(this);
|
|
14974
16650
|
const currentWin = this._resolveWindow(conf);
|
|
14975
|
-
const
|
|
14976
|
-
for (const m of bMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16651
|
+
for (const m of findAllOnConnectedBeforeMetadata(this)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
14977
16652
|
this._executeSwcScript("swc-on-before-connected", helperHostSet);
|
|
14978
16653
|
const targetConnectedList = useSsr ? [] : findAllOnConnectedMetadata(constructor);
|
|
14979
16654
|
const shadowMode = conf?.useShadow || targetConnectedList.find((it) => it.options.useShadow)?.options.useShadow;
|
|
14980
16655
|
if (shadowMode && !this.shadowRoot) {
|
|
14981
16656
|
const mode = shadowMode === true ? "open" : shadowMode;
|
|
14982
|
-
console.log("tagName=", this.tagName, "mode", mode, this.shadowRoot);
|
|
14983
16657
|
this.attachShadow({ mode });
|
|
14984
16658
|
}
|
|
14985
16659
|
const stateContext = { ...helperHostSet };
|
|
@@ -14988,7 +16662,6 @@ ${indentStr}}`;
|
|
|
14988
16662
|
});
|
|
14989
16663
|
const shadowChildren = [];
|
|
14990
16664
|
const lightChildren = [];
|
|
14991
|
-
console.log("targetConnectList", this.tagName, targetConnectedList.length);
|
|
14992
16665
|
if (targetConnectedList.length > 0) {
|
|
14993
16666
|
for (const meta of targetConnectedList) {
|
|
14994
16667
|
let res = await this._invokeLifecycleMethod(meta.propertyKey, helperHostSet);
|
|
@@ -15029,188 +16702,14 @@ ${indentStr}}`;
|
|
|
15029
16702
|
});
|
|
15030
16703
|
globalDelegatedRoots.add(root);
|
|
15031
16704
|
}
|
|
15032
|
-
|
|
15033
|
-
const nonDelegateListeners = [];
|
|
15034
|
-
addEventListenerList.forEach((meta) => {
|
|
15035
|
-
const isStringSelector = typeof meta.selector === "string";
|
|
15036
|
-
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 !== "") {
|
|
15037
|
-
delegateListeners.push(meta);
|
|
15038
|
-
} else {
|
|
15039
|
-
nonDelegateListeners.push(meta);
|
|
15040
|
-
}
|
|
15041
|
-
});
|
|
15042
|
-
const delegatesByTypeAndRoot = /* @__PURE__ */ new Map();
|
|
15043
|
-
delegateListeners.forEach((meta) => {
|
|
15044
|
-
const r = meta.options.root || "auto";
|
|
15045
|
-
const rootKey = `${meta.type}:${r}`;
|
|
15046
|
-
if (!delegatesByTypeAndRoot.has(rootKey)) {
|
|
15047
|
-
delegatesByTypeAndRoot.set(rootKey, []);
|
|
15048
|
-
}
|
|
15049
|
-
delegatesByTypeAndRoot.get(rootKey).push(meta);
|
|
15050
|
-
});
|
|
15051
|
-
delegatesByTypeAndRoot.forEach((metaList, typeRootKey) => {
|
|
15052
|
-
const [type, rStr] = typeRootKey.split(":");
|
|
15053
|
-
const r = rStr === "auto" ? "auto" : rStr;
|
|
15054
|
-
const opts = { capture: metaList[0].options.capture, once: metaList[0].options.once, passive: metaList[0].options.passive };
|
|
15055
|
-
const bindRoots = [];
|
|
15056
|
-
if (r === "auto") bindRoots.push(this.shadowRoot || this);
|
|
15057
|
-
else if (r === "light") bindRoots.push(this);
|
|
15058
|
-
else if (r === "shadow" && this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
15059
|
-
else if (r === "all") {
|
|
15060
|
-
bindRoots.push(this);
|
|
15061
|
-
if (this.shadowRoot) bindRoots.push(this.shadowRoot);
|
|
15062
|
-
}
|
|
15063
|
-
bindRoots.forEach((br) => {
|
|
15064
|
-
const sortedMetaList = [...metaList].sort((a, b) => {
|
|
15065
|
-
const aStop = a.options.stopPropagation ? 1 : 0;
|
|
15066
|
-
const bStop = b.options.stopPropagation ? 1 : 0;
|
|
15067
|
-
return bStop - aStop;
|
|
15068
|
-
});
|
|
15069
|
-
const unifiedHandler = async (event2) => {
|
|
15070
|
-
for (const meta of sortedMetaList) {
|
|
15071
|
-
const { selector, options } = meta;
|
|
15072
|
-
const matchedEl = event2.target?.closest(selector);
|
|
15073
|
-
if (matchedEl && br.contains(matchedEl)) {
|
|
15074
|
-
if (options.filter) {
|
|
15075
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, matchedEl);
|
|
15076
|
-
if (!options.filter(event2, helper)) {
|
|
15077
|
-
continue;
|
|
15078
|
-
}
|
|
15079
|
-
}
|
|
15080
|
-
if (options.stopPropagation) event2.stopPropagation();
|
|
15081
|
-
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
15082
|
-
if (options.preventDefault) event2.preventDefault();
|
|
15083
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
15084
|
-
const args = { event: event2, ...currentHostSet, $el: matchedEl, $root: br };
|
|
15085
|
-
await this[meta.propertyKey](event2, { ...currentHostSet, $matchedElement: matchedEl }, args);
|
|
15086
|
-
if (event2.cancelBubble) break;
|
|
15087
|
-
}
|
|
15088
|
-
}
|
|
15089
|
-
};
|
|
15090
|
-
br.addEventListener(type, unifiedHandler, opts);
|
|
15091
|
-
this._boundListeners.push({ target: br, type, handler: unifiedHandler, options: opts });
|
|
15092
|
-
});
|
|
15093
|
-
});
|
|
15094
|
-
nonDelegateListeners.forEach((meta) => {
|
|
15095
|
-
const { selector, type, options } = meta;
|
|
15096
|
-
const opts = { capture: options.capture, once: options.once, passive: options.passive };
|
|
15097
|
-
const bindTargets = [];
|
|
15098
|
-
const r = options.root || "auto";
|
|
15099
|
-
let resolvedSelector = null;
|
|
15100
|
-
if (typeof selector === "function") {
|
|
15101
|
-
const hostSet = SwcUtils.getHelperAndHostSet(currentWin, this);
|
|
15102
|
-
const result = selector(this, hostSet);
|
|
15103
|
-
if (typeof result === "string") {
|
|
15104
|
-
resolvedSelector = result;
|
|
15105
|
-
} else if (result instanceof currentWin.Element) {
|
|
15106
|
-
bindTargets.push(result);
|
|
15107
|
-
} else if (result instanceof currentWin.NodeList) {
|
|
15108
|
-
bindTargets.push(...Array.from(result));
|
|
15109
|
-
} else if (Array.isArray(result)) {
|
|
15110
|
-
bindTargets.push(...result);
|
|
15111
|
-
}
|
|
15112
|
-
} else {
|
|
15113
|
-
resolvedSelector = selector;
|
|
15114
|
-
}
|
|
15115
|
-
const applyRootOption = (target) => {
|
|
15116
|
-
if (!target) return;
|
|
15117
|
-
if (r === "auto") {
|
|
15118
|
-
bindTargets.push(target.shadowRoot || target);
|
|
15119
|
-
} else {
|
|
15120
|
-
if (r === "light" || r === "all") bindTargets.push(target);
|
|
15121
|
-
if ((r === "shadow" || r === "all") && target.shadowRoot) bindTargets.push(target.shadowRoot);
|
|
15122
|
-
}
|
|
15123
|
-
};
|
|
15124
|
-
if (resolvedSelector) {
|
|
15125
|
-
if (resolvedSelector === "$window") bindTargets.push(currentWin);
|
|
15126
|
-
else if (resolvedSelector === "$document") bindTargets.push(currentWin.document);
|
|
15127
|
-
else if (resolvedSelector === "$host") applyRootOption(helperHostSet.$host);
|
|
15128
|
-
else if (resolvedSelector === "$parentHost") applyRootOption(helperHostSet.$parentHost);
|
|
15129
|
-
else if (resolvedSelector === "$appHost") applyRootOption(helperHostSet.$appHost);
|
|
15130
|
-
else if (resolvedSelector === "$firstHost") applyRootOption(helperHostSet.$firstHost);
|
|
15131
|
-
else if (resolvedSelector === "$lastHost") applyRootOption(helperHostSet.$lastHost);
|
|
15132
|
-
else if (resolvedSelector === "$firstAppHost") applyRootOption(helperHostSet.$firstAppHost);
|
|
15133
|
-
else if (resolvedSelector === "$lastAppHost") applyRootOption(helperHostSet.$lastAppHost);
|
|
15134
|
-
else if (resolvedSelector === "$hosts") helperHostSet.$hosts.forEach(applyRootOption);
|
|
15135
|
-
else if (resolvedSelector === "$appHosts") helperHostSet.$appHosts.forEach(applyRootOption);
|
|
15136
|
-
else if (resolvedSelector === "$this" || !resolvedSelector) applyRootOption(this);
|
|
15137
|
-
else {
|
|
15138
|
-
const searchRoots = [];
|
|
15139
|
-
if (r === "auto") searchRoots.push(this.shadowRoot || this);
|
|
15140
|
-
else if (r === "light") searchRoots.push(this);
|
|
15141
|
-
else if (r === "shadow" && this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
15142
|
-
else if (r === "all") {
|
|
15143
|
-
searchRoots.push(this);
|
|
15144
|
-
if (this.shadowRoot) searchRoots.push(this.shadowRoot);
|
|
15145
|
-
}
|
|
15146
|
-
searchRoots.forEach((sr) => {
|
|
15147
|
-
sr.querySelectorAll(resolvedSelector).forEach((el) => bindTargets.push(el));
|
|
15148
|
-
});
|
|
15149
|
-
}
|
|
15150
|
-
}
|
|
15151
|
-
bindTargets.forEach((t) => {
|
|
15152
|
-
const handler = async (event2) => {
|
|
15153
|
-
if (options.filter) {
|
|
15154
|
-
const helper = SwcUtils.getHelperAndHostSet(currentWin, t);
|
|
15155
|
-
if (!options.filter(event2, { currentThis: this, helper })) {
|
|
15156
|
-
return;
|
|
15157
|
-
}
|
|
15158
|
-
}
|
|
15159
|
-
if (options.stopPropagation) event2.stopPropagation();
|
|
15160
|
-
if (options.stopImmediatePropagation) event2.stopImmediatePropagation();
|
|
15161
|
-
if (options.preventDefault) event2.preventDefault();
|
|
15162
|
-
const currentHostSet = SwcUtils.getHostSet(this);
|
|
15163
|
-
const args = { event: event2, ...currentHostSet, $el: t, $root: t };
|
|
15164
|
-
await this[meta.propertyKey](event2, { currentHostSet, $matchedElement: event2.currentTarget }, args);
|
|
15165
|
-
};
|
|
15166
|
-
const eventSubject = new Subject();
|
|
15167
|
-
let eventStream = eventSubject;
|
|
15168
|
-
if (options.debounceTime !== void 0 && options.debounceTime > 0) {
|
|
15169
|
-
eventStream = eventStream.pipe(debounceTime(options.debounceTime));
|
|
15170
|
-
}
|
|
15171
|
-
if (options.throttleTime !== void 0 && options.throttleTime > 0) {
|
|
15172
|
-
eventStream = eventStream.pipe(throttleTime2(options.throttleTime));
|
|
15173
|
-
}
|
|
15174
|
-
if (options.distinctUntilChanged !== void 0 && options.distinctUntilChanged !== false) {
|
|
15175
|
-
if (typeof options.distinctUntilChanged === "function") {
|
|
15176
|
-
eventStream = eventStream.pipe(distinctUntilChanged(options.distinctUntilChanged));
|
|
15177
|
-
} else {
|
|
15178
|
-
eventStream = eventStream.pipe(distinctUntilChanged());
|
|
15179
|
-
}
|
|
15180
|
-
}
|
|
15181
|
-
const subscription = eventStream.subscribe({
|
|
15182
|
-
next: (event2) => {
|
|
15183
|
-
handler(event2).catch((err) => console.error("Event handler error:", err));
|
|
15184
|
-
},
|
|
15185
|
-
error: (err) => console.error("Event stream error:", err)
|
|
15186
|
-
});
|
|
15187
|
-
const wrappedHandler = (event2) => {
|
|
15188
|
-
eventSubject.next(event2);
|
|
15189
|
-
};
|
|
15190
|
-
t.addEventListener(type, wrappedHandler, opts);
|
|
15191
|
-
this._boundListeners.push({ target: t, type, handler: wrappedHandler, options: opts, subscription });
|
|
15192
|
-
});
|
|
15193
|
-
});
|
|
16705
|
+
await buildObservers(SwcUtils.getHelperAndHostSet(win, this));
|
|
15194
16706
|
if (originalConnected) await originalConnected.apply(this);
|
|
15195
|
-
const
|
|
15196
|
-
for (const m of aMethods) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16707
|
+
for (const m of findAllOnConnectedAfterMetadata(this)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15197
16708
|
this._executeSwcScript("swc-on-connected", helperHostSet);
|
|
15198
16709
|
this._executeSwcScript("swc-on-after-connected", helperHostSet);
|
|
15199
16710
|
this.__swc_connected = true;
|
|
15200
|
-
for (let [name2, metaList] of Array.from(attrChangeMap)) {
|
|
15201
|
-
for (const meta of metaList) {
|
|
15202
|
-
if (meta.options.while === "connected") {
|
|
15203
|
-
const val = getAttributeValue(this, name2, { type: meta.options.type });
|
|
15204
|
-
if (val !== null) {
|
|
15205
|
-
await this[meta.propertyKey](val, null, name2, helperHostSet);
|
|
15206
|
-
}
|
|
15207
|
-
}
|
|
15208
|
-
}
|
|
15209
|
-
}
|
|
15210
16711
|
} finally {
|
|
15211
|
-
for (
|
|
15212
|
-
await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15213
|
-
}
|
|
16712
|
+
for (const m of findAllLifecycleMetadata(this, ON_CONNECTED_COMPLETED_METADATA_KEY)) await this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15214
16713
|
if (appHost && typeof appHost._connectedDone === "function") {
|
|
15215
16714
|
await appHost._connectedDone(this);
|
|
15216
16715
|
}
|
|
@@ -15218,26 +16717,24 @@ ${indentStr}}`;
|
|
|
15218
16717
|
};
|
|
15219
16718
|
const originalDisconnected = proto.disconnectedCallback;
|
|
15220
16719
|
proto.disconnectedCallback = function() {
|
|
15221
|
-
const appHost = helperHostSet
|
|
16720
|
+
const appHost = helperHostSet?.$appHost;
|
|
15222
16721
|
if (appHost && typeof appHost._disconnected === "function") {
|
|
15223
16722
|
appHost._disconnected(this);
|
|
15224
16723
|
}
|
|
15225
16724
|
this._executeSwcScript("swc-on-before-disconnected", helperHostSet);
|
|
15226
|
-
const
|
|
15227
|
-
for (const
|
|
15228
|
-
|
|
15229
|
-
|
|
15230
|
-
|
|
15231
|
-
|
|
15232
|
-
|
|
15233
|
-
|
|
15234
|
-
});
|
|
15235
|
-
this._boundListeners = [];
|
|
16725
|
+
for (const m of findAllLifecycleMetadata(this, ON_BEFORE_DISCONNECTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16726
|
+
for (const c of cyclers) c.onDisconnected?.(helperHostSet);
|
|
16727
|
+
for (const o of this.__swc_observers ?? []) {
|
|
16728
|
+
try {
|
|
16729
|
+
o?.disconnect?.();
|
|
16730
|
+
} catch (e) {
|
|
16731
|
+
console.error("[SWC] observer disconnect error:", e);
|
|
16732
|
+
}
|
|
15236
16733
|
}
|
|
16734
|
+
this.__swc_observers = [];
|
|
15237
16735
|
new ElementApply(this, { id: this._swcId }).removeAllEventListener();
|
|
15238
16736
|
if (originalDisconnected) originalDisconnected.apply(this);
|
|
15239
|
-
const
|
|
15240
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
16737
|
+
for (const m of findAllLifecycleMetadata(this, ON_AFTER_DISCONNECTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, helperHostSet);
|
|
15241
16738
|
this._executeSwcScript("swc-on-disconnected", helperHostSet);
|
|
15242
16739
|
this._executeSwcScript("swc-on-after-disconnected", helperHostSet);
|
|
15243
16740
|
this.__swc_connected = false;
|
|
@@ -15246,35 +16743,34 @@ ${indentStr}}`;
|
|
|
15246
16743
|
proto.adoptedCallback = function() {
|
|
15247
16744
|
const hostSet = SwcUtils.getHostSet(this);
|
|
15248
16745
|
this._executeSwcScript("swc-on-before-adopted", hostSet);
|
|
15249
|
-
const
|
|
15250
|
-
for (const
|
|
16746
|
+
for (const m of findAllLifecycleMetadata(this, ON_BEFORE_ADOPTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
16747
|
+
for (const c of cyclers) c.onAdopted?.(helperHostSet);
|
|
15251
16748
|
if (originalAdopted) originalAdopted.apply(this);
|
|
15252
|
-
const
|
|
15253
|
-
for (const m of aMethods) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
16749
|
+
for (const m of findAllLifecycleMetadata(this, ON_AFTER_ADOPTED_METADATA_KEY)) this._invokeLifecycleMethod(m.propertyKey, hostSet);
|
|
15254
16750
|
this._executeSwcScript("swc-on-adopted", hostSet);
|
|
15255
16751
|
this._executeSwcScript("swc-on-after-adopted", hostSet);
|
|
15256
16752
|
};
|
|
15257
16753
|
const originalAttributeChanged = proto.attributeChangedCallback;
|
|
15258
16754
|
proto.attributeChangedCallback = function(name2, old, newVal) {
|
|
15259
16755
|
if (originalAttributeChanged) originalAttributeChanged.apply(this, [name2, old, newVal]);
|
|
15260
|
-
const
|
|
16756
|
+
const helperAndHostSet = SwcUtils.getHelperAndHostSet(win, this);
|
|
15261
16757
|
let processedVal = newVal;
|
|
15262
16758
|
if (newVal !== null) {
|
|
15263
16759
|
const ae = new ActionExpression(newVal);
|
|
15264
16760
|
const expr = ae.getFirstExpression("callReturn");
|
|
15265
16761
|
if (expr) {
|
|
15266
16762
|
const win2 = this._resolveWindow?.() || (typeof window !== "undefined" ? window : void 0);
|
|
15267
|
-
const
|
|
16763
|
+
const exprHelperAndHostSet = SwcUtils.getHelperAndHostSet(win2, this);
|
|
15268
16764
|
const script = ConvertUtils2.decodeHtmlEntity(expr.script, win2.document);
|
|
15269
16765
|
try {
|
|
15270
16766
|
const result = FunctionUtils.executeReturn({
|
|
15271
16767
|
script,
|
|
15272
16768
|
context: this,
|
|
15273
|
-
args:
|
|
16769
|
+
args: exprHelperAndHostSet
|
|
15274
16770
|
});
|
|
15275
16771
|
processedVal = result;
|
|
15276
16772
|
} catch (e) {
|
|
15277
|
-
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}: ${
|
|
16773
|
+
console.error(`[SWC] Failed to execute directive {{= ${expr.script} }} on attribute ${name2}: ${exprHelperAndHostSet}`, e);
|
|
15278
16774
|
processedVal = newVal;
|
|
15279
16775
|
}
|
|
15280
16776
|
}
|
|
@@ -15285,20 +16781,7 @@ ${indentStr}}`;
|
|
|
15285
16781
|
this._bindAttributeEvent(this, name2, newVal, eventName);
|
|
15286
16782
|
}
|
|
15287
16783
|
}
|
|
15288
|
-
const
|
|
15289
|
-
if (hostCustomEventMeta && newVal !== null) {
|
|
15290
|
-
this._bindAttributeEvent(this, name2, newVal, hostCustomEventMeta.type);
|
|
15291
|
-
}
|
|
15292
|
-
const metaList = attrChangeMap.get(name2);
|
|
15293
|
-
if (metaList && Array.isArray(metaList)) {
|
|
15294
|
-
for (const meta of metaList) {
|
|
15295
|
-
if (meta.options.while === "connected" && !this.__swc_connected) {
|
|
15296
|
-
continue;
|
|
15297
|
-
}
|
|
15298
|
-
const convertedVal = convertAttributeValue(processedVal, meta.options.type);
|
|
15299
|
-
this[meta.propertyKey](convertedVal, old, name2, hSet);
|
|
15300
|
-
}
|
|
15301
|
-
}
|
|
16784
|
+
for (const c of cyclers) c.onAttributeChanged?.(helperAndHostSet, name2, old, processedVal);
|
|
15302
16785
|
};
|
|
15303
16786
|
Object.defineProperty(constructor, "observedAttributes", {
|
|
15304
16787
|
get: () => mergedObservedAttributes,
|
|
@@ -15528,6 +17011,9 @@ ${indentStr}}`;
|
|
|
15528
17011
|
return applyAttribute("$this", void 0, selectorOrAttributeOrTarget);
|
|
15529
17012
|
}
|
|
15530
17013
|
function setAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined) {
|
|
17014
|
+
if (typeof selectorOrAttributeOrOptions === "function") {
|
|
17015
|
+
return applyAttribute(selectorOrAttributeOrOptions, attributeNameOrOptions, optionsOrUndefined);
|
|
17016
|
+
}
|
|
15531
17017
|
if (typeof selectorOrAttributeOrOptions === "string") {
|
|
15532
17018
|
const isSelector = isCssSelector(selectorOrAttributeOrOptions);
|
|
15533
17019
|
if (isSelector) {
|
|
@@ -15550,6 +17036,22 @@ ${indentStr}}`;
|
|
|
15550
17036
|
});
|
|
15551
17037
|
return result;
|
|
15552
17038
|
};
|
|
17039
|
+
var attr = applyAttribute;
|
|
17040
|
+
function attrThis(targetAttributeName, options) {
|
|
17041
|
+
return applyAttribute("$this", targetAttributeName, options);
|
|
17042
|
+
}
|
|
17043
|
+
function attrAppHost(targetAttributeName, options) {
|
|
17044
|
+
return applyAttribute("$appHost", targetAttributeName, options);
|
|
17045
|
+
}
|
|
17046
|
+
function attrLight(selector, targetAttributeName, options) {
|
|
17047
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "light" });
|
|
17048
|
+
}
|
|
17049
|
+
function attrShadow(selector, targetAttributeName, options) {
|
|
17050
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "shadow" });
|
|
17051
|
+
}
|
|
17052
|
+
function attrAll(selector, targetAttributeName, options) {
|
|
17053
|
+
return applyAttribute(selector, targetAttributeName, { ...options ?? {}, root: "all" });
|
|
17054
|
+
}
|
|
15553
17055
|
|
|
15554
17056
|
// src/decorators/applyNode.ts
|
|
15555
17057
|
var APPLY_NODE_METADATA_KEY = Symbol.for("simple-web-component:apply-node");
|
|
@@ -15840,6 +17342,23 @@ ${indentStr}}`;
|
|
|
15840
17342
|
}
|
|
15841
17343
|
return applyNode({ ...selectorOrOptions, position: "clearChildren", root: "light" });
|
|
15842
17344
|
}
|
|
17345
|
+
var apply = applyNode;
|
|
17346
|
+
var node = applyNode;
|
|
17347
|
+
function applyThis(options) {
|
|
17348
|
+
return applyNode("$this", options);
|
|
17349
|
+
}
|
|
17350
|
+
function applyAppHost(options) {
|
|
17351
|
+
return applyNode("$appHost", options);
|
|
17352
|
+
}
|
|
17353
|
+
function applyLight(selector, options) {
|
|
17354
|
+
return applyNode(selector, { ...options ?? {}, root: "light" });
|
|
17355
|
+
}
|
|
17356
|
+
function applyShadow(selector, options) {
|
|
17357
|
+
return applyNode(selector, { ...options ?? {}, root: "shadow" });
|
|
17358
|
+
}
|
|
17359
|
+
function applyAll(selector, options) {
|
|
17360
|
+
return applyNode(selector, { ...options ?? {}, root: "all" });
|
|
17361
|
+
}
|
|
15843
17362
|
var findAllApplyNodeMetadata = (target) => {
|
|
15844
17363
|
const result = /* @__PURE__ */ new Map();
|
|
15845
17364
|
const maps = ReflectUtils.findAllMetadata(APPLY_NODE_METADATA_KEY, target);
|
|
@@ -15850,6 +17369,44 @@ ${indentStr}}`;
|
|
|
15850
17369
|
});
|
|
15851
17370
|
return result;
|
|
15852
17371
|
};
|
|
17372
|
+
var filterScopeOf = (target) => {
|
|
17373
|
+
if (target && typeof target.querySelector === "function") {
|
|
17374
|
+
return target;
|
|
17375
|
+
}
|
|
17376
|
+
const host = target?.host;
|
|
17377
|
+
return host && typeof host.querySelector === "function" ? host : null;
|
|
17378
|
+
};
|
|
17379
|
+
var tagNameOf = (node2) => {
|
|
17380
|
+
const tag = node2?.tagName;
|
|
17381
|
+
return typeof tag === "string" ? tag.toLowerCase() : null;
|
|
17382
|
+
};
|
|
17383
|
+
var skipIfSameTagPresent = (target, newValue) => {
|
|
17384
|
+
const nodes = (Array.isArray(newValue) ? newValue : [newValue]).filter((n) => tagNameOf(n) !== null);
|
|
17385
|
+
if (nodes.length === 0) return true;
|
|
17386
|
+
const scope = filterScopeOf(target);
|
|
17387
|
+
if (!scope) return true;
|
|
17388
|
+
return !nodes.some((n) => scope.querySelector(tagNameOf(n)));
|
|
17389
|
+
};
|
|
17390
|
+
var skipIfExists = (selector) => (target) => {
|
|
17391
|
+
const scope = filterScopeOf(target);
|
|
17392
|
+
if (!scope) return true;
|
|
17393
|
+
return !scope.querySelector(selector);
|
|
17394
|
+
};
|
|
17395
|
+
var skipIfEmpty = (_target, newValue) => {
|
|
17396
|
+
if (newValue === null || newValue === void 0 || newValue === false) return false;
|
|
17397
|
+
if (typeof newValue === "string") return newValue.trim().length > 0;
|
|
17398
|
+
if (Array.isArray(newValue)) return newValue.length > 0;
|
|
17399
|
+
return true;
|
|
17400
|
+
};
|
|
17401
|
+
var applyIfChanged = (target, newValue) => {
|
|
17402
|
+
const textOf = (v) => {
|
|
17403
|
+
if (typeof v === "string") return v;
|
|
17404
|
+
if (Array.isArray(v)) return v.map(textOf).join("");
|
|
17405
|
+
return typeof v?.textContent === "string" ? v.textContent : "";
|
|
17406
|
+
};
|
|
17407
|
+
const current = typeof target?.textContent === "string" ? target.textContent : "";
|
|
17408
|
+
return current !== textOf(newValue);
|
|
17409
|
+
};
|
|
15853
17410
|
|
|
15854
17411
|
// src/decorators/applyClass.ts
|
|
15855
17412
|
var CLASS_METADATA_KEY = Symbol.for("simple-web-component:class");
|
|
@@ -15869,6 +17426,9 @@ ${indentStr}}`;
|
|
|
15869
17426
|
if (result === null) {
|
|
15870
17427
|
return [];
|
|
15871
17428
|
}
|
|
17429
|
+
if (result instanceof win.Node) {
|
|
17430
|
+
return [];
|
|
17431
|
+
}
|
|
15872
17432
|
return result;
|
|
15873
17433
|
}
|
|
15874
17434
|
return selector;
|
|
@@ -15950,7 +17510,7 @@ ${indentStr}}`;
|
|
|
15950
17510
|
if (classMap && typeof classMap === "string") {
|
|
15951
17511
|
classes = resolvedRes ? classMap : "";
|
|
15952
17512
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15953
|
-
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([
|
|
17513
|
+
classes = Object.entries(resolvedRes).filter(([_, force]) => typeof force === "function" ? force(targetEl, hostSet) : !!force).map(([cls2]) => cls2).join(" ");
|
|
15954
17514
|
} else {
|
|
15955
17515
|
classes = Array.isArray(resolvedRes) ? resolvedRes.join(" ") : String(resolvedRes);
|
|
15956
17516
|
}
|
|
@@ -15959,9 +17519,9 @@ ${indentStr}}`;
|
|
|
15959
17519
|
if (classMap && typeof classMap === "string") {
|
|
15960
17520
|
targetEl.classList.toggle(classMap, !!resolvedRes);
|
|
15961
17521
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15962
|
-
Object.entries(resolvedRes).forEach(([
|
|
17522
|
+
Object.entries(resolvedRes).forEach(([cls2, force]) => {
|
|
15963
17523
|
const isActive = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
15964
|
-
targetEl.classList.toggle(
|
|
17524
|
+
targetEl.classList.toggle(cls2, isActive);
|
|
15965
17525
|
});
|
|
15966
17526
|
} else {
|
|
15967
17527
|
const classes = Array.isArray(resolvedRes) ? resolvedRes.map(String) : [String(resolvedRes)];
|
|
@@ -15973,11 +17533,11 @@ ${indentStr}}`;
|
|
|
15973
17533
|
if (action === "add") targetEl.classList.add(classMap);
|
|
15974
17534
|
else targetEl.classList.remove(classMap);
|
|
15975
17535
|
} else if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
15976
|
-
Object.entries(resolvedRes).forEach(([
|
|
17536
|
+
Object.entries(resolvedRes).forEach(([cls2, force]) => {
|
|
15977
17537
|
const shouldExecute = typeof force === "function" ? force(targetEl, hostSet) : !!force;
|
|
15978
17538
|
if (shouldExecute) {
|
|
15979
|
-
if (action === "add") targetEl.classList.add(
|
|
15980
|
-
else targetEl.classList.remove(
|
|
17539
|
+
if (action === "add") targetEl.classList.add(cls2);
|
|
17540
|
+
else targetEl.classList.remove(cls2);
|
|
15981
17541
|
}
|
|
15982
17542
|
});
|
|
15983
17543
|
} else {
|
|
@@ -16001,10 +17561,10 @@ ${indentStr}}`;
|
|
|
16001
17561
|
};
|
|
16002
17562
|
}
|
|
16003
17563
|
function applyClass(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
16004
|
-
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
17564
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
16005
17565
|
return createClassDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
16006
17566
|
}
|
|
16007
|
-
if (typeof selectorOrTarget === "string") {
|
|
17567
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16008
17568
|
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
16009
17569
|
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
16010
17570
|
return createClassDecorator(action2)(selectorOrTarget, options2);
|
|
@@ -16014,50 +17574,72 @@ ${indentStr}}`;
|
|
|
16014
17574
|
return createClassDecorator(action)("$this", options);
|
|
16015
17575
|
}
|
|
16016
17576
|
function setClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
16017
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17577
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
16018
17578
|
return createClassDecorator("set")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16019
17579
|
}
|
|
16020
|
-
if (typeof selectorOrTarget === "string") {
|
|
17580
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16021
17581
|
return createClassDecorator("set")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16022
17582
|
}
|
|
16023
17583
|
return createClassDecorator("set")("$this", selectorOrTarget);
|
|
16024
17584
|
}
|
|
16025
17585
|
function updateClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
16026
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17586
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
16027
17587
|
return createClassDecorator("update")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16028
17588
|
}
|
|
16029
|
-
if (typeof selectorOrTarget === "string") {
|
|
17589
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16030
17590
|
return createClassDecorator("update")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16031
17591
|
}
|
|
16032
17592
|
return createClassDecorator("update")("$this", selectorOrTarget);
|
|
16033
17593
|
}
|
|
16034
17594
|
function addClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
16035
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17595
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
16036
17596
|
return createClassDecorator("add")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16037
17597
|
}
|
|
16038
|
-
if (typeof selectorOrTarget === "string") {
|
|
17598
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16039
17599
|
return createClassDecorator("add")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16040
17600
|
}
|
|
16041
17601
|
return createClassDecorator("add")("$this", selectorOrTarget);
|
|
16042
17602
|
}
|
|
16043
17603
|
function removeClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
16044
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17604
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
16045
17605
|
return createClassDecorator("remove")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16046
17606
|
}
|
|
16047
|
-
if (typeof selectorOrTarget === "string") {
|
|
17607
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16048
17608
|
return createClassDecorator("remove")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16049
17609
|
}
|
|
16050
17610
|
return createClassDecorator("remove")("$this", selectorOrTarget);
|
|
16051
17611
|
}
|
|
16052
17612
|
function toggleClass(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor) {
|
|
16053
|
-
if (optionsOrDescriptor !== void 0 && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
17613
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof classMapOrOptionsOrPropertyKey === "string" || typeof classMapOrOptionsOrPropertyKey === "symbol")) {
|
|
16054
17614
|
return createClassDecorator("toggle")("$this", {})(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16055
17615
|
}
|
|
16056
|
-
if (typeof selectorOrTarget === "string") {
|
|
17616
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16057
17617
|
return createClassDecorator("toggle")(selectorOrTarget, classMapOrOptionsOrPropertyKey, optionsOrDescriptor);
|
|
16058
17618
|
}
|
|
16059
17619
|
return createClassDecorator("toggle")("$this", selectorOrTarget);
|
|
16060
17620
|
}
|
|
17621
|
+
var cls = applyClass;
|
|
17622
|
+
function clsThis(action, options) {
|
|
17623
|
+
return applyClass("$this", action, options);
|
|
17624
|
+
}
|
|
17625
|
+
function clsAppHost(action, options) {
|
|
17626
|
+
return applyClass("$appHost", action, options);
|
|
17627
|
+
}
|
|
17628
|
+
function clsLight(selector, actionOrOptions, options) {
|
|
17629
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17630
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17631
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "light" });
|
|
17632
|
+
}
|
|
17633
|
+
function clsShadow(selector, actionOrOptions, options) {
|
|
17634
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17635
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17636
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "shadow" });
|
|
17637
|
+
}
|
|
17638
|
+
function clsAll(selector, actionOrOptions, options) {
|
|
17639
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17640
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17641
|
+
return applyClass(selector, action, { ...opts ?? {}, root: "all" });
|
|
17642
|
+
}
|
|
16061
17643
|
var findAllClassMetadata = (target) => {
|
|
16062
17644
|
const result = /* @__PURE__ */ new Map();
|
|
16063
17645
|
const maps = ReflectUtils.findAllMetadata(CLASS_METADATA_KEY, target);
|
|
@@ -16087,6 +17669,9 @@ ${indentStr}}`;
|
|
|
16087
17669
|
if (result === null) {
|
|
16088
17670
|
return [];
|
|
16089
17671
|
}
|
|
17672
|
+
if (result instanceof win.Node) {
|
|
17673
|
+
return [];
|
|
17674
|
+
}
|
|
16090
17675
|
return result;
|
|
16091
17676
|
}
|
|
16092
17677
|
return selector;
|
|
@@ -16159,12 +17744,12 @@ ${indentStr}}`;
|
|
|
16159
17744
|
if (action === "set" || action === "update") {
|
|
16160
17745
|
if (action === "set") targetEl.style.cssText = "";
|
|
16161
17746
|
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
16162
|
-
Object.entries(resolvedRes).forEach(([
|
|
17747
|
+
Object.entries(resolvedRes).forEach(([prop2, val]) => {
|
|
16163
17748
|
const finalVal = typeof val === "function" ? val(targetEl, hostSet) : val;
|
|
16164
17749
|
if (finalVal === null || finalVal === void 0) {
|
|
16165
|
-
targetEl.style.removeProperty(
|
|
17750
|
+
targetEl.style.removeProperty(prop2);
|
|
16166
17751
|
} else {
|
|
16167
|
-
targetEl.style[
|
|
17752
|
+
targetEl.style[prop2] = String(finalVal);
|
|
16168
17753
|
}
|
|
16169
17754
|
});
|
|
16170
17755
|
} else if (typeof resolvedRes === "string") {
|
|
@@ -16172,10 +17757,10 @@ ${indentStr}}`;
|
|
|
16172
17757
|
}
|
|
16173
17758
|
} else if (action === "remove") {
|
|
16174
17759
|
if (typeof resolvedRes === "object" && resolvedRes !== null && !Array.isArray(resolvedRes)) {
|
|
16175
|
-
Object.entries(resolvedRes).forEach(([
|
|
17760
|
+
Object.entries(resolvedRes).forEach(([prop2, val]) => {
|
|
16176
17761
|
const shouldRemove = typeof val === "function" ? val(targetEl, hostSet) : !!val;
|
|
16177
17762
|
if (shouldRemove) {
|
|
16178
|
-
targetEl.style.removeProperty(
|
|
17763
|
+
targetEl.style.removeProperty(prop2);
|
|
16179
17764
|
}
|
|
16180
17765
|
});
|
|
16181
17766
|
} else {
|
|
@@ -16198,10 +17783,10 @@ ${indentStr}}`;
|
|
|
16198
17783
|
};
|
|
16199
17784
|
}
|
|
16200
17785
|
function applyStyle(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor) {
|
|
16201
|
-
if (optionsOrDescriptor !== void 0 && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
17786
|
+
if (optionsOrDescriptor !== void 0 && typeof selectorOrTarget !== "string" && typeof selectorOrTarget !== "function" && (typeof actionOrPropertyKey === "string" || typeof actionOrPropertyKey === "symbol")) {
|
|
16202
17787
|
return createStyleDecorator("update")("$this", {})(selectorOrTarget, actionOrPropertyKey, optionsOrDescriptor);
|
|
16203
17788
|
}
|
|
16204
|
-
if (typeof selectorOrTarget === "string") {
|
|
17789
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16205
17790
|
const action2 = typeof actionOrPropertyKey === "string" ? actionOrPropertyKey : "update";
|
|
16206
17791
|
const options2 = typeof actionOrPropertyKey === "object" ? actionOrPropertyKey : optionsOrDescriptor;
|
|
16207
17792
|
return createStyleDecorator(action2)(selectorOrTarget, options2);
|
|
@@ -16214,7 +17799,7 @@ ${indentStr}}`;
|
|
|
16214
17799
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16215
17800
|
return createStyleDecorator("set")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16216
17801
|
}
|
|
16217
|
-
if (typeof selectorOrTarget === "string") {
|
|
17802
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16218
17803
|
return createStyleDecorator("set")(selectorOrTarget, optionsOrPropertyKey);
|
|
16219
17804
|
}
|
|
16220
17805
|
return createStyleDecorator("set")("$this", selectorOrTarget);
|
|
@@ -16223,7 +17808,7 @@ ${indentStr}}`;
|
|
|
16223
17808
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16224
17809
|
return createStyleDecorator("update")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16225
17810
|
}
|
|
16226
|
-
if (typeof selectorOrTarget === "string") {
|
|
17811
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16227
17812
|
return createStyleDecorator("update")(selectorOrTarget, optionsOrPropertyKey);
|
|
16228
17813
|
}
|
|
16229
17814
|
return createStyleDecorator("update")("$this", selectorOrTarget);
|
|
@@ -16232,11 +17817,33 @@ ${indentStr}}`;
|
|
|
16232
17817
|
if (descriptor !== void 0 && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol")) {
|
|
16233
17818
|
return createStyleDecorator("remove")("$this", {})(selectorOrTarget, optionsOrPropertyKey, descriptor);
|
|
16234
17819
|
}
|
|
16235
|
-
if (typeof selectorOrTarget === "string") {
|
|
17820
|
+
if (typeof selectorOrTarget === "string" || typeof selectorOrTarget === "function") {
|
|
16236
17821
|
return createStyleDecorator("remove")(selectorOrTarget, optionsOrPropertyKey);
|
|
16237
17822
|
}
|
|
16238
17823
|
return createStyleDecorator("remove")("$this", selectorOrTarget);
|
|
16239
17824
|
}
|
|
17825
|
+
var style = applyStyle;
|
|
17826
|
+
function styleThis(action, options) {
|
|
17827
|
+
return applyStyle("$this", action, options);
|
|
17828
|
+
}
|
|
17829
|
+
function styleAppHost(action, options) {
|
|
17830
|
+
return applyStyle("$appHost", action, options);
|
|
17831
|
+
}
|
|
17832
|
+
function styleLight(selector, actionOrOptions, options) {
|
|
17833
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17834
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17835
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "light" });
|
|
17836
|
+
}
|
|
17837
|
+
function styleShadow(selector, actionOrOptions, options) {
|
|
17838
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17839
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17840
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "shadow" });
|
|
17841
|
+
}
|
|
17842
|
+
function styleAll(selector, actionOrOptions, options) {
|
|
17843
|
+
const action = typeof actionOrOptions === "string" ? actionOrOptions : void 0;
|
|
17844
|
+
const opts = typeof actionOrOptions === "object" ? actionOrOptions : options;
|
|
17845
|
+
return applyStyle(selector, action, { ...opts ?? {}, root: "all" });
|
|
17846
|
+
}
|
|
16240
17847
|
var findAllStyleMetadata = (target) => {
|
|
16241
17848
|
const result = /* @__PURE__ */ new Map();
|
|
16242
17849
|
const maps = ReflectUtils.findAllMetadata(STYLE_METADATA_KEY, target);
|
|
@@ -16248,89 +17855,6 @@ ${indentStr}}`;
|
|
|
16248
17855
|
return result;
|
|
16249
17856
|
};
|
|
16250
17857
|
|
|
16251
|
-
// src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts
|
|
16252
|
-
var SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-route-change-while-connected");
|
|
16253
|
-
function createSubscribeSwcAppRouteChangeWhileConnected(options) {
|
|
16254
|
-
return (target, propertyKey, descriptor) => {
|
|
16255
|
-
const pathPattern = options?.path;
|
|
16256
|
-
const filter = options?.filter;
|
|
16257
|
-
const constructor = target.constructor;
|
|
16258
|
-
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16259
|
-
if (!list) {
|
|
16260
|
-
list = [];
|
|
16261
|
-
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
16262
|
-
}
|
|
16263
|
-
list.push({ propertyKey, options });
|
|
16264
|
-
return descriptor;
|
|
16265
|
-
};
|
|
16266
|
-
}
|
|
16267
|
-
function subscribeSwcAppRouteChangeWhileConnected(targetOrOptions, propertyKeyOrConfig, descriptor) {
|
|
16268
|
-
if (propertyKeyOrConfig && (typeof propertyKeyOrConfig === "string" || typeof propertyKeyOrConfig === "symbol")) {
|
|
16269
|
-
return createSubscribeSwcAppRouteChangeWhileConnected({})(targetOrOptions, propertyKeyOrConfig, descriptor);
|
|
16270
|
-
}
|
|
16271
|
-
let options = {};
|
|
16272
|
-
if (Array.isArray(targetOrOptions)) {
|
|
16273
|
-
options.path = targetOrOptions;
|
|
16274
|
-
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
16275
|
-
options = { ...options, ...propertyKeyOrConfig };
|
|
16276
|
-
}
|
|
16277
|
-
} else if (typeof targetOrOptions === "string" || typeof targetOrOptions === "function") {
|
|
16278
|
-
options.path = targetOrOptions;
|
|
16279
|
-
if (propertyKeyOrConfig && typeof propertyKeyOrConfig === "object") {
|
|
16280
|
-
options = { ...options, ...propertyKeyOrConfig };
|
|
16281
|
-
}
|
|
16282
|
-
} else if (targetOrOptions && typeof targetOrOptions === "object") {
|
|
16283
|
-
options = targetOrOptions;
|
|
16284
|
-
}
|
|
16285
|
-
return createSubscribeSwcAppRouteChangeWhileConnected(options);
|
|
16286
|
-
}
|
|
16287
|
-
var changedRoute = subscribeSwcAppRouteChangeWhileConnected;
|
|
16288
|
-
var getSubscribeSwcAppRouteChangeWhileConnectedMetadata = (target) => {
|
|
16289
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
16290
|
-
const results = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_ROUTE_CHANGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16291
|
-
if (!results) return [];
|
|
16292
|
-
return [...results].sort((a, b) => (a.options?.order ?? 0) - (b.options?.order ?? 0));
|
|
16293
|
-
};
|
|
16294
|
-
|
|
16295
|
-
// src/decorators/subscribeSwcAppMessageWhileConnected.ts
|
|
16296
|
-
var SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY = Symbol.for("simple-web-component:subscribe-swc-app-message-while-connected");
|
|
16297
|
-
function createSubscribeSwcAppMessageWhileConnected(options, messageType) {
|
|
16298
|
-
return (target, propertyKey, descriptor) => {
|
|
16299
|
-
const filter = options?.filter;
|
|
16300
|
-
const constructor = target.constructor;
|
|
16301
|
-
let list = ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16302
|
-
if (!list) {
|
|
16303
|
-
list = [];
|
|
16304
|
-
ReflectUtils.defineMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, list, constructor);
|
|
16305
|
-
}
|
|
16306
|
-
list.push({ propertyKey, messageType, filter });
|
|
16307
|
-
return descriptor;
|
|
16308
|
-
};
|
|
16309
|
-
}
|
|
16310
|
-
function subscribeSwcAppMessageWhileConnected(targetOrMessageTypeOrOptions, optionsOrPropertyKey, descriptor) {
|
|
16311
|
-
if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object" && optionsOrPropertyKey && (typeof optionsOrPropertyKey === "string" || typeof optionsOrPropertyKey === "symbol") && descriptor) {
|
|
16312
|
-
const target = targetOrMessageTypeOrOptions;
|
|
16313
|
-
const propertyKey = optionsOrPropertyKey;
|
|
16314
|
-
return createSubscribeSwcAppMessageWhileConnected({})(target, propertyKey, descriptor);
|
|
16315
|
-
}
|
|
16316
|
-
let messageType;
|
|
16317
|
-
let options = {};
|
|
16318
|
-
if (typeof targetOrMessageTypeOrOptions === "string") {
|
|
16319
|
-
messageType = targetOrMessageTypeOrOptions;
|
|
16320
|
-
if (optionsOrPropertyKey && typeof optionsOrPropertyKey === "object") {
|
|
16321
|
-
options = optionsOrPropertyKey;
|
|
16322
|
-
}
|
|
16323
|
-
} else if (targetOrMessageTypeOrOptions && typeof targetOrMessageTypeOrOptions === "object") {
|
|
16324
|
-
options = targetOrMessageTypeOrOptions;
|
|
16325
|
-
}
|
|
16326
|
-
return createSubscribeSwcAppMessageWhileConnected(options, messageType);
|
|
16327
|
-
}
|
|
16328
|
-
var receiveMessage = subscribeSwcAppMessageWhileConnected;
|
|
16329
|
-
var getSubscribeSwcAppMessageWhileConnectedMetadata = (target) => {
|
|
16330
|
-
const constructor = target instanceof Function ? target : target.constructor;
|
|
16331
|
-
return ReflectUtils.getOwnMetadata(SUBSCRIBE_SWC_APP_MESSAGE_WHILE_CONNECTED_METADATA_KEY, constructor);
|
|
16332
|
-
};
|
|
16333
|
-
|
|
16334
17858
|
// src/decorators/publishSwcAppMessage.ts
|
|
16335
17859
|
var PUBLISH_SWC_APP_MESSAGE_METADATA_KEY = Symbol.for("simple-web-component:publish-swc-app-message");
|
|
16336
17860
|
function createPublishSwcAppMessage(messageType, options) {
|
|
@@ -16955,9 +18479,9 @@ ${indentStr}}`;
|
|
|
16955
18479
|
return target[name];
|
|
16956
18480
|
}
|
|
16957
18481
|
}
|
|
16958
|
-
set(obj,
|
|
18482
|
+
set(obj, prop2, value, receiver) {
|
|
16959
18483
|
value = this.simstanceManager?.proxy(value);
|
|
16960
|
-
obj[
|
|
18484
|
+
obj[prop2] = value;
|
|
16961
18485
|
return true;
|
|
16962
18486
|
}
|
|
16963
18487
|
apply(target, thisArg, argumentsList) {
|