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; }; /** * Functions that modify an element's setting values each time they are read. * * @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); /** * Adds a function that modifies the value of setting `key` each time it is * read. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/adapters/} for more info * @param key Setting key * @param callback Takes the value and returns the modified one * @return Disposer that removes the adapter */ add(key: Key, callback: (value: E["_settings"][Key], target: E, key: Key) => E["_settings"][Key]): IDisposer; /** * Removes all adapters for setting `key`. * * @since 5.1.0 * @param key Setting key */ remove(key: Key): void; /** * Turns the adapters for setting `key` back on after `disable()`. * * @since 5.1.0 * @param key Setting key */ enable(key: Key): void; /** * Turns off all adapters for setting `key` without removing them. * * @since 5.1.0 * @param key Setting key */ disable(key: Key): void; /** * @ignore */ fold(key: Key, value: E["_settings"][Key]): E["_settings"][Key]; } export interface IEntitySettings { /** * Ignores themes: no theme rule applies to the element, not even one of the * default theme. * * @default false * @since 5.15.6 */ ignoreThemes?: boolean; /** * Tags that theme rules can target. They also count for the element's * children, so a rule can match a child by a tag of its parent. * * @see {@link https://www.amcharts.com/docs/v5/concepts/themes/} for more info */ themeTags?: Array; /** * Tags that theme rules can target, like `themeTags`, but only for this * element, not its children. * * @see {@link https://www.amcharts.com/docs/v5/concepts/themes/} for more info */ themeTagsSelf?: Array; /** * Themes applied to the element and everything inside it. */ themes?: Array; /** * How long, in milliseconds, a switch from one state to another animates. * `0` switches at once. * * @default 0 */ stateAnimationDuration?: number; /** * Easing of the animated switch from one state to another. * * @default out(cubic) */ stateAnimationEasing?: $ease.Easing; /** * A unique ID for looking the element up in `root.entitiesById`. Setting * an ID that another element already has throws an error. */ id?: string; /** * Any data of your own to keep with the element. */ userData?: any; /** * Animations the element plays on its own, described as data - so they can * be set from a JSON config and saved with it. * * Each one animates a setting of the element (or, with `target: "dataItem"`, * a value of its data item - a map point's `positionOnLine`, say). They start * when the setting is applied, restart when it changes, and stop when the * element is disposed. A saved config keeps what was configured, never a * value caught half way through an animation. * * ```TypeScript * sprite.set("animations", [ * { key: "rotation", to: 360, duration: 4000, loops: 0 }, * { key: "scale", from: 1, to: 1.3, duration: 800, loops: 0, yoyo: true, easing: "sine" } * ]); * ``` * * @since 5.20.8 */ animations?: Array; } /** * An animation described as data, for the `animations` setting. * * @since 5.20.8 */ export interface IDeclaredAnimation { /** * Setting (or data item value, with `target: "dataItem"`) to animate. */ key: string; /** * Value to start from. Defaults to the current value. */ from?: any; /** * Value to animate to. */ to: any; /** * Duration in milliseconds. With `yoyo`, one way. */ duration: number; /** * Milliseconds to wait before starting. * * @default 0 */ delay?: number; /** * How many times to play it; `0` plays it forever. * * @default 1 */ loops?: number; /** * Go back to `from` after reaching `to`, rather than jumping back. * * @default false */ yoyo?: boolean; /** * Easing by name: `"linear"`, `"quad"`, `"cubic"`, `"exp"`, `"sine"`, * `"circle"`, `"bounce"` or `"elastic"`. * * @default "linear" */ easing?: string; /** * Which way the easing applies. * * @default "in" */ ease?: "in" | "out" | "inOut"; /** * `"self"` animates a setting of the element; `"dataItem"` a value of the * element's data item. * * @default "self" */ target?: "self" | "dataItem"; } export interface IEntityPrivate { } export interface IEntityEvents { } /** * Animation options. * * @see {@link https://www.amcharts.com/docs/v5/concepts/animations/} for more info */ export interface AnimationOptions { /** * The setting to animate. */ key: Key; /** * Value to start from. The current value if not set. */ from?: Value; /** * Value to animate to. */ to: Value; /** * Duration in milliseconds. `0` sets the value at once. */ duration: number; /** * Easing function. Linear if not set. * * @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; `Infinity` plays it forever. * Plays once if not set. */ loops?: number; } export interface IAnimationEvents { /** * The animation stopped: it reached the end, `stop()` was called, or the * same setting was set, removed or animated again. */ stopped: {}; } /** * An animation of a setting, returned by `animate()`. It can be paused, * resumed, stopped or waited for. * * @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; _declared: boolean; events: EventDispatcher>; constructor(animation: IStartAnimation, from: Value, to: Value, duration: number, easing: $ease.Easing, loops: number, startingTime: number | null); /** * The value the animation goes to. */ get to(): Value; /** * @ignore */ get duration(): number; /** * @ignore */ get easing(): $ease.Easing; /** * Plays left, `Infinity` for one that loops for ever. * * @ignore */ get loops(): number; /** * The value the animation starts from. */ get from(): Value; /** * `true` while the animation plays, `false` when it is paused or stopped. */ get playing(): boolean; /** * `true` once the animation has stopped. A stopped animation can't be * played again. */ get stopped(): boolean; /** * Stops the animation, leaving the setting at its current value. */ stop(): void; /** * Pauses the animation; `play()` resumes it. */ pause(): void; /** * Resumes a paused animation. */ play(): void; /** * How far the current loop has played, from `0` to `1`, before easing. */ get percentage(): Time; /** * Returns a promise that resolves when the animation stops. * * @return Promise */ 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; } /** * The newest `uid` given out: anything made after this call has a higher one. * * @ignore */ export declare function _lastUid(): number; /** * Base class for objects with settings, such as [[Entity]]. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info */ export declare abstract class Settings implements IDisposer, IAnimation, IStartAnimation { /** * A unique number, given to each object as it is created. */ 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)>; }; _debouncedSettingEvents: { [K in keyof this["_settings"]]?: Array<{ cb: (value: any, target?: any, key?: any) => void; delay: number; timeout?: number; }>; }; _debouncedPrivateSettingEvents: { [K in keyof this["_settings"]]?: Array<{ cb: (value: any, target?: any, key?: any) => void; delay: number; timeout?: number; }>; }; _prevSettings: this["_settings"]; _prevPrivateSettings: this["_privateSettings"]; protected _animatingSettings: Animated; protected _animatingPrivateSettings: Animated; private _disposed; protected _userProperties: Dirty; protected _computedProperties: Dirty; /** * What a setting held before an `animations` entry took it over, and where * that came from - what a saved config writes, rather than a value caught * mid-animation. Put back when the animation is removed. * * @ignore */ _animationBases: { [key: string]: { value: any; user: boolean; computed: boolean; }; }; protected _animationWriting: number; /** * Set to `false` to make `dispose()` do nothing. */ 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; /** * Calls `callback` each time the value of setting `key` changes or is * removed. Setting the same value again does not call it. * * @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 added with `on()`. Without `callback`, removes all of * them for `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Settings key * @param callback Callback * @since 5.9.2 */ off(key: Key, callback?: (value: this["_settings"][Key], target?: this, key?: Key) => void): void; /** * Like `on()`, but the callback is removed after it is called once. * * @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 * @since 5.20.4 */ once(key: Key, callback: (value: this["_settings"][Key], target?: this, key?: Key) => void): IDisposer; private _onDebouncedHelper; private _offDebouncedHelper; /** * Like `on()`, but waits until setting `key` has not changed for * `debounceDelay` milliseconds, then calls `callback` once with the latest * value. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Settings key * @param callback Callback * @param debounceDelay Debounce delay in milliseconds * @return Disposer for event */ onDebounced(key: Key, callback: (value: this["_settings"][Key], target?: this, key?: Key) => void, debounceDelay: number): IDisposer; /** * Removes a callback added with `onDebounced()`. Without `callback`, * removes all of them for `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Settings key * @param callback Callback */ offDebounced(key: Key, callback?: (value: this["_settings"][Key], target?: this, key?: Key) => void): void; /** * Like `onDebounced()`, but the callback is removed after it is called once. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Settings key * @param callback Callback * @param debounceDelay Debounce delay in milliseconds * @return Disposer for event * @since 5.20.4 */ onceDebounced(key: Key, callback: (value: this["_settings"][Key], target?: this, key?: Key) => void, debounceDelay: number): IDisposer; /** * Calls `callback` each time the value of private setting `key` 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 * @return Disposer for event */ onPrivate(key: Key, callback: (value: this["_privateSettings"][Key], target?: this, key?: Key) => void): IDisposer; /** * Removes a callback added with `onPrivate()`. Without `callback`, removes * all of them for `key`. * * @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; /** * Like `onPrivate()`, but waits until private setting `key` has not changed * for `debounceDelay` milliseconds, then calls `callback` once with the * latest value. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Private settings key * @param callback Callback * @param debounceDelay Debounce delay in milliseconds * @return Disposer for event */ onPrivateDebounced(key: Key, callback: (value: this["_privateSettings"][Key], target?: this, key?: Key) => void, debounceDelay: number): IDisposer; /** * Removes a callback added with `onPrivateDebounced()`. Without `callback`, * removes all of them for `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/#Settings_value_change} for more info * @param key Private settings key * @param callback Callback */ offDebouncedPrivate(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 setting `key` is set. * * @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 the value of setting `key`, or `fallback` if it is not set. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Settings key * @param fallback Value to return if the setting is not set * @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 setting `key` to `value` and returns `value`. Stops any animation * of that setting. * * @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 the value of setting `key`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Setting key */ remove(key: Key): void; /** * Removes all settings, as `remove()` does for each one. * * @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 several settings at once, from an object of key-value pairs. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param settings Settings */ setAll(settings: Partial): void; /** * Writes a value an animation arrived at. * * An animation carries provenance along rather than creating it: a setting * that was asked for stays that way, and one that was computed - or never set * at all - does not become a choice just because something animated to it. */ protected _setAnimated(key: Key, value: this["_settings"][Key]): void; /** * Animates a setting from its current value (or `from`) to `to`. The * setting jumps to `from` at once. With `duration` `0`, or no value to * start from, it is set to `to` at once and the returned animation is * already stopped. * * @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 the object has been disposed. * * @return Disposed */ isDisposed(): boolean; /** * Disposes the object, freeing everything it holds. A disposed object * can't be used again. */ dispose(): void; } /** * Base class of amCharts objects with settings, states, adapters and events: * elements, series, charts, formatters and more. * * @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; }; /** * Tags given to the element, as opposed to ones the library added. * * @ignore */ _userThemeTags: Array | undefined; /** * Made by the library while building another element, not by the user. * * @ignore */ _builtIn: boolean; /** * 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>); /** * Creates an instance of the class. Use it instead of `new 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 to apply to the instance * @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; /** * Returns `true` if the object is of class `type` or extends it. * * @param type Class name, such as `"XYSeries"` * @return {boolean} Is of class? */ isType(type: string): this is A; protected _pushPropertyDisposer(key: Key, disposer: D): D; protected _disposeProperty(key: Key): void; /** * A [[Template]] applied to the object. Its settings apply where the * object has none set of its own. * * @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 the value of setting `key`, run through any adapters, or * `fallback` if it is not set. * * @see {@link https://www.amcharts.com/docs/v5/concepts/settings/} for more info * @param key Settings key * @param fallback Value to return if the setting is not set * @return Value */ get(key: Key, fallback: F): NonNullable | F; get(key: Key): this["_settings"][Key]; /** * @ignore */ isUserSetting(key: Key): boolean; /** * Sets setting `key` to `value` and returns `value`. A value set this way * overrides themes and templates, and stops any animation of the setting. * * @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; /** * Same as `set()`, but for a value the library works out itself rather than * one that was asked for - a size measured during layout, a color derived * from data, and so on. * * Behaves identically in every way that affects the chart; the value is only * additionally flagged as computed, so that it can be left out when the chart * is serialized. * * @ignore * @param key Setting key * @param value Setting value * @return Setting value */ _setC(key: Key, value: Value): Value; /** * Same as `setRaw()`, but for a value the library works out itself. * * Kept separate from `_setC()` because `setRaw()` deliberately writes without * the side effects of `set()` - no animation is stopped and no change is * announced - and callers that reach for it are relying on that. * * @ignore * @param key Setting key * @param value Setting value */ _setCRaw(key: Key, value: Value): void; /** * Flags already-set settings as computed, without writing anything. * * For settings passed to `new()` by the library itself, where re-setting them * just to flag them would announce a change that never happened. * * @ignore * @param keys Setting keys * @return Itself */ _markC(this: T, ...keys: Array): T; /** * Sets multiple computed settings at once. * * @ignore * @param settings Settings */ _setCAll(settings: Partial): void; /** * Returns `true` if the setting holds a value the library worked out itself. * * @ignore * @param key Setting key * @return Computed? */ isComputedSetting(key: Key): boolean; /** * @ignore */ setRaw(key: Key, value: Value): void; /** * Sets setting `key` to `value` unless it was already set with `set()`. * Returns `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 the value set for setting `key`. The setting goes back to the * value from a theme or template, if one has it. * * @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; protected _declaredAnimations: Array<{ target: Settings; key: string; animation: Animation; }>; protected _declaredTimers: Array; protected _animationsApplied: boolean; /** * Stops what the `animations` setting started and puts back what the * animated settings held before. */ protected _stopDeclaredAnimations(restore?: boolean): void; /** * Plays the `animations` setting. */ protected _playDeclaredAnimations(): void; /** * Plays the `animations` setting when it changed. A container does this * before it prepares its children, so that a value an animation starts * from, or puts back when it is removed, is part of the same frame. */ protected _applyDeclaredAnimations(): void; _beforeChanged(): void; private _registerId; _afterChanged(): void; /** * @ignore */ addDisposer(disposer: T): T; protected _dispose(): void; /** * Calls `fn` after `delay` milliseconds, unless the object is disposed * first. Disposing the returned disposer cancels it. * * @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; /** * Tags given to the element that are still set. * * @ignore */ _getUserThemeTags(): Array; /** * @ignore */ _addUserThemeTags(tags: Array): void; /** * @ignore */ removeTag(tag: string): void; protected _t(text: any, locale?: ILocale, ...rest: Array): string; /** * The [[Root]] the object belongs to. * * @readonly * @since 5.0.6 * @return Root object */ get root(): Root; } export {}; //# sourceMappingURL=Entity.d.ts.map