Aggrid custom

This commit is contained in:
2026-03-17 08:44:54 +01:00
commit 739374d83f
3234 changed files with 1533165 additions and 0 deletions

9582
node_modules/ag-charts-core/dist/package/main.cjs.js generated vendored Executable file

File diff suppressed because it is too large Load Diff

12
node_modules/ag-charts-core/dist/package/main.cjs.min.js generated vendored Executable file

File diff suppressed because one or more lines are too long

12
node_modules/ag-charts-core/dist/package/main.esm.min.mjs generated vendored Executable file

File diff suppressed because one or more lines are too long

9566
node_modules/ag-charts-core/dist/package/main.esm.mjs generated vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
import { BaseProperties } from '../state/properties';
export declare class InterpolationProperties extends BaseProperties {
type: 'linear' | 'smooth' | 'step';
tension: number;
position: 'start' | 'middle' | 'end';
}

View File

@@ -0,0 +1,2 @@
import type { AgChartLegendPosition, AgChartLegendPositionOptions } from 'ag-charts-types';
export declare function expandLegendPosition(position: AgChartLegendPosition): Required<AgChartLegendPositionOptions>;

View File

@@ -0,0 +1,24 @@
import { type AgBaseSeriesOptions, type AgBaseSeriesThemeableOptions, type AgBaseThemeableChartOptions, type AgChartAutoSizedBaseLabelOptions, type AgChartLabelOptions, type AgDropShadowOptions, type AgErrorBarOptions, type AgErrorBarThemeableOptions, type AgInterpolationType, type AgSeriesMarkerOptions, type AgSeriesMarkerStyle, type AgSeriesTooltip, type ToolbarButton } from 'ag-charts-types';
import { type OptionsDefs, type Validator } from '../state/validation';
export declare const legendPositionValidator: Validator;
export declare const shapeValidator: Validator;
export declare const rangeValidator: Validator;
export declare const seriesTooltipRangeValidator: Validator;
export declare const textOrSegments: Validator;
export declare const contextMenuItemsArray: Validator;
export declare const toolbarButtonOptionsDefs: OptionsDefs<ToolbarButton>;
export declare const formatObjectValidator: Validator;
export declare const numberFormatValidator: Validator;
export declare const commonChartOptionsDefs: OptionsDefs<Omit<AgBaseThemeableChartOptions, 'navigator'>>;
export declare const commonSeriesThemeableOptionsDefs: OptionsDefs<AgBaseSeriesThemeableOptions<any>>;
export declare const commonSeriesOptionsDefs: OptionsDefs<AgBaseSeriesOptions<any>>;
export declare const markerStyleOptionsDefs: OptionsDefs<AgSeriesMarkerStyle>;
export declare const markerOptionsDefs: OptionsDefs<AgSeriesMarkerOptions<any, any>>;
export declare const seriesLabelOptionsDefs: OptionsDefs<AgChartLabelOptions<any, any>>;
export declare const autoSizedLabelOptionsDefs: OptionsDefs<AgChartAutoSizedBaseLabelOptions<any, any>>;
export declare const errorBarThemeableOptionsDefs: OptionsDefs<AgErrorBarThemeableOptions>;
export declare const errorBarOptionsDefs: OptionsDefs<AgErrorBarOptions<any>>;
export declare const tooltipOptionsDefs: OptionsDefs<AgSeriesTooltip<any>>;
export declare const tooltipOptionsDefsWithArea: OptionsDefs<AgSeriesTooltip<any>>;
export declare const shadowOptionsDefs: OptionsDefs<AgDropShadowOptions>;
export declare const interpolationOptionsDefs: OptionsDefs<AgInterpolationType>;

View File

@@ -0,0 +1,8 @@
import type { AgLinearGaugePreset, AgLinearGaugeTarget, AgLinearGaugeThemeableOptions, AgRadialGaugePreset, AgRadialGaugeTarget, AgRadialGaugeThemeableOptions } from 'ag-charts-types';
import { type OptionsDefs } from '../state/validation';
export declare const linearGaugeTargetOptionsDef: OptionsDefs<AgLinearGaugeTarget>;
export declare const radialGaugeTargetOptionsDef: OptionsDefs<AgRadialGaugeTarget>;
export declare const linearGaugeSeriesThemeableOptionsDef: OptionsDefs<AgLinearGaugeThemeableOptions>;
export declare const linearGaugeSeriesOptionsDef: OptionsDefs<AgLinearGaugePreset>;
export declare const radialGaugeSeriesThemeableOptionsDef: OptionsDefs<AgRadialGaugeThemeableOptions>;
export declare const radialGaugeSeriesOptionsDef: OptionsDefs<AgRadialGaugePreset>;

View File

@@ -0,0 +1,65 @@
import type { AgBarHighlightStyleOptions, AgGradientColor, AgGradientColorBounds, AgGradientType, AgHighlightStyleOptions, AgImageFill, AgLineHighlightStyleOptions, AgPatternColor, AgSeriesLineSegmentOptions, AgSeriesShapeSegmentOptions, BorderOptions, CssColor, FillOptions, LabelBoxOptions, LineDashOptions, StrokeOptions, TextOptions } from 'ag-charts-types';
import { type OptionsDefs } from '../state/validation';
export declare const themeOperator: (value: unknown) => boolean;
export declare const colorStopsOrderValidator: import("../state/validation").Validator;
export declare const gradientColorStops: import("../state/validation").Validator;
export declare const gradientStrict: import("../state/validation").Validator;
export interface InternalAgGradientColor extends AgGradientColor {
/** Format of the gradient */
gradient?: AgGradientType;
/** The domain of the colour gradient, defaults to item. */
bounds?: AgGradientColorBounds;
/** Reverse the order of colour stops. */
reverse?: boolean;
/** Colour space to use when interpolating colours in the gradient. */
colorSpace?: ColorSpace;
}
export type ColorSpace = 'rgb' | 'oklch';
export interface InternalAgPatternColor extends AgPatternColor {
/** Padding for the shape in the pattern unit. */
padding?: number;
}
export interface InternalAgImageFill extends AgImageFill {
}
export type RequiredInternalAgImageFill = Required<Omit<InternalAgImageFill, 'url' | 'width' | 'height'>> & Pick<Partial<InternalAgImageFill>, 'url'> & Pick<InternalAgImageFill, 'width' | 'height'>;
export type RequiredInternalAgPatternColor = Required<Omit<InternalAgPatternColor, 'path'>> & Pick<InternalAgPatternColor, 'path'>;
export type RequiredInternalAgGradientColor = Required<InternalAgGradientColor>;
export type InternalAgColorType = CssColor | InternalAgGradientColor | InternalAgPatternColor | InternalAgImageFill;
export type RequiredInternalAgColorType = CssColor | RequiredInternalAgGradientColor | RequiredInternalAgPatternColor | (RequiredInternalAgImageFill & Pick<InternalAgImageFill, 'url'>);
export declare const strokeOptionsDef: OptionsDefs<StrokeOptions>;
export declare const fillGradientDefaults: import("../state/validation").Validator;
export declare const fillPatternDefaults: import("../state/validation").Validator;
export declare const fillImageDefaults: import("../state/validation").Validator;
export declare const colorUnion: import("../state/validation").Validator;
export declare const fillOptionsDef: OptionsDefs<FillOptions>;
export declare const lineDashOptionsDef: OptionsDefs<LineDashOptions>;
export declare const barHighlightOptionsDef: OptionsDefs<AgBarHighlightStyleOptions>;
export declare const lineHighlightOptionsDef: OptionsDefs<AgLineHighlightStyleOptions>;
export declare const shapeHighlightOptionsDef: OptionsDefs<AgHighlightStyleOptions>;
export declare function highlightOptionsDef<T>(itemHighlightOptionsDef: T): {
enabled: import("../state/validation").Validator;
range: import("../state/validation").Validator;
highlightedItem: T;
unhighlightedItem: T;
};
export declare function multiSeriesHighlightOptionsDef<I, S>(itemHighlightOptionsDef: I, seriesHighlightOptionsDef: S): {
enabled: import("../state/validation").Validator;
range: import("../state/validation").Validator;
highlightedItem: I;
unhighlightedItem: I;
highlightedSeries: S;
unhighlightedSeries: S;
bringToFront: import("../state/validation").Validator;
};
export declare const shapeSegmentOptions: OptionsDefs<AgSeriesShapeSegmentOptions>;
export declare const lineSegmentOptions: OptionsDefs<AgSeriesLineSegmentOptions>;
export declare const shapeSegmentation: import("../state/validation").Validator;
export declare const lineSegmentation: import("../state/validation").Validator;
export declare const googleFont: import("../state/validation").Validator;
export declare const fontFamilyFull: import("../state/validation").Validator;
export declare const fontWeight: import("../state/validation").Validator;
export declare const fontOptionsDef: OptionsDefs<TextOptions>;
export declare const paddingOptions: import("../state/validation").Validator;
export declare const padding: import("../state/validation").Validator;
export declare const borderOptionsDef: OptionsDefs<BorderOptions>;
export declare const labelBoxOptionsDef: OptionsDefs<LabelBoxOptions>;

View File

@@ -0,0 +1,36 @@
import type { AgCartesianChartOptions, AgHighlightOptions, AgHighlightStyleOptions, AgMultiSeriesHighlightOptions, AgSeriesSegmentation, LabelBoxOptions, WithThemeParams } from 'ag-charts-types';
import { type RequiredInternalAgGradientColor, type RequiredInternalAgImageFill, type RequiredInternalAgPatternColor } from './optionsDefaults';
type CartesianAxis = Exclude<AgCartesianChartOptions['axes'], undefined>[0];
export declare const DIRECTION_SWAP_AXES: WithThemeParams<Record<string, CartesianAxis>>;
export declare const SAFE_FILL_OPERATION: any;
export declare const SAFE_FILLS_OPERATION: any;
export declare const SAFE_STROKE_FILL_OPERATION: any;
export declare const SAFE_RANGE2_OPERATION: any;
export declare const FILL_GRADIENT_BLANK_DEFAULTS: RequiredInternalAgGradientColor;
export declare const FILL_GRADIENT_LINEAR_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_LINEAR_HIERARCHY_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_LINEAR_SINGLE_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_LINEAR_KEYED_DEFAULTS: (key: 'up' | 'down' | 'altUp' | 'altDown' | 'neutral') => WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_RADIAL_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_RADIAL_REVERSED_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_RADIAL_SERIES_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_RADIAL_REVERSED_SERIES_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_GRADIENT_CONIC_SERIES_DEFAULTS: WithThemeParams<RequiredInternalAgGradientColor>;
export declare const FILL_PATTERN_DEFAULTS: WithThemeParams<RequiredInternalAgPatternColor>;
export declare const FILL_PATTERN_SINGLE_DEFAULTS: WithThemeParams<RequiredInternalAgPatternColor>;
export declare const FILL_PATTERN_BLANK_DEFAULTS: RequiredInternalAgPatternColor;
export declare const FILL_PATTERN_HIERARCHY_DEFAULTS: WithThemeParams<RequiredInternalAgPatternColor>;
export declare const FILL_PATTERN_KEYED_DEFAULTS: (key: 'up' | 'down' | 'altUp' | 'altDown' | 'neutral') => WithThemeParams<RequiredInternalAgPatternColor>;
export declare const FILL_IMAGE_DEFAULTS: WithThemeParams<RequiredInternalAgImageFill>;
export declare const FILL_IMAGE_BLANK_DEFAULTS: RequiredInternalAgImageFill;
export declare function getSequentialColors(colors: {
[key: string]: string;
}): Record<string | number, string[]>;
export declare const LABEL_BOXING_DEFAULTS: WithThemeParams<LabelBoxOptions>;
export declare const MULTI_SERIES_HIGHLIGHT_STYLE: WithThemeParams<AgMultiSeriesHighlightOptions<AgHighlightStyleOptions>>;
export declare const MARKER_SERIES_HIGHLIGHT_STYLE: WithThemeParams<AgMultiSeriesHighlightOptions<AgHighlightStyleOptions>>;
export declare const PART_WHOLE_HIGHLIGHT_STYLE: WithThemeParams<AgMultiSeriesHighlightOptions<AgHighlightStyleOptions>>;
export declare const SINGLE_SERIES_HIGHLIGHT_STYLE: WithThemeParams<AgHighlightOptions<AgHighlightStyleOptions>>;
export declare const LEGEND_CONTAINER_THEME: any;
export declare const SEGMENTATION_DEFAULTS: WithThemeParams<AgSeriesSegmentation>;
export {};

17
node_modules/ag-charts-core/dist/types/src/identity/id.d.ts generated vendored Executable file
View File

@@ -0,0 +1,17 @@
import type { AxisID, ElementID } from '../types/idBranding';
type IDTypes = ElementID | AxisID;
/**
* Interface for classes that can have IDs generated via createId().
* Implementing classes MUST define: static readonly className: string
*/
export interface Identifiable {
constructor: {
readonly className?: string;
readonly name?: string;
};
}
export declare function resetIds(): void;
export declare function createId<T extends IDTypes | string = string>(instance: Identifiable): T;
export declare function createElementId(): ElementID;
export declare function generateUUID(): string;
export {};

View File

@@ -0,0 +1 @@
export declare function createIdsGenerator(): (name: string) => string;

View File

@@ -0,0 +1,16 @@
export interface DebugLogger {
(...logContent: any[]): void;
check(): boolean;
group<T>(name: string, cb: () => T): T;
}
export declare function create(...debugSelectors: Array<boolean | string>): DebugLogger;
export declare function check(...debugSelectors: Array<boolean | string>): boolean;
export declare function inDevelopmentMode<R>(fn: () => R): R | undefined;
interface DebugTimingOptions {
logResult?: boolean;
logStack?: boolean;
logArgs?: boolean;
logData?: (target: any) => any;
}
export declare function Time(name: string, opts?: DebugTimingOptions): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => void;
export {};

View File

@@ -0,0 +1,2 @@
export declare function record(key: string, value: any): void;
export declare function flush(): Record<string, any>;

View File

@@ -0,0 +1,8 @@
export declare function log(...logContent: any[]): void;
export declare function warn(message: any, ...logContent: any[]): void;
export declare function error(message: any, ...logContent: any[]): void;
export declare function table(...logContent: any[]): void;
export declare function warnOnce(messageOrError: unknown, ...logContent: any[]): void;
export declare function errorOnce(messageOrError: unknown, ...logContent: any[]): void;
export declare function reset(): void;
export declare function logGroup<T>(name: string, cb: () => T): T;

100
node_modules/ag-charts-core/dist/types/src/main.d.ts generated vendored Executable file
View File

@@ -0,0 +1,100 @@
export * from './types/global';
export * from './modules/moduleDefinition';
export * from './types/scene';
export * from './types/scales';
export * from './structures/eventEmitter';
export * from './structures/lruCache';
export * as Debug from './logging/debugLogger';
export * as Logger from './logging/logger';
export * as DebugMetrics from './logging/debugMetrics';
export * from './modules/enterpriseRegistry';
export * as ModuleRegistry from './modules/moduleRegistry';
export { AbstractModuleInstance } from './modules/moduleInstance';
export * from './config/chartDefaults';
export * from './config/optionsDefaults';
export * from './config/gaugePreset';
export * from './config/themeUtil';
export * from './state/memento';
export * from './types/animationPhase';
export * from './types/axisDirection';
export * from './types/updateType';
export * from './types/zIndexMap';
export * from './chart/legendUtil';
export * from './chart/interpolationProperties';
export * from './utils/aggregation';
export * from './types/geojson';
export * from './types/themeConstants';
export * from './types/themeSymbols';
export * from './types/text';
export * from './state/callbackCache';
export * from './utils/types/decorator';
export * from './utils/dom/domUtil';
export * from './utils/geometry/math';
export * from './utils/data/arrays';
export * from './utils/geometry/angle';
export * from './utils/async';
export * from './utils/dom/attributeUtil';
export * from './utils/geometry/border';
export * from './utils/geometry/boxBounds';
export * from './utils/data/binarySearch';
export * from './utils/format/color';
export * from './utils/canvas';
export * from './utils/configuredCanvasMixin';
export * from './state/caching';
export * from './utils/time/date';
export * from './state/cleanupRegistry';
export * from './utils/deprecation';
export * from './utils/data/diff';
export * from './utils/geometry/distance';
export * from './utils/data/extent';
export * from './utils/format/format.util';
export * from './utils/functions';
export * from './utils/geojson';
export * from './structures/graph';
export * from './utils/data/json';
export * from './utils/dom/keynavUtil';
export * from './identity/id';
export * from './types/idBranding';
export * from './utils/data/iterators';
export * from './utils/data/linkedList';
export * from './state/memo';
export * from './utils/data/nearest';
export * from './utils/data/numberArray';
export * from './utils/data/numbers';
export * from './utils/data/object';
export * from './utils/geometry/padding';
export * from './utils/geometry/placement';
export * from './state/properties';
export * from './state/proxy';
export * from './utils/data/strings';
export * from './state/stateMachine';
export * from './rendering/textMeasurer';
export * from './utils/dom/domElements';
export * from './utils/dom/domEvents';
export * from './utils/dom/globalsProxy';
export * from './utils/dom/domDownload';
export * from './utils/text/textUtils';
export * from './utils/text/textWrapper';
export * from './utils/time/ticks';
export * from './utils/time/time';
export * from './utils/time/timeFormatDefaults';
export * from './utils/data/visibleRange';
export * from './identity/idGenerator';
export * from './utils/types/typeGuards';
export * from './utils/data/value';
export * from './state/validation';
export * as Vec2 from './utils/geometry/vector';
export * as Vec4 from './utils/geometry/vector4';
export * from './utils/geometry/fill';
export * from './utils/geometry/bezier';
export * from './utils/geometry/labelPlacement';
export * from './utils/geometry/scaling';
export * from './utils/geometry/lineInterpolation';
export * from './utils/zoomUtils';
export * from './logging/debugMetrics';
export { ChangeDetectableProperties } from './rendering/changeDetectableProperties';
export * from './utils/format/numberFormat';
export * from './utils/format/timeFormat';
export * from './rendering/domElements';
export * from './rendering/easing';
export * from './rendering/changeDetectable';

View File

@@ -0,0 +1,18 @@
import type { AgChartOptions } from 'ag-charts-types';
export interface LicenseManager {
validateLicense: () => void;
isDisplayWatermark: () => boolean;
getWatermarkMessage: () => string;
getWatermarkForegroundConfig: () => object | undefined;
getWatermarkForegroundConfigForBrowser: () => object | undefined;
getLicenseDetails: (licenseKey: string) => object;
}
interface EnterpriseRegistryOptions {
styles?: string;
licenseManager?: (options: AgChartOptions) => LicenseManager;
injectWatermark?: (domManager: any, text: string) => void;
createBackground?: (ctx: any) => any;
createForeground?: (ctx: any) => any;
}
export declare const enterpriseRegistry: EnterpriseRegistryOptions;
export {};

View File

@@ -0,0 +1,97 @@
import type { DatumDefault, ExtensibleTheme, SeriesDefaultAxes, SeriesPredictAxis, SeriesType } from 'ag-charts-types';
import type { OptionsDefs, ValidationResult } from '../state/validation';
import type { ScaleType } from '../types/scales';
import type { Point } from '../types/scene';
export declare enum ModuleType {
Chart = "chart",
Axis = "axis",
Series = "series",
Plugin = "plugin",
AxisPlugin = "axis:plugin",
SeriesPlugin = "series:plugin",
Preset = "preset"
}
export type ModuleTypeSwitch<TModule extends ModuleType, TOptions = any> = TModule extends ModuleType.Chart ? ChartModuleDefinition<TOptions> : TModule extends ModuleType.Axis ? AxisModuleDefinition<TOptions> : TModule extends ModuleType.Series ? SeriesModuleDefinition<TOptions> : TModule extends ModuleType.Preset ? PresetModuleDefinition<TOptions> : TModule extends ModuleType.Plugin ? PluginModuleDefinition<TOptions> : TModule extends ModuleType.AxisPlugin ? AxisPluginModuleDefinition<TOptions> : TModule extends ModuleType.SeriesPlugin ? SeriesPluginModuleDefinition<TOptions> : never;
export interface ModuleInstance {
destroy?(this: void): void;
}
export interface SeriesModuleInstance extends ModuleInstance {
}
export interface PluginModuleInstance extends ModuleInstance {
enabled?: boolean;
processData?(dataController: any): Promise<void> | void;
}
export type PickNodeDatumResult = {
datum: NonNullable<any>;
distanceSquared: number;
} | undefined;
export interface PropertyDefinitionOpts {
isContinuousX: boolean;
isContinuousY: boolean;
xScaleType?: ScaleType;
yScaleType?: ScaleType;
}
export interface SeriesPluginModuleInstance extends ModuleInstance {
pickNodeExact(point: Point): PickNodeDatumResult;
pickNodeNearest(point: Point): PickNodeDatumResult;
pickNodeMainAxisFirst(point: Point, majorDirection: any): PickNodeDatumResult | undefined;
getPropertyDefinitions(opts: PropertyDefinitionOpts): any[];
getDomain(direction: any): any[];
getTooltipParams(): object;
}
export interface ModuleDefinition<TModule extends ModuleType = ModuleType, TOptions = any, TInstance extends ModuleInstance = ModuleInstance> {
readonly type: `${TModule}` | TModule;
readonly name: string;
readonly version: string;
readonly enterprise?: boolean;
readonly dependencies?: ModuleDefinition[];
readonly placeholder?: boolean;
options?: OptionsDefs<TOptions>;
themeTemplate?: ExtensibleTheme<any>;
style?: string;
create(this: void, ...args: any[]): TInstance;
validate?(this: void, options: unknown, optionsDefs: OptionsDefs<TOptions>, path: string): ValidationResult<TOptions>;
}
export interface ChartModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.Chart, TOptions> {
options: OptionsDefs<TOptions>;
}
export interface PresetModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.Preset, TOptions> {
options: OptionsDefs<TOptions>;
create(this: void, options: unknown, ...args: any[]): any;
processData?(this: void, data: unknown): {
data?: unknown[];
series?: Array<{
xKey: string;
yKey: string;
}>;
};
}
export interface AxisModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.Axis, TOptions> {
readonly chartType: string;
options: OptionsDefs<TOptions>;
}
export interface SeriesModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.Series, TOptions, SeriesModuleInstance> {
readonly chartType: string;
readonly groupable?: boolean;
readonly stackable?: boolean;
readonly stackedByDefault?: boolean;
readonly solo?: boolean;
predictAxis?: (direction: any, datum: DatumDefault, seriesOptions: any) => SeriesPredictAxis<SeriesType> | undefined;
defaultAxes?: SeriesDefaultAxes<SeriesType>;
axisKeys?: Partial<Record<string, string>>;
axisKeysFlipped?: Partial<Record<string, string>>;
matchingKeys?: string[];
options: OptionsDefs<TOptions>;
}
export interface PluginModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.Plugin, TOptions> {
readonly chartType?: string;
patchContext?(this: void, ctx: any): void;
}
export interface AxisPluginModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.AxisPlugin, TOptions> {
readonly chartType?: string;
readonly axisTypes?: string[];
}
export interface SeriesPluginModuleDefinition<TOptions> extends ModuleDefinition<ModuleType.SeriesPlugin, TOptions, SeriesPluginModuleInstance> {
readonly chartType?: string;
readonly seriesTypes?: string[];
}

View File

@@ -0,0 +1,6 @@
import { CleanupRegistry } from '../state/cleanupRegistry';
import type { ModuleInstance } from './moduleDefinition';
export declare abstract class AbstractModuleInstance implements ModuleInstance {
protected readonly cleanup: CleanupRegistry;
destroy(): void;
}

View File

@@ -0,0 +1,21 @@
import { type AxisModuleDefinition, type AxisPluginModuleDefinition, type ChartModuleDefinition, type ModuleDefinition, ModuleType, type ModuleTypeSwitch, type PluginModuleDefinition, type PresetModuleDefinition, type SeriesModuleDefinition, type SeriesPluginModuleDefinition } from './moduleDefinition';
export declare enum RegistryMode {
Enterprise = "enterprise",
Integrated = "integrated",
UMD = "umd"
}
export declare function register(def: ModuleDefinition | ChartModuleDefinition<any> | AxisModuleDefinition<any> | SeriesModuleDefinition<any> | PresetModuleDefinition<any> | PluginModuleDefinition<any> | AxisPluginModuleDefinition<any> | SeriesPluginModuleDefinition<any>): void;
export declare function registerModules(definitions: Array<ModuleDefinition | ModuleDefinition[]>): void;
export declare function reset(): void;
export declare function hasModule(moduleName: string): boolean;
export declare function listModules(): Generator<ModuleDefinition>;
export declare function listModulesByType<T extends ModuleType>(moduleType: T): Generator<ModuleTypeSwitch<T>>;
export declare function getAxisModule(moduleName: string): AxisModuleDefinition<any> | undefined;
export declare function getChartModule(moduleName: string): ChartModuleDefinition<any>;
export declare function getPresetModule(moduleName: string): PresetModuleDefinition<any> | undefined;
export declare function getSeriesModule(moduleName: string): SeriesModuleDefinition<any> | undefined;
export declare function setRegistryMode(registryFlag: RegistryMode): void;
export declare function isEnterprise(): boolean;
export declare function isIntegrated(): boolean;
export declare function isUmd(): boolean;
export declare function isModuleType<T extends ModuleType>(moduleType: T, definition: ModuleDefinition | undefined): definition is ModuleTypeSwitch<T>;

View File

@@ -0,0 +1,39 @@
type Target = {
[K in string]: any;
} & {
onChangeDetection(privateKey: string): void;
};
interface SceneChangeDetectionOptions<T = any> {
convertor?: (o: any) => any;
changeCb?: (o: T) => any;
checkDirtyOnAssignment?: boolean;
equals?: (newValue: T, oldValue: T) => boolean;
}
interface SceneObjectChangeDetectionOptions<T = any> {
convertor?: (o: any) => any;
changeCb?: (o: T) => any;
checkDirtyOnAssignment?: boolean;
equals: (newValue: T, oldValue: T) => boolean;
}
interface SceneArrayChangeDetectionOptions<T = any> {
convertor?: (o: any) => any;
changeCb?: (o: T) => any;
checkDirtyOnAssignment?: boolean;
equals?: never;
}
export declare const TRIPLE_EQ: (lhs: unknown, rhs: unknown) => boolean;
export declare function SceneChangeDetection<T extends Target = any>(opts?: SceneChangeDetectionOptions): (target: T, key: string) => void;
export declare function SceneRefChangeDetection<T extends Target = any>(opts?: SceneChangeDetectionOptions): (target: T, key: string) => void;
export declare function SceneObjectChangeDetection<T extends Target = any>(opts: SceneObjectChangeDetectionOptions): (target: T, key: string) => void;
export declare function SceneArrayChangeDetection<T extends Target = any>(opts?: SceneArrayChangeDetectionOptions): (target: T, key: string) => void;
export declare function DeclaredSceneChangeDetection<V>(opts?: SceneChangeDetectionOptions): <K extends string, T extends {
[x: string]: any;
} & {
onChangeDetection(privateKey: string): void;
} & { [P in `__${K}`]: V; }>(target: T, key: K) => void;
export declare function DeclaredSceneObjectChangeDetection<V>(opts?: SceneObjectChangeDetectionOptions): <K extends string, T extends {
[x: string]: any;
} & {
onChangeDetection(privateKey: string): void;
} & { [P in `__${K}`]: V; }>(target: T, key: K) => void;
export {};

View File

@@ -0,0 +1,11 @@
import { BaseProperties } from '../state/properties';
export declare class ChangeDetectableProperties extends BaseProperties {
protected _dirty: boolean;
protected markDirty(): void;
markClean(_opts?: {
force?: boolean;
recursive?: boolean;
}): void;
isDirty(): boolean;
onChangeDetection(_property: string): void;
}

View File

@@ -0,0 +1,47 @@
import type { AgIconName } from 'ag-charts-types';
import { type AttributeSet, type InputAttributeSet } from '../utils/dom/attributeUtil';
type LabelAndIcon = {
label: string;
icon?: AgIconName;
};
type IconOnly = {
label?: never;
icon: AgIconName;
altText: string;
};
export type LabelIcon = LabelAndIcon | IconOnly;
export type ButtonOptions = LabelIcon & {
onPress: (event: MouseEvent) => void;
};
export declare function createButton(options: ButtonOptions, attrs?: AttributeSet): HTMLButtonElement & HTMLElement & {
id: import("../main").ElementID;
};
export interface CheckboxOptions {
checked: boolean;
onChange: (checked: boolean, event: Event) => void;
}
export declare function createCheckbox(options: CheckboxOptions, attrs?: AttributeSet): HTMLInputElement & HTMLElement & {
id: import("../main").ElementID;
};
export interface SelectOptions {
options: Array<{
label: string;
value: string;
}>;
value: string;
onChange: (value: string, event: Event) => void;
}
export declare function createSelect(options: SelectOptions, attrs?: AttributeSet): HTMLSelectElement & HTMLElement & {
id: import("../main").ElementID;
};
export interface TextAreaOptions {
value: string;
onChange: (value: string, event: Event) => void;
}
export declare function createTextArea(options: TextAreaOptions, attrs?: InputAttributeSet): HTMLTextAreaElement & HTMLElement & {
id: import("../main").ElementID;
};
export declare function createIcon(icon?: AgIconName): HTMLSpanElement & HTMLElement & {
id: import("../main").ElementID;
};
export {};

View File

@@ -0,0 +1,8 @@
export declare const linear: (n: number) => number;
export declare const easeIn: (n: number) => number;
export declare const easeOut: (n: number) => number;
export declare const easeInOut: (n: number) => number;
export declare const easeInQuad: (n: number) => number;
export declare const easeOutQuad: (n: number) => number;
export declare const easeInOutQuad: (n: number) => number;
export declare const inverseEaseOut: (x: number) => number;

View File

@@ -0,0 +1,22 @@
import type { TextSegment } from 'ag-charts-types';
import { type FontOptions, type ITextMeasurer, type LegacyTextMetrics, type MultilineSegmentsMetricsBox, type MultilineTextMetricsBox, type TextMetricsBox } from '../types/text';
export declare class TextMeasurer implements ITextMeasurer {
private readonly ctx;
private readonly measureTextCached?;
private readonly baselineMap;
private readonly charMap;
private lineHeightCache;
constructor(ctx: CanvasRenderingContext2D, measureTextCached?: ((text: string, useCache?: boolean) => LegacyTextMetrics) | undefined);
baselineDistance(textBaseline: CanvasTextBaseline): number;
lineHeight(): number;
measureText(text: string): TextMetricsBox;
measureLines(text: string | string[]): MultilineTextMetricsBox;
textWidth(text: string, estimate?: boolean): number;
private charWidth;
}
export declare function cachedTextMeasurer(font: string | FontOptions): TextMeasurer;
export declare namespace cachedTextMeasurer {
var clear: () => void;
}
export declare function measureTextSegments(textSegments: TextSegment[], defaultFont: FontOptions): MultilineSegmentsMetricsBox;
export type { ITextMeasurer, LineMetricsBox, MeasuredSegment, MultilineSegmentsMetricsBox, MultilineTextMetricsBox, SegmentsLineMetrics, TextMetricsBox, } from '../types/text';

View File

@@ -0,0 +1,14 @@
export declare class SimpleCache<T> {
protected readonly getter: () => T;
protected result?: T;
constructor(getter: () => T);
get(): T;
clear(): void;
}
export declare class WeakCache<T extends WeakKey> {
protected readonly getter: () => T;
protected result?: WeakRef<T>;
constructor(getter: () => T);
get(): T;
clear(): void;
}

View File

@@ -0,0 +1,13 @@
import type { Callback, CallbackParam, RequireOptional } from '../types/global';
type Caller = {
context?: unknown;
} | undefined;
export type CallbackParamRules<P> = RequireOptional<Omit<P, 'context'>>;
export declare function callWithContext<F extends Callback>(callers: Caller | Caller[], fn: F, params: CallbackParam<F>): ReturnType<F>;
export declare class CallbackCache {
private cache;
call<F extends Callback>(callers: Caller | Caller[], fn: F, params: CallbackParam<F>): ReturnType<F> | undefined;
private invoke;
invalidateCache(): void;
}
export {};

View File

@@ -0,0 +1,9 @@
import type { AnyFn } from '../types/global';
type RegisteredCallback = AnyFn | false | null | undefined;
export declare class CleanupRegistry {
protected readonly callbacks: Set<AnyFn>;
flush(): void;
merge(registry: CleanupRegistry): void;
register(...callbacks: RegisteredCallback[]): void;
}
export {};

View File

@@ -0,0 +1,29 @@
export interface MementoOriginator<Memento = any> {
mementoOriginatorKey: string;
createMemento(): Memento;
guardMemento(blob: unknown, messages: Array<string>): blob is Memento | undefined;
restoreMemento(version: string, mementoVersion: string, blob: Memento | undefined): void;
}
type MementoCaretakerPacket = Record<'version', string> & Record<string, any>;
/**
* The caretaker manages the encoding and decoding of mementos from originators, ensuring they can be provided to and
* received from external systems. A memento encapsulates the state of an originator at a point in time. A memento
* is also versioned to ensure it can be migrated to newer versions of the originator.
*/
export declare class MementoCaretaker {
readonly version: string;
constructor(version: string);
save(...originators: Array<MementoOriginator>): MementoCaretakerPacket;
restore(blob: unknown, ...originators: Array<MementoOriginator>): void;
/**
* Encode a memento as a serializable object, encoding any non-serializble types.
*/
private encode;
/**
* Decode an encoded memento, decoding any non-serializable types.
*/
private decode;
private static encodeTypes;
private static decodeTypes;
}
export {};

6
node_modules/ag-charts-core/dist/types/src/state/memo.d.ts generated vendored Executable file
View File

@@ -0,0 +1,6 @@
import type { AnyFn } from '../types/global';
export declare function memo<T, R>(params: T, fnGenerator: (params: T) => R): R;
export declare function simpleMemorize2<F extends AnyFn>(fn: F, cacheCallback?: (type: 'hit' | 'miss', fn: F, keys: any[]) => void): F & {
reset: () => void;
};
export declare function simpleMemorize<F extends AnyFn>(fn: F, cacheCallback?: (type: 'hit' | 'miss', fn: F, keys: any[]) => void): (...p: Parameters<F>) => ReturnType<F>;

View File

@@ -0,0 +1,15 @@
export { addFakeTransformToInstanceProperty as Property } from '../utils/types/decorator';
export declare class BaseProperties<T extends object = object> {
handleUnknownProperties(_unknownKeys: Set<unknown>, _properties: T): void;
set(properties: T): this;
clear(): this;
toJson<J>(this: J): T;
}
export declare class PropertiesArray<T extends BaseProperties> extends Array<T> {
private readonly itemFactory;
constructor(itemFactory: (new () => T) | ((params: any) => T), ...properties: object[]);
set(properties: object[]): this;
reset(properties: object[]): PropertiesArray<T> | undefined;
toJson(): object[];
}
export declare function isProperties<T extends object>(value: unknown): value is BaseProperties<T>;

20
node_modules/ag-charts-core/dist/types/src/state/proxy.d.ts generated vendored Executable file
View File

@@ -0,0 +1,20 @@
export declare function ProxyProperty(proxyPath: string | string[], configMetadata?: {
optional?: boolean;
}): PropertyDecorator;
export declare function ProxyOnWrite(proxyProperty: string): PropertyDecorator;
export declare function ProxyPropertyOnWrite(childName: string, childProperty?: string): PropertyDecorator;
export interface ActionOnSetOptions<T, V = any> {
newValue?: (this: T, newValue: V) => void;
oldValue?: (this: T, oldValue: V) => void;
changeValue?: (this: T, newValue?: V, oldValue?: V) => void;
}
/**
* Allows side-effects to be triggered on property write.
*
* @param opts.newValue called when a new value is set - never called for undefined values.
* @param opts.oldValue called with the old value before a new value is set - never called for
* undefined values.
* @param opts.changeValue called on any change to the value - always called.
*/
export declare function ActionOnSet<T, V = any>(opts: ActionOnSetOptions<T, V>): PropertyDecorator;
export declare function ObserveChanges<T, V = any>(observerFn: (target: T, newValue?: V, oldValue?: V) => void): PropertyDecorator;

View File

@@ -0,0 +1,56 @@
import * as Debug from '../logging/debugLogger';
type StateDefinition<State extends string, Events extends Record<string, any>> = {
[key in keyof Events]?: Destination<State, Events[key]>;
};
type Destination<State extends string, Data> = Array<StateTransition<State, Data>> | StateTransition<State, Data> | StateTransitionAction<Data> | State | HierarchyState | StateMachine<any, any>;
type StateUtils<State extends string> = {
onEnter?: (from?: State, data?: any) => void;
onExit?: () => void;
};
type StateTransition<State, Data> = {
/**
* Return `false` to prevent the action and transition. The FSM will pick the first transition that passes its
* guard or does not have one.
*/
guard?: (data: Data) => boolean;
target?: State | HierarchyState | StateMachine<any, any>;
action?: StateTransitionAction<Data>;
};
type StateTransitionAction<Data> = (data: Data) => void;
type HierarchyState = '__parent' | '__child';
export declare function StateMachineProperty(): PropertyDecorator;
declare abstract class AbstractStateMachine<Events extends Record<string, any>> {
parent?: AbstractStateMachine<Events>;
abstract transition<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
abstract transitionAsync<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
transitionRoot<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
}
/**
* A Hierarchical Finite State Machine is a system that must be in exactly one of a list of states, where those states
* can also be other state machines. It can only transition between one state and another if a transition event is
* provided between the two states.
*/
export declare class StateMachine<State extends string, Events extends Record<string, any>> extends AbstractStateMachine<Events> {
private readonly defaultState;
private readonly states;
private readonly enterEach?;
static readonly child: "__child";
static readonly parent: "__parent";
protected readonly debug: Debug.DebugLogger;
private state;
private childState?;
constructor(defaultState: State, states: Record<State, StateDefinition<State, Events> & StateUtils<State>>, enterEach?: ((from: State | HierarchyState, to: State | HierarchyState) => void) | undefined);
transition<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
transitionAsync<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
protected is(value: unknown): boolean;
protected resetHierarchy(): void;
private transitionChild;
private getDestinationState;
}
export declare class ParallelStateMachine<State extends string, Events extends Record<string, any>> extends AbstractStateMachine<Events> {
private readonly stateMachines;
constructor(...stateMachines: Array<StateMachine<State, Events>>);
transition<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
transitionAsync<Event extends keyof Events & string>(event: Event, data?: Events[Event]): void;
}
export {};

View File

@@ -0,0 +1,175 @@
import type { AreExact, IsUnion } from '../types/global';
declare const descriptionSymbol: unique symbol;
declare const requiredSymbol: unique symbol;
declare const undocumentedSymbol: unique symbol;
export declare const unionSymbol: unique symbol;
type ObjectLikeDef<T> = IsUnion<NonNullable<T>> extends true ? OptionsDefs<Exclude<T, undefined>> : T extends object ? keyof T extends never ? never : OptionsDefs<T> : never;
type Singular<T> = T extends any[] ? T[number] : T;
type PrivateSymbols = {
[descriptionSymbol]?: string;
[requiredSymbol]?: boolean;
[undocumentedSymbol]?: boolean;
[unionSymbol]?: string;
};
export type OptionsDefs<T> = {
[K in keyof Singular<T>]-?: Validator | ObjectLikeDef<Singular<T>[K]>;
} & PrivateSymbols;
export type TypeUnionDefs<T, K extends string | number | symbol> = {
[P in K]: OptionsDefs<Omit<Extract<T, {
type: P;
}>, 'type'>>;
};
export interface ValidationResult<T> {
cleared: Partial<T> | null;
invalid: ValidationError[];
}
export interface ValidatorResult extends ValidationResult<any> {
valid: boolean;
}
export interface ValidatorContext {
path: string;
options: any;
}
export declare enum ErrorType {
Invalid = "invalid",
Required = "required",
Unknown = "unknown"
}
export interface Validator extends Function, PrivateSymbols {
(value: unknown, context: ValidatorContext): ValidatorResult | boolean;
}
export declare class ValidationError {
readonly type: ErrorType | `${ErrorType}`;
readonly description: string | undefined;
readonly value: any;
readonly path: string;
readonly key?: string | undefined;
protected altPath?: string;
constructor(type: ErrorType | `${ErrorType}`, description: string | undefined, value: any, path: string, key?: string | undefined);
setUnionType(unionType: string, path: string): void;
getPrefix(): string;
toString(): string;
}
export declare class UnknownError extends ValidationError {
suggestions: string[];
key: string;
constructor(suggestions: string[], value: unknown, path: string, key: string);
getPrefix(): string;
getPostfix(): string;
toString(): string;
}
/**
* Validates the provided options against the specified definitions.
* @param options The options object to validate.
* @param optionsDefs The definitions against which to validate the options.
* @param path The current path in the options object, for nested properties.
* @returns An object containing valid options and validation errors.
*/
export declare function validate<T>(options: unknown, optionsDefs: OptionsDefs<T>, path?: string): ValidationResult<T>;
/**
* Attaches a descriptive message to a validator function.
* @param validator The validator function to which to attach a description.
* @param description The description to attach.
* @returns A new validator function with the attached description.
*/
export declare function attachDescription(validator: Validator, description: string): Validator;
export declare function attachDescription<T>(optionsDefs: OptionsDefs<T>, description: string): OptionsDefs<T>;
/**
* Marks a validator or option definitions object as required.
* @param validatorOrDefs The validator or option definitions to mark as required.
* @returns The modified validator or option definitions, marked as required.
*/
export declare function required<T extends OptionsDefs<any>>(validatorOrDefs: T): T;
export declare function required<T extends OptionsDefs<any>[]>(validatorOrDefs: T): T;
export declare function required(validatorOrDefs: Validator): Validator;
export declare function undocumented(validatorOrDefs: Validator): Validator;
export declare function undocumented<T extends OptionsDefs<any>>(validatorOrDefs: T): T;
/**
* Creates a validator for ensuring an object matches the provided option definitions.
* @param defs The option definitions against which to validate an object.
* @param description (Optional) A description for the validator, defaulting to 'an object'.
* @returns A validator function for the given option definitions.
*/
export declare const optionsDefs: <T>(defs: OptionsDefs<T>, description?: string, failAll?: boolean) => Validator;
export declare const typeUnion: <T extends {
type: string;
}>(defs: TypeUnionDefs<T, T['type']>, description: string, defaultType?: T['type']) => OptionsDefs<T>;
/**
* Combines multiple validators, requiring all to pass.
* @param validators An array of validators to combine.
* @returns A validator that requires all specified validators to pass.
*/
export declare const and: (...validators: Validator[]) => Validator;
/**
* Combines multiple validators, passing if any one of them does.
* @param validators An array of validators to combine.
* @returns A validator that passes if any one of the specified validators does.
*/
export declare const or: (...validators: Validator[]) => Validator;
export declare const array: Validator;
export declare const boolean: Validator;
export declare const callback: Validator;
export declare const color: Validator;
export declare const date: Validator;
export declare const defined: Validator;
export declare const number: Validator;
export declare const object: Validator;
export declare const string: Validator;
export declare const htmlElement: Validator;
export declare const arrayLength: (minLength: number, maxLength?: number) => Validator;
export declare const stringLength: (minLength: number, maxLength?: number) => Validator;
export declare const numberMin: (min: number, inclusive?: boolean) => Validator;
export declare const numberRange: (min: number, max: number) => Validator;
export declare const positiveNumber: Validator;
export declare const positiveNumberNonZero: Validator;
export declare const ratio: Validator;
export declare const lessThan: (otherField: string) => Validator;
export declare const lessThanOrEqual: (otherField: string) => Validator;
export declare const greaterThan: (otherField: string) => Validator;
/**
* Creates a validator for a union of allowed values.
* @param allowed An array of allowed values.
* @returns A validator function that checks if a value is among the allowed ones.
*/
export declare function union(allowed: object): Validator;
export declare function union(...allowed: any[]): Validator;
/**
* A defensive version of `union` that intentionally breaks compilation if a string union type is changed.
* @example
* type U = 'a' | 'b';
* strictUnion<U>()('a', 'b'); // compilation breaks if U is changed to `'a' | 'b' | 'c'`.
*/
export declare function strictUnion<T extends string>(): <U extends readonly T[]>(...args: U & (AreExact<T, U[number]> extends true ? U : never)) => Validator;
/**
* Creates a validator for a single constant value.
* @param allowed The allowed constant value.
* @returns A validator function that checks for equality with the allowed value.
*/
export declare const constant: (allowed: boolean | number | string) => Validator;
/**
* Creates a validator for instances of a specific class.
* @param instanceType The constructor of the class to check instances against.
* @param description An optional description string.
* @returns A validator function that checks if a value is an instance of the specified class.
*/
export declare const instanceOf: (instanceType: Function, description?: string) => Validator;
/**
* Creates a validator for arrays where every element must pass a given validator.
* @param validator The validator to apply to each array element.
* @param description An optional description string.
* @param strict When enabled validator fails on any invalid item, otherwise invalid items are filtered.
* @returns A validator function for arrays with elements validated by the specified validator.
*/
export declare const arrayOf: (validator: Validator, description?: string, strict?: boolean) => Validator;
/**
* Creates a validator for arrays where each element is validated against a given set of definitions.
* Allows capturing both valid and invalid values while providing detailed validation errors.
* @param defs The validation definitions to apply to each array element.
* @param description An optional description string.
* @returns A validator function for arrays, storing valid elements and collecting errors for invalid ones.
*/
export declare const arrayOfDefs: <T>(defs: OptionsDefs<T>, description?: string) => Validator;
export declare const callbackOf: (validator: Validator, description?: string) => Validator;
export declare const callbackDefs: <T>(defs: OptionsDefs<T>, description?: string) => Validator;
export declare function hasRequiredInPath(errors: ValidationError[], rootPath: string): boolean;
export {};

View File

@@ -0,0 +1,28 @@
export type EventListener<T> = (event: T) => void;
export declare class EventEmitter<EventMap extends object> {
private readonly events;
/**
* Registers an event listener.
* @param eventName The event name to listen for.
* @param listener The callback to be invoked on the event.
* @returns A function to unregister the listener.
*/
on<K extends keyof EventMap>(eventName: K, listener: EventListener<EventMap[K]>): () => void;
/**
* Unregisters an event listener.
* @param eventName The event name to stop listening for.
* @param listener The callback to be removed.
*/
off<K extends keyof EventMap>(eventName: K, listener: EventListener<EventMap[K]>): void;
/**
* Emits an event to all registered listeners.
* @param eventName The name of the event to emit.
* @param event The event payload.
*/
emit<K extends keyof EventMap>(eventName: K, event: EventMap[K]): void;
/**
* Clears all listeners for a specific event or all events if no event name is provided.
* @param eventName (Optional) The name of the event to clear listeners for. If not provided, all listeners for all events are cleared.
*/
clear<K extends keyof EventMap>(eventName?: K): void;
}

View File

@@ -0,0 +1,42 @@
/**
* A graph that is optimised for vertex lookup and adjacency by edge value.
*/
export declare class AdjacencyListGraph<V, E = undefined> {
private _vertexCount;
private _edgeCount;
private readonly cachedNeighboursEdge?;
private readonly processedEdge?;
protected pendingProcessingEdgesFrom: Vertex<V>[];
protected pendingProcessingEdgesTo: Vertex<V>[];
private readonly singleValueEdges?;
constructor(cachedNeighboursEdge?: E, processedEdge?: E, singleValueEdges?: Set<E>);
clear(): void;
getVertexCount(): number;
getEdgeCount(): number;
addVertex(value: V): Vertex<V>;
addEdge(from: Vertex<V>, to: Vertex<V>, edge: E): void;
removeVertex(vertex: Vertex<V>): void;
removeEdge(from: Vertex<V>, to: Vertex<V>, edge: E): void;
removeEdges(from: Vertex<V>, edgeValue: E): void;
getVertexValue(vertex: Vertex<V>): V;
neighbours(from: Vertex<V>): Generator<Vertex<V>, void, unknown>;
neighboursAndEdges(from: Vertex<V, E>): Generator<[Vertex<V>, E], void, unknown>;
neighboursWithEdgeValue(from: Vertex<V>, edgeValue: E): Vertex<V, unknown>[] | undefined;
findNeighbour(from: Vertex<V>, edgeValue: E): Vertex<V> | undefined;
findNeighbourValue(from: Vertex<V>, edgeValue: E): V | undefined;
findNeighbourWithValue(from: Vertex<V>, value: V, edgeValue?: E): Vertex<V> | undefined;
findVertexAlongEdge(from: Vertex<V>, findValues: Array<V>, edgeValue: E): Vertex<V> | undefined;
adjacent(from: Vertex<V>, to: Vertex<V>): boolean;
}
/**
* A wrapper class to ensure each vertex is unique even if the value is the same object.
*/
export declare class Vertex<V, E = unknown> {
value: V;
edges: Map<E, Vertex<V>[]>;
private _cachedNeighbours?;
constructor(value: V);
readCachedNeighbours(): Map<V, Vertex<V, unknown>> | undefined;
updateCachedNeighbours(): Map<V, Vertex<V, unknown>>;
clear(): void;
}

View File

@@ -0,0 +1,12 @@
/**
* Implements a most-recently-used caching strategy with a similar interface to Map.
*/
export declare class LRUCache<V, K = string> {
private readonly maxCacheSize;
private readonly store;
constructor(maxCacheSize: number);
get(key: K): NonNullable<V> | undefined;
has(key: K): boolean;
set(key: K, value: V): V;
clear(): void;
}

View File

@@ -0,0 +1,2 @@
/** Chart animation phases - determines the top-level animation lifecycle phase for the overall chart */
export type ChartAnimationPhase = 'initial' | 'ready' | 'disabled';

View File

@@ -0,0 +1,7 @@
export declare enum ChartAxisDirection {
X = "x",
Y = "y",
Angle = "angle",
Radius = "radius"
}
export type CartesianAxisDirection = ChartAxisDirection.X | ChartAxisDirection.Y;

View File

@@ -0,0 +1,47 @@
/** GeoJSON types based on https://datatracker.ietf.org/doc/html/rfc7946 */
export type Position = [number, number];
type BBox = [number, number, number, number] | [number, number, number, number, number, number];
export type Geometry = Point | MultiPoint | LineString | MultiLineString | Polygon | MultiPolygon | GeometryCollection;
interface GeometryCollection extends GeoJsonObject {
type: 'GeometryCollection';
geometries: Geometry[];
}
interface Point extends GeoJsonObject {
type: 'Point';
coordinates: Position;
}
interface MultiPoint extends GeoJsonObject {
type: 'MultiPoint';
coordinates: Position[];
}
interface LineString extends GeoJsonObject {
type: 'LineString';
coordinates: Position[];
}
interface MultiLineString extends GeoJsonObject {
type: 'MultiLineString';
coordinates: Position[][];
}
interface Polygon extends GeoJsonObject {
type: 'Polygon';
coordinates: Position[][];
}
interface MultiPolygon extends GeoJsonObject {
type: 'MultiPolygon';
coordinates: Position[][][];
}
interface GeoJsonObject {
type: (Geometry | Feature | FeatureCollection)['type'];
bbox?: BBox;
}
export interface Feature extends GeoJsonObject {
type: 'Feature';
geometry: Geometry | null;
id?: string | number;
properties: Record<string, any> | null;
}
export interface FeatureCollection extends GeoJsonObject {
type: 'FeatureCollection';
features: Feature[];
}
export {};

62
node_modules/ag-charts-core/dist/types/src/types/global.d.ts generated vendored Executable file
View File

@@ -0,0 +1,62 @@
export type AnyFn = (...args: any[]) => any;
export type Callback = (params: any) => any;
export type CallbackParam<F extends Callback> = Parameters<F>[0];
export type Nullable<T> = T | null | undefined;
export type PlainObject = {
[key: string | number | symbol]: any;
};
export type Has<P extends keyof T, T> = T & {
[K in P]-?: T[P];
};
export type Mutable<T> = T extends object ? {
-readonly [K in keyof T]: Mutable<T[K]>;
} : T;
export type Defined<T> = T extends undefined ? never : T;
export type DeepRequired<T, IgnoredKeys extends string = never> = T extends AnyFn ? T : T extends any[] ? _DeepRequiredArray<T[number], IgnoredKeys> : T extends object ? _DeepRequiredObject<T, IgnoredKeys> : T;
type _DeepRequiredArray<T, IgnoredKeys extends string> = Array<DeepRequired<Defined<T>, IgnoredKeys>>;
type _DeepRequiredObject<T, IgnoredKeys extends string> = {
[K in keyof T]-?: K extends IgnoredKeys ? NonNullable<T[K]> : DeepRequired<Defined<T[K]>, IgnoredKeys>;
};
export type DeepReadonly<T> = T extends (...args: any[]) => any ? T : T extends any[] ? _DeepReadonlyArray<T[number]> : T extends object ? _DeepReadonlyObject<T> : T;
type _DeepReadonlyArray<T> = ReadonlyArray<DeepReadonly<T>>;
type _DeepReadonlyObject<T> = {
readonly [K in keyof T]: DeepReadonly<T[K]>;
};
export type DeepPartial<T> = T extends Array<unknown> ? T : T extends object ? {
[K in keyof T]?: DeepPartial<T[K]>;
} : T;
export type PickRequired<T, K extends keyof T> = T & {
[P in K]-?: T[P];
};
export type RequireOptional<T> = {
[K in keyof Required<T>]: T[K] extends Required<T[K]> ? T[K] : T[K] | undefined;
};
export type Intersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export type Writeable<T> = {
-readonly [P in keyof T]: T[P];
};
export type StripCallSignature<T> = {
[K in keyof T]: T[K];
};
export type IsUnion<T> = [T] extends [infer U] ? (U extends any ? (x: U) => any : never) extends (x: infer I) => any ? [T] extends [I] ? false : true : never : never;
export type IsAny<T> = 0 extends 1 & T ? true : false;
export type AreExact<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
export type AreMutuallyExclusive<A, B> = AreExact<never, A & B>;
export type ConstructorReturnType<T extends abstract new (...args: any) => any> = T extends abstract new (...args: any) => infer P ? P : never;
type NN<T> = NonNullable<T>;
/**
* Helper macro for nested NonNullable key accessors.
*
* The maximum depth is capped at 8. This is intentional to keep the implementation simple. A dynamic & recursive
* implementation is possible and would remove this limitation, however the recursive nature would require memory of
* exponential complexity (which is impractical, and will choke the TypeScript compiler).
*
* @example
* NonNullablePath< T, 'a', 'b', 'c' >
* // expands to...
* NonNullable<NonNullable<NonNullable<T>['a']>['b']>['b']>
*
* @summary Nested NonNullable getters
*/
export type NonNullablePath<T, K0 extends keyof T = never, K1 extends keyof NN<T[K0]> = never, K2 extends keyof NN<NN<T[K0]>[K1]> = never, K3 extends keyof NN<NN<NN<T[K0]>[K1]>[K2]> = never, K4 extends keyof NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]> = never, K5 extends keyof NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]> = never, K6 extends keyof NN<NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]>[K5]> = never, K7 extends keyof NN<NN<NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> = never> = [K0] extends [never] ? T : [K1] extends [never] ? NN<T[K0]> : [K2] extends [never] ? NN<NN<T[K0]>[K1]> : [K3] extends [never] ? NN<NN<NN<T[K0]>[K1]>[K2]> : [K4] extends [never] ? NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]> : [K5] extends [never] ? NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]> : [K6] extends [never] ? NN<NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]>[K5]> : [K7] extends [never] ? NN<NN<NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]> : NN<NN<NN<NN<NN<NN<NN<NN<T[K0]>[K1]>[K2]>[K3]>[K4]>[K5]>[K6]>[K7]>;
export {};

View File

@@ -0,0 +1,9 @@
declare const elementIDBrand: unique symbol;
declare const axisIDBrand: unique symbol;
export type ElementID = string & {
readonly [elementIDBrand]: true;
};
export type AxisID = string & {
readonly [axisIDBrand]: true;
};
export {};

65
node_modules/ag-charts-core/dist/types/src/types/scales.d.ts generated vendored Executable file
View File

@@ -0,0 +1,65 @@
import type { AgTimeInterval } from 'ag-charts-types';
export type ScaleType = 'number' | 'log' | 'time' | 'unit-time' | 'ordinal-time' | 'category' | 'mercator' | 'color';
/**
* Metadata about a domain's sort characteristics.
* Used to skip expensive sort order detection in scales.
*/
export interface DomainSortMetadata {
/** Sort order: 1 = ascending, -1 = descending, undefined = unsorted/unknown */
sortOrder: 1 | -1 | undefined;
/** True if all values are unique (no duplicates) */
isUnique?: boolean;
}
/**
* A domain array with optional metadata for optimization.
* When metadata is present, scales can skip expensive scans.
*/
export interface DomainWithMetadata<D> {
domain: D[];
sortMetadata?: DomainSortMetadata;
}
/**
* Extract domain array from a domain with metadata.
*/
export declare function extractDomain<D>(value: DomainWithMetadata<D>): D[];
export interface ScaleTickParams<I> {
nice: boolean[];
interval: I | undefined;
tickCount: number | undefined;
minTickCount: number;
maxTickCount: number;
}
export interface NormalizedDomain<D> {
domain: D[];
animatable: boolean;
}
export interface ScaleTickResult<D> {
ticks: D[];
count: number | undefined;
firstTickIndex?: number;
timeInterval?: AgTimeInterval;
}
export declare enum ScaleAlignment {
Leading = 0,
Trailing = 1,
Interpolate = 2
}
export interface Scale<D, R, I = number> {
readonly type: ScaleType;
readonly defaultTickCount: number;
domain: D[];
range: R[];
getDomainMinMax(): [D, D] | [undefined, undefined];
normalizeDomains(...domains: DomainWithMetadata<D>[]): NormalizedDomain<D>;
toDomain(value: number): D | undefined;
convert(value: D, options?: {
clamp?: boolean;
alignment?: ScaleAlignment;
}): R;
invert(value: R, exact?: boolean): D | undefined;
ticks(ticks: ScaleTickParams<I>, domain?: D[], visibleRange?: [number, number]): ScaleTickResult<D> | undefined;
niceDomain(ticks: ScaleTickParams<I>, domain?: D[]): D[];
readonly bandwidth: number | undefined;
readonly step: number | undefined;
readonly inset: number | undefined;
}

18
node_modules/ag-charts-core/dist/types/src/types/scene.d.ts generated vendored Executable file
View File

@@ -0,0 +1,18 @@
export interface Size {
width: number;
height: number;
}
export interface Point {
x: number;
y: number;
}
export interface SizedPoint extends Point {
size: number;
focusSize?: number;
}
export interface Bounds4 {
x1: number;
y1: number;
x2: number;
y2: number;
}

View File

@@ -0,0 +1,7 @@
/**
* A stricter version of `Map` where each key can have its unique value type.
*/
export interface PerKeyMap<Meta extends object> extends Map<keyof Meta, Meta[keyof Meta]> {
set<K extends keyof Meta>(key: K, value: Meta[K]): this;
get<K extends keyof Meta>(key: K): Meta[K] | undefined;
}

53
node_modules/ag-charts-core/dist/types/src/types/text.d.ts generated vendored Executable file
View File

@@ -0,0 +1,53 @@
import type { FontFamily, FontSize, FontStyle, FontWeight, TextSegment } from 'ag-charts-types';
import type { Writeable } from './global';
import type { Size } from './scene';
export declare const EllipsisChar = "\u2026";
export declare const LineSplitter: RegExp;
export declare const TrimEdgeGuard = "\u200B";
export declare const TrimCharsRegex: RegExp;
export interface FontOptions {
fontSize: FontSize;
fontStyle?: FontStyle;
fontWeight?: FontWeight;
fontFamily?: FontFamily;
}
export interface TextMetricsBox {
width: number;
height: number;
ascent: number;
descent: number;
}
export interface LineMetricsBox extends TextMetricsBox {
text: string;
}
export interface MultilineTextMetricsBox {
width: number;
height: number;
lineMetrics: LineMetricsBox[];
}
export interface MeasuredSegment extends Omit<TextSegment, 'text'> {
text: string;
fontSize: number;
textMetrics: TextMetricsBox;
}
export interface SegmentsLineMetrics extends Size {
ascent: number;
descent: number;
segments: MeasuredSegment[];
}
export interface MultilineSegmentsMetricsBox {
width: number;
height: number;
lineMetrics: SegmentsLineMetrics[];
}
export interface LegacyTextMetrics extends Writeable<TextMetrics> {
emHeightAscent: number;
emHeightDescent: number;
}
export interface ITextMeasurer {
measureText(text: string): TextMetricsBox;
measureLines(text: string | string[]): MultilineTextMetricsBox;
baselineDistance(textBaseline: CanvasTextBaseline): number;
textWidth(text: string, estimate?: boolean): number;
lineHeight(): number;
}

View File

@@ -0,0 +1,50 @@
export declare enum FONT_SIZE {
SMALLEST = 8,
SMALLER = 10,
SMALL = 12,
MEDIUM = 13,
LARGE = 14,
LARGEST = 17
}
export declare const BASE_FONT_SIZE = FONT_SIZE.SMALL;
export declare const FONT_SIZE_RATIO: {
SMALLEST: number;
SMALLER: number;
SMALL: number;
MEDIUM: number;
LARGE: number;
LARGEST: number;
};
export declare enum CARTESIAN_POSITION {
TOP = "top",
TOP_RIGHT = "top-right",
TOP_LEFT = "top-left",
RIGHT = "right",
RIGHT_TOP = "right-top",
RIGHT_BOTTOM = "right-bottom",
BOTTOM = "bottom",
BOTTOM_RIGHT = "bottom-right",
BOTTOM_LEFT = "bottom-left",
LEFT = "left",
LEFT_TOP = "left-top",
LEFT_BOTTOM = "left-bottom"
}
export declare enum CARTESIAN_AXIS_TYPE {
CATEGORY = "category",
GROUPED_CATEGORY = "grouped-category",
ORDINAL_TIME = "ordinal-time",
UNIT_TIME = "unit-time",
TIME = "time",
NUMBER = "number",
LOG = "log"
}
export declare enum POLAR_AXIS_TYPE {
ANGLE_CATEGORY = "angle-category",
ANGLE_NUMBER = "angle-number",
RADIUS_CATEGORY = "radius-category",
RADIUS_NUMBER = "radius-number"
}
export declare enum POLAR_AXIS_SHAPE {
CIRCLE = "circle",
POLYGON = "polygon"
}

View File

@@ -0,0 +1,33 @@
export declare const IS_DARK_THEME: boolean;
export declare const DEFAULT_SHADOW_COLOUR: string;
export declare const DEFAULT_CAPTION_LAYOUT_STYLE: string;
export declare const DEFAULT_CAPTION_ALIGNMENT: string;
export declare const PALETTE_UP_STROKE: string;
export declare const PALETTE_DOWN_STROKE: string;
export declare const PALETTE_UP_FILL: string;
export declare const PALETTE_DOWN_FILL: string;
export declare const PALETTE_NEUTRAL_STROKE: string;
export declare const PALETTE_NEUTRAL_FILL: string;
export declare const PALETTE_ALT_UP_STROKE: string;
export declare const PALETTE_ALT_DOWN_STROKE: string;
export declare const PALETTE_ALT_UP_FILL: string;
export declare const PALETTE_ALT_DOWN_FILL: string;
export declare const PALETTE_ALT_NEUTRAL_FILL: string;
export declare const PALETTE_ALT_NEUTRAL_STROKE: string;
export declare const DEFAULT_POLAR_SERIES_STROKE: string;
export declare const DEFAULT_SPARKLINE_CROSSHAIR_STROKE: string;
export declare const DEFAULT_FINANCIAL_CHARTS_ANNOTATION_COLOR: string;
export declare const DEFAULT_FIBONACCI_STROKES: string;
export declare const DEFAULT_TEXT_ANNOTATION_COLOR: string;
export declare const DEFAULT_FINANCIAL_CHARTS_ANNOTATION_BACKGROUND_FILL: string;
export declare const DEFAULT_ANNOTATION_HANDLE_FILL: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_FILL: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_STROKE: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_COLOR: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_DIVIDER_STROKE: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_DOWN_FILL: string;
export declare const DEFAULT_ANNOTATION_STATISTICS_DOWN_STROKE: string;
export declare const DEFAULT_TEXTBOX_FILL: string;
export declare const DEFAULT_TEXTBOX_STROKE: string;
export declare const DEFAULT_TEXTBOX_COLOR: string;
export declare const DEFAULT_TOOLBAR_POSITION: string;

View File

@@ -0,0 +1,14 @@
/** Types of chart-update, in pipeline execution order. */
export declare enum ChartUpdateType {
FULL = 0,
UPDATE_DATA = 1,
PROCESS_DATA = 2,
PROCESS_DOMAIN = 3,
PROCESS_RANGE = 4,
PERFORM_LAYOUT = 5,
PRE_SERIES_UPDATE = 6,
SERIES_UPDATE = 7,
PRE_SCENE_RENDER = 8,
SCENE_RENDER = 9,
NONE = 10
}

View File

@@ -0,0 +1,39 @@
/**
* Constants to declare the expected nominal zIndex for all types of layer in chart rendering.
*/
export declare enum ZIndexMap {
CHART_BACKGROUND = 0,
AXIS_BAND_HIGHLIGHT = 1,
AXIS_GRID = 2,
AXIS = 3,
SERIES_AREA_CONTAINER = 4,
ZOOM_SELECTION = 5,
SERIES_CROSSLINE_RANGE = 6,
SERIES_LAYER = 7,
AXIS_FOREGROUND = 8,
SERIES_CROSSHAIR = 9,
SERIES_CROSSLINE_LINE = 10,
SERIES_ANNOTATION = 11,
CHART_ANNOTATION = 12,
CHART_ANNOTATION_FOCUSED = 13,
STATUS_BAR = 14,
SERIES_LABEL = 15,
LEGEND = 16,
NAVIGATOR = 17,
FOREGROUND = 18
}
export declare enum SeriesZIndexMap {
BACKGROUND = 0,
ANY_CONTENT = 1
}
export declare enum SeriesContentZIndexMap {
FOREGROUND = 0,
HIGHLIGHT = 1,
LABEL = 2
}
export declare enum PolarZIndexMap {
BACKGROUND = 0,
FOREGROUND = 1,
HIGHLIGHT = 2,
LABEL = 3
}

View File

@@ -0,0 +1,137 @@
import type { DomainWithMetadata, ScaleType } from '../types/scales';
export declare const AGGREGATION_INDEX_X_MIN = 0;
export declare const AGGREGATION_INDEX_X_MAX = 1;
export declare const AGGREGATION_INDEX_Y_MIN = 2;
export declare const AGGREGATION_INDEX_Y_MAX = 3;
export declare const AGGREGATION_SPAN = 4;
export declare const AGGREGATION_THRESHOLD = 1000;
export declare const AGGREGATION_MAX_POINTS = 10;
export declare const AGGREGATION_MIN_RANGE = 64;
export declare const AGGREGATION_INDEX_UNSET = 4294967295;
export declare function aggregationRangeFittingPoints(xValues: any[], d0: number, d1: number, opts?: {
smallestKeyInterval?: number;
xNeedsValueOf?: boolean;
}): number;
export declare function aggregationDomain(scale: ScaleType, domainInput: DomainWithMetadata<any>): [number, number];
export declare function aggregationXRatioForDatumIndex(datumIndex: any, domainCount: number): number;
export declare function aggregationXRatioForXValue(xValue: any, d0: number, d1: number, xNeedsValueOf: boolean): number;
export declare function aggregationIndexForXRatio(xRatio: number, maxRange: number): number;
export declare function aggregationBucketForDatum(xValues: any[], d0: number, d1: number, maxRange: number, datumIndex: number, { xNeedsValueOf, xValuesLength }?: {
xNeedsValueOf?: boolean;
xValuesLength?: number;
}): number;
export declare function aggregationDatumMatchesIndex(indexData: Uint32Array, aggIndex: number, datumIndex: number, offsets: number[]): boolean;
export declare function createAggregationIndices(xValues: any[], yMaxValues: any[], yMinValues: any[], d0: number, d1: number, maxRange: number, { positive, split, xNeedsValueOf, yNeedsValueOf, reuseIndexData, reuseValueData, reuseNegativeIndexData, reuseNegativeValueData, }?: {
positive?: boolean;
split?: boolean;
xNeedsValueOf?: boolean;
yNeedsValueOf?: boolean;
reuseIndexData?: Uint32Array;
reuseValueData?: Float64Array;
reuseNegativeIndexData?: Uint32Array;
reuseNegativeValueData?: Float64Array;
}): {
indexData: Uint32Array;
valueData: Float64Array;
negativeIndexData?: Uint32Array;
negativeValueData?: Float64Array;
};
export declare function compactAggregationIndices(indexData: Uint32Array, valueData: Float64Array, maxRange: number, { inPlace, midpointData, reuseIndexData, reuseValueData, }?: {
inPlace?: boolean;
midpointData?: Uint32Array;
reuseIndexData?: Uint32Array;
reuseValueData?: Float64Array;
}): {
maxRange: number;
indexData: Uint32Array;
valueData: Float64Array;
midpointData: Uint32Array;
};
export interface AggregationLevelState {
maxRange: number;
indexData: Uint32Array;
valueData: Float64Array;
midpointData?: Uint32Array;
}
/**
* Computes midpoint indices from aggregation index data.
* For each bucket, calculates the midpoint between min and max X indices.
*
* This generic helper consolidates the `getMidpoints()` functions from
* rangeBarAggregation and ohlcAggregation, and `getIndices()` from barAggregation.
*
* @param maxRange - Number of aggregation buckets
* @param indexData - Aggregation index data (TypedArray)
* @param reuseMidpointData - Optional pre-allocated array to reuse (must be correct size)
* @param xMinOffset - Offset for the X min index within each bucket
* @param xMaxOffset - Offset for the X max index within each bucket
* @param invalidSentinel - Sentinel value indicating invalid/empty buckets (-1 or AGGREGATION_INDEX_UNSET)
* @returns Array of midpoint indices representing each bucket
*/
export declare function getMidpointsForIndices(maxRange: number, indexData: Uint32Array, reuseMidpointData?: Uint32Array, xMinOffset?: number, xMaxOffset?: number, invalidSentinel?: number): Uint32Array;
export declare function collectAggregationLevels<T>(state: AggregationLevelState, { collectLevel, shouldContinue, minRange, compactInPlace, }: {
collectLevel: (state: AggregationLevelState) => T;
shouldContinue: (level: T, state: AggregationLevelState) => boolean;
minRange?: number;
compactInPlace?: boolean;
}): T[];
/**
* Filter interface for extremes-based aggregation (OHLC, RangeBar).
* Tracks indices that represent extrema values within each aggregation bucket.
*/
export interface ExtremesAggregationFilter {
indexData: Uint32Array;
valueData: Float64Array;
maxRange: number;
midpointIndices: Uint32Array;
}
/**
* Result type for partial extremes aggregation with deferred computation.
*/
export interface ExtremesPartialAggregationResult {
/** Levels computed immediately (includes the target level) */
immediate: ExtremesAggregationFilter[];
/** Function to compute remaining coarser levels, or undefined if all levels computed */
computeRemaining?: () => ExtremesAggregationFilter[];
}
/**
* Computes multi-level aggregation filters for extremes-based chart data (OHLC, RangeBar).
*
* Creates progressively coarser aggregation levels for efficient rendering
* of large datasets. Tracks extrema values (min/max for both X and Y) as indices
* within each aggregation bucket.
*
* @param domain - Numeric domain bounds [min, max] for X values
* @param xValues - X coordinate values (typically time/date)
* @param highValues - High/max Y values for each data point
* @param lowValues - Low/min Y values for each data point
* @param options - Configuration options
* @returns Array of aggregation filters from coarse to fine resolution, or undefined if below threshold
*/
export declare function computeExtremesAggregation(domain: [number, number], xValues: any[], highValues: any[], lowValues: any[], options: {
smallestKeyInterval: number | undefined;
xNeedsValueOf: boolean;
yNeedsValueOf: boolean;
existingFilters?: ExtremesAggregationFilter[];
}): ExtremesAggregationFilter[] | undefined;
/**
* Computes extremes aggregation with deferred full recomputation.
*
* For real-time data updates, this computes only the single aggregation level
* needed for the current zoom, deferring a full recomputation of all levels
* to idle time.
*
* @param domain - Numeric domain bounds [min, max] for X values
* @param xValues - X coordinate values
* @param highValues - High/max Y values
* @param lowValues - Low/min Y values
* @param options - Configuration options including targetRange
* @returns Partial result with the immediate level and a function to compute all levels
*/
export declare function computeExtremesAggregationPartial(domain: [number, number], xValues: any[], highValues: any[], lowValues: any[], options: {
smallestKeyInterval: number | undefined;
targetRange: number;
xNeedsValueOf: boolean;
yNeedsValueOf: boolean;
existingFilters?: ExtremesAggregationFilter[];
}): ExtremesPartialAggregationResult | undefined;

13
node_modules/ag-charts-core/dist/types/src/utils/async.d.ts generated vendored Executable file
View File

@@ -0,0 +1,13 @@
/**
* Primitive to allow coordination between async processes.
*/
export declare class AsyncAwaitQueue {
private readonly queue;
/** Await another async process to call notify(). */
waitForCompletion(timeout?: number): Promise<boolean>;
/** Trigger any await()ing async processes to continue. */
notify(): void;
}
export declare function pause(delayMilliseconds?: number): Promise<any>;
/** Wraps a promise with a timeout. Rejects with an error if the timeout expires before resolution. */
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, errorMessage?: string): Promise<T>;

View File

@@ -0,0 +1 @@
export declare function createCanvasContext(width?: number, height?: number): CanvasRenderingContext2D;

View File

@@ -0,0 +1,70 @@
/** Type representing a constructor function. */
export type Constructor<T> = new (...args: any[]) => T;
/**
* Minimal interface for what a Canvas-like class must provide.
* This allows the mixin to work with any canvas implementation (e.g., skia-canvas).
* Uses loose typing to accommodate different canvas implementations.
*/
export interface CanvasLike {
width: number;
height: number;
gpu: boolean;
getContext(type: '2d'): unknown;
toBuffer(format: string, options?: {
quality?: number;
msaa?: boolean;
}): Promise<Uint8Array>;
toDataURLSync?(mimeType: string): string;
}
/** Default canvas width for test/SSR rendering. */
export declare const CANVAS_WIDTH = 800;
/** Default canvas height for test/SSR rendering. */
export declare const CANVAS_HEIGHT = 600;
/** Default buffer options for consistent rendering output. */
export declare const CANVAS_TO_BUFFER_DEFAULTS: {
quality: number;
};
/**
* Mixin that configures a Canvas class for consistent SSR/test rendering.
* Disables GPU acceleration and MSAA for deterministic output.
*
* Usage:
* ```typescript
* import { Canvas } from 'skia-canvas';
* import { ConfiguredCanvasMixin } from 'ag-charts-core';
*
* export const ConfiguredCanvas = ConfiguredCanvasMixin(Canvas);
* ```
*/
export declare function ConfiguredCanvasMixin<T extends Constructor<CanvasLike>>(Base: T): {
new (...args: any[]): {
toBuffer(format: string, options?: {
quality?: number;
msaa?: boolean;
}): Promise<Uint8Array>;
transferToImageBitmap(): CanvasLike;
width: number;
height: number;
gpu: boolean;
getContext(type: "2d"): unknown;
toDataURLSync?(mimeType: string): string;
};
} & T;
/**
* Apply skia-canvas patches for consistent rendering.
* Call once at module initialization in consuming packages.
*
* Patches:
* - createConicGradient: Fixes angle offset (https://github.com/samizdatco/skia-canvas/issues/241)
* - fillText: Uses path-based text rendering for consistent output
*
* Usage:
* ```typescript
* import * as SkiaCanvas from 'skia-canvas';
* import { DOMMatrix } from 'skia-canvas';
* import { applySkiaPatches } from 'ag-charts-core';
*
* applySkiaPatches(SkiaCanvas.CanvasRenderingContext2D, DOMMatrix);
* ```
*/
export declare function applySkiaPatches(CanvasRenderingContext2D: any, DOMMatrix: any): void;

View File

@@ -0,0 +1,47 @@
/**
* Converts a value to an array. If the value is already an array, it is returned as-is.
* @param value - The value to convert.
* @returns The resulting array.
*/
export declare function toArray<T>(value: T | T[] | undefined): T[];
/**
* Removes duplicate values from an array.
* @param array - The array to process.
* @returns A new array with unique values.
*/
export declare function unique<T>(array: T[]): T[];
/**
* Groups items in an array by a key generated from the `iteratee` function.
* @param array - The array to group.
* @param iteratee - A function that generates the key for each item.
* @returns An object where the keys are the group keys and the values are arrays of grouped items.
*/
export declare function groupBy<T, R extends string | number | symbol>(array: T[], iteratee: (item: T) => R): { [K in R]?: T[] | undefined; };
/**
* Compares two arrays for deep equality, including nested arrays.
* @param a - The first array.
* @param b - The second array.
* @returns `true` if the arrays are equal, otherwise `false`.
*/
export declare function arraysEqual(a: readonly any[], b: readonly any[]): boolean;
/**
* Creates a circular slice of an array.
* @param data - The source array.
* @param size - The size of the slice.
* @param offset - The starting index for the slice (default is 0).
* @returns A circular slice of the array.
*/
export declare function circularSliceArray<T>(data: T[], size: number, offset?: number): T[];
/**
* Sorts a base array according to the order defined in a reference array.
* @param baseArray - The array to sort.
* @param orderArray - The array defining the desired order.
* @returns The sorted array.
*/
export declare function sortBasedOnArray<T>(baseArray: T[], orderArray: T[]): T[];
export declare function dropFirstWhile<T>(array: T[], cond: (value: T) => boolean): void;
export declare function dropLastWhile<T>(array: T[], cond: (value: T) => boolean): void;
/**
* Creates an even distribution of numbers between `min` and `max`.
*/
export declare function distribute(min: number, max: number, maxCount: number): number[];

View File

@@ -0,0 +1,40 @@
/**
* Finds the maximum value that matches a condition within a specified range.
*
* @template T
* @param {number} min - The minimum number in the range.
* @param {number} max - The maximum number in the range.
* @param {function(number): boolean} iteratee - A function that takes a number and returns a value of type T or undefined.
* @returns {number | undefined} - The maximum value that matches the condition, or undefined if no match is found.
*/
export declare function findMaxIndex(min: number, max: number, iteratee: (value: number) => boolean): number | undefined;
/**
* Finds the minimum value that matches a condition within a specified range.
*
* @template T
* @param {number} min - The minimum number in the range.
* @param {number} max - The maximum number in the range.
* @param {function(number): boolean} iteratee - A function that takes a number and returns a value of type T or undefined.
* @returns {number | undefined} - The minimum value that matches the condition, or undefined if no match is found.
*/
export declare function findMinIndex(min: number, max: number, iteratee: (value: number) => boolean): number | undefined;
/**
* Finds the maximum value that matches a condition within a specified range.
*
* @template T
* @param {number} min - The minimum number in the range.
* @param {number} max - The maximum number in the range.
* @param {function(number): (T | undefined)} iteratee - A function that takes a number and returns a value of type T or undefined.
* @returns {T | undefined} - The maximum value that matches the condition, or undefined if no match is found.
*/
export declare function findMaxValue<T>(min: number, max: number, iteratee: (value: number) => T | undefined): T | undefined;
/**
* Finds the minimum value that matches a condition within a specified range.
*
* @template T
* @param {number} min - The minimum number in the range.
* @param {number} max - The maximum number in the range.
* @param {function(number): (T | undefined)} iteratee - A function that takes a number and returns a value of type T or undefined.
* @returns {T | undefined} - The minimum value that matches the condition, or undefined if no match is found.
*/
export declare function findMinValue<T>(min: number, max: number, iteratee: (value: number) => T | undefined): T | undefined;

View File

@@ -0,0 +1,17 @@
/**
* Compares two arrays and returns the differences between them, identifying added and removed elements.
*
* @template T - The type of elements in the arrays.
* @param {T[]} previous - The original array before changes.
* @param {T[]} current - The modified array after changes.
* @returns {{ changed: boolean, added: Set<T>, removed: Set<T> }}
* - An object containing:
* - `changed`: A boolean indicating if there are any changes.
* - `added`: A set of elements that were added to the current array.
* - `removed`: A set of elements that were removed from the previous array.
*/
export declare function diffArrays<T>(previous: T[], current: T[]): {
changed: boolean;
added: Set<T>;
removed: Set<T>;
};

View File

@@ -0,0 +1,10 @@
import type { DomainWithMetadata } from '../../types/scales';
export declare function extent(values: Array<unknown>, sortOrder?: 1 | -1): [number, number] | null;
export declare function normalisedExtentWithMetadata<T>(d: T[], min?: T, max?: T, preferredMin?: T, preferredMax?: T, toValue?: (x: number) => T, sortOrder?: 1 | -1): {
extent: T[];
clipped: boolean;
};
export declare function normalisedTimeExtentWithMetadata(input: DomainWithMetadata<Date>, min?: Date | number, max?: Date | number, preferredMin?: Date | number, preferredMax?: Date | number): {
extent: Date[];
clipped: boolean;
};

View File

@@ -0,0 +1,32 @@
/**
* Yields items from multiple iterables in sequence. If a value is not iterable,
* it is yielded directly.
*
* @param items - A list of iterable objects or values.
* @returns A generator yielding all items from the input iterables, or the values themselves if not iterable.
*/
export declare function iterate<T extends any[]>(...items: T): Generator<T[number] extends Iterable<infer U> ? U : T[number], void, undefined>;
/**
* Converts a value into an iterable. If the value is not already iterable, it wraps it in an array.
* @param value - The value to convert.
* @returns An iterable representing the value.
*/
export declare function toIterable<T>(value: T | Iterable<T>): Iterable<T>;
/**
* Returns the first value from an iterable sequence.
* @param iterable source of values
* @returns The first value, or throws an error is there is no first value.
*/
export declare function first<T>(iterable: Iterable<T>): T | never;
/**
* Efficient key/value iterator. Note that the returned tuple is always the same array, only
* elements change from one iteration to the next, so should only be used in destructing for
* statements.
*
* NOTE: For performance sensitive code, prefer using `Object.keys()` directly, or consider
* using a `Map` instead.
*
* @param obj to iterate over
* @returns An iterator for all key/value tuples of obj
*/
export declare function entries<T extends object>(obj: T): Iterable<[keyof T, T[keyof T]]>;

View File

@@ -0,0 +1,80 @@
import type { DeepPartial } from '../../types/global';
type StringSet = {
has(value: string): boolean;
};
export type CloneOptions = {
shallow?: StringSet;
assign?: StringSet;
seen?: unknown[];
};
/**
* Performs a recursive JSON-diff between a source and target JSON structure.
*
* On a per-property basis, takes the target property value where:
* - types are different.
* - type is primitive.
* - type is array and length or content have changed.
*
* @param source starting point for diff
* @param target target for diff vs. source
* @param shallow object keys to only shallow compare during diff
* @returns `null` if no differences, or an object with the subset of properties that have changed.
*/
export declare function jsonDiff<T>(source: T, target: T, shallow?: Set<keyof T>): Partial<T> | null;
/**
* Compares all properties of source against target's properties of the same name.
*
* @param source object to read properties from
* @param target object to compare property values with
*
* @returns true if all properties in source have identical values in target
*/
export declare function jsonPropertyCompare<T>(source: Partial<T>, target: T): boolean;
/**
* Recursively clones of primitives and objects.
*
* @param source object | array
* @param shallow
*
* @return deep clone of source
*/
export declare function deepClone<T>(source: T, opts?: CloneOptions): T;
/**
* Clones of primitives and objects.
*
* @param source any value
*
* @return shallow clone of source
*/
export declare function shallowClone<T>(source: T): T;
/**
* Walk the given JSON object graphs, invoking the visit() callback for every object encountered.
* Arrays are descended into without a callback, however their elements will have the visit()
* callback invoked if they are objects.
*
* @param json to traverse
* @param visit callback for each non-primitive and non-array object found
* @param skip property names to skip when walking
* @param parallelJson to traverse in parallel
* @param ctx
* @param acc initial accumulator value
*/
export declare function jsonWalk<T, C, R>(json: T, visit: (node: T, parallelNode?: T, ctx?: C, acc?: R) => R, skip?: Set<string>, parallelJson?: T, ctx?: C, acc?: R): R;
/**
* Recursively apply a JSON object into a class-hierarchy, optionally instantiating certain classes
* by property name.
*
* @param target to apply source JSON properties into
* @param source to be applied
* @param params
* @param params.path path for logging/error purposes, to aid with pinpointing problems
* @param params.matcherPath path for pattern matching, to lookup allowedTypes override.
* @param params.skip property names to skip from the source
* @param params.constructedArrays map stores arrays which items should be initialised using a class constructor
*/
export declare function jsonApply<Target extends object, Source extends DeepPartial<Target>>(target: Target, source?: Source, params?: {
path?: string;
matcherPath?: string;
skip?: string[];
}): Target;
export {};

View File

@@ -0,0 +1,7 @@
type LinkedListItem<T> = {
value: T;
next: LinkedListItem<T> | null;
};
export type LinkedList<T> = LinkedListItem<T> | null;
export declare function insertListItemsSorted<T>(list: LinkedList<T>, items: T[], cmp: (a: T, b: T) => number): LinkedList<T>;
export {};

View File

@@ -0,0 +1,20 @@
export type NearestResult<T> = {
nearest: T | undefined;
distanceSquared: number;
};
export interface DistantObject {
distanceSquared(x: number, y: number): number;
}
type NearestCalculator<TNearest> = {
nearestSquared(x: number, y: number, maxDistance: number): NearestResult<TNearest>;
};
type DistantContainer<TNearest> = {
children: Iterable<NearestCalculator<TNearest>>;
transformPoint?: (x: number, y: number) => {
x: number;
y: number;
};
};
export declare function nearestSquared<TObject extends DistantObject>(x: number, y: number, objects: Iterable<TObject>, maxDistanceSquared?: number): NearestResult<TObject>;
export declare function nearestSquaredInContainer<TNearest>(x: number, y: number, container: DistantContainer<TNearest>, maxDistanceSquared?: number): NearestResult<TNearest>;
export {};

View File

@@ -0,0 +1,5 @@
export declare function clampArray(value: number, array: readonly number[]): number;
export declare function findMinMax(array: readonly number[]): number[];
export declare function findRangeExtent(array: number[]): number;
export declare function nextPowerOf2(value: number): number;
export declare function previousPowerOf2(value: number): number;

View File

@@ -0,0 +1,13 @@
export declare function clamp(min: number, value: number, max: number): number;
export declare function inRange(value: number, range: [number, number], epsilon?: number): boolean;
export declare function isNumberEqual(a: number, b: number, epsilon?: number): boolean;
export declare function isNegative(value: number): boolean;
export declare function isInteger(value: number): boolean;
export declare function roundTo(value: number, decimals?: number): number;
export declare function ceilTo(value: number, decimals?: number): number;
/**
* Returns the mathematically correct n modulus of m. For context, the JS % operator is remainder
* NOT modulus, which is why this is needed.
*/
export declare function modulus(n: number, m: number): number;
export declare function countFractionDigits(value: number): number;

View File

@@ -0,0 +1,39 @@
import type { Intersection, PlainObject } from '../../types/global';
type FalsyType = false | null | undefined;
export declare function strictObjectKeys<O extends object>(o: O): (keyof O)[];
export declare function objectsEqual(a: unknown, b: unknown): boolean;
export declare function objectsEqualWith<T extends PlainObject>(a: T, b: T, cmp: (a: T, b: T) => boolean): boolean;
/**
* Merge objects from left to right, with left-most properties having highest precedent.
*
* NOTE: `undefined` values take lower priority than actual values irrespective of precedent.
*/
export declare function mergeDefaults<TSource extends PlainObject, TArgs extends (TSource | FalsyType)[]>(...sources: TArgs): Intersection<Exclude<TArgs[number], FalsyType>>;
export declare function mergeDefaults<TSameSource extends PlainObject>(...sources: (TSameSource | undefined)[]): TSameSource;
/**
* Merge objects from left to right, with left-most properties having highest precedent.
*/
export declare function merge<TSource extends PlainObject, TArgs extends (TSource | FalsyType)[]>(...sources: TArgs): Intersection<Exclude<TArgs[number], FalsyType>>;
export declare function mergeArrayDefaults<T extends PlainObject>(dataArray: T[], ...itemDefaults: T[]): T[] | Intersection<Exclude<T, FalsyType>>[];
export declare function mapValues<T extends PlainObject, R>(object: T, mapper: (value: T[keyof T], key: keyof T, object: T) => R): Record<keyof T, R>;
export declare function without<T, K extends keyof T | string>(object: T | undefined, keys: readonly K[]): Omit<T, K>;
export declare function without(object: object | undefined, keys: readonly string[]): object;
export declare function pick<T, K extends keyof T>(object: T | undefined, keys: readonly K[]): Pick<T, K>;
export declare function pick(object: object | undefined, keys: readonly string[]): object;
export declare function every<T, K extends keyof T>(object: T | undefined, fn: (key: K, value: unknown) => boolean): boolean;
export declare function every(object: object | undefined, fn: (key: string, value: unknown) => boolean): boolean;
export declare function fromPairs<K extends string>(pairs?: Array<[K, any]>): Record<K, any>;
export declare function getPath(object: object, path: string | string[]): any;
export declare const SKIP_JS_BUILTINS: Set<string>;
export declare function setPath(object: object, path: string | string[], newValue: unknown): any;
export declare function partialAssign<T>(keysToCopy: (keyof T)[], target: T, source?: Partial<T>): T;
export declare function assignIfNotStrictlyEqual<T extends object>(target: T, source: T): T;
export declare function assignIfNotStrictlyEqual<T extends object>(target: T, source: T, keys: readonly string[]): T;
export declare function deepFreeze<T>(obj: T): T;
export declare function isObjectWithProperty<K extends string>(obj: unknown, key: K): obj is {
[key in K]: unknown;
};
export declare function isObjectWithStringProperty<K extends string>(obj: unknown, key: K): obj is {
[key in K]: string;
};
export {};

View File

@@ -0,0 +1,47 @@
import type { TextOrSegments } from 'ag-charts-types';
/**
* Joins an array of strings or objects into a formatted string, adding a custom conjunction before the last item.
* Useful for creating human-readable lists from arrays with an option to limit the number of items shown.
* @param values An array of strings or objects to join. Objects are converted to strings using the `format` function.
* @param conjunction The word to use before the last item in the list, defaulting to 'and'.
* @param format A function that formats each item in the array. By default, items are converted to strings using `String`.
* @param maxItems The maximum number of items to show before truncating, defaults to showing all items.
* @returns A string that is the result of joining the formatted values with commas, truncating if necessary, and appending the specified conjunction before the last item.
*/
export declare function joinFormatted(values: string[], conjunction?: string, format?: (value: any) => string, maxItems?: number): string;
/**
* Converts a value to a string with an optional maximum length.
* Provides specific string representations for `undefined`, `NaN`, `Infinity`, and `-Infinity`.
* If the stringified value exceeds the specified maximum length, it truncates the string and appends an indication of the truncated length.
* @param value The value to be stringified. Can be of any type.
* @param maxLength The maximum length of the resulting string. Defaults to Infinity.
* @returns A string representation of the value, potentially truncated if it exceeds the maximum length.
*/
export declare function stringifyValue(value: unknown, maxLength?: number): string;
/**
* Efficiently counts the number of lines in a string.
* Processes the string in a single pass, counting newline (`\n`) characters
* by their ASCII value (10). Optimized for performance in scenarios with
* large datasets or tight loops.
* @param {string} text The input string.
* @returns {number} The number of lines, with at least one line for non-empty strings.
*/
export declare function countLines(text: string): number;
/**
* Computes the Levenshtein distance between two strings.
* This function uses a space-optimized dynamic programming approach.
*
* @param {string} a - The first string.
* @param {string} b - The second string.
* @returns {number} - The Levenshtein distance between the two strings.
*/
export declare function levenshteinDistance(a: string, b: string): number;
/**
* Converts a string into kebab-case. It lowercases each matched uppercase character in the same single iteration
* through the string.
*
* @param {string} a - The string.
* @returns {string} - The kebab-case string.
*/
export declare function kebabCase(a: string): string;
export declare function toPlainText(text?: TextOrSegments, fallback?: string): string;

View File

@@ -0,0 +1,21 @@
import type { PlainObject } from '../../types/global';
type StringObject = PlainObject & {
toString: () => string;
};
type NumberObject = PlainObject & {
valueOf: () => number;
};
export declare function isStringObject(value: unknown): value is StringObject;
export declare function isNumberObject(value: unknown): value is NumberObject;
export declare function isContinuous(value: unknown): value is number | Date | NumberObject;
export declare function checkDatum<T>(value: T, isContinuousScale: boolean): boolean;
/**
* To enable duplicate categories, a category axis value on a datum from integrated charts is transformed into an
* object with `getString()` and `id` properties. The string value can be non-unique so we must instead use the
* unique id property.
*
* @see https://ag-grid.atlassian.net/browse/AG-10526
*/
export declare function transformIntegratedCategoryValue(value: unknown): any;
export declare function readIntegratedWrappedValue<D>(value: D): D;
export {};

View File

@@ -0,0 +1 @@
export declare function rescaleVisibleRange(visibleRange: [number, number], [s0, s1]: [number, number], [d0, d1]: [number, number]): [number, number];

View File

@@ -0,0 +1,5 @@
export declare function createDeprecationWarning(): (key: string, message?: string) => void;
export declare function Deprecated(message?: string, opts?: {
default?: any;
}): PropertyDecorator;
export declare function DeprecatedAndRenamedTo(newPropName: any, mapValue?: (value: any) => any): PropertyDecorator;

View File

@@ -0,0 +1,59 @@
import type { Direction } from 'ag-charts-types';
import type { Nullable } from '../../types/global';
import type { ElementID } from '../../types/idBranding';
export type StrictHTMLElement = HTMLElement & {
id: ElementID;
};
type AriaRole = 'figure' | 'group' | 'img' | 'list' | 'listitem' | 'menu' | 'menuitem' | 'menuitemradio' | 'presentation' | 'radio' | 'radiogroup' | 'separator' | 'status' | 'switch' | 'tab' | 'tablist' | 'tabpanel' | 'textbox' | 'toolbar';
export type BaseAttributeTypeMap = {
role: AriaRole;
'aria-checked': boolean;
'aria-controls': ElementID;
'aria-describedby': ElementID;
'aria-disabled': boolean;
'aria-expanded': boolean;
'aria-haspopup': 'true' | 'false' | 'menu' | 'dialog' | 'grid' | 'listbox' | 'tree';
'aria-hidden': boolean;
'aria-label': string;
'aria-labelledby': ElementID;
'aria-live': 'assertive' | 'polite';
'aria-orientation': Direction;
'aria-selected': boolean;
'data-focus-override': boolean;
'data-focus-visible-override': boolean;
'data-preventdefault': boolean;
class: string;
for: ElementID;
id: ElementID;
tabindex: 0 | -1;
title: string;
};
type InputAttributeTypeMap = BaseAttributeTypeMap & {
placeholder: string;
};
export type AttributeSet = Partial<{
[K in keyof BaseAttributeTypeMap]: BaseAttributeTypeMap[K];
}>;
export type InputAttributeSet = Partial<{
[K in keyof InputAttributeTypeMap]: InputAttributeTypeMap[K];
}>;
export type BaseStyleTypeMap = {
cursor: 'default' | 'pointer' | 'ew-resize' | 'ns-resize' | 'grab' | 'grabbing';
display: 'none';
position: 'absolute';
'pointer-events': 'auto' | 'none';
width: '100%';
height: '100%';
};
type StyleSet = Partial<{
[K in keyof BaseStyleTypeMap]: BaseStyleTypeMap[K];
}>;
export declare function setAttribute<A extends keyof BaseAttributeTypeMap>(e: Nullable<HTMLElement>, qualifiedName: A, value: BaseAttributeTypeMap[A] | undefined): void;
export declare function setAttribute<A extends keyof InputAttributeTypeMap>(e: Nullable<HTMLTextAreaElement>, qualifiedName: A, value: InputAttributeTypeMap[A] | undefined): void;
export declare function setAttributes(e: Nullable<HTMLElement>, attrs: AttributeSet | undefined): void;
export declare function setAttributes(e: Nullable<HTMLTextAreaElement>, attrs: InputAttributeTypeMap | undefined): void;
export declare function getAttribute<A extends keyof BaseAttributeTypeMap, DefaultType extends BaseAttributeTypeMap[A] | undefined>(e: Nullable<HTMLElement | EventTarget>, qualifiedName: A, defaultValue?: DefaultType): BaseAttributeTypeMap[A] | (DefaultType extends undefined ? undefined : never);
export declare function getAttribute<A extends keyof InputAttributeTypeMap, DefaultType extends InputAttributeTypeMap[A] | undefined>(e: Nullable<HTMLTextAreaElement>, qualifiedName: A, defaultValue?: DefaultType): InputAttributeTypeMap[A] | (DefaultType extends undefined ? undefined : never);
export declare function setElementStyle<P extends keyof BaseStyleTypeMap>(e: Nullable<Pick<HTMLElement, 'style'>>, property: P, value: BaseStyleTypeMap[P] | undefined): void;
export declare function setElementStyles(e: Nullable<HTMLElement>, styles: StyleSet): void;
export {};

View File

@@ -0,0 +1,6 @@
/**
* Triggers a download for a given data URL and file name.
* @param dataUrl - The data URL of the file to download.
* @param fileName - The name of the file to be saved.
*/
export declare function downloadUrl(dataUrl: string, fileName: string): void;

View File

@@ -0,0 +1,16 @@
import type { StrictHTMLElement } from './attributeUtil';
/**
* Creates an HTML element with optional class names and inline styles.
* @param tagName - The name of the HTML element to create.
* @param className - A space-separated string of class names or a style object (optional).
* @param style - An object representing CSS styles (optional).
* @returns The created HTML element.
*/
export declare function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, style?: Partial<CSSStyleDeclaration>): HTMLElementTagNameMap[K] & StrictHTMLElement;
export declare function createElement<K extends keyof HTMLElementTagNameMap>(tagName: K, style?: Partial<CSSStyleDeclaration>): HTMLElementTagNameMap[K] & StrictHTMLElement;
/**
* Creates an SVG element.
* @param elementName - The name of the SVG element to create.
* @returns The created SVG element.
*/
export declare function createSvgElement<K extends keyof SVGElementTagNameMap>(elementName: K): SVGElementTagNameMap[K];

View File

@@ -0,0 +1,3 @@
type EventMapFor<T> = T extends Window ? WindowEventMap : T extends Document ? DocumentEventMap : T extends HTMLElement ? HTMLElementEventMap : never;
export declare function attachListener<T extends Document | HTMLElement | Window, K extends keyof EventMapFor<T>>(element: T, eventName: K & string, handler: (this: T, event: EventMapFor<T>[K]) => void, options?: boolean | AddEventListenerOptions): () => void;
export {};

View File

@@ -0,0 +1,7 @@
import type { AgIconName } from 'ag-charts-types';
import type { BoxBounds } from '../geometry/boxBounds';
export declare function setElementBBox(element: HTMLElement | undefined, bbox: Partial<BoxBounds>): void;
export declare function getElementBBox(element: HTMLElement): BoxBounds;
export declare function focusCursorAtEnd(element: HTMLElement): void;
export declare function isInputPending(): false | void;
export declare function getIconClassNames(icon: AgIconName): string;

View File

@@ -0,0 +1 @@
export declare function parseColor(color: string): string | null;

View File

@@ -0,0 +1,71 @@
/**
* Retrieves the global `document` object or a specific property of it.
* @param propertyName - The name of the `document` property to retrieve (optional).
* @returns The `document` object or the specified property.
*/
export declare function getDocument<E>(): Document & E;
export declare function getDocument<K extends keyof Document>(propertyName: K): Document[K];
/**
* Retrieves the global `window` object or a specific property of it.
* @param propertyName - The name of the `window` property to retrieve (optional).
* @returns The `window` object or the specified property.
*/
export declare function getWindow<E>(): Window & E;
export declare function getWindow<K extends keyof Window>(propertyName: K): Window[K];
export declare function getWindow<R = unknown>(propertyName: string): R;
/**
* Sets the global `document` object.
* @param document - The `document` object to set.
*/
export declare function setDocument(document: Document): void;
/**
* Sets the global `window` object.
* @param window - The `window` object to set.
*/
export declare function setWindow(window: Window): void;
/**
* Retrieves the OffscreenCanvas constructor from the injected window.
* Falls back to globalThis if window doesn't have it.
*/
export declare function getOffscreenCanvas(): typeof OffscreenCanvas;
/**
* Retrieves the Path2D constructor from the injected window.
* Falls back to globalThis if window doesn't have it.
*/
export declare function getPath2D(): typeof Path2D;
/**
* Retrieves the DOMMatrix constructor from the injected window.
* Falls back to globalThis if window doesn't have it.
*/
export declare function getDOMMatrix(): typeof DOMMatrix;
/**
* Retrieves the Image constructor from the injected window.
* Falls back to globalThis if window doesn't have it.
*/
export declare function getImage(): typeof HTMLImageElement;
/**
* Retrieves the ResizeObserver constructor from the injected window.
* Falls back to globalThis if window doesn't have it.
* Returns undefined in SSR environments without a polyfill.
*/
export declare function getResizeObserver(): typeof ResizeObserver | undefined;
/**
* SSR-safe check for whether an object is a DOM Node.
* Uses duck-typing via nodeType property instead of instanceof.
*/
export declare function isNode(obj: unknown): obj is Node;
/**
* SSR-safe check for whether an object is a DOM Element.
* Uses duck-typing via nodeType property instead of instanceof.
*/
export declare function isElement(obj: unknown): obj is Element;
/**
* SSR-safe check for whether an object is a DocumentFragment (e.g. Shadow DOM root).
* Uses duck-typing via nodeType property instead of instanceof.
*/
export declare function isDocumentFragment(obj: unknown): obj is DocumentFragment;
/**
* SSR-safe check for whether an object is an HTMLElement.
* Uses duck-typing via nodeType and style property instead of instanceof.
*/
export declare function isHTMLElement(obj: unknown): obj is HTMLElement;

View File

@@ -0,0 +1,28 @@
import { CleanupRegistry } from '../../state/cleanupRegistry';
export declare function addEscapeEventListener(elem: HTMLElement, onEscape: (event: KeyboardEvent) => void, keyCodes?: readonly string[]): () => void;
export declare function addMouseCloseListener(menu: HTMLElement, hideCallback: () => void): () => void;
export declare function addTouchCloseListener(menu: HTMLElement, hideCallback: () => void): () => void;
export declare function addOverrideFocusVisibleEventListener(menu: HTMLElement, buttons: HTMLElement[], overrideFocusVisible: boolean): () => void;
export declare function hasNoModifiers(event: KeyboardEvent | MouseEvent): boolean;
export declare const PREV_NEXT_KEYS: {
readonly horizontal: {
readonly nextKey: "ArrowRight";
readonly prevKey: "ArrowLeft";
};
readonly vertical: {
readonly nextKey: "ArrowDown";
readonly prevKey: "ArrowUp";
};
};
export declare function initRovingTabIndex(opts: {
orientation: 'horizontal' | 'vertical';
buttons: HTMLElement[];
wrapAround?: boolean;
onFocus?: (event: FocusEvent) => void;
onBlur?: (event: FocusEvent) => void;
onEscape?: (event: KeyboardEvent) => void;
}): CleanupRegistry;
export declare function makeAccessibleClickListener(element: HTMLElement, onclick: (event: MouseEvent) => unknown): (event: MouseEvent) => void;
export declare function isButtonClickEvent(event: KeyboardEvent | MouseEvent): boolean;
export declare function getLastFocus(sourceEvent: Event | undefined): HTMLElement | undefined;
export declare function stopPageScrolling(element: HTMLElement): () => void;

View File

@@ -0,0 +1,79 @@
interface IColor {
readonly r: number;
readonly g: number;
readonly b: number;
readonly a: number;
}
export declare class Color implements IColor {
readonly r: number;
readonly g: number;
readonly b: number;
readonly a: number;
/**
* Every color component should be in the [0, 1] range.
* Some easing functions (such as elastic easing) can overshoot the target value by some amount.
* So, when animating colors, if the source or target color components are already near
* or at the edge of the allowed [0, 1] range, it is possible for the intermediate color
* component value to end up outside of that range mid-animation. For this reason the constructor
* performs range checking/constraining.
* @param r Red component.
* @param g Green component.
* @param b Blue component.
* @param a Alpha (opacity) component.
*/
constructor(r: number, g: number, b: number, a?: number);
/**
* A color string can be in one of the following formats to be valid:
* - #rgb
* - #rrggbb
* - rgb(r, g, b)
* - rgba(r, g, b, a)
* - CSS color name such as 'white', 'orange', 'cyan', etc.
*/
static validColorString(str: string): boolean;
/**
* The given string can be in one of the following formats:
* - #rgb
* - #rrggbb
* - rgb(r, g, b)
* - rgba(r, g, b, a)
* - CSS color name such as 'white', 'orange', 'cyan', etc.
* @param str
*/
static fromString(str: string): Color;
static parseHex(input: string): [number, number, number, number] | undefined;
static fromHexString(str: string): Color;
private static stringToRgba;
static fromRgbaString(str: string): Color;
static fromArray(arr: [number, number, number] | [number, number, number, number]): Color;
static fromHSB(h: number, s: number, b: number, alpha?: number): Color;
static fromHSL(h: number, s: number, l: number, alpha?: number): Color;
static fromOKLCH(l: number, c: number, h: number, alpha?: number): Color;
private static padHex;
toHexString(): string;
toRgbaString(fractionDigits?: number): string;
toString(): string;
toHSB(): [number, number, number];
static RGBtoOKLCH(r: number, g: number, b: number): [number, number, number];
static OKLCHtoRGB(l: number, c: number, h: number): [number, number, number];
static RGBtoHSL(r: number, g: number, b: number): [number, number, number];
static HSLtoRGB(h: number, s: number, l: number): [number, number, number];
/**
* Converts the given RGB triple to an array of HSB (HSV) components.
*/
static RGBtoHSB(r: number, g: number, b: number): [number, number, number];
/**
* Converts the given HSB (HSV) triple to an array of RGB components.
*/
static HSBtoRGB(H: number, S: number, B: number): [number, number, number];
static mix(c0: Color, c1: Color, t: number): Color;
static lighten(c: Color, t: number): Color;
static darken(c: Color, t: number): Color;
static interpolate(colors: Color[], count: number): Color[];
/**
* CSS Color Module Level 4:
* https://drafts.csswg.org/css-color/#named-colors
*/
private static readonly nameToHex;
}
export {};

View File

@@ -0,0 +1,29 @@
/**
* Formats a value as a string. If the value is a number, it formats it with the specified
* maximum number of fraction digits. If the value is not a number, it returns an empty string
* or the string representation of the value.
*
* @param value - The value to format.
* @param maximumFractionDigits - The maximum number of fraction digits to display when formatting numbers.
* @returns A formatted string representation of the value.
*/
export declare function formatValue(value: unknown, maximumFractionDigits?: number): string;
/**
* Formats a number as a percentage using the current locale.
*
* @param value - A decimal number representing the percentage (e.g., 0.25 for 25%).
* @returns A percentage string.
*/
export declare function formatPercent(value: number): string;
/**
* Formats a number with a specified maximum number of fraction digits.
*
* This function improves upon `Number.toFixed(n)`, which always displays exactly `n` digits after the decimal point.
* Instead, this function limits the number of fraction digits to a maximum value, making it useful for
* displaying both small and large numbers with an appropriate level of precision.
*
* @param value - The number to format.
* @param maximumFractionDigits - The maximum number of fraction digits to display.
* @returns A string representing the formatted number.
*/
export declare function formatNumber(value: number, maximumFractionDigits: number): string;

View File

@@ -0,0 +1,19 @@
interface FormatterOptions {
prefix?: string;
fill?: string;
align?: string;
sign?: string;
symbol?: string;
zero?: string;
width?: number;
comma?: string;
precision?: number;
trim?: boolean;
type?: string;
suffix?: string;
}
export declare function isValidNumberFormat(value: unknown): boolean;
export declare function parseNumberFormat(format: string): FormatterOptions | undefined;
export declare function createNumberFormatter(format: FormatterOptions): (n: number, fractionDigits?: number) => string;
export declare function createNumberFormatter(format: string): ((n: number, fractionDigits?: number) => string) | undefined;
export {};

View File

@@ -0,0 +1,3 @@
type FormattingFn = (dateTime: Date, paddingChar?: string) => string;
export declare function buildDateFormatter(formatString: string): FormattingFn;
export {};

View File

@@ -0,0 +1,43 @@
interface DebounceOptions {
leading?: boolean;
trailing?: boolean;
maxWait?: number;
}
interface ThrottleOptions {
leading?: boolean;
trailing?: boolean;
}
/**
* Creates a debounced function that delays invoking the provided callback until
* after `waitMs` milliseconds have elapsed since the last time the function was called.
*
* @template T - The type of the callback function.
* @param callback - The function to debounce.
* @param waitMs - The number of milliseconds to delay (default is 0).
* @param options - Optional configuration:
* - `leading` (default: false): If true, the callback will be invoked on the leading edge of the timeout.
* - `trailing` (default: true): If true, the callback will be invoked on the trailing edge of the timeout.
* - `maxWait` (default: Infinity): The maximum time the callback can be delayed before it's invoked.
* @returns A debounced version of the callback with a `cancel` method to clear the timer.
* @throws If `maxWait` is less than `waitMs`.
*/
export declare function debounce<T extends (...args: Parameters<T>) => void>(callback: T, waitMs?: number, options?: DebounceOptions): ((...args: Parameters<T>) => void) & {
cancel(): void;
};
/**
* Creates a throttled function that only invokes the provided callback at most once
* every `waitMs` milliseconds.
*
* @template T - The type of the callback function.
* @param callback - The function to throttle.
* @param waitMs - The number of milliseconds to throttle invocations.
* @param options - Optional configuration:
* - `leading` (default: true): If true, the callback will be invoked on the leading edge of the timeout.
* - `trailing` (default: true): If true, the callback will be invoked on the trailing edge of the timeout.
* @returns A throttled version of the callback with a `cancel` method to clear the timer.
*/
export declare function throttle<T extends (...args: Parameters<T>) => void>(callback: T, waitMs: number, options?: ThrottleOptions): ((...args: Parameters<T>) => void) & {
cancel(): void;
};
export declare function safeCall<T = unknown>(callback: Function, args: any[], errorPath?: string): T | undefined;
export {};

View File

@@ -0,0 +1 @@
export declare const geoJson: import("../state/validation").Validator;

View File

@@ -0,0 +1,33 @@
/**
* Normalize the given angle to be in the [0, 2π) interval.
* @param radians Angle in radians.
*/
export declare function normalizeAngle360(radians: number): number;
export declare function normalizeAngle360Inclusive(radians: number): number;
/**
* Normalize the given angle to be in the [-π, π) interval.
* @param radians Angle in radians.
*/
export declare function normalizeAngle180(radians: number): number;
export declare function isBetweenAngles(targetAngle: number, startAngle: number, endAngle: number): boolean;
export declare function toRadians(degrees: number): number;
export declare function toDegrees(radians: number): number;
/**
* Returns a rotation angle between two other angles.
* @param angle0 Angle in radians.
* @param angle1 Angle in radians.
* @returns Angle in radians.
*/
export declare function angleBetween(angle0: number, angle1: number): number;
/**
* Calculates the ratio of an angle in radians based on its proximity to 0, π/2, π, or 3π/2.
*
* - 0 and π return ratios decreasing linearly to 0 at these angles.
* - π/2 and 3π/2 return ratios increasing linearly to 1 at these angles.
*
* @param angle - The input angle in radians.
* @returns The ratio (a number between 0 and 1).
*/
export declare function getAngleRatioRadians(angle: number): number;
export declare function angularPadding(hPadding: number, vPadding: number, angle: number): number;
export declare function normalizeAngle360FromDegrees(degrees?: number): number;

View File

@@ -0,0 +1,6 @@
import type { Point } from '../../types/scene';
export declare function evaluateBezier(p0: number, p1: number, p2: number, p3: number, t: number): number;
export declare function solveBezier(p0: number, p1: number, p2: number, p3: number, value: number): number;
export declare function splitBezier2D(p0x: number, p0y: number, p1x: number, p1y: number, p2x: number, p2y: number, p3x: number, p3y: number, t: number): [[Point, Point, Point, Point], [Point, Point, Point, Point]];
export declare function bezier2DExtrema(cp0x: number, cp0y: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, cp3x: number, cp3y: number): number[];
export declare function bezier2DDistance(cp0x: number, cp0y: number, cp1x: number, cp1y: number, cp2x: number, cp2y: number, cp3x: number, cp3y: number, x: number, y: number, precision?: number): number;

View File

@@ -0,0 +1,18 @@
import type { BorderOptions } from 'ag-charts-types';
import { BaseProperties } from '../../state/properties';
export declare class Border extends BaseProperties implements BorderOptions {
readonly node: {
stroke?: string | object;
strokeOpacity: number;
strokeWidth: number;
};
enabled: boolean;
stroke: string;
strokeOpacity: number;
strokeWidth: number;
constructor(node: {
stroke?: string | object;
strokeOpacity: number;
strokeWidth: number;
});
}

View File

@@ -0,0 +1,7 @@
import type { Point, Size } from '../../types/scene';
export interface BoxBounds extends Size, Point {
}
export declare function boxCollides(b: BoxBounds, x: number, y: number, w: number, h: number): boolean;
export declare function boxContains(b: BoxBounds, x: number, y: number, w?: number, h?: number): boolean;
export declare function boxEmpty(b: BoxBounds | undefined): boolean;
export declare function boxesEqual(a: BoxBounds | undefined, b: BoxBounds | undefined): boolean;

View File

@@ -0,0 +1,2 @@
export declare function lineDistanceSquared(x: number, y: number, x1: number, y1: number, x2: number, y2: number, best: number): number;
export declare function arcDistanceSquared(x: number, y: number, cx: number, cy: number, radius: number, startAngle: number, endAngle: number, counterClockwise: boolean, best: number): number;

View File

@@ -0,0 +1,8 @@
import type { AgImageFill, AgPatternColor } from 'ag-charts-types';
import type { InternalAgColorType, InternalAgGradientColor } from '../../config/optionsDefaults';
export declare function isGradientFill(fill: any): fill is InternalAgGradientColor;
export declare function isGradientFillArray(fills: any): fills is InternalAgColorType[];
export declare function isStringFillArray(fills: any): fills is string[];
export declare function isPatternFill(fill: any): fill is AgPatternColor;
export declare function isImageFill(fill: any): fill is AgImageFill;
export declare function isGradientOrPatternFill(fill: any): fill is InternalAgGradientColor | AgPatternColor;

View File

@@ -0,0 +1,27 @@
import type { TextOrSegments } from 'ag-charts-types';
import type { Point, SizedPoint } from '../../types/scene';
import { type BoxBounds } from './boxBounds';
export type LabelPlacement = 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
export interface MeasuredLabel {
readonly text: TextOrSegments;
readonly width: number;
readonly height: number;
}
export interface PointLabelDatum {
readonly point: Readonly<SizedPoint>;
readonly label: MeasuredLabel;
readonly anchor: Point | undefined;
readonly placement: LabelPlacement | undefined;
}
export interface PlacedLabel<PLD = PointLabelDatum> extends MeasuredLabel, Readonly<Point> {
readonly index: number;
readonly datum: PLD;
}
export declare function isPointLabelDatum(x: any): x is PointLabelDatum;
/**
* @param data Points and labels for one or more series. The order of series determines label placement precedence.
* @param bounds Bounds to fit the labels into. If a label can't be fully contained, it doesn't fit.
* @param padding
* @returns Placed labels for all series.
*/
export declare function placeLabels(data: Map<string, PointLabelDatum[]>, bounds: BoxBounds, padding?: number): Map<string, PlacedLabel<PointLabelDatum>[]>;

View File

@@ -0,0 +1,58 @@
import type { Point } from '../../types/scene';
export interface LinearSpan {
type: 'linear';
moveTo: boolean;
x0: number;
y0: number;
x1: number;
y1: number;
}
export interface CubicSpan {
type: 'cubic';
moveTo: boolean;
cp0x: number;
cp0y: number;
cp1x: number;
cp1y: number;
cp2x: number;
cp2y: number;
cp3x: number;
cp3y: number;
}
export interface StepSpan {
type: 'step';
moveTo: boolean;
x0: number;
y0: number;
x1: number;
y1: number;
stepX: number;
}
export interface MultiLineSpan {
type: 'multi-line';
moveTo: boolean;
x0: number;
y0: number;
x1: number;
y1: number;
midPoints: Point[];
}
export type Span = LinearSpan | CubicSpan | StepSpan | MultiLineSpan;
export declare function spanRange(span: Span): [Point, Point];
export declare function collapseSpanToPoint(span: Span, point: Point): Span;
export declare function rescaleSpan(span: Span, nextStart: Point, nextEnd: Point): Span;
export declare function clipSpanX(span: Span, x0: number, x1: number): Span;
export declare enum SpanJoin {
MoveTo = 0,
LineTo = 1,
Skip = 2
}
export declare function linearPoints(points: Iterable<Point>): Span[];
declare const lineSteps: {
start: number;
middle: number;
end: number;
};
export declare function stepPoints(points: Iterable<Point>, position: number | keyof typeof lineSteps): Span[];
export declare function smoothPoints(iPoints: Iterable<Point>, tension: number): Span[];
export {};

View File

@@ -0,0 +1 @@
export * from './shapeUtils';

View File

@@ -0,0 +1,23 @@
import type { Point, Size } from '../../../types/scene';
/**
* Calculates the maximum width and height of an inner rectangle that can be
* rotated by a given angle (in degrees) and still fully fit within a container.
*
* @param rotationDeg - Rotation angle in degrees.
* @param containerWidth - Width of the outer container.
* @param containerHeight - Optional height of the container (defaults to Infinity).
* @returns The largest inner rectangle size that fits when rotated.
*/
export declare function getMaxInnerRectSize(rotationDeg: number, containerWidth: number, containerHeight?: number): Size;
/**
* Calculates the minimum axis-aligned outer rectangle that fully contains
* an inner rectangle of the given size when rotated by a specified angle.
*
* @param rotationDeg - Rotation angle in degrees.
* @param innerWidth - Width of the inner rectangle.
* @param innerHeight - Height of the inner rectangle (defaults to Infinity).
* @returns The smallest outer rectangle that contains the rotated inner rectangle.
*/
export declare function getMinOuterRectSize(rotationDeg: number, innerWidth: number, innerHeight?: number): Size;
export declare function rotatePoint(x: number, y: number, angle: number, // in radians
originX?: number, originY?: number): Point;

View File

@@ -0,0 +1,8 @@
import { BaseProperties } from '../../state/properties';
export declare class Padding extends BaseProperties {
top: number;
right: number;
bottom: number;
left: number;
constructor(top?: number, right?: number, bottom?: number, left?: number);
}

View File

@@ -0,0 +1,15 @@
export type Bounds = {
top?: number;
right?: number;
bottom?: number;
left?: number;
width?: number;
height?: number;
};
export type Placement = {
x: number;
y: number;
width: number;
height: number;
};
export declare function calculatePlacement(naturalWidth: number, naturalHeight: number, container: Pick<DOMRect, 'width' | 'height'>, bounds: Bounds): Placement;

View File

@@ -0,0 +1,31 @@
export type Scaling = ContinuousScaling | CategoryScaling | LogScaling;
export interface ContinuousScaling<T = 'continuous'> {
type: T;
domain: [number, number];
range: [number, number];
}
export interface LogScaling extends ContinuousScaling<'log'> {
convert(domain: number): number;
}
/** Standard category scaling with full domain array */
export interface StandardCategoryScaling {
type: 'category';
domain: readonly string[] | readonly Date[];
inset: number;
step: number;
}
/** Optimized scaling for unit-time with O(1) numeric metadata instead of full domain array */
export interface UnitTimeCategoryScaling {
type: 'category';
variant: 'unit-time';
firstBandTime: number;
lastBandTime: number;
bandCount: number;
intervalMs: number;
inset: number;
step: number;
}
export type CategoryScaling = StandardCategoryScaling | UnitTimeCategoryScaling;
export declare function isUnitTimeCategoryScaling(scaling: CategoryScaling): scaling is UnitTimeCategoryScaling;
export declare function areScalingEqual(a: Scaling | undefined, b: Scaling | undefined): boolean;
export declare function isScaleValid(scale?: Scaling): boolean;

View File

@@ -0,0 +1,118 @@
import type { Bounds4, Point } from '../../types/scene';
/**
* Add the components of the vectors `a` and `b`.
*/
export declare function add(a: Point, b: Point): Point;
export declare function add(a: Point, b: number): Point;
/**
* Subtract the components of `b` from `a`.
*/
export declare function sub(a: Point, b: Point): Point;
export declare function sub(a: Point, b: number): Point;
/**
* Multiply the components of `a` and `b`.
*/
export declare function multiply(a: Point, b: Point): Point;
export declare function multiply(a: Point, b: number): Point;
/**
* Get the length of a vector.
*/
export declare function length(a: Point): number;
/**
* Get the squared length of a vector. This method is faster than `length(a)` and is useful when making comparisons
* where the precise length does not matter.
*/
export declare function lengthSquared(a: Point): number;
/**
* Get the distance between two vectors.
*/
export declare function distance(a: Point, b: Point): number;
/**
* Get the squared distance between two vectors. This method is faster than `distance(a, b)` and is useful when making
* comparisons where the precise distance does not matter.
*/
export declare function distanceSquared(a: Point, b: Point): number;
/**
* Normalize a vector so that each component is a value between 0 and 1 and the length of the vector is always 1.
*/
export declare function normalized(a: Point): Point;
/**
* Find the angle between two vectors.
*/
export declare function angle(a: Point, b?: Point): number;
/**
* Rotate vector `a` by the angle `theta` around the origin `b`.
* This rotation is not cumulative, i.e. `rotate(rotate(a, Math.PI), Math.PI) !== a`.
*/
export declare function rotate(a: Point, theta: number, b?: Point): Point;
/**
* Get the gradient of the line that intersects two points.
* Optionally reflect the line about the y-axis when the coordinate system has y = 0 at the top.
*/
export declare function gradient(a: Point, b: Point, reflection?: number): number;
/**
* Get the y-intercept of a line through a point with a gradient where `c = y - mx`.
* Optionally reflect the line about the y-axis when the coordinate system has y = 0 at the top.
*/
export declare function intercept(a: Point, gradient: number, reflection?: number): number;
/**
* Get the point where a line intersects a horizontal line at the given y value.
* Optionally reflect the line about the y-axis when the coordinate system has y = 0 at the top.
*/
export declare function intersectAtY(gradient: number, coefficient: number, y?: number, reflection?: number): Point;
/**
* Get the point where a line intersects a vertical line at the given x value.
* Optionally reflect the line about the y-axis when the coordinate system has y = 0 at the top.
*/
export declare function intersectAtX(gradient: number, coefficient: number, x?: number, reflection?: number): Point;
/**
* Round each component of the vector.
*/
export declare function round(a: Point, decimals?: number): Point;
/**
* Check if the components of `a` and `b` are equal.
*/
export declare function equal(a: Point, b: Point): boolean;
/**
* Create a vector from an `x` and `y`.
*/
export declare function from(x: number, y: number): Point;
/**
* Create a vector from a widget event.
*/
export declare function from(event: {
currentX: number;
currentY: number;
}): Point;
/**
* Create a vector from a html element's `offsetWidth` and `offsetHeight`.
*/
export declare function from(element: {
offsetWidth: number;
offsetHeight: number;
}): Point;
/**
* Create a pair of vectors of the top left and bottom right of a bounding box.
*/
export declare function from(bbox: {
x: number;
y: number;
width: number;
height: number;
}): [Point, Point];
/**
* Create a pair of vectors from a line or box containing a pair of coordinates.
*/
export declare function from(vec4: Bounds4): [Point, Point];
/**
* Apply the components of `b` to `a` and return `a`.
*/
export declare function apply(a: Partial<Point>, b: Point): Point;
/**
* Create a vector, defaulting the components to `0` if nullish.
*/
export declare function required(a?: Partial<Point>): Point;
/**
* Create a vector at the origin point (0,0).
*/
export declare function origin(): Point;

View File

@@ -0,0 +1,62 @@
import type { Bounds4, Point } from '../../types/scene';
/**
* An interface for a vector with 4 components, considered to be a pair of vector2 coordinates. This can represent a
* line with a start and end point, or two opposite corners of a box. There is no inherent ordering of the values
* for each component, though positional functions such as `topCenter` will consider the min or max of each pair
* of `x` and `y` components.
*/
/**
* Get the vector2 at the start of a vector4.
*/
export declare function start(a: Bounds4): Point;
/**
* Get the vector2 at the end of a vector4.
*/
export declare function end(a: Bounds4): Point;
/**
* Get the vector2 at top center of a vector4.
*/
export declare function topCenter(a: Bounds4): Point;
/**
* Get the vector2 at center of a vector4.
*/
export declare function center(a: Bounds4): Point;
/**
* Get the vector2 at bottom center of a vector4.
*/
export declare function bottomCenter(a: Bounds4): Point;
/**
* Get the absolute width of a vector4.
*/
export declare function width(a: Bounds4): number;
/**
* Get the absolute height of a vector4.
*/
export declare function height(a: Bounds4): number;
/**
* Round each component of the vector4 to the nearest integer.
*/
export declare function round(a: Bounds4): Bounds4;
/**
* Clone a vector4.
*/
export declare function clone(a: Bounds4): Bounds4;
export declare function collides(a: Bounds4, b: Bounds4): boolean;
export declare function normalise(a: Bounds4): Bounds4;
/**
* Create a vector4 from an `x1`, `y1`, `x2` and `y2`.
*/
export declare function from(x1: number, y1: number, x2: number, y2: number): Bounds4;
/**
* Create a vector4 from a bounding box.
*/
export declare function from(bbox: {
x: number;
y: number;
width: number;
height: number;
}): Bounds4;
/**
* Create a vector4 at the origin point (0,0).
*/
export declare function origin(): Bounds4;

View File

@@ -0,0 +1,13 @@
import type { TextOrSegments, TextSegment, TextValue } from 'ag-charts-types';
import { type FontOptions } from '../../types/text';
export declare function toFontString({ fontSize, fontStyle, fontWeight, fontFamily }: FontOptions): string;
export declare function calcLineHeight(fontSize: number, lineHeightRatio?: number): number;
export declare function toTextString(value: TextValue | undefined): string;
export declare function appendEllipsis(text: string): string;
export declare function guardTextEdges(str: string): string;
export declare function unguardTextEdges(str: string): string;
export declare function isTruncated(value: TextOrSegments): boolean;
export declare function isTextTruncated(str: string): boolean;
export declare function isSegmentTruncated(segment: TextSegment | undefined): boolean;
export { EllipsisChar, LineSplitter, TrimEdgeGuard, TrimCharsRegex } from '../../types/text';
export type { FontOptions } from '../../types/text';

View File

@@ -0,0 +1,20 @@
import type { OverflowStrategy, TextOrSegments, TextSegment, TextWrap } from 'ag-charts-types';
import type { ITextMeasurer, MeasuredSegment } from '../../types/text';
import { type FontOptions } from './textUtils';
export interface WrapOptions {
font: FontOptions;
maxWidth: number;
maxHeight?: number;
lineHeight?: number;
textWrap?: TextWrap;
overflow?: OverflowStrategy;
avoidOrphans?: boolean;
}
export declare function wrapTextOrSegments(text: string, options: WrapOptions): string;
export declare function wrapTextOrSegments(segments: TextSegment[], options: WrapOptions): MeasuredSegment[];
export declare function wrapTextOrSegments(input: TextOrSegments, options: WrapOptions): string | MeasuredSegment[];
export declare function wrapText(text: string, options: WrapOptions): string;
export declare function wrapLines(text: string, options: WrapOptions): string[];
export declare function truncateLine(text: string, measurer: ITextMeasurer, maxWidth: number, ellipsisForce?: boolean): string;
export declare function clipLines(lines: string[], measurer: ITextMeasurer, options: WrapOptions): string[];
export declare function wrapTextSegments(textSegments: TextSegment[], options: WrapOptions): MeasuredSegment[];

Some files were not shown because too many files have changed in this diff Show More