import type { Root } from "../Root"; import type { Template, ApplyState } from "./Template"; import type { Theme } from "../Theme"; import type { ILocale } from "./Language"; import { IDisposer } from "./Disposer"; import { EventDispatcher, Events } from "./EventDispatcher"; import { Time, IAnimation, AnimationState } from "./Animation"; import { States } from "./States"; import * as $ease from "./Ease"; /** * @ignore */ export declare type Dirty = { [K in keyof A]?: boolean; }; /** * Allows to dynamically modify setting value of its target element. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/adapters/} for more info */ export declare class Adapters { private _entity; private _callbacks; private _disabled; constructor(entity: E); /** * Add a function (`callback`) that will modify value for setting `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/adapters/} for more info */ add(key: Key, callback: (value: E["_settings"][Key], target: E, key: Key) => E["_settings"][Key]): IDisposer; /** * Removes all adapters for the specific key. * * @since 5.1.0 */ remove(key: Key): void; /** * Enables (previously disabled) adapters for specific key. * * @since 5.1.0 */ enable(key: Key): void; /** * Disables all adapters for specific key. * * @since 5.1.0 */ disable(key: Key): void; /** * @ignore */ fold(key: Key, value: E["_settings"][Key]): E["_settings"][Key]; } export interface IEntitySettings { /** * If set to `true` the themes will be ignored when applying settings. * * @default false * @since 5.15.6 */ ignoreThemes?: boolean; /** * Tags which can be used by the theme rules. * * @see {@link https://www.amcharts.com/docs/v5/concepts/themes/} for more info */ themeTags?: Array; /** * Tags which can be used by the theme rules. * * These tags only apply to this object, not any children. * * @see {@link https://www.amcharts.com/docs/v5/concepts/themes/} for more info */ themeTagsSelf?: Array; /** * A list of themes applied to the element. */ themes?: Array; /** * Duration of transition from one state to another. * * @default 0 */ stateAnimationDuration?: number; /** * Easing of transition from one state to another. * * @default out(cubic) */ stateAnimationEasing?: $ease.Easing; /** * A custom string ID for the element. * * If set, element can be looked up via `root.entitiesById`. * * Will raise error if an element with the same ID already exists. */ id?: string; /** * A storage for any custom user data that needs to be associated with the * element. */ userData?: any; } export interface IEntityPrivate { } export interface IEntityEvents { } /** * Animation options. * * @see {@link https://www.amcharts.com/docs/v5/concepts/animations/} for more info */ export interface AnimationOptions { /** * A setting key to animate value for. */ key: Key; /** * Initial value to animate from. If not set, will use current value. */ from?: Value; /** * Target value to animate to. */ to: Value; /** * Animation duration in milliseconds. */ duration: number; /** * Easing function. Defaults to linear. * * @see {@link https://www.amcharts.com/docs/v5/concepts/animations/#Easing_functions} for more info */ easing?: $ease.Easing; /** * How many times to play the animation. Defaults to 1. */ loops?: number; } export interface IAnimationEvents { /** * Invoked when animation was stopped, which happens in these situations: * 1. When the animation reached the end. * 2. When the `stop()` method is called. * 3. When a new animation starts for the same key. * 4. When calling `set` for the same key. */ stopped: {}; } /** * Animation object. * * @see {@link https://www.amcharts.com/docs/v5/concepts/animations/} for more info */ export declare class Animation { private _animation; private _from; private _to; private _duration; private _easing; private _loops; private _interpolate; private _oldTime; private _time; _stopped: boolean; _playing: boolean; events: EventDispatcher>; constructor(animation: IStartAnimation, from: Value, to: Value, duration: number, easing: $ease.Easing, loops: number, startingTime: number | null); get to(): Value; get from(): Value; get playing(): boolean; get stopped(): boolean; stop(): void; pause(): void; play(): void; get percentage(): Time; waitForStop(): Promise; _checkEnded(): boolean; _run(currentTime: number): void; _reset(currentTime: number): void; _value(diff: Time): Value; } declare type Animated

= { [K in keyof P]?: Animation; }; interface IStartAnimation { _startAnimation(): void; } /** * Base class for [[Entity]] objects that support Settings. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info */ export declare abstract class Settings implements IDisposer, IAnimation, IStartAnimation { /** * Unique ID. */ uid: number; _settings: {}; _privateSettings: {}; _settingEvents: { [K in keyof this["_settings"]]?: Array<((value: V, target?: O, key?: K) => void)>; }; _privateSettingEvents: { [K in keyof this["_settings"]]?: Array<((value: V, target?: O, key?: K) => void)>; }; _prevSettings: this["_settings"]; _prevPrivateSettings: this["_privateSettings"]; protected _animatingSettings: Animated; protected _animatingPrivateSettings: Animated; private _disposed; protected _userProperties: Dirty; /** * If this is set to `false` then disposing does nothing, it's a no-op. */ enableDispose: boolean; constructor(settings: Settings["_settings"]); protected _checkDirty(): void; /** * @ignore */ resetUserSettings(): void; /** * @ignore */ abstract markDirty(): void; _runAnimation(currentTime: number): AnimationState; abstract _startAnimation(): void; protected abstract _animationTime(): number | null; _markDirtyKey(_key: Key): void; _markDirtyPrivateKey(_key: Key): void; /** * Sets a callback function to invoke when specific key of settings changes * or is set. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Settings key * @param callback Callback * @return Disposer for event */ on(key: Key, callback: (value: this["_settings"][Key], target?: this, key?: Key) => void): IDisposer; /** * Removes a callback for when value of a setting changes. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Private settings key * @param callback Callback * @since 5.9.2 */ off(key: Key, callback?: (value: this["_settings"][Key], target?: this, key?: Key) => void): void; /** * Sets a callback function to invoke when specific key of private settings * changes or is set. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Private settings key * @param callback Callback * @return Disposer for event */ onPrivate(key: Key, callback: (value: this["_privateSettings"][Key], target?: this, key?: Key) => void): IDisposer; /** * Removes a callback for when value of a private setting changes. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Private settings key * @param callback Callback * @since 5.9.2 */ offPrivate(key: Key, callback?: (value: this["_privateSettings"][Key], target?: this, key?: Key) => void): void; /** * @ignore */ getRaw(key: Key, fallback: F): NonNullable | F; /** * @ignore */ getRaw(key: Key): this["_settings"][Key]; /** * Returns `true` if the setting exists. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Settings key * @return {boolean} Key exists */ has(key: Key): boolean; /** * Returns settings value for the specified `key`. * * If there is no value, `fallback` is returned instead (if set). * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Settings value * @param callback Fallback value * @return {any} Value */ get(key: Key, fallback: F): NonNullable | F; get(key: Key): this["_settings"][Key]; protected _sendKeyEvent(key: Key, value: Value): void; protected _sendPrivateKeyEvent(key: Key, value: Value): void; /** * @ignore */ private _setRaw; /** * @ignore */ setRaw(key: Key, value: Value): void; /** * @ignore */ private _set; protected _stopAnimation(key: Key): void; /** * Sets a setting `value` for the specified `key`, and returns the same `value`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key * @param value Setting value * @return Setting value */ set(key: Key, value: Value): Value; /** * Removes a setting value for the specified `key`; * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key */ remove(key: Key): void; /** * Removes all keys; * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info */ removeAll(): void; /** * @ignore */ getPrivate(key: Key, fallback: F): NonNullable | F; /** * @ignore */ getPrivate(key: Key): this["_privateSettings"][Key]; /** * @ignore */ private _setPrivateRaw; /** * @ignore */ setPrivateRaw(key: Key, value: Value): void; /** * @ignore */ private _setPrivate; protected _stopAnimationPrivate(key: Key): void; /** * @ignore */ setPrivate(key: Key, value: Value): Value; /** * @ignore */ removePrivate(key: Key): void; /** * Sets multiple settings at once. * * `settings` must be an object with key: value pairs. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param settings Settings */ setAll(settings: Partial): void; /** * Animates setting values from current/start values to new ones. * * @see {@link https://www.amcharts.com/docs/v5/concepts/animations/#Animating_settings} for more info * @param options Animation options * @return Animation object */ animate(options: AnimationOptions): Animation; /** * @ignore */ animatePrivate(options: AnimationOptions): Animation; protected _dispose(): void; /** * Returns `true` if this element is disposed. * * @return Disposed */ isDisposed(): boolean; /** * Disposes this object. */ dispose(): void; } /** * Base class. * * @important */ export declare class Entity extends Settings implements IDisposer { _root: Root; _user_id: any; _settings: IEntitySettings; _privateSettings: IEntityPrivate; _events: IEntityEvents; states: States; adapters: Adapters; events: EventDispatcher>; protected _userPrivateProperties: Dirty; _dirty: Dirty; _dirtyPrivate: Dirty; protected _template: Template | undefined; protected _templates: Array>; protected _internalTemplates: Array>; _defaultThemes: Array; protected _templateDisposers: Array; protected _disposers: Array; protected _runSetup: boolean; static className: string; static classNames: Array; protected _disposerProperties: { [Key in keyof this["_settings"]]?: Array; }; /** * IMPORTANT! Do not instantiate this class via `new Class()` syntax. * * Use static method `Class.new()` instead. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/#New_element_syntax} for more info * @ignore */ constructor(root: Root, settings: Entity["_settings"], isReal: boolean, templates?: Array>); /** * Use this method to create an instance of this class. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/#New_element_syntax} for more info * @param root Root element * @param settings Settings * @param template Template * @return Instantiated object */ static new>(this: C, root: Root, settings: T["_settings"], template?: Template): T; static _new>(this: C, root: Root, settings: T["_settings"], templates?: Array>): T; protected _afterNew(): void; protected _afterNewApplyThemes(): void; protected _createEvents(): EventDispatcher>; /** * @ignore */ get classNames(): Array; /** * @ignore */ get className(): string; protected _setDefaults(): void; _setDefaultFn(key: Key, f: () => Value): NonNullable | Value; _setDefault(key: Key, value: this["_settings"][Key]): void; _setRawDefault(key: Key, value: this["_settings"][Key]): void; _clearDirty(): void; /** * @ignore */ isDirty(key: Key): boolean; /** * @ignore */ isPrivateDirty(key: Key): boolean; _markDirtyKey(key: Key): void; _markDirtyPrivateKey(key: Key): void; /** * Checks if element is of certain class (or inherits one). * * @param type Class name to check * @return {boolean} Is of class? */ isType(type: string): this is A; protected _pushPropertyDisposer(key: Key, disposer: D): D; protected _disposeProperty(key: Key): void; /** * @todo needs description * @param value Template */ set template(value: Template | undefined); get template(): Template | undefined; /** * @ignore */ markDirty(): void; _startAnimation(): void; protected _animationTime(): number | null; _applyState(_name: string): void; _applyStateAnimated(_name: string, _duration?: number): void; /** * Returns settings value for the specified `key`. * * If there is no value, `fallback` is returned instead (if set). * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Settings value * @param callback Fallback value * @return Value */ get(key: Key, fallback: F): NonNullable | F; get(key: Key): this["_settings"][Key]; /** * @ignore */ isUserSetting(key: Key): boolean; /** * Sets a setting `value` for the specified `key`, and returns the same `value`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key * @param value Setting value * @return Setting value */ set(key: Key, value: Value): Value; /** * @ignore */ setRaw(key: Key, value: Value): void; /** * Sets a setting `value` for the specified `key` only if the value for this key was not set previously using set method, and returns the same `value`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key * @param value Setting value * @return Setting value */ _setSoft(key: Key, value: Value): Value; /** * Removes a setting value for the specified `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key */ remove(key: Key): void; /** * @ignore */ setPrivate(key: Key, value: Value): Value; /** * @ignore */ setPrivateRaw(key: Key, value: Value): void; /** * @ignore */ removePrivate(key: Key): void; _setTemplateProperty(template: Template, key: Key, value: this["_settings"][Key]): void; _setTemplatePrivateProperty(template: Template, key: Key, value: this["_privateSettings"][Key]): void; _removeTemplateProperty(key: Key): void; _removeTemplatePrivateProperty(key: Key): void; _walkParents(f: (parent: Entity) => void): void; _applyStateByKey(name: string): void; protected _applyTemplate(template: Template, state: ApplyState): void; /** * Calls the closure with each template and returns the first template which is true */ protected _findStaticTemplate(f: (template: Template) => boolean): Template | undefined; _eachTemplate(f: (template: Template) => void): void; _applyTemplates(remove?: boolean): void; protected _findTemplate(f: (template: Template) => boolean): Template | undefined; protected _findTemplateByKey(key: Key): Template | undefined; protected _findTemplateByPrivateKey(key: Key): Template | undefined; protected _disposeTemplates(): void; protected _removeTemplates(): void; _applyThemes(force?: boolean): boolean; _changed(): void; _beforeChanged(): void; private _registerId; _afterChanged(): void; /** * @ignore */ addDisposer(disposer: T): T; protected _dispose(): void; /** * Creates and returns a "disposable" timeout. * * @param fn Callback * @param delay Delay in milliseconds * @return Timeout disposer */ setTimeout(fn: () => void, delay: number): IDisposer; /** * @ignore */ removeDispose(target: IDisposer): void; /** * @ignore */ hasTag(tag: string): boolean; /** * @ignore */ addTag(tag: string): void; /** * @ignore */ removeTag(tag: string): void; protected _t(text: any, locale?: ILocale, ...rest: Array): string; /** * An instance of [[Root]] object. * * @readonly * @since 5.0.6 * @return Root object */ get root(): Root; } export {}; //# sourceMappingURL=Entity.d.ts.map