import { OnChanges, SimpleChanges } from '@angular/core'; import * as i0 from "@angular/core"; /** * Every skeleton shape supported by the component. * * Types are either **primitives** (a single bone, such as `text` or `avatar`) * or **composites** built from other types (such as `article`, which is a * heading followed by a paragraph). */ export declare const SKELETON_LOADER_TYPES: readonly ["text", "heading", "avatar", "icon", "button", "chip", "divider", "image", "table-cell", "sentences", "paragraph", "article", "list-item", "list-item-avatar", "actions", "card-title", "card-title-icon", "card", "info-card-row", "info-card-row-vertical", "table-heading", "table-thead", "table-row", "table-tbody", "table"]; /** * Name of a skeleton shape supported by {@link SkeletonLoaderComponent}. */ export type SkeletonLoaderType = (typeof SKELETON_LOADER_TYPES)[number]; /** * A single node of the resolved skeleton tree. * Leaves (no children) are the painted bones; nodes with children are layout groups. */ export interface SkeletonLoaderBone { /** Resolved skeleton type this node represents. */ type: SkeletonLoaderType; /** Pre-computed CSS classes applied to the rendered element. */ cssClass: string; /** Nested bones. Empty for primitives. */ children: SkeletonLoaderBone[]; } /** * Placeholder that mimics the shape of the content being loaded, avoiding the * layout shift and the "blank screen" feeling of a spinner. * * The `type` input accepts a single type, a comma separated list, or an array * of types. Any type can be repeated with the `@` notation (`text@3`). * * @example Simple placeholder * ```html * * ``` * * @example Composed placeholder * ```html * * ``` * * @example Wrapping the real content * ```html * * * * ``` */ export declare class SkeletonLoaderComponent implements OnChanges { /** * Shape(s) to render. Accepts a single type, a comma separated list * (`'heading, paragraph'`), or an array of types. Use `@` to repeat a type * (`'list-item@3'`). Unknown types fall back to `text`. * * Autocomplete lists all skeleton types — any other value is still accepted. * @default 'text' */ type: SkeletonLoaderType | SkeletonLoaderType[] | (string & {}); /** * Whether the skeleton is displayed. When `false`, the projected content is * rendered instead of the bones. * @default true */ loading: boolean; /** * Whether to render the skeleton without the shimmer animation. * Useful for static placeholders and screenshot tests. * @default false */ boilerplate: boolean; /** * Width applied to the skeleton. Values without a unit are read as pixels * (`240` and `'240'` both become `240px`); anything else is used as provided * (`'50%'`, `'4rem'`). A shape with a single root fills it. * * It sizes the placeholder only: once the content is in, the element stops * being a box and the content keeps its own width. */ width?: string | number; /** * Height applied to the skeleton. Values without a unit are read as pixels * (`80` and `'80'` both become `80px`); anything else is used as provided * (`'50%'`, `'4rem'`). A shape with a single root fills it. * * It sizes the placeholder only: once the content is in, the element stops * being a box and the content keeps its own height, however much taller than * the placeholder that turns out to be. */ height?: string | number; /** * Accessible label announced while the skeleton is visible. * * Empty by default, which makes the placeholder decorative: it is hidden from * assistive technology rather than announcing itself. A skeleton is a picture * of content that is not there yet, and a screen full of them announcing one * message each is noise — the loading state belongs to whatever owns the data, * which should carry `aria-busy` and announce once for the whole view. * * Set a label only for a placeholder that stands alone and is the single thing * a screen reader should hear about while the view loads. Doing so turns the * element into a live region; keep it to one per screen. * @default '' */ ariaLabel: string; /** * @internal * Resolved skeleton tree rendered by the template. */ bones: SkeletonLoaderBone[]; /** * @internal * Base host class, always present. */ readonly hostClass = true; /** * @internal * Host modifier applied while the skeleton is visible. */ get loadingClass(): boolean; /** * @internal * Host modifier that turns the shimmer animation off. */ get boilerplateClass(): boolean; /** * Whether this skeleton announces itself. A labelled skeleton is a live region; * an unlabelled one is decorative and hidden from assistive technology. * @internal */ get isAnnounced(): boolean; /** * @internal * Dropped rather than set to `false` once the content is in: absent already * means "not busy", and the element is meant to leave no trace behind it. */ get ariaBusy(): string | null; /** * @internal * `status` already implies `aria-live="polite"`, so the live attribute is not * repeated here. */ get role(): string | null; /** @internal */ get ariaLabelAttribute(): string | null; /** @internal */ get ariaHidden(): string | null; /** * @internal * Sizes the placeholder, never the content: the size is dropped along with the * bones so the projected content is free to be taller or wider than the shape * that stood in for it. */ get hostWidth(): string | null; /** @internal */ get hostHeight(): string | null; /** * Declaration the current tree was built from, so an equivalent `type` — a new * array instance holding the same names, for instance — does not rebuild it. */ private declaration; constructor(); /** * Rebuilds the skeleton tree whenever the requested type changes. */ ngOnChanges(changes: SimpleChanges): void; /** * TrackBy function used to render the bone list. * @internal */ trackByIndex: (index: number) => number; /** * Resolves the current `type` into the tree of bones, unless it describes the * same shape the tree already holds. */ private rebuildBones; /** * Resolves a type declaration into the tree of bones to render. * Recursion always terminates because {@link SKELETON_TYPE_MAP} is acyclic: * primitives map to themselves and composites only reference simpler types. * @param declaration - Single type or comma separated list of types */ private buildBones; /** * Expands a single token (`'text'`, `'text@3'`, …) into its bones. */ private buildBone; /** * Splits a token into its type and repetition count, applying the fallbacks * for unknown types and invalid counts. */ private parseToken; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; static ngAcceptInputType_loading: unknown; static ngAcceptInputType_boilerplate: unknown; }