@sdcorejs/angular 22.2.7 → 22.2.8

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.
@@ -4,8 +4,12 @@ import { inject, DestroyRef, PLATFORM_ID, Injectable } from '@angular/core';
4
4
 
5
5
  var _a;
6
6
  const SD_LOADING_STYLE_ATTRIBUTE = 'data-sd-loading-styles';
7
+ const SD_LOADING_OVERLAY_ATTRIBUTE = 'data-sd-loading-overlay';
8
+ // why: SdButton cũng dùng .sd-loading; chỉ overlay do service tạo được nhận CSS phủ vùng.
9
+ const SD_LOADING_OVERLAY_SELECTOR = `.sd-loading[${SD_LOADING_OVERLAY_ATTRIBUTE}]`;
10
+ const SD_LOADING_SPINNER_SELECTOR = `${SD_LOADING_OVERLAY_SELECTOR} > .sd-loading-spinner`;
7
11
  const SD_LOADING_STYLES = `
8
- .sd-loading {
12
+ ${SD_LOADING_OVERLAY_SELECTOR} {
9
13
  position: absolute;
10
14
  inset: 0;
11
15
  width: 100%;
@@ -15,7 +19,7 @@ const SD_LOADING_STYLES = `
15
19
  z-index: 99999;
16
20
  }
17
21
 
18
- .sd-loading-spinner {
22
+ ${SD_LOADING_SPINNER_SELECTOR} {
19
23
  position: absolute;
20
24
  top: calc(50% - 2.5rem);
21
25
  left: calc(50% - 2.5rem);
@@ -233,6 +237,7 @@ class SdLoadingService {
233
237
  const container = this.#document.createElement('div');
234
238
  const spinner = this.#document.createElement('div');
235
239
  container.classList.add('sd-loading');
240
+ container.setAttribute(SD_LOADING_OVERLAY_ATTRIBUTE, '');
236
241
  container.setAttribute('role', 'status');
237
242
  container.setAttribute('aria-live', 'polite');
238
243
  container.setAttribute('aria-label', 'Loading');
@@ -283,8 +288,8 @@ class SdLoadingService {
283
288
  }
284
289
  #ensureRequiredStyleText(record) {
285
290
  const currentText = record.element.textContent ?? '';
286
- const hasRequiredRules = currentText.includes('.sd-loading {') &&
287
- currentText.includes('.sd-loading-spinner') &&
291
+ const hasRequiredRules = currentText.includes(`${SD_LOADING_OVERLAY_SELECTOR} {`) &&
292
+ currentText.includes(`${SD_LOADING_SPINNER_SELECTOR} {`) &&
288
293
  currentText.includes('@keyframes sd-loading-spin');
289
294
  if (hasRequiredRules)
290
295
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"sdcorejs-angular-services-loading.mjs","sources":["../../../projects/sdcorejs-angular/services/loading/src/loading.service.ts","../../../projects/sdcorejs-angular/services/loading/sdcorejs-angular-services-loading.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, PLATFORM_ID, inject } from '@angular/core';\n\nexport interface SdLoadingRef {\n readonly closed: boolean;\n close(): void;\n}\n\ninterface SdLoadingDocumentRecord {\n readonly hostStates: WeakMap<Element, SdLoadingHostState>;\n readonly liveHosts: Set<Element>;\n style: SdLoadingStyleRecord | undefined;\n}\n\ninterface SdLoadingHostState {\n readonly overlay: HTMLElement;\n readonly previousAriaBusy: string | null;\n readonly contributions: SdLoadingContribution[];\n count: number;\n}\n\ninterface SdLoadingHandleState {\n readonly selector: string;\n readonly contributions: SdLoadingContribution[];\n closed: boolean;\n}\n\ninterface SdLoadingContribution {\n readonly host: Element;\n readonly owner: SdLoadingHandleState;\n readonly service: SdLoadingService;\n released: boolean;\n}\n\ninterface SdLoadingStyleRecord {\n readonly element: HTMLStyleElement;\n readonly libraryOwned: boolean;\n readonly owners: Set<SdLoadingService>;\n ownedText: Text | null;\n}\n\nconst SD_LOADING_STYLE_ATTRIBUTE = 'data-sd-loading-styles';\nconst SD_LOADING_STYLES = `\n.sd-loading {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n opacity: 0.6;\n background: #fff;\n z-index: 99999;\n}\n\n.sd-loading-spinner {\n position: absolute;\n top: calc(50% - 2.5rem);\n left: calc(50% - 2.5rem);\n width: 5rem;\n height: 5rem;\n border: 0.5rem solid var(--sd-primary);\n border-top-color: var(--sd-border);\n border-radius: 50%;\n animation: sd-loading-spin 1s linear infinite;\n}\n\n@keyframes sd-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n`;\n\nconst CLOSED_LOADING_REF: SdLoadingRef = Object.freeze({\n closed: true,\n close(): void {\n // A closed ref deliberately has no work to release.\n },\n});\n\n/*\n * why: service này cố tình KHÔNG dùng Renderer2. Khi app bật animations, `RendererFactory2` trả về\n * `AnimationRendererFactory` và `Renderer2.removeChild()` chỉ đẩy element vào hàng đợi\n * `collectedLeaveElements` của animation engine — DOM chỉ thật sự bị gỡ ở lần flush kế tiếp (sau một\n * chu kỳ change detection). Overlay và `style[data-sd-loading-styles]` ở đây là DOM ngoài view, được\n * gỡ lúc destroy injector hoặc từ ngữ cảnh async ngoài Angular, tức không còn flush nào chạy sau đó →\n * node nằm lại trong document vĩnh viễn (overlay z-index 99999 khoá cả trang). Ghi DOM trực tiếp trên\n * `DOCUMENT` giữ append/remove đối xứng và đồng bộ; nhánh SSR đã được `isPlatformBrowser` chặn sẵn.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SdLoadingService {\n private static readonly documentRecords = new WeakMap<Document, SdLoadingDocumentRecord>();\n\n readonly #document: Document;\n readonly #isBrowser: boolean;\n readonly #destroyRef = inject(DestroyRef);\n readonly #handleQueue: SdLoadingHandleState[] = [];\n\n #styleRegistered = false;\n #destroyed = false;\n\n /** Inserted by Angular inject() migration for backwards compatibility. */\n constructor(...args: unknown[]);\n constructor() {\n this.#document = inject(DOCUMENT);\n this.#isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n this.#destroyRef.onDestroy(() => this.#destroy());\n }\n\n /** Starts loading for every current selector match and returns ownership of those exact hosts. */\n start = (selector = 'body'): SdLoadingRef => {\n if (this.#destroyed || !this.#isBrowser) return CLOSED_LOADING_REF;\n\n const hosts = Array.from(this.#document.querySelectorAll(selector));\n if (hosts.length === 0) return CLOSED_LOADING_REF;\n\n const documentRecord = this.#getOrCreateDocumentRecord();\n this.#ensureStyles(documentRecord);\n const state: SdLoadingHandleState = { selector, contributions: [], closed: false };\n for (const host of hosts) {\n const contribution: SdLoadingContribution = {\n host,\n owner: state,\n service: this,\n released: false,\n };\n state.contributions.push(contribution);\n this.#acquireHost(documentRecord, contribution);\n }\n this.#handleQueue.push(state);\n\n return {\n get closed(): boolean {\n return state.closed;\n },\n close: () => this.#closeHandle(state),\n };\n };\n\n /** Returns the first matched globally loading host, `false` for idle matches, or `null` when unavailable. */\n isLoading = (selector = 'body'): Element | false | null => {\n if (this.#destroyed || !this.#isBrowser) return null;\n\n const hosts = this.#document.querySelectorAll(selector);\n if (hosts.length === 0) return null;\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n for (const host of Array.from(hosts)) {\n const state = documentRecord?.hostStates.get(host);\n if (state && state.count > 0 && state.overlay.parentNode === host) return host;\n }\n return false;\n };\n\n /** Releases the oldest exact-selector start, with a current-host fallback for legacy cross-selector calls. */\n stop = (selector = 'body'): void => {\n if (this.#destroyed || !this.#isBrowser) return;\n\n const exactHandle = this.#handleQueue.find(state => !state.closed && state.selector === selector);\n if (exactHandle) {\n this.#closeHandle(exactHandle);\n return;\n }\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n if (!documentRecord) return;\n\n for (const host of Array.from(this.#document.querySelectorAll(selector))) {\n const contribution = documentRecord.hostStates\n .get(host)\n ?.contributions.find(candidate => !candidate.released && candidate.service === this);\n if (contribution) this.#releaseContribution(documentRecord, contribution);\n }\n };\n\n run<T>(task: () => T | PromiseLike<T>, selector?: string): Promise<T>;\n run<T>(task: PromiseLike<T>, selector?: string): Promise<T>;\n /** Runs a task inside a loading lifetime and always releases it without replacing the task result or error. */\n async run<T>(task: (() => T | PromiseLike<T>) | PromiseLike<T>, selector = 'body'): Promise<T> {\n const ref = this.start(selector);\n try {\n const result = typeof task === 'function' ? task() : task;\n return await result;\n } finally {\n ref.close();\n }\n }\n\n #getOrCreateDocumentRecord(): SdLoadingDocumentRecord {\n let record = SdLoadingService.documentRecords.get(this.#document);\n if (!record) {\n record = {\n hostStates: new WeakMap<Element, SdLoadingHostState>(),\n liveHosts: new Set<Element>(),\n style: undefined,\n };\n SdLoadingService.documentRecords.set(this.#document, record);\n }\n return record;\n }\n\n #acquireHost(documentRecord: SdLoadingDocumentRecord, contribution: SdLoadingContribution): void {\n const host = contribution.host;\n const existing = documentRecord.hostStates.get(host);\n if (existing) {\n this.#repairOverlay(host, existing);\n existing.count += 1;\n existing.contributions.push(contribution);\n return;\n }\n\n const state: SdLoadingHostState = {\n overlay: this.#createOverlay(),\n previousAriaBusy: host.getAttribute('aria-busy'),\n contributions: [contribution],\n count: 1,\n };\n host.setAttribute('aria-busy', 'true');\n host.appendChild(state.overlay);\n documentRecord.hostStates.set(host, state);\n documentRecord.liveHosts.add(host);\n }\n\n #repairOverlay(host: Element, state: SdLoadingHostState): void {\n // why: appendChild tự động rút overlay khỏi parent cũ, nên không cần removeChild riêng.\n if (state.overlay.parentNode !== host) host.appendChild(state.overlay);\n if (host.getAttribute('aria-busy') !== 'true') host.setAttribute('aria-busy', 'true');\n }\n\n #releaseContribution(documentRecord: SdLoadingDocumentRecord, contribution: SdLoadingContribution): void {\n if (contribution.released) return;\n contribution.released = true;\n\n const state = documentRecord.hostStates.get(contribution.host);\n if (state) {\n const contributionIndex = state.contributions.indexOf(contribution);\n if (contributionIndex >= 0) state.contributions.splice(contributionIndex, 1);\n state.count -= 1;\n\n if (state.count <= 0) this.#removeHost(documentRecord, contribution.host, state);\n }\n\n contribution.service.#closeOwnerWhenReleased(contribution.owner);\n }\n\n #removeHost(documentRecord: SdLoadingDocumentRecord, host: Element, state: SdLoadingHostState): void {\n state.overlay.remove();\n\n if (host.getAttribute('aria-busy') === 'true') {\n if (state.previousAriaBusy === null) host.removeAttribute('aria-busy');\n else host.setAttribute('aria-busy', state.previousAriaBusy);\n }\n\n documentRecord.hostStates.delete(host);\n documentRecord.liveHosts.delete(host);\n this.#deleteDocumentRecordWhenEmpty(documentRecord);\n }\n\n #closeHandle(state: SdLoadingHandleState): void {\n if (state.closed) return;\n\n state.closed = true;\n this.#dequeueHandle(state);\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n if (documentRecord) {\n for (const contribution of [...state.contributions]) {\n this.#releaseContribution(documentRecord, contribution);\n }\n } else {\n for (const contribution of state.contributions) contribution.released = true;\n }\n state.contributions.length = 0;\n }\n\n #closeOwnerWhenReleased(state: SdLoadingHandleState): void {\n if (state.closed || state.contributions.some(contribution => !contribution.released)) return;\n\n state.closed = true;\n this.#dequeueHandle(state);\n state.contributions.length = 0;\n }\n\n #dequeueHandle(state: SdLoadingHandleState): void {\n const handleIndex = this.#handleQueue.indexOf(state);\n if (handleIndex >= 0) this.#handleQueue.splice(handleIndex, 1);\n }\n\n #createOverlay(): HTMLElement {\n const container = this.#document.createElement('div');\n const spinner = this.#document.createElement('div');\n\n container.classList.add('sd-loading');\n container.setAttribute('role', 'status');\n container.setAttribute('aria-live', 'polite');\n container.setAttribute('aria-label', 'Loading');\n\n spinner.classList.add('sd-loading-spinner');\n spinner.setAttribute('aria-hidden', 'true');\n container.appendChild(spinner);\n return container;\n }\n\n #ensureStyles(documentRecord: SdLoadingDocumentRecord): void {\n let record = documentRecord.style;\n if (record && !this.#isCurrentStyle(record.element)) {\n const owners = record.owners;\n this.#detachOwnedStyleContent(record);\n record = this.#createStyleRecord(owners);\n documentRecord.style = record;\n } else if (!record) {\n record = this.#createStyleRecord(new Set<SdLoadingService>());\n documentRecord.style = record;\n } else {\n this.#ensureRequiredStyleText(record);\n }\n\n record.owners.add(this);\n this.#styleRegistered = true;\n }\n\n #isCurrentStyle(element: HTMLStyleElement): boolean {\n return element.isConnected && element.parentNode === this.#document.head && element.hasAttribute(SD_LOADING_STYLE_ATTRIBUTE);\n }\n\n #createStyleRecord(owners: Set<SdLoadingService>): SdLoadingStyleRecord {\n const existing = this.#document.head.querySelector<HTMLStyleElement>(`style[${SD_LOADING_STYLE_ATTRIBUTE}]`);\n if (existing) {\n const record: SdLoadingStyleRecord = {\n element: existing,\n libraryOwned: false,\n owners,\n ownedText: null,\n };\n this.#ensureRequiredStyleText(record);\n return record;\n }\n\n const style = this.#document.createElement('style');\n const ownedText = this.#document.createTextNode(SD_LOADING_STYLES);\n style.setAttribute(SD_LOADING_STYLE_ATTRIBUTE, '');\n style.appendChild(ownedText);\n this.#document.head.appendChild(style);\n return { element: style, libraryOwned: true, owners, ownedText };\n }\n\n #ensureRequiredStyleText(record: SdLoadingStyleRecord): void {\n const currentText = record.element.textContent ?? '';\n const hasRequiredRules =\n currentText.includes('.sd-loading {') &&\n currentText.includes('.sd-loading-spinner') &&\n currentText.includes('@keyframes sd-loading-spin');\n if (hasRequiredRules) return;\n\n if (record.ownedText && record.ownedText.parentNode !== record.element) record.ownedText = null;\n if (!record.ownedText) {\n record.ownedText = this.#document.createTextNode(SD_LOADING_STYLES);\n record.element.appendChild(record.ownedText);\n }\n }\n\n #detachOwnedStyleContent(record: SdLoadingStyleRecord): void {\n if (record.libraryOwned) record.element.remove();\n else record.ownedText?.remove();\n record.ownedText = null;\n }\n\n #destroy(): void {\n if (this.#destroyed) return;\n this.#destroyed = true;\n\n if (this.#isBrowser) {\n for (const state of [...this.#handleQueue]) this.#closeHandle(state);\n this.#unregisterStyles();\n return;\n }\n\n for (const state of this.#handleQueue) {\n state.closed = true;\n state.contributions.length = 0;\n }\n this.#handleQueue.length = 0;\n }\n\n #unregisterStyles(): void {\n if (!this.#styleRegistered) return;\n this.#styleRegistered = false;\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n const record = documentRecord?.style;\n if (!documentRecord || !record) return;\n\n record.owners.delete(this);\n if (record.owners.size === 0) {\n this.#detachOwnedStyleContent(record);\n documentRecord.style = undefined;\n }\n this.#deleteDocumentRecordWhenEmpty(documentRecord);\n }\n\n #deleteDocumentRecordWhenEmpty(documentRecord: SdLoadingDocumentRecord): void {\n if (documentRecord.liveHosts.size === 0 && !documentRecord.style) {\n SdLoadingService.documentRecords.delete(this.#document);\n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AAA,EAAA,CAAA;AAAhB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,cAFf,MAAM,EAAA,CAAA;;;2FAEP,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAH5B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;;ACzFD;;AAEG;;"}
1
+ {"version":3,"file":"sdcorejs-angular-services-loading.mjs","sources":["../../../projects/sdcorejs-angular/services/loading/src/loading.service.ts","../../../projects/sdcorejs-angular/services/loading/sdcorejs-angular-services-loading.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, PLATFORM_ID, inject } from '@angular/core';\n\nexport interface SdLoadingRef {\n readonly closed: boolean;\n close(): void;\n}\n\ninterface SdLoadingDocumentRecord {\n readonly hostStates: WeakMap<Element, SdLoadingHostState>;\n readonly liveHosts: Set<Element>;\n style: SdLoadingStyleRecord | undefined;\n}\n\ninterface SdLoadingHostState {\n readonly overlay: HTMLElement;\n readonly previousAriaBusy: string | null;\n readonly contributions: SdLoadingContribution[];\n count: number;\n}\n\ninterface SdLoadingHandleState {\n readonly selector: string;\n readonly contributions: SdLoadingContribution[];\n closed: boolean;\n}\n\ninterface SdLoadingContribution {\n readonly host: Element;\n readonly owner: SdLoadingHandleState;\n readonly service: SdLoadingService;\n released: boolean;\n}\n\ninterface SdLoadingStyleRecord {\n readonly element: HTMLStyleElement;\n readonly libraryOwned: boolean;\n readonly owners: Set<SdLoadingService>;\n ownedText: Text | null;\n}\n\nconst SD_LOADING_STYLE_ATTRIBUTE = 'data-sd-loading-styles';\nconst SD_LOADING_OVERLAY_ATTRIBUTE = 'data-sd-loading-overlay';\n// why: SdButton cũng dùng .sd-loading; chỉ overlay do service tạo được nhận CSS phủ vùng.\nconst SD_LOADING_OVERLAY_SELECTOR = `.sd-loading[${SD_LOADING_OVERLAY_ATTRIBUTE}]`;\nconst SD_LOADING_SPINNER_SELECTOR = `${SD_LOADING_OVERLAY_SELECTOR} > .sd-loading-spinner`;\nconst SD_LOADING_STYLES = `\n${SD_LOADING_OVERLAY_SELECTOR} {\n position: absolute;\n inset: 0;\n width: 100%;\n height: 100%;\n opacity: 0.6;\n background: #fff;\n z-index: 99999;\n}\n\n${SD_LOADING_SPINNER_SELECTOR} {\n position: absolute;\n top: calc(50% - 2.5rem);\n left: calc(50% - 2.5rem);\n width: 5rem;\n height: 5rem;\n border: 0.5rem solid var(--sd-primary);\n border-top-color: var(--sd-border);\n border-radius: 50%;\n animation: sd-loading-spin 1s linear infinite;\n}\n\n@keyframes sd-loading-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n`;\n\nconst CLOSED_LOADING_REF: SdLoadingRef = Object.freeze({\n closed: true,\n close(): void {\n // A closed ref deliberately has no work to release.\n },\n});\n\n/*\n * why: service này cố tình KHÔNG dùng Renderer2. Khi app bật animations, `RendererFactory2` trả về\n * `AnimationRendererFactory` và `Renderer2.removeChild()` chỉ đẩy element vào hàng đợi\n * `collectedLeaveElements` của animation engine — DOM chỉ thật sự bị gỡ ở lần flush kế tiếp (sau một\n * chu kỳ change detection). Overlay và `style[data-sd-loading-styles]` ở đây là DOM ngoài view, được\n * gỡ lúc destroy injector hoặc từ ngữ cảnh async ngoài Angular, tức không còn flush nào chạy sau đó →\n * node nằm lại trong document vĩnh viễn (overlay z-index 99999 khoá cả trang). Ghi DOM trực tiếp trên\n * `DOCUMENT` giữ append/remove đối xứng và đồng bộ; nhánh SSR đã được `isPlatformBrowser` chặn sẵn.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SdLoadingService {\n private static readonly documentRecords = new WeakMap<Document, SdLoadingDocumentRecord>();\n\n readonly #document: Document;\n readonly #isBrowser: boolean;\n readonly #destroyRef = inject(DestroyRef);\n readonly #handleQueue: SdLoadingHandleState[] = [];\n\n #styleRegistered = false;\n #destroyed = false;\n\n /** Inserted by Angular inject() migration for backwards compatibility. */\n constructor(...args: unknown[]);\n constructor() {\n this.#document = inject(DOCUMENT);\n this.#isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n this.#destroyRef.onDestroy(() => this.#destroy());\n }\n\n /** Starts loading for every current selector match and returns ownership of those exact hosts. */\n start = (selector = 'body'): SdLoadingRef => {\n if (this.#destroyed || !this.#isBrowser) return CLOSED_LOADING_REF;\n\n const hosts = Array.from(this.#document.querySelectorAll(selector));\n if (hosts.length === 0) return CLOSED_LOADING_REF;\n\n const documentRecord = this.#getOrCreateDocumentRecord();\n this.#ensureStyles(documentRecord);\n const state: SdLoadingHandleState = { selector, contributions: [], closed: false };\n for (const host of hosts) {\n const contribution: SdLoadingContribution = {\n host,\n owner: state,\n service: this,\n released: false,\n };\n state.contributions.push(contribution);\n this.#acquireHost(documentRecord, contribution);\n }\n this.#handleQueue.push(state);\n\n return {\n get closed(): boolean {\n return state.closed;\n },\n close: () => this.#closeHandle(state),\n };\n };\n\n /** Returns the first matched globally loading host, `false` for idle matches, or `null` when unavailable. */\n isLoading = (selector = 'body'): Element | false | null => {\n if (this.#destroyed || !this.#isBrowser) return null;\n\n const hosts = this.#document.querySelectorAll(selector);\n if (hosts.length === 0) return null;\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n for (const host of Array.from(hosts)) {\n const state = documentRecord?.hostStates.get(host);\n if (state && state.count > 0 && state.overlay.parentNode === host) return host;\n }\n return false;\n };\n\n /** Releases the oldest exact-selector start, with a current-host fallback for legacy cross-selector calls. */\n stop = (selector = 'body'): void => {\n if (this.#destroyed || !this.#isBrowser) return;\n\n const exactHandle = this.#handleQueue.find(state => !state.closed && state.selector === selector);\n if (exactHandle) {\n this.#closeHandle(exactHandle);\n return;\n }\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n if (!documentRecord) return;\n\n for (const host of Array.from(this.#document.querySelectorAll(selector))) {\n const contribution = documentRecord.hostStates\n .get(host)\n ?.contributions.find(candidate => !candidate.released && candidate.service === this);\n if (contribution) this.#releaseContribution(documentRecord, contribution);\n }\n };\n\n run<T>(task: () => T | PromiseLike<T>, selector?: string): Promise<T>;\n run<T>(task: PromiseLike<T>, selector?: string): Promise<T>;\n /** Runs a task inside a loading lifetime and always releases it without replacing the task result or error. */\n async run<T>(task: (() => T | PromiseLike<T>) | PromiseLike<T>, selector = 'body'): Promise<T> {\n const ref = this.start(selector);\n try {\n const result = typeof task === 'function' ? task() : task;\n return await result;\n } finally {\n ref.close();\n }\n }\n\n #getOrCreateDocumentRecord(): SdLoadingDocumentRecord {\n let record = SdLoadingService.documentRecords.get(this.#document);\n if (!record) {\n record = {\n hostStates: new WeakMap<Element, SdLoadingHostState>(),\n liveHosts: new Set<Element>(),\n style: undefined,\n };\n SdLoadingService.documentRecords.set(this.#document, record);\n }\n return record;\n }\n\n #acquireHost(documentRecord: SdLoadingDocumentRecord, contribution: SdLoadingContribution): void {\n const host = contribution.host;\n const existing = documentRecord.hostStates.get(host);\n if (existing) {\n this.#repairOverlay(host, existing);\n existing.count += 1;\n existing.contributions.push(contribution);\n return;\n }\n\n const state: SdLoadingHostState = {\n overlay: this.#createOverlay(),\n previousAriaBusy: host.getAttribute('aria-busy'),\n contributions: [contribution],\n count: 1,\n };\n host.setAttribute('aria-busy', 'true');\n host.appendChild(state.overlay);\n documentRecord.hostStates.set(host, state);\n documentRecord.liveHosts.add(host);\n }\n\n #repairOverlay(host: Element, state: SdLoadingHostState): void {\n // why: appendChild tự động rút overlay khỏi parent cũ, nên không cần removeChild riêng.\n if (state.overlay.parentNode !== host) host.appendChild(state.overlay);\n if (host.getAttribute('aria-busy') !== 'true') host.setAttribute('aria-busy', 'true');\n }\n\n #releaseContribution(documentRecord: SdLoadingDocumentRecord, contribution: SdLoadingContribution): void {\n if (contribution.released) return;\n contribution.released = true;\n\n const state = documentRecord.hostStates.get(contribution.host);\n if (state) {\n const contributionIndex = state.contributions.indexOf(contribution);\n if (contributionIndex >= 0) state.contributions.splice(contributionIndex, 1);\n state.count -= 1;\n\n if (state.count <= 0) this.#removeHost(documentRecord, contribution.host, state);\n }\n\n contribution.service.#closeOwnerWhenReleased(contribution.owner);\n }\n\n #removeHost(documentRecord: SdLoadingDocumentRecord, host: Element, state: SdLoadingHostState): void {\n state.overlay.remove();\n\n if (host.getAttribute('aria-busy') === 'true') {\n if (state.previousAriaBusy === null) host.removeAttribute('aria-busy');\n else host.setAttribute('aria-busy', state.previousAriaBusy);\n }\n\n documentRecord.hostStates.delete(host);\n documentRecord.liveHosts.delete(host);\n this.#deleteDocumentRecordWhenEmpty(documentRecord);\n }\n\n #closeHandle(state: SdLoadingHandleState): void {\n if (state.closed) return;\n\n state.closed = true;\n this.#dequeueHandle(state);\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n if (documentRecord) {\n for (const contribution of [...state.contributions]) {\n this.#releaseContribution(documentRecord, contribution);\n }\n } else {\n for (const contribution of state.contributions) contribution.released = true;\n }\n state.contributions.length = 0;\n }\n\n #closeOwnerWhenReleased(state: SdLoadingHandleState): void {\n if (state.closed || state.contributions.some(contribution => !contribution.released)) return;\n\n state.closed = true;\n this.#dequeueHandle(state);\n state.contributions.length = 0;\n }\n\n #dequeueHandle(state: SdLoadingHandleState): void {\n const handleIndex = this.#handleQueue.indexOf(state);\n if (handleIndex >= 0) this.#handleQueue.splice(handleIndex, 1);\n }\n\n #createOverlay(): HTMLElement {\n const container = this.#document.createElement('div');\n const spinner = this.#document.createElement('div');\n\n container.classList.add('sd-loading');\n container.setAttribute(SD_LOADING_OVERLAY_ATTRIBUTE, '');\n container.setAttribute('role', 'status');\n container.setAttribute('aria-live', 'polite');\n container.setAttribute('aria-label', 'Loading');\n\n spinner.classList.add('sd-loading-spinner');\n spinner.setAttribute('aria-hidden', 'true');\n container.appendChild(spinner);\n return container;\n }\n\n #ensureStyles(documentRecord: SdLoadingDocumentRecord): void {\n let record = documentRecord.style;\n if (record && !this.#isCurrentStyle(record.element)) {\n const owners = record.owners;\n this.#detachOwnedStyleContent(record);\n record = this.#createStyleRecord(owners);\n documentRecord.style = record;\n } else if (!record) {\n record = this.#createStyleRecord(new Set<SdLoadingService>());\n documentRecord.style = record;\n } else {\n this.#ensureRequiredStyleText(record);\n }\n\n record.owners.add(this);\n this.#styleRegistered = true;\n }\n\n #isCurrentStyle(element: HTMLStyleElement): boolean {\n return element.isConnected && element.parentNode === this.#document.head && element.hasAttribute(SD_LOADING_STYLE_ATTRIBUTE);\n }\n\n #createStyleRecord(owners: Set<SdLoadingService>): SdLoadingStyleRecord {\n const existing = this.#document.head.querySelector<HTMLStyleElement>(`style[${SD_LOADING_STYLE_ATTRIBUTE}]`);\n if (existing) {\n const record: SdLoadingStyleRecord = {\n element: existing,\n libraryOwned: false,\n owners,\n ownedText: null,\n };\n this.#ensureRequiredStyleText(record);\n return record;\n }\n\n const style = this.#document.createElement('style');\n const ownedText = this.#document.createTextNode(SD_LOADING_STYLES);\n style.setAttribute(SD_LOADING_STYLE_ATTRIBUTE, '');\n style.appendChild(ownedText);\n this.#document.head.appendChild(style);\n return { element: style, libraryOwned: true, owners, ownedText };\n }\n\n #ensureRequiredStyleText(record: SdLoadingStyleRecord): void {\n const currentText = record.element.textContent ?? '';\n const hasRequiredRules =\n currentText.includes(`${SD_LOADING_OVERLAY_SELECTOR} {`) &&\n currentText.includes(`${SD_LOADING_SPINNER_SELECTOR} {`) &&\n currentText.includes('@keyframes sd-loading-spin');\n if (hasRequiredRules) return;\n\n if (record.ownedText && record.ownedText.parentNode !== record.element) record.ownedText = null;\n if (!record.ownedText) {\n record.ownedText = this.#document.createTextNode(SD_LOADING_STYLES);\n record.element.appendChild(record.ownedText);\n }\n }\n\n #detachOwnedStyleContent(record: SdLoadingStyleRecord): void {\n if (record.libraryOwned) record.element.remove();\n else record.ownedText?.remove();\n record.ownedText = null;\n }\n\n #destroy(): void {\n if (this.#destroyed) return;\n this.#destroyed = true;\n\n if (this.#isBrowser) {\n for (const state of [...this.#handleQueue]) this.#closeHandle(state);\n this.#unregisterStyles();\n return;\n }\n\n for (const state of this.#handleQueue) {\n state.closed = true;\n state.contributions.length = 0;\n }\n this.#handleQueue.length = 0;\n }\n\n #unregisterStyles(): void {\n if (!this.#styleRegistered) return;\n this.#styleRegistered = false;\n\n const documentRecord = SdLoadingService.documentRecords.get(this.#document);\n const record = documentRecord?.style;\n if (!documentRecord || !record) return;\n\n record.owners.delete(this);\n if (record.owners.size === 0) {\n this.#detachOwnedStyleContent(record);\n documentRecord.style = undefined;\n }\n this.#deleteDocumentRecordWhenEmpty(documentRecord);\n }\n\n #deleteDocumentRecordWhenEmpty(documentRecord: SdLoadingDocumentRecord): void {\n if (documentRecord.liveHosts.size === 0 && !documentRecord.style) {\n SdLoadingService.documentRecords.delete(this.#document);\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAyCA,MAAM,0BAA0B,GAAG,wBAAwB;AAC3D,MAAM,4BAA4B,GAAG,yBAAyB;AAC9D;AACA,MAAM,2BAA2B,GAAG,CAAA,YAAA,EAAe,4BAA4B,GAAG;AAClF,MAAM,2BAA2B,GAAG,CAAA,EAAG,2BAA2B,wBAAwB;AAC1F,MAAM,iBAAiB,GAAG;EACxB,2BAA2B,CAAA;;;;;;;;;;EAU3B,2BAA2B,CAAA;;;;;;;;;;;;;;;;CAgB5B;AAED,MAAM,kBAAkB,GAAiB,MAAM,CAAC,MAAM,CAAC;AACrD,IAAA,MAAM,EAAE,IAAI;IACZ,KAAK,GAAA;;IAEL,CAAC;AACF,CAAA,CAAC;AAEF;;;;;;;;AAQG;MAIU,gBAAgB,CAAA;AACnB,IAAA,OAAgB,eAAe,GAAG,IAAI,OAAO,EAAqC;AAEjF,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;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 @@
1
1
  {
2
2
  "name": "@sdcorejs/angular",
3
- "version": "22.2.7",
3
+ "version": "22.2.8",
4
4
  "description": "Angular component library: data table, query bar/builder, 20+ signal-based form controls, layout, auth and workflow services. Standalone, OnPush, signals-first. Published in parallel lines for Angular 19, 20, 21 and 22.",
5
5
  "keywords": [
6
6
  "angular",
@@ -110,7 +110,6 @@ declare class SdUploadFile<TArgs = unknown> {
110
110
  readonly label: _angular_core.InputSignal<string | undefined>;
111
111
  readonly key: _angular_core.InputSignal<string | undefined>;
112
112
  readonly description: _angular_core.InputSignal<string | undefined>;
113
- readonly appearance: _angular_core.InputSignal<"dropzone" | "compact">;
114
113
  readonly previewWidth: _angular_core.InputSignal<string>;
115
114
  readonly previewHeight: _angular_core.InputSignal<string>;
116
115
  readonly align: _angular_core.InputSignal<"left" | "center">;
@@ -172,7 +171,7 @@ declare class SdUploadFile<TArgs = unknown> {
172
171
  onDownload: (previewFile: PreviewFile) => void;
173
172
  isLastVisibleOverlay(fileIndex: number): boolean;
174
173
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdUploadFile<any>, never>;
175
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdUploadFile<any>, "sd-upload-file", never, { "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; "args": { "alias": "args"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "key": { "alias": "key"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "previewWidth": { "alias": "previewWidth"; "required": false; "isSignal": true; }; "previewHeight": { "alias": "previewHeight"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "uploadInput": { "alias": "upload"; "required": false; "isSignal": true; }; "details": { "alias": "details"; "required": false; "isSignal": true; }; "downloadInput": { "alias": "download"; "required": false; "isSignal": true; }; "imageValidator": { "alias": "imageValidator"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "scaleToPixel": { "alias": "scaleToPixel"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "nameInput": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "helperText": { "alias": "helperText"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "maxOfImage": { "alias": "maxOfImage"; "required": false; "isSignal": true; }; "extensions": { "alias": "extensions"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "filesChanged": "filesChanged"; "model": "modelChange"; }, ["sdLabelDef"], never, true, never>;
174
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdUploadFile<any>, "sd-upload-file", never, { "autoIdInput": { "alias": "autoId"; "required": false; "isSignal": true; }; "args": { "alias": "args"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "key": { "alias": "key"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "previewWidth": { "alias": "previewWidth"; "required": false; "isSignal": true; }; "previewHeight": { "alias": "previewHeight"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; "uploadInput": { "alias": "upload"; "required": false; "isSignal": true; }; "details": { "alias": "details"; "required": false; "isSignal": true; }; "downloadInput": { "alias": "download"; "required": false; "isSignal": true; }; "imageValidator": { "alias": "imageValidator"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "maxWidth": { "alias": "maxWidth"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "scaleToPixel": { "alias": "scaleToPixel"; "required": false; "isSignal": true; }; "form": { "alias": "form"; "required": false; "isSignal": true; }; "nameInput": { "alias": "name"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "helperText": { "alias": "helperText"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "maxOfImage": { "alias": "maxOfImage"; "required": false; "isSignal": true; }; "extensions": { "alias": "extensions"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; "isSignal": true; }; }, { "loaded": "loaded"; "filesChanged": "filesChanged"; "model": "modelChange"; }, ["sdLabelDef"], never, true, never>;
176
175
  }
177
176
 
178
177
  export { SD_UPLOAD_FILE_CONFIGURATION, SdUploadFile };
@@ -406,6 +406,10 @@ interface SdLayoutMenuTreeNode {
406
406
  title: string;
407
407
  depth: number;
408
408
  paddingLeft: number;
409
+ inset: number;
410
+ branchOffsets: number[];
411
+ showIcon: boolean;
412
+ isRoot: boolean;
409
413
  isGroup: boolean;
410
414
  isActive: boolean;
411
415
  isPinned: boolean;
@@ -421,6 +425,10 @@ declare class SdLayoutMenuTreeComponent {
421
425
  pinnedKeys: _angular_core.InputSignal<string[]>;
422
426
  showPin: _angular_core.InputSignal<boolean>;
423
427
  pinVisibility: _angular_core.InputSignal<"hover" | "always">;
428
+ /** V3 hierarchy and flat shortcuts are opt-in; V2/mobile retain the default presentation. */
429
+ presentation: _angular_core.InputSignal<"default" | "hierarchy" | "shortcuts">;
430
+ structured: _angular_core.Signal<boolean>;
431
+ iconFontSet: _angular_core.Signal<"material-icons-outlined" | undefined>;
424
432
  navigate: _angular_core.OutputEmitterRef<SdLayoutRootMenu>;
425
433
  togglePinned: _angular_core.OutputEmitterRef<SdLayoutMenu>;
426
434
  nodes: _angular_core.Signal<SdLayoutMenuTreeNode[]>;
@@ -430,7 +438,7 @@ declare class SdLayoutMenuTreeComponent {
430
438
  onPinHoverStart(key: string): void;
431
439
  onPinHoverEnd(key: string): void;
432
440
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SdLayoutMenuTreeComponent, never>;
433
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdLayoutMenuTreeComponent, "sd-layout-menu-tree", never, { "menus": { "alias": "menus"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "activePath": { "alias": "activePath"; "required": false; "isSignal": true; }; "pinnedKeys": { "alias": "pinnedKeys"; "required": false; "isSignal": true; }; "showPin": { "alias": "showPin"; "required": false; "isSignal": true; }; "pinVisibility": { "alias": "pinVisibility"; "required": false; "isSignal": true; }; }, { "navigate": "navigate"; "togglePinned": "togglePinned"; }, never, never, true, never>;
441
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SdLayoutMenuTreeComponent, "sd-layout-menu-tree", never, { "menus": { "alias": "menus"; "required": false; "isSignal": true; }; "query": { "alias": "query"; "required": false; "isSignal": true; }; "activePath": { "alias": "activePath"; "required": false; "isSignal": true; }; "pinnedKeys": { "alias": "pinnedKeys"; "required": false; "isSignal": true; }; "showPin": { "alias": "showPin"; "required": false; "isSignal": true; }; "pinVisibility": { "alias": "pinVisibility"; "required": false; "isSignal": true; }; "presentation": { "alias": "presentation"; "required": false; "isSignal": true; }; }, { "navigate": "navigate"; "togglePinned": "togglePinned"; }, never, never, true, never>;
434
442
  }
435
443
 
436
444
  declare class SdLayoutUserMenuComponent {