@ckui/core 0.1.0-next.1 → 0.1.0-next.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ckui-core-internal.mjs","names":[],"sources":["../../../../projects/core/internal/id.ts","../../../../projects/core/internal/media.ts","../../../../projects/core/internal/announcer.ts","../../../../projects/core/internal/focus-trap.ts","../../../../projects/core/internal/icon.ts","../../../../projects/core/internal/inert.ts","../../../../projects/core/internal/value-control.ts","../../../../projects/core/internal/overlay-pane.ts","../../../../projects/core/internal/sheet-swipe.ts","../../../../projects/core/internal/overlay-host.ts","../../../../projects/core/internal/accessible-name.ts"],"sourcesContent":["let counter = 0;\n\n/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */\nexport function createCkId(prefix: string): string {\n if (typeof prefix !== 'string' || prefix.trim() === '') {\n throw new TypeError('createCkId needs a non-empty prefix string.');\n }\n counter += 1;\n return `${prefix}-${counter}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { CK_CONFIG } from '@ckui/core';\n\n/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */\n@Injectable({ providedIn: 'root' })\nexport class CkMedia {\n private readonly breakpointObserver = inject(BreakpointObserver);\n private readonly config = inject(CK_CONFIG);\n\n /** `(pointer: coarse)` */\n readonly coarsePointer: Signal<boolean> = this.watch('(pointer: coarse)');\n /** Viewport narrower than `CK_CONFIG.sheetBreakpoint`. */\n readonly narrow: Signal<boolean> = this.watch(\n `(max-width: ${this.config.sheetBreakpoint - 0.02}px)`,\n );\n /** `(prefers-reduced-motion: reduce)` */\n readonly reducedMotion: Signal<boolean> = this.watch('(prefers-reduced-motion: reduce)');\n /** Coarse pointer and a narrow viewport: overlays render as sheets. */\n readonly sheet: Signal<boolean> = computed(() => this.coarsePointer() && this.narrow());\n\n private watch(query: string): Signal<boolean> {\n const state = toSignal(this.breakpointObserver.observe(query), {\n initialValue: { matches: this.breakpointObserver.isMatched(query), breakpoints: {} },\n });\n return computed(() => state().matches);\n }\n}\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { _CdkPrivateStyleLoader, _VisuallyHiddenLoader } from '@angular/cdk/private';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Injectable, PLATFORM_ID, inject } from '@angular/core';\n\ntype Politeness = 'polite' | 'assertive';\n\ninterface Pending {\n readonly message: string;\n readonly politeness: Politeness;\n}\n\n/** Joins messages in order, with \". \" unless the earlier one already ends in punctuation. */\nfunction join(messages: readonly string[]): string {\n return messages.reduce((text, message) => {\n const trimmed = message.trim();\n if (text === '') {\n return trimmed;\n }\n return /[.!?:;,]$/.test(text) ? `${text} ${trimmed}` : `${text}. ${trimmed}`;\n }, '');\n}\n\n/** A message handed to the live region this recently (ms) may not have been read out yet. */\nconst READ_OUT_WINDOW = 150;\n\n/**\n * Screen-reader announcements through one shared live region. The CDK live region keeps only the\n * last message, so announcements made in the same tick are collected and spoken as one message, in\n * order (joined with \". \"); it is assertive if any of them is. A batch that follows within 150 ms\n * of the previous hand-over (the previous one may not be read out yet, and the CDK would replace\n * it) is spoken together with the previous text, again in order and assertive if either is; after\n * a longer pause only the new text is written. The region is hidden visually by the CDK styles,\n * which this service loads itself.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkAnnouncer {\n private readonly liveAnnouncer = inject(LiveAnnouncer);\n private pending: Pending[] = [];\n private waiters: (() => void)[] = [];\n private scheduled = false;\n private readonly view = inject(DOCUMENT).defaultView;\n private last: (Pending & { at: number }) | null = null;\n\n constructor() {\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);\n }\n }\n\n /**\n * Resolves once the message is in the live region. A blank message does nothing. Messages from\n * the same tick share one live-region update and one promise result.\n */\n announce(message: string, politeness: Politeness = 'polite'): Promise<void> {\n if (typeof message !== 'string' || message.trim() === '') {\n return Promise.resolve();\n }\n this.pending.push({ message, politeness });\n const done = new Promise<void>((resolve) => this.waiters.push(resolve));\n if (!this.scheduled) {\n this.scheduled = true;\n queueMicrotask(() => this.flush());\n }\n return done;\n }\n\n /** Empties the live region and drops announcements that have not been written yet. */\n clear(): void {\n this.pending = [];\n this.last = null;\n this.release();\n this.liveAnnouncer.clear();\n }\n\n private flush(): void {\n this.scheduled = false;\n const items = this.pending;\n if (items.length === 0) {\n return;\n }\n this.pending = [];\n const waiters = this.waiters;\n this.waiters = [];\n const now = this.view?.performance.now() ?? Date.now();\n const previous = this.last && now - this.last.at < READ_OUT_WINDOW ? this.last : null;\n const fresh = join(items.map((item) => item.message));\n // The same words again are repeated on their own, not stacked onto themselves.\n const all = previous && previous.message !== fresh ? [previous, ...items] : items;\n const politeness = all.some((item) => item.politeness === 'assertive') ? 'assertive' : 'polite';\n const message = all === items ? fresh : join(all.map((item) => item.message));\n this.last = { message, politeness, at: now };\n void this.liveAnnouncer\n .announce(message, politeness)\n .then(() => waiters.forEach((resolve) => resolve()));\n }\n\n private release(): void {\n const waiters = this.waiters;\n this.waiters = [];\n waiters.forEach((resolve) => resolve());\n }\n}\n","import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, Injector, afterNextRender, inject } from '@angular/core';\n\nexport interface CkFocusTrap {\n /**\n * Remembers the focused element, then focuses `initialFocus()` if it returns an element that takes\n * focus, else the first tabbable one inside. Resolves `false` if nothing could be focused.\n */\n activate(initialFocus?: () => HTMLElement | null): Promise<boolean>;\n /** Destroys the trap and gives focus back if the remembered element is still connected. Safe to call repeatedly. */\n release(): void;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CkFocusTrapFactory {\n private readonly focusTrapFactory = inject(FocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n\n create(element: HTMLElement): CkFocusTrap {\n const trap: FocusTrap = this.focusTrapFactory.create(element);\n const { document, injector } = this;\n let previous: HTMLElement | null = null;\n let released = false;\n\n return {\n activate: (initialFocus) => {\n if (released) {\n return Promise.resolve(false);\n }\n previous ??= document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // The CDK's own deferred variant would still focus after a release in between.\n return new Promise<boolean>((resolve) => {\n afterNextRender(\n () => {\n if (released) {\n return resolve(false);\n }\n const target = initialFocus?.() ?? null;\n if (target) {\n target.focus();\n if (document.activeElement === target) {\n return resolve(true);\n }\n }\n resolve(trap.focusInitialElement());\n },\n { injector },\n );\n });\n },\n release: () => {\n if (released) {\n return;\n }\n released = true;\n trap.destroy();\n const target = previous;\n previous = null;\n if (target?.isConnected) {\n target.focus();\n }\n },\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\nexport type CkIconName =\n | 'alert-octagon'\n | 'alert-triangle'\n | 'check'\n | 'chevron-down'\n | 'chevron-end'\n | 'close'\n | 'info'\n | 'minus'\n | 'plus';\n\nconst ICON_PATHS: Readonly<Record<CkIconName, string>> = {\n 'alert-octagon': 'M5.2 2h5.6L14 5.2v5.6L10.8 14H5.2L2 10.8V5.2L5.2 2zM8 5.5v3M8 11v.01',\n 'alert-triangle': 'M8 2.5l6 10.5H2L8 2.5zM8 6.5v3M8 11.5v.01',\n check: 'M3 8.5l3.5 3.5L13 4.5',\n 'chevron-down': 'M4 6l4 4 4-4',\n 'chevron-end': 'M6 4l4 4-4 4',\n close: 'M4 4l8 8M12 4l-8 8',\n info: 'M8 14A6 6 0 108 2a6 6 0 000 12zM8 7.5v3.5M8 5v.01',\n minus: 'M3.5 8h9',\n plus: 'M8 3.5v9M3.5 8h9',\n};\n\n/** Decorative icon at the surrounding font size and colour. The control carries its own accessible name. */\n@Component({\n selector: 'ck-icon',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-icon',\n 'aria-hidden': 'true',\n '[class.ck-icon--mirror]': 'name() === \"chevron-end\"',\n },\n template: `\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n <path [attr.d]=\"path()\" />\n </svg>\n `,\n styles: `\n @layer ckui {\n .ck-icon {\n display: inline-block;\n flex: none;\n inline-size: var(--ck-icon-size, 1em);\n block-size: var(--ck-icon-size, 1em);\n color: currentColor;\n vertical-align: -0.125em;\n }\n\n .ck-icon > svg {\n display: block;\n inline-size: 100%;\n block-size: 100%;\n }\n\n .ck-icon--mirror:dir(rtl) {\n transform: scaleX(-1);\n }\n }\n `,\n})\nexport class CkIcon {\n readonly name = input.required<CkIconName>();\n protected readonly path = computed(() => ICON_PATHS[this.name()] ?? '');\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n/** Never made inert: they render nothing, or must keep announcing while an overlay is open. */\nconst SKIPPED =\n 'script, style, link, template, noscript, [data-ck-inert-exempt], .cdk-live-announcer-element';\n\ninterface Hold {\n count: number;\n /** The `inert` attribute value the element had before the first hold; `null` if it had none. */\n original: string | null;\n}\n\n/** Reference-counted `inert`: an element stays inert until every hold on it is released. */\n@Injectable({ providedIn: 'root' })\nexport class CkInert {\n private readonly document = inject(DOCUMENT);\n private readonly holds = new Map<Element, Hold>();\n\n /**\n * Makes the elements inert and returns the release function (safe to call more than once).\n * An element that was already inert keeps its own attribute value when the last hold ends.\n */\n hold(elements: Iterable<Element>): () => void {\n const held = new Set(elements);\n for (const element of held) {\n const entry = this.holds.get(element);\n if (entry) {\n entry.count++;\n continue;\n }\n const original = element.getAttribute('inert');\n this.holds.set(element, { count: 1, original });\n if (original === null) {\n element.setAttribute('inert', '');\n }\n }\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n for (const element of held) {\n const entry = this.holds.get(element);\n if (!entry || --entry.count > 0) {\n continue;\n }\n this.holds.delete(element);\n if (entry.original === null) {\n element.removeAttribute('inert');\n }\n }\n };\n }\n\n /** Body children that an overlay hides from the user: all but `keep`, exempt elements and non-rendered tags. */\n backgroundElements(keep: Element): Element[] {\n return Array.from(this.document.body.children).filter(\n (element) => element !== keep && !element.matches(SKIPPED),\n );\n }\n}\n","import {\n Directive,\n ModelSignal,\n Provider,\n Type,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nconst noop = (): void => undefined;\n\n/**\n * Base for components that edit one value.\n *\n * Reactive Forms, `ngModel` and Signal Forms all talk to the component through the\n * `ControlValueAccessor` registered by `provideCkValueAccessor`: Angular's `[formField]` prefers a\n * value accessor on the same node over the `value` model contract, so only that one path is ever\n * active. The `value` model and `disabled` input are for standalone use (`[(value)]`) and for the\n * template.\n *\n * `value` is `undefined` until something sets it; a subclass with a `null` default reads\n * `value() ?? null`.\n */\n@Directive()\nexport abstract class CkValueControl<T> implements ControlValueAccessor, FormValueControl<T> {\n readonly value: ModelSignal<T> = model(undefined as T);\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Only ever becomes `true` here: `markAsUntouched()` and `reset()` do not travel through a value\n * accessor. Do not style from it; read the form's own state (`ng-touched`, the field's `touched()`).\n */\n readonly touched = model(false);\n\n private readonly controlDisabled = signal(false);\n private onChange: (value: T) => void = noop;\n private onTouched: () => void = noop;\n\n /** The `disabled` input or the forms API (`control.disable()`, a disabled field) says so. */\n protected readonly isDisabled = computed(() => this.disabled() || this.controlDisabled());\n\n writeValue(value: T): void {\n this.value.set(value);\n }\n\n registerOnChange(onChange: (value: T) => void): void {\n this.onChange = onChange;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.controlDisabled.set(isDisabled);\n }\n\n /** A change made by the user. Ignored while disabled or when the value is the current one. */\n protected commit(value: T): void {\n if (this.isDisabled() || Object.is(value, this.value())) {\n return;\n }\n this.value.set(value);\n this.onChange(value);\n }\n\n /** Call when focus leaves the whole control, not a part of it. */\n protected markTouched(): void {\n this.touched.set(true);\n this.onTouched();\n }\n}\n\n/** Registers the component as a value accessor: `providers: [provideCkValueAccessor(CkSegmented)]`. */\nexport function provideCkValueAccessor(type: Type<unknown>): Provider {\n return { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true };\n}\n","import { CdkPortalOutlet, Portal } from '@angular/cdk/portal';\nimport {\n ChangeDetectionStrategy,\n Component,\n ViewContainerRef,\n ViewEncapsulation,\n inject,\n input,\n viewChild,\n} from '@angular/core';\n\n/** What the overlay host puts inside every CDK pane: the grab area of a sheet and the caller's content. */\n@Component({\n selector: 'ck-overlay-pane',\n imports: [CdkPortalOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { class: 'ck-overlay-pane' },\n template: `\n @if (grab()) {\n <div class=\"ck-overlay-grab\" data-ck-sheet-grab aria-hidden=\"true\">\n <span class=\"ck-overlay-grab-bar\"></span>\n </div>\n }\n <ng-template cdkPortalOutlet />\n `,\n styles: `\n @layer ckui {\n .ck-overlay-backdrop {\n position: absolute;\n inset: 0;\n z-index: -1;\n background: var(--ck-color-backdrop);\n pointer-events: auto;\n touch-action: manipulation;\n }\n\n @media (forced-colors: active) {\n .ck-overlay-backdrop {\n forced-color-adjust: none;\n }\n }\n\n .ck-overlay-pane {\n position: relative;\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-inline-size: 0;\n min-block-size: 0;\n max-block-size: 100%;\n }\n\n .ck-overlay-pane > :not(.ck-overlay-grab) {\n flex: 1 1 auto;\n min-block-size: 0;\n }\n\n .ck-overlay-grab {\n display: flex;\n flex: none;\n justify-content: center;\n block-size: var(--ck-target-min);\n border-start-start-radius: var(--ck-radius-xl);\n border-start-end-radius: var(--ck-radius-xl);\n background: var(--ck-sheet-grab-bg, var(--ck-color-surface-raised));\n touch-action: none;\n }\n\n .ck-overlay-grab-bar {\n margin-block-start: var(--ck-space-2);\n inline-size: var(--ck-space-10);\n block-size: var(--ck-space-1);\n border-radius: var(--ck-radius-full);\n background: var(--ck-color-border);\n }\n\n @media (forced-colors: active) {\n .ck-overlay {\n border: 1px solid CanvasText;\n }\n\n .ck-overlay-grab-bar {\n background: CanvasText;\n }\n }\n }\n `,\n})\nexport class CkOverlayPane {\n readonly grab = input(false);\n\n private readonly outlet = viewChild.required(CdkPortalOutlet);\n readonly viewContainerRef = inject(ViewContainerRef);\n\n attach(portal: Portal<unknown>): void {\n this.outlet().attach(portal);\n }\n}\n","/** A sheet is dismissed by a drag past this share of its height... */\nexport const SWIPE_DISTANCE_RATIO = 1 / 3;\n/** ...or by a flick at least this fast (px per ms) that has moved a little. */\nexport const SWIPE_FLICK_VELOCITY = 0.5;\nexport const SWIPE_FLICK_MIN_DISTANCE = 16;\n/** The speed is measured over this many ms before release. */\nconst VELOCITY_WINDOW = 100;\n\nexport function shouldDismissSwipe(distance: number, height: number, velocity: number): boolean {\n if (distance <= 0 || height <= 0) {\n return false;\n }\n return (\n distance > height * SWIPE_DISTANCE_RATIO ||\n (velocity >= SWIPE_FLICK_VELOCITY && distance >= SWIPE_FLICK_MIN_DISTANCE)\n );\n}\n\nexport interface SheetSwipeOptions {\n /** Contains the grab area (`[data-ck-sheet-grab]`); the swipe starts there. */\n readonly pane: HTMLElement;\n /** The element that follows the finger. */\n readonly panel: HTMLElement;\n readonly backdrop: HTMLElement;\n readonly duration: () => number;\n readonly easing: () => string;\n /** Called on release. `dismiss` says the swipe passed the threshold; return whether the overlay closed. */\n readonly onRelease: (dismiss: boolean) => boolean;\n}\n\ninterface Sample {\n readonly offset: number;\n readonly time: number;\n}\n\n/** Makes the grab area of a bottom sheet draggable. Returns the function that removes it. */\nexport function attachSheetSwipe(options: SheetSwipeOptions): () => void {\n const { pane, panel, backdrop } = options;\n const doc = pane.ownerDocument;\n const now = (): number => (doc.defaultView as Window).performance.now();\n let pointerId: number | null = null;\n let startY = 0;\n let height = 0;\n let offset = 0;\n let samples: Sample[] = [];\n\n function setOffset(next: number): void {\n offset = Math.max(0, next);\n panel.style.transform = `translateY(${offset}px)`;\n backdrop.style.opacity = String(Math.max(0, 1 - offset / Math.max(height, 1)));\n samples.push({ offset, time: now() });\n }\n\n function velocity(): number {\n const current = now();\n const recent = samples.filter((sample) => current - sample.time <= VELOCITY_WINDOW);\n const first = recent[0];\n const last = recent[recent.length - 1];\n if (!first || !last) {\n return 0;\n }\n return (last.offset - first.offset) / Math.max(1, current - first.time);\n }\n\n function stopTracking(): void {\n pointerId = null;\n doc.removeEventListener('pointermove', onMove);\n doc.removeEventListener('pointerup', onUp);\n doc.removeEventListener('pointercancel', onCancel);\n }\n\n function snapBack(): void {\n const from = offset;\n panel.style.transform = '';\n backdrop.style.opacity = '';\n offset = 0;\n const duration = options.duration();\n if (from > 0 && duration > 0 && typeof panel.animate === 'function') {\n const timing = { duration, easing: options.easing() };\n panel.animate([{ transform: `translateY(${from}px)` }, { transform: 'none' }], timing);\n backdrop.animate(\n [{ opacity: String(Math.max(0, 1 - from / Math.max(height, 1))) }, { opacity: '1' }],\n timing,\n );\n }\n }\n\n function onDown(event: PointerEvent): void {\n const target = event.target;\n if (\n pointerId !== null ||\n !event.isPrimary ||\n event.button !== 0 ||\n !(target instanceof Element) ||\n !target.closest('[data-ck-sheet-grab]')\n ) {\n return;\n }\n pointerId = event.pointerId;\n startY = event.clientY;\n height = panel.getBoundingClientRect().height;\n offset = 0;\n samples = [{ offset: 0, time: now() }];\n try {\n (target as HTMLElement).setPointerCapture?.(event.pointerId);\n } catch {\n // A pointer that is already gone cannot be captured; the document listeners still work.\n }\n doc.addEventListener('pointermove', onMove);\n doc.addEventListener('pointerup', onUp);\n doc.addEventListener('pointercancel', onCancel);\n }\n\n function onMove(event: PointerEvent): void {\n if (event.pointerId === pointerId) {\n setOffset(event.clientY - startY);\n }\n }\n\n function onUp(event: PointerEvent): void {\n if (event.pointerId !== pointerId) {\n return;\n }\n setOffset(event.clientY - startY);\n const dismiss = shouldDismissSwipe(offset, height, velocity());\n stopTracking();\n if (!options.onRelease(dismiss)) {\n snapBack();\n }\n }\n\n function onCancel(event: PointerEvent): void {\n if (event.pointerId === pointerId) {\n stopTracking();\n snapBack();\n }\n }\n\n pane.addEventListener('pointerdown', onDown);\n return () => {\n pane.removeEventListener('pointerdown', onDown);\n stopTracking();\n };\n}\n","import { Overlay, OverlayContainer, OverlayRef, ScrollStrategy } from '@angular/cdk/overlay';\nimport { ComponentPortal, ComponentType, Portal, TemplatePortal } from '@angular/cdk/portal';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Injectable, Injector, PLATFORM_ID, TemplateRef, inject } from '@angular/core';\nimport { CkFocusTrap, CkFocusTrapFactory } from './focus-trap';\nimport { CkInert } from './inert';\nimport { CkMedia } from './media';\nimport { CkOverlayPane } from './overlay-pane';\nimport { attachSheetSwipe } from './sheet-swipe';\n\nexport type CkOverlayMode = 'auto' | 'modal' | 'sheet';\nexport type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';\n\nexport interface CkOverlayConfig {\n /** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */\n mode?: CkOverlayMode;\n /** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */\n dismissible?: boolean;\n /** A sheet as tall as the viewport allows instead of as tall as its content. */\n fullHeight?: boolean;\n panelClass?: string | string[];\n /** Default `dialog`. */\n role?: 'dialog' | 'alertdialog';\n ariaLabel?: string;\n ariaLabelledBy?: string;\n ariaDescribedBy?: string;\n /**\n * Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is\n * expected to call `handle.close()` straight away; without it the host closes the overlay itself.\n * A sheet that is still open after a swipe snaps back.\n */\n onDismissRequest?: (reason: CkOverlayDismissReason) => void;\n /**\n * Picks the element that takes focus once the overlay has rendered. Without it, or when it\n * returns `null` or something that cannot take focus, the first tabbable element does.\n */\n initialFocus?: () => HTMLElement | null;\n}\n\nexport interface CkOverlayHandle {\n /** The mode resolved when the overlay opened. */\n readonly mode: 'modal' | 'sheet';\n /** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */\n readonly panel: HTMLElement;\n /** Resolves once the opening animation and the initial focus are done. */\n readonly opened: Promise<void>;\n /** Resolves once the overlay is detached. */\n readonly closed: Promise<void>;\n /** Animates out, then detaches. Repeated calls return the same promise. */\n close(): Promise<void>;\n}\n\nconst DEFAULT_DURATION = 200;\nconst SHEET_MAX_HEIGHT = 'calc(100dvh - env(safe-area-inset-top, 0px))';\nconst MODAL_MARGIN = 'var(--ck-space-4, 1rem)';\n\ntype State = 'open' | 'closing' | 'closed';\n\ninterface Entry {\n readonly overlayRef: OverlayRef;\n readonly dismissible: boolean;\n readonly dismiss: (reason: CkOverlayDismissReason) => void;\n /** Elements that had focus before this overlay (and ones it inherited) that focus can return to. */\n readonly openers: HTMLElement[];\n /** Runs the whole teardown at once, without animation. Safe to call repeatedly. */\n readonly destroy: () => void;\n state: State;\n}\n\nfunction parseDuration(value: string): number {\n const match = /^\\s*(-?[\\d.]+)(ms|s)\\s*$/.exec(value);\n if (!match) {\n return DEFAULT_DURATION;\n }\n const amount = Number(match[1]) * (match[2] === 's' ? 1000 : 1);\n return Number.isFinite(amount) && amount >= 0 ? amount : DEFAULT_DURATION;\n}\n\n/**\n * Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and\n * restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkOverlayHost {\n private readonly overlay = inject(Overlay);\n private readonly overlayContainer = inject(OverlayContainer);\n private readonly media = inject(CkMedia);\n private readonly inert = inject(CkInert);\n private readonly focusTraps = inject(CkFocusTrapFactory);\n private readonly injector = inject(Injector);\n private readonly document = inject(DOCUMENT);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** Open overlays, topmost last. A closing overlay has already left it. */\n private readonly stack: Entry[] = [];\n private readonly entries = new Set<Entry>();\n private scrollStrategy: ScrollStrategy | null = null;\n private scrollLocks = 0;\n private listening = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n for (const entry of [...this.entries]) {\n entry.destroy();\n }\n this.entries.clear();\n this.stack.length = 0;\n this.listen(false);\n if (this.scrollLocks > 0) {\n this.scrollLocks = 0;\n this.scrollStrategy?.disable();\n }\n });\n }\n\n open<C>(\n content: ComponentType<C> | TemplateRef<unknown>,\n config: CkOverlayConfig = {},\n injector?: Injector,\n ): CkOverlayHandle {\n const requested = config.mode ?? 'auto';\n const mode = requested === 'auto' ? (this.media.sheet() ? 'sheet' : 'modal') : requested;\n if (!this.isBrowser) {\n return this.inertHandle(mode);\n }\n\n const sheet = mode === 'sheet';\n const dismissible = config.dismissible ?? true;\n const container = this.overlayContainer.getContainerElement();\n container.style.zIndex = 'var(--ck-z-overlay, 1000)';\n\n const overlayRef = this.overlay.create({\n positionStrategy: sheet\n ? this.overlay.position().global().bottom('0').centerHorizontally()\n : this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.noop(),\n width: sheet ? '100%' : undefined,\n height: sheet && config.fullHeight ? SHEET_MAX_HEIGHT : undefined,\n maxWidth: sheet ? undefined : `calc(100% - 2 * ${MODAL_MARGIN})`,\n maxHeight: sheet ? SHEET_MAX_HEIGHT : `calc(100dvh - 2 * ${MODAL_MARGIN})`,\n panelClass: [\n 'ck-overlay',\n sheet ? 'ck-overlay--sheet' : 'ck-overlay--modal',\n ...(config.panelClass === undefined ? [] : [config.panelClass].flat()),\n ],\n disposeOnNavigation: false,\n // The top layer would put every overlay above the toast host; the z-index tokens order them instead.\n usePopover: false,\n });\n const panel = overlayRef.overlayElement;\n const host = overlayRef.hostElement;\n\n let paneRef;\n try {\n paneRef = overlayRef.attach(new ComponentPortal(CkOverlayPane, null, this.injector));\n paneRef.setInput('grab', sheet && dismissible);\n paneRef.changeDetectorRef.detectChanges();\n paneRef.instance.attach(this.contentPortal(content, paneRef.instance, injector));\n } catch (error) {\n overlayRef.dispose();\n throw error;\n }\n\n panel.setAttribute('role', config.role ?? 'dialog');\n panel.setAttribute('aria-modal', 'true');\n panel.tabIndex = -1;\n for (const [attribute, value] of [\n ['aria-label', config.ariaLabel],\n ['aria-labelledby', config.ariaLabelledBy],\n ['aria-describedby', config.ariaDescribedBy],\n ] as const) {\n if (value) {\n panel.setAttribute(attribute, value);\n }\n }\n\n const backdrop = this.document.createElement('div');\n backdrop.className = 'ck-overlay-backdrop';\n host.prepend(backdrop);\n\n // The opener is recorded before the background turns inert; inert would blur it.\n const opener =\n this.document.activeElement instanceof HTMLElement ? this.document.activeElement : null;\n const trap: CkFocusTrap = this.focusTraps.create(panel);\n const activation = trap.activate(config.initialFocus);\n\n const releaseInert = this.inert.hold([\n ...this.inert.backgroundElements(container),\n ...this.stack.map((other) => other.overlayRef.hostElement),\n ]);\n this.lockScroll();\n\n let resolveClosed: () => void = () => undefined;\n const closed = new Promise<void>((resolve) => (resolveClosed = resolve));\n let closing: Promise<void> | null = null;\n let released = false;\n let finishedOnce = false;\n let openAnimations: Animation[] = [];\n const view = this.document.defaultView;\n\n const motion = () => {\n const style = view!.getComputedStyle(panel);\n return {\n duration: this.media.reducedMotion()\n ? 0\n : parseDuration(style.getPropertyValue('--ck-duration-normal')),\n easing: style.getPropertyValue('--ck-ease-standard').trim() || 'ease',\n };\n };\n\n const play = (\n element: HTMLElement,\n keyframes: Keyframe[],\n fill: FillMode,\n ): Animation | null => {\n const { duration, easing } = motion();\n if (duration <= 0 || typeof element.animate !== 'function') {\n return null;\n }\n return element.animate(keyframes, { duration, easing, fill });\n };\n\n const finished = (animation: Animation | null): Promise<unknown> =>\n animation ? animation.finished.catch(() => undefined) : Promise.resolve();\n\n const entry: Entry = {\n overlayRef,\n dismissible,\n state: 'open',\n openers: opener ? [opener] : [],\n dismiss: (reason) => {\n if (config.onDismissRequest) {\n config.onDismissRequest(reason);\n } else {\n void close();\n }\n },\n destroy: () => {\n release();\n finish();\n },\n };\n this.entries.add(entry);\n this.stack.push(entry);\n this.listen(true);\n\n const detachSwipe =\n sheet && dismissible\n ? attachSheetSwipe({\n pane: paneRef.location.nativeElement as HTMLElement,\n panel,\n backdrop,\n duration: () => motion().duration,\n easing: () => motion().easing,\n onRelease: (dismissed) => {\n if (dismissed) {\n entry.dismiss('swipe');\n }\n return entry.state !== 'open';\n },\n })\n : () => undefined;\n\n const onBackdropClick = (): void => {\n if (entry.state === 'open' && dismissible && this.stack.at(-1) === entry) {\n entry.dismiss('backdrop');\n }\n };\n backdrop.addEventListener('click', onBackdropClick);\n\n /** Everything that must stop the moment the overlay starts closing. */\n const release = (): void => {\n if (released) {\n return;\n }\n released = true;\n entry.state = 'closing';\n const index = this.stack.indexOf(entry);\n this.stack.splice(index, 1);\n // An overlay above this one gets its openers, so focus can still reach the page later.\n this.stack[index]?.openers.unshift(...entry.openers);\n detachSwipe();\n backdrop.removeEventListener('click', onBackdropClick);\n for (const animation of openAnimations) {\n animation.cancel();\n }\n // The background has to be live again before the opener can take focus back.\n releaseInert();\n host.inert = true;\n trap.release();\n this.restoreFocus(entry);\n };\n\n /** Everything that happens once the overlay is gone. */\n const finish = (): void => {\n if (finishedOnce) {\n return;\n }\n finishedOnce = true;\n entry.state = 'closed';\n this.entries.delete(entry);\n overlayRef.dispose();\n backdrop.remove();\n this.unlockScroll();\n if (this.entries.size === 0) {\n this.listen(false);\n }\n resolveClosed();\n };\n\n const enter: Keyframe[] = sheet\n ? [{ transform: 'translateY(100%)' }, { transform: 'none' }]\n : [\n { opacity: 0, transform: 'scale(0.96)' },\n { opacity: 1, transform: 'none' },\n ];\n openAnimations = [\n play(panel, enter, 'none'),\n play(backdrop, [{ opacity: 0 }, { opacity: 1 }], 'none'),\n ].filter((animation): animation is Animation => animation !== null);\n\n // Nothing focusable inside: the panel takes focus right away, not after the animation.\n void activation.then((focused) => {\n if (entry.state === 'open' && !focused) {\n panel.focus({ preventScroll: true });\n }\n });\n const opened = Promise.all([\n activation,\n ...openAnimations.map((animation) => finished(animation)),\n ]).then(() => undefined);\n\n const close = (): Promise<void> => {\n if (closing) {\n return closing;\n }\n release();\n const leave: Keyframe[] = sheet\n ? [{ transform: 'translateY(100%)' }]\n : [{ opacity: 0, transform: 'scale(0.96)' }];\n const animations = [\n play(panel, leave, 'forwards'),\n play(backdrop, [{ opacity: 0 }], 'forwards'),\n ];\n closing = Promise.all(animations.map(finished)).then(finish);\n return closing;\n };\n\n return { mode, panel, opened, closed, close };\n }\n\n /** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */\n private restoreFocus(closed: Entry): void {\n const top = this.stack.at(-1);\n const active = this.document.activeElement;\n if (top?.overlayRef.overlayElement.contains(active)) {\n return;\n }\n const openers = [...closed.openers].reverse().filter((candidate) => candidate.isConnected);\n if (active && openers.includes(active as HTMLElement)) {\n return;\n }\n for (const candidate of openers) {\n candidate.focus();\n if (this.document.activeElement === candidate) {\n return;\n }\n }\n top?.overlayRef.overlayElement.focus({ preventScroll: true });\n }\n\n private contentPortal<C>(\n content: ComponentType<C> | TemplateRef<unknown>,\n pane: CkOverlayPane,\n injector: Injector | undefined,\n ): Portal<unknown> {\n return content instanceof TemplateRef\n ? new TemplatePortal(content, pane.viewContainerRef, undefined, injector)\n : new ComponentPortal(content, null, injector ?? this.injector);\n }\n\n /** What the server gets: nothing is rendered, and the overlay counts as closed. */\n private inertHandle(mode: 'modal' | 'sheet'): CkOverlayHandle {\n return {\n mode,\n panel: this.document.createElement('div'),\n opened: Promise.resolve(),\n closed: Promise.resolve(),\n close: () => Promise.resolve(),\n };\n }\n\n private lockScroll(): void {\n this.scrollStrategy ??= this.overlay.scrollStrategies.block();\n if (this.scrollLocks++ === 0) {\n this.scrollStrategy.enable();\n }\n }\n\n private unlockScroll(): void {\n if (this.scrollLocks > 0 && --this.scrollLocks === 0) {\n this.scrollStrategy?.disable();\n }\n }\n\n private listen(active: boolean): void {\n if (active === this.listening) {\n return;\n }\n this.listening = active;\n if (active) {\n this.document.addEventListener('keydown', this.onKeydown);\n } else {\n this.document.removeEventListener('keydown', this.onKeydown);\n }\n }\n\n private readonly onKeydown = (event: KeyboardEvent): void => {\n if (event.key !== 'Escape' || event.defaultPrevented || event.isComposing) {\n return;\n }\n const top = this.stack.at(-1);\n if (top?.dismissible) {\n event.preventDefault();\n top.dismiss('escape');\n }\n };\n}\n","export interface CkNameSources {\n /** Count `title` as a name. */\n readonly title: boolean;\n /** Count the element's own visible text (not `aria-hidden` or `hidden` parts). */\n readonly text: boolean;\n /** Count the text of the `<label>` elements of a form control. */\n readonly labels?: boolean;\n}\n\n/** Whether the element has an accessible name: a label attribute, a label reference or readable text. */\nexport function hasAccessibleName(element: Element, sources: CkNameSources): boolean {\n const attribute = (name: string): boolean => (element.getAttribute(name) ?? '').trim() !== '';\n if (attribute('aria-label') || (sources.title && attribute('title'))) {\n return true;\n }\n if (sources.text && visibleText(element) !== '') {\n return true;\n }\n const named = (node: Element | null): boolean => (node?.textContent ?? '').trim() !== '';\n const labels = (element as Partial<HTMLInputElement>).labels;\n return (\n (element.getAttribute('aria-labelledby') ?? '')\n .split(/\\s+/)\n .some((id) => id !== '' && named(element.ownerDocument.getElementById(id))) ||\n (sources.labels === true && Array.from(labels ?? []).some(named))\n );\n}\n\n/** Text that is neither in an `aria-hidden` nor in a `hidden` subtree. */\nfunction visibleText(node: Node): string {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').trim();\n }\n if (\n node instanceof Element &&\n (node.getAttribute('aria-hidden') === 'true' || node.hasAttribute('hidden'))\n ) {\n return '';\n }\n return Array.from(node.childNodes, visibleText).join('');\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAI,UAAU;AAGd,SAAgB,WAAW,QAAc;CACvC,IAAI,OAAO,WAAW,YAAY,OAAO,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AK,aAAa,QAAQ,IAE1E,OAAO;CAET,OAAO,MAAM,KAAK,KAAK,YAAY,WAAW,CAAC,CAAC,KAAK,EAAE;AACzD"}
1
+ {"version":3,"file":"ckui-core-internal.mjs","names":[],"sources":["../../../../projects/core/internal/id.ts","../../../../projects/core/internal/media.ts","../../../../projects/core/internal/announcer.ts","../../../../projects/core/internal/focus-trap.ts","../../../../projects/core/internal/icon.ts","../../../../projects/core/internal/inert.ts","../../../../projects/core/internal/value-control.ts","../../../../projects/core/internal/accessible-name.ts"],"sourcesContent":["let counter = 0;\n\n/** Returns an id that is unique within the running page, e.g. `ck-field-3`. */\nexport function createCkId(prefix: string): string {\n if (typeof prefix !== 'string' || prefix.trim() === '') {\n throw new TypeError('createCkId needs a non-empty prefix string.');\n }\n counter += 1;\n return `${prefix}-${counter}`;\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { CK_CONFIG } from '@ckui/core';\n\n/** Viewport and user-preference signals. All `false` on the server, where nothing can match. */\n@Injectable({ providedIn: 'root' })\nexport class CkMedia {\n private readonly breakpointObserver = inject(BreakpointObserver);\n private readonly config = inject(CK_CONFIG);\n\n /** `(pointer: coarse)` */\n readonly coarsePointer: Signal<boolean> = this.watch('(pointer: coarse)');\n /** Viewport narrower than `CK_CONFIG.sheetBreakpoint`. */\n readonly narrow: Signal<boolean> = this.watch(\n `(max-width: ${this.config.sheetBreakpoint - 0.02}px)`,\n );\n /** `(prefers-reduced-motion: reduce)` */\n readonly reducedMotion: Signal<boolean> = this.watch('(prefers-reduced-motion: reduce)');\n /** Coarse pointer and a narrow viewport: overlays render as sheets. */\n readonly sheet: Signal<boolean> = computed(() => this.coarsePointer() && this.narrow());\n\n private watch(query: string): Signal<boolean> {\n const state = toSignal(this.breakpointObserver.observe(query), {\n initialValue: { matches: this.breakpointObserver.isMatched(query), breakpoints: {} },\n });\n return computed(() => state().matches);\n }\n}\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { _CdkPrivateStyleLoader, _VisuallyHiddenLoader } from '@angular/cdk/private';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Injectable, PLATFORM_ID, inject } from '@angular/core';\n\ntype Politeness = 'polite' | 'assertive';\n\ninterface Pending {\n readonly message: string;\n readonly politeness: Politeness;\n}\n\n/** Joins messages in order, with \". \" unless the earlier one already ends in punctuation. */\nfunction join(messages: readonly string[]): string {\n return messages.reduce((text, message) => {\n const trimmed = message.trim();\n if (text === '') {\n return trimmed;\n }\n return /[.!?:;,]$/.test(text) ? `${text} ${trimmed}` : `${text}. ${trimmed}`;\n }, '');\n}\n\n/** A message handed to the live region this recently (ms) may not have been read out yet. */\nconst READ_OUT_WINDOW = 150;\n\n/**\n * Screen-reader announcements through one shared live region. The CDK live region keeps only the\n * last message, so announcements made in the same tick are collected and spoken as one message, in\n * order (joined with \". \"); it is assertive if any of them is. A batch that follows within 150 ms\n * of the previous hand-over (the previous one may not be read out yet, and the CDK would replace\n * it) is spoken together with the previous text, again in order and assertive if either is; after\n * a longer pause only the new text is written. The region is hidden visually by the CDK styles,\n * which this service loads itself.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkAnnouncer {\n private readonly liveAnnouncer = inject(LiveAnnouncer);\n private pending: Pending[] = [];\n private waiters: (() => void)[] = [];\n private scheduled = false;\n private readonly view = inject(DOCUMENT).defaultView;\n private last: (Pending & { at: number }) | null = null;\n\n constructor() {\n if (isPlatformBrowser(inject(PLATFORM_ID))) {\n inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);\n }\n }\n\n /**\n * Resolves once the message is in the live region. A blank message does nothing. Messages from\n * the same tick share one live-region update and one promise result.\n */\n announce(message: string, politeness: Politeness = 'polite'): Promise<void> {\n if (typeof message !== 'string' || message.trim() === '') {\n return Promise.resolve();\n }\n this.pending.push({ message, politeness });\n const done = new Promise<void>((resolve) => this.waiters.push(resolve));\n if (!this.scheduled) {\n this.scheduled = true;\n queueMicrotask(() => this.flush());\n }\n return done;\n }\n\n /** Empties the live region and drops announcements that have not been written yet. */\n clear(): void {\n this.pending = [];\n this.last = null;\n this.release();\n this.liveAnnouncer.clear();\n }\n\n private flush(): void {\n this.scheduled = false;\n const items = this.pending;\n if (items.length === 0) {\n return;\n }\n this.pending = [];\n const waiters = this.waiters;\n this.waiters = [];\n const now = this.view?.performance.now() ?? Date.now();\n const previous = this.last && now - this.last.at < READ_OUT_WINDOW ? this.last : null;\n const fresh = join(items.map((item) => item.message));\n // The same words again are repeated on their own, not stacked onto themselves.\n const all = previous && previous.message !== fresh ? [previous, ...items] : items;\n const politeness = all.some((item) => item.politeness === 'assertive') ? 'assertive' : 'polite';\n const message = all === items ? fresh : join(all.map((item) => item.message));\n this.last = { message, politeness, at: now };\n void this.liveAnnouncer\n .announce(message, politeness)\n .then(() => waiters.forEach((resolve) => resolve()));\n }\n\n private release(): void {\n const waiters = this.waiters;\n this.waiters = [];\n waiters.forEach((resolve) => resolve());\n }\n}\n","import { FocusTrap, FocusTrapFactory } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, Injector, afterNextRender, inject } from '@angular/core';\n\nexport interface CkFocusTrap {\n /**\n * Remembers the focused element, then focuses `initialFocus()` if it returns an element that takes\n * focus, else the first tabbable one inside. Resolves `false` if nothing could be focused.\n */\n activate(initialFocus?: () => HTMLElement | null): Promise<boolean>;\n /** Destroys the trap and gives focus back if the remembered element is still connected. Safe to call repeatedly. */\n release(): void;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class CkFocusTrapFactory {\n private readonly focusTrapFactory = inject(FocusTrapFactory);\n private readonly document = inject(DOCUMENT);\n private readonly injector = inject(Injector);\n\n create(element: HTMLElement): CkFocusTrap {\n const trap: FocusTrap = this.focusTrapFactory.create(element);\n const { document, injector } = this;\n let previous: HTMLElement | null = null;\n let released = false;\n\n return {\n activate: (initialFocus) => {\n if (released) {\n return Promise.resolve(false);\n }\n previous ??= document.activeElement instanceof HTMLElement ? document.activeElement : null;\n // The CDK's own deferred variant would still focus after a release in between.\n return new Promise<boolean>((resolve) => {\n afterNextRender(\n () => {\n if (released) {\n return resolve(false);\n }\n const target = initialFocus?.() ?? null;\n if (target) {\n target.focus();\n if (document.activeElement === target) {\n return resolve(true);\n }\n }\n resolve(trap.focusInitialElement());\n },\n { injector },\n );\n });\n },\n release: () => {\n if (released) {\n return;\n }\n released = true;\n trap.destroy();\n const target = previous;\n previous = null;\n if (target?.isConnected) {\n target.focus();\n }\n },\n };\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n input,\n} from '@angular/core';\n\nexport type CkIconName =\n | 'alert-octagon'\n | 'alert-triangle'\n | 'check'\n | 'chevron-down'\n | 'chevron-end'\n | 'close'\n | 'info'\n | 'minus'\n | 'plus';\n\nconst ICON_PATHS: Readonly<Record<CkIconName, string>> = {\n 'alert-octagon': 'M5.2 2h5.6L14 5.2v5.6L10.8 14H5.2L2 10.8V5.2L5.2 2zM8 5.5v3M8 11v.01',\n 'alert-triangle': 'M8 2.5l6 10.5H2L8 2.5zM8 6.5v3M8 11.5v.01',\n check: 'M3 8.5l3.5 3.5L13 4.5',\n 'chevron-down': 'M4 6l4 4 4-4',\n 'chevron-end': 'M6 4l4 4-4 4',\n close: 'M4 4l8 8M12 4l-8 8',\n info: 'M8 14A6 6 0 108 2a6 6 0 000 12zM8 7.5v3.5M8 5v.01',\n minus: 'M3.5 8h9',\n plus: 'M8 3.5v9M3.5 8h9',\n};\n\n/** Decorative icon at the surrounding font size and colour. The control carries its own accessible name. */\n@Component({\n selector: 'ck-icon',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-icon',\n 'aria-hidden': 'true',\n '[class.ck-icon--mirror]': 'name() === \"chevron-end\"',\n },\n template: `\n <svg\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n focusable=\"false\"\n >\n <path [attr.d]=\"path()\" />\n </svg>\n `,\n styles: `\n @layer ckui {\n .ck-icon {\n display: inline-block;\n flex: none;\n inline-size: var(--ck-icon-size, 1em);\n block-size: var(--ck-icon-size, 1em);\n color: currentColor;\n vertical-align: -0.125em;\n }\n\n .ck-icon > svg {\n display: block;\n inline-size: 100%;\n block-size: 100%;\n }\n\n .ck-icon--mirror:dir(rtl) {\n transform: scaleX(-1);\n }\n }\n `,\n})\nexport class CkIcon {\n readonly name = input.required<CkIconName>();\n protected readonly path = computed(() => ICON_PATHS[this.name()] ?? '');\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n/** Never made inert: they render nothing, or must keep announcing while an overlay is open. */\nconst SKIPPED =\n 'script, style, link, template, noscript, [data-ck-inert-exempt], .cdk-live-announcer-element';\n\ninterface Hold {\n count: number;\n /** The `inert` attribute value the element had before the first hold; `null` if it had none. */\n original: string | null;\n}\n\n/** Reference-counted `inert`: an element stays inert until every hold on it is released. */\n@Injectable({ providedIn: 'root' })\nexport class CkInert {\n private readonly document = inject(DOCUMENT);\n private readonly holds = new Map<Element, Hold>();\n\n /**\n * Makes the elements inert and returns the release function (safe to call more than once).\n * An element that was already inert keeps its own attribute value when the last hold ends.\n */\n hold(elements: Iterable<Element>): () => void {\n const held = new Set(elements);\n for (const element of held) {\n const entry = this.holds.get(element);\n if (entry) {\n entry.count++;\n continue;\n }\n const original = element.getAttribute('inert');\n this.holds.set(element, { count: 1, original });\n if (original === null) {\n element.setAttribute('inert', '');\n }\n }\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n for (const element of held) {\n const entry = this.holds.get(element);\n if (!entry || --entry.count > 0) {\n continue;\n }\n this.holds.delete(element);\n if (entry.original === null) {\n element.removeAttribute('inert');\n }\n }\n };\n }\n\n /** Body children that an overlay hides from the user: all but `keep`, exempt elements and non-rendered tags. */\n backgroundElements(keep: Element): Element[] {\n return Array.from(this.document.body.children).filter(\n (element) => element !== keep && !element.matches(SKIPPED),\n );\n }\n}\n","import {\n Directive,\n ModelSignal,\n Provider,\n Type,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n signal,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nconst noop = (): void => undefined;\n\n/**\n * Base for components that edit one value.\n *\n * Reactive Forms, `ngModel` and Signal Forms all talk to the component through the\n * `ControlValueAccessor` registered by `provideCkValueAccessor`: Angular's `[formField]` prefers a\n * value accessor on the same node over the `value` model contract, so only that one path is ever\n * active. The `value` model and `disabled` input are for standalone use (`[(value)]`) and for the\n * template.\n *\n * `value` is `undefined` until something sets it; a subclass with a `null` default reads\n * `value() ?? null`.\n */\n@Directive()\nexport abstract class CkValueControl<T> implements ControlValueAccessor, FormValueControl<T> {\n readonly value: ModelSignal<T> = model(undefined as T);\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Only ever becomes `true` here: `markAsUntouched()` and `reset()` do not travel through a value\n * accessor. Do not style from it; read the form's own state (`ng-touched`, the field's `touched()`).\n */\n readonly touched = model(false);\n\n private readonly controlDisabled = signal(false);\n private onChange: (value: T) => void = noop;\n private onTouched: () => void = noop;\n\n /** The `disabled` input or the forms API (`control.disable()`, a disabled field) says so. */\n protected readonly isDisabled = computed(() => this.disabled() || this.controlDisabled());\n\n writeValue(value: T): void {\n this.value.set(value);\n }\n\n registerOnChange(onChange: (value: T) => void): void {\n this.onChange = onChange;\n }\n\n registerOnTouched(onTouched: () => void): void {\n this.onTouched = onTouched;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.controlDisabled.set(isDisabled);\n }\n\n /** A change made by the user. Ignored while disabled or when the value is the current one. */\n protected commit(value: T): void {\n if (this.isDisabled() || Object.is(value, this.value())) {\n return;\n }\n this.value.set(value);\n this.onChange(value);\n }\n\n /** Call when focus leaves the whole control, not a part of it. */\n protected markTouched(): void {\n this.touched.set(true);\n this.onTouched();\n }\n}\n\n/** Registers the component as a value accessor: `providers: [provideCkValueAccessor(CkSegmented)]`. */\nexport function provideCkValueAccessor(type: Type<unknown>): Provider {\n return { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => type), multi: true };\n}\n","export interface CkNameSources {\n /** Count `title` as a name. */\n readonly title: boolean;\n /** Count the element's own visible text (not `aria-hidden` or `hidden` parts). */\n readonly text: boolean;\n /** Count the text of the `<label>` elements of a form control. */\n readonly labels?: boolean;\n}\n\n/** Whether the element has an accessible name: a label attribute, a label reference or readable text. */\nexport function hasAccessibleName(element: Element, sources: CkNameSources): boolean {\n const attribute = (name: string): boolean => (element.getAttribute(name) ?? '').trim() !== '';\n if (attribute('aria-label') || (sources.title && attribute('title'))) {\n return true;\n }\n if (sources.text && visibleText(element) !== '') {\n return true;\n }\n const named = (node: Element | null): boolean => (node?.textContent ?? '').trim() !== '';\n const labels = (element as Partial<HTMLInputElement>).labels;\n return (\n (element.getAttribute('aria-labelledby') ?? '')\n .split(/\\s+/)\n .some((id) => id !== '' && named(element.ownerDocument.getElementById(id))) ||\n (sources.labels === true && Array.from(labels ?? []).some(named))\n );\n}\n\n/** Text that is neither in an `aria-hidden` nor in a `hidden` subtree. */\nfunction visibleText(node: Node): string {\n if (node.nodeType === Node.TEXT_NODE) {\n return (node.textContent ?? '').trim();\n }\n if (\n node instanceof Element &&\n (node.getAttribute('aria-hidden') === 'true' || node.hasAttribute('hidden'))\n ) {\n return '';\n }\n return Array.from(node.childNodes, visibleText).join('');\n}\n"],"mappings":";;;;;;;;;AAAA,IAAI,UAAU;AAGd,SAAgB,WAAW,QAAc;CACvC,IAAI,OAAO,WAAW,YAAY,OAAO,KAAI,MAAO,IAClD,MAAM,IAAI,UAAU,6CAA6C;CAEnE,WAAW;CACX,OAAO,GAAG,OAAM,GAAI;AACtB;ACFA,IAAa,UAAb,MAAa,QAAO;CACD,q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,SAAS,UAAU,OAAO,GAChE,OAAO;CAET,IAAI,QAAQ,QAAQ,YAAY,OAAO,MAAM,IAC3C,OAAO;CAET,MAAM,SAAS,UAAmC,MAAM,eAAe,GAAA,CAAI,KAAI,MAAO;CACtF,MAAM,SAAU,QAAsC;CACtD,QACG,QAAQ,aAAa,iBAAiB,KAAK,GAAA,CACzC,MAAM,KAAK,CAAC,CACZ,MAAM,OAAO,OAAO,MAAM,MAAM,QAAQ,cAAc,eAAe,EAAE,CAAC,CAAC,KAC3E,QAAQ,WAAW,QAAQ,MAAM,KAAK,UAAU,CAAA,CAAE,CAAC,CAAC,KAAK,KAAK;AAEnE;AAGA,SAAS,YAAY,MAAU;CAC7B,IAAI,KAAK,aAAa,KAAK,WACzB,QAAQ,KAAK,eAAe,GAAA,CAAI,KAAI;CAEtC,IACE,gBAAgB,YACf,KAAK,aAAa,aAAa,MAAM,UAAU,KAAK,aAAa,QAAQ,IAE1E,OAAO;CAET,OAAO,MAAM,KAAK,KAAK,YAAY,WAAW,CAAC,CAAC,KAAK,EAAE;AACzD"}
@@ -0,0 +1,165 @@
1
+ import { isPlatformBrowser } from "@angular/common";
2
+ import * as i0 from "@angular/core";
3
+ import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, computed, effect, inject, input } from "@angular/core";
4
+ import { hasAccessibleName } from "@ckui/core/internal";
5
+ const DEFAULT_MAX = 100;
6
+ const isValidMax = (max) => typeof max === "number" && Number.isFinite(max) && max > 0;
7
+ var CkProgress = class CkProgress {
8
+ value = input(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
9
+ max = input(DEFAULT_MAX, ...ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []);
10
+ valueText = input(void 0, ...ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []);
11
+ element = inject(ElementRef).nativeElement;
12
+ limit = computed(() => {
13
+ const max = this.max();
14
+ return isValidMax(max) ? max : DEFAULT_MAX;
15
+ }, ...ngDevMode ? [{ debugName: "limit" }] : /* istanbul ignore next */ []);
16
+ current = computed(() => {
17
+ const value = this.value();
18
+ if (typeof value !== "number" || Number.isNaN(value)) return null;
19
+ return Math.min(Math.max(value, 0), this.limit());
20
+ }, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
21
+ indeterminate = computed(() => this.current() === null, ...ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []);
22
+ fraction = computed(() => (this.current() ?? 0) / this.limit(), ...ngDevMode ? [{ debugName: "fraction" }] : /* istanbul ignore next */ []);
23
+ constructor() {
24
+ if (typeof ngDevMode !== "undefined" && ngDevMode && isPlatformBrowser(inject(PLATFORM_ID))) {
25
+ let destroyed = false;
26
+ inject(DestroyRef).onDestroy(() => destroyed = true);
27
+ let warnedMax = false;
28
+ effect(() => {
29
+ const max = this.max();
30
+ if (!warnedMax && !destroyed && !isValidMax(max)) {
31
+ warnedMax = true;
32
+ console.warn(`[ckui] ck-progress got max=${String(max)}, which is not a number above 0. It counts as ${DEFAULT_MAX}.`, this.element);
33
+ }
34
+ });
35
+ afterNextRender(() => {
36
+ if (!destroyed && !hasAccessibleName(this.element, {
37
+ title: false,
38
+ text: false
39
+ })) console.warn("[ckui] ck-progress has no accessible name. Add an aria-label or aria-labelledby.", this.element);
40
+ });
41
+ }
42
+ }
43
+ static ɵfac = i0.ɵɵngDeclareFactory({
44
+ minVersion: "12.0.0",
45
+ version: "22.2.4",
46
+ ngImport: i0,
47
+ type: CkProgress,
48
+ deps: [],
49
+ target: i0.ɵɵFactoryTarget.Component
50
+ });
51
+ static ɵcmp = i0.ɵɵngDeclareComponent({
52
+ minVersion: "17.0.0",
53
+ version: "22.2.4",
54
+ type: CkProgress,
55
+ isStandalone: true,
56
+ selector: "ck-progress",
57
+ inputs: {
58
+ value: {
59
+ classPropertyName: "value",
60
+ publicName: "value",
61
+ isSignal: true,
62
+ isRequired: false,
63
+ transformFunction: null
64
+ },
65
+ max: {
66
+ classPropertyName: "max",
67
+ publicName: "max",
68
+ isSignal: true,
69
+ isRequired: false,
70
+ transformFunction: null
71
+ },
72
+ valueText: {
73
+ classPropertyName: "valueText",
74
+ publicName: "valueText",
75
+ isSignal: true,
76
+ isRequired: false,
77
+ transformFunction: null
78
+ }
79
+ },
80
+ host: {
81
+ attributes: {
82
+ "role": "progressbar",
83
+ "aria-valuemin": "0"
84
+ },
85
+ properties: {
86
+ "class.ck-progress--indeterminate": "indeterminate()",
87
+ "attr.aria-valuemax": "limit()",
88
+ "attr.aria-valuenow": "current()",
89
+ "attr.aria-valuetext": "valueText() || null",
90
+ "style.--_ck-progress-fraction": "fraction()"
91
+ },
92
+ classAttribute: "ck-progress"
93
+ },
94
+ ngImport: i0,
95
+ template: `@if (indeterminate()) {
96
+ <span class="ck-progress__fill ck-progress__fill--slide"></span>
97
+ } @else {
98
+ <span class="ck-progress__fill"></span>
99
+ }`,
100
+ isInline: true,
101
+ styles: ["@layer ckui{.ck-progress{--_ck-progress-direction: 1;position:relative;display:block;box-sizing:border-box;inline-size:100%;block-size:var(--ck-progress-thickness, var(--ck-space-1));overflow:hidden;border-radius:var(--ck-progress-radius, var(--ck-radius-full));background:var(--ck-progress-track, var(--ck-color-control));color-scheme:var(--ck-color-scheme)}.ck-progress:dir(rtl){--_ck-progress-direction: -1}.ck-progress__fill{position:absolute;inset:0;border-radius:inherit;background:var(--ck-progress-fill, var(--ck-color-primary));transform:scaleX(var(--_ck-progress-fraction, 0));transform-origin:left center;transition:transform var(--ck-duration-normal) var(--ck-ease-standard)}.ck-progress:dir(rtl)>.ck-progress__fill{transform-origin:right center}.ck-progress--indeterminate>.ck-progress__fill{inset-inline-end:auto;inline-size:40%;transform:translate(calc(var(--_ck-progress-direction) * -100%));transition:none;animation:ck-progress-slide calc(var(--ck-duration-slow) * 5) var(--ck-ease-standard) infinite}@keyframes ck-progress-slide{0%{transform:translate(calc(var(--_ck-progress-direction) * -100%))}to{transform:translate(calc(var(--_ck-progress-direction) * 250%))}}@media(prefers-reduced-motion:reduce){.ck-progress__fill{transition:none}.ck-progress--indeterminate>.ck-progress__fill{inline-size:50%;transform:none;animation:none}}@media(forced-colors:active){.ck-progress{outline:1px solid CanvasText}.ck-progress__fill{forced-color-adjust:none;background:Highlight}}}\n"],
102
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
103
+ encapsulation: i0.ViewEncapsulation.None
104
+ });
105
+ };
106
+ i0.ɵɵngDeclareClassMetadata({
107
+ minVersion: "12.0.0",
108
+ version: "22.2.4",
109
+ ngImport: i0,
110
+ type: CkProgress,
111
+ decorators: [{
112
+ type: Component,
113
+ args: [{
114
+ selector: "ck-progress",
115
+ changeDetection: ChangeDetectionStrategy.OnPush,
116
+ encapsulation: ViewEncapsulation.None,
117
+ host: {
118
+ class: "ck-progress",
119
+ role: "progressbar",
120
+ "aria-valuemin": "0",
121
+ "[class.ck-progress--indeterminate]": "indeterminate()",
122
+ "[attr.aria-valuemax]": "limit()",
123
+ "[attr.aria-valuenow]": "current()",
124
+ "[attr.aria-valuetext]": "valueText() || null",
125
+ "[style.--_ck-progress-fraction]": "fraction()"
126
+ },
127
+ template: `@if (indeterminate()) {
128
+ <span class="ck-progress__fill ck-progress__fill--slide"></span>
129
+ } @else {
130
+ <span class="ck-progress__fill"></span>
131
+ }`,
132
+ styles: ["@layer ckui{.ck-progress{--_ck-progress-direction: 1;position:relative;display:block;box-sizing:border-box;inline-size:100%;block-size:var(--ck-progress-thickness, var(--ck-space-1));overflow:hidden;border-radius:var(--ck-progress-radius, var(--ck-radius-full));background:var(--ck-progress-track, var(--ck-color-control));color-scheme:var(--ck-color-scheme)}.ck-progress:dir(rtl){--_ck-progress-direction: -1}.ck-progress__fill{position:absolute;inset:0;border-radius:inherit;background:var(--ck-progress-fill, var(--ck-color-primary));transform:scaleX(var(--_ck-progress-fraction, 0));transform-origin:left center;transition:transform var(--ck-duration-normal) var(--ck-ease-standard)}.ck-progress:dir(rtl)>.ck-progress__fill{transform-origin:right center}.ck-progress--indeterminate>.ck-progress__fill{inset-inline-end:auto;inline-size:40%;transform:translate(calc(var(--_ck-progress-direction) * -100%));transition:none;animation:ck-progress-slide calc(var(--ck-duration-slow) * 5) var(--ck-ease-standard) infinite}@keyframes ck-progress-slide{0%{transform:translate(calc(var(--_ck-progress-direction) * -100%))}to{transform:translate(calc(var(--_ck-progress-direction) * 250%))}}@media(prefers-reduced-motion:reduce){.ck-progress__fill{transition:none}.ck-progress--indeterminate>.ck-progress__fill{inline-size:50%;transform:none;animation:none}}@media(forced-colors:active){.ck-progress{outline:1px solid CanvasText}.ck-progress__fill{forced-color-adjust:none;background:Highlight}}}\n"]
133
+ }]
134
+ }],
135
+ ctorParameters: () => [],
136
+ propDecorators: {
137
+ value: [{
138
+ type: i0.Input,
139
+ args: [{
140
+ isSignal: true,
141
+ alias: "value",
142
+ required: false
143
+ }]
144
+ }],
145
+ max: [{
146
+ type: i0.Input,
147
+ args: [{
148
+ isSignal: true,
149
+ alias: "max",
150
+ required: false
151
+ }]
152
+ }],
153
+ valueText: [{
154
+ type: i0.Input,
155
+ args: [{
156
+ isSignal: true,
157
+ alias: "valueText",
158
+ required: false
159
+ }]
160
+ }]
161
+ }
162
+ });
163
+ export { CkProgress };
164
+
165
+ //# sourceMappingURL=ckui-core-progress.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ckui-core-progress.mjs","names":[],"sources":["../../../../projects/core/progress/progress.ts"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport { hasAccessibleName } from '@ckui/core/internal';\n\ndeclare const ngDevMode: unknown;\n\nconst DEFAULT_MAX = 100;\n\nconst isValidMax = (max: unknown): max is number =>\n typeof max === 'number' && Number.isFinite(max) && max > 0;\n\n/**\n * A horizontal progress bar. A number `value` fills the track up to `value / max`; `null` (or a\n * value that is not a number) shows an indeterminate bar. It is not a live region: announce\n * milestones yourself.\n */\n@Component({\n selector: 'ck-progress',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-progress',\n role: 'progressbar',\n 'aria-valuemin': '0',\n '[class.ck-progress--indeterminate]': 'indeterminate()',\n '[attr.aria-valuemax]': 'limit()',\n '[attr.aria-valuenow]': 'current()',\n '[attr.aria-valuetext]': 'valueText() || null',\n '[style.--_ck-progress-fraction]': 'fraction()',\n },\n // Two elements, so a switch between the two states starts the fill from its final style, not\n // from the sliding segment's transform and width.\n template: `@if (indeterminate()) {\n <span class=\"ck-progress__fill ck-progress__fill--slide\"></span>\n } @else {\n <span class=\"ck-progress__fill\"></span>\n }`,\n styleUrl: './progress.css',\n})\nexport class CkProgress {\n /**\n * The progress, from 0 to `max`. Below 0 counts as 0 and above `max` as `max`. `null`,\n * `undefined` and `NaN` show an indeterminate bar without `aria-valuenow`.\n */\n readonly value = input<number | null | undefined>(null);\n /** The value that means done. Anything that is not a number above 0 counts as 100. */\n readonly max = input<number>(DEFAULT_MAX);\n /** Text for `aria-valuetext`, such as \"Step 2 of 7\". Without it assistive technology reads the percentage. */\n readonly valueText = input<string | undefined>(undefined);\n\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n\n /** @internal */\n protected readonly limit = computed(() => {\n const max = this.max();\n return isValidMax(max) ? max : DEFAULT_MAX;\n });\n\n /** The clamped value, or `null` while the bar is indeterminate. */\n protected readonly current = computed<number | null>(() => {\n const value = this.value();\n if (typeof value !== 'number' || Number.isNaN(value)) {\n return null;\n }\n return Math.min(Math.max(value, 0), this.limit());\n });\n\n protected readonly indeterminate = computed(() => this.current() === null);\n protected readonly fraction = computed(() => (this.current() ?? 0) / this.limit());\n\n constructor() {\n if (typeof ngDevMode !== 'undefined' && ngDevMode && isPlatformBrowser(inject(PLATFORM_ID))) {\n let destroyed = false;\n inject(DestroyRef).onDestroy(() => (destroyed = true));\n let warnedMax = false;\n effect(() => {\n const max = this.max();\n if (!warnedMax && !destroyed && !isValidMax(max)) {\n warnedMax = true;\n console.warn(\n `[ckui] ck-progress got max=${String(max)}, which is not a number above 0. It counts as ${DEFAULT_MAX}.`,\n this.element,\n );\n }\n });\n afterNextRender(() => {\n if (!destroyed && !hasAccessibleName(this.element, { title: false, text: false })) {\n console.warn(\n '[ckui] ck-progress has no accessible name. Add an aria-label or aria-labelledby.',\n this.element,\n );\n }\n });\n }\n }\n}\n"],"mappings":";;;;AAkBA,MAAM,cAAc;AAEpB,MAAM,cAAc,QAClB,OAAO,QAAQ,YAAY,OAAO,SAAS,GAAG,KAAK,MAAM;AA8B3D,IAAa,aAAb,MAAa,WAAU;CAKZ,QAAQ,MAAiC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAE9C,MAAM,MAAc,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CAEhC,YAAY,MAA0B,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAExC,UAAU,OAAgC,UAAU,CAAC,CAAC;CAGpD,QAAQ,eAAc;EACvC,MAAM,MAAM,KAAK,IAAG;EACpB,OAAO,WAAW,GAAG,IAAI,MAAM;CACjC,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGiB,UAAU,eAA6B;EACxD,MAAM,QAAQ,KAAK,MAAK;EACxB,IAAI,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,GACjD,OAAO;EAET,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,KAAK,MAAK,CAAE;CAClD,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAEiB,gBAAgB,eAAe,K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