@pyreon/charts 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,279 +1,2238 @@
1
- import { effect, signal } from "@pyreon/reactivity";
2
- import { onUnmount } from "@pyreon/core";
1
+ import { Props, VNodeChild } from "@pyreon/core";
2
+ import { EChartsOption, EChartsOption as EChartsOption$1 } from "echarts";
3
+ import { Signal } from "@pyreon/reactivity";
3
4
 
4
- //#region src/loader.ts
5
-
6
- /**
7
- * Lazily load echarts/core. Cached after first call.
5
+ //#region ../../node_modules/.bun/echarts@6.0.0/node_modules/echarts/types/dist/shared.d.ts
6
+ interface GradientObject {
7
+ id?: number;
8
+ type: string;
9
+ colorStops: GradientColorStop[];
10
+ global?: boolean;
11
+ }
12
+ interface GradientColorStop {
13
+ offset: number;
14
+ color: string;
15
+ }
16
+ interface RadialGradientObject extends GradientObject {
17
+ type: 'radial';
18
+ x: number;
19
+ y: number;
20
+ r: number;
21
+ }
22
+ interface LinearGradientObject extends GradientObject {
23
+ type: 'linear';
24
+ x: number;
25
+ y: number;
26
+ x2: number;
27
+ y2: number;
28
+ }
29
+ declare type Dictionary<T> = {
30
+ [key: string]: T;
31
+ };
32
+ declare type NullUndefined = null | undefined;
33
+ declare type ImageLike = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
34
+ declare type TextVerticalAlign = 'top' | 'middle' | 'bottom';
35
+ declare type TextAlign = 'left' | 'center' | 'right';
36
+ declare type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | number;
37
+ declare type FontStyle = 'normal' | 'italic' | 'oblique';
38
+ declare type BuiltinTextPosition = 'left' | 'right' | 'top' | 'bottom' | 'inside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideTopRight' | 'insideBottomLeft' | 'insideBottomRight';
39
+ declare type ZREventProperties = {
40
+ zrX: number;
41
+ zrY: number;
42
+ zrDelta: number;
43
+ zrEventControl: 'no_globalout' | 'only_globalout';
44
+ zrByTouch: boolean;
45
+ };
46
+ declare type ZRRawMouseEvent = MouseEvent & ZREventProperties;
47
+ declare type ZRRawTouchEvent = TouchEvent & ZREventProperties;
48
+ declare type ZRRawPointerEvent = TouchEvent & ZREventProperties;
49
+ declare type ZRRawEvent = ZRRawMouseEvent | ZRRawTouchEvent | ZRRawPointerEvent;
50
+ declare type ElementEventName = 'click' | 'dblclick' | 'mousewheel' | 'mouseout' | 'mouseover' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu' | 'drag' | 'dragstart' | 'dragend' | 'dragenter' | 'dragleave' | 'dragover' | 'drop' | 'globalout';
51
+ declare type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
52
+ declare type MapToType<T extends Dictionary<any>, S> = { [P in keyof T]: T[P] extends Dictionary<any> ? MapToType<T[P], S> : S };
53
+ declare type WithThisType<Func extends (...args: any) => any, This> = (this: This, ...args: Parameters<Func>) => ReturnType<Func>;
54
+ declare type SVGVNodeAttrs = Record<string, string | number | undefined | boolean>;
55
+ interface SVGVNode {
56
+ tag: string;
57
+ attrs: SVGVNodeAttrs;
58
+ children?: SVGVNode[];
59
+ text?: string;
60
+ elm?: Node;
61
+ key: string;
62
+ }
63
+ declare type ImagePatternRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
64
+ interface PatternObjectBase {
65
+ id?: number;
66
+ type?: 'pattern';
67
+ x?: number;
68
+ y?: number;
69
+ rotation?: number;
70
+ scaleX?: number;
71
+ scaleY?: number;
72
+ }
73
+ interface ImagePatternObject extends PatternObjectBase {
74
+ image: ImageLike | string;
75
+ repeat?: ImagePatternRepeat;
76
+ imageWidth?: number;
77
+ imageHeight?: number;
78
+ }
79
+ interface SVGPatternObject extends PatternObjectBase {
80
+ svgElement?: SVGVNode;
81
+ svgWidth?: number;
82
+ svgHeight?: number;
83
+ }
84
+ declare type PatternObject = ImagePatternObject | SVGPatternObject;
85
+ declare type EventCallbackSingleParam<EvtParam = any> = EvtParam extends any ? (params: EvtParam) => boolean | void : never;
86
+ declare type EventCallback<EvtParams = any[]> = EvtParams extends any[] ? (...args: EvtParams) => boolean | void : never;
87
+ declare type EventQuery = string | Object;
88
+ declare type CbThis<Ctx, Impl> = unknown extends Ctx ? Impl : Ctx;
89
+ declare type DefaultEventDefinition = Dictionary<EventCallback<any[]>>;
90
+ interface EventProcessor<EvtDef = DefaultEventDefinition> {
91
+ normalizeQuery?: (query: EventQuery) => EventQuery;
92
+ filter?: (eventType: keyof EvtDef, query: EventQuery) => boolean;
93
+ afterTrigger?: (eventType: keyof EvtDef) => void;
94
+ }
95
+ declare class Eventful<EvtDef extends DefaultEventDefinition = DefaultEventDefinition> {
96
+ private _$handlers;
97
+ protected _$eventProcessor: EventProcessor<EvtDef>;
98
+ constructor(eventProcessors?: EventProcessor<EvtDef>);
99
+ on<Ctx, EvtNm extends keyof EvtDef>(event: EvtNm, handler: WithThisType<EvtDef[EvtNm], CbThis<Ctx, this>>, context?: Ctx): this;
100
+ on<Ctx, EvtNm extends keyof EvtDef>(event: EvtNm, query: EventQuery, handler: WithThisType<EvtDef[EvtNm], CbThis<Ctx, this>>, context?: Ctx): this;
101
+ isSilent(eventName: keyof EvtDef): boolean;
102
+ off(eventType?: keyof EvtDef, handler?: Function): this;
103
+ trigger<EvtNm extends keyof EvtDef>(eventType: EvtNm, ...args: Parameters<EvtDef[EvtNm]>): this;
104
+ triggerWithContext(type: keyof EvtDef, ...args: any[]): this;
105
+ }
106
+ declare type VectorArray = number[];
107
+ declare type MatrixArray = number[];
108
+ interface PointLike {
109
+ x: number;
110
+ y: number;
111
+ }
112
+ declare class Point {
113
+ x: number;
114
+ y: number;
115
+ constructor(x?: number, y?: number);
116
+ copy(other: PointLike): this;
117
+ clone(): Point;
118
+ set(x: number, y: number): this;
119
+ equal(other: PointLike): boolean;
120
+ add(other: PointLike): this;
121
+ scale(scalar: number): void;
122
+ scaleAndAdd(other: PointLike, scalar: number): void;
123
+ sub(other: PointLike): this;
124
+ dot(other: PointLike): number;
125
+ len(): number;
126
+ lenSquare(): number;
127
+ normalize(): this;
128
+ distance(other: PointLike): number;
129
+ distanceSquare(other: Point): number;
130
+ negate(): this;
131
+ transform(m: MatrixArray): this;
132
+ toArray(out: number[]): number[];
133
+ fromArray(input: number[]): void;
134
+ static set(p: PointLike, x: number, y: number): void;
135
+ static copy(p: PointLike, p2: PointLike): void;
136
+ static len(p: PointLike): number;
137
+ static lenSquare(p: PointLike): number;
138
+ static dot(p0: PointLike, p1: PointLike): number;
139
+ static add(out: PointLike, p0: PointLike, p1: PointLike): void;
140
+ static sub(out: PointLike, p0: PointLike, p1: PointLike): void;
141
+ static scale(out: PointLike, p0: PointLike, scalar: number): void;
142
+ static scaleAndAdd(out: PointLike, p0: PointLike, p1: PointLike, scalar: number): void;
143
+ static lerp(out: PointLike, p0: PointLike, p1: PointLike, t: number): void;
144
+ }
145
+ declare class BoundingRect {
146
+ x: number;
147
+ y: number;
148
+ width: number;
149
+ height: number;
150
+ constructor(x: number, y: number, width: number, height: number);
151
+ static set<TTarget extends RectLike>(target: TTarget, x: number, y: number, width: number, height: number): TTarget;
152
+ union(other: BoundingRect): void;
153
+ applyTransform(m: MatrixArray): void;
154
+ calculateTransform(b: RectLike): MatrixArray;
155
+ intersect(b: RectLike, mtv?: PointLike, opt?: BoundingRectIntersectOpt): boolean;
156
+ static intersect(a: RectLike, b: RectLike, mtv?: PointLike, opt?: BoundingRectIntersectOpt): boolean;
157
+ static contain(rect: RectLike, x: number, y: number): boolean;
158
+ contain(x: number, y: number): boolean;
159
+ clone(): BoundingRect;
160
+ copy(other: RectLike): void;
161
+ plain(): RectLike;
162
+ isFinite(): boolean;
163
+ isZero(): boolean;
164
+ static create(rect: RectLike): BoundingRect;
165
+ static copy<TTarget extends RectLike>(target: TTarget, source: RectLike): TTarget;
166
+ static applyTransform(target: RectLike, source: RectLike, m: MatrixArray): void;
167
+ }
168
+ declare type RectLike = {
169
+ x: number;
170
+ y: number;
171
+ width: number;
172
+ height: number;
173
+ };
174
+ interface BoundingRectIntersectOpt {
175
+ direction?: number;
176
+ bidirectional?: boolean;
177
+ touchThreshold?: number;
178
+ outIntersectRect?: RectLike;
179
+ clamp?: boolean;
180
+ }
181
+ interface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {
182
+ dpr?: number;
183
+ }
184
+ declare class PathProxy {
185
+ dpr: number;
186
+ data: number[] | Float32Array;
187
+ private _version;
188
+ private _saveData;
189
+ private _pendingPtX;
190
+ private _pendingPtY;
191
+ private _pendingPtDist;
192
+ private _ctx;
193
+ private _xi;
194
+ private _yi;
195
+ private _x0;
196
+ private _y0;
197
+ private _len;
198
+ private _pathSegLen;
199
+ private _pathLen;
200
+ private _ux;
201
+ private _uy;
202
+ static CMD: {
203
+ M: number;
204
+ L: number;
205
+ C: number;
206
+ Q: number;
207
+ A: number;
208
+ Z: number;
209
+ R: number;
210
+ };
211
+ constructor(notSaveData?: boolean);
212
+ increaseVersion(): void;
213
+ getVersion(): number;
214
+ setScale(sx: number, sy: number, segmentIgnoreThreshold?: number): void;
215
+ setDPR(dpr: number): void;
216
+ setContext(ctx: ExtendedCanvasRenderingContext2D): void;
217
+ getContext(): ExtendedCanvasRenderingContext2D;
218
+ beginPath(): this;
219
+ reset(): void;
220
+ moveTo(x: number, y: number): this;
221
+ lineTo(x: number, y: number): this;
222
+ bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): this;
223
+ quadraticCurveTo(x1: number, y1: number, x2: number, y2: number): this;
224
+ arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise?: boolean): this;
225
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this;
226
+ rect(x: number, y: number, w: number, h: number): this;
227
+ closePath(): this;
228
+ fill(ctx: CanvasRenderingContext2D): void;
229
+ stroke(ctx: CanvasRenderingContext2D): void;
230
+ len(): number;
231
+ setData(data: Float32Array | number[]): void;
232
+ appendPath(path: PathProxy | PathProxy[]): void;
233
+ addData(cmd: number, a?: number, b?: number, c?: number, d?: number, e?: number, f?: number, g?: number, h?: number): void;
234
+ private _drawPendingPt;
235
+ private _expandData;
236
+ toStatic(): void;
237
+ getBoundingRect(): BoundingRect;
238
+ private _calculateLength;
239
+ rebuildPath(ctx: PathRebuilder, percent: number): void;
240
+ clone(): PathProxy;
241
+ canSave(): boolean;
242
+ private static initDefaultProps;
243
+ }
244
+ interface PathRebuilder {
245
+ moveTo(x: number, y: number): void;
246
+ lineTo(x: number, y: number): void;
247
+ bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number): void;
248
+ quadraticCurveTo(x: number, y: number, x2: number, y2: number): void;
249
+ arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean): void;
250
+ ellipse(cx: number, cy: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise: boolean): void;
251
+ rect(x: number, y: number, width: number, height: number): void;
252
+ closePath(): void;
253
+ }
254
+ declare type easingFunc = (percent: number) => number;
255
+ declare type AnimationEasing = keyof typeof easingFuncs | easingFunc;
256
+ declare const easingFuncs: {
257
+ linear(k: number): number;
258
+ quadraticIn(k: number): number;
259
+ quadraticOut(k: number): number;
260
+ quadraticInOut(k: number): number;
261
+ cubicIn(k: number): number;
262
+ cubicOut(k: number): number;
263
+ cubicInOut(k: number): number;
264
+ quarticIn(k: number): number;
265
+ quarticOut(k: number): number;
266
+ quarticInOut(k: number): number;
267
+ quinticIn(k: number): number;
268
+ quinticOut(k: number): number;
269
+ quinticInOut(k: number): number;
270
+ sinusoidalIn(k: number): number;
271
+ sinusoidalOut(k: number): number;
272
+ sinusoidalInOut(k: number): number;
273
+ exponentialIn(k: number): number;
274
+ exponentialOut(k: number): number;
275
+ exponentialInOut(k: number): number;
276
+ circularIn(k: number): number;
277
+ circularOut(k: number): number;
278
+ circularInOut(k: number): number;
279
+ elasticIn(k: number): number;
280
+ elasticOut(k: number): number;
281
+ elasticInOut(k: number): number;
282
+ backIn(k: number): number;
283
+ backOut(k: number): number;
284
+ backInOut(k: number): number;
285
+ bounceIn(k: number): number;
286
+ bounceOut(k: number): number;
287
+ bounceInOut(k: number): number;
288
+ };
289
+ interface Stage {
290
+ update?: () => void;
291
+ }
292
+ interface AnimationOption {
293
+ stage?: Stage;
294
+ }
295
+ declare class Animation extends Eventful {
296
+ stage: Stage;
297
+ private _head;
298
+ private _tail;
299
+ private _running;
300
+ private _time;
301
+ private _pausedTime;
302
+ private _pauseStart;
303
+ private _paused;
304
+ constructor(opts?: AnimationOption);
305
+ addClip(clip: Clip): void;
306
+ addAnimator(animator: Animator<any>): void;
307
+ removeClip(clip: Clip): void;
308
+ removeAnimator(animator: Animator<any>): void;
309
+ update(notTriggerFrameAndStageUpdate?: boolean): void;
310
+ _startLoop(): void;
311
+ start(): void;
312
+ stop(): void;
313
+ pause(): void;
314
+ resume(): void;
315
+ clear(): void;
316
+ isFinished(): boolean;
317
+ animate<T>(target: T, options: {
318
+ loop?: boolean;
319
+ }): Animator<T>;
320
+ }
321
+ declare type OnframeCallback = (percent: number) => void;
322
+ declare type ondestroyCallback = () => void;
323
+ declare type onrestartCallback = () => void;
324
+ interface ClipProps {
325
+ life?: number;
326
+ delay?: number;
327
+ loop?: boolean;
328
+ easing?: AnimationEasing;
329
+ onframe?: OnframeCallback;
330
+ ondestroy?: ondestroyCallback;
331
+ onrestart?: onrestartCallback;
332
+ }
333
+ declare class Clip {
334
+ private _life;
335
+ private _delay;
336
+ private _inited;
337
+ private _startTime;
338
+ private _pausedTime;
339
+ private _paused;
340
+ animation: Animation;
341
+ loop: boolean;
342
+ easing: AnimationEasing;
343
+ easingFunc: (p: number) => number;
344
+ next: Clip;
345
+ prev: Clip;
346
+ onframe: OnframeCallback;
347
+ ondestroy: ondestroyCallback;
348
+ onrestart: onrestartCallback;
349
+ constructor(opts: ClipProps);
350
+ step(globalTime: number, deltaTime: number): boolean;
351
+ pause(): void;
352
+ resume(): void;
353
+ setEasing(easing: AnimationEasing): void;
354
+ }
355
+ declare type ValueType = 0 | 1 | 2 | 3 | 4 | 5 | 6;
356
+ declare type Keyframe = {
357
+ time: number;
358
+ value: unknown;
359
+ percent: number;
360
+ rawValue: unknown;
361
+ easing?: AnimationEasing;
362
+ easingFunc?: (percent: number) => number;
363
+ additiveValue?: unknown;
364
+ };
365
+ declare class Track {
366
+ keyframes: Keyframe[];
367
+ propName: string;
368
+ valType: ValueType;
369
+ discrete: boolean;
370
+ _invalid: boolean;
371
+ private _finished;
372
+ private _needsSort;
373
+ private _additiveTrack;
374
+ private _additiveValue;
375
+ private _lastFr;
376
+ private _lastFrP;
377
+ constructor(propName: string);
378
+ isFinished(): boolean;
379
+ setFinished(): void;
380
+ needsAnimate(): boolean;
381
+ getAdditiveTrack(): Track;
382
+ addKeyframe(time: number, rawValue: unknown, easing?: AnimationEasing): Keyframe;
383
+ prepare(maxTime: number, additiveTrack?: Track): void;
384
+ step(target: any, percent: number): void;
385
+ private _addToTarget;
386
+ }
387
+ declare type DoneCallback = () => void;
388
+ declare type AbortCallback = () => void;
389
+ declare type OnframeCallback$1<T> = (target: T, percent: number) => void;
390
+ declare class Animator<T> {
391
+ animation?: Animation;
392
+ targetName?: string;
393
+ scope?: string;
394
+ __fromStateTransition?: string;
395
+ private _tracks;
396
+ private _trackKeys;
397
+ private _target;
398
+ private _loop;
399
+ private _delay;
400
+ private _maxTime;
401
+ private _force;
402
+ private _paused;
403
+ private _started;
404
+ private _allowDiscrete;
405
+ private _additiveAnimators;
406
+ private _doneCbs;
407
+ private _onframeCbs;
408
+ private _abortedCbs;
409
+ private _clip;
410
+ constructor(target: T, loop: boolean, allowDiscreteAnimation?: boolean, additiveTo?: Animator<any>[]);
411
+ getMaxTime(): number;
412
+ getDelay(): number;
413
+ getLoop(): boolean;
414
+ getTarget(): T;
415
+ changeTarget(target: T): void;
416
+ when(time: number, props: Dictionary<any>, easing?: AnimationEasing): this;
417
+ whenWithKeys(time: number, props: Dictionary<any>, propNames: string[], easing?: AnimationEasing): this;
418
+ pause(): void;
419
+ resume(): void;
420
+ isPaused(): boolean;
421
+ duration(duration: number): this;
422
+ private _doneCallback;
423
+ private _abortedCallback;
424
+ private _setTracksFinished;
425
+ private _getAdditiveTrack;
426
+ start(easing?: AnimationEasing): this;
427
+ stop(forwardToLast?: boolean): void;
428
+ delay(time: number): this;
429
+ during(cb: OnframeCallback$1<T>): this;
430
+ done(cb: DoneCallback): this;
431
+ aborted(cb: AbortCallback): this;
432
+ getClip(): Clip;
433
+ getTrack(propName: string): Track;
434
+ getTracks(): Track[];
435
+ stopTracks(propNames: string[], forwardToLast?: boolean): boolean;
436
+ saveTo(target: T, trackKeys?: readonly string[], firstOrLast?: boolean): void;
437
+ __changeFinalValue(finalProps: Dictionary<any>, trackKeys?: readonly string[]): void;
438
+ }
439
+ interface PathStyleProps extends CommonStyleProps {
440
+ fill?: string | PatternObject | LinearGradientObject | RadialGradientObject;
441
+ stroke?: string | PatternObject | LinearGradientObject | RadialGradientObject;
442
+ decal?: PatternObject;
443
+ strokePercent?: number;
444
+ strokeNoScale?: boolean;
445
+ fillOpacity?: number;
446
+ strokeOpacity?: number;
447
+ lineDash?: false | number[] | 'solid' | 'dashed' | 'dotted';
448
+ lineDashOffset?: number;
449
+ lineWidth?: number;
450
+ lineCap?: CanvasLineCap;
451
+ lineJoin?: CanvasLineJoin;
452
+ miterLimit?: number;
453
+ strokeFirst?: boolean;
454
+ }
455
+ interface PathProps extends DisplayableProps {
456
+ strokeContainThreshold?: number;
457
+ segmentIgnoreThreshold?: number;
458
+ subPixelOptimize?: boolean;
459
+ style?: PathStyleProps;
460
+ shape?: Dictionary<any>;
461
+ autoBatch?: boolean;
462
+ __value?: (string | number)[] | (string | number);
463
+ buildPath?: (ctx: PathProxy | CanvasRenderingContext2D, shapeCfg: Dictionary<any>, inBatch?: boolean) => void;
464
+ }
465
+ declare type PathKey = keyof PathProps;
466
+ declare type PathPropertyType = PropType<PathProps, PathKey>;
467
+ declare type PathStatePropNames = DisplayableStatePropNames | 'shape';
468
+ declare type PathState = Pick<PathProps, PathStatePropNames> & {
469
+ hoverLayer?: boolean;
470
+ };
471
+ interface Path<Props extends PathProps = PathProps> {
472
+ animate(key?: '', loop?: boolean): Animator<this>;
473
+ animate(key: 'style', loop?: boolean): Animator<this['style']>;
474
+ animate(key: 'shape', loop?: boolean): Animator<this['shape']>;
475
+ getState(stateName: string): PathState;
476
+ ensureState(stateName: string): PathState;
477
+ states: Dictionary<PathState>;
478
+ stateProxy: (stateName: string) => PathState;
479
+ }
480
+ declare class Path<Props extends PathProps = PathProps> extends Displayable<Props> {
481
+ path: PathProxy;
482
+ strokeContainThreshold: number;
483
+ segmentIgnoreThreshold: number;
484
+ subPixelOptimize: boolean;
485
+ style: PathStyleProps;
486
+ autoBatch: boolean;
487
+ private _rectStroke;
488
+ protected _normalState: PathState;
489
+ protected _decalEl: Path;
490
+ shape: Dictionary<any>;
491
+ constructor(opts?: Props);
492
+ update(): void;
493
+ getDecalElement(): Path<PathProps>;
494
+ protected _init(props?: Props): void;
495
+ protected getDefaultStyle(): Props['style'];
496
+ protected getDefaultShape(): {};
497
+ protected canBeInsideText(): boolean;
498
+ protected getInsideTextFill(): "#333" | "#ccc" | "#eee";
499
+ protected getInsideTextStroke(textFill?: string): string;
500
+ buildPath(ctx: PathProxy | CanvasRenderingContext2D, shapeCfg: Dictionary<any>, inBatch?: boolean): void;
501
+ pathUpdated(): void;
502
+ getUpdatedPathProxy(inBatch?: boolean): PathProxy;
503
+ createPathProxy(): void;
504
+ hasStroke(): boolean;
505
+ hasFill(): boolean;
506
+ getBoundingRect(): BoundingRect;
507
+ contain(x: number, y: number): boolean;
508
+ dirtyShape(): void;
509
+ dirty(): void;
510
+ animateShape(loop: boolean): Animator<this["shape"]>;
511
+ updateDuringAnimation(targetKey: string): void;
512
+ attrKV(key: PathKey, value: PathPropertyType): void;
513
+ setShape(obj: Props['shape']): this;
514
+ setShape<T extends keyof Props['shape']>(obj: T, value: Props['shape'][T]): this;
515
+ shapeChanged(): boolean;
516
+ createStyle(obj?: Props['style']): Props["style"];
517
+ protected _innerSaveToNormal(toState: PathState): void;
518
+ protected _applyStateObj(stateName: string, state: PathState, normalState: PathState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void;
519
+ protected _mergeStates(states: PathState[]): PathState;
520
+ getAnimationStyleProps(): MapToType<PathProps, boolean>;
521
+ isZeroArea(): boolean;
522
+ static extend<Shape extends Dictionary<any>>(defaultProps: {
523
+ type?: string;
524
+ shape?: Shape;
525
+ style?: PathStyleProps;
526
+ beforeBrush?: Displayable['beforeBrush'];
527
+ afterBrush?: Displayable['afterBrush'];
528
+ getBoundingRect?: Displayable['getBoundingRect'];
529
+ calculateTextPosition?: Element$1['calculateTextPosition'];
530
+ buildPath(this: Path, ctx: CanvasRenderingContext2D | PathProxy, shape: Shape, inBatch?: boolean): void;
531
+ init?(this: Path, opts: PathProps): void;
532
+ }): {
533
+ new (opts?: PathProps & {
534
+ shape: Shape;
535
+ }): Path;
536
+ };
537
+ protected static initDefaultProps: void;
538
+ }
539
+ declare class Transformable {
540
+ parent: Transformable;
541
+ x: number;
542
+ y: number;
543
+ scaleX: number;
544
+ scaleY: number;
545
+ skewX: number;
546
+ skewY: number;
547
+ rotation: number;
548
+ anchorX: number;
549
+ anchorY: number;
550
+ originX: number;
551
+ originY: number;
552
+ globalScaleRatio: number;
553
+ transform: MatrixArray;
554
+ invTransform: MatrixArray;
555
+ getLocalTransform(m?: MatrixArray): MatrixArray;
556
+ setPosition(arr: number[]): void;
557
+ setScale(arr: number[]): void;
558
+ setSkew(arr: number[]): void;
559
+ setOrigin(arr: number[]): void;
560
+ needLocalTransform(): boolean;
561
+ updateTransform(): void;
562
+ private _resolveGlobalScaleRatio;
563
+ getComputedTransform(): MatrixArray;
564
+ setLocalTransform(m: VectorArray): void;
565
+ decomposeTransform(): void;
566
+ getGlobalScale(out?: VectorArray): VectorArray;
567
+ transformCoordToLocal(x: number, y: number): number[];
568
+ transformCoordToGlobal(x: number, y: number): number[];
569
+ getLineScale(): number;
570
+ copyTransform(source: Transformable): void;
571
+ static getLocalTransform(target: Transformable, m?: MatrixArray): MatrixArray;
572
+ private static initDefaultProps;
573
+ }
574
+ declare const TRANSFORMABLE_PROPS: readonly ["x", "y", "originX", "originY", "anchorX", "anchorY", "rotation", "scaleX", "scaleY", "skewX", "skewY"];
575
+ declare type TransformProp = (typeof TRANSFORMABLE_PROPS)[number];
576
+ interface TSpanStyleProps extends PathStyleProps {
577
+ x?: number;
578
+ y?: number;
579
+ text?: string;
580
+ font?: string;
581
+ fontSize?: number;
582
+ fontWeight?: FontWeight;
583
+ fontStyle?: FontStyle;
584
+ fontFamily?: string;
585
+ textAlign?: CanvasTextAlign;
586
+ textBaseline?: CanvasTextBaseline;
587
+ }
588
+ interface TSpanProps extends DisplayableProps {
589
+ style?: TSpanStyleProps;
590
+ }
591
+ declare class TSpan extends Displayable<TSpanProps> {
592
+ style: TSpanStyleProps;
593
+ hasStroke(): boolean;
594
+ hasFill(): boolean;
595
+ createStyle(obj?: TSpanStyleProps): TSpanStyleProps;
596
+ setBoundingRect(rect: BoundingRect): void;
597
+ getBoundingRect(): BoundingRect;
598
+ protected static initDefaultProps: void;
599
+ }
600
+ interface ImageStyleProps extends CommonStyleProps {
601
+ image?: string | ImageLike;
602
+ x?: number;
603
+ y?: number;
604
+ width?: number;
605
+ height?: number;
606
+ sx?: number;
607
+ sy?: number;
608
+ sWidth?: number;
609
+ sHeight?: number;
610
+ }
611
+ interface ImageProps extends DisplayableProps {
612
+ style?: ImageStyleProps;
613
+ onload?: (image: ImageLike) => void;
614
+ }
615
+ declare class ZRImage extends Displayable<ImageProps> {
616
+ style: ImageStyleProps;
617
+ __image: ImageLike;
618
+ __imageSrc: string;
619
+ onload: (image: ImageLike) => void;
620
+ createStyle(obj?: ImageStyleProps): ImageStyleProps;
621
+ private _getSize;
622
+ getWidth(): number;
623
+ getHeight(): number;
624
+ getAnimationStyleProps(): MapToType<ImageProps, boolean>;
625
+ getBoundingRect(): BoundingRect;
626
+ }
627
+ declare class RectShape {
628
+ r?: number | number[];
629
+ x: number;
630
+ y: number;
631
+ width: number;
632
+ height: number;
633
+ }
634
+ interface RectProps extends PathProps {
635
+ shape?: Partial<RectShape>;
636
+ }
637
+ declare class Rect extends Path<RectProps> {
638
+ shape: RectShape;
639
+ constructor(opts?: RectProps);
640
+ getDefaultShape(): RectShape;
641
+ buildPath(ctx: CanvasRenderingContext2D, shape: RectShape): void;
642
+ isZeroArea(): boolean;
643
+ }
644
+ interface GroupProps extends ElementProps {}
645
+ declare class Group extends Element$1<GroupProps> {
646
+ readonly isGroup = true;
647
+ private _children;
648
+ constructor(opts?: GroupProps);
649
+ childrenRef(): Element$1<ElementProps>[];
650
+ children(): Element$1<ElementProps>[];
651
+ childAt(idx: number): Element$1;
652
+ childOfName(name: string): Element$1;
653
+ childCount(): number;
654
+ add(child: Element$1): Group;
655
+ addBefore(child: Element$1, nextSibling: Element$1): this;
656
+ replace(oldChild: Element$1, newChild: Element$1): this;
657
+ replaceAt(child: Element$1, index: number): this;
658
+ _doAdd(child: Element$1): void;
659
+ remove(child: Element$1): this;
660
+ removeAll(): this;
661
+ eachChild<Context>(cb: (this: Context, el: Element$1, index?: number) => void, context?: Context): this;
662
+ traverse<T>(cb: (this: T, el: Element$1) => boolean | void, context?: T): this;
663
+ addSelfToZr(zr: ZRenderType): void;
664
+ removeSelfFromZr(zr: ZRenderType): void;
665
+ getBoundingRect(includeChildren?: Element$1[]): BoundingRect;
666
+ }
667
+ interface GroupLike extends Element$1 {
668
+ childrenRef(): Element$1[];
669
+ }
670
+ interface TextStylePropsPart {
671
+ text?: string;
672
+ fill?: string;
673
+ stroke?: string;
674
+ strokeNoScale?: boolean;
675
+ opacity?: number;
676
+ fillOpacity?: number;
677
+ strokeOpacity?: number;
678
+ lineWidth?: number;
679
+ lineDash?: false | number[];
680
+ lineDashOffset?: number;
681
+ borderDash?: false | number[];
682
+ borderDashOffset?: number;
683
+ font?: string;
684
+ textFont?: string;
685
+ fontStyle?: FontStyle;
686
+ fontWeight?: FontWeight;
687
+ fontFamily?: string;
688
+ fontSize?: number | string;
689
+ align?: TextAlign;
690
+ verticalAlign?: TextVerticalAlign;
691
+ lineHeight?: number;
692
+ width?: number | string;
693
+ height?: number;
694
+ tag?: string;
695
+ textShadowColor?: string;
696
+ textShadowBlur?: number;
697
+ textShadowOffsetX?: number;
698
+ textShadowOffsetY?: number;
699
+ backgroundColor?: string | {
700
+ image: ImageLike | string;
701
+ };
702
+ padding?: number | number[];
703
+ margin?: number | number[];
704
+ borderColor?: string;
705
+ borderWidth?: number;
706
+ borderRadius?: number | number[];
707
+ shadowColor?: string;
708
+ shadowBlur?: number;
709
+ shadowOffsetX?: number;
710
+ shadowOffsetY?: number;
711
+ }
712
+ interface TextStyleProps extends TextStylePropsPart {
713
+ text?: string;
714
+ x?: number;
715
+ y?: number;
716
+ width?: number;
717
+ rich?: Dictionary<TextStylePropsPart>;
718
+ overflow?: 'break' | 'breakAll' | 'truncate' | 'none';
719
+ lineOverflow?: 'truncate';
720
+ ellipsis?: string;
721
+ placeholder?: string;
722
+ truncateMinChar?: number;
723
+ }
724
+ interface TextProps extends DisplayableProps {
725
+ style?: TextStyleProps;
726
+ zlevel?: number;
727
+ z?: number;
728
+ z2?: number;
729
+ culling?: boolean;
730
+ cursor?: string;
731
+ }
732
+ declare type TextState = Pick<TextProps, DisplayableStatePropNames> & ElementCommonState;
733
+ declare type DefaultTextStyle = Pick<TextStyleProps, 'fill' | 'stroke' | 'align' | 'verticalAlign'> & {
734
+ autoStroke?: boolean;
735
+ overflowRect?: BoundingRect | NullUndefined;
736
+ };
737
+ interface ZRText {
738
+ animate(key?: '', loop?: boolean): Animator<this>;
739
+ animate(key: 'style', loop?: boolean): Animator<this['style']>;
740
+ getState(stateName: string): TextState;
741
+ ensureState(stateName: string): TextState;
742
+ states: Dictionary<TextState>;
743
+ stateProxy: (stateName: string) => TextState;
744
+ }
745
+ declare class ZRText extends Displayable<TextProps> implements GroupLike {
746
+ type: string;
747
+ style: TextStyleProps;
748
+ overlap: 'hidden' | 'show' | 'blur';
749
+ innerTransformable: Transformable;
750
+ isTruncated: boolean;
751
+ private _children;
752
+ private _childCursor;
753
+ private _defaultStyle;
754
+ constructor(opts?: TextProps);
755
+ childrenRef(): (ZRImage | Rect | TSpan)[];
756
+ update(): void;
757
+ updateTransform(): void;
758
+ getLocalTransform(m?: MatrixArray): MatrixArray;
759
+ getComputedTransform(): MatrixArray;
760
+ private _updateSubTexts;
761
+ addSelfToZr(zr: ZRenderType): void;
762
+ removeSelfFromZr(zr: ZRenderType): void;
763
+ getBoundingRect(): BoundingRect;
764
+ setDefaultTextStyle(defaultTextStyle: DefaultTextStyle): void;
765
+ setTextContent(textContent: never): void;
766
+ protected _mergeStyle(targetStyle: TextStyleProps, sourceStyle: TextStyleProps): TextStyleProps;
767
+ private _mergeRich;
768
+ getAnimationStyleProps(): MapToType<TextProps, boolean>;
769
+ private _getOrCreateChild;
770
+ private _updatePlainTexts;
771
+ private _updateRichTexts;
772
+ private _placeToken;
773
+ private _renderBackground;
774
+ static makeFont(style: TextStylePropsPart): string;
775
+ }
776
+ interface TextPositionCalculationResult {
777
+ x: number;
778
+ y: number;
779
+ align: TextAlign;
780
+ verticalAlign: TextVerticalAlign;
781
+ }
782
+ declare class PolylineShape {
783
+ points: VectorArray[];
784
+ percent?: number;
785
+ smooth?: number;
786
+ smoothConstraint?: VectorArray[];
787
+ }
788
+ interface PolylineProps extends PathProps {
789
+ shape?: Partial<PolylineShape>;
790
+ }
791
+ declare class Polyline extends Path<PolylineProps> {
792
+ shape: PolylineShape;
793
+ constructor(opts?: PolylineProps);
794
+ getDefaultStyle(): {
795
+ stroke: string;
796
+ fill: string;
797
+ };
798
+ getDefaultShape(): PolylineShape;
799
+ buildPath(ctx: CanvasRenderingContext2D, shape: PolylineShape): void;
800
+ }
801
+ interface ElementAnimateConfig {
802
+ duration?: number;
803
+ delay?: number;
804
+ easing?: AnimationEasing;
805
+ during?: (percent: number) => void;
806
+ done?: Function;
807
+ aborted?: Function;
808
+ scope?: string;
809
+ force?: boolean;
810
+ additive?: boolean;
811
+ setToFinal?: boolean;
812
+ }
813
+ interface ElementTextConfig {
814
+ position?: BuiltinTextPosition | (number | string)[];
815
+ rotation?: number;
816
+ layoutRect?: RectLike;
817
+ offset?: number[];
818
+ origin?: (number | string)[] | 'center';
819
+ distance?: number;
820
+ local?: boolean;
821
+ insideFill?: string;
822
+ insideStroke?: string;
823
+ outsideFill?: string;
824
+ outsideStroke?: string;
825
+ inside?: boolean;
826
+ autoOverflowArea?: boolean;
827
+ }
828
+ interface ElementTextGuideLineConfig {
829
+ anchor?: Point;
830
+ showAbove?: boolean;
831
+ candidates?: ('left' | 'top' | 'right' | 'bottom')[];
832
+ }
833
+ interface ElementEvent {
834
+ type: ElementEventName;
835
+ event: ZRRawEvent;
836
+ target: Element$1;
837
+ topTarget: Element$1;
838
+ cancelBubble: boolean;
839
+ offsetX: number;
840
+ offsetY: number;
841
+ gestureEvent: string;
842
+ pinchX: number;
843
+ pinchY: number;
844
+ pinchScale: number;
845
+ wheelDelta: number;
846
+ zrByTouch: boolean;
847
+ which: number;
848
+ stop: (this: ElementEvent) => void;
849
+ }
850
+ declare type ElementEventCallback<Ctx, Impl> = (this: CbThis$1<Ctx, Impl>, e: ElementEvent) => boolean | void;
851
+ declare type CbThis$1<Ctx, Impl> = unknown extends Ctx ? Impl : Ctx;
852
+ interface ElementEventHandlerProps {
853
+ onclick: ElementEventCallback<unknown, unknown>;
854
+ ondblclick: ElementEventCallback<unknown, unknown>;
855
+ onmouseover: ElementEventCallback<unknown, unknown>;
856
+ onmouseout: ElementEventCallback<unknown, unknown>;
857
+ onmousemove: ElementEventCallback<unknown, unknown>;
858
+ onmousewheel: ElementEventCallback<unknown, unknown>;
859
+ onmousedown: ElementEventCallback<unknown, unknown>;
860
+ onmouseup: ElementEventCallback<unknown, unknown>;
861
+ oncontextmenu: ElementEventCallback<unknown, unknown>;
862
+ ondrag: ElementEventCallback<unknown, unknown>;
863
+ ondragstart: ElementEventCallback<unknown, unknown>;
864
+ ondragend: ElementEventCallback<unknown, unknown>;
865
+ ondragenter: ElementEventCallback<unknown, unknown>;
866
+ ondragleave: ElementEventCallback<unknown, unknown>;
867
+ ondragover: ElementEventCallback<unknown, unknown>;
868
+ ondrop: ElementEventCallback<unknown, unknown>;
869
+ }
870
+ interface ElementProps extends Partial<ElementEventHandlerProps>, Partial<Pick<Transformable, TransformProp>> {
871
+ name?: string;
872
+ ignore?: boolean;
873
+ isGroup?: boolean;
874
+ draggable?: boolean | 'horizontal' | 'vertical';
875
+ silent?: boolean;
876
+ ignoreHostSilent?: boolean;
877
+ ignoreClip?: boolean;
878
+ globalScaleRatio?: number;
879
+ textConfig?: ElementTextConfig;
880
+ textContent?: ZRText;
881
+ clipPath?: Path;
882
+ drift?: Element$1['drift'];
883
+ extra?: Dictionary<unknown>;
884
+ anid?: string;
885
+ }
886
+ declare const PRIMARY_STATES_KEYS: ["x" | "y" | "originX" | "originY" | "anchorX" | "anchorY" | "rotation" | "scaleX" | "scaleY" | "skewX" | "skewY", "ignore"];
887
+ declare type ElementStatePropNames = (typeof PRIMARY_STATES_KEYS)[number] | 'textConfig';
888
+ declare type ElementState = Pick<ElementProps, ElementStatePropNames> & ElementCommonState;
889
+ declare type ElementCommonState = {
890
+ hoverLayer?: boolean;
891
+ };
892
+ declare type ElementCalculateTextPosition = (out: TextPositionCalculationResult, style: ElementTextConfig, rect: RectLike) => TextPositionCalculationResult;
893
+ interface Element$1<Props extends ElementProps = ElementProps> extends Transformable, Eventful<{ [key in ElementEventName]: (e: ElementEvent) => void | boolean } & { [key in string]: (...args: any) => void | boolean }>, ElementEventHandlerProps {}
894
+ declare class Element$1<Props extends ElementProps = ElementProps> {
895
+ id: number;
896
+ type: string;
897
+ name: string;
898
+ ignore: boolean;
899
+ silent: boolean;
900
+ ignoreHostSilent: boolean;
901
+ isGroup: boolean;
902
+ draggable: boolean | 'horizontal' | 'vertical';
903
+ dragging: boolean;
904
+ parent: Group;
905
+ animators: Animator<any>[];
906
+ ignoreClip: boolean;
907
+ __hostTarget: Element$1;
908
+ __zr: ZRenderType;
909
+ __dirty: number;
910
+ __isRendered: boolean;
911
+ __inHover: boolean;
912
+ __clipPaths?: Path[];
913
+ private _clipPath?;
914
+ private _textContent?;
915
+ private _textGuide?;
916
+ textConfig?: ElementTextConfig;
917
+ textGuideLineConfig?: ElementTextGuideLineConfig;
918
+ anid: string;
919
+ extra: Dictionary<unknown>;
920
+ currentStates?: string[];
921
+ prevStates?: string[];
922
+ states: Dictionary<ElementState>;
923
+ stateTransition: ElementAnimateConfig;
924
+ stateProxy?: (stateName: string, targetStates?: string[]) => ElementState;
925
+ protected _normalState: ElementState;
926
+ private _innerTextDefaultStyle;
927
+ constructor(props?: Props);
928
+ protected _init(props?: Props): void;
929
+ drift(dx: number, dy: number, e?: ElementEvent): void;
930
+ beforeUpdate(): void;
931
+ afterUpdate(): void;
932
+ update(): void;
933
+ updateInnerText(forceUpdate?: boolean): void;
934
+ protected canBeInsideText(): boolean;
935
+ protected getInsideTextFill(): string | undefined;
936
+ protected getInsideTextStroke(textFill: string): string | undefined;
937
+ protected getOutsideFill(): string | undefined;
938
+ protected getOutsideStroke(textFill: string): string;
939
+ traverse<Context>(cb: (this: Context, el: Element$1<Props>) => void, context?: Context): void;
940
+ protected attrKV(key: string, value: unknown): void;
941
+ hide(): void;
942
+ show(): void;
943
+ attr(keyOrObj: Props): this;
944
+ attr<T extends keyof Props>(keyOrObj: T, value: Props[T]): this;
945
+ saveCurrentToNormalState(toState: ElementState): void;
946
+ protected _innerSaveToNormal(toState: ElementState): void;
947
+ protected _savePrimaryToNormal(toState: Dictionary<any>, normalState: Dictionary<any>, primaryKeys: readonly string[]): void;
948
+ hasState(): boolean;
949
+ getState(name: string): ElementState;
950
+ ensureState(name: string): ElementState;
951
+ clearStates(noAnimation?: boolean): void;
952
+ useState(stateName: string, keepCurrentStates?: boolean, noAnimation?: boolean, forceUseHoverLayer?: boolean): ElementState;
953
+ useStates(states: string[], noAnimation?: boolean, forceUseHoverLayer?: boolean): void;
954
+ isSilent(): boolean;
955
+ private _updateAnimationTargets;
956
+ removeState(state: string): void;
957
+ replaceState(oldState: string, newState: string, forceAdd: boolean): void;
958
+ toggleState(state: string, enable: boolean): void;
959
+ protected _mergeStates(states: ElementState[]): ElementState;
960
+ protected _applyStateObj(stateName: string, state: ElementState, normalState: ElementState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void;
961
+ private _attachComponent;
962
+ private _detachComponent;
963
+ getClipPath(): Path<PathProps>;
964
+ setClipPath(clipPath: Path): void;
965
+ removeClipPath(): void;
966
+ getTextContent(): ZRText;
967
+ setTextContent(textEl: ZRText): void;
968
+ setTextConfig(cfg: ElementTextConfig): void;
969
+ removeTextConfig(): void;
970
+ removeTextContent(): void;
971
+ getTextGuideLine(): Polyline;
972
+ setTextGuideLine(guideLine: Polyline): void;
973
+ removeTextGuideLine(): void;
974
+ markRedraw(): void;
975
+ dirty(): void;
976
+ private _toggleHoverLayerFlag;
977
+ addSelfToZr(zr: ZRenderType): void;
978
+ removeSelfFromZr(zr: ZRenderType): void;
979
+ animate(key?: string, loop?: boolean, allowDiscreteAnimation?: boolean): Animator<any>;
980
+ addAnimator(animator: Animator<any>, key: string): void;
981
+ updateDuringAnimation(key: string): void;
982
+ stopAnimation(scope?: string, forwardToLast?: boolean): this;
983
+ animateTo(target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType<Props, boolean>): void;
984
+ animateFrom(target: Props, cfg: ElementAnimateConfig, animationProps?: MapToType<Props, boolean>): void;
985
+ protected _transitionState(stateName: string, target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType<Props, boolean>): void;
986
+ getBoundingRect(): BoundingRect;
987
+ getPaintRect(): BoundingRect;
988
+ calculateTextPosition: ElementCalculateTextPosition;
989
+ protected static initDefaultProps: void;
990
+ }
991
+ interface CommonStyleProps {
992
+ shadowBlur?: number;
993
+ shadowOffsetX?: number;
994
+ shadowOffsetY?: number;
995
+ shadowColor?: string;
996
+ opacity?: number;
997
+ blend?: string;
998
+ }
999
+ interface DisplayableProps extends ElementProps {
1000
+ style?: Dictionary<any>;
1001
+ zlevel?: number;
1002
+ z?: number;
1003
+ z2?: number;
1004
+ culling?: boolean;
1005
+ cursor?: string;
1006
+ rectHover?: boolean;
1007
+ progressive?: boolean;
1008
+ incremental?: boolean;
1009
+ ignoreCoarsePointer?: boolean;
1010
+ batch?: boolean;
1011
+ invisible?: boolean;
1012
+ }
1013
+ declare type DisplayableKey = keyof DisplayableProps;
1014
+ declare type DisplayablePropertyType = PropType<DisplayableProps, DisplayableKey>;
1015
+ declare type DisplayableStatePropNames = ElementStatePropNames | 'style' | 'z' | 'z2' | 'invisible';
1016
+ declare type DisplayableState = Pick<DisplayableProps, DisplayableStatePropNames> & ElementCommonState;
1017
+ interface Displayable<Props extends DisplayableProps = DisplayableProps> {
1018
+ animate(key?: '', loop?: boolean): Animator<this>;
1019
+ animate(key: 'style', loop?: boolean): Animator<this['style']>;
1020
+ getState(stateName: string): DisplayableState;
1021
+ ensureState(stateName: string): DisplayableState;
1022
+ states: Dictionary<DisplayableState>;
1023
+ stateProxy: (stateName: string) => DisplayableState;
1024
+ }
1025
+ declare class Displayable<Props extends DisplayableProps = DisplayableProps> extends Element$1<Props> {
1026
+ invisible: boolean;
1027
+ z: number;
1028
+ z2: number;
1029
+ zlevel: number;
1030
+ culling: boolean;
1031
+ cursor: string;
1032
+ rectHover: boolean;
1033
+ incremental: boolean;
1034
+ ignoreCoarsePointer?: boolean;
1035
+ style: Dictionary<any>;
1036
+ protected _normalState: DisplayableState;
1037
+ protected _rect: BoundingRect;
1038
+ protected _paintRect: BoundingRect;
1039
+ protected _prevPaintRect: BoundingRect;
1040
+ dirtyRectTolerance: number;
1041
+ useHoverLayer?: boolean;
1042
+ __hoverStyle?: CommonStyleProps;
1043
+ __clipPaths?: Path[];
1044
+ __canvasFillGradient: CanvasGradient;
1045
+ __canvasStrokeGradient: CanvasGradient;
1046
+ __canvasFillPattern: CanvasPattern;
1047
+ __canvasStrokePattern: CanvasPattern;
1048
+ __svgEl: SVGElement;
1049
+ constructor(props?: Props);
1050
+ protected _init(props?: Props): void;
1051
+ beforeBrush(): void;
1052
+ afterBrush(): void;
1053
+ innerBeforeBrush(): void;
1054
+ innerAfterBrush(): void;
1055
+ shouldBePainted(viewWidth: number, viewHeight: number, considerClipPath: boolean, considerAncestors: boolean): boolean;
1056
+ contain(x: number, y: number): boolean;
1057
+ traverse<Context>(cb: (this: Context, el: this) => void, context?: Context): void;
1058
+ rectContain(x: number, y: number): boolean;
1059
+ getPaintRect(): BoundingRect;
1060
+ setPrevPaintRect(paintRect: BoundingRect): void;
1061
+ getPrevPaintRect(): BoundingRect;
1062
+ animateStyle(loop: boolean): Animator<this["style"]>;
1063
+ updateDuringAnimation(targetKey: string): void;
1064
+ attrKV(key: DisplayableKey, value: DisplayablePropertyType): void;
1065
+ setStyle(obj: Props['style']): this;
1066
+ setStyle<T extends keyof Props['style']>(obj: T, value: Props['style'][T]): this;
1067
+ dirtyStyle(notRedraw?: boolean): void;
1068
+ dirty(): void;
1069
+ styleChanged(): boolean;
1070
+ styleUpdated(): void;
1071
+ createStyle(obj?: Props['style']): Props["style"];
1072
+ useStyle(obj: Props['style']): void;
1073
+ isStyleObject(obj: Props['style']): any;
1074
+ protected _innerSaveToNormal(toState: DisplayableState): void;
1075
+ protected _applyStateObj(stateName: string, state: DisplayableState, normalState: DisplayableState, keepCurrentStates: boolean, transition: boolean, animationCfg: ElementAnimateConfig): void;
1076
+ protected _mergeStates(states: DisplayableState[]): DisplayableState;
1077
+ protected _mergeStyle(targetStyle: CommonStyleProps, sourceStyle: CommonStyleProps): CommonStyleProps;
1078
+ getAnimationStyleProps(): MapToType<DisplayableProps, boolean>;
1079
+ protected static initDefaultProps: void;
1080
+ }
1081
+ interface PainterBase {
1082
+ type: string;
1083
+ root?: HTMLElement;
1084
+ ssrOnly?: boolean;
1085
+ resize(width?: number | string, height?: number | string): void;
1086
+ refresh(): void;
1087
+ clear(): void;
1088
+ renderToString?(): string;
1089
+ getType: () => string;
1090
+ getWidth(): number;
1091
+ getHeight(): number;
1092
+ dispose(): void;
1093
+ getViewportRoot: () => HTMLElement;
1094
+ getViewportRootOffset: () => {
1095
+ offsetLeft: number;
1096
+ offsetTop: number;
1097
+ };
1098
+ refreshHover(): void;
1099
+ configLayer(zlevel: number, config: Dictionary<any>): void;
1100
+ setBackgroundColor(backgroundColor: string | GradientObject | PatternObject): void;
1101
+ }
1102
+ interface HandlerProxyInterface extends Eventful {
1103
+ handler: Handler;
1104
+ dispose: () => void;
1105
+ setCursor: (cursorStyle?: string) => void;
1106
+ }
1107
+ declare function shapeCompareFunc(a: Displayable, b: Displayable): number;
1108
+ declare class Storage {
1109
+ private _roots;
1110
+ private _displayList;
1111
+ private _displayListLen;
1112
+ traverse<T>(cb: (this: T, el: Element$1) => void, context?: T): void;
1113
+ getDisplayList(update?: boolean, includeIgnore?: boolean): Displayable[];
1114
+ updateDisplayList(includeIgnore?: boolean): void;
1115
+ private _updateAndAddDisplayable;
1116
+ addRoot(el: Element$1): void;
1117
+ delRoot(el: Element$1 | Element$1[]): void;
1118
+ delAllRoots(): void;
1119
+ getRoots(): Element$1<ElementProps>[];
1120
+ dispose(): void;
1121
+ displayableSortFunc: typeof shapeCompareFunc;
1122
+ }
1123
+ declare class HoveredResult {
1124
+ x: number;
1125
+ y: number;
1126
+ target: Displayable;
1127
+ topTarget: Displayable;
1128
+ constructor(x?: number, y?: number);
1129
+ }
1130
+ declare type HandlerName = 'click' | 'dblclick' | 'mousewheel' | 'mouseout' | 'mouseup' | 'mousedown' | 'mousemove' | 'contextmenu';
1131
+ declare class Handler extends Eventful {
1132
+ storage: Storage;
1133
+ painter: PainterBase;
1134
+ painterRoot: HTMLElement;
1135
+ proxy: HandlerProxyInterface;
1136
+ private _hovered;
1137
+ private _gestureMgr;
1138
+ private _draggingMgr;
1139
+ private _pointerSize;
1140
+ _downEl: Element$1;
1141
+ _upEl: Element$1;
1142
+ _downPoint: [number, number];
1143
+ constructor(storage: Storage, painter: PainterBase, proxy: HandlerProxyInterface, painterRoot: HTMLElement, pointerSize: number);
1144
+ setHandlerProxy(proxy: HandlerProxyInterface): void;
1145
+ mousemove(event: ZRRawEvent): void;
1146
+ mouseout(event: ZRRawEvent): void;
1147
+ resize(): void;
1148
+ dispatch(eventName: HandlerName, eventArgs?: any): void;
1149
+ dispose(): void;
1150
+ setCursorStyle(cursorStyle: string): void;
1151
+ dispatchToElement(targetInfo: {
1152
+ target?: Element$1;
1153
+ topTarget?: Element$1;
1154
+ }, eventName: ElementEventName, event: ZRRawEvent): void;
1155
+ findHover(x: number, y: number, exclude?: Displayable): HoveredResult;
1156
+ processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change'): void;
1157
+ click: (event: ZRRawEvent) => void;
1158
+ mousedown: (event: ZRRawEvent) => void;
1159
+ mouseup: (event: ZRRawEvent) => void;
1160
+ mousewheel: (event: ZRRawEvent) => void;
1161
+ dblclick: (event: ZRRawEvent) => void;
1162
+ contextmenu: (event: ZRRawEvent) => void;
1163
+ }
1164
+ interface LayerConfig {
1165
+ clearColor?: string | GradientObject | ImagePatternObject;
1166
+ motionBlur?: boolean;
1167
+ lastFrameAlpha?: number;
1168
+ }
1169
+ /*!
1170
+ * ZRender, a high performance 2d drawing library.
1171
+ *
1172
+ * Copyright (c) 2013, Baidu Inc.
1173
+ * All rights reserved.
1174
+ *
1175
+ * LICENSE
1176
+ * https://github.com/ecomfe/zrender/blob/master/LICENSE.txt
8
1177
  */
9
- async function getCore() {
10
- if (coreModule) return coreModule;
11
- if (!corePromise) corePromise = import("./core.d.ts").then(m => {
12
- coreModule = m;
13
- return m;
14
- });
15
- return corePromise;
1178
+ declare class ZRender {
1179
+ dom?: HTMLElement;
1180
+ id: number;
1181
+ storage: Storage;
1182
+ painter: PainterBase;
1183
+ handler: Handler;
1184
+ animation: Animation;
1185
+ private _sleepAfterStill;
1186
+ private _stillFrameAccum;
1187
+ private _needsRefresh;
1188
+ private _needsRefreshHover;
1189
+ private _disposed;
1190
+ private _darkMode;
1191
+ private _backgroundColor;
1192
+ constructor(id: number, dom?: HTMLElement, opts?: ZRenderInitOpt);
1193
+ add(el: Element$1): void;
1194
+ remove(el: Element$1): void;
1195
+ configLayer(zLevel: number, config: LayerConfig): void;
1196
+ setBackgroundColor(backgroundColor: string | GradientObject | PatternObject): void;
1197
+ getBackgroundColor(): string | GradientObject | PatternObject;
1198
+ setDarkMode(darkMode: boolean): void;
1199
+ isDarkMode(): boolean;
1200
+ refreshImmediately(fromInside?: boolean): void;
1201
+ refresh(): void;
1202
+ flush(): void;
1203
+ private _flush;
1204
+ setSleepAfterStill(stillFramesCount: number): void;
1205
+ wakeUp(): void;
1206
+ refreshHover(): void;
1207
+ refreshHoverImmediately(): void;
1208
+ resize(opts?: {
1209
+ width?: number | string;
1210
+ height?: number | string;
1211
+ }): void;
1212
+ clearAnimation(): void;
1213
+ getWidth(): number | undefined;
1214
+ getHeight(): number | undefined;
1215
+ setCursorStyle(cursorStyle: string): void;
1216
+ findHover(x: number, y: number): {
1217
+ target: Displayable;
1218
+ topTarget: Displayable;
1219
+ } | undefined;
1220
+ on<Ctx>(eventName: ElementEventName, eventHandler: ElementEventCallback<Ctx, ZRenderType>, context?: Ctx): this;
1221
+ on<Ctx>(eventName: string, eventHandler: WithThisType<EventCallback<any[]>, unknown extends Ctx ? ZRenderType : Ctx>, context?: Ctx): this;
1222
+ off(eventName?: string, eventHandler?: EventCallback): void;
1223
+ trigger(eventName: string, event?: unknown): void;
1224
+ clear(): void;
1225
+ dispose(): void;
1226
+ }
1227
+ interface ZRenderInitOpt {
1228
+ renderer?: string;
1229
+ devicePixelRatio?: number;
1230
+ width?: number | string;
1231
+ height?: number | string;
1232
+ useDirtyRect?: boolean;
1233
+ useCoarsePointer?: 'auto' | boolean;
1234
+ pointerSize?: number;
1235
+ ssr?: boolean;
16
1236
  }
1237
+ interface ZRenderType extends ZRender {}
1238
+ declare const _default: {
1239
+ time: {
1240
+ month: string[];
1241
+ monthAbbr: string[];
1242
+ dayOfWeek: string[];
1243
+ dayOfWeekAbbr: string[];
1244
+ };
1245
+ legend: {
1246
+ selector: {
1247
+ all: string;
1248
+ inverse: string;
1249
+ };
1250
+ };
1251
+ toolbox: {
1252
+ brush: {
1253
+ title: {
1254
+ rect: string;
1255
+ polygon: string;
1256
+ lineX: string;
1257
+ lineY: string;
1258
+ keep: string;
1259
+ clear: string;
1260
+ };
1261
+ };
1262
+ dataView: {
1263
+ title: string;
1264
+ lang: string[];
1265
+ };
1266
+ dataZoom: {
1267
+ title: {
1268
+ zoom: string;
1269
+ back: string;
1270
+ };
1271
+ };
1272
+ magicType: {
1273
+ title: {
1274
+ line: string;
1275
+ bar: string;
1276
+ stack: string;
1277
+ tiled: string;
1278
+ };
1279
+ };
1280
+ restore: {
1281
+ title: string;
1282
+ };
1283
+ saveAsImage: {
1284
+ title: string;
1285
+ lang: string[];
1286
+ };
1287
+ };
1288
+ series: {
1289
+ typeNames: {
1290
+ pie: string;
1291
+ bar: string;
1292
+ line: string;
1293
+ scatter: string;
1294
+ effectScatter: string;
1295
+ radar: string;
1296
+ tree: string;
1297
+ treemap: string;
1298
+ boxplot: string;
1299
+ candlestick: string;
1300
+ k: string;
1301
+ heatmap: string;
1302
+ map: string;
1303
+ parallel: string;
1304
+ lines: string;
1305
+ graph: string;
1306
+ sankey: string;
1307
+ funnel: string;
1308
+ gauge: string;
1309
+ pictorialBar: string;
1310
+ themeRiver: string;
1311
+ sunburst: string;
1312
+ custom: string;
1313
+ chart: string;
1314
+ };
1315
+ };
1316
+ aria: {
1317
+ general: {
1318
+ withTitle: string;
1319
+ withoutTitle: string;
1320
+ };
1321
+ series: {
1322
+ single: {
1323
+ prefix: string;
1324
+ withName: string;
1325
+ withoutName: string;
1326
+ };
1327
+ multiple: {
1328
+ prefix: string;
1329
+ withName: string;
1330
+ withoutName: string;
1331
+ separator: {
1332
+ middle: string;
1333
+ end: string;
1334
+ };
1335
+ };
1336
+ };
1337
+ data: {
1338
+ allData: string;
1339
+ partialData: string;
1340
+ withName: string;
1341
+ withoutName: string;
1342
+ separator: {
1343
+ middle: string;
1344
+ end: string;
1345
+ };
1346
+ };
1347
+ };
1348
+ };
1349
+ declare type LocaleOption = typeof _default;
1350
+ declare type DimensionUserOuputEncode = {
1351
+ [coordOrVisualDimName: string]: DimensionIndex[];
1352
+ };
17
1353
  /**
18
- * Get the cached core module (null if not yet loaded).
19
- */
20
- function getCoreSync() {
21
- return coreModule;
22
- }
23
- async function loadAndRegister(core, key, loader) {
24
- if (registered.has(key)) return;
25
- if (inflight.has(key)) return inflight.get(key);
26
- const promise = loader().then(mod => {
27
- core.use(mod);
28
- registered.add(key);
29
- inflight.delete(key);
30
- });
31
- inflight.set(key, promise);
32
- return promise;
1354
+ * If string, e.g., 'geo', means {geoIndex: 0}.
1355
+ * If Object, could contain some of these properties below:
1356
+ * {
1357
+ * seriesIndex, seriesId, seriesName,
1358
+ * geoIndex, geoId, geoName,
1359
+ * bmapIndex, bmapId, bmapName,
1360
+ * xAxisIndex, xAxisId, xAxisName,
1361
+ * yAxisIndex, yAxisId, yAxisName,
1362
+ * gridIndex, gridId, gridName,
1363
+ * ... (can be extended)
1364
+ * }
1365
+ * Each properties can be number|string|Array.<number>|Array.<string>
1366
+ * For example, a finder could be
1367
+ * {
1368
+ * seriesIndex: 3,
1369
+ * geoId: ['aa', 'cc'],
1370
+ * gridName: ['xx', 'rr']
1371
+ * }
1372
+ * xxxIndex can be set as 'all' (means all xxx) or 'none' (means not specify)
1373
+ * If nothing or null/undefined specified, return nothing.
1374
+ * If both `abcIndex`, `abcId`, `abcName` specified, only one work.
1375
+ * The priority is: index > id > name, the same with `ecModel.queryComponents`.
1376
+ */
1377
+ declare type ModelFinderIndexQuery = number | number[] | 'all' | 'none' | false;
1378
+ declare type ModelFinderIdQuery = OptionId | OptionId[];
1379
+ declare type ModelFinderNameQuery = OptionId | OptionId[];
1380
+ declare type ModelFinder = string | ModelFinderObject;
1381
+ declare type ModelFinderObject = {
1382
+ seriesIndex?: ModelFinderIndexQuery;
1383
+ seriesId?: ModelFinderIdQuery;
1384
+ seriesName?: ModelFinderNameQuery;
1385
+ geoIndex?: ModelFinderIndexQuery;
1386
+ geoId?: ModelFinderIdQuery;
1387
+ geoName?: ModelFinderNameQuery;
1388
+ bmapIndex?: ModelFinderIndexQuery;
1389
+ bmapId?: ModelFinderIdQuery;
1390
+ bmapName?: ModelFinderNameQuery;
1391
+ xAxisIndex?: ModelFinderIndexQuery;
1392
+ xAxisId?: ModelFinderIdQuery;
1393
+ xAxisName?: ModelFinderNameQuery;
1394
+ yAxisIndex?: ModelFinderIndexQuery;
1395
+ yAxisId?: ModelFinderIdQuery;
1396
+ yAxisName?: ModelFinderNameQuery;
1397
+ gridIndex?: ModelFinderIndexQuery;
1398
+ gridId?: ModelFinderIdQuery;
1399
+ gridName?: ModelFinderNameQuery;
1400
+ matrixIndex?: ModelFinderIndexQuery;
1401
+ matrixId?: ModelFinderIdQuery;
1402
+ matrixName?: ModelFinderNameQuery;
1403
+ dataIndex?: number;
1404
+ dataIndexInside?: number;
1405
+ };
1406
+ /**
1407
+ * {
1408
+ * seriesModels: [seriesModel1, seriesModel2],
1409
+ * seriesModel: seriesModel1, // The first model
1410
+ * geoModels: [geoModel1, geoModel2],
1411
+ * geoModel: geoModel1, // The first model
1412
+ * ...
1413
+ * }
1414
+ */
1415
+ interface RichTextTooltipMarker {
1416
+ renderMode: TooltipRenderMode;
1417
+ content: string;
1418
+ style: Dictionary<unknown>;
33
1419
  }
1420
+ declare type TooltipMarker = string | RichTextTooltipMarker;
34
1421
  /**
35
- * Analyze an ECharts option object and dynamically import only the
36
- * required chart types, components, and renderer. All imports are
37
- * cached subsequent calls with the same types are instant.
38
- */
39
- async function ensureModules(option, renderer = "canvas") {
40
- const core = await getCore();
41
- const loads = [];
42
- loads.push(loadAndRegister(core, `renderer:${renderer}`, RENDERERS[renderer]));
43
- const rawSeries = option.series;
44
- const seriesList = rawSeries ? Array.isArray(rawSeries) ? rawSeries : [rawSeries] : [];
45
- for (const s of seriesList) {
46
- const type = s.type;
47
- if (type && CHARTS[type]) loads.push(loadAndRegister(core, `chart:${type}`, CHARTS[type]));
48
- }
49
- for (const key of Object.keys(option)) if (COMPONENTS[key]) loads.push(loadAndRegister(core, `component:${key}`, COMPONENTS[key]));
50
- for (const s of seriesList) for (const key of Object.keys(s)) if (SERIES_FEATURES[key]) loads.push(loadAndRegister(core, `feature:${key}`, SERIES_FEATURES[key]));
51
- await Promise.all(loads);
52
- return core;
1422
+ * [Notice]:
1423
+ * Consider custom bundle on demand, chart specified
1424
+ * or component specified types and constants should
1425
+ * not put here. Only common types and constants can
1426
+ * be put in this file.
1427
+ */
1428
+ declare type RendererType = 'canvas' | 'svg';
1429
+ declare type NullUndefined$1 = null | undefined;
1430
+ declare type HorizontalAlign = 'left' | 'center' | 'right';
1431
+ declare type VerticalAlign = 'top' | 'middle' | 'bottom';
1432
+ declare type ColorString = string;
1433
+ declare type ZRColor = ColorString | LinearGradientObject | RadialGradientObject | PatternObject;
1434
+ declare type ZRLineType = 'solid' | 'dotted' | 'dashed' | number | number[];
1435
+ declare type ZRFontStyle = 'normal' | 'italic' | 'oblique';
1436
+ declare type ZRFontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | number;
1437
+ declare type ZRElementEventName = ElementEventName | 'globalout';
1438
+ declare type ComponentMainType = keyof ECUnitOption & string;
1439
+ interface PayloadItem {
1440
+ excludeSeriesId?: OptionId | OptionId[];
1441
+ animation?: PayloadAnimationPart;
1442
+ [other: string]: any;
1443
+ }
1444
+ interface Payload extends PayloadItem {
1445
+ type: string;
1446
+ escapeConnect?: boolean;
1447
+ batch?: PayloadItem[];
1448
+ }
1449
+ interface PayloadAnimationPart {
1450
+ duration?: number;
1451
+ easing?: AnimationEasing;
1452
+ delay?: number;
1453
+ }
1454
+ interface ECElementEvent extends ECEventData, CallbackDataParams {
1455
+ type: ZRElementEventName;
1456
+ event?: ElementEvent;
53
1457
  }
54
1458
  /**
55
- * Manually register ECharts modules (for tree-shaking entry point).
56
- * Call this at app startup instead of relying on auto-detection.
57
- *
58
- * @example
59
- * ```ts
60
- * import { use } from '@pyreon/charts/manual'
61
- * import { BarChart } from 'echarts/charts'
62
- * import { GridComponent, TooltipComponent } from 'echarts/components'
63
- * import { CanvasRenderer } from 'echarts/renderers'
64
- *
65
- * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)
66
- * ```
67
- */
68
- function manualUse(...modules) {
69
- const core = getCoreSync();
70
- if (core) core.use(modules);else getCore().then(c => c.use(modules));
1459
+ * The echarts event type to user.
1460
+ * Also known as packedEvent.
1461
+ */
1462
+ interface ECActionEvent extends ECEventData {
1463
+ type: string;
1464
+ componentType?: string;
1465
+ componentIndex?: number;
1466
+ seriesIndex?: number;
1467
+ escapeConnect?: boolean;
1468
+ batch?: ECEventData[];
71
1469
  }
72
-
73
- //#endregion
74
- //#region src/use-chart.ts
75
1470
  /**
76
- * Reactive ECharts hook. Creates a chart instance bound to a container
77
- * element, with automatic module lazy-loading, signal tracking, resize
78
- * handling, error capture, and cleanup.
79
- *
80
- * Generic parameter `TOption` narrows the option type for exact autocomplete.
81
- * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.
82
- *
83
- * @example
84
- * ```tsx
85
- * // Default — accepts any ECharts option
86
- * const chart = useChart(() => ({
87
- * series: [{ type: 'bar', data: revenue() }],
88
- * }))
89
- *
90
- * // Strict — only bar + line allowed, full autocomplete
91
- * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'
92
- * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>
93
- *
94
- * const chart = useChart<MyChartOption>(() => ({
95
- * series: [{ type: 'bar', data: revenue() }], // ✓
96
- * }))
97
- * ```
98
- */
99
- function useChart(optionsFn, config) {
100
- const instance = signal(null);
101
- const loading = signal(true);
102
- const error = signal(null);
103
- const container = signal(null);
104
- const renderer = config?.renderer ?? "canvas";
105
- let observer = null;
106
- let initialized = false;
107
- effect(() => {
108
- const el = container();
109
- if (!el || initialized) return;
110
- initialized = true;
111
- let opts;
112
- try {
113
- opts = optionsFn();
114
- } catch (err) {
115
- error.set(err instanceof Error ? err : new Error(String(err)));
116
- loading.set(false);
117
- return;
118
- }
119
- ensureModules(opts, renderer).then(core => {
120
- if (!container.peek()) return;
121
- try {
122
- const chart = core.init(el, config?.theme, {
123
- renderer,
124
- locale: config?.locale,
125
- devicePixelRatio: config?.devicePixelRatio,
126
- width: config?.width,
127
- height: config?.height
128
- });
129
- chart.setOption(opts);
130
- instance.set(chart);
131
- loading.set(false);
132
- error.set(null);
133
- config?.onInit?.(chart);
134
- observer = new ResizeObserver(() => {
135
- chart.resize();
136
- });
137
- observer.observe(el);
138
- } catch (err) {
139
- error.set(err instanceof Error ? err : new Error(String(err)));
140
- loading.set(false);
141
- }
142
- }).catch(err => {
143
- error.set(err instanceof Error ? err : new Error(String(err)));
144
- loading.set(false);
145
- });
146
- });
147
- effect(() => {
148
- const chart = instance();
149
- if (!chart) return;
150
- try {
151
- const opts = optionsFn();
152
- chart.setOption(opts, {
153
- notMerge: config?.notMerge ?? false,
154
- lazyUpdate: config?.lazyUpdate ?? true
155
- });
156
- error.set(null);
157
- } catch (err) {
158
- error.set(err instanceof Error ? err : new Error(String(err)));
159
- }
160
- });
161
- onUnmount(() => {
162
- observer?.disconnect();
163
- observer = null;
164
- const chart = instance.peek();
165
- if (chart) {
166
- chart.dispose();
167
- instance.set(null);
168
- }
169
- initialized = false;
170
- });
171
- return {
172
- ref: el => container.set(el),
173
- instance,
174
- loading,
175
- error,
176
- resize: () => instance.peek()?.resize()
177
- };
1471
+ * TODO: not applicable in `ECEventProcessor` yet.
1472
+ */
1473
+ interface ECEventData {
1474
+ [key: string]: any;
178
1475
  }
179
-
180
- //#endregion
181
- //#region ../../node_modules/.bun/@pyreon+core@0.6.0/node_modules/@pyreon/core/lib/jsx-runtime.js
182
1476
  /**
183
- * Hyperscript function the compiled output of JSX.
184
- * `<div class="x">hello</div>` `h("div", { class: "x" }, "hello")`
185
- *
186
- * Generic on P so TypeScript validates props match the component's signature
187
- * at the call site, then stores the result in the loosely-typed VNode.
188
- */
189
- /** Shared empty props sentinel identity-checked in mountElement to skip applyProps. */
190
-
191
- function h(type, props, ...children) {
192
- return {
193
- type,
194
- props: props ?? EMPTY_PROPS,
195
- children: normalizeChildren(children),
196
- key: props?.key ?? null
197
- };
1477
+ * 'html' is used for rendering tooltip in extra DOM form, and the result
1478
+ * string is used as DOM HTML content.
1479
+ * 'richText' is used for rendering tooltip in rich text form, for those where
1480
+ * DOM operation is not supported.
1481
+ */
1482
+ declare type TooltipRenderMode = 'html' | 'richText';
1483
+ declare type OrdinalRawValue = string | number;
1484
+ declare type OrdinalNumber = number;
1485
+ /**
1486
+ * @usage For example,
1487
+ * ```js
1488
+ * { ordinalNumbers: [2, 5, 3, 4] }
1489
+ * ```
1490
+ * means that ordinal 2 should be displayed on tick 0,
1491
+ * ordinal 5 should be displayed on tick 1, ...
1492
+ */
1493
+ declare type ParsedValueNumeric = number | OrdinalNumber;
1494
+ /**
1495
+ * `ScaleDataValue` represents the user input axis value in echarts API.
1496
+ * (For example, used `axis.min`/`axis.max` in echarts option, `convertToPixel`).
1497
+ * NOTICE:
1498
+ * `ScaleDataValue` is slightly different from `OptionDataValue` for historical reason.
1499
+ * `ScaleDataValue` should be parsed by `src/scale/Scale['parse']`.
1500
+ * `OptionDataValue` should be parsed by `src/data/helper/dataValueHelper.parseDataValue`.
1501
+ * FIXME:
1502
+ * Make `ScaleDataValue` `OptionDataValue` consistent? Since numeric string (like `'123'`) is accepted
1503
+ * in `series.data` and is effectively accepted in some axis relevant option (e.g., `axis.min/max`),
1504
+ * `type ScaleDataValue` should also include it for consistency. But it might bring some breaking in
1505
+ * TS interface (user callback) and need comprehensive checks for all of the parsing of `ScaleDataValue`.
1506
+ */
1507
+ declare type ScaleDataValue = ParsedValueNumeric | OrdinalRawValue | Date;
1508
+ /**
1509
+ * - `ScaleDataValue`:
1510
+ * e.g. geo accept that primitive input, like `convertToPixel('some_place')`;
1511
+ * Some coord sys, such as 'cartesian2d', also supports that for only query only a single axis.
1512
+ * - `ScaleDataValue[]`:
1513
+ * This is the most common case, each array item represent each data in
1514
+ * every dimension required by the coord sys. e.g., `[12, 98]` represents `[xData, yData]`.
1515
+ * - `(ScaleDataValue[])[]`:
1516
+ * represents `[data_range_x, data_range_y]`. e.g., `dataToPoint([[5, 600], [8889, 9000]])`,
1517
+ * represents data range `[5, 600]` in x, and `[8889, 9000]` in y.
1518
+ * Can be also `[5, [8999, 9000]]`.
1519
+ */
1520
+ declare type CoordinateSystemDataCoord = (ScaleDataValue | NullUndefined$1) | (ScaleDataValue | NullUndefined$1)[] | (ScaleDataValue | ScaleDataValue[] | NullUndefined$1)[];
1521
+ /**
1522
+ * Return type of API `CoordinateSystem['dataToLayout']`, expose to users.
1523
+ */
1524
+ interface CoordinateSystemDataLayout {
1525
+ rect?: RectLike;
1526
+ contentRect?: RectLike;
1527
+ matrixXYLocatorRange?: number[][];
198
1528
  }
199
- function normalizeChildren(children) {
200
- for (let i = 0; i < children.length; i++) if (Array.isArray(children[i])) return flattenChildren(children);
201
- return children;
1529
+ declare type DimensionIndex = number;
1530
+ declare type DimensionIndexLoose = DimensionIndex | string;
1531
+ declare type DimensionName = string;
1532
+ declare type DimensionLoose = DimensionName | DimensionIndexLoose;
1533
+ declare type SeriesDataType = 'main' | 'node' | 'edge';
1534
+ /**
1535
+ * [ECUnitOption]:
1536
+ * An object that contains definitions of components
1537
+ * and other properties. For example:
1538
+ *
1539
+ * ```ts
1540
+ * let option: ECUnitOption = {
1541
+ *
1542
+ * // Single `title` component:
1543
+ * title: {...},
1544
+ *
1545
+ * // Two `visualMap` components:
1546
+ * visualMap: [{...}, {...}],
1547
+ *
1548
+ * // Two `series.bar` components
1549
+ * // and one `series.pie` component:
1550
+ * series: [
1551
+ * {type: 'bar', data: [...]},
1552
+ * {type: 'bar', data: [...]},
1553
+ * {type: 'pie', data: [...]}
1554
+ * ],
1555
+ *
1556
+ * // A property:
1557
+ * backgroundColor: '#421ae4'
1558
+ *
1559
+ * // A property object:
1560
+ * textStyle: {
1561
+ * color: 'red',
1562
+ * fontSize: 20
1563
+ * }
1564
+ * };
1565
+ * ```
1566
+ */
1567
+ declare type ECUnitOption = {
1568
+ baseOption?: unknown;
1569
+ options?: unknown;
1570
+ media?: unknown;
1571
+ timeline?: ComponentOption | ComponentOption[];
1572
+ backgroundColor?: ZRColor;
1573
+ darkMode?: boolean | 'auto';
1574
+ textStyle?: GlobalTextStyleOption;
1575
+ useUTC?: boolean;
1576
+ hoverLayerThreshold?: number;
1577
+ legacyViewCoordSysCenterBase?: boolean;
1578
+ [key: string]: ComponentOption | ComponentOption[] | Dictionary<unknown> | unknown;
1579
+ stateAnimation?: AnimationOption$1;
1580
+ } & AnimationOptionMixin & ColorPaletteOptionMixin;
1581
+ /**
1582
+ * [ECOption]:
1583
+ * An object input to echarts.setOption(option).
1584
+ * May be an 'option: ECUnitOption',
1585
+ * or may be an object contains multi-options. For example:
1586
+ *
1587
+ * ```ts
1588
+ * let option: ECOption = {
1589
+ * baseOption: {
1590
+ * title: {...},
1591
+ * legend: {...},
1592
+ * series: [
1593
+ * {data: [...]},
1594
+ * {data: [...]},
1595
+ * ...
1596
+ * ]
1597
+ * },
1598
+ * timeline: {...},
1599
+ * options: [
1600
+ * {title: {...}, series: {data: [...]}},
1601
+ * {title: {...}, series: {data: [...]}},
1602
+ * ...
1603
+ * ],
1604
+ * media: [
1605
+ * {
1606
+ * query: {maxWidth: 320},
1607
+ * option: {series: {x: 20}, visualMap: {show: false}}
1608
+ * },
1609
+ * {
1610
+ * query: {minWidth: 320, maxWidth: 720},
1611
+ * option: {series: {x: 500}, visualMap: {show: true}}
1612
+ * },
1613
+ * {
1614
+ * option: {series: {x: 1200}, visualMap: {show: true}}
1615
+ * }
1616
+ * ]
1617
+ * };
1618
+ * ```
1619
+ */
1620
+ interface ECBasicOption extends ECUnitOption {
1621
+ baseOption?: ECUnitOption;
1622
+ timeline?: ComponentOption | ComponentOption[];
1623
+ options?: ECUnitOption[];
1624
+ media?: MediaUnit[];
202
1625
  }
203
- function flattenChildren(children) {
204
- const result = [];
205
- for (const child of children) if (Array.isArray(child)) result.push(...flattenChildren(child));else result.push(child);
206
- return result;
1626
+ declare type OptionDataItem = OptionDataValue | Dictionary<OptionDataValue> | OptionDataValue[] | OptionDataItemObject<OptionDataValue>;
1627
+ declare type OptionDataItemObject<T> = {
1628
+ id?: OptionId;
1629
+ name?: OptionName;
1630
+ groupId?: OptionId;
1631
+ childGroupId?: OptionId;
1632
+ value?: T[] | T;
1633
+ selected?: boolean;
1634
+ };
1635
+ declare type OptionId = string | number;
1636
+ declare type OptionName = string | number;
1637
+ declare type OptionDataValue = string | number | Date | null | undefined;
1638
+ declare type ThemeOption = Dictionary<any>;
1639
+ declare type DisplayState = 'normal' | 'emphasis' | 'blur' | 'select';
1640
+ interface CallbackDataParams {
1641
+ componentType: string;
1642
+ componentSubType: string;
1643
+ componentIndex: number;
1644
+ seriesType?: string;
1645
+ seriesIndex?: number;
1646
+ seriesId?: string;
1647
+ seriesName?: string;
1648
+ name: string;
1649
+ dataIndex: number;
1650
+ data: OptionDataItem;
1651
+ dataType?: SeriesDataType;
1652
+ value: OptionDataItem | OptionDataValue;
1653
+ color?: ZRColor;
1654
+ borderColor?: string;
1655
+ dimensionNames?: DimensionName[];
1656
+ encode?: DimensionUserOuputEncode;
1657
+ marker?: TooltipMarker;
1658
+ status?: DisplayState;
1659
+ dimensionIndex?: number;
1660
+ percent?: number;
1661
+ $vars: string[];
1662
+ }
1663
+ interface MediaQuery {
1664
+ minWidth?: number;
1665
+ maxWidth?: number;
1666
+ minHeight?: number;
1667
+ maxHeight?: number;
1668
+ minAspectRatio?: number;
1669
+ maxAspectRatio?: number;
1670
+ }
1671
+ declare type MediaUnit = {
1672
+ query?: MediaQuery;
1673
+ option: ECUnitOption;
1674
+ };
1675
+ interface ColorPaletteOptionMixin {
1676
+ color?: ZRColor | ZRColor[];
1677
+ colorLayer?: ZRColor[][];
207
1678
  }
208
1679
  /**
209
- * JSX automatic runtime.
210
- *
211
- * When tsconfig has `"jsxImportSource": "@pyreon/core"`, the TS/bundler compiler
212
- * rewrites JSX to imports from this file automatically:
213
- * <div class="x" /> → jsx("div", { class: "x" })
214
- */
215
- function jsx(type, props, key) {
216
- const {
217
- children,
218
- ...rest
219
- } = props;
220
- const propsWithKey = key != null ? {
221
- ...rest,
222
- key
223
- } : rest;
224
- if (typeof type === "function") return h(type, children !== void 0 ? {
225
- ...propsWithKey,
226
- children
227
- } : propsWithKey);
228
- return h(type, propsWithKey, ...(children === void 0 ? [] : Array.isArray(children) ? children : [children]));
1680
+ * Mixin of option set to control the box layout of each component.
1681
+ */
1682
+ interface ShadowOptionMixin {
1683
+ shadowBlur?: number;
1684
+ shadowColor?: ColorString;
1685
+ shadowOffsetX?: number;
1686
+ shadowOffsetY?: number;
229
1687
  }
230
-
1688
+ declare type AnimationDelayCallbackParam = {
1689
+ count: number;
1690
+ index: number;
1691
+ };
1692
+ declare type AnimationDurationCallback = (idx: number) => number;
1693
+ declare type AnimationDelayCallback = (idx: number, params?: AnimationDelayCallbackParam) => number;
1694
+ interface AnimationOption$1 {
1695
+ duration?: number;
1696
+ easing?: AnimationEasing;
1697
+ delay?: number;
1698
+ }
1699
+ /**
1700
+ * Mixin of option set to control the animation of series.
1701
+ */
1702
+ interface AnimationOptionMixin {
1703
+ /**
1704
+ * If enable animation
1705
+ */
1706
+ animation?: boolean;
1707
+ /**
1708
+ * Disable animation when the number of elements exceeds the threshold
1709
+ */
1710
+ animationThreshold?: number;
1711
+ /**
1712
+ * Duration of initialize animation.
1713
+ * Can be a callback to specify duration of each element
1714
+ */
1715
+ animationDuration?: number | AnimationDurationCallback;
1716
+ /**
1717
+ * Easing of initialize animation
1718
+ */
1719
+ animationEasing?: AnimationEasing;
1720
+ /**
1721
+ * Delay of initialize animation
1722
+ * Can be a callback to specify duration of each element
1723
+ */
1724
+ animationDelay?: number | AnimationDelayCallback;
1725
+ /**
1726
+ * Delay of data update animation.
1727
+ * Can be a callback to specify duration of each element
1728
+ */
1729
+ animationDurationUpdate?: number | AnimationDurationCallback;
1730
+ /**
1731
+ * Easing of data update animation.
1732
+ */
1733
+ animationEasingUpdate?: AnimationEasing;
1734
+ /**
1735
+ * Delay of data update animation.
1736
+ * Can be a callback to specify duration of each element
1737
+ */
1738
+ animationDelayUpdate?: number | AnimationDelayCallback;
1739
+ }
1740
+ declare type TextCommonOptionNuanceBase = Record<string, unknown>;
1741
+ declare type TextCommonOptionNuanceDefault = {};
1742
+ declare type LabelStyleColorString = ColorString | 'inherit' | 'auto';
1743
+ interface TextCommonOption<TNuance extends TextCommonOptionNuanceBase = TextCommonOptionNuanceDefault> extends ShadowOptionMixin {
1744
+ color?: 'color' extends keyof TNuance ? (TNuance['color'] | LabelStyleColorString) : LabelStyleColorString;
1745
+ fontStyle?: ZRFontStyle;
1746
+ fontWeight?: ZRFontWeight;
1747
+ fontFamily?: string;
1748
+ fontSize?: number | string;
1749
+ align?: HorizontalAlign;
1750
+ verticalAlign?: VerticalAlign;
1751
+ baseline?: VerticalAlign;
1752
+ opacity?: number;
1753
+ lineHeight?: number;
1754
+ backgroundColor?: ColorString | {
1755
+ image: ImageLike | string;
1756
+ };
1757
+ borderColor?: string;
1758
+ borderWidth?: number;
1759
+ borderType?: ZRLineType;
1760
+ borderDashOffset?: number;
1761
+ borderRadius?: number | number[];
1762
+ padding?: number | number[];
1763
+ /**
1764
+ * Currently margin related options are not declared here. They are not supported in rich text.
1765
+ * @see {LabelCommonOption}
1766
+ */
1767
+ width?: number | string;
1768
+ height?: number;
1769
+ textBorderColor?: string;
1770
+ textBorderWidth?: number;
1771
+ textBorderType?: ZRLineType;
1772
+ textBorderDashOffset?: number;
1773
+ textShadowBlur?: number;
1774
+ textShadowColor?: string;
1775
+ textShadowOffsetX?: number;
1776
+ textShadowOffsetY?: number;
1777
+ tag?: string;
1778
+ }
1779
+ declare type GlobalTextStyleOption = Pick<TextCommonOption, 'color' | 'opacity' | 'fontStyle' | 'fontWeight' | 'fontSize' | 'fontFamily' | 'textShadowColor' | 'textShadowBlur' | 'textShadowOffsetX' | 'textShadowOffsetY' | 'textBorderColor' | 'textBorderWidth' | 'textBorderType' | 'textBorderDashOffset'>;
1780
+ interface ComponentOption {
1781
+ mainType?: string;
1782
+ type?: string;
1783
+ id?: OptionId;
1784
+ name?: OptionName;
1785
+ z?: number;
1786
+ zlevel?: number;
1787
+ coordinateSystem?: string;
1788
+ coordinateSystemUsage?: CoordinateSystemUsageOption;
1789
+ coord?: CoordinateSystemDataCoord;
1790
+ }
1791
+ /**
1792
+ * - "data": Use it as "dataCoordSys", each data item is laid out based on a coord sys.
1793
+ * - "box": Use it as "boxCoordSys", the overall bounding rect or anchor point is calculated based on a coord sys.
1794
+ * e.g.,
1795
+ * grid rect (cartesian rect) is calculate based on matrix/calendar coord sys;
1796
+ * pie center is calculated based on calendar/cartesian;
1797
+ *
1798
+ * The default value (if not declared in option `coordinateSystemUsage`):
1799
+ * For series, be "data", since this is the most case and backward compatible.
1800
+ * For non-series components, be "box", since "data" is not applicable.
1801
+ */
1802
+ declare type CoordinateSystemUsageOption = 'data' | 'box';
1803
+ /**
1804
+ * Caution: If the mechanism should be changed some day, these cases
1805
+ * should be considered:
1806
+ *
1807
+ * (1) In `merge option` mode, if using the same option to call `setOption`
1808
+ * many times, the result should be the same (try our best to ensure that).
1809
+ * (2) In `merge option` mode, if a component has no id/name specified, it
1810
+ * will be merged by index, and the result sequence of the components is
1811
+ * consistent to the original sequence.
1812
+ * (3) In `replaceMerge` mode, keep the result sequence of the components is
1813
+ * consistent to the original sequence, even though there might result in "hole".
1814
+ * (4) `reset` feature (in toolbox). Find detailed info in comments about
1815
+ * `mergeOption` in module:echarts/model/OptionManager.
1816
+ */
1817
+ interface GlobalModelSetOptionOpts {
1818
+ replaceMerge: ComponentMainType | ComponentMainType[];
1819
+ }
1820
+ interface UpdateLifecycleTransitionSeriesFinder {
1821
+ seriesIndex?: ModelFinderIndexQuery;
1822
+ seriesId?: ModelFinderIdQuery;
1823
+ dimension: DimensionLoose;
1824
+ }
1825
+ interface UpdateLifecycleTransitionItem {
1826
+ from?: UpdateLifecycleTransitionSeriesFinder | UpdateLifecycleTransitionSeriesFinder[];
1827
+ to: UpdateLifecycleTransitionSeriesFinder | UpdateLifecycleTransitionSeriesFinder[];
1828
+ }
1829
+ declare type UpdateLifecycleTransitionOpt = UpdateLifecycleTransitionItem | UpdateLifecycleTransitionItem[];
1830
+ declare type ModelFinder$1 = ModelFinder;
1831
+ declare const IN_MAIN_PROCESS_KEY: "__flagInMainProcess";
1832
+ declare const MAIN_PROCESS_VERSION_KEY: "__mainProcessVersion";
1833
+ declare const PENDING_UPDATE: "__pendingUpdate";
1834
+ declare const STATUS_NEEDS_UPDATE_KEY: "__needsUpdateStatus";
1835
+ declare const CONNECT_STATUS_KEY: "__connectUpdateStatus";
1836
+ declare type SetOptionTransitionOpt = UpdateLifecycleTransitionOpt;
1837
+ interface SetOptionOpts$1 {
1838
+ notMerge?: boolean;
1839
+ lazyUpdate?: boolean;
1840
+ silent?: boolean;
1841
+ replaceMerge?: GlobalModelSetOptionOpts['replaceMerge'];
1842
+ transition?: SetOptionTransitionOpt;
1843
+ }
1844
+ interface ResizeOpts {
1845
+ width?: number | 'auto';
1846
+ height?: number | 'auto';
1847
+ animation?: AnimationOption$1;
1848
+ silent?: boolean;
1849
+ }
1850
+ interface SetThemeOpts {
1851
+ silent?: boolean;
1852
+ }
1853
+ declare type RenderedEventParam = {
1854
+ elapsedTime: number;
1855
+ };
1856
+ declare type ECEventDefinition = { [key in ZRElementEventName]: EventCallbackSingleParam<ECElementEvent> } & {
1857
+ rendered: EventCallbackSingleParam<RenderedEventParam>;
1858
+ finished: () => void | boolean;
1859
+ } & {
1860
+ [key: string]: (...args: unknown[]) => void | boolean;
1861
+ };
1862
+ declare type EChartsInitOpts = {
1863
+ locale?: string | LocaleOption;
1864
+ renderer?: RendererType;
1865
+ devicePixelRatio?: number;
1866
+ useDirtyRect?: boolean;
1867
+ useCoarsePointer?: boolean;
1868
+ pointerSize?: number;
1869
+ ssr?: boolean;
1870
+ width?: number | string;
1871
+ height?: number | string;
1872
+ };
1873
+ declare class ECharts extends Eventful<ECEventDefinition> {
1874
+ /**
1875
+ * @readonly
1876
+ */
1877
+ id: string;
1878
+ /**
1879
+ * Group id
1880
+ * @readonly
1881
+ */
1882
+ group: string;
1883
+ private _ssr;
1884
+ private _zr;
1885
+ private _dom;
1886
+ private _model;
1887
+ private _throttledZrFlush;
1888
+ private _theme;
1889
+ private _locale;
1890
+ private _chartsViews;
1891
+ private _chartsMap;
1892
+ private _componentsViews;
1893
+ private _componentsMap;
1894
+ private _coordSysMgr;
1895
+ private _api;
1896
+ private _scheduler;
1897
+ private _messageCenter;
1898
+ private _pendingActions;
1899
+ protected _$eventProcessor: never;
1900
+ private _disposed;
1901
+ private _loadingFX;
1902
+ private [PENDING_UPDATE];
1903
+ private [IN_MAIN_PROCESS_KEY];
1904
+ private [MAIN_PROCESS_VERSION_KEY];
1905
+ private [CONNECT_STATUS_KEY];
1906
+ private [STATUS_NEEDS_UPDATE_KEY];
1907
+ constructor(dom: HTMLElement, theme?: string | ThemeOption, opts?: EChartsInitOpts);
1908
+ private _onframe;
1909
+ getDom(): HTMLElement;
1910
+ getId(): string;
1911
+ getZr(): ZRenderType;
1912
+ isSSR(): boolean;
1913
+ /**
1914
+ * Usage:
1915
+ * chart.setOption(option, notMerge, lazyUpdate);
1916
+ * chart.setOption(option, {
1917
+ * notMerge: ...,
1918
+ * lazyUpdate: ...,
1919
+ * silent: ...
1920
+ * });
1921
+ *
1922
+ * @param opts opts or notMerge.
1923
+ * @param opts.notMerge Default `false`.
1924
+ * @param opts.lazyUpdate Default `false`. Useful when setOption frequently.
1925
+ * @param opts.silent Default `false`.
1926
+ * @param opts.replaceMerge Default undefined.
1927
+ */
1928
+ setOption<Opt extends ECBasicOption>(option: Opt, notMerge?: boolean, lazyUpdate?: boolean): void;
1929
+ setOption<Opt extends ECBasicOption>(option: Opt, opts?: SetOptionOpts$1): void;
1930
+ /**
1931
+ * Update theme with name or theme option and repaint the chart.
1932
+ * @param theme Theme name or theme option.
1933
+ * @param opts Optional settings
1934
+ */
1935
+ setTheme(theme: string | ThemeOption, opts?: SetThemeOpts): void;
1936
+ private _updateTheme;
1937
+ private getModel;
1938
+ getOption(): ECBasicOption;
1939
+ getWidth(): number;
1940
+ getHeight(): number;
1941
+ getDevicePixelRatio(): number;
1942
+ /**
1943
+ * Get canvas which has all thing rendered
1944
+ * @deprecated Use renderToCanvas instead.
1945
+ */
1946
+ getRenderedCanvas(opts?: any): HTMLCanvasElement;
1947
+ renderToCanvas(opts?: {
1948
+ backgroundColor?: ZRColor;
1949
+ pixelRatio?: number;
1950
+ }): HTMLCanvasElement;
1951
+ renderToSVGString(opts?: {
1952
+ useViewBox?: boolean;
1953
+ }): string;
1954
+ /**
1955
+ * Get svg data url
1956
+ */
1957
+ getSvgDataURL(): string;
1958
+ getDataURL(opts?: {
1959
+ type?: 'png' | 'jpeg' | 'svg';
1960
+ pixelRatio?: number;
1961
+ backgroundColor?: ZRColor;
1962
+ excludeComponents?: ComponentMainType[];
1963
+ }): string;
1964
+ getConnectedDataURL(opts?: {
1965
+ type?: 'png' | 'jpeg' | 'svg';
1966
+ pixelRatio?: number;
1967
+ backgroundColor?: ZRColor;
1968
+ connectedBackgroundColor?: ZRColor;
1969
+ excludeComponents?: string[];
1970
+ }): string;
1971
+ /**
1972
+ * Convert from logical coordinate system to pixel coordinate system.
1973
+ * See CoordinateSystem#convertToPixel.
1974
+ *
1975
+ * TODO / PENDING:
1976
+ * currently `convertToPixel` `convertFromPixel` `convertToLayout` may not be suitable
1977
+ * for some extremely performance-sensitive scenarios (such as, handling massive amounts of data),
1978
+ * since it performce "find component" every time.
1979
+ * And it is not friendly to the nuances between different coordinate systems.
1980
+ * @see https://github.com/apache/echarts/issues/20985 for details
1981
+ *
1982
+ * @see CoordinateSystem['dataToPoint'] for parameters and return.
1983
+ * @see CoordinateSystemDataCoord
1984
+ */
1985
+ convertToPixel(finder: ModelFinder$1, value: ScaleDataValue): number;
1986
+ convertToPixel(finder: ModelFinder$1, value: ScaleDataValue[]): number[];
1987
+ convertToPixel(finder: ModelFinder$1, value: ScaleDataValue | ScaleDataValue[]): number | number[];
1988
+ convertToPixel(finder: ModelFinder$1, value: (ScaleDataValue | ScaleDataValue[] | NullUndefined$1)[]): number | number[];
1989
+ /**
1990
+ * Convert from logical coordinate system to pixel coordinate system.
1991
+ * See CoordinateSystem#convertToPixel.
1992
+ *
1993
+ * @see CoordinateSystem['dataToLayout'] for parameters and return.
1994
+ * @see CoordinateSystemDataCoord
1995
+ */
1996
+ convertToLayout(finder: ModelFinder$1, value: (ScaleDataValue | NullUndefined$1) | (ScaleDataValue | ScaleDataValue[] | NullUndefined$1)[], opt?: unknown): CoordinateSystemDataLayout;
1997
+ /**
1998
+ * Convert from pixel coordinate system to logical coordinate system.
1999
+ * See CoordinateSystem#convertFromPixel.
2000
+ *
2001
+ * @see CoordinateSystem['pointToData'] for parameters and return.
2002
+ */
2003
+ convertFromPixel(finder: ModelFinder$1, value: number): number;
2004
+ convertFromPixel(finder: ModelFinder$1, value: number[]): number[];
2005
+ convertFromPixel(finder: ModelFinder$1, value: number | number[]): number | number[];
2006
+ /**
2007
+ * Is the specified coordinate systems or components contain the given pixel point.
2008
+ * @param {Array|number} value
2009
+ * @return {boolean} result
2010
+ */
2011
+ containPixel(finder: ModelFinder$1, value: number[]): boolean;
2012
+ /**
2013
+ * Get visual from series or data.
2014
+ * @param finder
2015
+ * If string, e.g., 'series', means {seriesIndex: 0}.
2016
+ * If Object, could contain some of these properties below:
2017
+ * {
2018
+ * seriesIndex / seriesId / seriesName,
2019
+ * dataIndex / dataIndexInside
2020
+ * }
2021
+ * If dataIndex is not specified, series visual will be fetched,
2022
+ * but not data item visual.
2023
+ * If all of seriesIndex, seriesId, seriesName are not specified,
2024
+ * visual will be fetched from first series.
2025
+ * @param visualType 'color', 'symbol', 'symbolSize'
2026
+ */
2027
+ getVisual(finder: ModelFinder$1, visualType: string): string | number | number[] | PatternObject | LinearGradientObject | RadialGradientObject;
2028
+ /**
2029
+ * Get view of corresponding component model
2030
+ */
2031
+ private getViewOfComponentModel;
2032
+ /**
2033
+ * Get view of corresponding series model
2034
+ */
2035
+ private getViewOfSeriesModel;
2036
+ private _initEvents;
2037
+ isDisposed(): boolean;
2038
+ clear(): void;
2039
+ dispose(): void;
2040
+ /**
2041
+ * Resize the chart
2042
+ */
2043
+ resize(opts?: ResizeOpts): void;
2044
+ /**
2045
+ * Show loading effect
2046
+ * @param name 'default' by default
2047
+ * @param cfg cfg of registered loading effect
2048
+ */
2049
+ showLoading(cfg?: object): void;
2050
+ showLoading(name?: string, cfg?: object): void;
2051
+ /**
2052
+ * Hide loading effect
2053
+ */
2054
+ hideLoading(): void;
2055
+ makeActionFromEvent(eventObj: ECActionEvent): Payload;
2056
+ /**
2057
+ * @param opt If pass boolean, means opt.silent
2058
+ * @param opt.silent Default `false`. Whether trigger events.
2059
+ * @param opt.flush Default `undefined`.
2060
+ * true: Flush immediately, and then pixel in canvas can be fetched
2061
+ * immediately. Caution: it might affect performance.
2062
+ * false: Not flush.
2063
+ * undefined: Auto decide whether perform flush.
2064
+ */
2065
+ dispatchAction(payload: Payload, opt?: boolean | {
2066
+ silent?: boolean;
2067
+ flush?: boolean | undefined;
2068
+ }): void;
2069
+ updateLabelLayout(): void;
2070
+ appendData(params: {
2071
+ seriesIndex: number;
2072
+ data: any;
2073
+ }): void;
2074
+ private static internalField;
2075
+ }
2076
+ /**
2077
+ * @param opts.devicePixelRatio Use window.devicePixelRatio by default
2078
+ * @param opts.renderer Can choose 'canvas' or 'svg' to render the chart.
2079
+ * @param opts.width Use clientWidth of the input `dom` by default.
2080
+ * Can be 'auto' (the same as null/undefined)
2081
+ * @param opts.height Use clientHeight of the input `dom` by default.
2082
+ * Can be 'auto' (the same as null/undefined)
2083
+ * @param opts.locale Specify the locale.
2084
+ * @param opts.useDirtyRect Enable dirty rectangle rendering or not.
2085
+ */
2086
+ interface EChartsType extends ECharts {}
231
2087
  //#endregion
232
- //#region src/chart-component.tsx
2088
+ //#region src/types.d.ts
2089
+ /** Chart event params — duck-typed to work across echarts entry points */
2090
+ interface ChartEventParams {
2091
+ componentType?: string;
2092
+ seriesType?: string;
2093
+ seriesIndex?: number;
2094
+ seriesName?: string;
2095
+ name?: string;
2096
+ dataIndex?: number;
2097
+ data?: unknown;
2098
+ dataType?: string;
2099
+ value?: unknown;
2100
+ color?: string;
2101
+ event?: Event;
2102
+ [key: string]: unknown;
2103
+ }
233
2104
  /**
234
- * Reactive chart component. Wraps useChart in a div with automatic
235
- * event binding.
236
- *
237
- * @example
238
- * ```tsx
239
- * // Default any chart type
240
- * <Chart
241
- * options={() => ({
242
- * series: [{ type: 'bar', data: revenue() }],
243
- * tooltip: {},
244
- * })}
245
- * style="height: 400px"
246
- * />
247
- *
248
- * // Strict — only specific chart types
249
- * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'
250
- * <Chart<ComposeOption<BarSeriesOption>>
251
- * options={() => ({
252
- * series: [{ type: 'bar', data: revenue() }],
253
- * })}
254
- * style="height: 400px"
255
- * />
256
- * ```
257
- */
258
- function Chart(props) {
259
- const chart = useChart(props.options, {
260
- theme: props.theme,
261
- renderer: props.renderer
262
- });
263
- effect(() => {
264
- const inst = chart.instance();
265
- if (!inst) return;
266
- if (props.onClick) inst.on("click", props.onClick);
267
- if (props.onMouseover) inst.on("mouseover", props.onMouseover);
268
- if (props.onMouseout) inst.on("mouseout", props.onMouseout);
269
- });
270
- return () => /* @__PURE__ */jsx("div", {
271
- ref: chart.ref,
272
- style: props.style,
273
- class: props.class
274
- });
2105
+ * Configuration for useChart.
2106
+ */
2107
+ interface UseChartConfig {
2108
+ /** ECharts theme — 'dark', a registered theme name, or a theme object */
2109
+ theme?: string | Record<string, unknown>;
2110
+ /** Renderer'canvas' (default, best performance) or 'svg' */
2111
+ renderer?: 'canvas' | 'svg';
2112
+ /** ECharts locale — 'EN' (default), 'ZH', etc. */
2113
+ locale?: string;
2114
+ /** Whether to replace all options instead of merging — default: false */
2115
+ notMerge?: boolean;
2116
+ /** Whether to batch updates — default: true */
2117
+ lazyUpdate?: boolean;
2118
+ /** Device pixel ratio — default: window.devicePixelRatio */
2119
+ devicePixelRatio?: number;
2120
+ /** Width override default: container width */
2121
+ width?: number;
2122
+ /** Height override — default: container height */
2123
+ height?: number;
2124
+ /** Called when chart instance is created */
2125
+ onInit?: (instance: EChartsType) => void;
275
2126
  }
276
-
2127
+ /**
2128
+ * Return type of useChart.
2129
+ */
2130
+ interface UseChartResult {
2131
+ /** Bind to container element via ref */
2132
+ ref: (el: Element | null) => void;
2133
+ /** The ECharts instance — null until mounted and modules loaded */
2134
+ instance: Signal<EChartsType | null>;
2135
+ /** True while ECharts modules are being dynamically imported */
2136
+ loading: Signal<boolean>;
2137
+ /** Error signal — set if chart init or setOption throws */
2138
+ error: Signal<Error | null>;
2139
+ /** Manually trigger resize */
2140
+ resize: () => void;
2141
+ }
2142
+ /**
2143
+ * Props for the <Chart /> component.
2144
+ * Generic parameter narrows the option type for exact autocomplete.
2145
+ */
2146
+ interface ChartProps<TOption extends EChartsOption = EChartsOption> extends Props {
2147
+ /** Reactive ECharts option config — fully typed */
2148
+ options: () => TOption;
2149
+ /** ECharts theme */
2150
+ theme?: string | Record<string, unknown>;
2151
+ /** Renderer — 'canvas' (default) or 'svg' */
2152
+ renderer?: 'canvas' | 'svg';
2153
+ /** CSS style for the container div */
2154
+ style?: string;
2155
+ /** CSS class for the container div */
2156
+ class?: string;
2157
+ /** Click event handler */
2158
+ onClick?: (params: ChartEventParams) => void;
2159
+ /** Mouseover event handler */
2160
+ onMouseover?: (params: ChartEventParams) => void;
2161
+ /** Mouseout event handler */
2162
+ onMouseout?: (params: ChartEventParams) => void;
2163
+ }
2164
+ //#endregion
2165
+ //#region src/chart-component.d.ts
2166
+ /**
2167
+ * Reactive chart component. Wraps useChart in a div with automatic
2168
+ * event binding.
2169
+ *
2170
+ * @example
2171
+ * ```tsx
2172
+ * // Default — any chart type
2173
+ * <Chart
2174
+ * options={() => ({
2175
+ * series: [{ type: 'bar', data: revenue() }],
2176
+ * tooltip: {},
2177
+ * })}
2178
+ * style="height: 400px"
2179
+ * />
2180
+ *
2181
+ * // Strict — only specific chart types
2182
+ * import type { ComposeOption, BarSeriesOption } from '@pyreon/charts'
2183
+ * <Chart<ComposeOption<BarSeriesOption>>
2184
+ * options={() => ({
2185
+ * series: [{ type: 'bar', data: revenue() }],
2186
+ * })}
2187
+ * style="height: 400px"
2188
+ * />
2189
+ * ```
2190
+ */
2191
+ declare function Chart<TOption extends EChartsOption$1 = EChartsOption$1>(props: ChartProps<TOption>): VNodeChild;
2192
+ //#endregion
2193
+ //#region src/loader.d.ts
2194
+ /**
2195
+ * Manually register ECharts modules (for tree-shaking entry point).
2196
+ * Call this at app startup instead of relying on auto-detection.
2197
+ *
2198
+ * @example
2199
+ * ```ts
2200
+ * import { use } from '@pyreon/charts/manual'
2201
+ * import { BarChart } from 'echarts/charts'
2202
+ * import { GridComponent, TooltipComponent } from 'echarts/components'
2203
+ * import { CanvasRenderer } from 'echarts/renderers'
2204
+ *
2205
+ * use(BarChart, GridComponent, TooltipComponent, CanvasRenderer)
2206
+ * ```
2207
+ */
2208
+ declare function manualUse(...modules: unknown[]): void;
2209
+ //#endregion
2210
+ //#region src/use-chart.d.ts
2211
+ /**
2212
+ * Reactive ECharts hook. Creates a chart instance bound to a container
2213
+ * element, with automatic module lazy-loading, signal tracking, resize
2214
+ * handling, error capture, and cleanup.
2215
+ *
2216
+ * Generic parameter `TOption` narrows the option type for exact autocomplete.
2217
+ * Use `ComposeOption<SeriesUnion>` from ECharts to restrict to specific chart types.
2218
+ *
2219
+ * @example
2220
+ * ```tsx
2221
+ * // Default — accepts any ECharts option
2222
+ * const chart = useChart(() => ({
2223
+ * series: [{ type: 'bar', data: revenue() }],
2224
+ * }))
2225
+ *
2226
+ * // Strict — only bar + line allowed, full autocomplete
2227
+ * import type { ComposeOption, BarSeriesOption, LineSeriesOption } from '@pyreon/charts'
2228
+ * type MyChartOption = ComposeOption<BarSeriesOption | LineSeriesOption>
2229
+ *
2230
+ * const chart = useChart<MyChartOption>(() => ({
2231
+ * series: [{ type: 'bar', data: revenue() }], // ✓
2232
+ * }))
2233
+ * ```
2234
+ */
2235
+ declare function useChart<TOption extends EChartsOption$1 = EChartsOption$1>(optionsFn: () => TOption, config?: UseChartConfig): UseChartResult;
277
2236
  //#endregion
278
- export { Chart, manualUse as use, useChart };
279
- //# sourceMappingURL=manual.d.ts.map
2237
+ export { Chart, type ChartProps, type EChartsOption, type UseChartConfig, type UseChartResult, manualUse as use, useChart };
2238
+ //# sourceMappingURL=manual2.d.ts.map