@ckui/core 0.1.0-next.0 → 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.
- package/README.md +239 -0
- package/fesm2022/ckui-core-badge.mjs +169 -0
- package/fesm2022/ckui-core-badge.mjs.map +1 -0
- package/fesm2022/ckui-core-button.mjs +5 -13
- package/fesm2022/ckui-core-button.mjs.map +1 -1
- package/fesm2022/ckui-core-dialog.mjs +908 -0
- package/fesm2022/ckui-core-dialog.mjs.map +1 -0
- package/fesm2022/ckui-core-field.mjs +6 -10
- package/fesm2022/ckui-core-field.mjs.map +1 -1
- package/fesm2022/ckui-core-internal-overlay.mjs +468 -0
- package/fesm2022/ckui-core-internal-overlay.mjs.map +1 -0
- package/fesm2022/ckui-core-internal.mjs +271 -8
- package/fesm2022/ckui-core-internal.mjs.map +1 -1
- package/fesm2022/ckui-core-progress.mjs +165 -0
- package/fesm2022/ckui-core-progress.mjs.map +1 -0
- package/fesm2022/ckui-core-segmented.mjs +528 -0
- package/fesm2022/ckui-core-segmented.mjs.map +1 -0
- package/fesm2022/ckui-core-stepper.mjs +842 -0
- package/fesm2022/ckui-core-stepper.mjs.map +1 -0
- package/fesm2022/ckui-core-toast.mjs +883 -0
- package/fesm2022/ckui-core-toast.mjs.map +1 -0
- package/fesm2022/ckui-core.mjs +5 -1
- package/fesm2022/ckui-core.mjs.map +1 -1
- package/package.json +29 -1
- package/styles/tokens.css +3 -0
- package/types/ckui-core-badge.d.ts +44 -0
- package/types/ckui-core-button.d.ts +0 -1
- package/types/ckui-core-dialog.d.ts +219 -0
- package/types/ckui-core-field.d.ts +0 -1
- package/types/ckui-core-internal-overlay.d.ts +76 -0
- package/types/ckui-core-internal.d.ts +115 -8
- package/types/ckui-core-progress.d.ts +43 -0
- package/types/ckui-core-segmented.d.ts +124 -0
- package/types/ckui-core-stepper.d.ts +186 -0
- package/types/ckui-core-toast.d.ts +97 -0
- package/types/ckui-core.d.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ckui-core-toast.mjs","names":[],"sources":["../../../../projects/core/toast/config.ts","../../../../projects/core/toast/toast-ref.ts","../../../../projects/core/toast/toast-store.ts","../../../../projects/core/toast/toast-item.ts","../../../../projects/core/toast/toast-host.ts","../../../../projects/core/toast/toast.service.ts"],"sourcesContent":["import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\nimport { CK_SIZES, CkSize } from '@ckui/core';\n\nexport type CkToastPosition = 'top' | 'bottom';\nexport type CkToastAlign = 'center' | 'end';\n\nexport interface CkToastConfig {\n /** Screen edge the toasts stack against. Default `bottom`. */\n position?: CkToastPosition;\n /** Default `center` on a narrow viewport and `end` otherwise, decided each time the stack is laid out. */\n align?: CkToastAlign;\n /** Toasts shown at once; later ones wait until a slot frees. A positive whole number, default 3. */\n max?: number;\n /** Size of the action and dismiss buttons. Default: the size from `provideCkui`. */\n size?: CkSize;\n}\n\nexport const DEFAULT_MAX = 3;\n\n/** The resolved options; `undefined` means \"decide when the toast is shown\". */\nexport const CK_TOAST_CONFIG = new InjectionToken<CkToastConfig>('CK_TOAST_CONFIG', {\n providedIn: 'root',\n factory: () => ({}),\n});\n\n/** Configures where toasts appear, how many show at once and the size of their buttons. */\nexport function provideCkToast(config: CkToastConfig = {}): EnvironmentProviders {\n const { position, align, max, size } = config;\n if (position !== undefined && position !== 'top' && position !== 'bottom') {\n throw new TypeError(`provideCkToast: position must be \"top\" or \"bottom\", got \"${position}\".`);\n }\n if (align !== undefined && align !== 'center' && align !== 'end') {\n throw new TypeError(`provideCkToast: align must be \"center\" or \"end\", got \"${align}\".`);\n }\n if (max !== undefined && (typeof max !== 'number' || !Number.isInteger(max) || max < 1)) {\n throw new TypeError(\n `provideCkToast: max must be a whole number of at least 1, got ${String(max)}.`,\n );\n }\n if (size !== undefined && !CK_SIZES.includes(size)) {\n throw new TypeError(\n `provideCkToast: size must be one of ${CK_SIZES.join(', ')}, got \"${size}\".`,\n );\n }\n return makeEnvironmentProviders([\n { provide: CK_TOAST_CONFIG, useValue: { position, align, max, size } satisfies CkToastConfig },\n ]);\n}\n","export type CkToastTone = 'neutral' | 'success' | 'warning' | 'danger';\n\nexport type CkToastDismissReason = 'timeout' | 'user' | 'action' | 'replaced' | 'programmatic';\n\nexport interface CkToastAction {\n /** Visible label and accessible name of the button. */\n label: string;\n /** Runs when the button is activated; the toast then closes with the reason `action`. */\n run: () => void;\n}\n\nexport interface CkToastOptions {\n /** Plain text; it is never parsed as HTML. */\n message: string;\n title?: string;\n /** Default `neutral`. */\n tone?: CkToastTone;\n action?: CkToastAction;\n /**\n * Milliseconds until the toast closes by itself. Default 5000. A toast with an `action` or tone\n * `danger` stays until dismissed unless a duration is given. `null`, `0`, a negative or a\n * non-finite number mean \"stay until dismissed\".\n */\n duration?: number | null;\n /** A toast with the id of one that is still open replaces it in place instead of stacking. */\n id?: string;\n}\n\n/** What a `CkToastRef` calls into; supplied by `CkToast`, not by consumers. */\nexport interface CkToastRefControls {\n readonly dismissed: Promise<CkToastDismissReason>;\n dismiss(): void;\n update(options: Partial<CkToastOptions>): void;\n}\n\n/** Controls one toast. Returned by `CkToast.show`; never constructed directly. */\nexport class CkToastRef {\n /** Resolves once, with the reason the toast closed. `replaced` when a toast with the same `id` took its place. */\n readonly dismissed: Promise<CkToastDismissReason>;\n private readonly controls: CkToastRefControls;\n\n constructor(controls: CkToastRefControls) {\n this.controls = controls;\n this.dismissed = controls.dismissed;\n }\n\n /** Closes the toast with the reason `programmatic`. Does nothing once it is closed or replaced. */\n dismiss(): void {\n this.controls.dismiss();\n }\n\n /**\n * Changes the shown content and restarts the timer. A key passed as `undefined` removes the title\n * or action, or restores the default duration; `id` cannot change. Text that changes is announced\n * again. Does nothing once the toast is closed or replaced.\n */\n update(options: Partial<CkToastOptions>): void {\n this.controls.update(options);\n }\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { Injectable, PLATFORM_ID, WritableSignal, computed, inject, signal } from '@angular/core';\nimport { CK_CONFIG, CkSize } from '@ckui/core';\nimport { CkAnnouncer } from '@ckui/core/internal';\nimport { CK_TOAST_CONFIG, CkToastPosition, DEFAULT_MAX } from './config';\nimport {\n CkToastAction,\n CkToastDismissReason,\n CkToastOptions,\n CkToastRef,\n CkToastTone,\n} from './toast-ref';\n\ndeclare const ngDevMode: unknown;\n\nexport const DEFAULT_DURATION = 5000;\n/** After a pause at least this much time is left, so a toast never vanishes the instant the pointer leaves it. */\nexport const MIN_RESUME = 1000;\n/** The longest delay `setTimeout` accepts; a longer duration counts as \"until dismissed\". */\nexport const MAX_DURATION = 2_147_483_647;\n\nconst TONES: readonly CkToastTone[] = ['neutral', 'success', 'warning', 'danger'];\n\n/** A toast's content after validation. */\nexport interface ToastContent {\n readonly message: string;\n readonly title: string | undefined;\n readonly tone: CkToastTone;\n readonly action: CkToastAction | undefined;\n readonly duration: number | null | undefined;\n}\n\nexport type ToastPhase = 'queued' | 'visible' | 'leaving';\n\nexport class ToastEntry {\n readonly content: WritableSignal<ToastContent>;\n readonly phase = signal<ToastPhase>('queued');\n /** Set when the user swiped the toast away, so it fades out where it is. */\n readonly swiped = signal(false);\n /** The rendered item, set by the item itself; used to move focus away before it leaves. */\n element: HTMLElement | null = null;\n /** The ref that currently controls this toast; an older one was replaced. */\n ref!: CkToastRef;\n /** Settles the current ref's `dismissed`. */\n settle: (reason: CkToastDismissReason) => void = () => undefined;\n timer: ReturnType<typeof setTimeout> | undefined;\n remaining: number | null = null;\n startedAt = 0;\n readonly pauses = new Set<string>();\n announced = '';\n\n constructor(\n /** Unique per stack entry; the key of the rendered item. */\n readonly key: number,\n /** The consumer's `id`, if any. */\n readonly id: string | undefined,\n content: ToastContent,\n ) {\n this.content = signal(content);\n }\n}\n\nfunction present(value: unknown): value is string {\n return typeof value === 'string' && value.trim() !== '';\n}\n\nfunction normaliseAction(action: unknown): CkToastAction | undefined {\n const candidate = action as Partial<CkToastAction> | null | undefined;\n return candidate && present(candidate.label) && typeof candidate.run === 'function'\n ? { label: candidate.label, run: candidate.run }\n : undefined;\n}\n\n/** The validated content, or `null` when there is nothing to show. */\nfunction normalise(options: unknown): ToastContent | null {\n const source = (typeof options === 'object' && options !== null ? options : {}) as Record<\n string,\n unknown\n >;\n const title = present(source['title']) ? source['title'] : undefined;\n const message = typeof source['message'] === 'string' ? source['message'] : '';\n if (message.trim() === '' && title === undefined) {\n return null;\n }\n const duration = source['duration'];\n return {\n message,\n title,\n tone: TONES.includes(source['tone'] as CkToastTone)\n ? (source['tone'] as CkToastTone)\n : 'neutral',\n action: normaliseAction(source['action']),\n duration: typeof duration === 'number' || duration === null ? duration : undefined,\n };\n}\n\n/** Milliseconds until the toast closes by itself, or `null` when it stays until dismissed. */\nexport function effectiveDuration(content: ToastContent): number | null {\n const { duration } = content;\n if (duration === null) {\n return null;\n }\n if (typeof duration === 'number') {\n return Number.isFinite(duration) && duration > 0 && duration <= MAX_DURATION ? duration : null;\n }\n return content.action !== undefined || content.tone === 'danger' ? null : DEFAULT_DURATION;\n}\n\nexport function announcementOf(content: ToastContent): string {\n const { title, message } = content;\n if (title === undefined) {\n return message;\n }\n if (message.trim() === '') {\n return title;\n }\n return /[.!?:]$/.test(title.trim()) ? `${title} ${message}` : `${title}. ${message}`;\n}\n\n/** The state of every open toast: queue, timers, announcements. The host and the items render it. */\n@Injectable({ providedIn: 'root' })\nexport class CkToastStore {\n private readonly document = inject(DOCUMENT);\n private readonly announcer = inject(CkAnnouncer);\n private readonly config = inject(CK_TOAST_CONFIG);\n private readonly ckConfig = inject(CK_CONFIG);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** Every toast in the order shown, leaving ones included until their animation ends. */\n readonly entries = signal<readonly ToastEntry[]>([]);\n readonly position: CkToastPosition = this.config.position ?? 'bottom';\n readonly max: number = this.config.max ?? DEFAULT_MAX;\n readonly alignOverride = this.config.align;\n readonly size = computed<CkSize>(() => this.config.size ?? this.ckConfig.size);\n\n /** Called just before a visible toast starts leaving, while its element can still hold focus. */\n beforeLeave: ((entry: ToastEntry) => void) | null = null;\n\n private nextKey = 0;\n private listening = false;\n private destroyed = false;\n\n show(options: CkToastOptions): CkToastRef {\n const content = normalise(options);\n if (!this.isBrowser || this.destroyed || content === null) {\n if (content === null && typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn('[ckui] CkToast.show needs a message or a title, nothing was shown.');\n }\n return this.settledRef();\n }\n const id = present(options.id) ? options.id : undefined;\n const existing =\n id === undefined\n ? undefined\n : this.entries().find((entry) => entry.id === id && entry.phase() !== 'leaving');\n if (existing) {\n this.replace(existing, content);\n return existing.ref;\n }\n this.listen();\n const entry = new ToastEntry(this.nextKey++, id, content);\n this.bind(entry);\n this.entries.update((entries) => [...entries, entry]);\n this.promote();\n return entry.ref;\n }\n\n /** Queued toasts go first and quietly, so closing the visible ones promotes and announces nothing. */\n dismissAll(): void {\n const all = [...this.entries()];\n const queued = all.filter((entry) => entry.phase() === 'queued');\n for (const entry of queued) {\n this.clearTimer(entry);\n entry.settle('programmatic');\n }\n if (queued.length > 0) {\n this.entries.update((entries) => entries.filter((entry) => !queued.includes(entry)));\n }\n for (const entry of all) {\n if (!queued.includes(entry)) {\n this.dismiss(entry, 'programmatic');\n }\n }\n }\n\n dismiss(entry: ToastEntry, reason: CkToastDismissReason, swiped = false): void {\n const phase = entry.phase();\n if (phase === 'leaving') {\n return;\n }\n this.clearTimer(entry);\n entry.settle(reason);\n if (phase === 'queued') {\n this.remove(entry);\n return;\n }\n this.beforeLeave?.(entry);\n entry.swiped.set(swiped);\n entry.phase.set('leaving');\n this.promote();\n }\n\n /** Takes the entry out once it has left the screen. */\n remove(entry: ToastEntry): void {\n this.clearTimer(entry);\n if (this.entries().includes(entry)) {\n this.entries.update((entries) => entries.filter((other) => other !== entry));\n }\n }\n\n pause(entry: ToastEntry, reason: string): void {\n entry.pauses.add(reason);\n if (entry.timer !== undefined && entry.remaining !== null) {\n clearTimeout(entry.timer);\n entry.timer = undefined;\n entry.remaining = Math.max(entry.remaining - (Date.now() - entry.startedAt), MIN_RESUME);\n }\n }\n\n resume(entry: ToastEntry, reason: string): void {\n if (entry.pauses.delete(reason)) {\n this.arm(entry);\n }\n }\n\n /** Closes everything without animation and stops listening; used when the app is destroyed. */\n teardown(): void {\n this.destroyed = true;\n this.beforeLeave = null;\n for (const entry of this.entries()) {\n this.clearTimer(entry);\n entry.settle('programmatic');\n entry.phase.set('leaving');\n }\n this.entries.set([]);\n if (this.listening) {\n this.listening = false;\n this.document.removeEventListener('visibilitychange', this.onVisibilityChange);\n }\n }\n\n /** Gives the entry a fresh ref; the previous ref of a replaced toast has already been settled. */\n private bind(entry: ToastEntry): void {\n let resolve: (reason: CkToastDismissReason) => void = () => undefined;\n const dismissed = new Promise<CkToastDismissReason>((done) => (resolve = done));\n const ref: CkToastRef = new CkToastRef({\n dismissed,\n dismiss: () => {\n if (entry.ref === ref) {\n this.dismiss(entry, 'programmatic');\n }\n },\n update: (partial) => {\n if (entry.ref === ref) {\n this.update(entry, partial);\n }\n },\n });\n entry.ref = ref;\n entry.settle = resolve;\n }\n\n private settledRef(): CkToastRef {\n return new CkToastRef({\n dismissed: Promise.resolve('programmatic'),\n dismiss: () => undefined,\n update: () => undefined,\n });\n }\n\n private replace(entry: ToastEntry, content: ToastContent): void {\n entry.settle('replaced');\n this.bind(entry);\n this.apply(entry, content);\n }\n\n private update(entry: ToastEntry, partial: Partial<CkToastOptions>): void {\n if (entry.phase() === 'leaving' || typeof partial !== 'object' || partial === null) {\n return;\n }\n const current = entry.content();\n const has = (key: keyof CkToastOptions): boolean =>\n Object.hasOwn(partial, key) && !(key === 'message' && partial.message === undefined);\n const merged = normalise({\n message: has('message') ? partial.message : current.message,\n title: has('title') ? partial.title : current.title,\n tone: has('tone') ? partial.tone : current.tone,\n action: has('action') ? partial.action : current.action,\n duration: has('duration') ? partial.duration : current.duration,\n });\n if (merged !== null) {\n this.apply(entry, merged);\n }\n }\n\n private apply(entry: ToastEntry, content: ToastContent): void {\n entry.content.set(content);\n if (entry.phase() === 'visible') {\n this.restart(entry);\n this.announce(entry);\n }\n }\n\n /** Shows queued toasts while there is a free slot. */\n private promote(): void {\n const entries = this.entries();\n let free = this.max - entries.filter((entry) => entry.phase() === 'visible').length;\n for (const entry of entries) {\n if (free <= 0) {\n break;\n }\n if (entry.phase() === 'queued') {\n free--;\n entry.phase.set('visible');\n if (this.document.visibilityState === 'hidden') {\n entry.pauses.add('hidden');\n }\n this.restart(entry);\n this.announce(entry);\n }\n }\n }\n\n private restart(entry: ToastEntry): void {\n this.clearTimer(entry);\n entry.remaining = effectiveDuration(entry.content());\n this.arm(entry);\n }\n\n private arm(entry: ToastEntry): void {\n if (\n entry.phase() !== 'visible' ||\n entry.remaining === null ||\n entry.pauses.size > 0 ||\n entry.timer !== undefined\n ) {\n return;\n }\n entry.startedAt = Date.now();\n entry.timer = setTimeout(() => {\n entry.timer = undefined;\n this.dismiss(entry, 'timeout');\n }, entry.remaining);\n }\n\n private clearTimer(entry: ToastEntry): void {\n if (entry.timer !== undefined) {\n clearTimeout(entry.timer);\n entry.timer = undefined;\n }\n }\n\n /** Danger is assertive, everything else polite; the same words at the same politeness are not repeated. */\n private announce(entry: ToastEntry): void {\n const content = entry.content();\n const politeness = content.tone === 'danger' ? 'assertive' : 'polite';\n const text = announcementOf(content);\n const signature = `${politeness}|${text}`;\n if (signature !== entry.announced) {\n entry.announced = signature;\n void this.announcer.announce(text, politeness);\n }\n }\n\n private listen(): void {\n if (!this.listening) {\n this.listening = true;\n this.document.addEventListener('visibilitychange', this.onVisibilityChange);\n }\n }\n\n private readonly onVisibilityChange = (): void => {\n const hidden = this.document.visibilityState === 'hidden';\n for (const entry of this.entries()) {\n if (entry.phase() !== 'visible') {\n continue;\n }\n if (hidden) {\n this.pause(entry, 'hidden');\n } else {\n this.resume(entry, 'hidden');\n }\n }\n };\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n untracked,\n} from '@angular/core';\nimport { CK_LABELS } from '@ckui/core';\nimport { CkButton } from '@ckui/core/button';\nimport { CkIcon, CkIconName, CkMedia } from '@ckui/core/internal';\nimport { CkToastTone } from './toast-ref';\nimport { CkToastStore, ToastEntry } from './toast-store';\n\n/** A drag shorter than this is a tap, and one that is mostly vertical is a scroll. */\nconst SWIPE_SLOP = 8;\n/** Dragged further than this share of the toast's width, the toast is dismissed on release... */\nconst SWIPE_DISTANCE_RATIO = 0.35;\n/** ...or after a quicker flick (px per ms) that moved at least this far (px). */\nconst SWIPE_FLICK_VELOCITY = 0.5;\nconst SWIPE_FLICK_MIN_DISTANCE = 24;\nconst VELOCITY_WINDOW = 100;\n/** Gives up waiting for `animationend` this long after the animation should have ended. */\nconst LEAVE_GRACE = 100;\n/** A click this soon (ms) after a drag's pointerup is the drag's own and is swallowed. */\nconst CLICK_AFTER_DRAG = 100;\n\nconst ICONS: Record<CkToastTone, CkIconName> = {\n neutral: 'info',\n success: 'check',\n warning: 'alert-triangle',\n danger: 'alert-octagon',\n};\n\nfunction parseTime(value: string): number {\n const match = /^\\s*(-?[\\d.]+)(ms|s)\\s*$/.exec(value);\n if (!match) {\n return 0;\n }\n const amount = Number(match[1]) * (match[2] === 's' ? 1000 : 1);\n return Number.isFinite(amount) && amount > 0 ? amount : 0;\n}\n\n/** One toast: tone icon, text, an optional action and the dismiss button. Pauses its timer, swipes away. */\n@Component({\n selector: 'ck-toast-item',\n imports: [CkButton, CkIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-toast',\n '[class]': 'toneClass()',\n '[class.ck-toast--leaving]': 'leaving()',\n '[class.ck-toast--swiped]': 'entry().swiped()',\n '[attr.inert]': 'leaving() ? \"\" : null',\n '(pointerenter)': 'onPointerEnter($event)',\n '(pointerleave)': 'onPointerLeave($event)',\n '(focusin)': 'onFocusIn()',\n '(focusout)': 'onFocusOut($event)',\n '(pointerdown)': 'onPointerDown($event)',\n },\n template: `\n <span class=\"ck-toast__icon\" aria-hidden=\"true\">\n <ck-icon [name]=\"iconName()\" />\n </span>\n <div class=\"ck-toast__text\">\n @if (content().title; as title) {\n <div class=\"ck-toast__title\">{{ title }}</div>\n }\n @if (content().message.trim() !== '') {\n <div class=\"ck-toast__message\">{{ content().message }}</div>\n }\n </div>\n <div class=\"ck-toast__buttons\">\n @if (content().action; as action) {\n <button\n ckButton\n type=\"button\"\n variant=\"ghost\"\n class=\"ck-toast__action\"\n [size]=\"store.size()\"\n (click)=\"runAction()\"\n >\n {{ action.label }}\n </button>\n }\n <button\n ckButton\n type=\"button\"\n variant=\"ghost\"\n iconOnly\n class=\"ck-toast__dismiss\"\n [size]=\"store.size()\"\n [attr.aria-label]=\"labels().dismiss\"\n (click)=\"dismiss()\"\n >\n <ck-icon name=\"close\" />\n </button>\n </div>\n `,\n})\nexport class CkToastItem {\n readonly entry = input.required<ToastEntry>();\n\n protected readonly store = inject(CkToastStore);\n protected readonly labels = inject(CK_LABELS);\n private readonly media = inject(CkMedia);\n private readonly injector = inject(Injector);\n private readonly destroyRef = inject(DestroyRef);\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly view = this.element.ownerDocument.defaultView as Window;\n\n protected readonly content = computed(() => this.entry().content());\n protected readonly leaving = computed(() => this.entry().phase() === 'leaving');\n protected readonly toneClass = computed(() => `ck-toast--${this.content().tone}`);\n protected readonly iconName = computed<CkIconName>(() => ICONS[this.content().tone]);\n\n private destroyed = false;\n private stopTracking: (() => void) | null = null;\n /** `timeStamp` of the pointerup that ended a drag; the click that follows it is swallowed. */\n private dragEndedAt: number | null = null;\n\n constructor() {\n const destroyRef = this.destroyRef;\n const swallowClick = (event: Event): void => {\n const endedAt = this.dragEndedAt;\n this.dragEndedAt = null;\n if (endedAt !== null && event.timeStamp - endedAt < CLICK_AFTER_DRAG) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n this.element.addEventListener('click', swallowClick, { capture: true });\n destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.element.removeEventListener('click', swallowClick, { capture: true });\n this.stopTracking?.();\n });\n\n effect(() => {\n this.entry().element = this.element;\n });\n\n effect(() => {\n if (this.leaving()) {\n untracked(() => afterNextRender(() => this.finishLeaving(), { injector: this.injector }));\n }\n });\n }\n\n protected runAction(): void {\n const entry = this.entry();\n const action = entry.content().action;\n if (!action || entry.phase() !== 'visible') {\n return;\n }\n try {\n action.run();\n } finally {\n this.store.dismiss(entry, 'action');\n }\n }\n\n protected dismiss(): void {\n this.store.dismiss(this.entry(), 'user');\n }\n\n protected onPointerEnter(event: PointerEvent): void {\n if (event.pointerType !== 'touch') {\n this.store.pause(this.entry(), 'hover');\n }\n }\n\n protected onPointerLeave(event: PointerEvent): void {\n if (event.pointerType !== 'touch') {\n this.store.resume(this.entry(), 'hover');\n }\n }\n\n protected onFocusIn(): void {\n this.store.pause(this.entry(), 'focus');\n }\n\n protected onFocusOut(event: FocusEvent): void {\n if (!(event.relatedTarget instanceof Node && this.element.contains(event.relatedTarget))) {\n this.store.resume(this.entry(), 'focus');\n }\n }\n\n /** Removes the toast once its leave animation is over, at once when there is none. */\n private finishLeaving(): void {\n if (this.destroyed) {\n return;\n }\n const entry = this.entry();\n const style = this.view.getComputedStyle(this.element);\n const duration = parseTime(style.animationDuration.split(',')[0] ?? '');\n if (style.animationName === 'none' || duration === 0 || this.media.reducedMotion()) {\n this.store.remove(entry);\n return;\n }\n let done = false;\n const finish = (): void => {\n if (!done) {\n done = true;\n clearTimeout(fallback);\n this.element.removeEventListener('animationend', finish);\n this.store.remove(entry);\n }\n };\n const fallback = setTimeout(finish, duration + LEAVE_GRACE);\n this.element.addEventListener('animationend', finish);\n this.destroyRef.onDestroy(() => clearTimeout(fallback));\n }\n\n protected onPointerDown(event: PointerEvent): void {\n this.dragEndedAt = null;\n const entry = this.entry();\n if (\n this.stopTracking ||\n !event.isPrimary ||\n event.button !== 0 ||\n entry.phase() !== 'visible'\n ) {\n return;\n }\n const element = this.element;\n const doc = element.ownerDocument;\n const now = (): number => this.view.performance.now();\n const pointerId = event.pointerId;\n const startX = event.clientX;\n const startY = event.clientY;\n const width = Math.max(element.getBoundingClientRect().width, 1);\n let swiping = false;\n let offset = 0;\n let samples = [{ offset: 0, time: now() }];\n\n this.store.pause(entry, 'drag');\n\n const end = (): void => {\n doc.removeEventListener('pointermove', onMove);\n doc.removeEventListener('pointerup', onUp);\n doc.removeEventListener('pointercancel', onCancel);\n this.stopTracking = null;\n element.classList.remove('ck-toast--dragging');\n this.store.resume(entry, 'drag');\n };\n\n const snapBack = (): void => {\n const from = offset;\n const opacity = element.style.opacity || '1';\n element.style.translate = '';\n element.style.opacity = '';\n const duration = this.media.reducedMotion()\n ? 0\n : parseTime(this.view.getComputedStyle(element).getPropertyValue('--ck-duration-normal'));\n if (from !== 0 && duration > 0 && typeof element.animate === 'function') {\n element.animate(\n [\n { translate: `${from}px 0`, opacity },\n { translate: '0 0', opacity: '1' },\n ],\n { duration, easing: 'ease-out' },\n );\n }\n };\n\n const 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 return first && last\n ? (Math.abs(last.offset) - Math.abs(first.offset)) / Math.max(1, current - first.time)\n : 0;\n };\n\n const onMove = (moved: PointerEvent): void => {\n if (moved.pointerId !== pointerId) {\n return;\n }\n const deltaX = moved.clientX - startX;\n const deltaY = moved.clientY - startY;\n if (!swiping) {\n if (Math.max(Math.abs(deltaX), Math.abs(deltaY)) < SWIPE_SLOP) {\n return;\n }\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\n end();\n return;\n }\n swiping = true;\n element.classList.add('ck-toast--dragging');\n try {\n element.setPointerCapture?.(pointerId);\n } catch {\n // A pointer that is already gone cannot be captured; the document listeners still work.\n }\n }\n offset = deltaX;\n element.style.translate = `${offset}px 0`;\n element.style.opacity = String(Math.max(0, 1 - Math.abs(offset) / width));\n samples.push({ offset, time: now() });\n };\n\n const onUp = (released: PointerEvent): void => {\n if (released.pointerId !== pointerId) {\n return;\n }\n const distance = Math.abs(offset);\n const dismissed =\n swiping &&\n (distance > width * SWIPE_DISTANCE_RATIO ||\n (velocity() >= SWIPE_FLICK_VELOCITY && distance >= SWIPE_FLICK_MIN_DISTANCE));\n end();\n if (swiping) {\n this.dragEndedAt = released.timeStamp;\n }\n if (dismissed) {\n this.store.dismiss(entry, 'user', true);\n } else if (swiping) {\n snapBack();\n }\n };\n\n const onCancel = (cancelled: PointerEvent): void => {\n if (cancelled.pointerId !== pointerId) {\n return;\n }\n end();\n if (swiping) {\n snapBack();\n }\n };\n\n this.stopTracking = () => {\n end();\n samples = [];\n };\n doc.addEventListener('pointermove', onMove);\n doc.addEventListener('pointerup', onUp);\n doc.addEventListener('pointercancel', onCancel);\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n inject,\n} from '@angular/core';\nimport { CK_LABELS } from '@ckui/core';\nimport { CkMedia } from '@ckui/core/internal';\nimport { CkToastItem } from './toast-item';\nimport { CkToastStore } from './toast-store';\n\n/**\n * The one `<section>` that holds every toast, a direct child of `body`. `data-ck-inert-exempt`\n * keeps it clickable while a modal overlay has made the rest of the page inert.\n */\n@Component({\n selector: 'ck-toast-host',\n imports: [CkToastItem],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'ck-toast-host',\n 'data-ck-inert-exempt': '',\n '[attr.aria-label]': 'labels().notifications',\n '[class.ck-toast-host--top]': 'store.position === \"top\"',\n '[class.ck-toast-host--bottom]': 'store.position === \"bottom\"',\n '[class.ck-toast-host--center]': 'align() === \"center\"',\n '[class.ck-toast-host--end]': 'align() === \"end\"',\n '[class.ck-toast-host--narrow]': 'media.narrow()',\n '[class.ck-toast-host--empty]': 'shown().length === 0',\n },\n template: `\n @for (entry of shown(); track entry.key) {\n <ck-toast-item [entry]=\"entry\" />\n }\n `,\n styleUrl: './toast.css',\n})\nexport class CkToastHost {\n protected readonly store = inject(CkToastStore);\n protected readonly labels = inject(CK_LABELS);\n protected readonly media = inject(CkMedia);\n\n /** Centred on a narrow viewport, at the end otherwise, unless `provideCkToast` says which. */\n protected readonly align = computed(\n () => this.store.alignOverride ?? (this.media.narrow() ? 'center' : 'end'),\n );\n\n /** Queued toasts wait; the newest is nearest the screen edge, so at the top it comes first in the DOM. */\n protected readonly shown = computed(() => {\n const shown = this.store.entries().filter((entry) => entry.phase() !== 'queued');\n return this.store.position === 'top' ? shown.reverse() : shown;\n });\n}\n","import { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n ApplicationRef,\n ComponentRef,\n DestroyRef,\n EnvironmentInjector,\n Injectable,\n PLATFORM_ID,\n createComponent,\n inject,\n} from '@angular/core';\nimport { CkToastHost } from './toast-host';\nimport { CkToastOptions, CkToastRef } from './toast-ref';\nimport { CkToastStore, ToastEntry } from './toast-store';\n\nconst FOCUSABLE =\n 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * Shows short messages in a stack at the edge of the screen. Announces each one to screen readers,\n * stays open for an action or a danger message, and pauses while the user reads it.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkToast {\n private readonly store = inject(CkToastStore);\n private readonly document = inject(DOCUMENT);\n private readonly appRef = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private host: ComponentRef<CkToastHost> | null = null;\n private hostElement: HTMLElement | null = null;\n /** The element that had focus before it entered the toast host, where it goes back to. */\n private focusOrigin: HTMLElement | null = null;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.store.teardown();\n this.hostElement?.removeEventListener('focusin', this.onFocusIn);\n this.focusOrigin = null;\n this.host?.destroy();\n this.hostElement?.remove();\n this.host = null;\n this.hostElement = null;\n });\n }\n\n /**\n * Shows a toast and returns the ref that controls it. A blank message with no title shows\n * nothing. On the server nothing is shown and `dismissed` resolves as `programmatic` at once.\n */\n show(options: CkToastOptions): CkToastRef {\n const ref = this.store.show(options);\n if (this.isBrowser && this.store.entries().length > 0) {\n this.ensureHost();\n }\n return ref;\n }\n\n /** Closes every toast, queued ones included, with the reason `programmatic`. */\n dismissAll(): void {\n this.store.dismissAll();\n }\n\n private ensureHost(): void {\n if (this.host) {\n return;\n }\n const element = this.document.createElement('section');\n this.document.body.appendChild(element);\n this.hostElement = element;\n element.addEventListener('focusin', this.onFocusIn);\n this.store.beforeLeave = (entry) => this.moveFocusAway(entry);\n this.host = createComponent(CkToastHost, {\n environmentInjector: this.environmentInjector,\n hostElement: element,\n });\n this.appRef.attachView(this.host.hostView);\n this.host.changeDetectorRef.detectChanges();\n }\n\n private readonly onFocusIn = (event: FocusEvent): void => {\n const origin = event.relatedTarget;\n if (origin instanceof HTMLElement && !this.hostElement?.contains(origin)) {\n this.focusOrigin = origin;\n }\n };\n\n /**\n * A toast that holds focus is about to leave: focus goes to the same button of the next toast\n * (else the previous one), else back to where it came from, else into the open modal overlay.\n * Without any of these focus is left alone.\n */\n private moveFocusAway(entry: ToastEntry): void {\n const host = this.hostElement;\n const active = this.document.activeElement;\n if (!host || !entry.element || !active || !entry.element.contains(active)) {\n return;\n }\n const slot = active.closest('.ck-toast__action') ? 'action' : 'dismiss';\n const items = Array.from(host.querySelectorAll<HTMLElement>('ck-toast-item'));\n const index = items.indexOf(entry.element);\n const stays = (item: HTMLElement): boolean =>\n item !== entry.element &&\n this.store.entries().some((other) => other.element === item && other.phase() === 'visible');\n const neighbours = [\n ...items.slice(index + 1).filter(stays),\n ...items.slice(0, index).filter(stays).reverse(),\n ];\n for (const item of neighbours) {\n const target =\n item.querySelector<HTMLElement>(`.ck-toast__${slot}`) ??\n item.querySelector<HTMLElement>('.ck-toast__dismiss');\n if (this.tryFocus(target)) {\n return;\n }\n }\n const origin = this.focusOrigin;\n if (origin?.isConnected && !host.contains(origin) && this.tryFocus(origin)) {\n return;\n }\n const modals = this.document.querySelectorAll<HTMLElement>('[aria-modal=\"true\"]');\n const modal = modals[modals.length - 1];\n if (modal) {\n if (!this.tryFocus(modal.querySelector<HTMLElement>(FOCUSABLE))) {\n this.tryFocus(modal);\n }\n }\n }\n\n private tryFocus(element: HTMLElement | null | undefined): boolean {\n element?.focus({ preventScroll: true });\n return !!element && this.document.activeElement === element;\n }\n}\n"],"mappings":";;;;;;AAoBA,MAAa,kBAAkB,IAAI,eAA8B,mBAAmB;CAClF,YAAY;CACZ,gBAAgB,CAAA;AACjB,CAAA;AAGD,SAAgB,eAAe,SAAwB,CAAA,GAAE;CACvD,MAAM,EAAE,UAAU,OAAO,KAAK,SAAS;CACvC,IAAI,aAAa,UAAa,aAAa,SAAS,aAAa,UAC/D,MAAM,IAAI,UAAU,4DAA4D,SAAQ,GAAI;CAE9F,IAAI,UAAU,UAAa,UAAU,YAAY,UAAU,OACzD,MAAM,IAAI,UAAU,yDAAyD,MAAK,GAAI;CAExF,IAAI,QAAQ,WAAc,OAAO,QAAQ,YAAY,CAAC,OAAO,UAAU,GAAG,KAAK,MAAM,IACnF,MAAM,IAAI,UACR,iEAAiE,OAAO,GAAG,EAAC,EAAG;CAGnF,IAAI,SAAS,UAAa,CAAC,SAAS,SAAS,IAAI,GAC/C,MAAM,IAAI,UACR,uCAAuC,SAAS,KAAK,IAAI,EAAC,SAAU,KAAI,GAAI;CAGhF,OAAO,yBAAyB,CAC9B;EAAE,SAAS;EAAiB,UAAU;GAAE;GAAU;GAAO;GAAK;EAAI;CAA0B,CAC7F,CAAA;AACH;ACXA,IAAa,aAAb,MAAuB;CAEZ;CACQ;CAEjB,YAAY,UAA4B;EACtC,KAAK,WAAW;EAChB,KAAK,YAAY,SAAS;CAC5B;CAGA,UAAO;EACL,KAAK,SAAS,QAAO;CACvB;CAOA,OAAO,S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AS,KAAK;EACrB;CAEJ;CAEQ,SAAS,SAAuC;EACtD,SAAS,MAAM,EAAE,eAAe,KAAI,CAAE;EACtC,OAAO,CAAC,CAAC,WAAW,KAAK,SAAS,kBAAkB;CACtD;CA7GW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAP,OAAA,QAAA,GAAA,sBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,YADM;CAAM,CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EADnB,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
package/fesm2022/ckui-core.mjs
CHANGED
|
@@ -7,8 +7,12 @@ const CK_SIZES = [
|
|
|
7
7
|
];
|
|
8
8
|
const CK_DEFAULT_LABELS = Object.freeze({
|
|
9
9
|
close: "Close",
|
|
10
|
+
decrement: "Decrease",
|
|
11
|
+
dismiss: "Dismiss",
|
|
12
|
+
increment: "Increase",
|
|
10
13
|
loading: "Loading",
|
|
11
|
-
noResults: "No results"
|
|
14
|
+
noResults: "No results",
|
|
15
|
+
notifications: "Notifications"
|
|
12
16
|
});
|
|
13
17
|
function resolveCkLabels(overrides) {
|
|
14
18
|
const source = typeof overrides === "object" && overrides !== null ? overrides : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ckui-core.mjs","names":[],"sources":["../../../../projects/core/src/size.ts","../../../../projects/core/src/labels.ts","../../../../projects/core/src/config.ts"],"sourcesContent":["export type CkSize = 'sm' | 'md' | 'lg' | 'xl';\n\nexport const CK_SIZES: readonly CkSize[] = ['sm', 'md', 'lg', 'xl'];\n","import { InjectionToken, Signal, signal } from '@angular/core';\n\n/** Built-in strings. Each package adds its keys; consumers pass a `Partial`. */\nexport interface CkLabels {\n close: string;\n loading: string;\n noResults: string;\n}\n\nexport const CK_DEFAULT_LABELS: Readonly<CkLabels> = Object.freeze({\n close: 'Close',\n loading: 'Loading',\n noResults: 'No results',\n});\n\n/** Merges overrides onto the defaults. Blank and non-string values fall back; unknown keys are ignored. */\nexport function resolveCkLabels(overrides: unknown): CkLabels {\n const source = typeof overrides === 'object' && overrides !== null ? overrides : {};\n const resolved: CkLabels = { ...CK_DEFAULT_LABELS };\n for (const key of Object.keys(CK_DEFAULT_LABELS) as (keyof CkLabels)[]) {\n const value = Object.hasOwn(source, key) ? (source as Record<string, unknown>)[key] : undefined;\n if (typeof value === 'string' && value.trim() !== '') {\n resolved[key] = value;\n }\n }\n return resolved;\n}\n\nexport const CK_LABELS = new InjectionToken<Signal<CkLabels>>('CK_LABELS', {\n providedIn: 'root',\n factory: () => signal<CkLabels>({ ...CK_DEFAULT_LABELS }).asReadonly(),\n});\n","import {\n EnvironmentProviders,\n InjectionToken,\n Provider,\n Signal,\n computed,\n isSignal,\n makeEnvironmentProviders,\n signal,\n} from '@angular/core';\nimport { CK_LABELS, CkLabels, resolveCkLabels } from './labels';\nimport { CK_SIZES, CkSize } from './size';\n\nexport interface CkConfig {\n readonly size: CkSize;\n /** Viewport width in px below which a coarse pointer switches overlays to sheets. */\n readonly sheetBreakpoint: number;\n}\n\nexport const CK_DEFAULT_CONFIG: Readonly<CkConfig> = Object.freeze({\n size: 'md',\n sheetBreakpoint: 640,\n});\n\nexport const CK_CONFIG = new InjectionToken<CkConfig>('CK_CONFIG', {\n providedIn: 'root',\n factory: () => ({ ...CK_DEFAULT_CONFIG }),\n});\n\nexport interface CkOptions {\n size?: CkSize;\n /** In px; finite and greater than 0. */\n sheetBreakpoint?: number;\n /** A partial object, a signal of one, or a factory (runs in injection context) returning a signal of one. */\n labels?: Partial<CkLabels> | Signal<Partial<CkLabels>> | (() => Signal<Partial<CkLabels>>);\n}\n\nfunction labelsProvider(labels: NonNullable<CkOptions['labels']>): Provider {\n if (isSignal(labels)) {\n return { provide: CK_LABELS, useValue: computed(() => resolveCkLabels(labels())) };\n }\n if (typeof labels === 'function') {\n return {\n provide: CK_LABELS,\n useFactory: (): Signal<CkLabels> => {\n const source = labels();\n if (!isSignal(source)) {\n throw new TypeError('provideCkui: the labels factory must return a signal.');\n }\n return computed(() => resolveCkLabels(source()));\n },\n };\n }\n if (typeof labels !== 'object' || labels === null) {\n throw new TypeError('provideCkui: labels must be an object or a factory returning a signal.');\n }\n return { provide: CK_LABELS, useValue: signal(resolveCkLabels(labels)).asReadonly() };\n}\n\n/** Configures size, sheet breakpoint and built-in strings for the whole app. */\nexport function provideCkui(options: CkOptions = {}): EnvironmentProviders {\n const size = options.size === undefined ? CK_DEFAULT_CONFIG.size : options.size;\n const sheetBreakpoint =\n options.sheetBreakpoint === undefined\n ? CK_DEFAULT_CONFIG.sheetBreakpoint\n : options.sheetBreakpoint;\n if (!CK_SIZES.includes(size)) {\n throw new TypeError(`provideCkui: size must be one of ${CK_SIZES.join(', ')}, got \"${size}\".`);\n }\n if (\n typeof sheetBreakpoint !== 'number' ||\n !Number.isFinite(sheetBreakpoint) ||\n sheetBreakpoint <= 0\n ) {\n throw new TypeError(\n `provideCkui: sheetBreakpoint must be a finite number greater than 0, got ${String(sheetBreakpoint)}.`,\n );\n }\n const providers: Provider[] = [{ provide: CK_CONFIG, useValue: { size, sheetBreakpoint } }];\n if (options.labels !== undefined) {\n providers.push(labelsProvider(options.labels));\n }\n return makeEnvironmentProviders(providers);\n}\n"],"mappings":";AAEA,MAAa,WAA8B;CAAC;CAAM;CAAM;CAAM;AAAI;
|
|
1
|
+
{"version":3,"file":"ckui-core.mjs","names":[],"sources":["../../../../projects/core/src/size.ts","../../../../projects/core/src/labels.ts","../../../../projects/core/src/config.ts"],"sourcesContent":["export type CkSize = 'sm' | 'md' | 'lg' | 'xl';\n\nexport const CK_SIZES: readonly CkSize[] = ['sm', 'md', 'lg', 'xl'];\n","import { InjectionToken, Signal, signal } from '@angular/core';\n\n/** Built-in strings. Each package adds its keys; consumers pass a `Partial`. */\nexport interface CkLabels {\n close: string;\n decrement: string;\n dismiss: string;\n increment: string;\n loading: string;\n noResults: string;\n notifications: string;\n}\n\nexport const CK_DEFAULT_LABELS: Readonly<CkLabels> = Object.freeze({\n close: 'Close',\n decrement: 'Decrease',\n dismiss: 'Dismiss',\n increment: 'Increase',\n loading: 'Loading',\n noResults: 'No results',\n notifications: 'Notifications',\n});\n\n/** Merges overrides onto the defaults. Blank and non-string values fall back; unknown keys are ignored. */\nexport function resolveCkLabels(overrides: unknown): CkLabels {\n const source = typeof overrides === 'object' && overrides !== null ? overrides : {};\n const resolved: CkLabels = { ...CK_DEFAULT_LABELS };\n for (const key of Object.keys(CK_DEFAULT_LABELS) as (keyof CkLabels)[]) {\n const value = Object.hasOwn(source, key) ? (source as Record<string, unknown>)[key] : undefined;\n if (typeof value === 'string' && value.trim() !== '') {\n resolved[key] = value;\n }\n }\n return resolved;\n}\n\nexport const CK_LABELS = new InjectionToken<Signal<CkLabels>>('CK_LABELS', {\n providedIn: 'root',\n factory: () => signal<CkLabels>({ ...CK_DEFAULT_LABELS }).asReadonly(),\n});\n","import {\n EnvironmentProviders,\n InjectionToken,\n Provider,\n Signal,\n computed,\n isSignal,\n makeEnvironmentProviders,\n signal,\n} from '@angular/core';\nimport { CK_LABELS, CkLabels, resolveCkLabels } from './labels';\nimport { CK_SIZES, CkSize } from './size';\n\nexport interface CkConfig {\n readonly size: CkSize;\n /** Viewport width in px below which a coarse pointer switches overlays to sheets. */\n readonly sheetBreakpoint: number;\n}\n\nexport const CK_DEFAULT_CONFIG: Readonly<CkConfig> = Object.freeze({\n size: 'md',\n sheetBreakpoint: 640,\n});\n\nexport const CK_CONFIG = new InjectionToken<CkConfig>('CK_CONFIG', {\n providedIn: 'root',\n factory: () => ({ ...CK_DEFAULT_CONFIG }),\n});\n\nexport interface CkOptions {\n size?: CkSize;\n /** In px; finite and greater than 0. */\n sheetBreakpoint?: number;\n /** A partial object, a signal of one, or a factory (runs in injection context) returning a signal of one. */\n labels?: Partial<CkLabels> | Signal<Partial<CkLabels>> | (() => Signal<Partial<CkLabels>>);\n}\n\nfunction labelsProvider(labels: NonNullable<CkOptions['labels']>): Provider {\n if (isSignal(labels)) {\n return { provide: CK_LABELS, useValue: computed(() => resolveCkLabels(labels())) };\n }\n if (typeof labels === 'function') {\n return {\n provide: CK_LABELS,\n useFactory: (): Signal<CkLabels> => {\n const source = labels();\n if (!isSignal(source)) {\n throw new TypeError('provideCkui: the labels factory must return a signal.');\n }\n return computed(() => resolveCkLabels(source()));\n },\n };\n }\n if (typeof labels !== 'object' || labels === null) {\n throw new TypeError('provideCkui: labels must be an object or a factory returning a signal.');\n }\n return { provide: CK_LABELS, useValue: signal(resolveCkLabels(labels)).asReadonly() };\n}\n\n/** Configures size, sheet breakpoint and built-in strings for the whole app. */\nexport function provideCkui(options: CkOptions = {}): EnvironmentProviders {\n const size = options.size === undefined ? CK_DEFAULT_CONFIG.size : options.size;\n const sheetBreakpoint =\n options.sheetBreakpoint === undefined\n ? CK_DEFAULT_CONFIG.sheetBreakpoint\n : options.sheetBreakpoint;\n if (!CK_SIZES.includes(size)) {\n throw new TypeError(`provideCkui: size must be one of ${CK_SIZES.join(', ')}, got \"${size}\".`);\n }\n if (\n typeof sheetBreakpoint !== 'number' ||\n !Number.isFinite(sheetBreakpoint) ||\n sheetBreakpoint <= 0\n ) {\n throw new TypeError(\n `provideCkui: sheetBreakpoint must be a finite number greater than 0, got ${String(sheetBreakpoint)}.`,\n );\n }\n const providers: Provider[] = [{ provide: CK_CONFIG, useValue: { size, sheetBreakpoint } }];\n if (options.labels !== undefined) {\n providers.push(labelsProvider(options.labels));\n }\n return makeEnvironmentProviders(providers);\n}\n"],"mappings":";AAEA,MAAa,WAA8B;CAAC;CAAM;CAAM;CAAM;AAAI;ACWlE,MAAa,oBAAwC,OAAO,OAAO;CACjE,OAAO;CACP,WAAW;CACX,SAAS;CACT,WAAW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SAAY,kBAAkB,OAAO,QAAQ;CAC3E,MAAM,kBACJ,QAAQ,oBAAoB,SACxB,kBAAkB,kBAClB,QAAQ;CACd,IAAI,CAAC,SAAS,SAAS,IAAI,GACzB,MAAM,IAAI,UAAU,oCAAoC,SAAS,KAAK,IAAI,EAAC,SAAU,KAAI,GAAI;CAE/F,IACE,OAAO,oBAAoB,YAC3B,CAAC,OAAO,SAAS,eAAe,KAChC,mBAAmB,GAEnB,MAAM,IAAI,UACR,4EAA4E,OAAO,eAAe,EAAC,EAAG;CAG1G,MAAM,YAAwB,CAAC;EAAE,SAAS;EAAW,UAAU;GAAE;GAAM;EAAe;CAAE,CAAE;CAC1F,IAAI,QAAQ,WAAW,QACrB,UAAU,KAAK,eAAe,QAAQ,MAAM,CAAC;CAE/C,OAAO,yBAAyB,SAAS;AAC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckui/core",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.2",
|
|
4
4
|
"description": "Accessible, themeable Angular UI components for phone and desktop.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -42,10 +42,18 @@
|
|
|
42
42
|
"types": "./types/ckui-core.d.ts",
|
|
43
43
|
"default": "./fesm2022/ckui-core.mjs"
|
|
44
44
|
},
|
|
45
|
+
"./badge": {
|
|
46
|
+
"types": "./types/ckui-core-badge.d.ts",
|
|
47
|
+
"default": "./fesm2022/ckui-core-badge.mjs"
|
|
48
|
+
},
|
|
45
49
|
"./button": {
|
|
46
50
|
"types": "./types/ckui-core-button.d.ts",
|
|
47
51
|
"default": "./fesm2022/ckui-core-button.mjs"
|
|
48
52
|
},
|
|
53
|
+
"./dialog": {
|
|
54
|
+
"types": "./types/ckui-core-dialog.d.ts",
|
|
55
|
+
"default": "./fesm2022/ckui-core-dialog.mjs"
|
|
56
|
+
},
|
|
49
57
|
"./field": {
|
|
50
58
|
"types": "./types/ckui-core-field.d.ts",
|
|
51
59
|
"default": "./fesm2022/ckui-core-field.mjs"
|
|
@@ -53,6 +61,26 @@
|
|
|
53
61
|
"./internal": {
|
|
54
62
|
"types": "./types/ckui-core-internal.d.ts",
|
|
55
63
|
"default": "./fesm2022/ckui-core-internal.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./internal/overlay": {
|
|
66
|
+
"types": "./types/ckui-core-internal-overlay.d.ts",
|
|
67
|
+
"default": "./fesm2022/ckui-core-internal-overlay.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./progress": {
|
|
70
|
+
"types": "./types/ckui-core-progress.d.ts",
|
|
71
|
+
"default": "./fesm2022/ckui-core-progress.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./segmented": {
|
|
74
|
+
"types": "./types/ckui-core-segmented.d.ts",
|
|
75
|
+
"default": "./fesm2022/ckui-core-segmented.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./stepper": {
|
|
78
|
+
"types": "./types/ckui-core-stepper.d.ts",
|
|
79
|
+
"default": "./fesm2022/ckui-core-stepper.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./toast": {
|
|
82
|
+
"types": "./types/ckui-core-toast.d.ts",
|
|
83
|
+
"default": "./fesm2022/ckui-core-toast.mjs"
|
|
56
84
|
}
|
|
57
85
|
},
|
|
58
86
|
"publishConfig": {
|
package/styles/tokens.css
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
type CkBadgeTone = 'neutral' | 'success' | 'warning' | 'danger';
|
|
3
|
+
type CkBadgeSize = 'sm' | 'md';
|
|
4
|
+
/** Marks a projected element (usually an `svg`) as the badge's leading icon. It is decorative. */
|
|
5
|
+
export declare class CkBadgeIcon {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkBadgeIcon, never>;
|
|
7
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkBadgeIcon, "[ckBadgeIcon]", never, {}, {}, never, never, true, never>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A small, non-interactive status label: a pill with text, an optional leading dot or icon. It is
|
|
11
|
+
* not a live region and has no role; the text must say what the status is, colour never does.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CkBadge {
|
|
14
|
+
/** Colours of the badge. An unknown value falls back to `neutral`. */
|
|
15
|
+
readonly tone: import("@angular/core").InputSignal<CkBadgeTone>;
|
|
16
|
+
/** Adds a leading dot in the text colour. */
|
|
17
|
+
readonly dot: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
18
|
+
/** `md` is a 1.5rem pill, `sm` a smaller one for dense lists. An unknown value falls back to `md`. */
|
|
19
|
+
readonly size: import("@angular/core").InputSignal<CkBadgeSize>;
|
|
20
|
+
private readonly element;
|
|
21
|
+
protected readonly modifierClasses: import("@angular/core").Signal<string>;
|
|
22
|
+
constructor();
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkBadge, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkBadge, "ck-badge", never, {
|
|
25
|
+
"tone": {
|
|
26
|
+
"alias": "tone";
|
|
27
|
+
"required": false;
|
|
28
|
+
"isSignal": true;
|
|
29
|
+
};
|
|
30
|
+
"dot": {
|
|
31
|
+
"alias": "dot";
|
|
32
|
+
"required": false;
|
|
33
|
+
"isSignal": true;
|
|
34
|
+
};
|
|
35
|
+
"size": {
|
|
36
|
+
"alias": "size";
|
|
37
|
+
"required": false;
|
|
38
|
+
"isSignal": true;
|
|
39
|
+
};
|
|
40
|
+
}, {}, never, ["[ckBadgeIcon]", "*"], true, never>;
|
|
41
|
+
}
|
|
42
|
+
/** Everything a template needs for a badge: `imports: [CK_BADGE_IMPORTS]`. */
|
|
43
|
+
export declare const CK_BADGE_IMPORTS: readonly [typeof CkBadge, typeof CkBadgeIcon];
|
|
44
|
+
export type { CkBadgeSize, CkBadgeTone };
|
|
@@ -26,7 +26,6 @@ export declare class CkButton {
|
|
|
26
26
|
constructor();
|
|
27
27
|
/** Sets the attribute, or gives the consumer's own value back when `value` is null. */
|
|
28
28
|
private override;
|
|
29
|
-
private hasAccessibleName;
|
|
30
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<CkButton, never>;
|
|
31
30
|
static ɵcmp: i0.ɵɵComponentDeclaration<CkButton, "button[ckButton], a[ckButton]", never, {
|
|
32
31
|
"variant": {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { InjectionToken, Injector, TemplateRef } from "@angular/core";
|
|
3
|
+
import { ComponentType } from "@angular/cdk/portal";
|
|
4
|
+
type CkDialogRole = 'dialog' | 'alertdialog';
|
|
5
|
+
/** Largest inline size of a modal dialog: 24, 32 or 48rem. */
|
|
6
|
+
type CkDialogWidth = 'sm' | 'md' | 'lg';
|
|
7
|
+
/** `auto` opens a sheet on a narrow screen with a coarse pointer, a centred modal otherwise. */
|
|
8
|
+
type CkDialogMode = 'auto' | 'modal' | 'sheet';
|
|
9
|
+
interface CkDialogConfig<D = unknown> {
|
|
10
|
+
/** What the content gets from `inject(CK_DIALOG_DATA)`. */
|
|
11
|
+
data?: D;
|
|
12
|
+
/** `alertdialog` for a message the user has to answer. Default `dialog`. */
|
|
13
|
+
role?: CkDialogRole;
|
|
14
|
+
/** Default `md`. Under a sheet the dialog is as wide as the screen. */
|
|
15
|
+
width?: CkDialogWidth;
|
|
16
|
+
/** Escape, a click on the backdrop and a swipe down close the dialog. Default `true`. */
|
|
17
|
+
dismissible?: boolean;
|
|
18
|
+
/** Shows the close button next to the title. Default `true`. */
|
|
19
|
+
closeButton?: boolean;
|
|
20
|
+
/** Default `auto`, decided at the moment the dialog opens. */
|
|
21
|
+
mode?: CkDialogMode;
|
|
22
|
+
/** A sheet as tall as the screen allows instead of as tall as its content. Default `false`. */
|
|
23
|
+
fullHeight?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The parent injector of a component's content, for providers the app root doesn't have (route
|
|
26
|
+
* level, or the opener's own): pass `inject(Injector)` from the opener. `CK_DIALOG_DATA` and
|
|
27
|
+
* `CkDialogRef` are provided on top. Template content keeps the injector of its template.
|
|
28
|
+
*/
|
|
29
|
+
injector?: Injector;
|
|
30
|
+
/** The accessible name when the content has no `ckDialogTitle`. */
|
|
31
|
+
ariaLabel?: string;
|
|
32
|
+
}
|
|
33
|
+
/** The `data` of the config, for a dialog opened with a component. */
|
|
34
|
+
export declare const CK_DIALOG_DATA: InjectionToken<unknown>;
|
|
35
|
+
/**
|
|
36
|
+
* A dialog declared in a template. Its content is one `<ng-template>` that is only rendered while
|
|
37
|
+
* `open` is true, so nothing in it exists while the dialog is closed. `[(open)]` follows the dialog:
|
|
38
|
+
* Escape, the backdrop, the close button and `[ckDialogClose]` set it back to `false`.
|
|
39
|
+
*/
|
|
40
|
+
export declare class CkDialogComponent {
|
|
41
|
+
readonly open: import("@angular/core").ModelSignal<boolean>;
|
|
42
|
+
readonly role: import("@angular/core").InputSignal<CkDialogRole>;
|
|
43
|
+
readonly width: import("@angular/core").InputSignal<CkDialogWidth>;
|
|
44
|
+
readonly dismissible: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
45
|
+
readonly closeButton: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
46
|
+
readonly mode: import("@angular/core").InputSignal<CkDialogMode>;
|
|
47
|
+
readonly fullHeight: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
48
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string | undefined>;
|
|
49
|
+
/** Emits when the dialog has left the screen, with the result of `[ckDialogClose]`, else `undefined`. */
|
|
50
|
+
readonly closed: import("@angular/core").OutputEmitterRef<unknown>;
|
|
51
|
+
private readonly template;
|
|
52
|
+
private readonly dialog;
|
|
53
|
+
private readonly isBrowser;
|
|
54
|
+
private ref;
|
|
55
|
+
private destroyed;
|
|
56
|
+
constructor();
|
|
57
|
+
private sync;
|
|
58
|
+
private show;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogComponent, never>;
|
|
60
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkDialogComponent, "ck-dialog", never, {
|
|
61
|
+
"open": {
|
|
62
|
+
"alias": "open";
|
|
63
|
+
"required": false;
|
|
64
|
+
"isSignal": true;
|
|
65
|
+
};
|
|
66
|
+
"role": {
|
|
67
|
+
"alias": "role";
|
|
68
|
+
"required": false;
|
|
69
|
+
"isSignal": true;
|
|
70
|
+
};
|
|
71
|
+
"width": {
|
|
72
|
+
"alias": "width";
|
|
73
|
+
"required": false;
|
|
74
|
+
"isSignal": true;
|
|
75
|
+
};
|
|
76
|
+
"dismissible": {
|
|
77
|
+
"alias": "dismissible";
|
|
78
|
+
"required": false;
|
|
79
|
+
"isSignal": true;
|
|
80
|
+
};
|
|
81
|
+
"closeButton": {
|
|
82
|
+
"alias": "closeButton";
|
|
83
|
+
"required": false;
|
|
84
|
+
"isSignal": true;
|
|
85
|
+
};
|
|
86
|
+
"mode": {
|
|
87
|
+
"alias": "mode";
|
|
88
|
+
"required": false;
|
|
89
|
+
"isSignal": true;
|
|
90
|
+
};
|
|
91
|
+
"fullHeight": {
|
|
92
|
+
"alias": "fullHeight";
|
|
93
|
+
"required": false;
|
|
94
|
+
"isSignal": true;
|
|
95
|
+
};
|
|
96
|
+
"ariaLabel": {
|
|
97
|
+
"alias": "ariaLabel";
|
|
98
|
+
"required": false;
|
|
99
|
+
"isSignal": true;
|
|
100
|
+
};
|
|
101
|
+
}, {
|
|
102
|
+
"open": "openChange";
|
|
103
|
+
"closed": "closed";
|
|
104
|
+
}, ["template"], never, true, never>;
|
|
105
|
+
}
|
|
106
|
+
/** Marks a heading as the title of the dialog: it names the dialog (`aria-labelledby`). */
|
|
107
|
+
export declare class CkDialogTitle {
|
|
108
|
+
/** Default: a generated id. */
|
|
109
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
110
|
+
constructor();
|
|
111
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogTitle, never>;
|
|
112
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkDialogTitle, "[ckDialogTitle]", never, {
|
|
113
|
+
"id": {
|
|
114
|
+
"alias": "id";
|
|
115
|
+
"required": false;
|
|
116
|
+
"isSignal": true;
|
|
117
|
+
};
|
|
118
|
+
}, {}, never, never, true, never>;
|
|
119
|
+
}
|
|
120
|
+
/** Marks the text that explains the dialog: it describes it (`aria-describedby`). */
|
|
121
|
+
export declare class CkDialogDescription {
|
|
122
|
+
/** Default: a generated id. */
|
|
123
|
+
readonly id: import("@angular/core").InputSignal<string>;
|
|
124
|
+
constructor();
|
|
125
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogDescription, never>;
|
|
126
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkDialogDescription, "[ckDialogDescription]", never, {
|
|
127
|
+
"id": {
|
|
128
|
+
"alias": "id";
|
|
129
|
+
"required": false;
|
|
130
|
+
"isSignal": true;
|
|
131
|
+
};
|
|
132
|
+
}, {}, never, never, true, never>;
|
|
133
|
+
}
|
|
134
|
+
/** The part of a dialog that scrolls when the content is taller than the screen. */
|
|
135
|
+
export declare class CkDialogBody {
|
|
136
|
+
constructor();
|
|
137
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogBody, never>;
|
|
138
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkDialogBody, "ck-dialog-body", never, {}, {}, never, ["*"], true, never>;
|
|
139
|
+
}
|
|
140
|
+
/** The row of buttons at the bottom of a dialog. On a sheet they stack and fill the width. */
|
|
141
|
+
export declare class CkDialogActions {
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogActions, never>;
|
|
143
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CkDialogActions, "ck-dialog-actions", never, {}, {}, never, ["*"], true, never>;
|
|
144
|
+
}
|
|
145
|
+
/** Closes the dialog with the bound value as its result when the element is clicked. */
|
|
146
|
+
export declare class CkDialogClose<R = unknown> {
|
|
147
|
+
/** The result of the dialog; empty means `undefined`. */
|
|
148
|
+
readonly result: import("@angular/core").InputSignal<"" | R | undefined>;
|
|
149
|
+
private readonly ref;
|
|
150
|
+
constructor();
|
|
151
|
+
protected close(): void;
|
|
152
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogClose<any>, never>;
|
|
153
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkDialogClose<any>, "[ckDialogClose]", never, {
|
|
154
|
+
"result": {
|
|
155
|
+
"alias": "ckDialogClose";
|
|
156
|
+
"required": false;
|
|
157
|
+
"isSignal": true;
|
|
158
|
+
};
|
|
159
|
+
}, {}, never, never, true, never>;
|
|
160
|
+
}
|
|
161
|
+
/** Takes focus when the dialog opens, e.g. the least destructive action of an `alertdialog`. */
|
|
162
|
+
export declare class CkDialogInitialFocus {
|
|
163
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialogInitialFocus, never>;
|
|
164
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CkDialogInitialFocus, "[ckDialogInitialFocus]", never, {}, {}, never, never, true, never>;
|
|
165
|
+
}
|
|
166
|
+
/** What a `CkDialogRef` calls into; supplied by `CkDialog`, not by consumers. */
|
|
167
|
+
interface CkDialogRefControls<R> {
|
|
168
|
+
readonly closing: Promise<void>;
|
|
169
|
+
readonly closed: Promise<R | undefined>;
|
|
170
|
+
close(result: R | undefined): void;
|
|
171
|
+
}
|
|
172
|
+
/** Controls one open dialog. Returned by `CkDialog.open`, injected by its content; never constructed directly. */
|
|
173
|
+
export declare class CkDialogRef<R = unknown> {
|
|
174
|
+
/**
|
|
175
|
+
* Resolves once, after the dialog has left the screen, with the result of the first `close()`.
|
|
176
|
+
* Escape, a click on the backdrop and a swipe resolve it with `undefined`, and so does destroying
|
|
177
|
+
* the app.
|
|
178
|
+
*/
|
|
179
|
+
readonly closed: Promise<R | undefined>;
|
|
180
|
+
/**
|
|
181
|
+
* Resolves once, the moment the dialog starts to close (before the leave animation), whatever
|
|
182
|
+
* the cause. `closed` follows when it has left the screen.
|
|
183
|
+
*/
|
|
184
|
+
readonly closing: Promise<void>;
|
|
185
|
+
private readonly controls;
|
|
186
|
+
constructor(controls: CkDialogRefControls<R>);
|
|
187
|
+
/** Closes the dialog. Only the first call counts; later ones, with another result too, do nothing. */
|
|
188
|
+
close(result?: R): void;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Opens modal dialogs, which become bottom sheets on a phone. Takes a component or a template as
|
|
192
|
+
* content and returns a `CkDialogRef` that closes it and delivers the result.
|
|
193
|
+
*/
|
|
194
|
+
export declare class CkDialog {
|
|
195
|
+
private readonly overlay;
|
|
196
|
+
private readonly checker;
|
|
197
|
+
private readonly injector;
|
|
198
|
+
private readonly active;
|
|
199
|
+
constructor();
|
|
200
|
+
/**
|
|
201
|
+
* Opens a dialog. The content injects `CK_DIALOG_DATA` and `CkDialogRef`; a component sees the
|
|
202
|
+
* app's providers, plus those of `config.injector` when given. On the server nothing is shown and
|
|
203
|
+
* `closed` resolves with `undefined` at once.
|
|
204
|
+
*/
|
|
205
|
+
open<C, D = unknown, R = unknown>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkDialogConfig<D>): CkDialogRef<R>;
|
|
206
|
+
/** Closes every open dialog as if each one's `close()` had been called without a result. */
|
|
207
|
+
closeAll(): void;
|
|
208
|
+
private setAttribute;
|
|
209
|
+
/**
|
|
210
|
+
* The marked element, else the first tabbable one of the content (the close button comes last in
|
|
211
|
+
* the DOM, and the scrolling body itself is skipped), else the panel.
|
|
212
|
+
*/
|
|
213
|
+
private initialFocus;
|
|
214
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkDialog, never>;
|
|
215
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
216
|
+
}
|
|
217
|
+
/** Everything a template needs for a dialog: `imports: [CK_DIALOG_IMPORTS]`. */
|
|
218
|
+
export declare const CK_DIALOG_IMPORTS: readonly [typeof CkDialogComponent, typeof CkDialogTitle, typeof CkDialogDescription, typeof CkDialogBody, typeof CkDialogActions, typeof CkDialogClose, typeof CkDialogInitialFocus];
|
|
219
|
+
export type { CkDialogConfig, CkDialogMode, CkDialogRole, CkDialogWidth };
|
|
@@ -113,7 +113,6 @@ export declare class CkInput {
|
|
|
113
113
|
private observeWidth;
|
|
114
114
|
/** Sets the height to the content; the CSS min and max rows clamp it. */
|
|
115
115
|
private measure;
|
|
116
|
-
private hasAccessibleName;
|
|
117
116
|
static ɵfac: i0.ɵɵFactoryDeclaration<CkInput, never>;
|
|
118
117
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CkInput, "input[ckInput], textarea[ckInput]", never, {
|
|
119
118
|
"size": {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ComponentType } from "@angular/cdk/portal";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Injector, TemplateRef } from "@angular/core";
|
|
4
|
+
type CkOverlayMode = 'auto' | 'modal' | 'sheet';
|
|
5
|
+
type CkOverlayDismissReason = 'escape' | 'backdrop' | 'swipe';
|
|
6
|
+
interface CkOverlayConfig {
|
|
7
|
+
/** `auto` becomes a sheet when `CkMedia.sheet()` is true at the moment of opening. Default `auto`. */
|
|
8
|
+
mode?: CkOverlayMode;
|
|
9
|
+
/** Escape, a click on the backdrop and a swipe down may close the overlay. Default `true`. */
|
|
10
|
+
dismissible?: boolean;
|
|
11
|
+
/** A sheet as tall as the viewport allows instead of as tall as its content. */
|
|
12
|
+
fullHeight?: boolean;
|
|
13
|
+
panelClass?: string | string[];
|
|
14
|
+
/** Default `dialog`. */
|
|
15
|
+
role?: 'dialog' | 'alertdialog';
|
|
16
|
+
ariaLabel?: string;
|
|
17
|
+
ariaLabelledBy?: string;
|
|
18
|
+
ariaDescribedBy?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the user asks to dismiss (Escape, backdrop, swipe) a dismissible overlay. It is
|
|
21
|
+
* expected to call `handle.close()` straight away; without it the host closes the overlay itself.
|
|
22
|
+
* A sheet that is still open after a swipe snaps back.
|
|
23
|
+
*/
|
|
24
|
+
onDismissRequest?: (reason: CkOverlayDismissReason) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Picks the element that takes focus once the overlay has rendered. Without it, or when it
|
|
27
|
+
* returns `null` or something that cannot take focus, the first tabbable element does.
|
|
28
|
+
*/
|
|
29
|
+
initialFocus?: () => HTMLElement | null;
|
|
30
|
+
}
|
|
31
|
+
interface CkOverlayHandle {
|
|
32
|
+
/** The mode resolved when the overlay opened. */
|
|
33
|
+
readonly mode: 'modal' | 'sheet';
|
|
34
|
+
/** The element that carries `role`, `aria-modal` and the labels; set `aria-labelledby` here when the title appears later. */
|
|
35
|
+
readonly panel: HTMLElement;
|
|
36
|
+
/** Resolves once the opening animation and the initial focus are done. */
|
|
37
|
+
readonly opened: Promise<void>;
|
|
38
|
+
/** Resolves once the overlay is detached. */
|
|
39
|
+
readonly closed: Promise<void>;
|
|
40
|
+
/** Animates out, then detaches. Repeated calls return the same promise. */
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Opens modal dialogs and bottom sheets on the CDK overlay: backdrop, scroll lock, focus trap and
|
|
45
|
+
* restore, `inert` background, Escape / backdrop / swipe dismissal and the open and close animation.
|
|
46
|
+
*/
|
|
47
|
+
export declare class CkOverlayHost {
|
|
48
|
+
private readonly overlay;
|
|
49
|
+
private readonly overlayContainer;
|
|
50
|
+
private readonly media;
|
|
51
|
+
private readonly inert;
|
|
52
|
+
private readonly focusTraps;
|
|
53
|
+
private readonly injector;
|
|
54
|
+
private readonly document;
|
|
55
|
+
private readonly isBrowser;
|
|
56
|
+
/** Open overlays, topmost last. A closing overlay has already left it. */
|
|
57
|
+
private readonly stack;
|
|
58
|
+
private readonly entries;
|
|
59
|
+
private scrollStrategy;
|
|
60
|
+
private scrollLocks;
|
|
61
|
+
private listening;
|
|
62
|
+
constructor();
|
|
63
|
+
open<C>(content: ComponentType<C> | TemplateRef<unknown>, config?: CkOverlayConfig, injector?: Injector): CkOverlayHandle;
|
|
64
|
+
/** Focus did not return to where it came from (opener disabled, inert or gone): find it a home. */
|
|
65
|
+
private restoreFocus;
|
|
66
|
+
private contentPortal;
|
|
67
|
+
/** What the server gets: nothing is rendered, and the overlay counts as closed. */
|
|
68
|
+
private inertHandle;
|
|
69
|
+
private lockScroll;
|
|
70
|
+
private unlockScroll;
|
|
71
|
+
private listen;
|
|
72
|
+
private readonly onKeydown;
|
|
73
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CkOverlayHost, never>;
|
|
74
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
75
|
+
}
|
|
76
|
+
export type { CkOverlayConfig, CkOverlayDismissReason, CkOverlayHandle, CkOverlayMode };
|