@nanoforge-dev/graphics-2d 1.0.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.
- package/LICENSE +21 -0
- package/README.md +109 -0
- package/dist/index.cjs +281 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +330 -0
- package/dist/index.d.ts +330 -0
- package/dist/index.js +177 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { BaseGraphicsLibrary, InitContext } from '@nanoforge-dev/common';
|
|
2
|
+
import * as konva_lib_shapes_Wedge from 'konva/lib/shapes/Wedge';
|
|
3
|
+
import * as konva_lib_Tween from 'konva/lib/Tween';
|
|
4
|
+
import * as konva_lib_shapes_Transformer from 'konva/lib/shapes/Transformer';
|
|
5
|
+
import * as konva_lib_Util from 'konva/lib/Util';
|
|
6
|
+
import * as konva_lib_shapes_TextPath from 'konva/lib/shapes/TextPath';
|
|
7
|
+
import * as konva_lib_shapes_Text from 'konva/lib/shapes/Text';
|
|
8
|
+
import * as konva_lib_shapes_Star from 'konva/lib/shapes/Star';
|
|
9
|
+
import * as konva_lib_Stage from 'konva/lib/Stage';
|
|
10
|
+
import * as konva_lib_shapes_Sprite from 'konva/lib/shapes/Sprite';
|
|
11
|
+
import * as konva_lib_Shape from 'konva/lib/Shape';
|
|
12
|
+
import * as konva_lib_shapes_Ring from 'konva/lib/shapes/Ring';
|
|
13
|
+
import * as konva_lib_shapes_RegularPolygon from 'konva/lib/shapes/RegularPolygon';
|
|
14
|
+
import * as konva_lib_shapes_Rect from 'konva/lib/shapes/Rect';
|
|
15
|
+
import * as konva_lib_shapes_Path from 'konva/lib/shapes/Path';
|
|
16
|
+
import * as konva_lib_shapes_Line from 'konva/lib/shapes/Line';
|
|
17
|
+
import * as konva_lib_Layer from 'konva/lib/Layer';
|
|
18
|
+
import * as konva_lib_shapes_Label from 'konva/lib/shapes/Label';
|
|
19
|
+
import * as konva_lib_shapes_Image from 'konva/lib/shapes/Image';
|
|
20
|
+
import * as konva_lib_Group from 'konva/lib/Group';
|
|
21
|
+
import * as konva_lib_FastLayer from 'konva/lib/FastLayer';
|
|
22
|
+
import * as konva_lib_shapes_Ellipse from 'konva/lib/shapes/Ellipse';
|
|
23
|
+
import * as konva_lib_types from 'konva/lib/types';
|
|
24
|
+
import * as konva_lib_Node from 'konva/lib/Node';
|
|
25
|
+
import * as konva_lib_Context from 'konva/lib/Context';
|
|
26
|
+
import * as konva_lib_Container from 'konva/lib/Container';
|
|
27
|
+
import * as konva_lib_shapes_Circle from 'konva/lib/shapes/Circle';
|
|
28
|
+
import * as konva_lib_Canvas from 'konva/lib/Canvas';
|
|
29
|
+
import * as konva_lib_shapes_Arrow from 'konva/lib/shapes/Arrow';
|
|
30
|
+
import * as konva_lib_shapes_Arc from 'konva/lib/shapes/Arc';
|
|
31
|
+
import * as konva_lib_Animation from 'konva/lib/Animation';
|
|
32
|
+
import Konva from 'konva';
|
|
33
|
+
|
|
34
|
+
declare const Animation: typeof konva_lib_Animation.Animation;
|
|
35
|
+
type Animation = Konva.Animation;
|
|
36
|
+
declare const Arc: typeof konva_lib_shapes_Arc.Arc;
|
|
37
|
+
type Arc = Konva.Arc;
|
|
38
|
+
type ArcConfig = Konva.ArcConfig;
|
|
39
|
+
declare const Arrow: typeof konva_lib_shapes_Arrow.Arrow;
|
|
40
|
+
type Arrow = Konva.Arrow;
|
|
41
|
+
type ArrowConfig = Konva.ArrowConfig;
|
|
42
|
+
declare const Canvas: typeof konva_lib_Canvas.Canvas;
|
|
43
|
+
type Canvas = typeof Konva.Canvas;
|
|
44
|
+
declare const Circle: typeof konva_lib_shapes_Circle.Circle;
|
|
45
|
+
type Circle = Konva.Circle;
|
|
46
|
+
type CircleConfig = Konva.CircleConfig;
|
|
47
|
+
declare const Container: typeof konva_lib_Container.Container;
|
|
48
|
+
type Container = Konva.Container;
|
|
49
|
+
type ContainerConfig = Konva.ContainerConfig;
|
|
50
|
+
declare const Context: typeof konva_lib_Context.Context;
|
|
51
|
+
type Context = Konva.Context;
|
|
52
|
+
declare const DD: {
|
|
53
|
+
readonly isDragging: boolean;
|
|
54
|
+
justDragged: boolean;
|
|
55
|
+
readonly node: konva_lib_Node.Node<konva_lib_Node.NodeConfig> | undefined;
|
|
56
|
+
_dragElements: Map<number, {
|
|
57
|
+
node: konva_lib_Node.Node;
|
|
58
|
+
startPointerPos: konva_lib_types.Vector2d;
|
|
59
|
+
offset: konva_lib_types.Vector2d;
|
|
60
|
+
pointerId?: number;
|
|
61
|
+
dragStatus: "ready" | "dragging" | "stopped";
|
|
62
|
+
}>;
|
|
63
|
+
_drag(evt: any): void;
|
|
64
|
+
_endDragBefore(evt?: any): void;
|
|
65
|
+
_endDragAfter(evt: any): void;
|
|
66
|
+
};
|
|
67
|
+
type DD = typeof Konva.DD;
|
|
68
|
+
declare const Easings: {
|
|
69
|
+
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
70
|
+
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
71
|
+
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
72
|
+
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
73
|
+
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
74
|
+
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
75
|
+
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
76
|
+
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
77
|
+
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
78
|
+
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
79
|
+
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
80
|
+
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
81
|
+
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
82
|
+
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
83
|
+
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
84
|
+
Linear(t: any, b: any, c: any, d: any): any;
|
|
85
|
+
};
|
|
86
|
+
type Easings = typeof Konva.Easings;
|
|
87
|
+
declare const Ellipse: typeof konva_lib_shapes_Ellipse.Ellipse;
|
|
88
|
+
type Ellipse = Konva.Ellipse;
|
|
89
|
+
type EllipseConfig = Konva.EllipseConfig;
|
|
90
|
+
declare const FastLayer: typeof konva_lib_FastLayer.FastLayer;
|
|
91
|
+
type FastLayer = Konva.FastLayer;
|
|
92
|
+
declare const Filters: {
|
|
93
|
+
Blur: konva_lib_Node.Filter;
|
|
94
|
+
Brightness: konva_lib_Node.Filter;
|
|
95
|
+
Brighten: konva_lib_Node.Filter;
|
|
96
|
+
Contrast: konva_lib_Node.Filter;
|
|
97
|
+
Emboss: konva_lib_Node.Filter;
|
|
98
|
+
Enhance: konva_lib_Node.Filter;
|
|
99
|
+
Grayscale: konva_lib_Node.Filter;
|
|
100
|
+
HSL: konva_lib_Node.Filter;
|
|
101
|
+
HSV: konva_lib_Node.Filter;
|
|
102
|
+
Invert: konva_lib_Node.Filter;
|
|
103
|
+
Kaleidoscope: konva_lib_Node.Filter;
|
|
104
|
+
Mask: konva_lib_Node.Filter;
|
|
105
|
+
Noise: konva_lib_Node.Filter;
|
|
106
|
+
Pixelate: konva_lib_Node.Filter;
|
|
107
|
+
Posterize: konva_lib_Node.Filter;
|
|
108
|
+
RGB: konva_lib_Node.Filter;
|
|
109
|
+
RGBA: konva_lib_Node.Filter;
|
|
110
|
+
Sepia: konva_lib_Node.Filter;
|
|
111
|
+
Solarize: konva_lib_Node.Filter;
|
|
112
|
+
Threshold: konva_lib_Node.Filter;
|
|
113
|
+
};
|
|
114
|
+
type Filters = typeof Konva.Filters;
|
|
115
|
+
declare const Group: typeof konva_lib_Group.Group;
|
|
116
|
+
type Group = Konva.Group;
|
|
117
|
+
type GroupConfig = Konva.GroupConfig;
|
|
118
|
+
declare const Image: typeof konva_lib_shapes_Image.Image;
|
|
119
|
+
type Image = Konva.Image;
|
|
120
|
+
type ImageConfig = Konva.ImageConfig;
|
|
121
|
+
type KonvaEventListener<This, EventType> = Konva.KonvaEventListener<This, EventType>;
|
|
122
|
+
type KonvaEventObject<EventType> = Konva.KonvaEventObject<EventType>;
|
|
123
|
+
type KonvaPointerEvent = Konva.KonvaPointerEvent;
|
|
124
|
+
declare const Label: typeof konva_lib_shapes_Label.Label;
|
|
125
|
+
type Label = Konva.Label;
|
|
126
|
+
type LabelConfig = Konva.LabelConfig;
|
|
127
|
+
declare const Layer: typeof konva_lib_Layer.Layer;
|
|
128
|
+
type Layer = Konva.Layer;
|
|
129
|
+
type LayerConfig = Konva.LayerConfig;
|
|
130
|
+
declare const Line: typeof konva_lib_shapes_Line.Line;
|
|
131
|
+
type Line = Konva.Line;
|
|
132
|
+
type LineConfig = Konva.LineConfig;
|
|
133
|
+
declare const Node: typeof konva_lib_Node.Node;
|
|
134
|
+
type Node = Konva.Node;
|
|
135
|
+
type NodeConfig = Konva.NodeConfig;
|
|
136
|
+
declare const Path: typeof konva_lib_shapes_Path.Path;
|
|
137
|
+
type Path = Konva.Path;
|
|
138
|
+
type PathConfig = Konva.PathConfig;
|
|
139
|
+
declare const Rect: typeof konva_lib_shapes_Rect.Rect;
|
|
140
|
+
type Rect = Konva.Rect;
|
|
141
|
+
type RectConfig = Konva.RectConfig;
|
|
142
|
+
declare const RegularPolygon: typeof konva_lib_shapes_RegularPolygon.RegularPolygon;
|
|
143
|
+
type RegularPolygon = Konva.RegularPolygon;
|
|
144
|
+
type RegularPolygonConfig = Konva.RegularPolygonConfig;
|
|
145
|
+
declare const Ring: typeof konva_lib_shapes_Ring.Ring;
|
|
146
|
+
type Ring = Konva.Ring;
|
|
147
|
+
type RingConfig = Konva.RingConfig;
|
|
148
|
+
declare const Shape: typeof konva_lib_Shape.Shape;
|
|
149
|
+
type Shape = Konva.Shape;
|
|
150
|
+
type ShapeConfig = Konva.ShapeConfig;
|
|
151
|
+
declare const Sprite: typeof konva_lib_shapes_Sprite.Sprite;
|
|
152
|
+
type Sprite = Konva.Sprite;
|
|
153
|
+
type SpriteConfig = Konva.SpriteConfig;
|
|
154
|
+
declare const Stage: typeof konva_lib_Stage.Stage;
|
|
155
|
+
type Stage = Konva.Stage;
|
|
156
|
+
type StageConfig = Konva.StageConfig;
|
|
157
|
+
declare const Star: typeof konva_lib_shapes_Star.Star;
|
|
158
|
+
type Star = Konva.Star;
|
|
159
|
+
type StarConfig = Konva.StarConfig;
|
|
160
|
+
declare const Tag: typeof konva_lib_shapes_Label.Tag;
|
|
161
|
+
type Tag = Konva.Tag;
|
|
162
|
+
type TagConfig = Konva.TagConfig;
|
|
163
|
+
declare const Text: typeof konva_lib_shapes_Text.Text;
|
|
164
|
+
type Text = Konva.Text;
|
|
165
|
+
type TextConfig = Konva.TextConfig;
|
|
166
|
+
declare const TextPath: typeof konva_lib_shapes_TextPath.TextPath;
|
|
167
|
+
type TextPath = Konva.TextPath;
|
|
168
|
+
type TextPathConfig = Konva.TextPathConfig;
|
|
169
|
+
declare const Transform: typeof konva_lib_Util.Transform;
|
|
170
|
+
type Transform = Konva.Transform;
|
|
171
|
+
declare const Transformer: typeof konva_lib_shapes_Transformer.Transformer;
|
|
172
|
+
type Transformer = Konva.Transformer;
|
|
173
|
+
type TransformerConfig = Konva.TransformerConfig;
|
|
174
|
+
declare const Tween: typeof konva_lib_Tween.Tween;
|
|
175
|
+
type Tween = Konva.Tween;
|
|
176
|
+
type TweenConfig = Konva.TweenConfig;
|
|
177
|
+
declare const Util: {
|
|
178
|
+
_isElement(obj: any): obj is Element;
|
|
179
|
+
_isFunction(obj: any): boolean;
|
|
180
|
+
_isPlainObject(obj: any): boolean;
|
|
181
|
+
_isArray(obj: any): obj is Array<any>;
|
|
182
|
+
_isNumber(obj: any): obj is number;
|
|
183
|
+
_isString(obj: any): obj is string;
|
|
184
|
+
_isBoolean(obj: any): obj is boolean;
|
|
185
|
+
isObject(val: any): val is object;
|
|
186
|
+
isValidSelector(selector: any): boolean;
|
|
187
|
+
_sign(number: number): 1 | -1;
|
|
188
|
+
requestAnimFrame(callback: Function): void;
|
|
189
|
+
createCanvasElement(): HTMLCanvasElement;
|
|
190
|
+
createImageElement(): HTMLImageElement;
|
|
191
|
+
_isInDocument(el: any): boolean;
|
|
192
|
+
_urlToImage(url: string, callback: Function): void;
|
|
193
|
+
_rgbToHex(r: number, g: number, b: number): string;
|
|
194
|
+
_hexToRgb(hex: string): konva_lib_types.RGB;
|
|
195
|
+
getRandomColor(): string;
|
|
196
|
+
isCanvasFarblingActive(): boolean;
|
|
197
|
+
getHitColor(): string;
|
|
198
|
+
getHitColorKey(r: number, g: number, b: number): string;
|
|
199
|
+
getSnappedHexColor(hex: string): string;
|
|
200
|
+
getRGB(color: string): konva_lib_types.RGB;
|
|
201
|
+
colorToRGBA(str: string): {
|
|
202
|
+
r: number;
|
|
203
|
+
g: number;
|
|
204
|
+
b: number;
|
|
205
|
+
a: number;
|
|
206
|
+
} | undefined;
|
|
207
|
+
_namedColorToRBA(str: string): {
|
|
208
|
+
r: number;
|
|
209
|
+
g: number;
|
|
210
|
+
b: number;
|
|
211
|
+
a: number;
|
|
212
|
+
} | null;
|
|
213
|
+
_rgbColorToRGBA(str: string): {
|
|
214
|
+
r: number;
|
|
215
|
+
g: number;
|
|
216
|
+
b: number;
|
|
217
|
+
a: number;
|
|
218
|
+
} | undefined;
|
|
219
|
+
_rgbaColorToRGBA(str: string): {
|
|
220
|
+
r: number;
|
|
221
|
+
g: number;
|
|
222
|
+
b: number;
|
|
223
|
+
a: number;
|
|
224
|
+
} | undefined;
|
|
225
|
+
_hex8ColorToRGBA(str: string): {
|
|
226
|
+
r: number;
|
|
227
|
+
g: number;
|
|
228
|
+
b: number;
|
|
229
|
+
a: number;
|
|
230
|
+
} | undefined;
|
|
231
|
+
_hex6ColorToRGBA(str: string): {
|
|
232
|
+
r: number;
|
|
233
|
+
g: number;
|
|
234
|
+
b: number;
|
|
235
|
+
a: number;
|
|
236
|
+
} | undefined;
|
|
237
|
+
_hex4ColorToRGBA(str: string): {
|
|
238
|
+
r: number;
|
|
239
|
+
g: number;
|
|
240
|
+
b: number;
|
|
241
|
+
a: number;
|
|
242
|
+
} | undefined;
|
|
243
|
+
_hex3ColorToRGBA(str: string): {
|
|
244
|
+
r: number;
|
|
245
|
+
g: number;
|
|
246
|
+
b: number;
|
|
247
|
+
a: number;
|
|
248
|
+
} | undefined;
|
|
249
|
+
_hslColorToRGBA(str: string): {
|
|
250
|
+
r: number;
|
|
251
|
+
g: number;
|
|
252
|
+
b: number;
|
|
253
|
+
a: number;
|
|
254
|
+
} | undefined;
|
|
255
|
+
haveIntersection(r1: konva_lib_types.IRect, r2: konva_lib_types.IRect): boolean;
|
|
256
|
+
cloneObject<Any>(obj: Any): Any;
|
|
257
|
+
cloneArray(arr: Array<any>): any[];
|
|
258
|
+
degToRad(deg: number): number;
|
|
259
|
+
radToDeg(rad: number): number;
|
|
260
|
+
_degToRad(deg: number): number;
|
|
261
|
+
_radToDeg(rad: number): number;
|
|
262
|
+
_getRotation(radians: number): number;
|
|
263
|
+
_capitalize(str: string): string;
|
|
264
|
+
throw(str: string): never;
|
|
265
|
+
error(str: string): void;
|
|
266
|
+
warn(str: string): void;
|
|
267
|
+
each(obj: object, func: Function): void;
|
|
268
|
+
_inRange(val: number, left: number, right: number): boolean;
|
|
269
|
+
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
270
|
+
_getProjectionToLine(pt: konva_lib_types.Vector2d, line: Array<konva_lib_types.Vector2d>, isClosed: boolean): konva_lib_types.Vector2d;
|
|
271
|
+
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
|
|
272
|
+
_prepareToStringify<T>(obj: any): T | null;
|
|
273
|
+
_assign<T, U>(target: T, source: U): T & U;
|
|
274
|
+
_getFirstPointerId(evt: any): any;
|
|
275
|
+
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
276
|
+
drawRoundedRectPath(context: konva_lib_Context.Context, width: number, height: number, cornerRadius: number | number[]): void;
|
|
277
|
+
drawRoundedPolygonPath(context: konva_lib_Context.Context, points: konva_lib_types.Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
|
|
278
|
+
};
|
|
279
|
+
type Util = typeof Konva.Util;
|
|
280
|
+
type Vector2d = Konva.Vector2d;
|
|
281
|
+
declare const Wedge: typeof konva_lib_shapes_Wedge.Wedge;
|
|
282
|
+
type Wedge = Konva.Wedge;
|
|
283
|
+
type WedgeConfig = Konva.WedgeConfig;
|
|
284
|
+
declare const _global: any;
|
|
285
|
+
declare const _injectGlobal: (Konva: any) => void;
|
|
286
|
+
declare const _mouseDblClickPointerId: null;
|
|
287
|
+
declare const _mouseInDblClickWindow: boolean;
|
|
288
|
+
declare const _mouseListenClick: boolean;
|
|
289
|
+
declare const _pointerDblClickPointerId: null;
|
|
290
|
+
declare const _pointerInDblClickWindow: boolean;
|
|
291
|
+
declare const _pointerListenClick: boolean;
|
|
292
|
+
declare const _renderBackend: string;
|
|
293
|
+
declare const _touchDblClickPointerId: null;
|
|
294
|
+
declare const _touchInDblClickWindow: boolean;
|
|
295
|
+
declare const _touchListenClick: boolean;
|
|
296
|
+
declare const angleDeg: boolean;
|
|
297
|
+
declare const autoDrawEnabled: boolean;
|
|
298
|
+
declare const capturePointerEventsEnabled: boolean;
|
|
299
|
+
declare const dblClickWindow: number;
|
|
300
|
+
declare const document: any;
|
|
301
|
+
declare const dragButtons: number[];
|
|
302
|
+
declare const dragDistance: number;
|
|
303
|
+
declare const enableTrace: boolean;
|
|
304
|
+
declare const getAngle: (angle: number) => number;
|
|
305
|
+
declare const hitOnDragEnabled: boolean;
|
|
306
|
+
declare const isBrowser: boolean;
|
|
307
|
+
declare const isDragReady: () => boolean;
|
|
308
|
+
declare const isDragging: () => boolean;
|
|
309
|
+
declare const isTransforming: () => boolean;
|
|
310
|
+
declare const isUnminified: boolean;
|
|
311
|
+
declare const legacyTextRendering: boolean;
|
|
312
|
+
declare const pixelRatio: number;
|
|
313
|
+
declare const pointerEventsEnabled: boolean;
|
|
314
|
+
declare const releaseCanvasOnDestroy: boolean;
|
|
315
|
+
declare const shapes: {
|
|
316
|
+
[key: string]: konva_lib_Shape.Shape<konva_lib_Shape.ShapeConfig>;
|
|
317
|
+
};
|
|
318
|
+
declare const showWarnings: boolean;
|
|
319
|
+
declare const stages: konva_lib_Stage.Stage[];
|
|
320
|
+
declare const version: string;
|
|
321
|
+
|
|
322
|
+
declare class Graphics2DLibrary extends BaseGraphicsLibrary {
|
|
323
|
+
private _stage?;
|
|
324
|
+
get __name(): string;
|
|
325
|
+
get stage(): Stage;
|
|
326
|
+
__init(context: InitContext): Promise<void>;
|
|
327
|
+
__run(): Promise<void>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export { Animation, Arc, type ArcConfig, Arrow, type ArrowConfig, Canvas, Circle, type CircleConfig, Container, type ContainerConfig, Context, DD, Easings, Ellipse, type EllipseConfig, FastLayer, Filters, Graphics2DLibrary, Group, type GroupConfig, Image, type ImageConfig, type KonvaEventListener, type KonvaEventObject, type KonvaPointerEvent, Label, type LabelConfig, Layer, type LayerConfig, Line, type LineConfig, Node, type NodeConfig, Path, type PathConfig, Rect, type RectConfig, RegularPolygon, type RegularPolygonConfig, Ring, type RingConfig, Shape, type ShapeConfig, Sprite, type SpriteConfig, Stage, type StageConfig, Star, type StarConfig, Tag, type TagConfig, Text, type TextConfig, TextPath, type TextPathConfig, Transform, Transformer, type TransformerConfig, Tween, type TweenConfig, Util, type Vector2d, Wedge, type WedgeConfig, _global, _injectGlobal, _mouseDblClickPointerId, _mouseInDblClickWindow, _mouseListenClick, _pointerDblClickPointerId, _pointerInDblClickWindow, _pointerListenClick, _renderBackend, _touchDblClickPointerId, _touchInDblClickWindow, _touchListenClick, angleDeg, autoDrawEnabled, capturePointerEventsEnabled, dblClickWindow, document, dragButtons, dragDistance, enableTrace, getAngle, hitOnDragEnabled, isBrowser, isDragReady, isDragging, isTransforming, isUnminified, legacyTextRendering, pixelRatio, pointerEventsEnabled, releaseCanvasOnDestroy, shapes, showWarnings, stages, version };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { BaseGraphicsLibrary, InitContext } from '@nanoforge-dev/common';
|
|
2
|
+
import * as konva_lib_shapes_Wedge from 'konva/lib/shapes/Wedge';
|
|
3
|
+
import * as konva_lib_Tween from 'konva/lib/Tween';
|
|
4
|
+
import * as konva_lib_shapes_Transformer from 'konva/lib/shapes/Transformer';
|
|
5
|
+
import * as konva_lib_Util from 'konva/lib/Util';
|
|
6
|
+
import * as konva_lib_shapes_TextPath from 'konva/lib/shapes/TextPath';
|
|
7
|
+
import * as konva_lib_shapes_Text from 'konva/lib/shapes/Text';
|
|
8
|
+
import * as konva_lib_shapes_Star from 'konva/lib/shapes/Star';
|
|
9
|
+
import * as konva_lib_Stage from 'konva/lib/Stage';
|
|
10
|
+
import * as konva_lib_shapes_Sprite from 'konva/lib/shapes/Sprite';
|
|
11
|
+
import * as konva_lib_Shape from 'konva/lib/Shape';
|
|
12
|
+
import * as konva_lib_shapes_Ring from 'konva/lib/shapes/Ring';
|
|
13
|
+
import * as konva_lib_shapes_RegularPolygon from 'konva/lib/shapes/RegularPolygon';
|
|
14
|
+
import * as konva_lib_shapes_Rect from 'konva/lib/shapes/Rect';
|
|
15
|
+
import * as konva_lib_shapes_Path from 'konva/lib/shapes/Path';
|
|
16
|
+
import * as konva_lib_shapes_Line from 'konva/lib/shapes/Line';
|
|
17
|
+
import * as konva_lib_Layer from 'konva/lib/Layer';
|
|
18
|
+
import * as konva_lib_shapes_Label from 'konva/lib/shapes/Label';
|
|
19
|
+
import * as konva_lib_shapes_Image from 'konva/lib/shapes/Image';
|
|
20
|
+
import * as konva_lib_Group from 'konva/lib/Group';
|
|
21
|
+
import * as konva_lib_FastLayer from 'konva/lib/FastLayer';
|
|
22
|
+
import * as konva_lib_shapes_Ellipse from 'konva/lib/shapes/Ellipse';
|
|
23
|
+
import * as konva_lib_types from 'konva/lib/types';
|
|
24
|
+
import * as konva_lib_Node from 'konva/lib/Node';
|
|
25
|
+
import * as konva_lib_Context from 'konva/lib/Context';
|
|
26
|
+
import * as konva_lib_Container from 'konva/lib/Container';
|
|
27
|
+
import * as konva_lib_shapes_Circle from 'konva/lib/shapes/Circle';
|
|
28
|
+
import * as konva_lib_Canvas from 'konva/lib/Canvas';
|
|
29
|
+
import * as konva_lib_shapes_Arrow from 'konva/lib/shapes/Arrow';
|
|
30
|
+
import * as konva_lib_shapes_Arc from 'konva/lib/shapes/Arc';
|
|
31
|
+
import * as konva_lib_Animation from 'konva/lib/Animation';
|
|
32
|
+
import Konva from 'konva';
|
|
33
|
+
|
|
34
|
+
declare const Animation: typeof konva_lib_Animation.Animation;
|
|
35
|
+
type Animation = Konva.Animation;
|
|
36
|
+
declare const Arc: typeof konva_lib_shapes_Arc.Arc;
|
|
37
|
+
type Arc = Konva.Arc;
|
|
38
|
+
type ArcConfig = Konva.ArcConfig;
|
|
39
|
+
declare const Arrow: typeof konva_lib_shapes_Arrow.Arrow;
|
|
40
|
+
type Arrow = Konva.Arrow;
|
|
41
|
+
type ArrowConfig = Konva.ArrowConfig;
|
|
42
|
+
declare const Canvas: typeof konva_lib_Canvas.Canvas;
|
|
43
|
+
type Canvas = typeof Konva.Canvas;
|
|
44
|
+
declare const Circle: typeof konva_lib_shapes_Circle.Circle;
|
|
45
|
+
type Circle = Konva.Circle;
|
|
46
|
+
type CircleConfig = Konva.CircleConfig;
|
|
47
|
+
declare const Container: typeof konva_lib_Container.Container;
|
|
48
|
+
type Container = Konva.Container;
|
|
49
|
+
type ContainerConfig = Konva.ContainerConfig;
|
|
50
|
+
declare const Context: typeof konva_lib_Context.Context;
|
|
51
|
+
type Context = Konva.Context;
|
|
52
|
+
declare const DD: {
|
|
53
|
+
readonly isDragging: boolean;
|
|
54
|
+
justDragged: boolean;
|
|
55
|
+
readonly node: konva_lib_Node.Node<konva_lib_Node.NodeConfig> | undefined;
|
|
56
|
+
_dragElements: Map<number, {
|
|
57
|
+
node: konva_lib_Node.Node;
|
|
58
|
+
startPointerPos: konva_lib_types.Vector2d;
|
|
59
|
+
offset: konva_lib_types.Vector2d;
|
|
60
|
+
pointerId?: number;
|
|
61
|
+
dragStatus: "ready" | "dragging" | "stopped";
|
|
62
|
+
}>;
|
|
63
|
+
_drag(evt: any): void;
|
|
64
|
+
_endDragBefore(evt?: any): void;
|
|
65
|
+
_endDragAfter(evt: any): void;
|
|
66
|
+
};
|
|
67
|
+
type DD = typeof Konva.DD;
|
|
68
|
+
declare const Easings: {
|
|
69
|
+
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
70
|
+
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
71
|
+
BackEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
72
|
+
ElasticEaseIn(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
73
|
+
ElasticEaseOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
74
|
+
ElasticEaseInOut(t: any, b: any, c: any, d: any, a: any, p: any): any;
|
|
75
|
+
BounceEaseOut(t: any, b: any, c: any, d: any): any;
|
|
76
|
+
BounceEaseIn(t: any, b: any, c: any, d: any): any;
|
|
77
|
+
BounceEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
78
|
+
EaseIn(t: any, b: any, c: any, d: any): any;
|
|
79
|
+
EaseOut(t: any, b: any, c: any, d: any): any;
|
|
80
|
+
EaseInOut(t: any, b: any, c: any, d: any): any;
|
|
81
|
+
StrongEaseIn(t: any, b: any, c: any, d: any): any;
|
|
82
|
+
StrongEaseOut(t: any, b: any, c: any, d: any): any;
|
|
83
|
+
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
84
|
+
Linear(t: any, b: any, c: any, d: any): any;
|
|
85
|
+
};
|
|
86
|
+
type Easings = typeof Konva.Easings;
|
|
87
|
+
declare const Ellipse: typeof konva_lib_shapes_Ellipse.Ellipse;
|
|
88
|
+
type Ellipse = Konva.Ellipse;
|
|
89
|
+
type EllipseConfig = Konva.EllipseConfig;
|
|
90
|
+
declare const FastLayer: typeof konva_lib_FastLayer.FastLayer;
|
|
91
|
+
type FastLayer = Konva.FastLayer;
|
|
92
|
+
declare const Filters: {
|
|
93
|
+
Blur: konva_lib_Node.Filter;
|
|
94
|
+
Brightness: konva_lib_Node.Filter;
|
|
95
|
+
Brighten: konva_lib_Node.Filter;
|
|
96
|
+
Contrast: konva_lib_Node.Filter;
|
|
97
|
+
Emboss: konva_lib_Node.Filter;
|
|
98
|
+
Enhance: konva_lib_Node.Filter;
|
|
99
|
+
Grayscale: konva_lib_Node.Filter;
|
|
100
|
+
HSL: konva_lib_Node.Filter;
|
|
101
|
+
HSV: konva_lib_Node.Filter;
|
|
102
|
+
Invert: konva_lib_Node.Filter;
|
|
103
|
+
Kaleidoscope: konva_lib_Node.Filter;
|
|
104
|
+
Mask: konva_lib_Node.Filter;
|
|
105
|
+
Noise: konva_lib_Node.Filter;
|
|
106
|
+
Pixelate: konva_lib_Node.Filter;
|
|
107
|
+
Posterize: konva_lib_Node.Filter;
|
|
108
|
+
RGB: konva_lib_Node.Filter;
|
|
109
|
+
RGBA: konva_lib_Node.Filter;
|
|
110
|
+
Sepia: konva_lib_Node.Filter;
|
|
111
|
+
Solarize: konva_lib_Node.Filter;
|
|
112
|
+
Threshold: konva_lib_Node.Filter;
|
|
113
|
+
};
|
|
114
|
+
type Filters = typeof Konva.Filters;
|
|
115
|
+
declare const Group: typeof konva_lib_Group.Group;
|
|
116
|
+
type Group = Konva.Group;
|
|
117
|
+
type GroupConfig = Konva.GroupConfig;
|
|
118
|
+
declare const Image: typeof konva_lib_shapes_Image.Image;
|
|
119
|
+
type Image = Konva.Image;
|
|
120
|
+
type ImageConfig = Konva.ImageConfig;
|
|
121
|
+
type KonvaEventListener<This, EventType> = Konva.KonvaEventListener<This, EventType>;
|
|
122
|
+
type KonvaEventObject<EventType> = Konva.KonvaEventObject<EventType>;
|
|
123
|
+
type KonvaPointerEvent = Konva.KonvaPointerEvent;
|
|
124
|
+
declare const Label: typeof konva_lib_shapes_Label.Label;
|
|
125
|
+
type Label = Konva.Label;
|
|
126
|
+
type LabelConfig = Konva.LabelConfig;
|
|
127
|
+
declare const Layer: typeof konva_lib_Layer.Layer;
|
|
128
|
+
type Layer = Konva.Layer;
|
|
129
|
+
type LayerConfig = Konva.LayerConfig;
|
|
130
|
+
declare const Line: typeof konva_lib_shapes_Line.Line;
|
|
131
|
+
type Line = Konva.Line;
|
|
132
|
+
type LineConfig = Konva.LineConfig;
|
|
133
|
+
declare const Node: typeof konva_lib_Node.Node;
|
|
134
|
+
type Node = Konva.Node;
|
|
135
|
+
type NodeConfig = Konva.NodeConfig;
|
|
136
|
+
declare const Path: typeof konva_lib_shapes_Path.Path;
|
|
137
|
+
type Path = Konva.Path;
|
|
138
|
+
type PathConfig = Konva.PathConfig;
|
|
139
|
+
declare const Rect: typeof konva_lib_shapes_Rect.Rect;
|
|
140
|
+
type Rect = Konva.Rect;
|
|
141
|
+
type RectConfig = Konva.RectConfig;
|
|
142
|
+
declare const RegularPolygon: typeof konva_lib_shapes_RegularPolygon.RegularPolygon;
|
|
143
|
+
type RegularPolygon = Konva.RegularPolygon;
|
|
144
|
+
type RegularPolygonConfig = Konva.RegularPolygonConfig;
|
|
145
|
+
declare const Ring: typeof konva_lib_shapes_Ring.Ring;
|
|
146
|
+
type Ring = Konva.Ring;
|
|
147
|
+
type RingConfig = Konva.RingConfig;
|
|
148
|
+
declare const Shape: typeof konva_lib_Shape.Shape;
|
|
149
|
+
type Shape = Konva.Shape;
|
|
150
|
+
type ShapeConfig = Konva.ShapeConfig;
|
|
151
|
+
declare const Sprite: typeof konva_lib_shapes_Sprite.Sprite;
|
|
152
|
+
type Sprite = Konva.Sprite;
|
|
153
|
+
type SpriteConfig = Konva.SpriteConfig;
|
|
154
|
+
declare const Stage: typeof konva_lib_Stage.Stage;
|
|
155
|
+
type Stage = Konva.Stage;
|
|
156
|
+
type StageConfig = Konva.StageConfig;
|
|
157
|
+
declare const Star: typeof konva_lib_shapes_Star.Star;
|
|
158
|
+
type Star = Konva.Star;
|
|
159
|
+
type StarConfig = Konva.StarConfig;
|
|
160
|
+
declare const Tag: typeof konva_lib_shapes_Label.Tag;
|
|
161
|
+
type Tag = Konva.Tag;
|
|
162
|
+
type TagConfig = Konva.TagConfig;
|
|
163
|
+
declare const Text: typeof konva_lib_shapes_Text.Text;
|
|
164
|
+
type Text = Konva.Text;
|
|
165
|
+
type TextConfig = Konva.TextConfig;
|
|
166
|
+
declare const TextPath: typeof konva_lib_shapes_TextPath.TextPath;
|
|
167
|
+
type TextPath = Konva.TextPath;
|
|
168
|
+
type TextPathConfig = Konva.TextPathConfig;
|
|
169
|
+
declare const Transform: typeof konva_lib_Util.Transform;
|
|
170
|
+
type Transform = Konva.Transform;
|
|
171
|
+
declare const Transformer: typeof konva_lib_shapes_Transformer.Transformer;
|
|
172
|
+
type Transformer = Konva.Transformer;
|
|
173
|
+
type TransformerConfig = Konva.TransformerConfig;
|
|
174
|
+
declare const Tween: typeof konva_lib_Tween.Tween;
|
|
175
|
+
type Tween = Konva.Tween;
|
|
176
|
+
type TweenConfig = Konva.TweenConfig;
|
|
177
|
+
declare const Util: {
|
|
178
|
+
_isElement(obj: any): obj is Element;
|
|
179
|
+
_isFunction(obj: any): boolean;
|
|
180
|
+
_isPlainObject(obj: any): boolean;
|
|
181
|
+
_isArray(obj: any): obj is Array<any>;
|
|
182
|
+
_isNumber(obj: any): obj is number;
|
|
183
|
+
_isString(obj: any): obj is string;
|
|
184
|
+
_isBoolean(obj: any): obj is boolean;
|
|
185
|
+
isObject(val: any): val is object;
|
|
186
|
+
isValidSelector(selector: any): boolean;
|
|
187
|
+
_sign(number: number): 1 | -1;
|
|
188
|
+
requestAnimFrame(callback: Function): void;
|
|
189
|
+
createCanvasElement(): HTMLCanvasElement;
|
|
190
|
+
createImageElement(): HTMLImageElement;
|
|
191
|
+
_isInDocument(el: any): boolean;
|
|
192
|
+
_urlToImage(url: string, callback: Function): void;
|
|
193
|
+
_rgbToHex(r: number, g: number, b: number): string;
|
|
194
|
+
_hexToRgb(hex: string): konva_lib_types.RGB;
|
|
195
|
+
getRandomColor(): string;
|
|
196
|
+
isCanvasFarblingActive(): boolean;
|
|
197
|
+
getHitColor(): string;
|
|
198
|
+
getHitColorKey(r: number, g: number, b: number): string;
|
|
199
|
+
getSnappedHexColor(hex: string): string;
|
|
200
|
+
getRGB(color: string): konva_lib_types.RGB;
|
|
201
|
+
colorToRGBA(str: string): {
|
|
202
|
+
r: number;
|
|
203
|
+
g: number;
|
|
204
|
+
b: number;
|
|
205
|
+
a: number;
|
|
206
|
+
} | undefined;
|
|
207
|
+
_namedColorToRBA(str: string): {
|
|
208
|
+
r: number;
|
|
209
|
+
g: number;
|
|
210
|
+
b: number;
|
|
211
|
+
a: number;
|
|
212
|
+
} | null;
|
|
213
|
+
_rgbColorToRGBA(str: string): {
|
|
214
|
+
r: number;
|
|
215
|
+
g: number;
|
|
216
|
+
b: number;
|
|
217
|
+
a: number;
|
|
218
|
+
} | undefined;
|
|
219
|
+
_rgbaColorToRGBA(str: string): {
|
|
220
|
+
r: number;
|
|
221
|
+
g: number;
|
|
222
|
+
b: number;
|
|
223
|
+
a: number;
|
|
224
|
+
} | undefined;
|
|
225
|
+
_hex8ColorToRGBA(str: string): {
|
|
226
|
+
r: number;
|
|
227
|
+
g: number;
|
|
228
|
+
b: number;
|
|
229
|
+
a: number;
|
|
230
|
+
} | undefined;
|
|
231
|
+
_hex6ColorToRGBA(str: string): {
|
|
232
|
+
r: number;
|
|
233
|
+
g: number;
|
|
234
|
+
b: number;
|
|
235
|
+
a: number;
|
|
236
|
+
} | undefined;
|
|
237
|
+
_hex4ColorToRGBA(str: string): {
|
|
238
|
+
r: number;
|
|
239
|
+
g: number;
|
|
240
|
+
b: number;
|
|
241
|
+
a: number;
|
|
242
|
+
} | undefined;
|
|
243
|
+
_hex3ColorToRGBA(str: string): {
|
|
244
|
+
r: number;
|
|
245
|
+
g: number;
|
|
246
|
+
b: number;
|
|
247
|
+
a: number;
|
|
248
|
+
} | undefined;
|
|
249
|
+
_hslColorToRGBA(str: string): {
|
|
250
|
+
r: number;
|
|
251
|
+
g: number;
|
|
252
|
+
b: number;
|
|
253
|
+
a: number;
|
|
254
|
+
} | undefined;
|
|
255
|
+
haveIntersection(r1: konva_lib_types.IRect, r2: konva_lib_types.IRect): boolean;
|
|
256
|
+
cloneObject<Any>(obj: Any): Any;
|
|
257
|
+
cloneArray(arr: Array<any>): any[];
|
|
258
|
+
degToRad(deg: number): number;
|
|
259
|
+
radToDeg(rad: number): number;
|
|
260
|
+
_degToRad(deg: number): number;
|
|
261
|
+
_radToDeg(rad: number): number;
|
|
262
|
+
_getRotation(radians: number): number;
|
|
263
|
+
_capitalize(str: string): string;
|
|
264
|
+
throw(str: string): never;
|
|
265
|
+
error(str: string): void;
|
|
266
|
+
warn(str: string): void;
|
|
267
|
+
each(obj: object, func: Function): void;
|
|
268
|
+
_inRange(val: number, left: number, right: number): boolean;
|
|
269
|
+
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
270
|
+
_getProjectionToLine(pt: konva_lib_types.Vector2d, line: Array<konva_lib_types.Vector2d>, isClosed: boolean): konva_lib_types.Vector2d;
|
|
271
|
+
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
|
|
272
|
+
_prepareToStringify<T>(obj: any): T | null;
|
|
273
|
+
_assign<T, U>(target: T, source: U): T & U;
|
|
274
|
+
_getFirstPointerId(evt: any): any;
|
|
275
|
+
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
276
|
+
drawRoundedRectPath(context: konva_lib_Context.Context, width: number, height: number, cornerRadius: number | number[]): void;
|
|
277
|
+
drawRoundedPolygonPath(context: konva_lib_Context.Context, points: konva_lib_types.Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
|
|
278
|
+
};
|
|
279
|
+
type Util = typeof Konva.Util;
|
|
280
|
+
type Vector2d = Konva.Vector2d;
|
|
281
|
+
declare const Wedge: typeof konva_lib_shapes_Wedge.Wedge;
|
|
282
|
+
type Wedge = Konva.Wedge;
|
|
283
|
+
type WedgeConfig = Konva.WedgeConfig;
|
|
284
|
+
declare const _global: any;
|
|
285
|
+
declare const _injectGlobal: (Konva: any) => void;
|
|
286
|
+
declare const _mouseDblClickPointerId: null;
|
|
287
|
+
declare const _mouseInDblClickWindow: boolean;
|
|
288
|
+
declare const _mouseListenClick: boolean;
|
|
289
|
+
declare const _pointerDblClickPointerId: null;
|
|
290
|
+
declare const _pointerInDblClickWindow: boolean;
|
|
291
|
+
declare const _pointerListenClick: boolean;
|
|
292
|
+
declare const _renderBackend: string;
|
|
293
|
+
declare const _touchDblClickPointerId: null;
|
|
294
|
+
declare const _touchInDblClickWindow: boolean;
|
|
295
|
+
declare const _touchListenClick: boolean;
|
|
296
|
+
declare const angleDeg: boolean;
|
|
297
|
+
declare const autoDrawEnabled: boolean;
|
|
298
|
+
declare const capturePointerEventsEnabled: boolean;
|
|
299
|
+
declare const dblClickWindow: number;
|
|
300
|
+
declare const document: any;
|
|
301
|
+
declare const dragButtons: number[];
|
|
302
|
+
declare const dragDistance: number;
|
|
303
|
+
declare const enableTrace: boolean;
|
|
304
|
+
declare const getAngle: (angle: number) => number;
|
|
305
|
+
declare const hitOnDragEnabled: boolean;
|
|
306
|
+
declare const isBrowser: boolean;
|
|
307
|
+
declare const isDragReady: () => boolean;
|
|
308
|
+
declare const isDragging: () => boolean;
|
|
309
|
+
declare const isTransforming: () => boolean;
|
|
310
|
+
declare const isUnminified: boolean;
|
|
311
|
+
declare const legacyTextRendering: boolean;
|
|
312
|
+
declare const pixelRatio: number;
|
|
313
|
+
declare const pointerEventsEnabled: boolean;
|
|
314
|
+
declare const releaseCanvasOnDestroy: boolean;
|
|
315
|
+
declare const shapes: {
|
|
316
|
+
[key: string]: konva_lib_Shape.Shape<konva_lib_Shape.ShapeConfig>;
|
|
317
|
+
};
|
|
318
|
+
declare const showWarnings: boolean;
|
|
319
|
+
declare const stages: konva_lib_Stage.Stage[];
|
|
320
|
+
declare const version: string;
|
|
321
|
+
|
|
322
|
+
declare class Graphics2DLibrary extends BaseGraphicsLibrary {
|
|
323
|
+
private _stage?;
|
|
324
|
+
get __name(): string;
|
|
325
|
+
get stage(): Stage;
|
|
326
|
+
__init(context: InitContext): Promise<void>;
|
|
327
|
+
__run(): Promise<void>;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export { Animation, Arc, type ArcConfig, Arrow, type ArrowConfig, Canvas, Circle, type CircleConfig, Container, type ContainerConfig, Context, DD, Easings, Ellipse, type EllipseConfig, FastLayer, Filters, Graphics2DLibrary, Group, type GroupConfig, Image, type ImageConfig, type KonvaEventListener, type KonvaEventObject, type KonvaPointerEvent, Label, type LabelConfig, Layer, type LayerConfig, Line, type LineConfig, Node, type NodeConfig, Path, type PathConfig, Rect, type RectConfig, RegularPolygon, type RegularPolygonConfig, Ring, type RingConfig, Shape, type ShapeConfig, Sprite, type SpriteConfig, Stage, type StageConfig, Star, type StarConfig, Tag, type TagConfig, Text, type TextConfig, TextPath, type TextPathConfig, Transform, Transformer, type TransformerConfig, Tween, type TweenConfig, Util, type Vector2d, Wedge, type WedgeConfig, _global, _injectGlobal, _mouseDblClickPointerId, _mouseInDblClickWindow, _mouseListenClick, _pointerDblClickPointerId, _pointerInDblClickWindow, _pointerListenClick, _renderBackend, _touchDblClickPointerId, _touchInDblClickWindow, _touchListenClick, angleDeg, autoDrawEnabled, capturePointerEventsEnabled, dblClickWindow, document, dragButtons, dragDistance, enableTrace, getAngle, hitOnDragEnabled, isBrowser, isDragReady, isDragging, isTransforming, isUnminified, legacyTextRendering, pixelRatio, pointerEventsEnabled, releaseCanvasOnDestroy, shapes, showWarnings, stages, version };
|