@dooboostore/simple-web-component 1.0.49 → 1.0.51
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 +790 -337
- package/dist/cjs/SwcAppEngine.js.map +2 -2
- package/dist/cjs/decorators/addEventListener.js +1925 -22
- package/dist/cjs/decorators/addEventListener.js.map +2 -2
- package/dist/cjs/decorators/applyAttribute.js +41 -47
- package/dist/cjs/decorators/applyAttribute.js.map +2 -2
- package/dist/cjs/decorators/applyClass.js +14 -11
- package/dist/cjs/decorators/applyClass.js.map +2 -2
- package/dist/cjs/decorators/applyNode.js +19 -21
- package/dist/cjs/decorators/applyNode.js.map +2 -2
- package/dist/cjs/decorators/applyProperty.js +24 -48
- package/dist/cjs/decorators/applyProperty.js.map +2 -2
- package/dist/cjs/decorators/applySlot.js +9 -8
- package/dist/cjs/decorators/applySlot.js.map +2 -2
- package/dist/cjs/decorators/applyStyle.js +14 -11
- package/dist/cjs/decorators/applyStyle.js.map +2 -2
- package/dist/cjs/decorators/around.js +124 -0
- package/dist/cjs/decorators/around.js.map +7 -0
- package/dist/cjs/decorators/changedAttribute.js +61 -24
- package/dist/cjs/decorators/changedAttribute.js.map +2 -2
- package/dist/cjs/decorators/elementDefine.js +240 -196
- package/dist/cjs/decorators/elementDefine.js.map +3 -3
- package/dist/cjs/decorators/emitCustomEvent.js +14 -12
- package/dist/cjs/decorators/emitCustomEvent.js.map +2 -2
- package/dist/cjs/decorators/eventMedia.js +112 -0
- package/dist/cjs/decorators/eventMedia.js.map +7 -0
- package/dist/cjs/decorators/fetch.js +278 -0
- package/dist/cjs/decorators/fetch.js.map +7 -0
- package/dist/cjs/decorators/index.js +8 -2
- package/dist/cjs/decorators/index.js.map +2 -2
- package/dist/cjs/decorators/intersectionObserver.js +76 -65
- package/dist/cjs/decorators/intersectionObserver.js.map +2 -2
- package/dist/cjs/decorators/lifecycles.js +11 -11
- package/dist/cjs/decorators/lifecycles.js.map +2 -2
- package/dist/cjs/decorators/mutationObserver.js +97 -90
- package/dist/cjs/decorators/mutationObserver.js.map +3 -3
- package/dist/cjs/decorators/parameter.js +156 -0
- package/dist/cjs/decorators/parameter.js.map +7 -0
- package/dist/cjs/decorators/publishSwcAppMessage.js +2 -2
- package/dist/cjs/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/cjs/decorators/query.js +11 -5
- package/dist/cjs/decorators/query.js.map +2 -2
- package/dist/cjs/decorators/requestAnimationFrame.js +115 -0
- package/dist/cjs/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/cjs/decorators/resizeObserver.js +84 -69
- package/dist/cjs/decorators/resizeObserver.js.map +3 -3
- package/dist/cjs/decorators/setInterval.js +65 -22
- package/dist/cjs/decorators/setInterval.js.map +2 -2
- package/dist/cjs/decorators/setTimeout.js +68 -22
- package/dist/cjs/decorators/setTimeout.js.map +2 -2
- package/dist/cjs/decorators/state.js +13 -10
- package/dist/cjs/decorators/state.js.map +2 -2
- package/dist/cjs/decorators/{subscribeSwcAppMessageWhileConnected.js → subscribeSwcAppMessage.js} +20 -21
- package/dist/cjs/decorators/subscribeSwcAppMessage.js.map +7 -0
- package/dist/cjs/decorators/{subscribeSwcAppRouteChangeWhileConnected.js → subscribeSwcAppRouteChange.js} +23 -19
- package/dist/cjs/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/cjs/decorators/swcAppRoute.js +149 -0
- package/dist/cjs/decorators/swcAppRoute.js.map +7 -0
- package/dist/cjs/elements/SwcApp.js +70 -0
- package/dist/cjs/elements/SwcApp.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +256 -67
- package/dist/cjs/elements/SwcAppMixin.js.map +3 -3
- package/dist/cjs/types/index.js +5 -1
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/cjs/types/window.d.js.map +1 -1
- package/dist/cjs/utils/Utils.js +36 -15
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/SwcAppEngine.js.map +2 -2
- package/dist/esm/decorators/addEventListener.js +1925 -22
- package/dist/esm/decorators/addEventListener.js.map +2 -2
- package/dist/esm/decorators/applyAttribute.js +41 -47
- package/dist/esm/decorators/applyAttribute.js.map +2 -2
- package/dist/esm/decorators/applyClass.js +14 -11
- package/dist/esm/decorators/applyClass.js.map +2 -2
- package/dist/esm/decorators/applyNode.js +20 -22
- package/dist/esm/decorators/applyNode.js.map +2 -2
- package/dist/esm/decorators/applyProperty.js +24 -48
- package/dist/esm/decorators/applyProperty.js.map +2 -2
- package/dist/esm/decorators/applySlot.js +9 -8
- package/dist/esm/decorators/applySlot.js.map +2 -2
- package/dist/esm/decorators/applyStyle.js +14 -11
- package/dist/esm/decorators/applyStyle.js.map +2 -2
- package/dist/esm/decorators/around.js +105 -0
- package/dist/esm/decorators/around.js.map +7 -0
- package/dist/esm/decorators/changedAttribute.js +61 -24
- package/dist/esm/decorators/changedAttribute.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +238 -194
- package/dist/esm/decorators/elementDefine.js.map +3 -3
- package/dist/esm/decorators/emitCustomEvent.js +15 -13
- package/dist/esm/decorators/emitCustomEvent.js.map +2 -2
- package/dist/esm/decorators/eventMedia.js +94 -0
- package/dist/esm/decorators/eventMedia.js.map +7 -0
- package/dist/esm/decorators/fetch.js +259 -0
- package/dist/esm/decorators/fetch.js.map +7 -0
- package/dist/esm/decorators/index.js +8 -2
- package/dist/esm/decorators/index.js.map +2 -2
- package/dist/esm/decorators/intersectionObserver.js +76 -65
- package/dist/esm/decorators/intersectionObserver.js.map +2 -2
- package/dist/esm/decorators/lifecycles.js +11 -11
- package/dist/esm/decorators/lifecycles.js.map +2 -2
- package/dist/esm/decorators/mutationObserver.js +97 -90
- package/dist/esm/decorators/mutationObserver.js.map +3 -3
- package/dist/esm/decorators/parameter.js +137 -0
- package/dist/esm/decorators/parameter.js.map +7 -0
- package/dist/esm/decorators/publishSwcAppMessage.js +2 -2
- package/dist/esm/decorators/publishSwcAppMessage.js.map +2 -2
- package/dist/esm/decorators/query.js +11 -5
- package/dist/esm/decorators/query.js.map +2 -2
- package/dist/esm/decorators/requestAnimationFrame.js +96 -0
- package/dist/esm/decorators/requestAnimationFrame.js.map +7 -0
- package/dist/esm/decorators/resizeObserver.js +84 -69
- package/dist/esm/decorators/resizeObserver.js.map +2 -2
- package/dist/esm/decorators/setInterval.js +65 -23
- package/dist/esm/decorators/setInterval.js.map +2 -2
- package/dist/esm/decorators/setTimeout.js +68 -23
- package/dist/esm/decorators/setTimeout.js.map +2 -2
- package/dist/esm/decorators/state.js +13 -10
- package/dist/esm/decorators/state.js.map +2 -2
- package/dist/esm/decorators/subscribeSwcAppMessage.js +53 -0
- package/dist/esm/decorators/subscribeSwcAppMessage.js.map +7 -0
- package/dist/esm/decorators/{subscribeSwcAppRouteChangeWhileConnected.js → subscribeSwcAppRouteChange.js} +20 -16
- package/dist/esm/decorators/subscribeSwcAppRouteChange.js.map +7 -0
- package/dist/esm/decorators/swcAppRoute.js +130 -0
- package/dist/esm/decorators/swcAppRoute.js.map +7 -0
- package/dist/esm/elements/SwcApp.js +70 -0
- package/dist/esm/elements/SwcApp.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +258 -69
- package/dist/esm/elements/SwcAppMixin.js.map +3 -3
- package/dist/esm/types/index.js +5 -1
- package/dist/esm/types/index.js.map +2 -2
- package/dist/esm/utils/Utils.js +36 -15
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +4395 -1266
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +4 -4
- package/dist/types/SwcAppEngine.d.ts +1 -0
- package/dist/types/SwcAppEngine.d.ts.map +1 -1
- package/dist/types/decorators/addEventListener.d.ts +936 -11
- package/dist/types/decorators/addEventListener.d.ts.map +1 -1
- package/dist/types/decorators/applyAttribute.d.ts +27 -37
- package/dist/types/decorators/applyAttribute.d.ts.map +1 -1
- package/dist/types/decorators/applyClass.d.ts +2 -2
- package/dist/types/decorators/applyClass.d.ts.map +1 -1
- package/dist/types/decorators/applyNode.d.ts +16 -16
- package/dist/types/decorators/applyNode.d.ts.map +1 -1
- package/dist/types/decorators/applyProperty.d.ts +28 -44
- package/dist/types/decorators/applyProperty.d.ts.map +1 -1
- package/dist/types/decorators/applySlot.d.ts.map +1 -1
- package/dist/types/decorators/applyStyle.d.ts +2 -2
- package/dist/types/decorators/applyStyle.d.ts.map +1 -1
- package/dist/types/decorators/around.d.ts +87 -0
- package/dist/types/decorators/around.d.ts.map +1 -0
- package/dist/types/decorators/changedAttribute.d.ts +22 -4
- 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 +0 -1
- package/dist/types/decorators/emitCustomEvent.d.ts.map +1 -1
- package/dist/types/decorators/eventMedia.d.ts +48 -0
- package/dist/types/decorators/eventMedia.d.ts.map +1 -0
- package/dist/types/decorators/fetch.d.ts +139 -0
- package/dist/types/decorators/fetch.d.ts.map +1 -0
- package/dist/types/decorators/index.d.ts +8 -2
- package/dist/types/decorators/index.d.ts.map +1 -1
- package/dist/types/decorators/intersectionObserver.d.ts +32 -10
- package/dist/types/decorators/intersectionObserver.d.ts.map +1 -1
- package/dist/types/decorators/lifecycles.d.ts +8 -7
- package/dist/types/decorators/lifecycles.d.ts.map +1 -1
- package/dist/types/decorators/mutationObserver.d.ts +34 -12
- package/dist/types/decorators/mutationObserver.d.ts.map +1 -1
- package/dist/types/decorators/parameter.d.ts +113 -0
- package/dist/types/decorators/parameter.d.ts.map +1 -0
- package/dist/types/decorators/publishSwcAppMessage.d.ts +0 -1
- package/dist/types/decorators/publishSwcAppMessage.d.ts.map +1 -1
- package/dist/types/decorators/query.d.ts +7 -7
- package/dist/types/decorators/query.d.ts.map +1 -1
- package/dist/types/decorators/requestAnimationFrame.d.ts +47 -0
- package/dist/types/decorators/requestAnimationFrame.d.ts.map +1 -0
- package/dist/types/decorators/resizeObserver.d.ts +34 -12
- package/dist/types/decorators/resizeObserver.d.ts.map +1 -1
- package/dist/types/decorators/setInterval.d.ts +27 -5
- package/dist/types/decorators/setInterval.d.ts.map +1 -1
- package/dist/types/decorators/setTimeout.d.ts +27 -5
- package/dist/types/decorators/setTimeout.d.ts.map +1 -1
- package/dist/types/decorators/state.d.ts.map +1 -1
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts +44 -0
- package/dist/types/decorators/subscribeSwcAppMessage.d.ts.map +1 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts +60 -0
- package/dist/types/decorators/subscribeSwcAppRouteChange.d.ts.map +1 -0
- package/dist/types/decorators/swcAppRoute.d.ts +94 -0
- package/dist/types/decorators/swcAppRoute.d.ts.map +1 -0
- package/dist/types/elements/SwcApp.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts +423 -388
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +43 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +15 -5
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +4395 -1266
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +4 -4
- package/package.json +8 -6
- package/src/SwcAppEngine.ts +1 -0
- package/src/decorators/addEventListener.ts +1086 -28
- package/src/decorators/applyAttribute.ts +82 -134
- package/src/decorators/applyClass.ts +14 -10
- package/src/decorators/applyNode.ts +39 -37
- package/src/decorators/applyProperty.ts +72 -100
- package/src/decorators/applySlot.ts +9 -8
- package/src/decorators/applyStyle.ts +14 -10
- package/src/decorators/around.ts +196 -0
- package/src/decorators/changedAttribute.ts +65 -26
- package/src/decorators/elementDefine.ts +298 -220
- package/src/decorators/emitCustomEvent.ts +17 -13
- package/src/decorators/eventMedia.ts +119 -0
- package/src/decorators/fetch.ts +454 -0
- package/src/decorators/index.ts +8 -2
- package/src/decorators/intersectionObserver.ts +108 -78
- package/src/decorators/lifecycles.ts +24 -22
- package/src/decorators/mutationObserver.ts +140 -104
- package/src/decorators/parameter.ts +212 -0
- package/src/decorators/publishSwcAppMessage.ts +3 -4
- package/src/decorators/query.ts +22 -14
- package/src/decorators/requestAnimationFrame.ts +149 -0
- package/src/decorators/resizeObserver.ts +119 -82
- package/src/decorators/setInterval.ts +90 -23
- package/src/decorators/setTimeout.ts +93 -23
- package/src/decorators/state.ts +19 -13
- package/src/decorators/subscribeSwcAppMessage.ts +106 -0
- package/src/decorators/subscribeSwcAppRouteChange.ts +131 -0
- package/src/decorators/swcAppRoute.ts +231 -0
- package/src/elements/SwcApp.ts +40 -10
- package/src/elements/SwcAppMixin.ts +329 -85
- package/src/types/index.ts +38 -5
- package/src/types/window.d.ts +2 -18
- package/src/utils/Utils.ts +50 -18
- package/dist/cjs/decorators/subscribeSwcAppMessageWhileConnected.js.map +0 -7
- package/dist/cjs/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +0 -7
- package/dist/cjs/examples/RxJSOperatorsExample.js +0 -285
- package/dist/cjs/examples/RxJSOperatorsExample.js.map +0 -7
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js +0 -54
- package/dist/esm/decorators/subscribeSwcAppMessageWhileConnected.js.map +0 -7
- package/dist/esm/decorators/subscribeSwcAppRouteChangeWhileConnected.js.map +0 -7
- package/dist/esm/examples/RxJSOperatorsExample.js +0 -266
- package/dist/esm/examples/RxJSOperatorsExample.js.map +0 -7
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts +0 -23
- package/dist/types/decorators/subscribeSwcAppMessageWhileConnected.d.ts.map +0 -1
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts +0 -31
- package/dist/types/decorators/subscribeSwcAppRouteChangeWhileConnected.d.ts.map +0 -1
- package/dist/types/examples/RxJSOperatorsExample.d.ts +0 -94
- package/dist/types/examples/RxJSOperatorsExample.d.ts.map +0 -1
- package/src/decorators/subscribeSwcAppMessageWhileConnected.ts +0 -91
- package/src/decorators/subscribeSwcAppRouteChangeWhileConnected.ts +0 -107
- package/src/examples/RxJSOperatorsExample.ts +0 -279
package/dist/cjs/types/index.js
CHANGED
|
@@ -17,7 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var types_exports = {};
|
|
19
19
|
__export(types_exports, {
|
|
20
|
-
InjectSituationType: () => InjectSituationType
|
|
20
|
+
InjectSituationType: () => InjectSituationType,
|
|
21
|
+
inObserverScope: () => inObserverScope,
|
|
22
|
+
isSelfObserverMeta: () => isSelfObserverMeta
|
|
21
23
|
});
|
|
22
24
|
module.exports = __toCommonJS(types_exports);
|
|
23
25
|
var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
@@ -33,4 +35,6 @@ var InjectSituationType = /* @__PURE__ */ ((InjectSituationType2) => {
|
|
|
33
35
|
InjectSituationType2["LAST_APP_HOST"] = "SIMPLE_WEB_COMPONENT://LASTAPPHOST";
|
|
34
36
|
return InjectSituationType2;
|
|
35
37
|
})(InjectSituationType || {});
|
|
38
|
+
const isSelfObserverMeta = (m) => !m.options?.delegate && (m.selector === "$this" || m.selector === "");
|
|
39
|
+
const inObserverScope = (m, scope) => !scope || scope === "self" === isSelfObserverMeta(m);
|
|
36
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\n// \uACF5\uD1B5 \uC140\uB809\uD130 \uD568\uC218 \u2014 \uC694\uC18C/\uB178\uB4DC\uB97C \uC9C1\uC811 \uBC18\uD658\uD558\uB294 \uD568\uC218 \uC140\uB809\uD130 (query\uB294 Node\uAE4C\uC9C0 \uBC18\uD658 \uAC00\uB2A5)\nexport type SwcFnSelector = (currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null;\n// \uACF5\uD1B5 \uC140\uB809\uD130 \u2014 \uBB38\uC790\uC5F4(CSS/\uD2B9\uC218) \uB610\uB294 \uD568\uC218\nexport type SwcSelector = string | SwcFnSelector;\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n}\n\nexport interface SwcElement {\n _swcId: string;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\n}\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// ElementDefineLifeCycler\n//\n// \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C(addEventListener, mutationObserver, \u2026)\uC774 \uC774 interface\uB97C\n// \uAD6C\uD604\uD574 export \uD558\uACE0, elementDefine.ts\uB294 cyclers \uBC30\uC5F4\uB85C \uAD00\uB9AC\uD558\uBA70 \uC704\uC784\uB9CC \uD55C\uB2E4.\n//\n// \uC2DC\uD074\uB7EC\uB294 \uC0DD\uC131\uC790\uC5D0\uC11C \uC544\uBB34 \uC778\uC790\uB3C4 \uBC1B\uC9C0 \uC54A\uB294\uB2E4. \uC0C1\uD0DC\uB294 \uC778\uC2A4\uD134\uC2A4\uBCC4\uB85C \uAD00\uB9AC\uD574\uC57C \uD558\uBBC0\uB85C,\n// \uAC01 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uD6C5(onConnected \uB4F1)\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uC544\n// \uADF8 \uC548\uC758 $this(\uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4) / $w(window) \uB85C \uCC98\uB9AC\uD55C\uB2E4.\n// elementDefine \uC740 elementDefine \uC2DC\uC810\uC5D0 \uC2DC\uD074\uB7EC\uB97C 1\uD68C \uC0DD\uC131\uD558\uACE0 \uACC4\uC18D \uC7AC\uC0AC\uC6A9\uD55C\uB2E4.\n// \uBAA8\uB4E0 \uBA54\uC11C\uB4DC\uB294 optional \u2014 \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// onConnected \uBC18\uD658 \uD0C0\uC785\n//\n// \uAC01 cycler \uAC00 \"\uD544\uC694\uD55C observer \uC815\uBCF4\"\uB97C \uC120\uC5B8\uD558\uBA74,\n// elementDefine \uC774 \uC218\uC9D1\uD574\uC11C \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC observer \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD55C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** observer observe \uB300\uC0C1 \uC5D4\uD2B8\uB9AC. delegate:true \uC774\uBA74 target \uC740 \uC140\uB809\uD130 \uBB38\uC790\uC5F4\uC774\uBA70, \uC2E4\uC81C \uC694\uC18C\uB294 \uB3D9\uC801 \uCD94\uC801\uC73C\uB85C observe/unobserve \uB41C\uB2E4. */\nexport interface ObserverObserveTarget<TOptions> {\n target: Element | ShadowRoot | string;\n options?: TOptions;\n delegate?: boolean;\n /** delegate \uB3D9\uC801 \uCD94\uC801 \uC2DC observe/unobserve \uB97C \uC2E4\uD589\uD560 \uB8E8\uD2B8(\uC2A4\uCF54\uD504). delegate:true \uC77C \uB54C\uB9CC \uC758\uBBF8 \uC788\uB2E4. */\n delegateRoot?: SwcRootType;\n}\n\n/** MutationObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface MutationObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: MutationObserverInit;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (mutations: MutationRecord[], observer: MutationObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 MutationObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type MutationObserverSet = MutationObserverSetEntry[];\n\n/** ResizeObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uC140\uB809\uD130\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface ResizeObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: ResizeObserverOptions;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 ResizeObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type ResizeObserverSet = ResizeObserverSetEntry[];\n\n/** IntersectionObserver observe \uB300\uC0C1 \uD558\uB098. \uAC19\uC740 \uC635\uC158 \uADF8\uB8F9\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface IntersectionObserverSetEntry {\n target: Element | ShadowRoot | string;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;\n}\n\n/** IntersectionObserver \uADF8\uB8F9. observer \uB294 \uC0DD\uC131 \uC2DC\uC810\uC5D0 \uC635\uC158\uC774 \uACE0\uC815\uB418\uBBC0\uB85C \uC635\uC158\uBCC4\uB85C 1\uAC1C\uC529 \uC0DD\uC131\uB41C\uB2E4. */\nexport interface IntersectionObserverGroup {\n /** observer \uC0DD\uC131 \uC635\uC158 (threshold/rootMargin/root). \uC774 \uAC12\uC774 \uAC19\uC73C\uBA74 \uAC19\uC740 observer \uB97C \uACF5\uC720\uD55C\uB2E4. */\n options: IntersectionObserverInit;\n observeTargets: IntersectionObserverSetEntry[];\n}\n\n/** observe \uD560 \uC635\uC158 \uADF8\uB8F9 \uBAA9\uB85D. elementDefine \uC774 \uADF8\uB8F9\uB9C8\uB2E4 IntersectionObserver \uB97C \uC0DD\uC131\uD55C\uB2E4. */\nexport type IntersectionObserverSet = IntersectionObserverGroup[];\n\n/**\n * onConnected \uC758 \uBC18\uD658 \uD0C0\uC785.\n * observer \uAC00 \uD544\uC694 \uC5C6\uB294 cycler \uB294 undefined \uB97C \uBC18\uD658\uD574\uB3C4 \uB41C\uB2E4.\n */\nexport interface OnConnectedResult {\n mutationObserverSet?: MutationObserverSet;\n resizeObserverSet?: ResizeObserverSet;\n intersectionObserverSet?: IntersectionObserverSet;\n}\n\n/**\n * \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C\uC774 \uAD6C\uD604\uD558\uB294 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uC704\uC784 interface.\n *\n * \uAD6C\uD604\uCCB4\uB294 \uC0C1\uD0DC\uB97C \uAC16\uC9C0 \uC54A\uACE0, \uAC01 \uD6C5\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uB294\uB2E4.\n * \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4 (\uC804\uBD80 optional).\n *\n * ```ts\n * const eventCycler = new EventListenerLifeCycler();\n * const cyclers: ElementDefineLifeCycler[] = [eventCycler, ...]; // elementDefine \uC2DC 1\uD68C \uC0DD\uC131\n *\n * proto.connectedCallback = async function () {\n * const helperHostSet = SwcUtils.getHelperAndHostSet(win, this);\n * const results = await Promise.all(cyclers.map(c => c.onConnected?.(helperHostSet)));\n * // results \uC5D0\uC11C mutationObserverSet / resizeObserverSet \uC218\uC9D1\n * // \u2192 \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC MutationObserver / ResizeObserver \uC0DD\uC131\n * };\n * proto.disconnectedCallback = function () {\n * for (const c of cyclers) c.onDisconnected?.(helperHostSet);\n * };\n * ```\n */\nexport interface ElementDefineLifeCycler {\n /**\n * connectedCallback \uC2DC \uD638\uCD9C.\n * observer \uAC00 \uD544\uC694\uD558\uBA74 OnConnectedResult \uB97C \uBC18\uD658\uD558\uACE0,\n * \uD544\uC694 \uC5C6\uC73C\uBA74 void / undefined \uB97C \uBC18\uD658\uD55C\uB2E4.\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param resizeObserverSet \uC774\uC804 \uC2DC\uD074\uB7EC\uAC00 \uBC18\uD658\uD55C resize observer set (mutation \uC2DC\uD074\uB7EC\uAC00 \uC8FC\uC785\uBC1B\uC544 \uC0AC\uC6A9)\n */\n onConnected?(helperHostSet: HelperHostSet, resizeObserverSet?: ResizeObserverSet): OnConnectedResult | void | Promise<OnConnectedResult | void>;\n\n /** disconnectedCallback \uC2DC \uD638\uCD9C. \uB4F1\uB85D\uD55C \uB9AC\uC18C\uC2A4\uB97C \uD574\uC81C\uD55C\uB2E4. */\n onDisconnected?(helperHostSet: HelperHostSet): void;\n\n /** adoptedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801). */\n onAdopted?(helperHostSet: HelperHostSet): void;\n\n /**\n * attributeChangedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801).\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param name \uBCC0\uACBD\uB41C attribute \uC774\uB984\n * @param oldVal \uC774\uC804 \uAC12\n * @param newVal \uC0C8 \uAC12 (ActionExpression \uCC98\uB9AC \uD6C4)\n */\n onAttributeChanged?(helperHostSet: HelperHostSet, name: string, oldVal: string | null, newVal: any): void;\n\n /**\n * observedAttributes \uC5D0 \uD3EC\uD568\uD574\uC57C \uD558\uB294 attribute \uC774\uB984 \uBAA9\uB85D\uC744 \uBC18\uD658\uD55C\uB2E4.\n * elementDefine \uC774 define-time(constructor)\uC5D0 \uD638\uCD9C\uD574 \uC218\uC9D1\uD55C\uB2E4.\n * \uAD00\uC2EC \uC5C6\uC73C\uBA74 \uAD6C\uD604\uD558\uC9C0 \uC54A\uAC70\uB098 \uBE48 \uBC30\uC5F4\uC744 \uBC18\uD658\uD55C\uB2E4.\n * @param target constructor \uB610\uB294 element \uC778\uC2A4\uD134\uC2A4 (\uBA54\uD0C0\uB370\uC774\uD130 \uC870\uD68C\uC6A9)\n */\n getObservedAttributeNames?(target: any): string[];\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { Router } from '@dooboostore/core-web';\nimport type { Observable } from '@dooboostore/core';\nimport {SwcAttributeConfigType, SwcConfigType} from \"../SwcAppEngine\";\n\nexport enum InjectSituationType {\n HOST_SET = 'SIMPLE_WEB_COMPONENT://HOSTSET',\n APP_HOST = 'SIMPLE_WEB_COMPONENT://APPHOST',\n APP_HOSTS = 'SIMPLE_WEB_COMPONENT://APPHOSTS',\n HOST = 'SIMPLE_WEB_COMPONENT://HOST',\n PARENT_HOST = 'SIMPLE_WEB_COMPONENT://PARENTHOST',\n HOSTS = 'SIMPLE_WEB_COMPONENT://HOSTS',\n FIRST_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTHOST',\n LAST_HOST = 'SIMPLE_WEB_COMPONENT://LASTHOST',\n FIRST_APP_HOST = 'SIMPLE_WEB_COMPONENT://FIRSTAPPHOST',\n LAST_APP_HOST = 'SIMPLE_WEB_COMPONENT://LASTAPPHOST'\n}\n\nexport type SwcRootType = 'light' | 'shadow' | 'all' | 'auto';\n\nexport type SpecialSelector = '$this' | '$window' | '$document' | '$host' | '$appHost' | '$firstHost' | '$lastHost' | '$firstAppHost' | '$lastAppHost' | '$hosts' | '$appHosts';\n\nexport type SwcQueryOptions = { root?: SwcRootType };\n\nexport type HelperSet = {\n $d: Document;\n $w: Window;\n $q: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement | null;\n $qa: (selector: string, root?: Element | Document | ShadowRoot) => HTMLElement[];\n $qi: (id: string, root?: Document | ShadowRoot) => HTMLElement | null;\n};\n\nexport type HostSet = {\n $host: HTMLElement | null; // Nearest parent SWC component\n $parentHost: HTMLElement | null; // Grandparent SWC ancestor\n $hosts: HTMLElement[]; // All SWC ancestors [root, ..., parent]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $host\n // $templateHost: HTMLTemplateElement | null | undefined;\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet & {$this: any};\n\n// \uACF5\uD1B5 \uC140\uB809\uD130 \uD568\uC218 \u2014 \uC694\uC18C/\uB178\uB4DC\uB97C \uC9C1\uC811 \uBC18\uD658\uD558\uB294 \uD568\uC218 \uC140\uB809\uD130 (query\uB294 Node\uAE4C\uC9C0 \uBC18\uD658 \uAC00\uB2A5)\nexport type SwcFnSelector = (currentThis: any, helper: HelperHostSet) => Node | NodeList | Element | Element[] | null;\n// \uACF5\uD1B5 \uC140\uB809\uD130 \u2014 \uBB38\uC790\uC5F4(CSS/\uD2B9\uC218) \uB610\uB294 \uD568\uC218\nexport type SwcSelector = string | SwcFnSelector;\n\nexport type SwcAppMessage<T = any> = {\n publisher?: any;\n data?: T;\n type?: string;\n};\n\n/**\n * \uB2A6\uAC8C \uC5F0\uACB0/\uAD6C\uB3C5\uD55C \uCABD\uC5D0 \uACFC\uAC70 \uBA54\uC2DC\uC9C0\uB97C \uC7AC\uC0DD\uD558\uB294 \uBC29\uC2DD (@subscribeSwcAppMessage, observeMessage \uACF5\uD1B5).\n * - 'subject' \uB610\uB294 \uBBF8\uC9C0\uC815: live\uB9CC\n * - 'behavior': \uBC84\uD37C\uC758 \uB9C8\uC9C0\uB9C9 1\uAC1C \uBA3C\uC800\n * - 'replay': \uBC84\uD37C \uC804\uCCB4\uB97C \uC2DC\uAC04\uC21C\uC73C\uB85C \uBA3C\uC800\n */\nexport type SwcAppMessageSubject = 'subject' | 'behavior' | 'replay';\n\n/** observeMessage \uC635\uC158. type\uC774 \uC5C6\uC73C\uBA74 \uC804 \uD0C0\uC785 live (\uD0C0\uC785\uBCC4 \uBC84\uD37C\uB77C \uC7AC\uC0DD\uC740 type\uC774 \uC788\uC744 \uB54C\uB9CC). */\nexport type SwcAppMessageObserveOptions = { type?: string; subject?: SwcAppMessageSubject };\n\n\nexport interface SwcAppInterface extends HTMLElement, SwcElement {\n simpleApplication?: SimpleApplication;\n config?: SwcConfigType;\n router?: Router;\n connect(config?: SwcAttributeConfigType): Promise<void>;\n routing(path: string): Promise<void>;\n reload(): void;\n back(): void;\n forward(): void;\n publishMessage(message: SwcAppMessage): void;\n /** \uCF54\uB4DC\uB85C \uBA54\uC2DC\uC9C0 \uAD6C\uB3C5 (RxJS \uC2A4\uD0C0\uC77C). \uBC18\uD658\uB41C Observable\uC744 subscribe\uD558\uACE0, \uB05D\uB098\uBA74 unsubscribe. */\n observeMessage<T = any>(): Observable<SwcAppMessage<T>>;\n observeMessage<T = any>(type: string): Observable<SwcAppMessage<T>>;\n observeMessage<T = any>(type: string, options: Omit<SwcAppMessageObserveOptions, 'type'>): Observable<SwcAppMessage<T>>;\n observeMessage<T = any>(options: SwcAppMessageObserveOptions): Observable<SwcAppMessage<T>>;\n /** \uD604\uC7AC \uC5F0\uACB0\uB41C \uC790\uC2DD \uC5D8\uB9AC\uBA3C\uD2B8 \uBAA9\uB85D */\n connectedElements(): Array<HTMLElement & SwcElement>;\n}\n\nexport interface SwcElement {\n _swcId?: string;\n __swc_initialized?: boolean;\n __swc_proto_setup?: boolean;\n __swc_observers?: (MutationObserver | ResizeObserver | IntersectionObserver)[];\n _emitHandlers?: Map<any, any>;\n __swc_attributeEventHandlers?: Map<any, any>;\n // __swc_handled?: any;\n // createSlotString(id: string): string\n // createEaHtml(id: string, script: string): string\n // createEaText(id: string, script: string): string\n // createEaAttribute(id: string, attributeName: string): string\n // createEaEvent(id: string, eventName: string): string\n // createEaProperty(id: string, propertyName: string): string\n}\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// ElementDefineLifeCycler\n//\n// \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C(addEventListener, mutationObserver, \u2026)\uC774 \uC774 interface\uB97C\n// \uAD6C\uD604\uD574 export \uD558\uACE0, elementDefine.ts\uB294 cyclers \uBC30\uC5F4\uB85C \uAD00\uB9AC\uD558\uBA70 \uC704\uC784\uB9CC \uD55C\uB2E4.\n//\n// \uC2DC\uD074\uB7EC\uB294 \uC0DD\uC131\uC790\uC5D0\uC11C \uC544\uBB34 \uC778\uC790\uB3C4 \uBC1B\uC9C0 \uC54A\uB294\uB2E4. \uC0C1\uD0DC\uB294 \uC778\uC2A4\uD134\uC2A4\uBCC4\uB85C \uAD00\uB9AC\uD574\uC57C \uD558\uBBC0\uB85C,\n// \uAC01 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uD6C5(onConnected \uB4F1)\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uC544\n// \uADF8 \uC548\uC758 $this(\uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4) / $w(window) \uB85C \uCC98\uB9AC\uD55C\uB2E4.\n// elementDefine \uC740 elementDefine \uC2DC\uC810\uC5D0 \uC2DC\uD074\uB7EC\uB97C 1\uD68C \uC0DD\uC131\uD558\uACE0 \uACC4\uC18D \uC7AC\uC0AC\uC6A9\uD55C\uB2E4.\n// \uBAA8\uB4E0 \uBA54\uC11C\uB4DC\uB294 optional \u2014 \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// onConnected \uBC18\uD658 \uD0C0\uC785\n//\n// \uAC01 cycler \uAC00 \"\uD544\uC694\uD55C observer \uC815\uBCF4\"\uB97C \uC120\uC5B8\uD558\uBA74,\n// elementDefine \uC774 \uC218\uC9D1\uD574\uC11C \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC observer \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD55C\uB2E4.\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n/** observer observe \uB300\uC0C1 \uC5D4\uD2B8\uB9AC. delegate:true \uC774\uBA74 target \uC740 \uC140\uB809\uD130 \uBB38\uC790\uC5F4\uC774\uBA70, \uC2E4\uC81C \uC694\uC18C\uB294 \uB3D9\uC801 \uCD94\uC801\uC73C\uB85C observe/unobserve \uB41C\uB2E4. */\nexport interface ObserverObserveTarget<TOptions> {\n target: Element | ShadowRoot | string;\n options?: TOptions;\n delegate?: boolean;\n /** delegate \uB3D9\uC801 \uCD94\uC801 \uC2DC observe/unobserve \uB97C \uC2E4\uD589\uD560 \uB8E8\uD2B8(\uC2A4\uCF54\uD504). delegate:true \uC77C \uB54C\uB9CC \uC758\uBBF8 \uC788\uB2E4. */\n delegateRoot?: SwcRootType;\n}\n\n/** MutationObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uB8E8\uD2B8\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface MutationObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: MutationObserverInit;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (mutations: MutationRecord[], observer: MutationObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 MutationObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type MutationObserverSet = MutationObserverSetEntry[];\n\n/** ResizeObserver observe \uB300\uC0C1 \uD558\uB098. \uB3D9\uC77C \uC140\uB809\uD130\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface ResizeObserverSetEntry {\n target: Element | ShadowRoot | string;\n options?: ResizeObserverOptions;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: ResizeObserverEntry[], observer: ResizeObserver) => void;\n}\n\n/** observe \uD560 \uB300\uC0C1 \uBAA9\uB85D (\uC5D4\uD2B8\uB9AC\uBCC4 \uCF5C\uBC31 \uD3EC\uD568). elementDefine \uC774 \uD558\uB098\uC758 ResizeObserver \uB85C \uBAA8\uB450 observe \uD55C\uB2E4. */\nexport type ResizeObserverSet = ResizeObserverSetEntry[];\n\n/** IntersectionObserver observe \uB300\uC0C1 \uD558\uB098. \uAC19\uC740 \uC635\uC158 \uADF8\uB8F9\uC758 \uC5EC\uB7EC \uB300\uC0C1\uC740 \uAC19\uC740 callback \uC744 \uACF5\uC720\uD55C\uB2E4. */\nexport interface IntersectionObserverSetEntry {\n target: Element | ShadowRoot | string;\n delegate?: boolean;\n delegateRoot?: SwcRootType;\n callback: (entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void;\n}\n\n/** IntersectionObserver \uADF8\uB8F9. observer \uB294 \uC0DD\uC131 \uC2DC\uC810\uC5D0 \uC635\uC158\uC774 \uACE0\uC815\uB418\uBBC0\uB85C \uC635\uC158\uBCC4\uB85C 1\uAC1C\uC529 \uC0DD\uC131\uB41C\uB2E4. */\nexport interface IntersectionObserverGroup {\n /** observer \uC0DD\uC131 \uC635\uC158 (threshold/rootMargin/root). \uC774 \uAC12\uC774 \uAC19\uC73C\uBA74 \uAC19\uC740 observer \uB97C \uACF5\uC720\uD55C\uB2E4. */\n options: IntersectionObserverInit;\n observeTargets: IntersectionObserverSetEntry[];\n}\n\n/** observe \uD560 \uC635\uC158 \uADF8\uB8F9 \uBAA9\uB85D. elementDefine \uC774 \uADF8\uB8F9\uB9C8\uB2E4 IntersectionObserver \uB97C \uC0DD\uC131\uD55C\uB2E4. */\nexport type IntersectionObserverSet = IntersectionObserverGroup[];\n\n/**\n * onConnected \uC758 \uBC18\uD658 \uD0C0\uC785.\n * observer \uAC00 \uD544\uC694 \uC5C6\uB294 cycler \uB294 undefined \uB97C \uBC18\uD658\uD574\uB3C4 \uB41C\uB2E4.\n */\nexport interface OnConnectedResult {\n mutationObserverSet?: MutationObserverSet;\n resizeObserverSet?: ResizeObserverSet;\n intersectionObserverSet?: IntersectionObserverSet;\n}\n\n/**\n * \uAC01 \uB370\uCF54\uB808\uC774\uD130 \uD30C\uC77C\uC774 \uAD6C\uD604\uD558\uB294 \uB77C\uC774\uD504\uC0AC\uC774\uD074 \uC704\uC784 interface.\n *\n * \uAD6C\uD604\uCCB4\uB294 \uC0C1\uD0DC\uB97C \uAC16\uC9C0 \uC54A\uACE0, \uAC01 \uD6C5\uC758 \uCCAB \uBC88\uC9F8 \uC778\uC790\uB85C HelperHostSet \uC744 \uBC1B\uB294\uB2E4.\n * \uAD00\uC2EC \uC788\uB294 \uD6C5\uB9CC \uAD6C\uD604\uD558\uBA74 \uB41C\uB2E4 (\uC804\uBD80 optional).\n *\n * ```ts\n * const eventCycler = new EventListenerLifeCycler();\n * const cyclers: ElementDefineLifeCycler[] = [eventCycler, ...]; // elementDefine \uC2DC 1\uD68C \uC0DD\uC131\n *\n * proto.connectedCallback = async function () {\n * const helperHostSet = SwcUtils.getHelperAndHostSet(this);\n * const results = await Promise.all(cyclers.map(c => c.onConnected?.(helperHostSet)));\n * // results \uC5D0\uC11C mutationObserverSet / resizeObserverSet \uC218\uC9D1\n * // \u2192 \uD544\uC694\uD55C \uACBD\uC6B0\uC5D0\uB9CC MutationObserver / ResizeObserver \uC0DD\uC131\n * };\n * proto.disconnectedCallback = function () {\n * for (const c of cyclers) c.onDisconnected?.(helperHostSet);\n * };\n * ```\n */\n// observer \uBA54\uD0C0 phase \uBD84\uB958: \uC790\uAE30 \uC790\uC2E0(bare/$this, non-delegate)\uC740 \uB80C\uB354 \uC804\uC5D0, \uB098\uBA38\uC9C0\uB294 \uB80C\uB354 \uD6C4\uC5D0 \uBD99\uB294\uB2E4.\nexport type ObserverScope = 'self' | 'rest';\nexport const isSelfObserverMeta = (m: { selector?: unknown; options?: { delegate?: boolean } }): boolean =>\n !m.options?.delegate && (m.selector === '$this' || m.selector === '');\nexport const inObserverScope = (m: { selector?: unknown; options?: { delegate?: boolean } }, scope?: ObserverScope): boolean =>\n !scope || (scope === 'self') === isSelfObserverMeta(m);\n\nexport interface ElementDefineLifeCycler {\n /**\n * connectedCallback \uC2DC \uD638\uCD9C.\n * observer \uAC00 \uD544\uC694\uD558\uBA74 OnConnectedResult \uB97C \uBC18\uD658\uD558\uACE0,\n * \uD544\uC694 \uC5C6\uC73C\uBA74 void / undefined \uB97C \uBC18\uD658\uD55C\uB2E4.\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param resizeObserverSet \uC774\uC804 \uC2DC\uD074\uB7EC\uAC00 \uBC18\uD658\uD55C resize observer set (mutation \uC2DC\uD074\uB7EC\uAC00 \uC8FC\uC785\uBC1B\uC544 \uC0AC\uC6A9)\n * @param scope observer \uC2DC\uD074\uB7EC \uC804\uC6A9 \u2014 'self'(\uB80C\uB354 \uC804, \uC790\uAE30 \uC790\uC2E0 \uBA54\uD0C0\uB9CC) / 'rest'(\uB80C\uB354 \uD6C4, \uB098\uBA38\uC9C0). \uC5C6\uC73C\uBA74 \uC804\uBD80.\n */\n onConnected?(helperHostSet: HelperHostSet, resizeObserverSet?: ResizeObserverSet, scope?: ObserverScope): OnConnectedResult | void | Promise<OnConnectedResult | void>;\n\n /** disconnectedCallback \uC2DC \uD638\uCD9C. \uB4F1\uB85D\uD55C \uB9AC\uC18C\uC2A4\uB97C \uD574\uC81C\uD55C\uB2E4. */\n onDisconnected?(helperHostSet: HelperHostSet): void;\n\n /** adoptedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801). */\n onAdopted?(helperHostSet: HelperHostSet): void;\n\n /**\n * attributeChangedCallback \uC2DC \uD638\uCD9C (\uC120\uD0DD\uC801).\n * @param helperHostSet \uD604\uC7AC \uC5D8\uB9AC\uBA3C\uD2B8 \uC778\uC2A4\uD134\uC2A4($this)\uB97C \uD3EC\uD568\uD55C \uCEE8\uD14D\uC2A4\uD2B8\n * @param name \uBCC0\uACBD\uB41C attribute \uC774\uB984\n * @param oldVal \uC774\uC804 \uAC12\n * @param newVal \uC0C8 \uAC12 (ActionExpression \uCC98\uB9AC \uD6C4)\n */\n onAttributeChanged?(helperHostSet: HelperHostSet, name: string, oldVal: string | null, newVal: any): void;\n\n /**\n * observedAttributes \uC5D0 \uD3EC\uD568\uD574\uC57C \uD558\uB294 attribute \uC774\uB984 \uBAA9\uB85D\uC744 \uBC18\uD658\uD55C\uB2E4.\n * elementDefine \uC774 define-time(constructor)\uC5D0 \uD638\uCD9C\uD574 \uC218\uC9D1\uD55C\uB2E4.\n * \uAD00\uC2EC \uC5C6\uC73C\uBA74 \uAD6C\uD604\uD558\uC9C0 \uC54A\uAC70\uB098 \uBE48 \uBC30\uC5F4\uC744 \uBC18\uD658\uD55C\uB2E4.\n * @param target constructor \uB610\uB294 element \uC778\uC2A4\uD134\uC2A4 (\uBA54\uD0C0\uB370\uC774\uD130 \uC870\uD68C\uC6A9)\n */\n getObservedAttributeNames?(target: any): string[];\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,IAAK,sBAAL,kBAAKA,yBAAL;AACL,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,cAAW;AACX,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,iBAAc;AACd,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,gBAAa;AACb,EAAAA,qBAAA,eAAY;AACZ,EAAAA,qBAAA,oBAAiB;AACjB,EAAAA,qBAAA,mBAAgB;AAVN,SAAAA;AAAA,GAAA;AA4ML,MAAM,qBAAqB,CAAC,MACjC,CAAC,EAAE,SAAS,aAAa,EAAE,aAAa,WAAW,EAAE,aAAa;AAC7D,MAAM,kBAAkB,CAAC,GAA6D,UAC3F,CAAC,SAAU,UAAU,WAAY,mBAAmB,CAAC;",
|
|
6
6
|
"names": ["InjectSituationType"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/window.d.ts"],
|
|
4
|
-
"sourcesContent": ["import {HTMLDialogElement} from \"@dooboostore/dom-parser\";\n\n/**\n * Global type augmentation for @dooboostore showcase\n */\ndeclare global {\n interface Window {\n Node: typeof Node;\n NodeList: typeof NodeList;\n Element: typeof Element;\n HTMLElement: typeof HTMLElement;\n HTMLDivElement: typeof HTMLDivElement;\n HTMLButtonElement: typeof HTMLButtonElement;\n HTMLTemplateElement: typeof HTMLTemplateElement;\n HTMLAnchorElement: typeof HTMLAnchorElement;\n HTMLDialogElement: typeof HTMLDialogElement;\n HTMLBodyElement: typeof HTMLBodyElement;\n HTMLSectionElement: typeof HTMLSectionElement;\n HTMLMainElement: typeof HTMLMainElement;\n ShadowRoot: typeof ShadowRoot;\n location: Location;\n document: Document;\n history: History;\n console: Console;\n IntersectionObserver: typeof IntersectionObserver;\n
|
|
4
|
+
"sourcesContent": ["import {HTMLDialogElement} from \"@dooboostore/dom-parser\";\n\n/**\n * Global type augmentation for @dooboostore showcase\n */\ndeclare global {\n interface Window {\n Node: typeof Node;\n NodeList: typeof NodeList;\n Element: typeof Element;\n HTMLElement: typeof HTMLElement;\n HTMLDivElement: typeof HTMLDivElement;\n HTMLButtonElement: typeof HTMLButtonElement;\n HTMLTemplateElement: typeof HTMLTemplateElement;\n HTMLAnchorElement: typeof HTMLAnchorElement;\n HTMLDialogElement: typeof HTMLDialogElement;\n HTMLBodyElement: typeof HTMLBodyElement;\n HTMLSectionElement: typeof HTMLSectionElement;\n HTMLMainElement: typeof HTMLMainElement;\n ShadowRoot: typeof ShadowRoot;\n location: Location;\n document: Document;\n history: History;\n console: Console;\n IntersectionObserver: typeof IntersectionObserver;\n ResizeObserver: typeof ResizeObserver;\n MutationObserver: typeof MutationObserver;\n SwaggerUIBundle: any;\n\n }\n}\n\nexport {};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils/Utils.js
CHANGED
|
@@ -217,7 +217,15 @@ var SwcUtils;
|
|
|
217
217
|
$qi: (id, root) => (root ?? doc).getElementById(id)
|
|
218
218
|
};
|
|
219
219
|
};
|
|
220
|
-
SwcUtils2.
|
|
220
|
+
SwcUtils2.resolveWindow = (el) => {
|
|
221
|
+
const hosts = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
|
|
222
|
+
for (let i = hosts.length - 1; i >= 0; i--) {
|
|
223
|
+
const w = (0, import_decorators.getElementConfig)(hosts[i])?.window;
|
|
224
|
+
if (w) return w;
|
|
225
|
+
}
|
|
226
|
+
return typeof window !== "undefined" ? window : void 0;
|
|
227
|
+
};
|
|
228
|
+
SwcUtils2.getHelperAndHostSet = (el, win = (0, SwcUtils2.resolveWindow)(el)) => {
|
|
221
229
|
const helperSet = (0, SwcUtils2.getHelperSet)(win);
|
|
222
230
|
const hostSet = (0, SwcUtils2.getHostSet)(el);
|
|
223
231
|
return {
|
|
@@ -236,13 +244,15 @@ var SwcUtils;
|
|
|
236
244
|
}
|
|
237
245
|
return current;
|
|
238
246
|
};
|
|
239
|
-
SwcUtils2.
|
|
247
|
+
SwcUtils2.findNearestSwcAncestorHost = (el) => {
|
|
240
248
|
const el1 = el;
|
|
241
249
|
if (el1.__swc_host) return el1.__swc_host;
|
|
242
250
|
let current = el.parentElement || el.getRootNode?.()?.host;
|
|
243
251
|
const doc = el.ownerDocument;
|
|
244
252
|
const win = doc?.defaultView || (typeof window !== "undefined" ? window : void 0);
|
|
253
|
+
let guard = 0;
|
|
245
254
|
while (current && current !== doc && current !== win) {
|
|
255
|
+
if (++guard > 50) break;
|
|
246
256
|
if (current.__swc_host) return current.__swc_host;
|
|
247
257
|
if ((0, import_decorators.getElementConfig)(current)) return current;
|
|
248
258
|
current = current.parentElement || current.getRootNode?.()?.host;
|
|
@@ -250,22 +260,18 @@ var SwcUtils;
|
|
|
250
260
|
return void 0;
|
|
251
261
|
};
|
|
252
262
|
SwcUtils2.findAllSwcHostsIncludingSelf = (el) => {
|
|
253
|
-
const hosts = [];
|
|
254
|
-
let current = (0, SwcUtils2.
|
|
263
|
+
const hosts = (0, import_decorators.getElementConfig)(el) ? [el] : [];
|
|
264
|
+
let current = (0, SwcUtils2.findNearestSwcAncestorHost)(el);
|
|
255
265
|
while (current) {
|
|
256
266
|
hosts.push(current);
|
|
257
|
-
current = (0, SwcUtils2.
|
|
267
|
+
current = (0, SwcUtils2.findNearestSwcAncestorHost)(current);
|
|
258
268
|
}
|
|
259
269
|
return hosts.reverse();
|
|
260
270
|
};
|
|
261
|
-
SwcUtils2.getHosts = (el) =>
|
|
262
|
-
const ancestors = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
|
|
263
|
-
if ((0, import_decorators.getElementConfig)(el)) return [...ancestors, el];
|
|
264
|
-
return ancestors;
|
|
265
|
-
};
|
|
271
|
+
SwcUtils2.getHosts = (el) => (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
|
|
266
272
|
SwcUtils2.getHost = (el) => {
|
|
267
273
|
if ((0, import_decorators.getElementConfig)(el)) return el;
|
|
268
|
-
return (0, SwcUtils2.
|
|
274
|
+
return (0, SwcUtils2.findNearestSwcAncestorHost)(el);
|
|
269
275
|
};
|
|
270
276
|
function projectProcessHtml(id, htmlOrNode, document2) {
|
|
271
277
|
if (typeof htmlOrNode === "string") {
|
|
@@ -277,7 +283,6 @@ var SwcUtils;
|
|
|
277
283
|
document: document2,
|
|
278
284
|
replaceWrap: { start: /a::\w+=\s*"/, end: /"\s/ },
|
|
279
285
|
replacer: (id2, script, er) => {
|
|
280
|
-
console.log("start: /a-->", er);
|
|
281
286
|
const match = er.expressionStart.match(/^\w+::(\w+)="/);
|
|
282
287
|
const name = match?.[1];
|
|
283
288
|
return import_core_web.ElementApply.attribute(id2, name, script);
|
|
@@ -287,7 +292,6 @@ var SwcUtils;
|
|
|
287
292
|
document: document2,
|
|
288
293
|
replaceWrap: { start: /e::\w+=\s*"/, end: /"\s/ },
|
|
289
294
|
replacer: (id2, script, er) => {
|
|
290
|
-
console.log("start: /e-->", er);
|
|
291
295
|
const match = er.expressionStart.match(/^\w+::(\w+)="/);
|
|
292
296
|
const name = match?.[1];
|
|
293
297
|
return import_core_web.ElementApply.event(id2, name, script);
|
|
@@ -297,7 +301,6 @@ var SwcUtils;
|
|
|
297
301
|
document: document2,
|
|
298
302
|
replaceWrap: { start: /p:\w+=\s*"/, end: /"\s/ },
|
|
299
303
|
replacer: (id2, script, er) => {
|
|
300
|
-
console.log("start: /p-->", er);
|
|
301
304
|
const match = er.expressionStart.match(/^\w+:(\w+)="/);
|
|
302
305
|
const name = match?.[1];
|
|
303
306
|
return import_core_web.ElementApply.property(id2, name, script);
|
|
@@ -434,7 +437,8 @@ var SwcUtils;
|
|
|
434
437
|
return appHosts.reverse();
|
|
435
438
|
};
|
|
436
439
|
SwcUtils2.getHostSet = (el) => {
|
|
437
|
-
const
|
|
440
|
+
const hosts = (0, SwcUtils2.findAllSwcHostsIncludingSelf)(el);
|
|
441
|
+
const ancestors = hosts[hosts.length - 1] === el ? hosts.slice(0, -1) : hosts;
|
|
438
442
|
const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;
|
|
439
443
|
const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;
|
|
440
444
|
const $hosts = ancestors;
|
|
@@ -483,6 +487,23 @@ var SwcUtils;
|
|
|
483
487
|
});
|
|
484
488
|
return result;
|
|
485
489
|
};
|
|
490
|
+
SwcUtils2.parsePathPatternAll = (pattern, currentPath) => {
|
|
491
|
+
if (pattern === null || pattern === void 0) return {};
|
|
492
|
+
const trimmedPattern = pattern.trim();
|
|
493
|
+
if (trimmedPattern === "" && pattern !== "") return {};
|
|
494
|
+
const paramNames = [];
|
|
495
|
+
const regexPattern = trimmedPattern.replace(/{(\w+)(?::(.+?))?}/g, (match2, paramName, customRegex) => {
|
|
496
|
+
paramNames.push(paramName);
|
|
497
|
+
return `(${customRegex || "[^/]+"})`;
|
|
498
|
+
});
|
|
499
|
+
const match = currentPath.match(new RegExp(`^${regexPattern}$`));
|
|
500
|
+
if (!match) return null;
|
|
501
|
+
const result = {};
|
|
502
|
+
paramNames.forEach((name, index) => {
|
|
503
|
+
(result[name] ?? (result[name] = [])).push(match[index + 1]);
|
|
504
|
+
});
|
|
505
|
+
return result;
|
|
506
|
+
};
|
|
486
507
|
})(SwcUtils || (SwcUtils = {}));
|
|
487
508
|
;
|
|
488
509
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/Utils.ts"],
|
|
4
|
-
"sourcesContent": ["import {SwcAppInterface, HostSet, HelperSet, HelperHostSet} from '../types';\nimport {getElementConfig} from \"../decorators\";\nimport {getExpression, ExpressionResult, GetExpressionConfig, GetExpressionResult, ActionExpression} from '@dooboostore/core';\nimport {ElementApply, NodeSlot, Router} from \"@dooboostore/core-web\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n\nexport const html = (str: string, document: Document) => {\n return [...document.createRange().createContextualFragment(str).childNodes];\n}\n// DOM Creation Utilities\nexport const htmlFragment = (html: string | Node | Node[], doc: Document): DocumentFragment => {\n if (!doc) throw new Error('Document is not available');\n const template = doc.createElement('template');\n if (typeof html === 'string') {\n template.innerHTML = html.trim();\n } else if (html instanceof Node) {\n template.appendChild(html);\n } else if (Array.isArray(html)) {\n template.append(...html);\n }\n // template.innerHTML = html.trim();\n return template.content;\n};\n\nexport const textNode = (text: string | any, doc?: Document): Text => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createTextNode(text !== undefined && text !== null ? String(text) : '');\n};\n\nexport const commentNode = (comment: string | any, doc?: Document): Comment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createComment(comment !== undefined && comment !== null ? String(comment) : '');\n};\n\nexport type CreateElementConfig = { innerHtml?: string; property?: Record<string, any>, attrs?: Record<string, any>; };\nexport const createElement = <T extends HTMLElement>(\n documentOrWindow: Document | Window,\n tagName: string,\n options?: CreateElementConfig\n): T => {\n const doc = 'document' in documentOrWindow ? documentOrWindow.document : documentOrWindow;\n if (!doc) throw new Error('Document is not available');\n const el = doc.createElement(tagName) as T;\n if (options?.innerHtml) el.innerHTML = options.innerHtml;\n if (options?.attrs) {\n Object.entries(options.attrs).filter(([k,v])=>v).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n if (options?.property) {\n Object.entries(options.property).forEach(([k, v]) => el[k] = v);\n }\n return el;\n};\n\n// Element factory functions\nexport const htmlDivElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLDivElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('div') as HTMLDivElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSpanElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLSpanElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('span') as HTMLSpanElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlButtonElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLButtonElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('button') as HTMLButtonElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlUlElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLUListElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('ul') as HTMLUListElement;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlLiElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLLIElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('li') as HTMLLIElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlAElement = (html: string, options?: { href?: string; doc?: Document; attrs?: Record<string, any> }): HTMLAnchorElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('a') as HTMLAnchorElement;\n el.innerHTML = html.trim();\n if (options?.href) el.href = options.href;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlPElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLParagraphElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('p') as HTMLParagraphElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlHeadingElement = (level: 1 | 2 | 3 | 4 | 5 | 6, html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLHeadingElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement(`h${level}`) as HTMLHeadingElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSectionElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('section');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlArticleElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('article');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport namespace SwcUtils {\n\n\n export const getParentContainer = (e: Node) => {\n return e.parentElement ?? e.getRootNode() as any;\n }\n\n export const parsePathPatternsSetAttributeString = (pathPattern: string[], path: string) => {\n return JSON.stringify(SwcUtils.parsePathPatternsSet(pathPattern, path)).replace(/\"/g, \"'\");\n }\n\n export const parsePathPatternsSet = (pathPattern: string[], urlAndRouter?: string | Router) => {\n // if (!path) {\n // return;\n // }\n urlAndRouter ??= '/'\n const p = typeof urlAndRouter === 'string' ? urlAndRouter : urlAndRouter.value.url;\n const searchParams = new URLSearchParams();\n const qs = p.split('?')[1];\n qs?.split('&').forEach(it => {\n const [k, v] = it.split('=');\n searchParams.set(k, v);\n })\n return {\n path: p,\n searchParams,\n pathData: SwcUtils.parsePathPatterns(pathPattern, p)\n };\n };\n export const parsePathPatterns = (pathPattern: string[], path: string) => {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, path || '/');\n if (data !== null) {\n return data;\n }\n }\n };\n\n export const getHelperSet = (win: Window): HelperSet => {\n const doc: Document = win.document;\n return {\n $d: doc,\n $w: win,\n $q: (sel: string, root?: Element | Document | ShadowRoot) => (root ?? doc).querySelector(sel),\n $qa: (sel: string, root?: Element | Document | ShadowRoot) => Array.from((root ?? doc).querySelectorAll(sel)) as HTMLElement[],\n $qi: (id: string, root?: Document | ShadowRoot) => (root ?? doc).getElementById(id) as HTMLElement\n } as const;\n };\n\n export const getHelperAndHostSet = (win: Window, el: HTMLElement): HelperHostSet => {\n const helperSet = getHelperSet(win);\n const hostSet = getHostSet(el);\n return {\n ...helperSet,\n ...hostSet,\n $this: el,\n };\n };\n\n export const getValueByPath = (obj: any, path: string, rootName: string) => {\n if (!obj || !path) return SWC_NOT_FOUND;\n\n const parts = path.split('.');\n let current = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return SWC_NOT_FOUND;\n current = current[part];\n }\n return current;\n };\n\n /**\n * Finds the nearest logical SWC host for an element.\n * Checks __swc_host property first, then climbs the DOM tree.\n */\n export const findNearestSwcHostIncludingSelf = (el: HTMLElement | Node): HTMLElement | undefined => {\n const el1 = el as any;\n if (el1.__swc_host) return el1.__swc_host;\n\n let current: any = el.parentElement || (el.getRootNode?.() as any)?.host;\n const doc = el.ownerDocument;\n const win = doc?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n while (current && current !== doc && current !== win) {\n if (current.__swc_host) return current.__swc_host;\n if (getElementConfig(current)) return current as HTMLElement;\n current = current.parentElement || (current.getRootNode?.() as any)?.host;\n }\n return undefined;\n };\n\n /**\n * Returns all SWC ancestors (excluding self) in [root, ..., parent] order.\n */\n export const findAllSwcHostsIncludingSelf = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = [];\n let current = findNearestSwcHostIncludingSelf(el);\n while (current) {\n hosts.push(current);\n // To find the next ancestor, we must start searching from the PARENT of the found host\n current = findNearestSwcHostIncludingSelf(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => {\n const ancestors = findAllSwcHostsIncludingSelf(el);\n if (getElementConfig(el)) return [...ancestors, el];\n return ancestors;\n };\n\n export const getHost = (el: HTMLElement): HTMLElement | undefined => {\n if (getElementConfig(el)) return el;\n return findNearestSwcHostIncludingSelf(el);\n };\n\n\n export function projectProcessHtml(id: string, htmlOrNode: string, document: Document): string;\n export function projectProcessHtml(id: string, htmlOrNode: ((Node)[]) | Node, document: Document): (Node)[];\n export function projectProcessHtml(id: string, htmlOrNode: string | ((Node)[]) | Node, document: Document): string | (Node)[] {\n if (typeof htmlOrNode === 'string') {\n // slot\n let t = htmlOrNode;\n // if (!config?.excludeSlot) {\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[[', end: ']]-->'}, replacer: (id, script) => NodeSlot.slot(id, script)});\n // }\n // if (!config?.excludeHtml) {\n // Ea html\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[html', end: ']-->'}, replacer: (id, script) => ElementApply.html(id, script)});\n // }\n\n // if (!config?.excludeText) {\n // Ea text\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[text', end: ']-->'}, replacer: (id, script) => ElementApply.text(id, script)});\n // }\n\n // if (!config.excludeAttribute) {\n // Ea attribute\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /a::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /a-->', er)\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.attribute(id, name, script)\n }\n });\n // }\n\n // if (!config.excludeEvent) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /e::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /e-->', er)\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.event(id, name, script)\n }\n });\n // }\n\n\n // if (!config.excludeProperty) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /p:\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n console.log('start: /p-->', er)\n const match = er.expressionStart.match(/^\\w+:(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.property(id, name, script)\n }\n });\n return t;\n } else if (htmlOrNode) {\n\n // \uC544\uB798 node\uC77C\uB584\uB3C4 \uCC98\uB9AC\uD558\uB3C4\uB85D \uB9CC\uB4EC \uC544\uC9C1\uD14C\uC2A4\uD2B8\uB294 \uC548\uD574\uBD04 \uD14C\uC2A4\uD2B8\uD6C4 \uC8FC\uC11D\uC9C0\uC6B8\uAC83.\n const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];\n const window = document.defaultView;\n nodes.forEach(node => {\n // TextNode \uD569\uCE58\uAE30\n node.normalize();\n const nodes = document.createTreeWalker(node, window.NodeFilter.SHOW_ELEMENT | window.NodeFilter.SHOW_COMMENT)\n\n const getSlotData = (s: string) => {\n return s.match(/^\\[\\[([\\s\\S]+)\\]\\]$/)?.[1]?.trim();\n }\n const getHtmlData = (s: string) => {\n return s.match(/^\\[html([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[html') && s.endsWith(']');\n }\n const getTextData = (s: string) => {\n return s.match(/^\\[text([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[text') && s.endsWith(']');\n }\n while (nodes.nextNode()) {\n const currentNode = nodes.currentNode;\n if (currentNode.nodeType === window.Node.COMMENT_NODE) {\n const targetNode = currentNode as Comment;\n const v = targetNode.data.trim();\n const slotData = getSlotData(v);\n const htmlData = getHtmlData(v);\n const textData = getTextData(v);\n if (v && slotData) {\n const res = NodeSlot.slotIds(id, slotData)\n targetNode.data = res.start;\n const end = document.createComment(res.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n // document.createTe\n\n } else if (v && htmlData) {\n const s = ElementApply.htmlDataSet(id, htmlData);\n targetNode.data = s.start;\n const end = document.createComment(s.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n } else if (v && textData) {\n const s = ElementApply.textDataSet(id, textData);\n const end = document.createComment(s.end)\n targetNode.data = s.start;\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n }\n\n } else if (currentNode.nodeType === window.Node.ELEMENT_NODE) {\n const targetNode = currentNode as Element;\n targetNode.getAttributeNames().forEach(it => {\n const e = it.match(/e::(\\w+)$/);\n const eventName = e?.[1];\n const p = it.match(/p::(\\w+)$/);\n const propertyName = p?.[1];\n const a = it.match(/a::(\\w+)$/);\n const attributeName = a?.[1];\n\n const value = targetNode.getAttribute(it);\n if (eventName) {\n targetNode.setAttribute(ElementApply.eventName(id, eventName), value);\n targetNode.removeAttribute(it);\n } else if (propertyName) {\n targetNode.setAttribute(ElementApply.propertyName(id, propertyName), value);\n targetNode.removeAttribute(it);\n } else if (attributeName) {\n targetNode.setAttribute(ElementApply.attributeName(id, attributeName), value);\n targetNode.removeAttribute(it);\n }\n })\n }\n }\n\n })\n\n return nodes;\n }\n // }\n\n\n }\n\n // export function processHtml(id: string, htmlOrNode: string, config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): string;\n // export function processHtml(id: string, htmlOrNode: (Node | string)[], config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): (Node | string)[] ;\n export function processHtml(\n id: string,\n html: string,\n config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }\n ): string {\n const replaceStart = config.replaceWrap.start;\n const replaceEnd = config.replaceWrap.end;\n const callReturnStart = `${config.replaceWrap.start}=`;\n const callReturnEnd = `${config.replaceWrap.end}`;\n const callStart = `${config.replaceWrap.start}@`;\n const callEnd = `${config.replaceWrap.end}`;\n const hasPattern = (text: string | null | undefined, start: string, end: string) => {\n if (!text) return false;\n const s = text.indexOf(start);\n const e = text.indexOf(end, s + start.length);\n return s !== -1 && e !== -1 && s < e;\n };\n\n const actionConfig: GetExpressionConfig = {expression: {replace: {start: replaceStart, end: replaceEnd}, callReturn: {start: callReturnStart, end: callReturnEnd}, call: {start: callStart, end: callEnd}}};\n const runActionExpression = (source: string) => {\n const actionExpression = new ActionExpression(source, actionConfig);\n actionExpression.getExpressions().filter(it => it.type === 'replace').forEach(it => {\n actionExpression.replace(it, config.replacer(id, it.script?.trim(), it));\n });\n return actionExpression.toResult();\n };\n\n return runActionExpression(html);\n // if (typeof html === 'string') {\n // } else {\n // }\n }\n\n export const getAppHosts = (el: HTMLElement): SwcAppInterface[] => {\n // const hosts = getHosts(el);\n // return hosts.filter(host => host.tagName.toLowerCase() === 'swc-app' || host.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n const hosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n return hosts;\n };\n\n export const getAppHost = (el: HTMLElement): SwcAppInterface | undefined => {\n const appHosts = getAppHosts(el);\n const appHostsWithoutSelf = appHosts.filter(h => h !== el);\n return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : undefined;\n };\n\n /**\n * Find the closest app host by traversing DOM tree directly, including the element itself.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAppHostIncludingSelfDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllAppHostsIncludingSelfDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all app hosts by traversing DOM tree directly, including the element itself.\n * Returns array of all app hosts in [root, ..., closest-parent-or-self] order.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAllAppHostsIncludingSelfDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n\n const w = el.ownerDocument?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // Guard against SSR environment where window might be undefined\n if (!w) {\n return appHosts;\n }\n\n // console.log('------?',w.ShadowRoot);\n // el \uC790\uCCB4\uBD80\uD130 \uC2DC\uC791 (el\uC774 app host\uC77C \uC218\uB3C4 \uC788\uC74C)\n let current: HTMLElement | null = el;\n\n while (current) {\n const isAppHost =\n current.tagName.toLowerCase() === 'swc-app' ||\n current.getAttribute('is')?.startsWith('swc-app-');\n if (isAppHost) {\n appHosts.push(current as SwcAppInterface);\n }\n\n // \uB2E4\uC74C \uBD80\uBAA8 \uCC3E\uAE30\n if (current.parentElement) {\n // Light DOM: \uC815\uC0C1\uC801\uC778 \uBD80\uBAA8 \uC694\uC18C\n current = current.parentElement;\n } else {\n // parentElement\uAC00 \uC5C6\uC74C = Shadow root\uC758 \uC9C1\uC811 \uC790\uC2DD\uC77C \uC218 \uC788\uC74C\n const root = current.getRootNode();\n if (w.ShadowRoot && root instanceof w.ShadowRoot) {\n // Shadow host\uB85C \uC62C\uB77C\uAC00\uAE30\n current = (root as ShadowRoot).host as HTMLElement;\n } else {\n // Document root \uB3C4\uB2EC\n break;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent-or-self]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const ancestors = findAllSwcHostsIncludingSelf(el); // [root, ..., parent]\n\n const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n const $hosts = ancestors;\n const $firstHost = ancestors.length > 0 ? ancestors[0] : null;\n\n // Collect loop contexts\n const loopContext: Record<string, any> = {};\n let curr: any = el;\n const rootEl = el.ownerDocument?.documentElement;\n while (curr && curr !== rootEl) {\n if (curr.__swc_loop_context) {\n Object.assign(loopContext, curr.__swc_loop_context);\n }\n curr = curr.parentElement || (curr.getRootNode() as any).host;\n }\n\n const $appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n const $appHost = $appHosts.length > 0 ? ($appHosts[$appHosts.length - 1] === el ? ($appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null) : $appHosts[$appHosts.length - 1]) : null;\n const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;\n\n return {\n $host,\n $parentHost,\n $hosts,\n $firstHost,\n $lastHost: $host,\n // $templateHost: (el as any).__swc_template_host,\n $appHost,\n $appHosts,\n $firstAppHost,\n $lastAppHost: $appHost,\n ...loopContext\n } as any;\n };\n\n export const parsePathPattern = (pattern: string | undefined, currentPath: string): { [key: string]: string } | null => {\n // pattern\uC774 null/undefined\uBA74 \uC640\uC77C\uB4DC\uCE74\uB4DC (\uBAA8\uB4E0 \uACBD\uB85C \uB9E4\uCE6D)\n if (pattern === null || pattern === undefined) return {};\n\n // \uACF5\uBC31\uB9CC \uC788\uB294 \uD328\uD134\uB3C4 \uC640\uC77C\uB4DC\uCE74\uB4DC\n const trimmedPattern = pattern.trim();\n if (trimmedPattern === '' && pattern !== '') return {}; // \uACF5\uBC31 \uBB38\uC790\uB9CC \uC788\uB294 \uACBD\uC6B0\n\n // \uD328\uD134\uC744 \uC815\uADDC\uC2DD\uC73C\uB85C \uBCC0\uD658\n // \uC9C0\uC6D0 \uD615\uC2DD:\n // {id} \u2192 ([^/]+) \uAE30\uBCF8 (/ \uC81C\uC678\uD55C \uBAA8\uB4E0 \uBB38\uC790)\n // {tail:.*} \u2192 (.*) \uC815\uADDC\uD45C\uD604\uC2DD \uC9C1\uC811 \uC9C0\uC815\n // {slug:[a-z0-9-]+} \u2192 ([a-z0-9-]+)\n const paramNames: string[] = [];\n const regexPattern = trimmedPattern.replace(/{(\\w+)(?::(.+?))?}/g, (match, paramName, customRegex) => {\n paramNames.push(paramName);\n // customRegex\uAC00 \uC788\uC73C\uBA74 \uC0AC\uC6A9, \uC5C6\uC73C\uBA74 \uAE30\uBCF8\uAC12 ([^/]+)\n return `(${customRegex || '[^/]+'})`;\n });\n\n const regex = new RegExp(`^${regexPattern}$`);\n const match = currentPath.match(regex);\n\n if (!match) return null;\n\n const result: { [key: string]: string } = {};\n paramNames.forEach((name, index) => {\n result[name] = match[index + 1];\n });\n\n return result;\n };\n\n\n}\n;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,wBAA+B;AAC/B,kBAA0G;AAC1G,sBAA6C;AAEtC,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAGjE,MAAM,OAAO,CAAC,KAAaA,cAAuB;AACvD,SAAO,CAAC,GAAGA,UAAS,YAAY,EAAE,yBAAyB,GAAG,EAAE,UAAU;AAC5E;AAEO,MAAM,eAAe,CAACC,OAA8B,QAAoC;AAC7F,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,2BAA2B;AACrD,QAAM,WAAW,IAAI,cAAc,UAAU;AAC7C,MAAI,OAAOA,UAAS,UAAU;AAC5B,aAAS,YAAYA,MAAK,KAAK;AAAA,EACjC,WAAWA,iBAAgB,MAAM;AAC/B,aAAS,YAAYA,KAAI;AAAA,EAC3B,WAAW,MAAM,QAAQA,KAAI,GAAG;AAC9B,aAAS,OAAO,GAAGA,KAAI;AAAA,EACzB;AAEA,SAAO,SAAS;AAClB;AAEO,MAAM,WAAW,CAAC,MAAoB,QAAyB;AACpE,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,SAAO,EAAE,eAAe,SAAS,UAAa,SAAS,OAAO,OAAO,IAAI,IAAI,EAAE;AACjF;AAEO,MAAM,cAAc,CAAC,SAAuB,QAA4B;AAC7E,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC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kB;AAAA,MACpD;AACA,aAAO,KAAK,iBAAkB,KAAK,YAAY,EAAU;AAAA,IAC3D;AAEA,UAAM,YAAYA,UAAS,mCAAmC,EAAE;AAChE,UAAM,WAAW,UAAU,SAAS,IAAK,UAAU,UAAU,SAAS,CAAC,MAAM,KAAM,UAAU,SAAS,IAAI,UAAU,UAAU,SAAS,CAAC,IAAI,OAAQ,UAAU,UAAU,SAAS,CAAC,IAAK;AACvL,UAAM,gBAAgB,UAAU,SAAS,IAAI,UAAU,CAAC,IAAI;AAE5D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA;AAAA,MAEX;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,GAAG;AAAA,IACL;AAAA,EACF;AAEO,EAAMA,UAAA,mBAAmB,CAAC,SAA6B,gBAA0D;AAEtH,QAAI,YAAY,QAAQ,YAAY,OAAW,QAAO,CAAC;AAGvD,UAAM,iBAAiB,QAAQ,KAAK;AACpC,QAAI,mBAAmB,MAAM,YAAY,GAAI,QAAO,CAAC;AAOrD,UAAM,aAAuB,CAAC;AAC9B,UAAM,eAAe,eAAe,QAAQ,uBAAuB,CAACI,QAAO,WAAW,gBAAgB;AACpG,iBAAW,KAAK,SAAS;AAEzB,aAAO,IAAI,eAAe,OAAO;AAAA,IACnC,CAAC;AAED,UAAM,QAAQ,IAAI,OAAO,IAAI,YAAY,GAAG;AAC5C,UAAM,QAAQ,YAAY,MAAM,KAAK;AAErC,QAAI,CAAC,MAAO,QAAO;AAEnB,UAAM,SAAoC,CAAC;AAC3C,eAAW,QAAQ,CAAC,MAAM,UAAU;AAClC,aAAO,IAAI,IAAI,MAAM,QAAQ,CAAC;AAAA,IAChC,CAAC;AAED,WAAO;AAAA,EACT;AAAA,GA7ae;AAibjB;",
|
|
4
|
+
"sourcesContent": ["import {SwcAppInterface, HostSet, HelperSet, HelperHostSet} from '../types';\nimport {getElementConfig} from \"../decorators\";\nimport {getExpression, ExpressionResult, GetExpressionConfig, GetExpressionResult, ActionExpression} from '@dooboostore/core';\nimport {ElementApply, NodeSlot, Router} from \"@dooboostore/core-web\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n\nexport const html = (str: string, document: Document) => {\n return [...document.createRange().createContextualFragment(str).childNodes];\n}\n// DOM Creation Utilities\nexport const htmlFragment = (html: string | Node | Node[], doc: Document): DocumentFragment => {\n if (!doc) throw new Error('Document is not available');\n const template = doc.createElement('template');\n if (typeof html === 'string') {\n template.innerHTML = html.trim();\n } else if (html instanceof Node) {\n template.appendChild(html);\n } else if (Array.isArray(html)) {\n template.append(...html);\n }\n // template.innerHTML = html.trim();\n return template.content;\n};\n\nexport const textNode = (text: string | any, doc?: Document): Text => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createTextNode(text !== undefined && text !== null ? String(text) : '');\n};\n\nexport const commentNode = (comment: string | any, doc?: Document): Comment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n return d.createComment(comment !== undefined && comment !== null ? String(comment) : '');\n};\n\nexport type CreateElementConfig = { innerHtml?: string; property?: Record<string, any>, attrs?: Record<string, any>; };\nexport const createElement = <T extends HTMLElement>(\n documentOrWindow: Document | Window,\n tagName: string,\n options?: CreateElementConfig\n): T => {\n const doc = 'document' in documentOrWindow ? documentOrWindow.document : documentOrWindow;\n if (!doc) throw new Error('Document is not available');\n const el = doc.createElement(tagName) as T;\n if (options?.innerHtml) el.innerHTML = options.innerHtml;\n if (options?.attrs) {\n Object.entries(options.attrs).filter(([k,v])=>v).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n if (options?.property) {\n Object.entries(options.property).forEach(([k, v]) => el[k] = v);\n }\n return el;\n};\n\n// Element factory functions\nexport const htmlDivElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLDivElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('div') as HTMLDivElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSpanElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLSpanElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('span') as HTMLSpanElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlButtonElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLButtonElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('button') as HTMLButtonElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlUlElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLUListElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('ul') as HTMLUListElement;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlLiElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLLIElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('li') as HTMLLIElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlAElement = (html: string, options?: { href?: string; doc?: Document; attrs?: Record<string, any> }): HTMLAnchorElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('a') as HTMLAnchorElement;\n el.innerHTML = html.trim();\n if (options?.href) el.href = options.href;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlPElement = (html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLParagraphElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('p') as HTMLParagraphElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlHeadingElement = (level: 1 | 2 | 3 | 4 | 5 | 6, html: string, options?: { doc?: Document; attrs?: Record<string, any> }): HTMLHeadingElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement(`h${level}`) as HTMLHeadingElement;\n el.innerHTML = html.trim();\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlSectionElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('section');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport const htmlArticleElement = (options?: { doc?: Document; attrs?: Record<string, any> }): HTMLElement => {\n const d = options?.doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const el = d.createElement('article');\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(v)));\n }\n return el;\n};\n\nexport namespace SwcUtils {\n\n\n export const getParentContainer = (e: Node) => {\n return e.parentElement ?? e.getRootNode() as any;\n }\n\n export const parsePathPatternsSetAttributeString = (pathPattern: string[], path: string) => {\n return JSON.stringify(SwcUtils.parsePathPatternsSet(pathPattern, path)).replace(/\"/g, \"'\");\n }\n\n export const parsePathPatternsSet = (pathPattern: string[], urlAndRouter?: string | Router) => {\n // if (!path) {\n // return;\n // }\n urlAndRouter ??= '/'\n const p = typeof urlAndRouter === 'string' ? urlAndRouter : urlAndRouter.value.url;\n const searchParams = new URLSearchParams();\n const qs = p.split('?')[1];\n qs?.split('&').forEach(it => {\n const [k, v] = it.split('=');\n searchParams.set(k, v);\n })\n return {\n path: p,\n searchParams,\n pathData: SwcUtils.parsePathPatterns(pathPattern, p)\n };\n };\n export const parsePathPatterns = (pathPattern: string[], path: string) => {\n for (const pattern of pathPattern) {\n const data = SwcUtils.parsePathPattern(pattern, path || '/');\n if (data !== null) {\n return data;\n }\n }\n };\n\n export const getHelperSet = (win: Window): HelperSet => {\n const doc: Document = win.document;\n return {\n $d: doc,\n $w: win,\n $q: (sel: string, root?: Element | Document | ShadowRoot) => (root ?? doc).querySelector(sel),\n $qa: (sel: string, root?: Element | Document | ShadowRoot) => Array.from((root ?? doc).querySelectorAll(sel)) as HTMLElement[],\n $qi: (id: string, root?: Document | ShadowRoot) => (root ?? doc).getElementById(id) as HTMLElement\n } as const;\n };\n\n /** el \uC758 window \u2014 \uC790\uAE30 elementDefine \uC124\uC815 \u2192 \uAC00\uAE4C\uC6B4 \uC870\uC0C1 SWC \uD638\uC2A4\uD2B8 \uC124\uC815 \u2192 \uC804\uC5ED window \uC21C. */\n export const resolveWindow = (el: HTMLElement | Node): Window => {\n const hosts = findAllSwcHostsIncludingSelf(el);\n for (let i = hosts.length - 1; i >= 0; i--) {\n const w = getElementConfig(hosts[i])?.window;\n if (w) return w;\n }\n return (typeof window !== 'undefined' ? window : undefined) as Window;\n };\n\n /** win \uC0DD\uB7B5 \uC2DC resolveWindow(el). el \uC774 SWC \uC694\uC18C\uAC00 \uC544\uB2C8\uBA74(\uC774\uBCA4\uD2B8 target \uB4F1) \uD638\uC2A4\uD2B8\uC758 window \uB97C \uB118\uAE34\uB2E4. */\n export const getHelperAndHostSet = (el: HTMLElement, win: Window = resolveWindow(el)): HelperHostSet => {\n const helperSet = getHelperSet(win);\n const hostSet = getHostSet(el);\n return {\n ...helperSet,\n ...hostSet,\n $this: el,\n };\n };\n\n export const getValueByPath = (obj: any, path: string, rootName: string) => {\n if (!obj || !path) return SWC_NOT_FOUND;\n\n const parts = path.split('.');\n let current = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined) return SWC_NOT_FOUND;\n current = current[part];\n }\n return current;\n };\n\n /**\n * Finds the nearest logical SWC host for an element (excluding self).\n * Checks __swc_host property first, then climbs the DOM tree from the parent.\n */\n export const findNearestSwcAncestorHost = (el: HTMLElement | Node): HTMLElement | undefined => {\n const el1 = el as any;\n if (el1.__swc_host) return el1.__swc_host;\n\n let current: any = el.parentElement || (el.getRootNode?.() as any)?.host;\n const doc = el.ownerDocument;\n const win = doc?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n let guard = 0;\n while (current && current !== doc && current !== win) {\n if (++guard > 50) break;\n if (current.__swc_host) return current.__swc_host;\n if (getElementConfig(current)) return current as HTMLElement;\n current = current.parentElement || (current.getRootNode?.() as any)?.host;\n }\n return undefined;\n };\n\n /**\n * Returns all SWC hosts in [root, ..., parent, self] order (self only when el is an SWC element).\n */\n export const findAllSwcHostsIncludingSelf = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = getElementConfig(el) ? [el as HTMLElement] : [];\n let current = findNearestSwcAncestorHost(el);\n while (current) {\n hosts.push(current);\n // To find the next ancestor, we must start searching from the PARENT of the found host\n current = findNearestSwcAncestorHost(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => findAllSwcHostsIncludingSelf(el);\n\n export const getHost = (el: HTMLElement): HTMLElement | undefined => {\n if (getElementConfig(el)) return el;\n return findNearestSwcAncestorHost(el);\n };\n\n\n export function projectProcessHtml(id: string, htmlOrNode: string, document: Document): string;\n export function projectProcessHtml(id: string, htmlOrNode: ((Node)[]) | Node, document: Document): (Node)[];\n export function projectProcessHtml(id: string, htmlOrNode: string | ((Node)[]) | Node, document: Document): string | (Node)[] {\n if (typeof htmlOrNode === 'string') {\n // slot\n let t = htmlOrNode;\n // if (!config?.excludeSlot) {\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[[', end: ']]-->'}, replacer: (id, script) => NodeSlot.slot(id, script)});\n // }\n // if (!config?.excludeHtml) {\n // Ea html\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[html', end: ']-->'}, replacer: (id, script) => ElementApply.html(id, script)});\n // }\n\n // if (!config?.excludeText) {\n // Ea text\n t = SwcUtils.processHtml(id, t, {document: document, replaceWrap: {start: '<!--[text', end: ']-->'}, replacer: (id, script) => ElementApply.text(id, script)});\n // }\n\n // if (!config.excludeAttribute) {\n // Ea attribute\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /a::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.attribute(id, name, script)\n }\n });\n // }\n\n // if (!config.excludeEvent) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /e::\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n const match = er.expressionStart.match(/^\\w+::(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.event(id, name, script)\n }\n });\n // }\n\n\n // if (!config.excludeProperty) {\n t = SwcUtils.processHtml(id, t, {\n document: document,\n replaceWrap: {start: /p:\\w+=\\s*\"/, end: /\"\\s/}, replacer: (id, script, er) => {\n const match = er.expressionStart.match(/^\\w+:(\\w+)=\"/)\n const name = match?.[1];\n return ElementApply.property(id, name, script)\n }\n });\n return t;\n } else if (htmlOrNode) {\n\n // \uC544\uB798 node\uC77C\uB584\uB3C4 \uCC98\uB9AC\uD558\uB3C4\uB85D \uB9CC\uB4EC \uC544\uC9C1\uD14C\uC2A4\uD2B8\uB294 \uC548\uD574\uBD04 \uD14C\uC2A4\uD2B8\uD6C4 \uC8FC\uC11D\uC9C0\uC6B8\uAC83.\n const nodes = Array.isArray(htmlOrNode) ? htmlOrNode : [htmlOrNode];\n const window = document.defaultView;\n nodes.forEach(node => {\n // TextNode \uD569\uCE58\uAE30\n node.normalize();\n const nodes = document.createTreeWalker(node, window.NodeFilter.SHOW_ELEMENT | window.NodeFilter.SHOW_COMMENT)\n\n const getSlotData = (s: string) => {\n return s.match(/^\\[\\[([\\s\\S]+)\\]\\]$/)?.[1]?.trim();\n }\n const getHtmlData = (s: string) => {\n return s.match(/^\\[html([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[html') && s.endsWith(']');\n }\n const getTextData = (s: string) => {\n return s.match(/^\\[text([\\s\\S]+)\\]$/)?.[1]?.trim();\n // return s.startsWith('[text') && s.endsWith(']');\n }\n while (nodes.nextNode()) {\n const currentNode = nodes.currentNode;\n if (currentNode.nodeType === window.Node.COMMENT_NODE) {\n const targetNode = currentNode as Comment;\n const v = targetNode.data.trim();\n const slotData = getSlotData(v);\n const htmlData = getHtmlData(v);\n const textData = getTextData(v);\n if (v && slotData) {\n const res = NodeSlot.slotIds(id, slotData)\n targetNode.data = res.start;\n const end = document.createComment(res.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n // document.createTe\n\n } else if (v && htmlData) {\n const s = ElementApply.htmlDataSet(id, htmlData);\n targetNode.data = s.start;\n const end = document.createComment(s.end)\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n } else if (v && textData) {\n const s = ElementApply.textDataSet(id, textData);\n const end = document.createComment(s.end)\n targetNode.data = s.start;\n targetNode.parentNode?.insertBefore(end, targetNode.nextSibling);\n }\n\n } else if (currentNode.nodeType === window.Node.ELEMENT_NODE) {\n const targetNode = currentNode as Element;\n targetNode.getAttributeNames().forEach(it => {\n const e = it.match(/e::(\\w+)$/);\n const eventName = e?.[1];\n const p = it.match(/p::(\\w+)$/);\n const propertyName = p?.[1];\n const a = it.match(/a::(\\w+)$/);\n const attributeName = a?.[1];\n\n const value = targetNode.getAttribute(it);\n if (eventName) {\n targetNode.setAttribute(ElementApply.eventName(id, eventName), value);\n targetNode.removeAttribute(it);\n } else if (propertyName) {\n targetNode.setAttribute(ElementApply.propertyName(id, propertyName), value);\n targetNode.removeAttribute(it);\n } else if (attributeName) {\n targetNode.setAttribute(ElementApply.attributeName(id, attributeName), value);\n targetNode.removeAttribute(it);\n }\n })\n }\n }\n\n })\n\n return nodes;\n }\n // }\n\n\n }\n\n // export function processHtml(id: string, htmlOrNode: string, config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): string;\n // export function processHtml(id: string, htmlOrNode: (Node | string)[], config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }): (Node | string)[] ;\n export function processHtml(\n id: string,\n html: string,\n config: { document: Document, replaceWrap: { start: string | RegExp, end: string | RegExp }, replacer: (id: string, script: string, er: ExpressionResult) => string }\n ): string {\n const replaceStart = config.replaceWrap.start;\n const replaceEnd = config.replaceWrap.end;\n const callReturnStart = `${config.replaceWrap.start}=`;\n const callReturnEnd = `${config.replaceWrap.end}`;\n const callStart = `${config.replaceWrap.start}@`;\n const callEnd = `${config.replaceWrap.end}`;\n const hasPattern = (text: string | null | undefined, start: string, end: string) => {\n if (!text) return false;\n const s = text.indexOf(start);\n const e = text.indexOf(end, s + start.length);\n return s !== -1 && e !== -1 && s < e;\n };\n\n const actionConfig: GetExpressionConfig = {expression: {replace: {start: replaceStart, end: replaceEnd}, callReturn: {start: callReturnStart, end: callReturnEnd}, call: {start: callStart, end: callEnd}}};\n const runActionExpression = (source: string) => {\n const actionExpression = new ActionExpression(source, actionConfig);\n actionExpression.getExpressions().filter(it => it.type === 'replace').forEach(it => {\n actionExpression.replace(it, config.replacer(id, it.script?.trim(), it));\n });\n return actionExpression.toResult();\n };\n\n return runActionExpression(html);\n // if (typeof html === 'string') {\n // } else {\n // }\n }\n\n export const getAppHosts = (el: HTMLElement): SwcAppInterface[] => {\n // const hosts = getHosts(el);\n // return hosts.filter(host => host.tagName.toLowerCase() === 'swc-app' || host.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n const hosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n return hosts;\n };\n\n export const getAppHost = (el: HTMLElement): SwcAppInterface | undefined => {\n const appHosts = getAppHosts(el);\n const appHostsWithoutSelf = appHosts.filter(h => h !== el);\n return appHostsWithoutSelf.length > 0 ? appHostsWithoutSelf[appHostsWithoutSelf.length - 1] : undefined;\n };\n\n /**\n * Find the closest app host by traversing DOM tree directly, including the element itself.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAppHostIncludingSelfDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllAppHostsIncludingSelfDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all app hosts by traversing DOM tree directly, including the element itself.\n * Returns array of all app hosts in [root, ..., closest-parent-or-self] order.\n * Only checks tagName and is attribute - no SWC host discovery.\n * Useful for Safari polyfill compatibility where is=\"\" elements upgrade in child-first order.\n */\n export const findAllAppHostsIncludingSelfDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n\n const w = el.ownerDocument?.defaultView || ((typeof window !== 'undefined' ? window : undefined) as any);\n\n // Guard against SSR environment where window might be undefined\n if (!w) {\n return appHosts;\n }\n\n // console.log('------?',w.ShadowRoot);\n // el \uC790\uCCB4\uBD80\uD130 \uC2DC\uC791 (el\uC774 app host\uC77C \uC218\uB3C4 \uC788\uC74C)\n let current: HTMLElement | null = el;\n\n // NOTE: \uC774\uB984\uC73C\uB85C\uB9CC \uCC3E\uB294\uB2E4. define \uC804\uC5D0\uB294 \uAECD\uB370\uAE30 \uC5D8\uB9AC\uBA3C\uD2B8\uB77C \uBA54\uC11C\uB4DC\u00B7instanceof\uB85C\n // \uD310\uBCC4 \uBD88\uAC00 (Safari \uD3F4\uB9AC\uD544\uC740 \uC5C5\uADF8\uB808\uC774\uB4DC \uC21C\uC11C\uB3C4 child-first). 'swc-app' \uD0DC\uADF8 \uB610\uB294\n // is=\"swc-app-*\" \uC18D\uC131\uC774 \uC720\uC77C\uD55C \uB2E8\uC11C. \uCEE4\uC2A4\uD140 \uD638\uC2A4\uD2B8\uB3C4 \uBC18\uB4DC\uC2DC \uC774 prefix\uB97C \uC4F8 \uAC83.\n while (current) {\n const isAppHost =\n current.tagName.toLowerCase() === 'swc-app' ||\n current.getAttribute('is')?.startsWith('swc-app-');\n if (isAppHost) {\n appHosts.push(current as SwcAppInterface);\n }\n\n // \uB2E4\uC74C \uBD80\uBAA8 \uCC3E\uAE30\n if (current.parentElement) {\n // Light DOM: \uC815\uC0C1\uC801\uC778 \uBD80\uBAA8 \uC694\uC18C\n current = current.parentElement;\n } else {\n // parentElement\uAC00 \uC5C6\uC74C = Shadow root\uC758 \uC9C1\uC811 \uC790\uC2DD\uC77C \uC218 \uC788\uC74C\n const root = current.getRootNode();\n if (w.ShadowRoot && root instanceof w.ShadowRoot) {\n // Shadow host\uB85C \uC62C\uB77C\uAC00\uAE30\n current = (root as ShadowRoot).host as HTMLElement;\n } else {\n // Document root \uB3C4\uB2EC\n break;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent-or-self]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const hosts = findAllSwcHostsIncludingSelf(el);\n const ancestors = hosts[hosts.length - 1] === el ? hosts.slice(0, -1) : hosts; // [root, ..., parent] \u2014 $host \uB294 \uC790\uAE30 \uC790\uC2E0\uC774 \uC544\uB2CC \uBD80\uBAA8\n\n const $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n const $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n const $hosts = ancestors;\n const $firstHost = ancestors.length > 0 ? ancestors[0] : null;\n\n // Collect loop contexts\n const loopContext: Record<string, any> = {};\n let curr: any = el;\n const rootEl = el.ownerDocument?.documentElement;\n while (curr && curr !== rootEl) {\n if (curr.__swc_loop_context) {\n Object.assign(loopContext, curr.__swc_loop_context);\n }\n curr = curr.parentElement || (curr.getRootNode() as any).host;\n }\n\n const $appHosts = SwcUtils.findAllAppHostsIncludingSelfDirect(el);\n const $appHost = $appHosts.length > 0 ? ($appHosts[$appHosts.length - 1] === el ? ($appHosts.length > 1 ? $appHosts[$appHosts.length - 2] : null) : $appHosts[$appHosts.length - 1]) : null;\n const $firstAppHost = $appHosts.length > 0 ? $appHosts[0] : null;\n\n return {\n $host,\n $parentHost,\n $hosts,\n $firstHost,\n $lastHost: $host,\n // $templateHost: (el as any).__swc_template_host,\n $appHost,\n $appHosts,\n $firstAppHost,\n $lastAppHost: $appHost,\n ...loopContext\n } as any;\n };\n\n export const parsePathPattern = (pattern: string | undefined, currentPath: string): { [key: string]: string } | null => {\n // pattern\uC774 null/undefined\uBA74 \uC640\uC77C\uB4DC\uCE74\uB4DC (\uBAA8\uB4E0 \uACBD\uB85C \uB9E4\uCE6D)\n if (pattern === null || pattern === undefined) return {};\n\n // \uACF5\uBC31\uB9CC \uC788\uB294 \uD328\uD134\uB3C4 \uC640\uC77C\uB4DC\uCE74\uB4DC\n const trimmedPattern = pattern.trim();\n if (trimmedPattern === '' && pattern !== '') return {}; // \uACF5\uBC31 \uBB38\uC790\uB9CC \uC788\uB294 \uACBD\uC6B0\n\n // \uD328\uD134\uC744 \uC815\uADDC\uC2DD\uC73C\uB85C \uBCC0\uD658\n // \uC9C0\uC6D0 \uD615\uC2DD:\n // {id} \u2192 ([^/]+) \uAE30\uBCF8 (/ \uC81C\uC678\uD55C \uBAA8\uB4E0 \uBB38\uC790)\n // {tail:.*} \u2192 (.*) \uC815\uADDC\uD45C\uD604\uC2DD \uC9C1\uC811 \uC9C0\uC815\n // {slug:[a-z0-9-]+} \u2192 ([a-z0-9-]+)\n const paramNames: string[] = [];\n const regexPattern = trimmedPattern.replace(/{(\\w+)(?::(.+?))?}/g, (match, paramName, customRegex) => {\n paramNames.push(paramName);\n // customRegex\uAC00 \uC788\uC73C\uBA74 \uC0AC\uC6A9, \uC5C6\uC73C\uBA74 \uAE30\uBCF8\uAC12 ([^/]+)\n return `(${customRegex || '[^/]+'})`;\n });\n\n const regex = new RegExp(`^${regexPattern}$`);\n const match = currentPath.match(regex);\n\n if (!match) return null;\n\n const result: { [key: string]: string } = {};\n paramNames.forEach((name, index) => {\n result[name] = match[index + 1];\n });\n\n return result;\n };\n\n /**\n * parsePathPattern \uACFC \uAC19\uC740 \uB9E4\uCE6D\uC774\uC9C0\uB9CC, \uAC19\uC740 \uC774\uB984\uC758 \uBCC0\uC218\uAC00 \uC5EC\uB7EC \uBC88 \uB098\uC624\uBA74 \uBAA8\uB4E0 \uAC12\uC744 \uC21C\uC11C\uB300\uB85C \uBAA8\uC740\uB2E4.\n * '/a/{id}/b/{id}' \u2190 '/a/1/b/2' \u2192 { id: ['1', '2'] } (parsePathPattern \uC740 \uB9C8\uC9C0\uB9C9 \uAC12 '2' \uB85C \uB36E\uC5B4\uC500)\n */\n export const parsePathPatternAll = (pattern: string | undefined, currentPath: string): { [key: string]: string[] } | null => {\n if (pattern === null || pattern === undefined) return {};\n const trimmedPattern = pattern.trim();\n if (trimmedPattern === '' && pattern !== '') return {};\n const paramNames: string[] = [];\n const regexPattern = trimmedPattern.replace(/{(\\w+)(?::(.+?))?}/g, (match, paramName, customRegex) => {\n paramNames.push(paramName);\n return `(${customRegex || '[^/]+'})`;\n });\n const match = currentPath.match(new RegExp(`^${regexPattern}$`));\n if (!match) return null;\n const result: { [key: string]: string[] } = {};\n paramNames.forEach((name, index) =>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AAO;AAAA,EACT;AAMO,EAAMJ,UAAA,sBAAsB,CAAC,SAA6B,gBAA4D;AAC3H,QAAI,YAAY,QAAQ,YAAY,OAAW,QAAO,CAAC;AACvD,UAAM,iBAAiB,QAAQ,KAAK;AACpC,QAAI,mBAAmB,MAAM,YAAY,GAAI,QAAO,CAAC;AACrD,UAAM,aAAuB,CAAC;AAC9B,UAAM,eAAe,eAAe,QAAQ,uBAAuB,CAACI,QAAO,WAAW,gBAAgB;AACpG,iBAAW,KAAK,SAAS;AACzB,aAAO,IAAI,eAAe,OAAO;AAAA,IACnC,CAAC;AACD,UAAM,QAAQ,YAAY,MAAM,IAAI,OAAO,IAAI,YAAY,GAAG,CAAC;AAC/D,QAAI,CAAC,MAAO,QAAO;AACnB,UAAM,SAAsC,CAAC;AAC7C,eAAW,QAAQ,CAAC,MAAM,UAAU;AAClC,OAAC,gCAAiB,CAAC,IAAG,KAAK,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC7C,CAAC;AACD,WAAO;AAAA,EACT;AAAA,GA7ce;AAidjB;",
|
|
6
6
|
"names": ["document", "html", "SwcUtils", "id", "window", "nodes", "match"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SwcAppEngine.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => {\n it(this._config.window);\n }))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;AAAA,SAAS,yBAAyB;AAClC,SAAS,YAAY,YAAY,cAA+B;AAChE,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot';\nimport { HashRouter, PathRouter, Router, RouterEventType } from '@dooboostore/core-web';\nimport { ElementRouter } from './router/ElementRouter';\nimport { SimOption } from '@dooboostore/simple-boot';\nimport { ConstructorType, OptionalType, Subscription } from '@dooboostore/core';\nimport { SwcAppInterface } from './types';\nimport { SimConfig } from '@dooboostore/simple-boot';\n\nexport type SwcConfigType = {\n routeType: 'path' | 'hash' | 'element';\n // connectMode?: 'direct' | 'swap' | 'clear-swap'; // hydrate \uC544\uC9C1 \uAC1C\uBC1C\uC911\n container?: symbol;\n otherInstanceSim?: Map<ConstructorType<any> | Function | SimConfig | symbol, any>;\n path?: string;\n window: Window;\n onEngineStarted?: (sp: SimpleApplication, app: SwcAppInterface) => Promise<void> | void;\n onConnectedChildAfter?: (swcEl: HTMLElement) => void;\n onConnectedChildBefore?: (swcEl: HTMLElement) => void;\n onDisconnectedChildAfter?: (swcEl: HTMLElement) => void;\n onDisconnectedChildBefore?: (swcEl: HTMLElement) => void;\n onConnected?: (app: SwcAppInterface) => void;\n onDisconnected?: (app: SwcAppInterface) => void;\n ssr?: boolean;\n onStartedLazyDefineComponent?: ((w: Window)=> Promise<CustomElementConstructor> | void | string | any | CustomElementConstructor)[];\n\n onChildrenConnectedDone?: (app: SwcAppInterface) => void;\n // onChildrenSwcAppStartedDone?: (app: SwcAppInterface) => void;\n // childrenSwcAppStartedDoneCheckIntervalTime?: number;\n onChildrenRouteChanged?: (event: RouterEventType, app: SwcAppInterface) => void;\n childrenRouteChangedCheckIntervalTime?: number; // \uC790\uC2DD \uC5F0\uACB0 \uC644\uB8CC \uC774\uBCA4\uD2B8 \uB514\uBC14\uC6B4\uC2A4 \uD0C0\uC784 (ms)\n childrenConnectedDoneCheckIntervalTime?: number;\n messageReplayBufferSize?: number; // \uD0C0\uC785\uBCC4 \uACFC\uAC70 \uBA54\uC2DC\uC9C0 \uBCF4\uAD00 \uAC1C\uC218. \uB2A6\uAC8C \uC5F0\uACB0\uB41C \uC778\uC2A4\uD134\uC2A4\uC5D0 \uC7AC\uC0DD. \uAE30\uBCF8 10.\n};\n\nexport type SwcAttributeConfigType = OptionalType<SwcConfigType, 'routeType' | 'window'>;\n\nexport class SwcAppEngine {\n public simpleApplication?: SimpleApplication;\n public router?: Router;\n private routerSubscription?: Subscription;\n private _config?: SwcConfigType;\n\n constructor(private host: HTMLElement) {}\n\n get config() {\n return this._config;\n }\n\n async connect(config: SwcConfigType) {\n try {\n this._config = config;\n\n // Router Selection\n if (this._config.routeType === 'path') {\n this.router = new PathRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'hash') {\n this.router = new HashRouter({ window: this._config.window, firstUrl: this._config.path });\n } else if (this._config.routeType === 'element') {\n this.router = new ElementRouter({ window: this._config.window, firstUrl: this._config.path });\n }\n\n // console.log('vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv', this.router)\n\n // App start\n this.simpleApplication = new SimpleApplication(\n new SimOption({\n excludeProxys: [(this._config.window as any).Node],\n container: this._config.container\n })\n );\n\n const otherInstanceSim = new Map<any, any>();\n this.config?.otherInstanceSim?.forEach((v, k) => {\n otherInstanceSim.set(k, v);\n });\n if (this.router) otherInstanceSim.set(Router, this.router);\n this.simpleApplication.run(otherInstanceSim);\n\n\n if (this._config.onStartedLazyDefineComponent) {\n // console.log('-------->', this._config.onStartedLazyDefineComponent)\n await Promise.all(this._config.onStartedLazyDefineComponent.map(it => {\n it(this._config.window);\n }))\n }\n if (this._config.onEngineStarted) {\n await this._config.onEngineStarted(this.simpleApplication, this.host as unknown as SwcAppInterface);\n }\n } catch (e) {\n console.error('[SWC-APP-ENGINE] Init failed:', e, this._config);\n }\n }\n\n disconnect() {\n this.routerSubscription?.unsubscribe();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;AAAA,SAAS,yBAAyB;AAClC,SAAS,YAAY,YAAY,cAA+B;AAChE,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;AAiCnB,MAAM,aAAa;AAAA,EAMxB,YAAoB,MAAmB;AAAnB;AALpB,wBAAO;AACP,wBAAO;AACP,wBAAQ;AACR,wBAAQ;AAAA,EAEgC;AAAA,EAExC,IAAI,SAAS;AACX,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,MAAM,QAAQ,QAAuB;AACnC,QAAI;AACF,WAAK,UAAU;AAGf,UAAI,KAAK,QAAQ,cAAc,QAAQ;AACrC,aAAK,SAAS,IAAI,WAAW,EAAE,QAAQ,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC3F,WAAW,KAAK,QAAQ,cAAc,QAAQ;AAC5C,aAAK,SAAS,IAAI,WAAW,EAAE,QAAQ,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ,KAAK,CAAC;AAAA,MAC3F,WAAW,KAAK,QAAQ,cAAc,WAAW;AAC/C,aAAK,SAAS,IAAI,cAAc,EAAE,QAAQ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