import * as i0 from '@angular/core';
import { ProviderToken, FactorySansProvider, Provider, computed, ModuleWithProviders, Signal, linkedSignal, Injector, InjectionToken } from '@angular/core';
import { HasElementRef } from '@fundamental-ngx/cdk/utils';
import { Observable, Observer, Subscription } from 'rxjs';

declare enum ContentDensityMode {
    COZY = "cozy",
    CONDENSED = "condensed",
    COMPACT = "compact"
}

/**
 * Configuration for UI5 Web Components content density markers.
 * UI5 Web Components use `data-ui5-compact-size` attribute for compact mode.
 * Cozy is the default mode (no marker needed).
 */
interface Ui5ContentDensityMarkers {
    /**
     * Whether to apply UI5 content density markers.
     * When enabled, `data-ui5-compact-size` attribute will be applied
     * for COMPACT and CONDENSED modes (UI5 only supports cozy/compact).
     * @default true
     */
    enabled: boolean;
}
declare class ContentDensityObserverSettings {
    /** Classes to be added to the element. */
    modifiers?: Partial<Record<ContentDensityMode, string>>;
    /** Supported content densities. */
    supportedContentDensity?: ContentDensityMode[];
    /** Default content density. */
    defaultContentDensity?: ContentDensityMode | ProviderToken<ContentDensityMode> | FactorySansProvider;
    /** Whether in debug mode. */
    debug?: boolean;
    /** Whether to always add class modifiers. Useful for components that are detached from its parent component. */
    alwaysAddModifiers?: boolean;
    /** Whether to force child components to restrict supported content density with current component's one. */
    restrictChildContentDensity?: boolean;
    /**
     * Configuration for UI5 Web Components content density markers.
     * When enabled, applies `data-ui5-compact-size` attribute for compact/condensed modes.
     */
    ui5Markers?: Ui5ContentDensityMarkers;
}

declare const ContentDensityGlobalKeyword = "global";
declare const ContentDensityDefaultKeyword = "default";
type LocalContentDensityMode = ContentDensityMode | typeof ContentDensityGlobalKeyword | typeof ContentDensityDefaultKeyword;
interface BaseContentDensityModuleConfig {
    defaultGlobalContentDensity?: ContentDensityMode;
}
interface LocalStorageConfig {
    storage: 'localStorage';
    storageKey?: string;
}
interface UrlStorageConfig {
    storage: 'url';
    storageKey?: string;
}
interface CustomStorageConfig {
    storage: Provider;
}
interface MemoryStorageConfig {
    storage: 'memory';
}
type ContentDensityModuleConfig = (LocalStorageConfig | MemoryStorageConfig | UrlStorageConfig | CustomStorageConfig) & BaseContentDensityModuleConfig;
interface ContentDensityObserverTarget extends HasElementRef {
    contentDensitySettings?: ContentDensityObserverSettings;
}
type ContentDensityCallbackFn = (target: ContentDensityMode) => void;

/**
 * Directive to control the content density of elements.
 * Used by density controllers and consumers.
 *
 * Provides signal-based state management for reactive content density tracking.
 * Also applies UI5 `data-ui5-compact-size` attribute for UI5 Web Components compatibility.
 *
 * @example
 * // Using fdContentDensity input
 * <fd-button [fdContentDensity]="'compact'">Button</fd-button>
 *
 * // Using shorthand inputs
 * <fd-button fdCompact>Compact Button</fd-button>
 * <fd-button fdCozy>Cozy Button</fd-button>
 * <fd-button fdCondensed>Condensed Button</fd-button>
 */
declare class ContentDensityDirective {
    /**
     * Sets the content density of the element dynamically.
     * Accepts 'compact', 'cozy', 'condensed', or 'global'.
     *
     * @example
     * <fd-button [fdContentDensity]="'compact'">Button</fd-button>
     */
    readonly fdContentDensity: i0.InputSignal<"" | "cozy" | "condensed" | "compact" | LocalContentDensityMode>;
    /**
     * Shorthand for setting compact density.
     * Equivalent to `[fdContentDensity]="'compact'"`.
     *
     * @example
     * <fd-button fdCompact>Button</fd-button>
     * <fd-button [fdCompact]="isCompact">Button</fd-button>
     */
    readonly fdCompact: i0.InputSignalWithTransform<boolean, unknown>;
    /**
     * Shorthand for setting condensed density.
     * Equivalent to `[fdContentDensity]="'condensed'"`.
     *
     * @example
     * <fd-button fdCondensed>Button</fd-button>
     * <fd-button [fdCondensed]="isCondensed">Button</fd-button>
     */
    readonly fdCondensed: i0.InputSignalWithTransform<boolean, unknown>;
    /**
     * Shorthand for setting cozy density.
     * Equivalent to `[fdContentDensity]="'cozy'"`.
     *
     * @example
     * <fd-button fdCozy>Button</fd-button>
     * <fd-button [fdCozy]="isCozy">Button</fd-button>
     */
    readonly fdCozy: i0.InputSignalWithTransform<boolean, unknown>;
    /**
     * Current content density mode as a computed signal.
     * Resolves the density based on shorthand inputs or fdContentDensity value.
     *
     * @returns The resolved content density mode
     */
    readonly densityMode: ReturnType<typeof computed<LocalContentDensityMode>>;
    /**
     * Current density mode value.
     *
     * @deprecated Use densityMode() signal instead
     * @returns The current content density mode
     */
    get value(): LocalContentDensityMode;
    /** @hidden */
    private readonly _elementRef;
    /** @hidden */
    private readonly _renderer;
    /**
     * Internal signal for programmatic density updates.
     * Takes precedence over input bindings when set.
     */
    private readonly _programmaticDensity;
    /** @hidden */
    constructor();
    /**
     * Sets the content density programmatically.
     * Use this method when you need to update the density from code
     * (e.g., in host directives or dynamic scenarios).
     *
     * @param density The content density mode to set
     */
    setDensity(density: LocalContentDensityMode): void;
    /**
     * Clears the programmatic density override.
     * After calling this, the density will be resolved from input bindings.
     */
    clearDensity(): void;
    /**
     * Applies or removes the UI5 compact attribute based on density mode.
     * COMPACT and CONDENSED map to UI5 compact mode.
     * COZY and 'global' do not apply the attribute (UI5 defaults to cozy).
     * @hidden
     */
    private _applyUi5Attribute;
    static ɵfac: i0.ɵɵFactoryDeclaration<ContentDensityDirective, never>;
    static ɵdir: i0.ɵɵDirectiveDeclaration<ContentDensityDirective, "[fdContentDensity]:not([fdCompact]):not([fdCondensed]):not([fdCozy]),                [fdCompact]:not([fdContentDensity]):not([fdCondensed]):not([fdCozy]),                [fdCondensed]:not([fdContentDensity]):not([fdCompact]):not([fdCozy]),                [fdCozy]:not([fdContentDensity]):not([fdCompact]):not([fdCondensed])", ["fdContentDensity"], { "fdContentDensity": { "alias": "fdContentDensity"; "required": false; "isSignal": true; }; "fdCompact": { "alias": "fdCompact"; "required": false; "isSignal": true; }; "fdCondensed": { "alias": "fdCondensed"; "required": false; "isSignal": true; }; "fdCozy": { "alias": "fdCozy"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

/**
 * @deprecated
 * Use direct imports of components and directives.
 */
declare class ContentDensityModule {
    /** Module with providers */
    static forRoot(config?: ContentDensityModuleConfig): ModuleWithProviders<ContentDensityModule>;
    static ɵfac: i0.ɵɵFactoryDeclaration<ContentDensityModule, never>;
    static ɵmod: i0.ɵɵNgModuleDeclaration<ContentDensityModule, never, [typeof ContentDensityDirective], [typeof ContentDensityDirective]>;
    static ɵinj: i0.ɵɵInjectorDeclaration<ContentDensityModule>;
}

/**
 * Abstract class for content density storage implementations.
 * The default implementation is MemoryContentDensityStorage.
 *
 * Provides a signal-based API for reactive content density tracking.
 *
 * @example
 * // Provide a custom storage implementation
 * providers: [
 *   { provide: ContentDensityStorage, useClass: LocalContentDensityStorage }
 * ]
 */
declare abstract class ContentDensityStorage {
    /**
     * Current content density as a readonly signal.
     * Read this signal to get the current density or react to changes.
     */
    abstract readonly contentDensity: Signal<ContentDensityMode>;
    /**
     * Updates the content density.
     * @param density The new content density mode
     */
    abstract setContentDensity(density: ContentDensityMode): void;
}

/**
 * Creates provider for ContentDensityObserver
 */
declare function contentDensityObserverProviders(params?: ContentDensityObserverSettings): Provider[];

/**
 * Service for observing and managing content density in components.
 *
 * Provides signal-based API for reactive content density tracking.
 * Uses linkedSignal (Angular 21+) for derived state with validation.
 */
declare class ContentDensityObserver {
    /** Configuration for this observer */
    readonly config: ContentDensityObserverSettings;
    /**
     * Current content density as a readonly signal.
     * Uses linkedSignal internally for reactive updates with validation.
     */
    readonly contentDensity: ReturnType<ReturnType<typeof linkedSignal<ContentDensityMode, ContentDensityMode>>['asReadonly']>;
    /** Whether content density is compact (signal) */
    readonly isCompactSignal: ReturnType<typeof computed<boolean>>;
    /** Whether content density is cozy (signal) */
    readonly isCozySignal: ReturnType<typeof computed<boolean>>;
    /** Whether content density is condensed (signal) */
    readonly isCondensedSignal: ReturnType<typeof computed<boolean>>;
    /**
     * Current content density signal
     * @deprecated Use contentDensity() instead
     */
    readonly contentDensity$: ReturnType<ReturnType<typeof linkedSignal<ContentDensityMode, ContentDensityMode>>['asReadonly']>;
    /**
     * Observable for compact state changes
     * @deprecated Use isCompactSignal signal instead
     */
    readonly isCompact$: Observable<boolean>;
    /**
     * Observable for cozy state changes
     * @deprecated Use isCozySignal signal instead
     */
    readonly isCozy$: Observable<boolean>;
    /**
     * Observable for condensed state changes
     * @deprecated Use isCondensedSignal signal instead
     */
    readonly isCondensed$: Observable<boolean>;
    /**
     * Observable of content density changes
     * @deprecated Use contentDensity signal instead
     */
    readonly contentDensity$$: Observable<ContentDensityMode>;
    /**
     * Internal linkedSignal for content density with validation.
     * linkedSignal (Angular 21+) automatically tracks source changes
     * and applies the computation (validation/fallback).
     */
    private readonly _contentDensity;
    private readonly _changesSource;
    private readonly _destroyRef;
    private readonly _alternativeTo;
    private _globalContentDensityService;
    private _contentDensityDirective;
    private _parentContentDensityObserver;
    private _renderer;
    private _elementRef;
    private _elements;
    /**
     * Current content density value
     * @deprecated Use contentDensity() signal instead
     */
    get value(): ContentDensityMode;
    /**
     * Whether content density is compact
     * @deprecated Use isCompactSignal() signal instead
     */
    get isCompact(): boolean;
    /**
     * Whether content density is cozy
     * @deprecated Use isCozySignal() signal instead
     */
    get isCozy(): boolean;
    /**
     * Whether content density is condensed
     * @deprecated Use isCondensedSignal() signal instead
     */
    get isCondensed(): boolean;
    constructor(_injector: Injector, _providedConfig?: ContentDensityObserverSettings);
    /**
     * Add consumers to observe content density changes
     * @deprecated Use signal bindings instead
     */
    consume(...consumers: ContentDensityObserverTarget[]): void;
    /**
     * Completes the observer and cleans up resources
     * @deprecated Cleanup is automatic via DestroyRef
     */
    complete(): void;
    /**
     * Returns an observable of content density changes
     * @deprecated Use contentDensity signal instead
     */
    asObservable(): Observable<ContentDensityMode>;
    /**
     * Subscribe to content density changes.
     * @deprecated Use contentDensity signal with effect() instead.
     * This method exists for backward compatibility.
     */
    subscribe(observer?: Partial<Observer<ContentDensityMode>>): Subscription;
    /**
     * Remove a consumer from the observer
     * @deprecated Use signal bindings instead
     */
    removeConsumer(consumer: ContentDensityObserverTarget): void;
    private _validateAndFallback;
    private _cleanup;
    private _applyClass;
    /**
     * Apply or remove UI5 Web Components compact marker.
     * UI5 Web Components only support cozy (default) and compact modes.
     * Both COMPACT and CONDENSED fundamental-ngx modes map to UI5 compact.
     */
    private _applyUi5Marker;
    private _isSupported;
    static ɵfac: i0.ɵɵFactoryDeclaration<ContentDensityObserver, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<ContentDensityObserver>;
}

/**
 * Service for managing global content density state.
 * Provides a signal-based API for reactive content density tracking.
 */
declare class GlobalContentDensityService {
    /** Current content density as a readonly signal. */
    readonly currentDensitySignal: Signal<ContentDensityMode>;
    private readonly _storage;
    private readonly _injector;
    /**
     * Current content density value.
     *
     * @deprecated Use currentDensitySignal() instead
     * @returns The current content density mode
     */
    get currentContentDensity(): ContentDensityMode;
    constructor();
    /**
     * Returns an observable that emits content density changes.
     *
     * @deprecated Use currentDensitySignal signal instead
     * @returns Observable of content density changes
     */
    contentDensityListener(): Observable<ContentDensityMode>;
    /**
     * Updates the global content density.
     * @param density The new content density mode
     */
    updateContentDensity(density: ContentDensityMode): void;
    static ɵfac: i0.ɵɵFactoryDeclaration<GlobalContentDensityService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<GlobalContentDensityService>;
}

declare const isCompact: (density: any) => boolean;
declare const isCondensed: (density: any) => boolean;
declare const isCozy: (density: any) => boolean;
declare const isContentDensityMode: (density: any) => boolean;

/**
 * Interface for content density directive providers.
 * Uses signals for reactive content density tracking.
 */
interface ContentDensityDirectiveRef {
    /** Current density mode as a signal */
    readonly densityMode: Signal<LocalContentDensityMode>;
    /** Current density mode value (deprecated) */
    readonly value: LocalContentDensityMode;
}
declare const CONTENT_DENSITY_DIRECTIVE: InjectionToken<ContentDensityDirectiveRef>;

/** @hidden */
declare function mockedLocalContentDensityDirective(defaultValue?: LocalContentDensityMode): {
    contentDensityDirectiveProvider: Provider;
    setContentDensity: (cd: LocalContentDensityMode) => void;
};

declare const defaultContentDensityObserverConfigs: Required<ContentDensityObserverSettings>;

/**
 * Provides content density services and configurations
 * @param config
 */
declare function provideContentDensity(config?: ContentDensityModuleConfig): Provider[];

export { CONTENT_DENSITY_DIRECTIVE, ContentDensityDefaultKeyword, ContentDensityDirective, ContentDensityGlobalKeyword, ContentDensityMode, ContentDensityModule, ContentDensityObserver, ContentDensityObserverSettings, ContentDensityStorage, GlobalContentDensityService, contentDensityObserverProviders, defaultContentDensityObserverConfigs, isCompact, isCondensed, isContentDensityMode, isCozy, mockedLocalContentDensityDirective, provideContentDensity };
export type { ContentDensityCallbackFn, ContentDensityDirectiveRef, ContentDensityModuleConfig, ContentDensityObserverTarget, LocalContentDensityMode, Ui5ContentDensityMarkers };
