@arsedizioni/ars-utils 22.5.27 → 22.5.30

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.
Files changed (24) hide show
  1. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs +14 -2
  2. package/fesm2022/arsedizioni-ars-utils-clipper.ui.mjs.map +1 -1
  3. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs +358 -115
  4. package/fesm2022/arsedizioni-ars-utils-core.validators.mjs.map +1 -1
  5. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs +18 -12
  6. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.auth.mjs.map +1 -1
  7. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs +5 -2
  8. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.mjs.map +1 -1
  9. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs +23 -8
  10. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.prompt.mjs.map +1 -1
  11. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs +6 -4
  12. package/fesm2022/arsedizioni-ars-utils-ui.dialogs.select.mjs.map +1 -1
  13. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs +8 -12
  14. package/fesm2022/arsedizioni-ars-utils-ui.files.mjs.map +1 -1
  15. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs +2 -2
  16. package/fesm2022/arsedizioni-ars-utils-ui.shell.mjs.map +1 -1
  17. package/package.json +1 -1
  18. package/types/arsedizioni-ars-utils-clipper.ui.d.ts +16 -0
  19. package/types/arsedizioni-ars-utils-core.validators.d.ts +167 -52
  20. package/types/arsedizioni-ars-utils-ui.dialogs.auth.d.ts +7 -0
  21. package/types/arsedizioni-ars-utils-ui.dialogs.d.ts +3 -0
  22. package/types/arsedizioni-ars-utils-ui.dialogs.prompt.d.ts +20 -0
  23. package/types/arsedizioni-ars-utils-ui.dialogs.select.d.ts +3 -0
  24. package/types/arsedizioni-ars-utils-ui.files.d.ts +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"arsedizioni-ars-utils-ui.shell.mjs","sources":["../../../projects/ars-utils/ui.shell/busy-timer.ts","../../../projects/ars-utils/ui.shell/shell-busy/shell-busy.component.ts","../../../projects/ars-utils/ui.shell/shell-busy/shell-busy.component.html","../../../projects/ars-utils/ui.shell/shell-message/shell-message.component.ts","../../../projects/ars-utils/ui.shell/shell-message/shell-message.component.html","../../../projects/ars-utils/ui.shell/shell.service.ts","../../../projects/ars-utils/ui.shell/public_api.ts","../../../projects/ars-utils/ui.shell/arsedizioni-ars-utils-ui.shell.ts"],"sourcesContent":["import { Subscription, timer } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport type { ShellService } from './shell.service';\n\n/**\n * Shows the busy overlay only if the operation is still running after a debounce delay, so that\n * an operation that answers in 30 ms never makes the screen flash.\n *\n * Whoever creates one owns it: {@link clear} must be called when the operation ends, otherwise\n * the overlay appears after the fact and stays.\n */\nexport class BusyTimer {\n private readonly subscription: Subscription;\n\n /**\n * Arms the timer.\n * @param shellService - The service that owns the overlay. A `DialogService` is accepted too,\n * since it extends `ShellService`.\n * @param due - Delay in milliseconds before the overlay appears. Defaults to `100`.\n * @param message - Text to display. Defaults to `'Operazione in corso...'`.\n */\n constructor(\n private readonly shellService: ShellService,\n due: number = 100,\n message: string = 'Operazione in corso...'\n ) {\n this.subscription = timer(due).pipe(tap(() => this.shellService.busy(message))).subscribe();\n }\n\n /**\n * Disarms the timer and takes the overlay away.\n * @returns void\n */\n clear(): void {\n this.subscription.unsubscribe();\n this.shellService.clearBusy();\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { SafeHtmlPipe, ThemeService, ThemeType } from '@arsedizioni/ars-utils/core';\n\n/** Visual style of the busy indicator. */\nexport type ShellBusyType = 'bar' | 'spinner' | 'wait' | 'hourglass';\n\n/** Progress mode of the bar and of the spinner. */\nexport type ShellBusyMode = 'determinate' | 'indeterminate';\n\n/** Circumference of the spinner circle, in user units. Kept here so the template stays arithmetic-free. */\nconst SPINNER_CIRCUMFERENCE = 2 * Math.PI * 31.5;\n\n/**\n * Overlay that blocks interaction while an operation is running, in the four styles the\n * applications use: progress bar, spinner, hourglass and bare wait.\n *\n * Reproduces `mat-progress-bar` and `mat-progress-spinner` in CSS and SVG rather than importing\n * them, because this overlay is shown from the boot path — an HTTP interceptor calls it before\n * any route exists — and `ui.shell` exists precisely so that path costs no Material.\n *\n * The instance is created once by {@link ShellService} and then reused: showing and hiding is a\n * class on the host, never a `createComponent`, so the 40-odd calls a screen costs nothing.\n */\n@Component({\n selector: 'ars-shell-busy',\n templateUrl: './shell-busy.component.html',\n styleUrl: './shell-busy.component.scss',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [SafeHtmlPipe],\n host: { '[class.ars-hidden]': '!visible()', '[class.ars-dark]': 'dark()' }\n})\nexport class ShellBusyComponent {\n\n private readonly themeService = inject(ThemeService);\n\n /**\n * True when the panel must paint itself dark.\n *\n * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not\n * always agree: the service is what the user chose, and it may be forcing dark on a machine\n * that is on light. Following the OS instead would leave this panel the only light thing on a\n * dark screen.\n */\n protected readonly dark = signal(false);\n\n /**\n * Keeps {@link dark} in step with the service, now and at every later change.\n *\n * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the\n * operating system is currently on.\n * @returns void\n */\n private followTheme(): void {\n const resolve = (theme: ThemeType): boolean =>\n (theme === 'auto' ? this.themeService.getTheme() : theme) === 'dark';\n this.dark.set(resolve(this.themeService.getTheme()));\n this.themeService.changed\n .pipe(takeUntilDestroyed())\n .subscribe(theme => this.dark.set(resolve(theme)));\n }\n\n /** Whether the overlay is on screen. Hidden with `display: none`, so it costs no layout. */\n readonly visible = signal(false);\n\n /** Visual style of the indicator. */\n readonly type = signal<ShellBusyType>('bar');\n\n /** Current progress value (0-100), used when {@link progressMode} is `'determinate'`. */\n readonly progress = signal(0);\n\n /** Progress mode of the bar and of the spinner. */\n readonly progressMode = signal<ShellBusyMode>('indeterminate');\n\n /** Message displayed above the indicator. */\n readonly message = signal('');\n\n /** Circumference of the spinner circle, bound to `stroke-dasharray`. */\n protected readonly circumference = SPINNER_CIRCUMFERENCE;\n\n constructor() {\n this.followTheme();\n }\n\n /** Length of the spinner arc still to be drawn, derived from {@link progress}. */\n protected readonly dashOffset = computed(\n () => SPINNER_CIRCUMFERENCE * (1 - Math.min(Math.max(this.progress(), 0), 100) / 100)\n );\n\n /**\n * Updates the overlay state.\n *\n * Same contract as the `BusyDialogComponent` it replaces, down to the two implicit rules that\n * callers rely on: an empty message keeps the previous text (so `wait()` does not wipe it), and\n * a progress above zero forces `'determinate'` whatever the caller passed.\n * @param message - New message to display. An empty string preserves the current one.\n * @param progress - Current progress value (0-100). Above zero it forces determinate mode.\n * @param progressMode - Progress mode to use. Defaults to `'indeterminate'`.\n * @param type - Visual style to use. Defaults to `'bar'`.\n * @returns void\n */\n set(\n message: string,\n progress: number,\n progressMode: ShellBusyMode = 'indeterminate',\n type: ShellBusyType = 'bar'\n ): void {\n if (message) this.message.set(message);\n if (type) this.type.set(type);\n this.progress.set(progress);\n this.progressMode.set(progress > 0 ? 'determinate' : progressMode);\n }\n}\n","<div class=\"scrim\"></div>\n\n@if (type() === 'hourglass' || type() === 'wait') {\n<div class=\"bare\">\n <svg class=\"hourglass\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4zm2 2v3.2l4 4 4-4V4zm0 16h8v-3.2l-4-4-4 4z\" />\n </svg>\n @if (type() === 'hourglass' && message()) {\n <div class=\"message\" [innerHTML]=\"message() | safeHtml\"></div>\n }\n</div>\n} @else {\n<div class=\"panel\" role=\"status\" aria-live=\"polite\">\n @if (message()) {\n <div class=\"message\" [innerHTML]=\"message() | safeHtml\"></div>\n }\n\n @if (type() === 'bar') {\n <div class=\"bar\" [class.indeterminate]=\"progressMode() === 'indeterminate'\">\n <div class=\"bar-fill\" [style.width.%]=\"progressMode() === 'determinate' ? progress() : null\"></div>\n </div>\n } @else if (type() === 'spinner') {\n <svg class=\"spinner\" [class.indeterminate]=\"progressMode() === 'indeterminate'\" viewBox=\"0 0 70 70\"\n aria-hidden=\"true\">\n <circle class=\"track\" cx=\"35\" cy=\"35\" r=\"31.5\"></circle>\n <circle class=\"arc\" cx=\"35\" cy=\"35\" r=\"31.5\" [style.stroke-dasharray]=\"circumference\"\n [style.stroke-dashoffset]=\"progressMode() === 'determinate' ? dashOffset() : null\"></circle>\n </svg>\n }\n\n @if (progress() > 0) {\n <div class=\"percent\"><b>{{ progress() }}%</b></div>\n }\n</div>\n}\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef,\n HostListener, afterNextRender, inject, output, signal, viewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { SafeHtmlPipe, ThemeService, ThemeType } from '@arsedizioni/ars-utils/core';\nimport { ShellMessageData } from '../definitions';\n\n/**\n * The shell's message panel: a modal that looks like a Material dialog and owes nothing to\n * Material.\n *\n * It exists because shell, interceptors, guards and app initializers must be able to say\n * \"the session is gone\" before a single route has been loaded, and paying for `mat-dialog`,\n * `cdk/overlay` and the rest of that stack on the boot path costs the initial bundle more\n * than every route of the application put together. The look is matched through CSS custom\n * properties (`--ars-*` first, Material's `--mat-sys-*` next, a literal last), so an\n * application that themes Material gets the same surface here for free.\n *\n * Instantiated imperatively by {@link ShellService}, never declared in a template: that is\n * what lets an interceptor open it.\n */\n@Component({\n selector: 'ars-shell-message',\n templateUrl: './shell-message.component.html',\n styleUrl: './shell-message.component.scss',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [SafeHtmlPipe],\n host: { '[class.ars-dark]': 'dark()' }\n})\nexport class ShellMessageComponent {\n\n /** Emitted when the user dismisses the message, whichever way they did it. */\n readonly closed = output<void>();\n\n private readonly themeService = inject(ThemeService);\n\n private readonly panel = viewChild.required<ElementRef<HTMLElement>>('panel');\n private readonly okButton = viewChild.required<ElementRef<HTMLButtonElement>>('ok');\n\n /** Unique id tying the panel to its heading for assistive technology. */\n protected readonly titleId = `ars-shell-message-title-${Math.random().toString(36).slice(2, 10)}`;\n\n /** Unique id tying the details panel to the header that opens it. */\n protected readonly detailsId = `ars-shell-message-details-${Math.random().toString(36).slice(2, 10)}`;\n\n /**\n * Whether the technical details are open.\n *\n * Closed on arrival, and closed again by every {@link setData}: the message is what the user is\n * meant to read, and a stack trace unfolded under it is noise until they ask for it.\n */\n protected readonly detailsOpen = signal(false);\n\n /** Current content, with the defaults the shell relies on already applied. */\n protected readonly data = signal<ShellMessageData>({ message: '', title: 'Informazioni', okCaption: 'Ok', width: 500 });\n\n /** True for a moment after a successful copy, so the button can acknowledge it. */\n protected readonly copied = signal(false);\n\n private dismissTimer?: ReturnType<typeof setTimeout>;\n private copiedTimer?: ReturnType<typeof setTimeout>;\n private closing = false;\n\n /**\n * True when the panel must paint itself dark.\n *\n * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not\n * always agree: the service is what the user chose, and it may be forcing dark on a machine\n * that is on light. Following the OS instead would leave this panel the only light thing on a\n * dark screen.\n */\n protected readonly dark = signal(false);\n\n /**\n * Keeps {@link dark} in step with the service, now and at every later change.\n *\n * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the\n * operating system is currently on.\n * @returns void\n */\n private followTheme(): void {\n const resolve = (theme: ThemeType): boolean =>\n (theme === 'auto' ? this.themeService.getTheme() : theme) === 'dark';\n this.dark.set(resolve(this.themeService.getTheme()));\n this.themeService.changed\n .pipe(takeUntilDestroyed())\n .subscribe(theme => this.dark.set(resolve(theme)));\n }\n\n constructor() {\n this.followTheme();\n afterNextRender(() => this.okButton().nativeElement.focus());\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.dismissTimer);\n clearTimeout(this.copiedTimer);\n });\n }\n\n /**\n * Replaces the content shown by the panel and restarts the auto-dismiss timer.\n *\n * Called on an already open panel by `ShellService.error()` so that a burst of failures\n * updates one message instead of stacking modals nobody can dismiss.\n * @param data - The new content to display.\n * @returns void\n */\n setData(data: ShellMessageData): void {\n this.data.set({ title: 'Informazioni', okCaption: 'Ok', width: 500, ...data });\n this.detailsOpen.set(false);\n this.scheduleDismiss(this.data().dismissAfter);\n }\n\n /**\n * Opens or closes the technical details panel.\n * @returns void\n */\n protected toggleDetails(): void {\n this.detailsOpen.update(open => !open);\n }\n\n /**\n * Dismisses the panel. Safe to call more than once: only the first call is announced.\n * @returns void\n */\n close(): void {\n if (this.closing) return;\n this.closing = true;\n clearTimeout(this.dismissTimer);\n this.closed.emit();\n }\n\n /**\n * Closes the panel on Escape, mirroring a Material dialog opened with the default config.\n * @param e - The keyboard event captured at document level.\n * @returns void\n */\n @HostListener('document:keydown', ['$event'])\n protected onKeydown(e: KeyboardEvent): void {\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n return;\n }\n if (e.key === 'Tab') this.trapFocus(e);\n }\n\n /**\n * Keeps Tab inside the panel while the message is up.\n *\n * A hand-rolled two-element version of what `cdk/a11y` does, which is all this panel needs:\n * it never holds more than the copy button and the dismiss button.\n * @param e - The Tab keydown event.\n * @returns void\n */\n private trapFocus(e: KeyboardEvent): void {\n const focusable = Array.from(\n this.panel().nativeElement.querySelectorAll<HTMLElement>('button:not([disabled]), [href], [tabindex]:not([tabindex=\"-1\"])')\n );\n if (!focusable.length) return;\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n\n if (e.shiftKey && (active === first || !this.panel().nativeElement.contains(active))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n }\n\n /**\n * (Re)schedules the auto-dismiss timer, cancelling any pending one so a timer armed for an\n * earlier message can never close a newer one.\n * @param dismissAfter - Delay in milliseconds; no-op when falsy.\n * @returns void\n */\n private scheduleDismiss(dismissAfter?: number): void {\n clearTimeout(this.dismissTimer);\n this.dismissTimer = undefined;\n if (dismissAfter) this.dismissTimer = setTimeout(() => this.close(), dismissAfter);\n }\n\n /**\n * Copies the message and its details to the clipboard, as both HTML and plain text.\n *\n * Unlike `InfoDialogComponent` there is no toast to report the outcome — the shell has no\n * toast — so the button itself acknowledges it for a moment.\n * @returns A promise that resolves once the copy has been attempted.\n */\n protected async copy(): Promise<void> {\n const content = this.panel().nativeElement.querySelector<HTMLElement>('.content');\n if (!content) return;\n try {\n await navigator.clipboard.write([\n new ClipboardItem({\n 'text/html': new Blob([content.innerHTML], { type: 'text/html' }),\n 'text/plain': new Blob([content.innerText], { type: 'text/plain' })\n })\n ]);\n this.copied.set(true);\n clearTimeout(this.copiedTimer);\n this.copiedTimer = setTimeout(() => this.copied.set(false), 1500);\n } catch {\n // Clipboard permission denied or the document is not focused: nothing worth interrupting\n // the user for, and the text is on screen anyway.\n }\n }\n}\n","<div class=\"scrim\" (click)=\"close()\"></div>\n\n<div #panel class=\"panel\" role=\"alertdialog\" aria-modal=\"true\" [attr.aria-labelledby]=\"titleId\"\n [style.max-width.px]=\"data().width\">\n\n <h2 class=\"title\" [id]=\"titleId\" [innerHTML]=\"data().title | safeHtml\"></h2>\n\n <div class=\"content\">\n @if (data().message) {\n <div class=\"message\" [innerHTML]=\"data().message | safeHtml\"></div>\n }\n @if (data().details) {\n <div class=\"details-box\" [class.open]=\"detailsOpen()\">\n <button type=\"button\" class=\"details-header\" (click)=\"toggleDetails()\"\n [attr.aria-expanded]=\"detailsOpen()\" [attr.aria-controls]=\"detailsId\">\n <span class=\"details-label\">Dettaglio</span>\n <svg class=\"chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z\" />\n </svg>\n </button>\n <div class=\"details-body\">\n <div class=\"details\" [id]=\"detailsId\" [attr.aria-hidden]=\"!detailsOpen()\">\n <div class=\"details-text\" [innerHTML]=\"data().details | safeHtml\"></div>\n </div>\n </div>\n </div>\n }\n </div>\n\n <div class=\"actions\">\n <button type=\"button\" class=\"icon-button\" (click)=\"copy()\"\n [title]=\"copied() ? 'Copiato negli appunti' : 'Copia negli appunti'\" aria-label=\"Copia negli appunti\">\n @if (copied()) {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z\" /></svg>\n } @else {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path\n d=\"M16 1H4a2 2 0 0 0-2 2v14h2V3h12zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m0 16H8V7h11z\" /></svg>\n }\n </button>\n <button #ok type=\"button\" class=\"flat-button\" (click)=\"close()\">{{ data().okCaption }}</button>\n </div>\n</div>\n","import { ApplicationRef, ComponentRef, EnvironmentInjector, Service, createComponent, inject } from '@angular/core';\nimport { SystemUtils } from '@arsedizioni/ars-utils/core';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { first } from 'rxjs/operators';\nimport { BusyTimer } from './busy-timer';\nimport { ShellMessageData, ShellMessageRef } from './definitions';\nimport { ShellBusyComponent, ShellBusyMode, ShellBusyType } from './shell-busy/shell-busy.component';\nimport { ShellMessageComponent } from './shell-message/shell-message.component';\n\n/** Grace period before the busy overlay is actually taken away, in milliseconds. */\nconst CLEAR_BUSY_GRACE = 500;\n\n/**\n * Everything the application can say to the user without asking anything back: a message, an\n * error, and the wait overlay. No Angular Material behind any of it.\n *\n * `DialogService` extends this class, so a route component injects `DialogService` and has both\n * halves; shell, HTTP interceptors, route guards and app initializers inject `ShellService` and\n * pay for neither `mat-dialog` nor `cdk/overlay` on the boot path — measured at 445 KB of the\n * 905 KB initial bundle on myARS, more than every route of the application put together.\n *\n * The methods keep the parameter order of the `DialogService` ones they came from, so no call\n * site changed when they moved here.\n *\n * ## Stacking\n *\n * Since Angular CDK 22 every overlay is opened as `popover=\"manual\"`, so a Material dialog is not\n * at z-index 1000 any more: it is in the browser top layer, which is painted above the whole\n * document whatever the z-index of the document says. A number, however large, cannot get above\n * it — so these overlays are promoted to the top layer as well, and the order there is the order\n * of promotion: whatever went up last is on top.\n *\n * That gives the right answer by itself in the case that matters, an error raised while a dialog\n * is open. The other three are arranged explicitly: `setBusy()` puts the message back on top\n * after raising the busy overlay, `DialogService.open()` calls {@link raiseMessage} after opening\n * a dialog, and it also takes the busy away immediately rather than with the grace period, so a\n * dialog is never drawn under an overlay that is on its way out.\n *\n * The `--ars-shell-dialog-z-index` / `--ars-shell-busy-z-index` pair (1100 / 1090, above the CDK's 1000) is\n * still there and still correct: it is what orders the overlays on a browser without the Popover\n * API, where the CDK does not use it either.\n */\n@Service()\nexport class ShellService {\n\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n\n private messageRef?: ComponentRef<ShellMessageComponent>;\n private messageKind?: 'info' | 'error';\n private messageClosed?: Subject<void>;\n private previousOverflow?: string;\n private previouslyFocused?: HTMLElement;\n\n private busyRef?: ComponentRef<ShellBusyComponent>;\n private busyVisible = false;\n private busyActionSubscription?: Subscription;\n private clearBusyTimer?: ReturnType<typeof setTimeout>;\n\n /** Cached answer of {@link supportsTopLayer}, resolved the first time an overlay is shown. */\n private topLayerSupport?: boolean;\n\n // ---------------------------------------------------------------------------\n // Messages\n // ---------------------------------------------------------------------------\n\n /**\n * Shows an informational message.\n * @param message - HTML message to display.\n * @param title - Heading. Defaults to `'Informazioni'`.\n * @param okCaption - Dismiss button label. Defaults to `'Ok'`.\n * @param width - Maximum panel width in pixels. Defaults to `500`.\n * @param dismissAfter - Auto-close delay in milliseconds (optional).\n * @param details - Optional secondary details text.\n * @returns A handle over the open message, or `null` outside the browser.\n */\n info(\n message: string,\n title: string = 'Informazioni',\n okCaption: string = 'Ok',\n width: number = 500,\n dismissAfter?: number,\n details?: string\n ): ShellMessageRef | null {\n this.clearBusy();\n return this.showMessage('info', { message, title, okCaption, width, dismissAfter, details });\n }\n\n /**\n * Shows an error message. When one is already on screen its content is replaced in place: a\n * failing API answers many requests at once, and each of them must not add a panel of its own.\n * @param message - HTML error message to display.\n * @param log - Optional technical log or stack trace shown in the details panel.\n * @param title - Heading. Defaults to `'Errore'`.\n * @param okCaption - Dismiss button label. Defaults to `'Ok'`.\n * @param width - Maximum panel width in pixels. Defaults to `500`.\n * @param dismissAfter - Auto-close delay in milliseconds (optional).\n * @returns A handle over the open message, or `null` outside the browser.\n */\n error(\n message: string,\n log?: string,\n title: string = 'Errore',\n okCaption: string = 'Ok',\n width: number = 500,\n dismissAfter?: number\n ): ShellMessageRef | null {\n this.clearBusy();\n return this.showMessage('error', { message, title, okCaption, width, dismissAfter, details: log });\n }\n\n /**\n * Closes the message currently on screen, if any. Does not touch the busy overlay.\n * @returns void\n */\n closeMessage(): void {\n if (!this.messageRef) return;\n\n const ref = this.messageRef;\n this.messageRef = undefined;\n this.messageKind = undefined;\n\n this.leaveTopLayer(ref.location.nativeElement as HTMLElement);\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n\n if (this.previousOverflow !== undefined) {\n document.body.style.overflow = this.previousOverflow;\n this.previousOverflow = undefined;\n }\n this.previouslyFocused?.focus();\n this.previouslyFocused = undefined;\n\n // Last, so that whoever is waiting on it finds the screen already in its final state.\n const closed = this.messageClosed;\n this.messageClosed = undefined;\n closed?.next();\n closed?.complete();\n }\n\n /**\n * Opens the message panel, or updates the one already open when it is showing the same kind of\n * message.\n * @param kind - Whether this is an informational or an error message.\n * @param data - The content to display.\n * @returns A handle over the open message, or `null` outside the browser.\n */\n private showMessage(kind: 'info' | 'error', data: ShellMessageData): ShellMessageRef | null {\n if (!SystemUtils.isBrowser()) return null;\n\n if (this.messageRef && this.messageKind === kind) {\n this.messageRef.instance.setData(data);\n this.messageRef.changeDetectorRef.detectChanges();\n // Back to the front: a dialog may have been opened since this panel went up, and the top\n // layer orders by promotion, not by z-index.\n this.raiseTopLayer(this.messageRef.location.nativeElement as HTMLElement);\n return this.messageHandle();\n }\n\n // A message of a different kind replaces the one on screen rather than stacking on it.\n this.closeMessage();\n\n const ref = createComponent(ShellMessageComponent, { environmentInjector: this.environmentInjector });\n ref.instance.setData(data);\n ref.instance.closed.subscribe(() => this.closeMessage());\n\n // One subject per panel, not per handle: an `error()` that replaces the text of the message\n // already on screen hands out a second handle, and both must fire when that message goes.\n this.messageClosed = new Subject<void>();\n\n this.previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : undefined;\n this.previousOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n this.appRef.attachView(ref.hostView);\n document.body.appendChild(ref.location.nativeElement as HTMLElement);\n this.enterTopLayer(ref.location.nativeElement as HTMLElement);\n\n this.messageRef = ref;\n this.messageKind = kind;\n return this.messageHandle();\n }\n\n /**\n * Builds the handle returned to callers.\n *\n * The subject is captured now rather than read at call time, so `afterClosed()` keeps\n * answering about the message this handle was given for, even once another one has taken\n * its place on screen.\n * @returns The handle over the message currently on screen.\n */\n private messageHandle(): ShellMessageRef {\n const closed = this.messageClosed!;\n return {\n close: () => this.closeMessage(),\n afterClosed: () => closed.asObservable()\n };\n }\n\n // ---------------------------------------------------------------------------\n // Busy overlay\n // ---------------------------------------------------------------------------\n\n /**\n * Shows or updates the busy overlay.\n *\n * Called dozens of times per screen, so it creates nothing after the first time: the component\n * is built once and then kept, and showing it again is a class on the host element. The state\n * is written to signals and checked synchronously before returning, so the message on screen is\n * always the last one asked for — a second `busy()` in the same task never leaves the previous\n * text behind.\n * @param message - Text to display. An empty string keeps the current one.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param type - Visual style of the overlay. Defaults to `'bar'`.\n * @param action - Optional observable; the overlay is dismissed when it first emits. It\n * replaces the one passed to a previous call, which is unsubscribed.\n * @returns `true` if the overlay was brought up by this call, `false` if it was already up.\n */\n setBusy(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n type: ShellBusyType = 'bar',\n action?: Observable<unknown>\n ): boolean {\n if (!SystemUtils.isBrowser()) return false;\n\n // Cancel any pending clearBusy(): it must never take away an overlay just asked for.\n clearTimeout(this.clearBusyTimer);\n this.clearBusyTimer = undefined;\n\n const created = !this.busyVisible;\n const ref = this.ensureBusy();\n ref.instance.set(message, progress, progressMode, type);\n ref.instance.visible.set(true);\n this.busyVisible = true;\n ref.changeDetectorRef.detectChanges();\n this.enterTopLayer(ref.location.nativeElement as HTMLElement);\n\n // The overlay has just been promoted, so it is the topmost element of the top layer: put the\n // message back above it, which is what the 1100/1090 pair used to do on its own.\n this.raiseMessage();\n\n // The action always replaces the previous one. Keeping the first, as the previous\n // implementation did, meant the overlay outlived the operation that was actually running.\n this.busyActionSubscription?.unsubscribe();\n this.busyActionSubscription = action?.pipe(first()).subscribe(() => this.clearBusy());\n\n return created;\n }\n\n /**\n * Shows or updates the busy overlay using the progress-bar style.\n * @param message - Text to display inside the overlay.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busy(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n action?: Observable<unknown>\n ): boolean {\n return this.setBusy(message, progress, progressMode, 'bar', action);\n }\n\n /**\n * Shows or updates the busy overlay using the spinner style.\n * @param message - Text to display inside the overlay.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busySpinner(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n action?: Observable<unknown>\n ): boolean {\n return this.setBusy(message, progress, progressMode, 'spinner', action);\n }\n\n /**\n * Shows or updates the busy overlay using the hourglass style.\n * @param message - Text to display inside the overlay.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busyHourglass(message: string, action?: Observable<unknown>): boolean {\n return this.setBusy(message, -1, 'indeterminate', 'hourglass', action);\n }\n\n /**\n * Shows a bare wait indicator, with no panel and no message.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n wait(action?: Observable<unknown>): boolean {\n return this.setBusy('', -1, 'indeterminate', 'wait', action);\n }\n\n /**\n * Returns a {@link BusyTimer} that brings the overlay up only if the operation is still running\n * after a debounce delay.\n * @param message - Text to display. Defaults to `'Operazione in corso...'`.\n * @param due - Delay in milliseconds before the overlay appears. Defaults to `100`.\n * @returns A timer that must be disposed with `clear()` when the operation ends.\n */\n busyTimer(message: string = 'Operazione in corso...', due: number = 100): BusyTimer {\n return new BusyTimer(this, due, message);\n }\n\n /**\n * Takes the busy overlay away.\n *\n * By default it waits a short grace period, so that a chain of quick operations does not make\n * the overlay blink between one and the next; any `setBusy()` in the meantime cancels the\n * pending removal. Pass `true` when something is about to be drawn underneath it and the wait\n * would be visible — that is what `DialogService.open()` does.\n * @param immediate - When `true`, removes the overlay without waiting for the grace period.\n * @returns void\n */\n clearBusy(immediate: boolean = false): void {\n clearTimeout(this.clearBusyTimer);\n this.clearBusyTimer = undefined;\n\n if (immediate) {\n this.hideBusy();\n return;\n }\n this.clearBusyTimer = setTimeout(() => {\n this.clearBusyTimer = undefined;\n this.hideBusy();\n }, CLEAR_BUSY_GRACE);\n }\n\n /**\n * Hides the busy overlay without destroying it, so the next call can reuse the instance.\n * @returns void\n */\n private hideBusy(): void {\n this.busyActionSubscription?.unsubscribe();\n this.busyActionSubscription = undefined;\n if (!this.busyVisible) return;\n this.busyVisible = false;\n this.busyRef?.instance.visible.set(false);\n this.busyRef?.changeDetectorRef.detectChanges();\n this.leaveTopLayer(this.busyRef?.location.nativeElement as HTMLElement | undefined);\n }\n\n /**\n * Returns the busy component, creating and attaching it the first time it is needed.\n * @returns The reused busy component reference.\n */\n private ensureBusy(): ComponentRef<ShellBusyComponent> {\n if (this.busyRef) return this.busyRef;\n\n const ref = createComponent(ShellBusyComponent, { environmentInjector: this.environmentInjector });\n this.appRef.attachView(ref.hostView);\n document.body.appendChild(ref.location.nativeElement as HTMLElement);\n this.busyRef = ref;\n return ref;\n }\n\n // ---------------------------------------------------------------------------\n // Top layer\n // ---------------------------------------------------------------------------\n\n /**\n * Brings the message currently on screen back to the front of the top layer, if there is one.\n *\n * Called by `DialogService` after opening a dialog: an error the user has not dismissed yet\n * must stay above whatever is opened underneath it.\n * @returns void\n */\n raiseMessage(): void {\n this.raiseTopLayer(this.messageRef?.location.nativeElement as HTMLElement | undefined);\n }\n\n /**\n * Whether the browser can promote an element to the top layer through the Popover API.\n *\n * Angular CDK 22 opens every overlay as `popover=\"manual\"`, so a Material dialog does not sit\n * at z-index 1000 any more: it sits in the top layer, which is painted above the whole page\n * whatever the z-index of the page says. The only way to put something above it is to be in\n * the top layer too. Where the API is missing the overlays fall back to their z-index, which\n * is also the CDK's own fallback and therefore still the right order.\n * @returns `true` when `showPopover()` is available.\n */\n private supportsTopLayer(): boolean {\n if (this.topLayerSupport === undefined) {\n this.topLayerSupport = SystemUtils.isBrowser()\n && typeof HTMLElement !== 'undefined'\n && 'showPopover' in HTMLElement.prototype;\n }\n return this.topLayerSupport;\n }\n\n /**\n * Promotes an overlay to the top layer, marking it as a manual popover the first time.\n *\n * `manual` and not `auto`: an `auto` popover is light-dismissed by a click anywhere and closed\n * by Escape without telling anyone, which would take the panel off the screen behind the back\n * of the component that owns it.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private enterTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n if (el.getAttribute('popover') !== 'manual') el.setAttribute('popover', 'manual');\n // Throws if the element is already showing, or is not connected yet.\n try { if (!el.matches(':popover-open')) el.showPopover(); } catch { /* already up */ }\n }\n\n /**\n * Takes an overlay out of the top layer.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private leaveTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n try { if (el.matches(':popover-open')) el.hidePopover(); } catch { /* already down */ }\n }\n\n /**\n * Moves an overlay back to the front of the top layer.\n *\n * The top layer is a stack ordered by promotion, so the only way to raise an element already\n * in it is to take it out and put it back.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private raiseTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n if (!el.matches(':popover-open')) {\n this.enterTopLayer(el);\n return;\n }\n try {\n el.hidePopover();\n el.showPopover();\n } catch { /* the element is on its way out */ }\n }\n}\n","/*\n * Public API Surface of @arsedizioni/ars-utils/ui.shell\n */\nexport * from './definitions';\nexport * from './busy-timer';\nexport * from './shell.service';\nexport * from './shell-message/shell-message.component';\nexport * from './shell-busy/shell-busy.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAIA;;;;;;AAMG;MACU,SAAS,CAAA;AAGpB;;;;;;AAMG;AACH,IAAA,WAAA,CACmB,YAA0B,EAC3C,GAAA,GAAc,GAAG,EACjB,UAAkB,wBAAwB,EAAA;QAFzB,IAAA,CAAA,YAAY,GAAZ,YAAY;AAI7B,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;IAC7F;AAEA;;;AAGG;IACH,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;AAC/B,QAAA,IAAI,CAAC,YAAY,CAAC,SAAS,EAA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"}
1
+ {"version":3,"file":"arsedizioni-ars-utils-ui.shell.mjs","sources":["../../../projects/ars-utils/ui.shell/busy-timer.ts","../../../projects/ars-utils/ui.shell/shell-busy/shell-busy.component.ts","../../../projects/ars-utils/ui.shell/shell-busy/shell-busy.component.html","../../../projects/ars-utils/ui.shell/shell-message/shell-message.component.ts","../../../projects/ars-utils/ui.shell/shell-message/shell-message.component.html","../../../projects/ars-utils/ui.shell/shell.service.ts","../../../projects/ars-utils/ui.shell/public_api.ts","../../../projects/ars-utils/ui.shell/arsedizioni-ars-utils-ui.shell.ts"],"sourcesContent":["import { Subscription, timer } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport type { ShellService } from './shell.service';\n\n/**\n * Shows the busy overlay only if the operation is still running after a debounce delay, so that\n * an operation that answers in 30 ms never makes the screen flash.\n *\n * Whoever creates one owns it: {@link clear} must be called when the operation ends, otherwise\n * the overlay appears after the fact and stays.\n */\nexport class BusyTimer {\n private readonly subscription: Subscription;\n\n /**\n * Arms the timer.\n * @param shellService - The service that owns the overlay. A `DialogService` is accepted too,\n * since it extends `ShellService`.\n * @param due - Delay in milliseconds before the overlay appears. Defaults to `100`.\n * @param message - Text to display. Defaults to `'Operazione in corso...'`.\n */\n constructor(\n private readonly shellService: ShellService,\n due: number = 100,\n message: string = 'Operazione in corso...'\n ) {\n this.subscription = timer(due).pipe(tap(() => this.shellService.busy(message))).subscribe();\n }\n\n /**\n * Disarms the timer and takes the overlay away.\n * @returns void\n */\n clear(): void {\n this.subscription.unsubscribe();\n this.shellService.clearBusy();\n }\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { SafeHtmlPipe, ThemeService, ThemeType } from '@arsedizioni/ars-utils/core';\n\n/** Visual style of the busy indicator. */\nexport type ShellBusyType = 'bar' | 'spinner' | 'wait' | 'hourglass';\n\n/** Progress mode of the bar and of the spinner. */\nexport type ShellBusyMode = 'determinate' | 'indeterminate';\n\n/** Circumference of the spinner circle, in user units. Kept here so the template stays arithmetic-free. */\nconst SPINNER_CIRCUMFERENCE = 2 * Math.PI * 31.5;\n\n/**\n * Overlay that blocks interaction while an operation is running, in the four styles the\n * applications use: progress bar, spinner, hourglass and bare wait.\n *\n * Reproduces `mat-progress-bar` and `mat-progress-spinner` in CSS and SVG rather than importing\n * them, because this overlay is shown from the boot path — an HTTP interceptor calls it before\n * any route exists — and `ui.shell` exists precisely so that path costs no Material.\n *\n * The instance is created once by {@link ShellService} and then reused: showing and hiding is a\n * class on the host, never a `createComponent`, so the 40-odd calls a screen costs nothing.\n */\n@Component({\n selector: 'ars-shell-busy',\n templateUrl: './shell-busy.component.html',\n styleUrl: './shell-busy.component.scss',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [SafeHtmlPipe],\n host: { '[class.ars-hidden]': '!visible()', '[class.ars-dark]': 'dark()' }\n})\nexport class ShellBusyComponent {\n\n private readonly themeService = inject(ThemeService);\n\n /**\n * True when the panel must paint itself dark.\n *\n * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not\n * always agree: the service is what the user chose, and it may be forcing dark on a machine\n * that is on light. Following the OS instead would leave this panel the only light thing on a\n * dark screen.\n */\n protected readonly dark = signal(false);\n\n /**\n * Keeps {@link dark} in step with the service, now and at every later change.\n *\n * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the\n * operating system is currently on.\n * @returns void\n */\n private followTheme(): void {\n const resolve = (theme: ThemeType): boolean =>\n (theme === 'auto' ? this.themeService.getTheme() : theme) === 'dark';\n this.dark.set(resolve(this.themeService.getTheme()));\n this.themeService.changed\n .pipe(takeUntilDestroyed())\n .subscribe(theme => this.dark.set(resolve(theme)));\n }\n\n /** Whether the overlay is on screen. Hidden with `display: none`, so it costs no layout. */\n readonly visible = signal(false);\n\n /** Visual style of the indicator. */\n readonly type = signal<ShellBusyType>('bar');\n\n /** Current progress value (0-100), used when {@link progressMode} is `'determinate'`. */\n readonly progress = signal(0);\n\n /** Progress mode of the bar and of the spinner. */\n readonly progressMode = signal<ShellBusyMode>('indeterminate');\n\n /** Message displayed above the indicator. */\n readonly message = signal('');\n\n /** Circumference of the spinner circle, bound to `stroke-dasharray`. */\n protected readonly circumference = SPINNER_CIRCUMFERENCE;\n\n constructor() {\n this.followTheme();\n }\n\n /** Length of the spinner arc still to be drawn, derived from {@link progress}. */\n protected readonly dashOffset = computed(\n () => SPINNER_CIRCUMFERENCE * (1 - Math.min(Math.max(this.progress(), 0), 100) / 100)\n );\n\n /**\n * Updates the overlay state.\n *\n * Same contract as the `BusyDialogComponent` it replaces, down to the two implicit rules that\n * callers rely on: an empty message keeps the previous text (so `wait()` does not wipe it), and\n * a progress above zero forces `'determinate'` whatever the caller passed.\n * @param message - New message to display. An empty string preserves the current one.\n * @param progress - Current progress value (0-100). Above zero it forces determinate mode.\n * @param progressMode - Progress mode to use. Defaults to `'indeterminate'`.\n * @param type - Visual style to use. Defaults to `'bar'`.\n * @returns void\n */\n set(\n message: string,\n progress: number,\n progressMode: ShellBusyMode = 'indeterminate',\n type: ShellBusyType = 'bar'\n ): void {\n if (message) this.message.set(message);\n if (type) this.type.set(type);\n this.progress.set(progress);\n this.progressMode.set(progress > 0 ? 'determinate' : progressMode);\n }\n}\n","<div class=\"scrim\"></div>\n\n@if (type() === 'hourglass' || type() === 'wait') {\n<div class=\"bare\">\n <svg class=\"hourglass\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M6 2h12v6l-4 4 4 4v6H6v-6l4-4-4-4zm2 2v3.2l4 4 4-4V4zm0 16h8v-3.2l-4-4-4 4z\" />\n </svg>\n @if (type() === 'hourglass' && message()) {\n <div class=\"message\" [innerHTML]=\"message() | safeHtml\"></div>\n }\n</div>\n} @else {\n<div class=\"panel\" role=\"status\" aria-live=\"polite\">\n @if (message()) {\n <div class=\"message\" [innerHTML]=\"message() | safeHtml\"></div>\n }\n\n @if (type() === 'bar') {\n <div class=\"bar\" [class.indeterminate]=\"progressMode() === 'indeterminate'\">\n <div class=\"bar-fill\" [style.width.%]=\"progressMode() === 'determinate' ? progress() : null\"></div>\n </div>\n } @else if (type() === 'spinner') {\n <svg class=\"spinner\" [class.indeterminate]=\"progressMode() === 'indeterminate'\" viewBox=\"0 0 70 70\"\n aria-hidden=\"true\">\n <circle class=\"track\" cx=\"35\" cy=\"35\" r=\"31.5\"></circle>\n <circle class=\"arc\" cx=\"35\" cy=\"35\" r=\"31.5\" [style.stroke-dasharray]=\"circumference\"\n [style.stroke-dashoffset]=\"progressMode() === 'determinate' ? dashOffset() : null\"></circle>\n </svg>\n }\n\n @if (progress() > 0) {\n <div class=\"percent\"><b>{{ progress() }}%</b></div>\n }\n</div>\n}\n","import {\n ChangeDetectionStrategy, Component, DestroyRef, ElementRef,\n HostListener, afterNextRender, inject, output, signal, viewChild\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { SafeHtmlPipe, ThemeService, ThemeType } from '@arsedizioni/ars-utils/core';\nimport { ShellMessageData } from '../definitions';\n\n/**\n * The shell's message panel: a modal that looks like a Material dialog and owes nothing to\n * Material.\n *\n * It exists because shell, interceptors, guards and app initializers must be able to say\n * \"the session is gone\" before a single route has been loaded, and paying for `mat-dialog`,\n * `cdk/overlay` and the rest of that stack on the boot path costs the initial bundle more\n * than every route of the application put together. The look is matched through CSS custom\n * properties (`--ars-*` first, Material's `--mat-sys-*` next, a literal last), so an\n * application that themes Material gets the same surface here for free.\n *\n * Instantiated imperatively by {@link ShellService}, never declared in a template: that is\n * what lets an interceptor open it.\n */\n@Component({\n selector: 'ars-shell-message',\n templateUrl: './shell-message.component.html',\n styleUrl: './shell-message.component.scss',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [SafeHtmlPipe],\n host: { '[class.ars-dark]': 'dark()' }\n})\nexport class ShellMessageComponent {\n\n /** Emitted when the user dismisses the message, whichever way they did it. */\n readonly closed = output<void>();\n\n private readonly themeService = inject(ThemeService);\n\n private readonly panel = viewChild.required<ElementRef<HTMLElement>>('panel');\n private readonly okButton = viewChild.required<ElementRef<HTMLButtonElement>>('ok');\n\n /** Unique id tying the panel to its heading for assistive technology. */\n protected readonly titleId = `ars-shell-message-title-${Math.random().toString(36).slice(2, 10)}`;\n\n /** Unique id tying the details panel to the header that opens it. */\n protected readonly detailsId = `ars-shell-message-details-${Math.random().toString(36).slice(2, 10)}`;\n\n /**\n * Whether the technical details are open.\n *\n * Closed on arrival, and closed again by every {@link setData}: the message is what the user is\n * meant to read, and a stack trace unfolded under it is noise until they ask for it.\n */\n protected readonly detailsOpen = signal(false);\n\n /** Current content, with the defaults the shell relies on already applied. */\n protected readonly data = signal<ShellMessageData>({ message: '', title: 'Informazioni', okCaption: 'Ok', width: 500 });\n\n /** True for a moment after a successful copy, so the button can acknowledge it. */\n protected readonly copied = signal(false);\n\n private dismissTimer?: ReturnType<typeof setTimeout>;\n private copiedTimer?: ReturnType<typeof setTimeout>;\n private closing = false;\n\n /**\n * True when the panel must paint itself dark.\n *\n * Read from {@link ThemeService} and not from `prefers-color-scheme`, because the two do not\n * always agree: the service is what the user chose, and it may be forcing dark on a machine\n * that is on light. Following the OS instead would leave this panel the only light thing on a\n * dark screen.\n */\n protected readonly dark = signal(false);\n\n /**\n * Keeps {@link dark} in step with the service, now and at every later change.\n *\n * `'auto'` is resolved through `getTheme()`, which is the only thing that knows what the\n * operating system is currently on.\n * @returns void\n */\n private followTheme(): void {\n const resolve = (theme: ThemeType): boolean =>\n (theme === 'auto' ? this.themeService.getTheme() : theme) === 'dark';\n this.dark.set(resolve(this.themeService.getTheme()));\n this.themeService.changed\n .pipe(takeUntilDestroyed())\n .subscribe(theme => this.dark.set(resolve(theme)));\n }\n\n constructor() {\n this.followTheme();\n afterNextRender(() => this.okButton().nativeElement.focus());\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.dismissTimer);\n clearTimeout(this.copiedTimer);\n });\n }\n\n /**\n * Replaces the content shown by the panel and restarts the auto-dismiss timer.\n *\n * Called on an already open panel by `ShellService.error()` so that a burst of failures\n * updates one message instead of stacking modals nobody can dismiss.\n * @param data - The new content to display.\n * @returns void\n */\n setData(data: ShellMessageData): void {\n this.data.set({ title: 'Informazioni', okCaption: 'Ok', width: 500, ...data });\n this.detailsOpen.set(false);\n this.scheduleDismiss(this.data().dismissAfter);\n }\n\n /**\n * Opens or closes the technical details panel.\n * @returns void\n */\n protected toggleDetails(): void {\n this.detailsOpen.update(open => !open);\n }\n\n /**\n * Dismisses the panel. Safe to call more than once: only the first call is announced.\n * @returns void\n */\n close(): void {\n if (this.closing) return;\n this.closing = true;\n clearTimeout(this.dismissTimer);\n this.closed.emit();\n }\n\n /**\n * Closes the panel on Escape, mirroring a Material dialog opened with the default config.\n * @param e - The keyboard event captured at document level.\n * @returns void\n */\n @HostListener('document:keydown', ['$event'])\n protected onKeydown(e: KeyboardEvent): void {\n if (e.key === 'Escape') {\n e.preventDefault();\n this.close();\n return;\n }\n if (e.key === 'Tab') this.trapFocus(e);\n }\n\n /**\n * Keeps Tab inside the panel while the message is up.\n *\n * A hand-rolled two-element version of what `cdk/a11y` does, which is all this panel needs:\n * it never holds more than the copy button and the dismiss button.\n * @param e - The Tab keydown event.\n * @returns void\n */\n private trapFocus(e: KeyboardEvent): void {\n const focusable = Array.from(\n this.panel().nativeElement.querySelectorAll<HTMLElement>('button:not([disabled]), [href], [tabindex]:not([tabindex=\"-1\"])')\n );\n if (!focusable.length) return;\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = document.activeElement;\n\n if (e.shiftKey && (active === first || !this.panel().nativeElement.contains(active))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && active === last) {\n e.preventDefault();\n first.focus();\n }\n }\n\n /**\n * (Re)schedules the auto-dismiss timer, cancelling any pending one so a timer armed for an\n * earlier message can never close a newer one.\n * @param dismissAfter - Delay in milliseconds; no-op when falsy.\n * @returns void\n */\n private scheduleDismiss(dismissAfter?: number): void {\n clearTimeout(this.dismissTimer);\n this.dismissTimer = undefined;\n if (dismissAfter) this.dismissTimer = setTimeout(() => this.close(), dismissAfter);\n }\n\n /**\n * Copies the message and its details to the clipboard, as both HTML and plain text.\n *\n * Unlike `InfoDialogComponent` there is no toast to report the outcome — the shell has no\n * toast — so the button itself acknowledges it for a moment.\n * @returns A promise that resolves once the copy has been attempted.\n */\n protected async copy(): Promise<void> {\n const content = this.panel().nativeElement.querySelector<HTMLElement>('.content');\n if (!content) return;\n try {\n await navigator.clipboard.write([\n new ClipboardItem({\n 'text/html': new Blob([content.innerHTML], { type: 'text/html' }),\n 'text/plain': new Blob([content.innerText], { type: 'text/plain' })\n })\n ]);\n this.copied.set(true);\n clearTimeout(this.copiedTimer);\n this.copiedTimer = setTimeout(() => this.copied.set(false), 1500);\n } catch {\n // Clipboard permission denied or the document is not focused: nothing worth interrupting\n // the user for, and the text is on screen anyway.\n }\n }\n}\n","<div class=\"scrim\" (click)=\"close()\"></div>\n\n<div #panel class=\"panel\" role=\"alertdialog\" aria-modal=\"true\" [attr.aria-labelledby]=\"titleId\"\n [style.max-width.px]=\"data().width\">\n\n <h2 class=\"title\" [id]=\"titleId\" [innerHTML]=\"data().title | safeHtml\"></h2>\n\n <div class=\"content\">\n @if (data().message) {\n <div class=\"message\" [innerHTML]=\"data().message | safeHtml\"></div>\n }\n @if (data().details) {\n <div class=\"details-box\" [class.open]=\"detailsOpen()\">\n <button type=\"button\" class=\"details-header\" (click)=\"toggleDetails()\"\n [attr.aria-expanded]=\"detailsOpen()\" [attr.aria-controls]=\"detailsId\">\n <span class=\"details-label\">Dettaglio</span>\n <svg class=\"chevron\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6z\" />\n </svg>\n </button>\n <div class=\"details-body\">\n <div class=\"details\" [id]=\"detailsId\" [attr.aria-hidden]=\"!detailsOpen()\">\n <div class=\"details-text\" [innerHTML]=\"data().details | safeHtml\"></div>\n </div>\n </div>\n </div>\n }\n </div>\n\n <div class=\"actions\">\n <button type=\"button\" class=\"icon-button\" (click)=\"copy()\"\n [title]=\"copied() ? 'Copiato negli appunti' : 'Copia negli appunti'\" aria-label=\"Copia negli appunti\">\n @if (copied()) {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z\" /></svg>\n } @else {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path\n d=\"M16 1H4a2 2 0 0 0-2 2v14h2V3h12zm3 4H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m0 16H8V7h11z\" /></svg>\n }\n </button>\n <button #ok type=\"button\" class=\"flat-button\" (click)=\"close()\">{{ data().okCaption }}</button>\n </div>\n</div>\n","import { ApplicationRef, ComponentRef, EnvironmentInjector, Service, createComponent, inject } from '@angular/core';\nimport { SystemUtils } from '@arsedizioni/ars-utils/core';\nimport { Observable, Subject, Subscription } from 'rxjs';\nimport { first } from 'rxjs/operators';\nimport { BusyTimer } from './busy-timer';\nimport { ShellMessageData, ShellMessageRef } from './definitions';\nimport { ShellBusyComponent, ShellBusyMode, ShellBusyType } from './shell-busy/shell-busy.component';\nimport { ShellMessageComponent } from './shell-message/shell-message.component';\n\n/** Grace period before the busy overlay is actually taken away, in milliseconds. */\nconst CLEAR_BUSY_GRACE = 500;\n\n/**\n * Everything the application can say to the user without asking anything back: a message, an\n * error, and the wait overlay. No Angular Material behind any of it.\n *\n * `DialogService` extends this class, so a route component injects `DialogService` and has both\n * halves; shell, HTTP interceptors, route guards and app initializers inject `ShellService` and\n * pay for neither `mat-dialog` nor `cdk/overlay` on the boot path — measured at 445 KB of the\n * 905 KB initial bundle on myARS, more than every route of the application put together.\n *\n * The methods keep the parameter order of the `DialogService` ones they came from, so no call\n * site changed when they moved here.\n *\n * ## Stacking\n *\n * Since Angular CDK 22 every overlay is opened as `popover=\"manual\"`, so a Material dialog is not\n * at z-index 1000 any more: it is in the browser top layer, which is painted above the whole\n * document whatever the z-index of the document says. A number, however large, cannot get above\n * it — so these overlays are promoted to the top layer as well, and the order there is the order\n * of promotion: whatever went up last is on top.\n *\n * That gives the right answer by itself in the case that matters, an error raised while a dialog\n * is open. The other three are arranged explicitly: `setBusy()` puts the message back on top\n * after raising the busy overlay, `DialogService.open()` calls {@link raiseMessage} after opening\n * a dialog, and it also takes the busy away immediately rather than with the grace period, so a\n * dialog is never drawn under an overlay that is on its way out.\n *\n * The `--ars-shell-dialog-z-index` / `--ars-shell-busy-z-index` pair (1100 / 1090, above the CDK's 1000) is\n * still there and still correct: it is what orders the overlays on a browser without the Popover\n * API, where the CDK does not use it either.\n */\n@Service()\nexport class ShellService {\n\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n\n private messageRef?: ComponentRef<ShellMessageComponent>;\n private messageKind?: 'info' | 'error';\n private messageClosed?: Subject<void>;\n private previousOverflow?: string;\n private previouslyFocused?: HTMLElement;\n\n private busyRef?: ComponentRef<ShellBusyComponent>;\n private busyVisible = false;\n private busyActionSubscription?: Subscription;\n private clearBusyTimer?: ReturnType<typeof setTimeout>;\n\n /** Cached answer of {@link supportsTopLayer}, resolved the first time an overlay is shown. */\n private topLayerSupport?: boolean;\n\n // ---------------------------------------------------------------------------\n // Messages\n // ---------------------------------------------------------------------------\n\n /**\n * Shows an informational message.\n * @param message - HTML message to display.\n * @param title - Heading. Defaults to `'Informazioni'`.\n * @param okCaption - Dismiss button label. Defaults to `'Ok'`.\n * @param width - Maximum panel width in pixels. Defaults to `500`.\n * @param dismissAfter - Auto-close delay in milliseconds (optional).\n * @param details - Optional secondary details text.\n * @returns A handle over the open message, or `null` outside the browser.\n */\n info(\n message: string,\n title: string = 'Informazioni',\n okCaption: string = 'Ok',\n width: number = 500,\n dismissAfter?: number,\n details?: string\n ): ShellMessageRef | null {\n this.clearBusy();\n return this.showMessage('info', { message, title, okCaption, width, dismissAfter, details });\n }\n\n /**\n * Shows an error message. When one is already on screen its content is replaced in place: a\n * failing API answers many requests at once, and each of them must not add a panel of its own.\n * @param message - HTML error message to display.\n * @param log - Optional technical log or stack trace shown in the details panel.\n * @param title - Heading. Defaults to `'Errore'`.\n * @param okCaption - Dismiss button label. Defaults to `'Ok'`.\n * @param width - Maximum panel width in pixels. Defaults to `500`.\n * @param dismissAfter - Auto-close delay in milliseconds (optional).\n * @returns A handle over the open message, or `null` outside the browser.\n */\n error(\n message: string,\n log?: string,\n title: string = 'Errore',\n okCaption: string = 'Ok',\n width: number = 500,\n dismissAfter?: number\n ): ShellMessageRef | null {\n this.clearBusy();\n return this.showMessage('error', { message, title, okCaption, width, dismissAfter, details: log });\n }\n\n /**\n * Closes the message currently on screen, if any. Does not touch the busy overlay.\n * @returns void\n */\n closeMessage(): void {\n if (!this.messageRef) return;\n\n const ref = this.messageRef;\n this.messageRef = undefined;\n this.messageKind = undefined;\n\n this.leaveTopLayer(ref.location.nativeElement as HTMLElement);\n this.appRef.detachView(ref.hostView);\n ref.destroy();\n\n if (this.previousOverflow !== undefined) {\n document.body.style.overflow = this.previousOverflow;\n this.previousOverflow = undefined;\n }\n this.previouslyFocused?.focus();\n this.previouslyFocused = undefined;\n\n // Last, so that whoever is waiting on it finds the screen already in its final state.\n const closed = this.messageClosed;\n this.messageClosed = undefined;\n closed?.next();\n closed?.complete();\n }\n\n /**\n * Opens the message panel, or updates the one already open when it is showing the same kind of\n * message.\n * @param kind - Whether this is an informational or an error message.\n * @param data - The content to display.\n * @returns A handle over the open message, or `null` outside the browser.\n */\n private showMessage(kind: 'info' | 'error', data: ShellMessageData): ShellMessageRef | null {\n if (!SystemUtils.isBrowser()) return null;\n\n if (this.messageRef && this.messageKind === kind) {\n this.messageRef.instance.setData(data);\n this.messageRef.changeDetectorRef.detectChanges();\n // Back to the front: a dialog may have been opened since this panel went up, and the top\n // layer orders by promotion, not by z-index.\n this.raiseTopLayer(this.messageRef.location.nativeElement as HTMLElement);\n return this.messageHandle();\n }\n\n // A message of a different kind replaces the one on screen rather than stacking on it.\n this.closeMessage();\n\n const ref = createComponent(ShellMessageComponent, { environmentInjector: this.environmentInjector });\n ref.instance.setData(data);\n ref.instance.closed.subscribe(() => this.closeMessage());\n\n // One subject per panel, not per handle: an `error()` that replaces the text of the message\n // already on screen hands out a second handle, and both must fire when that message goes.\n this.messageClosed = new Subject<void>();\n\n this.previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : undefined;\n this.previousOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n this.appRef.attachView(ref.hostView);\n document.body.appendChild(ref.location.nativeElement as HTMLElement);\n this.enterTopLayer(ref.location.nativeElement as HTMLElement);\n\n this.messageRef = ref;\n this.messageKind = kind;\n return this.messageHandle();\n }\n\n /**\n * Builds the handle returned to callers.\n *\n * The subject is captured now rather than read at call time, so `afterClosed()` keeps\n * answering about the message this handle was given for, even once another one has taken\n * its place on screen.\n * @returns The handle over the message currently on screen.\n */\n private messageHandle(): ShellMessageRef {\n const closed = this.messageClosed!;\n return {\n close: () => this.closeMessage(),\n afterClosed: () => closed.asObservable()\n };\n }\n\n // ---------------------------------------------------------------------------\n // Busy overlay\n // ---------------------------------------------------------------------------\n\n /**\n * Shows or updates the busy overlay.\n *\n * Called dozens of times per screen, so it creates nothing after the first time: the component\n * is built once and then kept, and showing it again is a class on the host element. The state\n * is written to signals and checked synchronously before returning, so the message on screen is\n * always the last one asked for — a second `busy()` in the same task never leaves the previous\n * text behind.\n * @param message - Text to display. An empty string keeps the current one.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param type - Visual style of the overlay. Defaults to `'bar'`.\n * @param action - Optional observable; the overlay is dismissed when it first emits. It\n * replaces the one passed to a previous call, which is unsubscribed.\n * @returns `true` if the overlay was brought up by this call, `false` if it was already up.\n */\n setBusy(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n type: ShellBusyType = 'bar',\n action?: Observable<unknown>\n ): boolean {\n if (!SystemUtils.isBrowser()) return false;\n\n // Cancel any pending clearBusy(): it must never take away an overlay just asked for.\n clearTimeout(this.clearBusyTimer);\n this.clearBusyTimer = undefined;\n\n const created = !this.busyVisible;\n const ref = this.ensureBusy();\n ref.instance.set(message, progress, progressMode, type);\n ref.instance.visible.set(true);\n this.busyVisible = true;\n ref.changeDetectorRef.detectChanges();\n this.enterTopLayer(ref.location.nativeElement as HTMLElement);\n\n // The overlay has just been promoted, so it is the topmost element of the top layer: put the\n // message back above it, which is what the 1100/1090 pair used to do on its own.\n this.raiseMessage();\n\n // The action always replaces the previous one. Keeping the first, as the previous\n // implementation did, meant the overlay outlived the operation that was actually running.\n this.busyActionSubscription?.unsubscribe();\n this.busyActionSubscription = action?.pipe(first()).subscribe(() => this.clearBusy());\n\n return created;\n }\n\n /**\n * Shows or updates the busy overlay using the progress-bar style.\n * @param message - Text to display inside the overlay.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busy(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n action?: Observable<unknown>\n ): boolean {\n return this.setBusy(message, progress, progressMode, 'bar', action);\n }\n\n /**\n * Shows or updates the busy overlay using the spinner style.\n * @param message - Text to display inside the overlay.\n * @param progress - Progress value (`-1` = indeterminate). Defaults to `-1`.\n * @param progressMode - Progress mode. Defaults to `'indeterminate'`.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busySpinner(\n message: string,\n progress: number = -1,\n progressMode: ShellBusyMode = 'indeterminate',\n action?: Observable<unknown>\n ): boolean {\n return this.setBusy(message, progress, progressMode, 'spinner', action);\n }\n\n /**\n * Shows or updates the busy overlay using the hourglass style.\n * @param message - Text to display inside the overlay.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n busyHourglass(message: string, action?: Observable<unknown>): boolean {\n return this.setBusy(message, -1, 'indeterminate', 'hourglass', action);\n }\n\n /**\n * Shows a bare wait indicator, with no panel and no message.\n * @param action - Optional observable; the overlay is dismissed when it emits.\n * @returns `true` if the overlay was brought up by this call.\n */\n wait(action?: Observable<unknown>): boolean {\n return this.setBusy('', -1, 'indeterminate', 'wait', action);\n }\n\n /**\n * Returns a {@link BusyTimer} that brings the overlay up only if the operation is still running\n * after a debounce delay.\n * @param message - Text to display. Defaults to `'Operazione in corso...'`.\n * @param due - Delay in milliseconds before the overlay appears. Defaults to `100`.\n * @returns A timer that must be disposed with `clear()` when the operation ends.\n */\n busyTimer(message: string = 'Operazione in corso...', due: number = 100): BusyTimer {\n return new BusyTimer(this, due, message);\n }\n\n /**\n * Takes the busy overlay away.\n *\n * By default it waits a short grace period, so that a chain of quick operations does not make\n * the overlay blink between one and the next; any `setBusy()` in the meantime cancels the\n * pending removal. Pass `true` when something is about to be drawn underneath it and the wait\n * would be visible — that is what `DialogService.open()` does.\n * @param immediate - When `true`, removes the overlay without waiting for the grace period.\n * @returns void\n */\n clearBusy(immediate: boolean = false): void {\n clearTimeout(this.clearBusyTimer);\n this.clearBusyTimer = undefined;\n\n if (immediate) {\n this.hideBusy();\n return;\n }\n this.clearBusyTimer = setTimeout(() => {\n this.clearBusyTimer = undefined;\n this.hideBusy();\n }, CLEAR_BUSY_GRACE);\n }\n\n /**\n * Hides the busy overlay without destroying it, so the next call can reuse the instance.\n * @returns void\n */\n private hideBusy(): void {\n this.busyActionSubscription?.unsubscribe();\n this.busyActionSubscription = undefined;\n if (!this.busyVisible) return;\n this.busyVisible = false;\n this.busyRef?.instance.visible.set(false);\n this.busyRef?.changeDetectorRef.detectChanges();\n this.leaveTopLayer(this.busyRef?.location.nativeElement as HTMLElement | undefined);\n }\n\n /**\n * Returns the busy component, creating and attaching it the first time it is needed.\n * @returns The reused busy component reference.\n */\n private ensureBusy(): ComponentRef<ShellBusyComponent> {\n if (this.busyRef) return this.busyRef;\n\n const ref = createComponent(ShellBusyComponent, { environmentInjector: this.environmentInjector });\n this.appRef.attachView(ref.hostView);\n document.body.appendChild(ref.location.nativeElement as HTMLElement);\n this.busyRef = ref;\n return ref;\n }\n\n // ---------------------------------------------------------------------------\n // Top layer\n // ---------------------------------------------------------------------------\n\n /**\n * Brings the message currently on screen back to the front of the top layer, if there is one.\n *\n * Called by `DialogService` after opening a dialog: an error the user has not dismissed yet\n * must stay above whatever is opened underneath it.\n * @returns void\n */\n raiseMessage(): void {\n this.raiseTopLayer(this.messageRef?.location.nativeElement as HTMLElement | undefined);\n }\n\n /**\n * Whether the browser can promote an element to the top layer through the Popover API.\n *\n * Angular CDK 22 opens every overlay as `popover=\"manual\"`, so a Material dialog does not sit\n * at z-index 1000 any more: it sits in the top layer, which is painted above the whole page\n * whatever the z-index of the page says. The only way to put something above it is to be in\n * the top layer too. Where the API is missing the overlays fall back to their z-index, which\n * is also the CDK's own fallback and therefore still the right order.\n * @returns `true` when `showPopover()` is available.\n */\n private supportsTopLayer(): boolean {\n if (this.topLayerSupport === undefined) {\n this.topLayerSupport = SystemUtils.isBrowser()\n && typeof HTMLElement !== 'undefined'\n && 'showPopover' in HTMLElement.prototype;\n }\n return this.topLayerSupport;\n }\n\n /**\n * Promotes an overlay to the top layer, marking it as a manual popover the first time.\n *\n * `manual` and not `auto`: an `auto` popover is light-dismissed by a click anywhere and closed\n * by Escape without telling anyone, which would take the panel off the screen behind the back\n * of the component that owns it.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private enterTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n if (el.getAttribute('popover') !== 'manual') el.setAttribute('popover', 'manual');\n // Throws if the element is already showing, or is not connected yet.\n try { if (!el.matches(':popover-open')) el.showPopover(); } catch { /* already up */ }\n }\n\n /**\n * Takes an overlay out of the top layer.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private leaveTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n try { if (el.matches(':popover-open')) el.hidePopover(); } catch { /* already down */ }\n }\n\n /**\n * Moves an overlay back to the front of the top layer.\n *\n * The top layer is a stack ordered by promotion, so the only way to raise an element already\n * in it is to take it out and put it back.\n * @param el - The host element of the overlay. Ignored when undefined.\n * @returns void\n */\n private raiseTopLayer(el?: HTMLElement): void {\n if (!el || !this.supportsTopLayer()) return;\n if (!el.matches(':popover-open')) {\n this.enterTopLayer(el);\n return;\n }\n try {\n el.hidePopover();\n el.showPopover();\n } catch { /* the element is on its way out */ }\n }\n}\n","/*\n * Public API Surface of @arsedizioni/ars-utils/ui.shell\n */\nexport * from './definitions';\nexport * from './busy-timer';\nexport * from './shell.service';\nexport * from './shell-message/shell-message.component';\nexport * from './shell-busy/shell-busy.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;AAIA;;;;;;AAMG;MACU,SAAS,CAAA;AAGpB;;;;;;AAMG;AACH,IAAA,WAAA,CACmB,YAA0B,EAC3C,GAAA,GAAc,GAAG,EACjB,UAAkB,wBAAwB,EAAA;QAFzB,IAAA,CAAA,YAAY,GAAZ,YAAY;AAI7B,QAAA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE;IAC7F;AAEA;;;AAGG;IACH,KAAK,GAAA;AACH,QAAA,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;AAC/B,QAAA,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;IAC/B;AACD;;AC3BD;AACA,MAAM,qBAAqB,GAAG,CAAC,G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@arsedizioni/ars-utils",
3
- "version": "22.5.27",
3
+ "version": "22.5.30",
4
4
  "author": {
5
5
  "email": "software@arsedizioni.it",
6
6
  "name": "Fabio Buscaroli, Alberto Doria"
@@ -2,6 +2,7 @@ import * as _angular_forms_signals from '@angular/forms/signals';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { DestroyRef, ChangeDetectorRef } from '@angular/core';
4
4
  import { ScrollDispatcher } from '@angular/cdk/scrolling';
5
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
5
6
  import { MatExpansionPanel } from '@angular/material/expansion';
6
7
  import { MatInput } from '@angular/material/input';
7
8
  import { MatPaginator, PageEvent } from '@angular/material/paginator';
@@ -524,6 +525,21 @@ interface BrowserFilterModel {
524
525
  changeReason: number | null;
525
526
  }
526
527
  declare class ClipperBrowserComponent extends ClipperSearchResultManager {
528
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
529
+ protected readonly getFieldErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
530
+ /**
531
+ * Error text for a date range: whichever end is in error speaks for the pair.
532
+ * @param from - Errors of the start field, from `f.from().errors()`.
533
+ * @param to - Errors of the end field, from `f.to().errors()`.
534
+ * @returns The text to show under the range, or `undefined` when neither end is in error.
535
+ */
536
+ protected rangeErrorMessage(from: readonly {
537
+ kind: string;
538
+ message?: string;
539
+ }[], to: readonly {
540
+ kind: string;
541
+ message?: string;
542
+ }[]): string | undefined;
527
543
  readonly filterByNumber: _angular_core.Signal<MatInput>;
528
544
  readonly filterByText: _angular_core.Signal<MatInput>;
529
545
  readonly filterByChangeNumber: _angular_core.Signal<MatInput>;
@@ -1,6 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Validator, AbstractControl, ValidationErrors } from '@angular/forms';
3
- import { PathKind, SchemaPath, SchemaPathRules, LogicFn } from '@angular/forms/signals';
3
+ import { PathKind, LogicFn, SchemaPath, SchemaPathRules } from '@angular/forms/signals';
4
+ import { Validated } from '@arsedizioni/ars-utils/core';
4
5
 
5
6
  /**
6
7
  * Directive that delegates validation to an externally provided validator function.
@@ -266,56 +267,6 @@ declare class NotEmptyValidatorDirective implements Validator {
266
267
  static ɵdir: i0.ɵɵDirectiveDeclaration<NotEmptyValidatorDirective, "[notEmpty]", never, {}, {}, never, never, true, never>;
267
268
  }
268
269
 
269
- /**
270
- * Signal-forms counterparts of the classic validator directives in this entry point.
271
- *
272
- * The `[formField]` directive only honours `NG_VALIDATORS` providers on ControlValueAccessor
273
- * hosts (custom controls); on native inputs the attribute directives (`password`, `emails`,
274
- * `time`, `equals`) are ignored. Schemas built with `form()` must therefore use these
275
- * functions instead. Error kinds and messages match the directive versions one to one.
276
- */
277
- /**
278
- * Binds a validator requiring the value to be a semicolon-separated list of valid
279
- * email addresses. An empty value is considered valid (pair with `required` if needed).
280
- * Signal-forms counterpart of `EmailsValidatorDirective`.
281
- * @param path - Path of the string field to validate.
282
- */
283
- declare function emailsValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
284
- /**
285
- * Binds a validator requiring the value to meet the minimum password-strength
286
- * requirements (see `SystemUtils.calculatePasswordStrength`). An empty value is
287
- * INVALID, exactly like the classic directive.
288
- * Signal-forms counterpart of `PasswordValidatorDirective`.
289
- * @param path - Path of the string field to validate.
290
- */
291
- declare function passwordValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
292
- /**
293
- * Binds a validator requiring the value to be a valid `"HH:MM"` time string and,
294
- * when slots are provided, to fall within at least one of the allowed ranges.
295
- * An empty value is considered valid (pair with `required` if needed).
296
- * Signal-forms counterpart of `TimeValidatorDirective`.
297
- * @param path - Path of the string field to validate.
298
- * @param slots - Optional reactive function returning the pipe-separated allowed
299
- * ranges (e.g. `"08:00-12:00|14:00-18:00"`), or `undefined` for none.
300
- */
301
- declare function timeValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, slots?: () => string | undefined): void;
302
- /**
303
- * Binds a validator requiring the value to strictly equal the value of another field
304
- * of the same form. Reactive on both fields, so the host field re-validates when the
305
- * other field changes (this replaces the `valueChanges` subscription of the directive).
306
- * Signal-forms counterpart of `EqualsValidatorDirective`.
307
- * @param path - Path of the field to validate.
308
- * @param other - Path of the field whose value must match.
309
- */
310
- declare function equalsValidator<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>): void;
311
- /**
312
- * Binds a validator requiring the value to be either empty or a complete 6-digit
313
- * OTP code. A partial code (e.g. `"12"`) is invalid; emptiness is left to `required`.
314
- * Schema-level counterpart of the `OtpInputComponent` internal validator.
315
- * @param path - Path of the string field to validate.
316
- */
317
- declare function otpValidator<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>): void;
318
-
319
270
  /**
320
271
  * Options shared by the ARS signal-form validators.
321
272
  *
@@ -336,6 +287,13 @@ interface ArsValidatorConfig<TValue = string, TPathKind extends PathKind = PathK
336
287
  */
337
288
  when?: NoInfer<LogicFn<TValue, boolean, TPathKind>>;
338
289
  }
290
+ /**
291
+ * Default texts of the rules declared here, in one place so that the validators and the fallback
292
+ * map of `SignalsUtils.getFieldErrorMessage` cannot drift apart: a rule added below without a
293
+ * message here would show "Errore", and one renamed here without touching the validator would
294
+ * leave the map with a kind nobody produces.
295
+ */
296
+ declare const ARS_VALIDATOR_MESSAGES: Record<string, string>;
339
297
  /**
340
298
  * Requires the value to be a well-formed GUID / UUID.
341
299
  *
@@ -379,6 +337,163 @@ declare function password<TPathKind extends PathKind = PathKind.Root>(path: Sche
379
337
  * const f = form(this.model, p => { required(p.city); notEmpty(p.city); });
380
338
  */
381
339
  declare function notEmpty<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
340
+ /**
341
+ * Requires the value to differ from the value of another field of the same form.
342
+ *
343
+ * The signal-form counterpart of `NotEqualValidatorDirective`, with its exact rule: two empty
344
+ * values are considered different, so an untouched pair of fields does not start out in error.
345
+ * Reactive on both fields — editing either one re-validates this one, which is what the
346
+ * directive needed a `valueChanges` subscription (and a re-entrancy guard) to achieve.
347
+ *
348
+ * @param path - Path of the field to validate.
349
+ * @param other - Path of the field whose value must differ.
350
+ * @param config - Optional message override and `when` condition.
351
+ * @returns void
352
+ */
353
+ declare function notEqual<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
354
+ /**
355
+ * Requires the value to be a date the backend can store: parseable, and after 1750.
356
+ *
357
+ * The signal-form counterpart of `SqlDateValidatorDirective`. The year floor is not arbitrary —
358
+ * it is what separates a real date from the 01/01/0001 that a mistyped year produces, which SQL
359
+ * Server rejects with an error nobody can read.
360
+ *
361
+ * @param path - Path of the field to validate.
362
+ * @param config - Optional message override and `when` condition.
363
+ * @returns void
364
+ */
365
+ declare function sqlDate<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
366
+ /**
367
+ * Requires the value to be a date that is not in the future.
368
+ *
369
+ * The signal-form counterpart of `NotFutureValidatorDirective`. Today counts as valid: the
370
+ * comparison is made on the end of the day, so a date entered this morning does not become
371
+ * invalid because the clock says 09:00.
372
+ *
373
+ * @param path - Path of the field to validate.
374
+ * @param config - Optional message override and `when` condition.
375
+ * @returns void
376
+ */
377
+ declare function notFuture<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
378
+ /**
379
+ * Requires the value to be a well-formed URL. An empty value passes, as everywhere else here.
380
+ *
381
+ * The signal-form counterpart of `UrlValidatorDirective`.
382
+ *
383
+ * @param path - Path of the field to validate.
384
+ * @param config - Optional message override and `when` condition.
385
+ * @returns void
386
+ */
387
+ declare function url<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
388
+ /**
389
+ * Requires the value to hold no more than `max` whitespace-separated terms.
390
+ *
391
+ * The signal-form counterpart of `MaxTermsValidatorDirective`, used on the search boxes where
392
+ * the backend refuses a query past a certain number of words.
393
+ *
394
+ * @param path - Path of the field to validate.
395
+ * @param max - The maximum number of terms, as a number or a reactive function.
396
+ * @param config - Optional message override and `when` condition.
397
+ * @returns void
398
+ */
399
+ declare function maxTerms<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, max: number | (() => number), config?: ArsValidatorConfig<string, TPathKind>): void;
400
+ /**
401
+ * Requires the size of the picked file to fall within the allowed range.
402
+ *
403
+ * The signal-form counterpart of `FileSizeValidatorDirective`, and it keeps its shape: the field
404
+ * itself holds the file NAME, while the size arrives from outside — the control that picked the
405
+ * file knows it, the form does not. An empty field passes, so "no file" is `required()`'s call
406
+ * and not a size error.
407
+ *
408
+ * @param path - Path of the field holding the file name.
409
+ * @param sizeMb - The size of the picked file in megabytes, as a reactive function.
410
+ * @param maxSizeMb - The maximum allowed size in megabytes. Defaults to `5`.
411
+ * @param minSizeMb - The minimum required size in megabytes. Defaults to `0`.
412
+ * @param config - Optional message override and `when` condition.
413
+ * @returns void
414
+ */
415
+ declare function fileSize<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, sizeMb: () => number | undefined, maxSizeMb?: number | (() => number), minSizeMb?: number | (() => number), config?: ArsValidatorConfig<string, TPathKind>): void;
416
+ /**
417
+ * Requires the value to declare itself valid.
418
+ *
419
+ * The signal-form counterpart of `ValidIfDirective`: when the field holds an object implementing
420
+ * `Validated` the verdict is its own `isValid()`, and when the field is empty the verdict is the
421
+ * `flag`. It is the escape hatch for the composite controls whose validity only they can judge.
422
+ *
423
+ * @param path - Path of the field to validate.
424
+ * @param flag - Verdict used while the field is empty, as a boolean or a reactive function.
425
+ * Defaults to `false`.
426
+ * @param config - Optional message override and `when` condition.
427
+ * @returns void
428
+ */
429
+ declare function validIf<TValue extends Partial<Validated>, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, flag?: boolean | (() => boolean), config?: ArsValidatorConfig<TValue, TPathKind>): void;
430
+ /**
431
+ * Requires the value to be a semicolon-separated list of valid e-mail addresses.
432
+ *
433
+ * The signal-form counterpart of `EmailsValidatorDirective`. An empty value passes, and so does
434
+ * an empty entry between two semicolons: the list is typed by hand and a trailing `;` is not a
435
+ * mistake worth an error.
436
+ *
437
+ * @param path - Path of the field to validate.
438
+ * @param config - Optional message override and `when` condition.
439
+ * @returns void
440
+ */
441
+ declare function emails<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
442
+ /**
443
+ * Requires the value to be a `"HH:MM"` time and, when slots are given, to fall inside one of them.
444
+ *
445
+ * The signal-form counterpart of `TimeValidatorDirective`. An empty value passes.
446
+ *
447
+ * @param path - Path of the field to validate.
448
+ * @param slots - Optional reactive function returning the pipe-separated allowed ranges
449
+ * (e.g. `"08:00-12:00|14:00-18:00"`), or `undefined` for no restriction.
450
+ * @param config - Optional message override and `when` condition.
451
+ * @returns void
452
+ */
453
+ declare function time<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, slots?: () => string | undefined, config?: ArsValidatorConfig<string, TPathKind>): void;
454
+ /**
455
+ * Requires the value to equal the value of another field of the same form.
456
+ *
457
+ * The signal-form counterpart of `EqualsValidatorDirective`. Reactive on both fields, which is
458
+ * what the directive needed a `valueChanges` subscription to obtain: retyping the first password
459
+ * re-validates the confirmation without anyone wiring the two together.
460
+ *
461
+ * @param path - Path of the field to validate.
462
+ * @param other - Path of the field whose value must match.
463
+ * @param config - Optional message override and `when` condition.
464
+ * @returns void
465
+ */
466
+ declare function equals<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, other: SchemaPath<TValue, SchemaPathRules.Supported>, config?: ArsValidatorConfig<TValue, TPathKind>): void;
467
+ /**
468
+ * Requires the value to be either empty or a complete six-digit one-time code.
469
+ *
470
+ * The schema-level counterpart of the validator inside `OtpInputComponent`: a partial code is an
471
+ * error, an empty one is `required()`'s business.
472
+ *
473
+ * @param path - Path of the field to validate.
474
+ * @param config - Optional message override and `when` condition.
475
+ * @returns void
476
+ */
477
+ declare function otp<TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<string, SchemaPathRules.Supported, TPathKind>, config?: ArsValidatorConfig<string, TPathKind>): void;
478
+ /** Helpers around signal forms that are not validators themselves. */
479
+ declare class SignalsUtils {
480
+ /**
481
+ * Builds the error text for a signal-forms field.
482
+ *
483
+ * Deliberately dumb: the wording lives in the schema, next to the rule that produces it
484
+ * (`required(p.x, { message: ... })`), so a field says what is wrong with it in one place
485
+ * instead of here in a switch that has to guess from the error kind. The map below is only
486
+ * the safety net for the rules declared without a message — the Angular built-ins, plus
487
+ * {@link ARS_VALIDATOR_MESSAGES} for the ones declared in this file.
488
+ * @param errors - The errors currently on the field, from `f.x().errors()`.
489
+ * @param message - Optional override applied to every error of the field.
490
+ * @returns The first relevant error text, or `undefined` when the field has no errors.
491
+ */
492
+ static getFieldErrorMessage(errors: readonly {
493
+ kind: string;
494
+ message?: string;
495
+ }[], message?: string): string | undefined;
496
+ }
382
497
 
383
- export { EmailsValidatorDirective, EqualsValidatorDirective, FileSizeValidatorDirective, GuidValidatorDirective, MaxTermsValidatorDirective, NotEmptyValidatorDirective, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, SqlDateValidatorDirective, TimeValidatorDirective, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, emailsValidator, equalsValidator, guid, notEmpty, otpValidator, password, passwordValidator, timeValidator };
498
+ export { ARS_VALIDATOR_MESSAGES, EmailsValidatorDirective, EqualsValidatorDirective, FileSizeValidatorDirective, GuidValidatorDirective, MaxTermsValidatorDirective, NotEmptyValidatorDirective, NotEqualValidatorDirective, NotFutureValidatorDirective, PasswordValidatorDirective, SignalsUtils, SqlDateValidatorDirective, TimeValidatorDirective, UrlValidatorDirective, ValidIfDirective, ValidatorDirective, emails, equals, fileSize, guid, maxTerms, notEmpty, notEqual, notFuture, otp, password, sqlDate, time, url, validIf };
384
499
  export type { ArsValidatorConfig };
@@ -5,6 +5,7 @@ import { PasswordStrength } from '@arsedizioni/ars-utils/core';
5
5
  import * as _angular_forms_signals from '@angular/forms/signals';
6
6
  import { CredentialsDialogResult, ResetPasswordDialogResult, RecoverPasswordDialogResult, PromptOtpDialogResult, PromptDialogData } from '@arsedizioni/ars-utils/ui';
7
7
  import { MatFormFieldAppearance } from '@angular/material/form-field';
8
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
8
9
 
9
10
  declare class OtpInputComponent implements ControlValueAccessor, Validator {
10
11
  /** Signal-based query for all individual OTP digit input elements. */
@@ -124,6 +125,8 @@ interface CredentialsDialogData {
124
125
  appearance?: MatFormFieldAppearance;
125
126
  }
126
127
  declare class CredentialsDialogComponent {
128
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
129
+ protected readonly getFieldErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
127
130
  /** Emitted when the user submits the form. Carries the entered credentials. */
128
131
  readonly done: _angular_core.OutputEmitterRef<CredentialsDialogResult>;
129
132
  /** Emitted when the user requests a password-recovery flow. */
@@ -169,6 +172,8 @@ interface ResetPasswordDialogData {
169
172
  appearance?: MatFormFieldAppearance;
170
173
  }
171
174
  declare class ResetPasswordDialogComponent {
175
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
176
+ protected readonly getFieldErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
172
177
  /** Emitted when the user submits the new password. Carries the entered password data. */
173
178
  readonly done: _angular_core.OutputEmitterRef<ResetPasswordDialogResult>;
174
179
  private readonly dialogService;
@@ -208,6 +213,8 @@ interface RecoverPasswordDialogData {
208
213
  appearance?: MatFormFieldAppearance;
209
214
  }
210
215
  declare class RecoverPasswordDialogComponent {
216
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
217
+ protected readonly getFieldErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
211
218
  /** Emitted when the user submits the recovery request. Carries the entered email and recaptcha state. */
212
219
  readonly done: _angular_core.OutputEmitterRef<RecoverPasswordDialogResult>;
213
220
  /** Dialog configuration with defaults applied at construction time. */
@@ -5,6 +5,7 @@ import { MatSnackBarRef } from '@angular/material/snack-bar';
5
5
  import { ShellService } from '@arsedizioni/ars-utils/ui.shell';
6
6
  import { DialogResult, DialogOption } from '@arsedizioni/ars-utils/ui';
7
7
  import * as _angular_forms_signals from '@angular/forms/signals';
8
+ import { SignalsUtils } from '@arsedizioni/ars-utils/core.validators';
8
9
  import { MatFormFieldAppearance } from '@angular/material/form-field';
9
10
 
10
11
  interface ConfirmDialogOption extends DialogOption {
@@ -56,6 +57,8 @@ interface DeleteDialogData {
56
57
  appearance?: MatFormFieldAppearance;
57
58
  }
58
59
  declare class DeleteDialogComponent {
60
+ /** Error text of a field: the message declared in the schema, or the shared fallback. */
61
+ protected readonly getFieldErrorMessage: typeof SignalsUtils.getFieldErrorMessage;
59
62
  /** Emitted when the user makes a choice. Carries the selected result. */
60
63
  readonly choosen: i0.OutputEmitterRef<DialogResult>;
61
64
  private readonly dialogRef;