@dooboostore/simple-web-component 1.0.30 → 1.0.31
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 +220 -1
- package/dist/cjs/decorators/elementDefine.js +3 -3
- package/dist/cjs/decorators/elementDefine.js.map +2 -2
- package/dist/cjs/elements/SwcAppEngine.js +3 -3
- package/dist/cjs/elements/SwcAppEngine.js.map +2 -2
- package/dist/cjs/elements/SwcAppMixin.js +0 -7
- package/dist/cjs/elements/SwcAppMixin.js.map +2 -2
- package/dist/cjs/elements/SwcAsync.js +35 -54
- package/dist/cjs/elements/SwcAsync.js.map +2 -2
- package/dist/cjs/elements/SwcChoose.js +2 -23
- package/dist/cjs/elements/SwcChoose.js.map +2 -2
- package/dist/cjs/elements/SwcIf.js +31 -60
- package/dist/cjs/elements/SwcIf.js.map +2 -2
- package/dist/cjs/elements/SwcLoop.js +20 -43
- package/dist/cjs/elements/SwcLoop.js.map +2 -2
- package/dist/cjs/elements/SwcSubTemplates.js +0 -27
- package/dist/cjs/elements/SwcSubTemplates.js.map +2 -2
- package/dist/cjs/elements/register.js +88 -92
- package/dist/cjs/elements/register.js.map +2 -2
- package/dist/cjs/router/ElementRouter.js +1 -8
- package/dist/cjs/router/ElementRouter.js.map +2 -2
- package/dist/cjs/types.js.map +1 -1
- package/dist/cjs/utils/Utils.js +24 -11
- package/dist/cjs/utils/Utils.js.map +2 -2
- package/dist/esm/decorators/elementDefine.js +3 -3
- package/dist/esm/decorators/elementDefine.js.map +2 -2
- package/dist/esm/elements/SwcAppEngine.js +3 -3
- package/dist/esm/elements/SwcAppEngine.js.map +2 -2
- package/dist/esm/elements/SwcAppMixin.js +0 -7
- package/dist/esm/elements/SwcAppMixin.js.map +2 -2
- package/dist/esm/elements/SwcAsync.js +35 -35
- package/dist/esm/elements/SwcAsync.js.map +2 -2
- package/dist/esm/elements/SwcChoose.js +2 -4
- package/dist/esm/elements/SwcChoose.js.map +2 -2
- package/dist/esm/elements/SwcIf.js +31 -41
- package/dist/esm/elements/SwcIf.js.map +2 -2
- package/dist/esm/elements/SwcLoop.js +20 -24
- package/dist/esm/elements/SwcLoop.js.map +2 -2
- package/dist/esm/elements/SwcSubTemplates.js +0 -8
- package/dist/esm/elements/SwcSubTemplates.js.map +2 -2
- package/dist/esm/elements/register.js +88 -92
- package/dist/esm/elements/register.js.map +2 -2
- package/dist/esm/router/ElementRouter.js +1 -8
- package/dist/esm/router/ElementRouter.js.map +2 -2
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/utils/Utils.js +24 -11
- package/dist/esm/utils/Utils.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js +27 -14
- package/dist/esm-bundle/dooboostore-simple-web-component.esm.js.map +2 -2
- package/dist/types/decorators/elementDefine.d.ts.map +1 -1
- package/dist/types/elements/SwcAppMixin.d.ts.map +1 -1
- package/dist/types/elements/SwcAsync.d.ts +1 -11
- package/dist/types/elements/SwcAsync.d.ts.map +1 -1
- package/dist/types/elements/SwcChoose.d.ts +1 -13
- package/dist/types/elements/SwcChoose.d.ts.map +1 -1
- package/dist/types/elements/SwcIf.d.ts +1 -13
- package/dist/types/elements/SwcIf.d.ts.map +1 -1
- package/dist/types/elements/SwcLoop.d.ts +1 -13
- package/dist/types/elements/SwcLoop.d.ts.map +1 -1
- package/dist/types/elements/SwcSubTemplates.d.ts +6 -6
- package/dist/types/elements/SwcSubTemplates.d.ts.map +1 -1
- package/dist/types/elements/register.d.ts.map +1 -1
- package/dist/types/router/ElementRouter.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/Utils.d.ts +10 -0
- package/dist/types/utils/Utils.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js +27 -14
- package/dist/umd-bundle/dooboostore-simple-web-component.umd.js.map +2 -2
- package/package.json +3 -3
- package/src/decorators/elementDefine.ts +6 -3
- package/src/elements/SwcAppEngine.ts +3 -3
- package/src/elements/SwcAppMixin.ts +5 -26
- package/src/elements/SwcAsync.ts +43 -31
- package/src/elements/SwcChoose.ts +8 -3
- package/src/elements/SwcIf.ts +38 -38
- package/src/elements/SwcLoop.ts +24 -19
- package/src/elements/SwcSubTemplates.ts +6 -6
- package/src/elements/register.ts +107 -86
- package/src/router/ElementRouter.ts +1 -12
- package/src/types.ts +3 -1
- package/src/utils/Utils.ts +37 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/router/ElementRouter.ts"],
|
|
4
|
-
"sourcesContent": ["import { ChangeStateConfig, ChangeStateResult, RouteAction, Router, RouterConfig, RouterMethodOptions } from '@dooboostore/core-web';\nimport { UrlUtils } from '@dooboostore/core';\n\nexport class ElementRouter extends Router {\n private _history: { url: string; data: any; title?: string }[] = [];\n private _currentIndex = -1;\n\n constructor(config: RouterConfig) {\n
|
|
5
|
-
"mappings": "AAAA,SAA4D,cAAiD;AAC7G,SAAS,gBAAgB;AAElB,MAAM,sBAAsB,OAAO;AAAA,EAIxC,YAAY,QAAsB;
|
|
4
|
+
"sourcesContent": ["import { ChangeStateConfig, ChangeStateResult, RouteAction, Router, RouterConfig, RouterMethodOptions } from '@dooboostore/core-web';\nimport { UrlUtils } from '@dooboostore/core';\n\nexport class ElementRouter extends Router {\n private _history: { url: string; data: any; title?: string }[] = [];\n private _currentIndex = -1;\n\n constructor(config: RouterConfig) {\n super(config);\n }\n\n // Override pushState to manage internal history\n pushState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n // Ensure _history is initialized (defense for super calls)\n if (!this._history) this._history = [];\n\n this._history = this._history.slice(0, this._currentIndex + 1);\n this._history.push({ url: path, data, title });\n this._currentIndex++;\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n // Override replaceState to manage internal history\n replaceState(data: any, title: string | undefined, path: string, config?: ChangeStateConfig): ChangeStateResult {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'start' });\n }\n\n if (!this._history) this._history = [];\n if (this._currentIndex === -1) {\n this._history.push({ url: path, data, title });\n this._currentIndex = 0;\n } else {\n this._history[this._currentIndex] = { url: path, data, title };\n }\n\n if (!config?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: path }), triggerPoint: 'end' });\n }\n return { data };\n }\n\n push(path: RouteAction, state?: RouterMethodOptions): void {\n this.pushState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n replace(path: RouteAction, state?: RouterMethodOptions): void {\n this.replaceState(state?.data, state?.title, this.toUrl(path), state?.config);\n }\n\n back(config?: ChangeStateConfig): void {\n if (this._currentIndex > 0) {\n this.go(-1, config);\n }\n }\n\n forward(config?: ChangeStateConfig): void {\n if (this._currentIndex < this._history.length - 1) {\n this.go(1, config);\n }\n }\n\n go(i: number, config?: ChangeStateConfig): void;\n async go(config: string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }): Promise<void>;\n go(config: number | string | { path: RouteAction; state?: RouterMethodOptions; replace?: boolean; scrollToTop?: boolean }, changeStateConfig?: ChangeStateConfig): Promise<void> | void {\n if (typeof config === 'number') {\n const targetIndex = this._currentIndex + config;\n if (this._history && targetIndex >= 0 && targetIndex < this._history.length) {\n const behaviorSubject = (this as any).behaviorSubject;\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData(), triggerPoint: 'start' });\n }\n\n this._currentIndex = targetIndex;\n const entry = this._history[this._currentIndex];\n\n if (!changeStateConfig?.noEventAndPublish && behaviorSubject) {\n behaviorSubject.next({ ...this.getRouteData({ pathOrUrl: entry.url }), triggerPoint: 'end' });\n }\n }\n return;\n }\n return super.go(config as any, changeStateConfig);\n }\n\n getData(): any {\n return this._history?.[this._currentIndex]?.data;\n }\n\n getUrl(): string {\n return this._history?.[this._currentIndex]?.url ?? this.config?.firstUrl ?? '/';\n }\n\n getHref(): string {\n return this.getUrl();\n }\n\n getPathName(): string {\n return this.getUrl().split('?')[0];\n }\n\n getSearch(): string {\n const parts = this.getUrl().split('?');\n return parts[1] ? `?${parts[1]}` : '';\n }\n\n getSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const search = this.getSearch();\n const searchParams = new URLSearchParams(search);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n getHashSearchParams(data?: { delete?: string[]; append?: [[string, string]] }): URLSearchParams {\n const url = this.getUrl();\n const hashIdx = url.indexOf('#');\n const hash = hashIdx !== -1 ? url.slice(hashIdx + 1) : '';\n const searchParams = new URLSearchParams(hash);\n return UrlUtils.manipulateSearchParams(searchParams, data);\n }\n\n pushAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.push({ searchParams: s }, state);\n }\n\n pushDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.push(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n pushDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.push({ searchParams: s }, state);\n }\n\n pushUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams();\n UrlUtils.upsertSearchParam(s, params);\n this.push({ searchParams: s }, state);\n }\n\n replaceAddSearchParam(params: [[string, string]], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ append: params });\n this.replace({ searchParams: s }, state);\n }\n\n replaceDeleteHashSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getHashSearchParams({ delete: Array.isArray(name) ? name : [name] });\n const url = this.getUrl().split('#')[0];\n const size = Array.from(s.entries()).length;\n this.replace(url + (size > 0 ? '#' + s.toString() : ''), state);\n }\n\n replaceDeleteSearchParam(name: string | string[], state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParams({ delete: Array.isArray(name) ? name : [name] });\n this.replace({ searchParams: s }, state);\n }\n\n replaceUpsertSearchParam(params: Record<string, string | string[]>, state: RouterMethodOptions | undefined): void {\n const s = this.getSearchParamObject();\n UrlUtils.upsertSearchParam(s as any, params);\n this.replace({ searchParams: s as any }, state);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAA4D,cAAiD;AAC7G,SAAS,gBAAgB;AAElB,MAAM,sBAAsB,OAAO;AAAA,EAIxC,YAAY,QAAsB;AAChC,UAAM,MAAM;AAJd,SAAQ,WAAyD,CAAC;AAClE,SAAQ,gBAAgB;AAAA,EAIxB;AAAA;AAAA,EAGA,UAAU,MAAW,OAA2B,MAAc,QAA+C;AAC3G,UAAM,kBAAmB,KAAa;AACtC,QAAI,CAAC,QAAQ,qBAAqB,iBAAiB;AACjD,sBAAgB,KAAK,EAAE,GAAG,KAAK,aAAa,EAAE,WAAW,KAAK,CAAC,GAAG,cAAc,QAAQ,CAAC;AAAA,IAC3F;AAGA,QAAI,CAAC,KAAK,SAAU,MAAK,WAAW,CAAC;AAErC,SAAK,WAAW,KAAK,SAAS,MAAM,GAAG,KAAK,gBAAgB,CAAC;AAC7D,SAAK,SAAS,KAAK,EAAE,KAAK,MAAM,MAAM,MAAM,CAAC;AAC7C,SAAK;AAEL,QAAI,CAAC,QAAQ,qBAAqB,iBAAiB;AACjD,sBAAgB,KAAK,EAAE,GAAG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,EAAE,cAAc,EAAE,GAAG,KAAK;AAAA,EACzC;AAAA,EAEA,6BAA6B,MAAyB,OAA8C;AAClG,UAAM,IAAI,KAAK,oBAAoB,EAAE,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAClF,UAAM,MAAM,KAAK,OAAO,EAAE,MAAM,GAAG,EAAE,CAAC;AACtC,UAAM,OAAO,MAAM,KAAK,EAAE,QAAQ,CAAC,EAAE;AACrC,SAAK,QAAQ,OAAO,OAAO,IAAI,MAAM,EAAE,SAAS,IAAI,KAAK,KAAK;AAAA,EAChE;AAAA,EAEA,yBAAyB,MAAyB,OAA8C;AAC9F,UAAM,IAAI,KAAK,gBAAgB,EAAE,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAC9E,SAAK,QAAQ,EAAE,cAAc,EAAE,GAAG,KAAK;AAAA,EACzC;AAAA,EAEA,yBAAyB,QAA2C,OAA8C;AAChH,UAAM,IAAI,KAAK,qBAAqB;AACpC,aAAS,kBAAkB,GAAU,MAAM;AAC3C,SAAK,QAAQ,EAAE,cAAc,EAAS,GAAG,KAAK;AAAA,EAChD;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType} from \"./elements/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 = ':host' | ':window' | ':document' | ':parentHost' | ':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; // Current component itself\n $parentHost: HTMLElement | null; // Nearest parent SWC component\n $hosts: HTMLElement[]; // [root, ..., parent, self]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $parentHost (for backward compatibility or clarity)\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet;\n\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\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}\n"],
|
|
4
|
+
"sourcesContent": ["import { SimpleApplication } from '@dooboostore/simple-boot/SimpleApplication';\nimport { Router } from '@dooboostore/core-web';\nimport {SwcAttributeConfigType} from \"./elements/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 = ':host' | ':window' | ':document' | ':parentHost' | ':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; // Current component itself\n $parentHost: HTMLElement | null; // Nearest parent SWC component\n $hosts: HTMLElement[]; // [root, ..., parent, self]\n $firstHost: HTMLElement | null; // Top-most SWC ancestor\n $lastHost: HTMLElement | null; // Same as $parentHost (for backward compatibility or clarity)\n $appHost: SwcAppInterface | null;\n $appHosts: SwcAppInterface[];\n $firstAppHost: SwcAppInterface | null;\n $lastAppHost: SwcAppInterface | null;\n};\n\nexport type HelperHostSet = HelperSet & HostSet;\nexport interface SwcChooseInterface extends HTMLTemplateElement {\n refresh(): void;\n}\nexport interface SwcAppInterface extends HTMLElement {\n simpleApplication?: SimpleApplication;\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}\n"],
|
|
5
5
|
"mappings": "AAIO,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;",
|
|
6
6
|
"names": ["InjectSituationType"]
|
|
7
7
|
}
|
package/dist/esm/utils/Utils.js
CHANGED
|
@@ -127,6 +127,23 @@ const htmlArticleElement = (options) => {
|
|
|
127
127
|
};
|
|
128
128
|
var SwcUtils;
|
|
129
129
|
((SwcUtils2) => {
|
|
130
|
+
SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
|
|
131
|
+
return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
|
|
132
|
+
};
|
|
133
|
+
SwcUtils2.parsePathPatternsSet = (pathPattern, path) => {
|
|
134
|
+
return {
|
|
135
|
+
path,
|
|
136
|
+
pathData: SwcUtils2.parsePathPatterns(pathPattern, path)
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
SwcUtils2.parsePathPatterns = (pathPattern, path) => {
|
|
140
|
+
for (const pattern of pathPattern) {
|
|
141
|
+
const data = SwcUtils2.parsePathPattern(pattern, path || "/");
|
|
142
|
+
if (data !== null) {
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
130
147
|
SwcUtils2.getHelperSet = (win) => {
|
|
131
148
|
const doc = win.document;
|
|
132
149
|
return {
|
|
@@ -200,24 +217,20 @@ var SwcUtils;
|
|
|
200
217
|
};
|
|
201
218
|
SwcUtils2.findAllParentAppHostsDirect = (el) => {
|
|
202
219
|
const appHosts = [];
|
|
203
|
-
let current = el
|
|
220
|
+
let current = el;
|
|
204
221
|
while (current) {
|
|
205
222
|
const isAppHost = current.tagName.toLowerCase() === "swc-app" || current.getAttribute("is")?.startsWith("swc-app-");
|
|
206
223
|
if (isAppHost) {
|
|
207
224
|
appHosts.push(current);
|
|
208
225
|
}
|
|
209
|
-
if (current.
|
|
210
|
-
current = current.
|
|
226
|
+
if (current.parentElement) {
|
|
227
|
+
current = current.parentElement;
|
|
211
228
|
} else {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
current = parentNode.host;
|
|
216
|
-
} else {
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
229
|
+
const root = current.getRootNode();
|
|
230
|
+
if (root instanceof ShadowRoot) {
|
|
231
|
+
current = root.host;
|
|
219
232
|
} else {
|
|
220
|
-
|
|
233
|
+
break;
|
|
221
234
|
}
|
|
222
235
|
}
|
|
223
236
|
}
|
|
@@ -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\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n// DOM Creation Utilities\nexport const htmlFragment = (html: string, doc?: Document): DocumentFragment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const template = d.createElement('template');\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 const createElement = <T extends HTMLElement>(\n tagName: string,\n options?: { html?: string; attrs?: Record<string, any>; doc?: Document }\n): T => {\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(tagName) as T;\n if (options?.html) el.innerHTML = options.html;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(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 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 };\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 findNearestSwcHost = (el: HTMLElement | Node): HTMLElement | undefined => {\n if ((el as any).__swc_host) return (el as any).__swc_host;\n // if ((el as any).__swc_proto_setup) return (el as any).__swc_proto_setup;\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 findAllSwcHosts = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = [];\n let current = findNearestSwcHost(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 = findNearestSwcHost(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => {\n const ancestors = findAllSwcHosts(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 findNearestSwcHost(el);\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 };\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 parent app host by traversing DOM tree directly.\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 findParentAppHostDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllParentAppHostsDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all parent app hosts by traversing DOM tree directly.\n * Returns array of all parent app hosts in [closest-parent, ..., root] 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 findAllParentAppHostsDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n \n // Shadow DOM \uB0B4\uBD80\uC758 depth\uB97C \uC815\uC0C1\uC801\uC73C\uB85C \uD0D0\uC0C9\uD558\uAE30 \uC704\uD574\n // el.parentElement\uBD80\uD130 \uC2DC\uC791\uD558\uACE0, shadow root \uACBD\uACC4\uB97C \uB9CC\uB0A0 \uB54C\uB9CC host\uB85C \uC774\uB3D9\n let current: HTMLElement | null = el.parentElement;\n \n while (current) {\n // console.log('vvvvvvv');\n // alert(1)\n // debugger;\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 // Handle shadow DOM\n if (current.shadowRoot) {\n current = ((current.shadowRoot as any).host as HTMLElement).parentElement;\n } else {\n // \uBD80\uBAA8\uAC00 \uC5C6\uC73C\uBA74 shadow root \uACBD\uACC4\uC77C \uC218 \uC788\uC74C\n if (!current.parentElement) {\n const parentNode = current.parentNode;\n if (parentNode instanceof ShadowRoot) {\n current = (parentNode as any).host as HTMLElement;\n } else {\n break;\n }\n } else {\n current = current.parentElement;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const isSwc = !!getElementConfig(el);\n const ancestors = findAllSwcHosts(el); // [root, ..., parent]\n\n let $host: HTMLElement;\n let $parentHost: HTMLElement | null;\n\n if (isSwc) {\n $host = el;\n $parentHost = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n } else {\n $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : el;\n $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n }\n\n const $hosts = isSwc ? [...ancestors, el] : ancestors;\n const $firstHost = $hosts.length > 0 ? $hosts[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.findAllParentAppHostsDirect(el); //$hosts.filter(h => h.tagName.toLowerCase() === 'swc-app' || h.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n // console.log('apphosts00000000', $appHosts)\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: $parentHost,\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"],
|
|
5
|
-
"mappings": "AACA,SAAQ,wBAAuB;AAExB,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAGjE,MAAM,eAAe,CAAC,MAAc,QAAqC;AAC9E,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,QAAM,WAAW,EAAE,cAAc,UAAU;AAC3C,WAAS,YAAY,KAAK,KAAK;AAC/B,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/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,SAAO,EAAE,cAAc,YAAY,UAAa,YAAY,OAAO,OAAO,OAAO,IAAI,EAAE;AACzF;AAEO,MAAM,gBAAgB,CAC3B,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CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAAA,EACjF;AACA,SAAO;AACT;AAEO,MAAM,qBAAqB,CAAC,YAA2E;AAC5G,QAAM,IAAI,SAAS,QAAQ,OAAO,aAAa,cAAc,WAAW;AACxE,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,QAAM,KAAK,EAAE,cAAc,SAAS;AACpC,MAAI,SAAS,OAAO;AAClB,WAAO,QAAQ,QAAQ,KAAK,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;AAAA,EACjF;AACA,SAAO;AACT;AAEO,IAAU;AAAA,CAAV,CAAUA,cAAV;
|
|
4
|
+
"sourcesContent": ["import { SwcAppInterface, HostSet, HelperSet, HelperHostSet } from '../types';\nimport {getElementConfig} from \"../decorators\";\n\nexport const SWC_NOT_FOUND = Symbol.for('simple-web-component:not-found');\n\n// DOM Creation Utilities\nexport const htmlFragment = (html: string, doc?: Document): DocumentFragment => {\n const d = doc || (typeof document !== 'undefined' ? document : undefined);\n if (!d) throw new Error('Document is not available');\n const template = d.createElement('template');\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 const createElement = <T extends HTMLElement>(\n tagName: string,\n options?: { html?: string; attrs?: Record<string, any>; doc?: Document }\n): T => {\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(tagName) as T;\n if (options?.html) el.innerHTML = options.html;\n if (options?.attrs) {\n Object.entries(options.attrs).forEach(([k, v]) => el.setAttribute(k, String(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 parsePathPatternsSetAttributeString = (pathPattern: string[], path: string) => {\n return JSON.stringify(SwcUtils.parsePathPatternsSet(pathPattern, path)).replace(/\"/g, \"'\");\n }\n\n export const parsePathPatternsSet = (pathPattern: string[], path: string) => {\n return {\n path: path,\n pathData: SwcUtils.parsePathPatterns(pathPattern, path)\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 };\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 findNearestSwcHost = (el: HTMLElement | Node): HTMLElement | undefined => {\n if ((el as any).__swc_host) return (el as any).__swc_host;\n // if ((el as any).__swc_proto_setup) return (el as any).__swc_proto_setup;\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 findAllSwcHosts = (el: HTMLElement | Node): HTMLElement[] => {\n const hosts: HTMLElement[] = [];\n let current = findNearestSwcHost(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 = findNearestSwcHost(current);\n }\n return hosts.reverse();\n };\n\n export const getHosts = (el: HTMLElement): HTMLElement[] => {\n const ancestors = findAllSwcHosts(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 findNearestSwcHost(el);\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 };\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 parent app host by traversing DOM tree directly.\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 findParentAppHostDirect = (el: HTMLElement): SwcAppInterface | null => {\n const appHosts = findAllParentAppHostsDirect(el);\n return appHosts.length > 0 ? appHosts[appHosts.length - 1] : null;\n };\n\n /**\n * Find all parent app hosts by traversing DOM tree directly.\n * Returns array of all parent app hosts in [closest-parent, ..., root] 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 findAllParentAppHostsDirect = (el: HTMLElement): SwcAppInterface[] => {\n const appHosts: SwcAppInterface[] = [];\n \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 (root instanceof ShadowRoot) {\n // Shadow host\uB85C \uC62C\uB77C\uAC00\uAE30\n current = root.host as HTMLElement;\n } else {\n // Document root \uB3C4\uB2EC\n break;\n }\n }\n }\n return appHosts.reverse(); // [root, ..., closest-parent]\n };\n\n export const getHostSet = (el: HTMLElement): HostSet => {\n const isSwc = !!getElementConfig(el);\n const ancestors = findAllSwcHosts(el); // [root, ..., parent]\n\n let $host: HTMLElement;\n let $parentHost: HTMLElement | null;\n\n if (isSwc) {\n $host = el;\n $parentHost = ancestors.length > 0 ? ancestors[ancestors.length - 1] : null;\n } else {\n $host = ancestors.length > 0 ? ancestors[ancestors.length - 1] : el;\n $parentHost = ancestors.length > 1 ? ancestors[ancestors.length - 2] : null;\n }\n\n const $hosts = isSwc ? [...ancestors, el] : ancestors;\n const $firstHost = $hosts.length > 0 ? $hosts[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.findAllParentAppHostsDirect(el); //$hosts.filter(h => h.tagName.toLowerCase() === 'swc-app' || h.getAttribute('is')?.startsWith('swc-app-')) as SwcAppInterface[];\n // console.log('apphosts00000000', $appHosts)\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: $parentHost,\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"],
|
|
5
|
+
"mappings": "AACA,SAAQ,wBAAuB;AAExB,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAGjE,MAAM,eAAe,CAAC,MAAc,QAAqC;AAC9E,QAAM,IAAI,QAAQ,OAAO,aAAa,cAAc,WAAW;AAC/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,QAAM,WAAW,EAAE,cAAc,UAAU;AAC3C,WAAS,YAAY,KAAK,KAAK;AAC/B,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/D,MAAI,CAAC,EAAG,OAAM,IAAI,MAAM,2BAA2B;AACnD,SAAO,EAAE,cAAc,YAAY,UAAa,YAAY,OAAO,OAAO,OAAO,IAAI,EAAE;AACzF;AAEO,MAAM,gBAAgB,CAC3B,SACA,YACM;AACN,QAAM,IAAI,SAAS,QAAQ,OAAO,aAAa,cAAc,WAAW;AACxE,MAAI,CAAC,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AO,CAAC;AAGvD,UAAM,iBAAiB,QAAQ,KAAK;AACpC,QAAI,mBAAmB,MAAM,YAAY,GAAI,QAAO,CAAC;AAOrD,UAAM,aAAuB,CAAC;AAC9B,UAAM,eAAe,eAAe,QAAQ,uBAAuB,CAACC,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,GA9Oe;",
|
|
6
6
|
"names": ["SwcUtils", "match"]
|
|
7
7
|
}
|
|
@@ -7023,6 +7023,23 @@ var htmlArticleElement = (options) => {
|
|
|
7023
7023
|
};
|
|
7024
7024
|
var SwcUtils;
|
|
7025
7025
|
((SwcUtils2) => {
|
|
7026
|
+
SwcUtils2.parsePathPatternsSetAttributeString = (pathPattern, path) => {
|
|
7027
|
+
return JSON.stringify(SwcUtils2.parsePathPatternsSet(pathPattern, path)).replace(/"/g, "'");
|
|
7028
|
+
};
|
|
7029
|
+
SwcUtils2.parsePathPatternsSet = (pathPattern, path) => {
|
|
7030
|
+
return {
|
|
7031
|
+
path,
|
|
7032
|
+
pathData: SwcUtils2.parsePathPatterns(pathPattern, path)
|
|
7033
|
+
};
|
|
7034
|
+
};
|
|
7035
|
+
SwcUtils2.parsePathPatterns = (pathPattern, path) => {
|
|
7036
|
+
for (const pattern of pathPattern) {
|
|
7037
|
+
const data = SwcUtils2.parsePathPattern(pattern, path || "/");
|
|
7038
|
+
if (data !== null) {
|
|
7039
|
+
return data;
|
|
7040
|
+
}
|
|
7041
|
+
}
|
|
7042
|
+
};
|
|
7026
7043
|
SwcUtils2.getHelperSet = (win) => {
|
|
7027
7044
|
const doc = win.document;
|
|
7028
7045
|
return {
|
|
@@ -7096,24 +7113,20 @@ var SwcUtils;
|
|
|
7096
7113
|
};
|
|
7097
7114
|
SwcUtils2.findAllParentAppHostsDirect = (el) => {
|
|
7098
7115
|
const appHosts = [];
|
|
7099
|
-
let current = el
|
|
7116
|
+
let current = el;
|
|
7100
7117
|
while (current) {
|
|
7101
7118
|
const isAppHost = current.tagName.toLowerCase() === "swc-app" || current.getAttribute("is")?.startsWith("swc-app-");
|
|
7102
7119
|
if (isAppHost) {
|
|
7103
7120
|
appHosts.push(current);
|
|
7104
7121
|
}
|
|
7105
|
-
if (current.
|
|
7106
|
-
current = current.
|
|
7122
|
+
if (current.parentElement) {
|
|
7123
|
+
current = current.parentElement;
|
|
7107
7124
|
} else {
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
current = parentNode.host;
|
|
7112
|
-
} else {
|
|
7113
|
-
break;
|
|
7114
|
-
}
|
|
7125
|
+
const root = current.getRootNode();
|
|
7126
|
+
if (root instanceof ShadowRoot) {
|
|
7127
|
+
current = root.host;
|
|
7115
7128
|
} else {
|
|
7116
|
-
|
|
7129
|
+
break;
|
|
7117
7130
|
}
|
|
7118
7131
|
}
|
|
7119
7132
|
}
|
|
@@ -7463,12 +7476,12 @@ var setupPrototype = (proto) => {
|
|
|
7463
7476
|
ensureInit2(this);
|
|
7464
7477
|
if (typeof this[methodName] !== "function") return;
|
|
7465
7478
|
const useHostSet = hostSet ?? SwcUtils.getHostSet(this);
|
|
7466
|
-
const app = useHostSet?.$appHost
|
|
7479
|
+
const app = useHostSet?.$appHost?.simpleApplication;
|
|
7467
7480
|
if (app) {
|
|
7468
7481
|
const otherStorage = /* @__PURE__ */ new Map();
|
|
7469
7482
|
const situations = new SituationTypeContainers([new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTSET" /* HOST_SET */, data: useHostSet }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOST" /* APP_HOST */, data: useHostSet.$appHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://APPHOSTS" /* APP_HOSTS */, data: useHostSet.$appHosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOST" /* HOST */, data: useHostSet.$host }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://HOSTS" /* HOSTS */, data: useHostSet.$hosts }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTHOST" /* FIRST_HOST */, data: useHostSet.$firstHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTHOST" /* LAST_HOST */, data: useHostSet.$lastHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://FIRSTAPPHOST" /* FIRST_APP_HOST */, data: useHostSet.$firstAppHost }), new SituationTypeContainer({ situationType: "SIMPLE_WEB_COMPONENT://LASTAPPHOST" /* LAST_APP_HOST */, data: useHostSet.$lastAppHost })]);
|
|
7470
7483
|
otherStorage.set(SituationTypeContainers, situations);
|
|
7471
|
-
return app.simstanceManager.
|
|
7484
|
+
return app.simstanceManager.executeBindParameterSim(
|
|
7472
7485
|
{
|
|
7473
7486
|
target: this,
|
|
7474
7487
|
targetKey: methodName,
|
|
@@ -7591,7 +7604,7 @@ var elementDefine = (name, config = {}) => (constructor) => {
|
|
|
7591
7604
|
if (connectedInnerHtmlList.length > 0) {
|
|
7592
7605
|
let sContent = "", lContent = "";
|
|
7593
7606
|
for (const meta of connectedInnerHtmlList) {
|
|
7594
|
-
const res = this
|
|
7607
|
+
const res = this._invokeLifecycleMethod(meta.propertyKey, hostSet);
|
|
7595
7608
|
if (res !== void 0) {
|
|
7596
7609
|
if (meta.options.useShadow) sContent += res;
|
|
7597
7610
|
else lContent += res;
|