@flowgram.ai/utils 0.1.0-alpha.10

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.
@@ -0,0 +1,1365 @@
1
+ import { interfaces } from 'inversify';
2
+
3
+ /**
4
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ declare const PI: number;
8
+ /** Two Pi. */
9
+ declare const PI_2: number;
10
+ /** Conversion factor for converting radians to degrees. */
11
+ declare const RAD_TO_DEG: number;
12
+ /** Conversion factor for converting degrees to radians. */
13
+ declare const DEG_TO_RAD: number;
14
+ /** Constants that identify shapes. */
15
+ declare enum SHAPES {
16
+ /** Polygon */
17
+ POLY = 0,
18
+ /** Rectangle */
19
+ RECT = 1,
20
+ /** Circle */
21
+ CIRC = 2,
22
+ /** Ellipse */
23
+ ELIP = 3,
24
+ /** Rounded Rectangle */
25
+ RREC = 4
26
+ }
27
+
28
+ /**
29
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
30
+ * SPDX-License-Identifier: MIT
31
+ */
32
+ declare class Vector2 {
33
+ x: number;
34
+ y: number;
35
+ constructor(x?: number, y?: number);
36
+ /**
37
+ * 向量减法
38
+ */
39
+ sub(v: Vector2): Vector2;
40
+ /**
41
+ * 向量点乘
42
+ */
43
+ dot(v: Vector2): number;
44
+ }
45
+
46
+ /**
47
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
48
+ * SPDX-License-Identifier: MIT
49
+ */
50
+ /**
51
+ * Common interface for points. Both Point and ObservablePoint implement it
52
+ */
53
+ interface IPoint {
54
+ /**
55
+ * X coord
56
+ */
57
+ x: number;
58
+ /**
59
+ * Y coord
60
+ */
61
+ y: number;
62
+ }
63
+
64
+ /**
65
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
66
+ * SPDX-License-Identifier: MIT
67
+ */
68
+ type SchemaType = 'string' | 'integer' | 'float' | 'boolean' | 'enum' | 'object' | 'range' | 'color' | 'array';
69
+ interface SchemaMixinDefaults {
70
+ [defaultKey: string]: any;
71
+ }
72
+ interface SchemaDecoration<SCHEMA = any> {
73
+ type: SchemaType;
74
+ label?: string;
75
+ description?: string;
76
+ properties?: {
77
+ [K in keyof SCHEMA]: SchemaDecoration<SCHEMA[K]> & {
78
+ priority?: number;
79
+ };
80
+ };
81
+ enumValues?: (string | number)[];
82
+ enumType?: string | number;
83
+ enumLabels?: string[];
84
+ rangeStep?: number;
85
+ max?: number;
86
+ min?: number;
87
+ disabled?: boolean;
88
+ default?: SCHEMA;
89
+ mixinDefaults?: SchemaMixinDefaults;
90
+ }
91
+ declare namespace SchemaDecoration {
92
+ /**
93
+ * 扩展 SchemaDecoration
94
+ *
95
+ * @param properties - 定义新的属性
96
+ * @param baseDecoration - 基类
97
+ * @param mixinDefaults - 修改默认值
98
+ * @example
99
+ * const MySchemaDecoration = SchemaDecoration.create({
100
+ * myProp: { label: '', default: 1, type: 'number' }
101
+ * },
102
+ * TransformSchemaDecoration, // 继承 Transform
103
+ * {
104
+ * 'size.width': 100, // 修改 size 的默认值
105
+ * 'size.height': 100,
106
+ * })
107
+ */
108
+ function create<T>(properties: {
109
+ [key: string]: SchemaDecoration;
110
+ }, baseDecoration?: SchemaDecoration, mixinDefaults?: SchemaMixinDefaults): SchemaDecoration<T>;
111
+ }
112
+ declare namespace Schema {
113
+ function createDefault<T>(decoration: SchemaDecoration, mixinDefaults?: SchemaMixinDefaults, _key?: string): T;
114
+ /**
115
+ * 非 object 类
116
+ */
117
+ function isBaseType(decoration: SchemaDecoration): boolean;
118
+ }
119
+
120
+ /**
121
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
122
+ * SPDX-License-Identifier: MIT
123
+ */
124
+
125
+ interface PositionSchema {
126
+ x: number;
127
+ y: number;
128
+ }
129
+ type RotationSchema = number;
130
+ interface OriginSchema {
131
+ x: number;
132
+ y: number;
133
+ }
134
+ interface ScaleSchema {
135
+ x: number;
136
+ y: number;
137
+ }
138
+ interface ScrollSchema {
139
+ scrollX: number;
140
+ scrollY: number;
141
+ }
142
+ interface SkewSchema {
143
+ x: number;
144
+ y: number;
145
+ }
146
+ declare const SizeSchemaDecoration: SchemaDecoration<SizeSchema>;
147
+ declare const OriginSchemaDecoration: SchemaDecoration<OriginSchema>;
148
+ declare const PositionSchemaDecoration: SchemaDecoration<PositionSchema>;
149
+ declare const RotationSchemaDecoration: SchemaDecoration<RotationSchema>;
150
+ declare const ScaleSchemaDecoration: SchemaDecoration<ScaleSchema>;
151
+ declare const SkewSchemaDecoration: SchemaDecoration<SkewSchema>;
152
+ declare const TransformSchemaDecoration: SchemaDecoration<TransformSchema>;
153
+ interface TransformSchema {
154
+ position: PositionSchema;
155
+ size: SizeSchema;
156
+ origin: OriginSchema;
157
+ scale: ScaleSchema;
158
+ skew: SkewSchema;
159
+ rotation: RotationSchema;
160
+ }
161
+ declare namespace TransformSchema {
162
+ function createDefault(): TransformSchema;
163
+ function toJSON(obj: TransformSchema): TransformSchema;
164
+ function getDelta(oldTransform: TransformSchema, newTransform: TransformSchema): TransformSchema;
165
+ function mergeDelta(oldTransform: TransformSchema, newTransformDelta: TransformSchema, toFixedNum?: number): TransformSchema;
166
+ function is(obj: object): obj is TransformSchema;
167
+ }
168
+ interface SizeSchema {
169
+ width: number;
170
+ height: number;
171
+ locked?: boolean;
172
+ }
173
+ declare namespace SizeSchema {
174
+ /**
175
+ * 适配父节点宽高
176
+ *
177
+ * @return 返回需要缩放的比例,为 1 则不缩放
178
+ */
179
+ function fixSize(currentSize: SizeSchema, parentSize: SizeSchema): number;
180
+ /**
181
+ * 填充父节点的宽高
182
+ *
183
+ * @return 返回放大的比例
184
+ */
185
+ function coverSize(currentSize: SizeSchema, parentSize: SizeSchema): number;
186
+ function empty(): SizeSchema;
187
+ }
188
+
189
+ /**
190
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
191
+ * SPDX-License-Identifier: MIT
192
+ */
193
+
194
+ type OpacitySchema = number;
195
+ interface FlipSchema {
196
+ x: boolean;
197
+ y: boolean;
198
+ }
199
+ interface ShadowSchema {
200
+ color: string;
201
+ offsetX: number;
202
+ offsetY: number;
203
+ blur: number;
204
+ }
205
+ interface PaddingSchema {
206
+ left: number;
207
+ right: number;
208
+ top: number;
209
+ bottom: number;
210
+ }
211
+ declare namespace PaddingSchema {
212
+ const empty: () => {
213
+ left: number;
214
+ right: number;
215
+ top: number;
216
+ bottom: number;
217
+ };
218
+ }
219
+ type MarginSchema = PaddingSchema;
220
+ interface TintSchema {
221
+ topLeft: string;
222
+ topRight: string;
223
+ bottomLeft: string;
224
+ bottomRight: string;
225
+ }
226
+ declare namespace TintSchema {
227
+ function isEmpty(tint: Partial<TintSchema> | undefined): boolean;
228
+ }
229
+ declare const CropSchemaDecoration: SchemaDecoration<PositionSchema & SizeSchema>;
230
+ declare const FlipSchemaDecoration: SchemaDecoration<FlipSchema>;
231
+ declare const PaddingSchemaDecoration: SchemaDecoration<PaddingSchema>;
232
+ declare const ShadowSchemaDecoration: SchemaDecoration<ShadowSchema>;
233
+ declare const TintSchemaDecoration: SchemaDecoration<TintSchema>;
234
+ declare const OpacitySchemaDecoration: SchemaDecoration<OpacitySchema>;
235
+
236
+ /**
237
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
238
+ * SPDX-License-Identifier: MIT
239
+ */
240
+
241
+ /**
242
+ * Size object, contains width and height
243
+ */
244
+ type ISize = {
245
+ width: number;
246
+ height: number;
247
+ };
248
+ declare enum RectangleAlignType {
249
+ ALIGN_LEFT = "align-left",
250
+ ALIGN_CENTER = "align-center",
251
+ ALIGN_RIGHT = "align-right",
252
+ ALIGN_TOP = "align-top",
253
+ ALIGN_MIDDLE = "align-middle",
254
+ ALIGN_BOTTOM = "align-bottom",
255
+ DISTRIBUTE_HORIZONTAL = "distribute-horizontal",
256
+ DISTRIBUTE_VERTICAL = "distribute-vertical"
257
+ }
258
+ declare enum RectangleAlignTitle {
259
+ ALIGN_LEFT = "\u5DE6\u5BF9\u9F50",
260
+ ALIGN_CENTER = "\u5DE6\u53F3\u5C45\u4E2D\u5BF9\u9F50",
261
+ ALIGN_RIGHT = "\u53F3\u5BF9\u9F50",
262
+ ALIGN_TOP = "\u4E0A\u5BF9\u9F50",
263
+ ALIGN_MIDDLE = "\u4E0A\u4E0B\u5C45\u4E2D\u5BF9\u9F50",
264
+ ALIGN_BOTTOM = "\u4E0B\u5BF9\u9F50",
265
+ DISTRIBUTE_HORIZONTAL = "\u6C34\u5E73\u5E73\u5747\u5206\u5E03",
266
+ DISTRIBUTE_VERTICAL = "\u5782\u76F4\u5E73\u5747\u5206\u5E03"
267
+ }
268
+ /**
269
+ * Rectangle object is an area defined by its position, as indicated by its top-left corner
270
+ * point (x, y) and by its width and its height.
271
+ */
272
+ declare class Rectangle {
273
+ x: number;
274
+ y: number;
275
+ width: number;
276
+ height: number;
277
+ /**
278
+ * The type of the object, mainly used to avoid `instanceof` checks
279
+ */
280
+ readonly type = SHAPES.RECT;
281
+ /**
282
+ * @param [x] - The X coordinate of the upper-left corner of the rectangle
283
+ * @param [y] - The Y coordinate of the upper-left corner of the rectangle
284
+ * @param [width] - The overall width of this rectangle
285
+ * @param [height] - The overall height of this rectangle
286
+ */
287
+ constructor(x?: number, y?: number, width?: number, height?: number);
288
+ /**
289
+ * A constant empty rectangle. MUST NOT modify properties!
290
+ */
291
+ static get EMPTY(): Rectangle;
292
+ get left(): number;
293
+ get right(): number;
294
+ get top(): number;
295
+ get bottom(): number;
296
+ /**
297
+ * Creates a clone of this Rectangle.
298
+ *
299
+ * @return a copy of the rectangle
300
+ */
301
+ clone(): Rectangle;
302
+ /**
303
+ * Copies another rectangle to this one.
304
+ *
305
+ * @return Returns itself.
306
+ */
307
+ copyFrom(rectangle: Rectangle): Rectangle;
308
+ /**
309
+ * Copies this rectangle to another one.
310
+ *
311
+ * @return Returns given rectangle.
312
+ */
313
+ copyTo(rectangle: Rectangle): Rectangle;
314
+ /**
315
+ * Checks whether the x and y coordinates given are contained within this Rectangle
316
+ *
317
+ * @param x - The X coordinate of the point to test
318
+ * @param y - The Y coordinate of the point to test
319
+ * @return Whether the x/y coordinates are within this Rectangle
320
+ */
321
+ contains(x: number, y: number): boolean;
322
+ isEqual(rect: Rectangle): boolean;
323
+ containsRectangle(rect: Rectangle): boolean;
324
+ /**
325
+ * Pads the rectangle making it grow in all directions.
326
+ * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.
327
+ *
328
+ * @param [paddingX] - The horizontal padding amount.
329
+ * @param [paddingY] - The vertical padding amount.
330
+ */
331
+ pad(paddingX?: number, paddingY?: number): this;
332
+ /**
333
+ * Fits this rectangle around the passed one.
334
+ * Intersection 交集
335
+ */
336
+ fit(rectangle: Rectangle): this;
337
+ /**
338
+ * Enlarges rectangle that way its corners lie on grid
339
+ */
340
+ ceil(resolution?: number, precision?: number): this;
341
+ /**
342
+ * Enlarges this rectangle to include the passed rectangle.
343
+ */
344
+ enlarge(rectangle: Rectangle): this;
345
+ get center(): IPoint;
346
+ get rightBottom(): IPoint;
347
+ get leftBottom(): IPoint;
348
+ get rightTop(): IPoint;
349
+ get leftTop(): IPoint;
350
+ get bottomCenter(): IPoint;
351
+ get topCenter(): IPoint;
352
+ get rightCenter(): IPoint;
353
+ get leftCenter(): IPoint;
354
+ update(fn: (rect: Rectangle) => Rectangle): Rectangle;
355
+ get crossDistance(): number;
356
+ toStyleStr(): string;
357
+ withPadding(padding: PaddingSchema): this;
358
+ withoutPadding(padding: PaddingSchema): this;
359
+ withHeight(height: number): this;
360
+ clearSpace(): this;
361
+ }
362
+ declare namespace Rectangle {
363
+ /**
364
+ * 矩形对齐
365
+ */
366
+ function align(rectangles: Rectangle[], type: RectangleAlignType): Rectangle[];
367
+ /**
368
+ * 获取所有矩形的外围最大边框
369
+ */
370
+ function enlarge(rectangles: Rectangle[]): Rectangle;
371
+ /**
372
+ * 判断矩形相交
373
+ *
374
+ * @param [direction] 判断单一方向
375
+ */
376
+ function intersects(target1: Rectangle, target2: Rectangle, direction?: 'horizontal' | 'vertical'): boolean;
377
+ /**
378
+ * 使用 OBB 算法判断两个旋转矩形是否相交
379
+ * @param rotate1 单位 radian
380
+ * @param rotate2 单位 radian
381
+ */
382
+ function intersectsWithRotation(rect1: Rectangle, rotate1: number, rect2: Rectangle, rotate2: number): boolean;
383
+ /**
384
+ * 判断指定 rect 是否在 viewport 可见
385
+ *
386
+ * @param rotation rect 旋转,单位 radian
387
+ * @param isContains 整个 bounds 是否全部可见
388
+ */
389
+ function isViewportVisible(rect: Rectangle, viewport: Rectangle, rotation?: number, isContains?: boolean): boolean;
390
+ /**
391
+ * 保证bounds 永远在 viewport 里边
392
+ *
393
+ * @param bounds
394
+ * @param viewport
395
+ * @param padding 距离 viewport 的安全边界
396
+ */
397
+ function setViewportVisible(bounds: Rectangle, viewport: Rectangle, padding?: number): Rectangle;
398
+ /**
399
+ * 根据两点创建矩形
400
+ */
401
+ function createRectangleWithTwoPoints(point1: IPoint, point2: IPoint): Rectangle;
402
+ }
403
+ /**
404
+ * Oriented Bounding Box (OBB)
405
+ * @see https://en.wikipedia.org/wiki/Bounding_volume
406
+ */
407
+ declare class OBBRect {
408
+ protected width: number;
409
+ protected height: number;
410
+ readonly axesX: Vector2;
411
+ readonly axesY: Vector2;
412
+ readonly centerPoint: Vector2;
413
+ /**
414
+ * @param rotation in radian
415
+ */
416
+ constructor(centerPoint: IPoint, width: number, height: number, rotation: number);
417
+ /**
418
+ * 计算投影半径
419
+ */
420
+ getProjectionRadius(axis: Vector2): number;
421
+ }
422
+
423
+ /**
424
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
425
+ * SPDX-License-Identifier: MIT
426
+ */
427
+
428
+ /**
429
+ * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.
430
+ */
431
+ declare class Circle {
432
+ x: number;
433
+ y: number;
434
+ radius: number;
435
+ /**
436
+ * The type of the object, mainly used to avoid `instanceof` checks
437
+ */
438
+ readonly type = SHAPES.CIRC;
439
+ /**
440
+ * @param x Circle center x
441
+ * @param y Circle center y
442
+ */
443
+ constructor(x?: number, y?: number, radius?: number);
444
+ /**
445
+ * Creates a clone of this Circle instance
446
+ *
447
+ * @return a copy of the Circle
448
+ */
449
+ clone(): Circle;
450
+ /**
451
+ * Checks whether the x and y coordinates given are contained within this circle
452
+ *
453
+ * @return Whether the (x, y) coordinates are within this Circle
454
+ */
455
+ contains(x: number, y: number): boolean;
456
+ /**
457
+ * Returns the framing rectangle of the circle as a Rectangle object
458
+ *
459
+ * @return the framing rectangle
460
+ */
461
+ getBounds(): Rectangle;
462
+ }
463
+
464
+ /**
465
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
466
+ * SPDX-License-Identifier: MIT
467
+ */
468
+
469
+ /**
470
+ * The Point object represents a location in a two-dimensional coordinate system, where x represents
471
+ * the horizontal axis and y represents the vertical axis.
472
+ *
473
+ * An ObservablePoint is a point that triggers a callback when the point's position is changed.
474
+ */
475
+ declare class ObservablePoint<T = any> implements IPoint {
476
+ cb: (this: T) => any;
477
+ scope: any;
478
+ /**
479
+ * @param {Function} cb - callback when changed
480
+ * @param {object} scope - owner of callback
481
+ * @param {number} [x=0] - position of the point on the x axis
482
+ * @param {number} [y=0] - position of the point on the y axis
483
+ */
484
+ constructor(cb: (this: T) => any, scope: T, x?: number, y?: number);
485
+ _x: number;
486
+ /**
487
+ * The position of the displayObject on the x axis relative to the local coordinates of the parent.
488
+ */
489
+ get x(): number;
490
+ set x(value: number);
491
+ _y: number;
492
+ /**
493
+ * The position of the displayObject on the x axis relative to the local coordinates of the parent.
494
+ */
495
+ get y(): number;
496
+ set y(value: number);
497
+ /**
498
+ * Creates a clone of this point.
499
+ * The callback and scope params can be overidden otherwise they will default
500
+ * to the clone object's values.
501
+ *
502
+ * @override
503
+ * @param {Function} [cb=null] - callback when changed
504
+ * @param {object} [scope=null] - owner of callback
505
+ * @return {ObservablePoint} a copy of the point
506
+ */
507
+ clone(cb?: (this: T) => any, scope?: any): ObservablePoint;
508
+ /**
509
+ * Sets the point to a new x and y position.
510
+ * If y is omitted, both x and y will be set to x.
511
+ *
512
+ * @param {number} [x=0] - position of the point on the x axis
513
+ * @param {number} [y=x] - position of the point on the y axis
514
+ * @returns {this} Returns itself.
515
+ */
516
+ set(x?: number, y?: number): this;
517
+ /**
518
+ * Copies x and y from the given point
519
+ *
520
+ * @param {IPoint} p - The point to copy from.
521
+ * @returns {this} Returns itself.
522
+ */
523
+ copyFrom(p: IPoint): this;
524
+ /**
525
+ * Copies x and y into the given point
526
+ *
527
+ * @param {IPoint} p - The point to copy.
528
+ * @returns {IPoint} Given point with values updated
529
+ */
530
+ copyTo<T2 extends IPoint>(p: T2): T2;
531
+ /**
532
+ * Returns true if the given point is equal to this point
533
+ *
534
+ * @param {IPoint} p - The point to check
535
+ * @returns {boolean} Whether the given point equal to this point
536
+ */
537
+ equals(p: IPoint): boolean;
538
+ }
539
+
540
+ /**
541
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
542
+ * SPDX-License-Identifier: MIT
543
+ */
544
+
545
+ /**
546
+ * Transform that takes care about its versions
547
+ *
548
+ * @class
549
+ * @memberof PIXI
550
+ */
551
+ declare class Transform {
552
+ /**
553
+ * A default (identity) transform
554
+ *
555
+ * @static
556
+ * @constant
557
+ * @member {PIXI.Transform}
558
+ */
559
+ static readonly IDENTITY: Transform;
560
+ worldTransform: Matrix;
561
+ localTransform: Matrix;
562
+ position: ObservablePoint;
563
+ scale: ObservablePoint;
564
+ pivot: ObservablePoint;
565
+ skew: ObservablePoint;
566
+ _parentID: number;
567
+ _worldID: number;
568
+ protected _rotation: number;
569
+ protected _cx: number;
570
+ protected _sx: number;
571
+ protected _cy: number;
572
+ protected _sy: number;
573
+ protected _localID: number;
574
+ protected _currentLocalID: number;
575
+ constructor();
576
+ /**
577
+ * Called when a value changes.
578
+ *
579
+ * @protected
580
+ */
581
+ protected onChange(): void;
582
+ /**
583
+ * Called when the skew or the rotation changes.
584
+ *
585
+ * @protected
586
+ */
587
+ protected updateSkew(): void;
588
+ /**
589
+ * Updates the local transformation matrix.
590
+ */
591
+ updateLocalTransform(): void;
592
+ /**
593
+ * Updates the local and the world transformation matrices.
594
+ *
595
+ * @param {PIXI.Transform} parentTransform - The parent transform
596
+ */
597
+ updateTransform(parentTransform: Transform): void;
598
+ /**
599
+ * Decomposes a matrix and sets the transforms properties based on it.
600
+ *
601
+ * @param {PIXI.Matrix} matrix - The matrix to decompose
602
+ */
603
+ setFromMatrix(matrix: Matrix): void;
604
+ /**
605
+ * The rotation of the object in radians.
606
+ *
607
+ * @member {number}
608
+ */
609
+ get rotation(): number;
610
+ set rotation(value: number);
611
+ }
612
+
613
+ /**
614
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
615
+ * SPDX-License-Identifier: MIT
616
+ */
617
+
618
+ /**
619
+ * The PIXIJS Matrix as a class makes it a lot faster.
620
+ *
621
+ * Here is a representation of it:
622
+ * ```js
623
+ * | a | c | tx|
624
+ * | b | d | ty|
625
+ * | 0 | 0 | 1 |
626
+ * // default:
627
+ * | 1 | 0 | 0 |
628
+ * | 0 | 1 | 0 |
629
+ * | 0 | 0 | 1 |
630
+ * ```
631
+ */
632
+ declare class Matrix {
633
+ a: number;
634
+ b: number;
635
+ c: number;
636
+ d: number;
637
+ tx: number;
638
+ ty: number;
639
+ array: Float32Array | null;
640
+ /**
641
+ * @param [a] x scale
642
+ * @param [b] x skew
643
+ * @param [c] y skew
644
+ * @param [d] y scale
645
+ * @param [tx] x translation
646
+ * @param [ty] y translation
647
+ */
648
+ constructor(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number);
649
+ /**
650
+ * A default (identity) matrix
651
+ */
652
+ static get IDENTITY(): Matrix;
653
+ /**
654
+ * A temp matrix
655
+ */
656
+ static get TEMP_MATRIX(): Matrix;
657
+ /**
658
+ * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:
659
+ *
660
+ * @param array The array that the matrix will be populated from.
661
+ */
662
+ fromArray(array: number[]): this;
663
+ /**
664
+ * sets the matrix properties
665
+ *
666
+ * @param a Matrix component
667
+ * @param b Matrix component
668
+ * @param c Matrix component
669
+ * @param d Matrix component
670
+ * @param tx Matrix component
671
+ * @param ty Matrix component
672
+ */
673
+ set(a: number, b: number, c: number, d: number, tx: number, ty: number): this;
674
+ /**
675
+ * Creates an array from the current Matrix object.
676
+ *
677
+ * @param transpose Whether we need to transpose the matrix or not
678
+ * @param [out=new Float32Array(9)] If provided the array will be assigned to out
679
+ * @return the newly created array which contains the matrix
680
+ */
681
+ toArray(transpose: boolean, out?: Float32Array): Float32Array;
682
+ /**
683
+ * Get a new position with the current transformation applied.
684
+ * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)
685
+ *
686
+ * @param pos The origin
687
+ * @param [newPos] The point that the new position is assigned to (allowed to be same as input)
688
+ * @return The new point, transformed through this matrix
689
+ */
690
+ apply(pos: IPoint, newPos?: IPoint): IPoint;
691
+ /**
692
+ * Get a new position with the inverse of the current transformation applied.
693
+ * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)
694
+ *
695
+ * @param pos The origin
696
+ * @param [newPos] The point that the new position is assigned to (allowed to be same as input)
697
+ * @return The new point, inverse-transformed through this matrix
698
+ */
699
+ applyInverse(pos: IPoint, newPos?: IPoint): IPoint;
700
+ /**
701
+ * Translates the matrix on the x and y.
702
+ *
703
+ * @param x How much to translate x by
704
+ * @param y How much to translate y by
705
+ */
706
+ translate(x: number, y: number): this;
707
+ /**
708
+ * Applies a scale transformation to the matrix.
709
+ *
710
+ * @param x The amount to scale horizontally
711
+ * @param y The amount to scale vertically
712
+ */
713
+ scale(x: number, y: number): this;
714
+ /**
715
+ * Applies a rotation transformation to the matrix.
716
+ *
717
+ * @param angle The angle in radians.
718
+ */
719
+ rotate(angle: number): this;
720
+ /**
721
+ * 矩阵乘法,当前矩阵 * matrix
722
+ * Appends the given Matrix to this Matrix.
723
+ */
724
+ append(matrix: Matrix): this;
725
+ /**
726
+ * Sets the matrix based on all the available properties
727
+ *
728
+ * @param x Position on the x axis
729
+ * @param y Position on the y axis
730
+ * @param pivotX Pivot on the x axis
731
+ * @param pivotY Pivot on the y axis
732
+ * @param scaleX Scale on the x axis
733
+ * @param scaleY Scale on the y axis
734
+ * @param rotation Rotation in radians
735
+ * @param skewX Skew on the x axis
736
+ * @param skewY Skew on the y axis
737
+ */
738
+ setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number, scaleY: number, rotation: number, skewX: number, skewY: number): this;
739
+ /**
740
+ * 矩阵乘法,matrix * 当前矩阵
741
+ * Prepends the given Matrix to this Matrix.
742
+ */
743
+ prepend(matrix: Matrix): this;
744
+ /**
745
+ * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.
746
+ *
747
+ * @param transform The transform to apply the properties to.
748
+ * @return The transform with the newly applied properties
749
+ */
750
+ decompose(transform: Transform): Transform;
751
+ /**
752
+ * Inverts this matrix
753
+ */
754
+ invert(): this;
755
+ /**
756
+ * Resets this Matrix to an identity (default) matrix.
757
+ */
758
+ identity(): this;
759
+ /**
760
+ * 未做旋转的矩阵
761
+ */
762
+ isSimple(): boolean;
763
+ /**
764
+ * Creates a new Matrix object with the same values as this one.
765
+ *
766
+ * @return A copy of this matrix.
767
+ */
768
+ clone(): Matrix;
769
+ /**
770
+ * Changes the values of the given matrix to be the same as the ones in this matrix
771
+ *
772
+ * @return The matrix given in parameter with its values updated.
773
+ */
774
+ copyTo(matrix: Matrix): Matrix;
775
+ /**
776
+ * Changes the values of the matrix to be the same as the ones in given matrix
777
+ */
778
+ copyFrom(matrix: Matrix): this;
779
+ }
780
+
781
+ /**
782
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
783
+ * SPDX-License-Identifier: MIT
784
+ */
785
+
786
+ /**
787
+ * The Point object represents a location in a two-dimensional coordinate system, where x represents
788
+ * the horizontal axis and y represents the vertical axis.
789
+ *
790
+ * @class
791
+ * @memberof PIXI
792
+ * @implements IPoint
793
+ */
794
+ declare class Point implements IPoint {
795
+ x: number;
796
+ y: number;
797
+ constructor(x?: number, y?: number);
798
+ /**
799
+ * Creates a clone of this point
800
+ *
801
+ * @return {Point} a copy of the point
802
+ */
803
+ clone(): Point;
804
+ /**
805
+ * Copies x and y from the given point
806
+ *
807
+ * @param {IPoint} p - The point to copy from
808
+ * @returns {this} Returns itself.
809
+ */
810
+ copyFrom(p: IPoint): this;
811
+ /**
812
+ * Copies x and y into the given point
813
+ *
814
+ * @param {IPoint} p - The point to copy.
815
+ * @returns {IPoint} Given point with values updated
816
+ */
817
+ copyTo<T extends IPoint>(p: T): T;
818
+ /**
819
+ * Returns true if the given point is equal to this point
820
+ *
821
+ * @param {IPoint} p - The point to check
822
+ * @returns {boolean} Whether the given point equal to this point
823
+ */
824
+ equals(p: IPoint): boolean;
825
+ /**
826
+ * Sets the point to a new x and y position.
827
+ * If y is omitted, both x and y will be set to x.
828
+ *
829
+ * @param {number} [x=0] - position of the point on the x axis
830
+ * @param {number} [y=x] - position of the point on the y axis
831
+ * @returns {this} Returns itself.
832
+ */
833
+ set(x?: number, y?: number): this;
834
+ }
835
+ declare namespace Point {
836
+ const EMPTY: IPoint;
837
+ /**
838
+ * 获取两点间的距离
839
+ * @param p1
840
+ * @param p2
841
+ */
842
+ function getDistance(p1: IPoint, p2: IPoint): number;
843
+ /**
844
+ * 获取两点间的中间点
845
+ * @param p1
846
+ * @param p2
847
+ */
848
+ function getMiddlePoint(p1: IPoint, p2: IPoint): IPoint;
849
+ /**
850
+ * 按一定比例,获取两点间的中间点
851
+ * @param p1
852
+ * @param p2
853
+ */
854
+ function getRatioPoint(p1: IPoint, p2: IPoint, ratio: number): IPoint;
855
+ function fixZero(output: IPoint): IPoint;
856
+ /**
857
+ * 往目标点移动 distance 距离
858
+ * @param current
859
+ * @param direction
860
+ */
861
+ function move(current: IPoint, m: Partial<IPoint>): IPoint;
862
+ /**
863
+ * 往目标点移动 distance 距离
864
+ * @param current
865
+ * @param direction
866
+ */
867
+ function moveDistanceToDirection(current: IPoint, direction: IPoint, distance: number): IPoint;
868
+ }
869
+
870
+ /**
871
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
872
+ * SPDX-License-Identifier: MIT
873
+ */
874
+
875
+ declare namespace Angle {
876
+ /**
877
+ * Wrap an angle.
878
+ *
879
+ * Wraps the angle to a value in the range of -PI to PI.
880
+ *
881
+ * @param angle - The angle to wrap, in radians.
882
+ * @return The wrapped angle, in radians.
883
+ */
884
+ function wrap(angle: number): number;
885
+ /**
886
+ * Wrap an angle in degrees.
887
+ *
888
+ * Wraps the angle to a value in the range of -180 to 180.
889
+ *
890
+ * @param angle - The angle to wrap, in degrees.
891
+ * @return The wrapped angle, in degrees.
892
+ */
893
+ function wrapDegrees(angle: number): number;
894
+ /**
895
+ * 计算两个点的夹角
896
+ *
897
+ * @return The angle in radians.
898
+ */
899
+ function betweenPoints(point1: IPoint, point2: IPoint, originPoint?: IPoint): number;
900
+ }
901
+
902
+ /**
903
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
904
+ * SPDX-License-Identifier: MIT
905
+ */
906
+ declare function deepFreeze<T>(obj: T): T;
907
+ declare function notEmpty<T>(arg: T | undefined | null): arg is T;
908
+ /**
909
+ * `true` if the argument is an empty object. Otherwise, `false`.
910
+ */
911
+ declare function isEmpty(arg: Object): boolean;
912
+ declare const each: <T = any, K = string>(obj: any, fn: (value: T, key: K) => void) => void;
913
+ declare const values: (obj: any) => any[];
914
+ declare const filter: (obj: any, fn: (value: any, key: string) => boolean, dest?: any) => any;
915
+ declare const pick: (obj: any, fields: string[], dest?: any) => any;
916
+ declare const omit: (obj: any, fields: string[], dest?: any) => any;
917
+ declare const reduce: <V = any, R = any>(obj: any, fn: (res: R, value: V, key: string) => any, res?: R) => R;
918
+ declare const mapValues: <V = any>(obj: any, fn: (value: V, key: string) => any) => any;
919
+ declare const mapKeys: <V = any>(obj: any, fn: (value: V, key: string) => any) => any;
920
+ /**
921
+ * @param target
922
+ * @param key
923
+ * @example
924
+ * const obj = {
925
+ * position: {
926
+ * x: 0
927
+ * y: 0
928
+ * }
929
+ * }
930
+ * getByKey(ob, 'position.x') // 0
931
+ */
932
+ declare function getByKey(target: any, key: string): any | undefined;
933
+ /**
934
+ * @param target
935
+ * @param key
936
+ * @param newValue
937
+ * @param autoCreateObject
938
+ * @example
939
+ * const obj = {
940
+ * position: {
941
+ * x: 0
942
+ * y: 0
943
+ * }
944
+ * }
945
+ * setByKey(ob, 'position.x', 100) // true
946
+ * setByKey(obj, 'size.width', 100) // false
947
+ * setBeyKey(obj, 'size.width', 100, true) // true
948
+ */
949
+ declare function setByKey(target: any, key: string, newValue: any, autoCreateObject?: boolean, clone?: boolean): any;
950
+ declare const NOOP: () => void;
951
+ /**
952
+ * @param obj The object to inspect.
953
+ * @returns True if the argument appears to be a plain object.
954
+ */
955
+ declare function isPlainObject(obj: any): boolean;
956
+
957
+ /**
958
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
959
+ * SPDX-License-Identifier: MIT
960
+ */
961
+ interface AsClass<T> {
962
+ new (...args: any[]): T;
963
+ }
964
+ type UnknownObject<T extends object> = Record<string | number | symbol, unknown> & {
965
+ [K in keyof T]: unknown;
966
+ };
967
+ declare function isObject<T extends object>(v: unknown): v is UnknownObject<T>;
968
+ declare function isString(v: unknown): v is string;
969
+ declare function isFunction<T extends (...args: unknown[]) => unknown>(v: unknown): v is T;
970
+ declare function getTag(v: unknown): string;
971
+ declare function isNumber(v: unknown): v is number;
972
+ type MaybeArray<T> = T | T[];
973
+ type MaybePromise<T> = T | PromiseLike<T>;
974
+ type RecursivePartial<T> = {
975
+ [P in keyof T]?: T[P] extends Array<infer I> ? Array<RecursivePartial<I>> : RecursivePartial<T[P]>;
976
+ };
977
+
978
+ /**
979
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
980
+ * SPDX-License-Identifier: MIT
981
+ */
982
+ /**
983
+ * An object that performs a cleanup operation when `.dispose()` is called.
984
+ *
985
+ * Some examples of how disposables are used:
986
+ *
987
+ * - An event listener that removes itself when `.dispose()` is called.
988
+ * - The return value from registering a provider. When `.dispose()` is called, the provider is unregistered.
989
+ */
990
+ interface Disposable {
991
+ dispose(): void;
992
+ }
993
+ declare namespace Disposable {
994
+ function is(thing: any): thing is Disposable;
995
+ function create(func: () => void): Disposable;
996
+ const NULL: Readonly<Disposable>;
997
+ }
998
+
999
+ /**
1000
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1001
+ * SPDX-License-Identifier: MIT
1002
+ */
1003
+
1004
+ interface EventListener$1<T> {
1005
+ (args: T): void;
1006
+ }
1007
+ interface Event<T> {
1008
+ (listener: EventListener$1<T>, thisArgs?: any): Disposable;
1009
+ }
1010
+ declare namespace Event {
1011
+ const None: Event<any>;
1012
+ }
1013
+ declare class Emitter<T = any> {
1014
+ static LEAK_WARNING_THRESHHOLD: number;
1015
+ private _event?;
1016
+ private _listeners?;
1017
+ private _disposed;
1018
+ get event(): Event<T>;
1019
+ fire(event: T): void;
1020
+ get disposed(): boolean;
1021
+ dispose(): void;
1022
+ }
1023
+
1024
+ /**
1025
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1026
+ * SPDX-License-Identifier: MIT
1027
+ */
1028
+
1029
+ declare class DisposableImpl implements Disposable {
1030
+ readonly toDispose: DisposableCollection;
1031
+ dispose(): void;
1032
+ get disposed(): boolean;
1033
+ get onDispose(): Event<void>;
1034
+ }
1035
+ declare class DisposableCollection implements Disposable {
1036
+ protected readonly disposables: Disposable[];
1037
+ protected readonly onDisposeEmitter: Emitter<void>;
1038
+ private _disposed;
1039
+ constructor(...toDispose: Disposable[]);
1040
+ get length(): number;
1041
+ get onDispose(): Event<void>;
1042
+ get disposed(): boolean;
1043
+ dispose(): void;
1044
+ push(disposable: Disposable): Disposable;
1045
+ pushAll(disposables: Disposable[]): Disposable[];
1046
+ }
1047
+
1048
+ /**
1049
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1050
+ * SPDX-License-Identifier: MIT
1051
+ */
1052
+
1053
+ interface CancellationToken {
1054
+ /**
1055
+ * A flag signalling is cancellation has been requested.
1056
+ */
1057
+ readonly isCancellationRequested: boolean;
1058
+ /**
1059
+ * An event which fires when cancellation is requested. This event
1060
+ * only ever fires `once` as cancellation can only happen once. Listeners
1061
+ * that are registered after cancellation will be called (next event loop run),
1062
+ * but also only once.
1063
+ * @event
1064
+ */
1065
+ readonly onCancellationRequested: Event<void>;
1066
+ }
1067
+ declare namespace CancellationToken {
1068
+ function isCancellationToken(thing: unknown): thing is CancellationToken;
1069
+ const None: Readonly<CancellationToken>;
1070
+ const Cancelled: Readonly<CancellationToken>;
1071
+ }
1072
+ declare class MutableToken implements CancellationToken {
1073
+ private _isCancelled;
1074
+ private _emitter?;
1075
+ cancel(): void;
1076
+ get isCancellationRequested(): boolean;
1077
+ get onCancellationRequested(): Event<void>;
1078
+ dispose(): void;
1079
+ }
1080
+ declare class CancellationTokenSource {
1081
+ private _token;
1082
+ get token(): CancellationToken;
1083
+ cancel(): void;
1084
+ dispose(): void;
1085
+ }
1086
+ declare function cancelled(): Error;
1087
+ declare function isCancelled(err: Error | undefined): boolean;
1088
+ declare function checkCancelled(token?: CancellationToken): void;
1089
+
1090
+ /**
1091
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1092
+ * SPDX-License-Identifier: MIT
1093
+ */
1094
+
1095
+ /**
1096
+ * Simple implementation of the deferred pattern.
1097
+ * An object that exposes a promise and functions to resolve and reject it.
1098
+ */
1099
+ declare class PromiseDeferred<T> {
1100
+ resolve: (value?: T | PromiseLike<T>) => void;
1101
+ reject: (err?: any) => void;
1102
+ promise: Promise<T>;
1103
+ }
1104
+ declare const Deferred: typeof PromiseDeferred;
1105
+ /**
1106
+ * @returns resolves after a specified number of milliseconds
1107
+ * @throws cancelled if a given token is cancelled before a specified number of milliseconds
1108
+ */
1109
+ declare function delay(ms: number, token?: Readonly<CancellationToken>): Promise<void>;
1110
+ declare function retry<T>(task: () => Promise<T>, delayTime: number, retries: number, shouldRetry?: (res: T) => boolean): Promise<T>;
1111
+ interface PromiseTask<T> {
1112
+ (): Promise<T>;
1113
+ }
1114
+ interface PromisePoolOpts {
1115
+ intervalCount?: number;
1116
+ intervalTime?: number;
1117
+ retries?: number;
1118
+ retryDelay?: number;
1119
+ }
1120
+ declare class PromisePool {
1121
+ protected opts: Required<PromisePoolOpts>;
1122
+ constructor(opts?: PromisePoolOpts);
1123
+ protected tryToExec<T>(task: PromiseTask<T>, checkIfRetry?: (res: T) => boolean): Promise<T>;
1124
+ /**
1125
+ * @param tasks 执行任务
1126
+ * @param checkIfRetry 判断结果是否需要重试
1127
+ */
1128
+ run<T>(tasks: PromiseTask<T>[], checkIfRetry?: (res: T) => boolean): Promise<T[]>;
1129
+ }
1130
+
1131
+ /**
1132
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1133
+ * SPDX-License-Identifier: MIT
1134
+ */
1135
+
1136
+ interface CacheManager<T, ITEM extends CacheOriginItem = CacheOriginItem> extends Disposable {
1137
+ get(): T;
1138
+ getMore(count: number, autoDelete?: boolean): T[];
1139
+ getMoreByItemKeys(item: ITEM[]): T[];
1140
+ getMoreByItems(item: ITEM[]): T[];
1141
+ /**
1142
+ * 从缓存中获取
1143
+ * @param key
1144
+ */
1145
+ getFromCacheByKey(key: string): T | undefined;
1146
+ /**
1147
+ * 获取所有缓存
1148
+ */
1149
+ getFromCache(): Cache<T>[];
1150
+ /**
1151
+ * 清空缓存数据
1152
+ */
1153
+ clear(): void;
1154
+ }
1155
+ interface ShortCache<T> {
1156
+ get(fn: () => T): T;
1157
+ }
1158
+ interface WeakCache {
1159
+ get(key: any): any;
1160
+ save(key: any, value: any): void;
1161
+ isChanged(key: any, value: any): boolean;
1162
+ }
1163
+ interface CacheOpts {
1164
+ deleteLimit?: number;
1165
+ }
1166
+ interface CacheOriginItem {
1167
+ key?: any;
1168
+ }
1169
+ type Cache<T> = {
1170
+ [P in keyof T]: T[P];
1171
+ } & {
1172
+ dispose?: () => void;
1173
+ key?: any;
1174
+ };
1175
+ /**
1176
+ * 缓存工具:
1177
+ * 1. 可延迟按需创建,提升性能
1178
+ * 2. 可支持多个或单个,有些动态创建多个的场景可以共享已有的实例,提升性能
1179
+ * 3. 自动删除,超过一定的数目会自动做清空回收
1180
+ *
1181
+ * @example
1182
+ * function htmlFactory<HTMLElement>(): Cache<HTMLElement> {
1183
+ * const el = document.createElement('div')
1184
+ * return Cache.assign(el, { dispose: () => el.remove() })
1185
+ * }
1186
+ * const htmlCache = Cache.create<HTMLElement>(htmlFactory)
1187
+ * console.log(htmlCache.get() === htmlCache.get()) // true
1188
+ * console.log(htmlCache.getMore(3)) // [HTMLElement, HTMLElement, HTMLElement]
1189
+ * console.log(htmlCache.getMore(2)) // [HTMLElement, HTMLElement] 自动删除第三个
1190
+ */
1191
+ declare namespace Cache {
1192
+ function create<T, ITEM extends CacheOriginItem = CacheOriginItem>(cacheFactory: (item?: ITEM) => Cache<T>, opts?: CacheOpts): CacheManager<T, ITEM>;
1193
+ function assign<T = any>(target: T, fn: Disposable): Cache<T>;
1194
+ /**
1195
+ * 短存储
1196
+ * @param timeout
1197
+ */
1198
+ function createShortCache<T>(timeout?: number): ShortCache<T>;
1199
+ function createWeakCache(): WeakCache;
1200
+ }
1201
+
1202
+ /**
1203
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1204
+ * SPDX-License-Identifier: MIT
1205
+ */
1206
+ declare namespace Compare {
1207
+ /**
1208
+ * 比较,默认浅比较
1209
+ * @param oldProps
1210
+ * @param newProps
1211
+ * @param depth - 比较的深度,默认是 1
1212
+ * @param partial - 比较对象的局部,默认 true
1213
+ */
1214
+ function isChanged(oldProps: any, newProps: any, depth?: number, partial?: boolean): boolean;
1215
+ /**
1216
+ * 深度比较
1217
+ * @param oldProps
1218
+ * @param newProps
1219
+ * @param partial - 比较对象的局部,默认 true
1220
+ */
1221
+ function isDeepChanged(oldProps: any, newProps: any, partial?: boolean): boolean;
1222
+ function isArrayShallowChanged(arr1: any[], arr2: any[]): boolean;
1223
+ }
1224
+
1225
+ /**
1226
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1227
+ * SPDX-License-Identifier: MIT
1228
+ */
1229
+
1230
+ type CSSStyle = {
1231
+ [P in keyof CSSStyleDeclaration]?: string | number | undefined;
1232
+ };
1233
+ interface DOMCache extends HTMLElement, Disposable {
1234
+ setStyle(style: CSSStyle): void;
1235
+ key?: string | number;
1236
+ }
1237
+ declare namespace domUtils {
1238
+ function toPixel(num: number): string;
1239
+ function fromPercent(percent: string): number;
1240
+ function toPercent(percent: number): string;
1241
+ function enableEvent(element: HTMLDivElement): void;
1242
+ function disableEvent(element: HTMLDivElement): void;
1243
+ function createElement<T extends HTMLElement>(ele: string, ...classNames: string[]): T;
1244
+ function createDivWithClass(...classNames: string[]): HTMLDivElement;
1245
+ function addClass(element: Element, ...classNames: string[]): void;
1246
+ function delClass(element: Element, ...classNames: string[]): void;
1247
+ function coverClass(element: Element, ...classNames: string[]): void;
1248
+ function clearChildren(container: HTMLDivElement): void;
1249
+ function translatePercent(node: HTMLDivElement, x: number, y: number): void;
1250
+ function translateXPercent(node: HTMLDivElement, x: number): void;
1251
+ function translateYPercent(node: HTMLDivElement, y: number): void;
1252
+ function setStyle(node: HTMLElement, styles: CSSStyle): void;
1253
+ function classNameWithPrefix(prefix: string): (key: string, opts?: any) => string;
1254
+ function addStandardDisposableListener(dom: HTMLElement | HTMLDocument, type: string, listener: EventListenerOrEventListenerObject | any, options?: boolean | any): Disposable;
1255
+ /**
1256
+ * dom 缓存
1257
+ * @param parent
1258
+ * @param className
1259
+ */
1260
+ function createDOMCache<T extends DOMCache = DOMCache>(parent: HTMLElement, className: string | (() => HTMLElement), children?: string): CacheManager<T>;
1261
+ }
1262
+
1263
+ /**
1264
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1265
+ * SPDX-License-Identifier: MIT
1266
+ */
1267
+ type LocalId = number;
1268
+ declare function generateLocalId(): LocalId;
1269
+ declare function _setIdx(idx: number): void;
1270
+
1271
+ /**
1272
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1273
+ * SPDX-License-Identifier: MIT
1274
+ */
1275
+ declare function iterToArray<T = any>(iter: IterableIterator<T>): T[];
1276
+ declare function arrayToSet(arr: any[]): Set<any>;
1277
+ /**
1278
+ * @see https://stackoverflow.com/a/9229821
1279
+ * export function arrayUnion(arr: any[]): any[] {
1280
+ * return [...new Set(arr)]
1281
+ * }
1282
+ */
1283
+ declare function arrayUnion(arr: any[]): any[];
1284
+
1285
+ /**
1286
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1287
+ * SPDX-License-Identifier: MIT
1288
+ */
1289
+
1290
+ declare function bindContributions(bind: interfaces.Bind, target: any, contribs: any[]): void;
1291
+
1292
+ /**
1293
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1294
+ * SPDX-License-Identifier: MIT
1295
+ */
1296
+ type RequestFn = (...args: any[]) => Promise<any>;
1297
+ /**
1298
+ * 请求缓存
1299
+ * @param req
1300
+ */
1301
+ declare const RequestCache: Map<any, Promise<any>>;
1302
+ declare function clearRequestCache(): void;
1303
+ declare function requestWithMemo(req: RequestFn, cacheTime?: number, createCacheKey?: (...args: any[]) => any): RequestFn;
1304
+
1305
+ /**
1306
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1307
+ * SPDX-License-Identifier: MIT
1308
+ */
1309
+
1310
+ type FuncMaybePromise<D> = (d: D, ...others: any[]) => MaybePromise<D>;
1311
+ type FuncPromise<D> = (d: D, ...others: any[]) => Promise<D>;
1312
+ type Func<D> = (d: D, ...others: any[]) => D;
1313
+ declare function composeAsync<D>(...fns: FuncMaybePromise<D>[]): FuncPromise<D>;
1314
+ declare function compose<D>(...fns: Func<D>[]): Func<D>;
1315
+
1316
+ /**
1317
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1318
+ * SPDX-License-Identifier: MIT
1319
+ */
1320
+
1321
+ declare const ContributionProvider: unique symbol;
1322
+ interface ContributionProvider<T extends object> {
1323
+ getContributions(): T[];
1324
+ forEach(fn: (v: T) => void): void;
1325
+ }
1326
+ declare function bindContributionProvider(bind: interfaces.Bind, id: symbol): void;
1327
+
1328
+ /**
1329
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1330
+ * SPDX-License-Identifier: MIT
1331
+ */
1332
+
1333
+ type EventListener<K extends keyof HTMLElementEventMap> = (this: HTMLElement, event: HTMLElementEventMap[K]) => any;
1334
+ type EventListenerOrEventListenerObject$1<K extends keyof HTMLElementEventMap> = EventListener<K>;
1335
+ declare function addEventListener<K extends keyof HTMLElementEventMap>(element: HTMLElement, type: K, listener: EventListenerOrEventListenerObject$1<K>, useCapture?: boolean): Disposable;
1336
+
1337
+ /**
1338
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1339
+ * SPDX-License-Identifier: MIT
1340
+ */
1341
+ declare class Logger {
1342
+ isDevEnv(): boolean;
1343
+ info(...props: any): void;
1344
+ log(...props: any): void;
1345
+ error(...props: any): void;
1346
+ warn(...props: any): void;
1347
+ }
1348
+ declare const logger: Logger;
1349
+
1350
+ /**
1351
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1352
+ * SPDX-License-Identifier: MIT
1353
+ */
1354
+ declare function createStyleElement(styleId: string, container?: HTMLElement): HTMLStyleElement;
1355
+ declare const DecorationStyle: {
1356
+ createStyleElement: typeof createStyleElement;
1357
+ };
1358
+
1359
+ /**
1360
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
1361
+ * SPDX-License-Identifier: MIT
1362
+ */
1363
+ declare function useRefresh(defaultValue?: any): (v?: any) => void;
1364
+
1365
+ export { Angle, type AsClass, type CSSStyle, Cache, type CacheManager, type CacheOpts, type CacheOriginItem, CancellationToken, CancellationTokenSource, Circle, Compare, ContributionProvider, CropSchemaDecoration, DEG_TO_RAD, type DOMCache, DecorationStyle, Deferred, Disposable, DisposableCollection, DisposableImpl, Emitter, Event, type EventListener$1 as EventListener, type FlipSchema, FlipSchemaDecoration, type IPoint, type ISize, type LocalId, type MarginSchema, Matrix, type MaybeArray, type MaybePromise, MutableToken, NOOP, OBBRect, type OpacitySchema, OpacitySchemaDecoration, type OriginSchema, OriginSchemaDecoration, PI, PI_2, PaddingSchema, PaddingSchemaDecoration, Point, type PositionSchema, PositionSchemaDecoration, PromiseDeferred, PromisePool, type PromisePoolOpts, type PromiseTask, RAD_TO_DEG, Rectangle, RectangleAlignTitle, RectangleAlignType, type RecursivePartial, RequestCache, type RotationSchema, RotationSchemaDecoration, SHAPES, type ScaleSchema, ScaleSchemaDecoration, Schema, SchemaDecoration, type SchemaType, type ScrollSchema, type ShadowSchema, ShadowSchemaDecoration, type ShortCache, SizeSchema, SizeSchemaDecoration, type SkewSchema, SkewSchemaDecoration, TintSchema, TintSchemaDecoration, Transform, TransformSchema, TransformSchemaDecoration, type WeakCache, _setIdx, addEventListener, arrayToSet, arrayUnion, bindContributionProvider, bindContributions, cancelled, checkCancelled, clearRequestCache, compose, composeAsync, deepFreeze, delay, domUtils, each, filter, generateLocalId, getByKey, getTag, isCancelled, isEmpty, isFunction, isNumber, isObject, isPlainObject, isString, iterToArray, logger, mapKeys, mapValues, notEmpty, omit, pick, reduce, requestWithMemo, retry, setByKey, useRefresh, values };