konva 9.3.21 → 10.0.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/README.md +1 -1
- package/konva.js +664 -226
- package/konva.min.js +46 -4
- package/lib/Animation.d.ts +2 -2
- package/lib/Animation.js +7 -11
- package/lib/BezierFunctions.js +9 -15
- package/lib/Canvas.d.ts +1 -1
- package/lib/Canvas.js +14 -20
- package/lib/Container.d.ts +7 -6
- package/lib/Container.js +12 -16
- package/lib/Context.d.ts +7 -5
- package/lib/Context.js +34 -14
- package/lib/Core.d.ts +2 -2
- package/lib/Core.js +3 -7
- package/lib/DragAndDrop.d.ts +3 -3
- package/lib/DragAndDrop.js +24 -27
- package/lib/Factory.d.ts +2 -2
- package/lib/Factory.js +24 -27
- package/lib/FastLayer.d.ts +1 -1
- package/lib/FastLayer.js +6 -10
- package/lib/Global.d.ts +4 -3
- package/lib/Global.js +19 -19
- package/lib/Group.d.ts +4 -3
- package/lib/Group.js +6 -10
- package/lib/Layer.d.ts +10 -9
- package/lib/Layer.js +33 -37
- package/lib/Node.d.ts +16 -13
- package/lib/Node.js +207 -123
- package/lib/PointerEvents.d.ts +4 -4
- package/lib/PointerEvents.js +7 -14
- package/lib/Shape.d.ts +7 -4
- package/lib/Shape.js +91 -91
- package/lib/Stage.d.ts +8 -7
- package/lib/Stage.js +66 -56
- package/lib/Tween.d.ts +3 -2
- package/lib/Tween.js +29 -31
- package/lib/Util.d.ts +3 -2
- package/lib/Util.js +98 -38
- package/lib/Validators.js +44 -57
- package/lib/_CoreInternals.d.ts +49 -23
- package/lib/_CoreInternals.js +33 -36
- package/lib/_FullInternals.d.ts +126 -62
- package/lib/_FullInternals.js +77 -78
- package/lib/canvas-backend.d.ts +2 -0
- package/lib/canvas-backend.js +27 -0
- package/lib/filters/Blur.d.ts +1 -1
- package/lib/filters/Blur.js +5 -9
- package/lib/filters/Brighten.d.ts +1 -1
- package/lib/filters/Brighten.js +5 -9
- package/lib/filters/Brightness.d.ts +2 -0
- package/lib/filters/Brightness.js +8 -0
- package/lib/filters/Contrast.d.ts +1 -1
- package/lib/filters/Contrast.js +5 -9
- package/lib/filters/Emboss.d.ts +1 -1
- package/lib/filters/Emboss.js +95 -101
- package/lib/filters/Enhance.d.ts +1 -1
- package/lib/filters/Enhance.js +5 -9
- package/lib/filters/Grayscale.d.ts +1 -1
- package/lib/filters/Grayscale.js +1 -5
- package/lib/filters/HSL.d.ts +1 -1
- package/lib/filters/HSL.js +7 -11
- package/lib/filters/HSV.d.ts +1 -1
- package/lib/filters/HSV.js +7 -11
- package/lib/filters/Invert.d.ts +1 -1
- package/lib/filters/Invert.js +1 -5
- package/lib/filters/Kaleidoscope.d.ts +1 -1
- package/lib/filters/Kaleidoscope.js +9 -13
- package/lib/filters/Mask.d.ts +1 -1
- package/lib/filters/Mask.js +16 -10
- package/lib/filters/Noise.d.ts +1 -1
- package/lib/filters/Noise.js +5 -9
- package/lib/filters/Pixelate.d.ts +1 -1
- package/lib/filters/Pixelate.js +7 -11
- package/lib/filters/Posterize.d.ts +1 -1
- package/lib/filters/Posterize.js +5 -9
- package/lib/filters/RGB.d.ts +1 -1
- package/lib/filters/RGB.js +7 -11
- package/lib/filters/RGBA.d.ts +1 -1
- package/lib/filters/RGBA.js +8 -12
- package/lib/filters/Sepia.d.ts +1 -1
- package/lib/filters/Sepia.js +1 -5
- package/lib/filters/Solarize.d.ts +1 -1
- package/lib/filters/Solarize.js +13 -29
- package/lib/filters/Threshold.d.ts +1 -1
- package/lib/filters/Threshold.js +5 -9
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -4
- package/lib/shapes/Arc.d.ts +4 -3
- package/lib/shapes/Arc.js +13 -17
- package/lib/shapes/Arrow.d.ts +4 -3
- package/lib/shapes/Arrow.js +13 -17
- package/lib/shapes/Circle.d.ts +4 -3
- package/lib/shapes/Circle.js +7 -11
- package/lib/shapes/Ellipse.d.ts +4 -3
- package/lib/shapes/Ellipse.js +9 -13
- package/lib/shapes/Image.d.ts +4 -3
- package/lib/shapes/Image.js +17 -21
- package/lib/shapes/Label.d.ts +7 -6
- package/lib/shapes/Label.js +13 -18
- package/lib/shapes/Line.d.ts +4 -3
- package/lib/shapes/Line.js +10 -14
- package/lib/shapes/Path.d.ts +3 -2
- package/lib/shapes/Path.js +83 -23
- package/lib/shapes/Rect.d.ts +4 -3
- package/lib/shapes/Rect.js +9 -13
- package/lib/shapes/RegularPolygon.d.ts +6 -3
- package/lib/shapes/RegularPolygon.js +19 -16
- package/lib/shapes/Ring.d.ts +4 -3
- package/lib/shapes/Ring.js +8 -12
- package/lib/shapes/Sprite.d.ts +5 -4
- package/lib/shapes/Sprite.js +15 -19
- package/lib/shapes/Star.d.ts +4 -3
- package/lib/shapes/Star.js +9 -13
- package/lib/shapes/Text.d.ts +16 -3
- package/lib/shapes/Text.js +73 -53
- package/lib/shapes/TextPath.d.ts +5 -4
- package/lib/shapes/TextPath.js +48 -41
- package/lib/shapes/Transformer.d.ts +8 -8
- package/lib/shapes/Transformer.js +90 -90
- package/lib/shapes/Wedge.d.ts +4 -3
- package/lib/shapes/Wedge.js +12 -16
- package/lib/skia-backend.d.ts +2 -0
- package/lib/skia-backend.js +24 -0
- package/lib/types.d.ts +22 -22
- package/lib/types.js +21 -25
- package/package.json +53 -25
- package/lib/index-node.d.ts +0 -2
- package/lib/index-node.js +0 -21
- package/lib/index-types.d.ts +0 -181
package/lib/_FullInternals.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import { Konva as Core } from './_CoreInternals.ts';
|
|
2
|
+
import { Arc } from './shapes/Arc.ts';
|
|
3
|
+
import { Arrow } from './shapes/Arrow.ts';
|
|
4
|
+
import { Circle } from './shapes/Circle.ts';
|
|
5
|
+
import { Ellipse } from './shapes/Ellipse.ts';
|
|
6
|
+
import { Image } from './shapes/Image.ts';
|
|
7
|
+
import { Label, Tag } from './shapes/Label.ts';
|
|
8
|
+
import { Line } from './shapes/Line.ts';
|
|
9
|
+
import { Path } from './shapes/Path.ts';
|
|
10
|
+
import { Rect } from './shapes/Rect.ts';
|
|
11
|
+
import { RegularPolygon } from './shapes/RegularPolygon.ts';
|
|
12
|
+
import { Ring } from './shapes/Ring.ts';
|
|
13
|
+
import { Sprite } from './shapes/Sprite.ts';
|
|
14
|
+
import { Star } from './shapes/Star.ts';
|
|
15
|
+
import { Text } from './shapes/Text.ts';
|
|
16
|
+
import { TextPath } from './shapes/TextPath.ts';
|
|
17
|
+
import { Transformer } from './shapes/Transformer.ts';
|
|
18
|
+
import { Wedge } from './shapes/Wedge.ts';
|
|
18
19
|
export declare const Konva: {
|
|
19
20
|
_global: any;
|
|
20
21
|
version: string;
|
|
@@ -36,14 +37,15 @@ export declare const Konva: {
|
|
|
36
37
|
_mouseDblClickPointerId: null;
|
|
37
38
|
_touchDblClickPointerId: null;
|
|
38
39
|
_pointerDblClickPointerId: null;
|
|
39
|
-
|
|
40
|
+
_renderBackend: string;
|
|
41
|
+
legacyTextRendering: boolean;
|
|
40
42
|
pixelRatio: number;
|
|
41
43
|
dragDistance: number;
|
|
42
44
|
angleDeg: boolean;
|
|
43
45
|
showWarnings: boolean;
|
|
44
46
|
dragButtons: number[];
|
|
45
|
-
isDragging():
|
|
46
|
-
isTransforming():
|
|
47
|
+
isDragging(): boolean;
|
|
48
|
+
isTransforming(): boolean;
|
|
47
49
|
isDragReady(): boolean;
|
|
48
50
|
releaseCanvasOnDestroy: boolean;
|
|
49
51
|
document: any;
|
|
@@ -66,9 +68,9 @@ export declare const Konva: {
|
|
|
66
68
|
_isInDocument(el: any): boolean;
|
|
67
69
|
_urlToImage(url: string, callback: Function): void;
|
|
68
70
|
_rgbToHex(r: number, g: number, b: number): string;
|
|
69
|
-
_hexToRgb(hex: string): import("./types.
|
|
71
|
+
_hexToRgb(hex: string): import("./types.ts").RGB;
|
|
70
72
|
getRandomColor(): string;
|
|
71
|
-
getRGB(color: string): import("./types.
|
|
73
|
+
getRGB(color: string): import("./types.ts").RGB;
|
|
72
74
|
colorToRGBA(str: string): {
|
|
73
75
|
r: number;
|
|
74
76
|
g: number;
|
|
@@ -123,7 +125,7 @@ export declare const Konva: {
|
|
|
123
125
|
b: number;
|
|
124
126
|
a: number;
|
|
125
127
|
} | undefined;
|
|
126
|
-
haveIntersection(r1: import("./types").IRect, r2: import("./types.
|
|
128
|
+
haveIntersection(r1: import("./types.ts").IRect, r2: import("./types.ts").IRect): boolean;
|
|
127
129
|
cloneObject<Any>(obj: Any): Any;
|
|
128
130
|
cloneArray(arr: Array<any>): any[];
|
|
129
131
|
degToRad(deg: number): number;
|
|
@@ -138,30 +140,31 @@ export declare const Konva: {
|
|
|
138
140
|
each(obj: object, func: Function): void;
|
|
139
141
|
_inRange(val: number, left: number, right: number): boolean;
|
|
140
142
|
_getProjectionToSegment(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): any[];
|
|
141
|
-
_getProjectionToLine(pt: import("./types").Vector2d, line: Array<import("./types").Vector2d>, isClosed: boolean): import("./types.
|
|
143
|
+
_getProjectionToLine(pt: import("./types.ts").Vector2d, line: Array<import("./types.ts").Vector2d>, isClosed: boolean): import("./types.ts").Vector2d;
|
|
142
144
|
_prepareArrayForTween(startArray: any, endArray: any, isClosed: any): number[];
|
|
143
145
|
_prepareToStringify<T>(obj: any): T | null;
|
|
144
146
|
_assign<T, U>(target: T, source: U): T & U;
|
|
145
147
|
_getFirstPointerId(evt: any): any;
|
|
146
148
|
releaseCanvas(...canvases: HTMLCanvasElement[]): void;
|
|
147
|
-
drawRoundedRectPath(context: import("./Context.
|
|
149
|
+
drawRoundedRectPath(context: import("./Context.ts").Context, width: number, height: number, cornerRadius: number | number[]): void;
|
|
150
|
+
drawRoundedPolygonPath(context: import("./Context.ts").Context, points: import("./types.ts").Vector2d[], sides: number, radius: number, cornerRadius: number | number[]): void;
|
|
148
151
|
};
|
|
149
|
-
Transform: typeof import("./Util.
|
|
150
|
-
Node: typeof import("./Node.
|
|
151
|
-
Container: typeof import("./Container.
|
|
152
|
-
Stage: typeof import("./Stage.
|
|
153
|
-
stages: import("./Stage.
|
|
154
|
-
Layer: typeof import("./Layer.
|
|
155
|
-
FastLayer: typeof import("./FastLayer.
|
|
156
|
-
Group: typeof import("./Group.
|
|
152
|
+
Transform: typeof import("./Util.ts").Transform;
|
|
153
|
+
Node: typeof import("./Node.ts").Node;
|
|
154
|
+
Container: typeof import("./Container.ts").Container;
|
|
155
|
+
Stage: typeof import("./Stage.ts").Stage;
|
|
156
|
+
stages: import("./Stage.ts").Stage[];
|
|
157
|
+
Layer: typeof import("./Layer.ts").Layer;
|
|
158
|
+
FastLayer: typeof import("./FastLayer.ts").FastLayer;
|
|
159
|
+
Group: typeof import("./Group.ts").Group;
|
|
157
160
|
DD: {
|
|
158
161
|
readonly isDragging: boolean;
|
|
159
162
|
justDragged: boolean;
|
|
160
|
-
readonly node: import("./Node").Node<import("./Node.
|
|
163
|
+
readonly node: import("./Node.ts").Node<import("./Node.ts").NodeConfig> | undefined;
|
|
161
164
|
_dragElements: Map<number, {
|
|
162
|
-
node: import("./Node.
|
|
163
|
-
startPointerPos: import("./types.
|
|
164
|
-
offset: import("./types.
|
|
165
|
+
node: import("./Node.ts").Node;
|
|
166
|
+
startPointerPos: import("./types.ts").Vector2d;
|
|
167
|
+
offset: import("./types.ts").Vector2d;
|
|
165
168
|
pointerId?: number;
|
|
166
169
|
dragStatus: "ready" | "dragging" | "stopped";
|
|
167
170
|
}>;
|
|
@@ -169,12 +172,12 @@ export declare const Konva: {
|
|
|
169
172
|
_endDragBefore(evt?: any): void;
|
|
170
173
|
_endDragAfter(evt: any): void;
|
|
171
174
|
};
|
|
172
|
-
Shape: typeof import("./Shape.
|
|
175
|
+
Shape: typeof import("./Shape.ts").Shape;
|
|
173
176
|
shapes: {
|
|
174
|
-
[key: string]: import("./Shape").Shape<import("./Shape.
|
|
177
|
+
[key: string]: import("./Shape.ts").Shape<import("./Shape.ts").ShapeConfig>;
|
|
175
178
|
};
|
|
176
|
-
Animation: typeof import("./Animation.
|
|
177
|
-
Tween: typeof import("./Tween.
|
|
179
|
+
Animation: typeof import("./Animation.ts").Animation;
|
|
180
|
+
Tween: typeof import("./Tween.ts").Tween;
|
|
178
181
|
Easings: {
|
|
179
182
|
BackEaseIn(t: any, b: any, c: any, d: any): any;
|
|
180
183
|
BackEaseOut(t: any, b: any, c: any, d: any): any;
|
|
@@ -193,8 +196,8 @@ export declare const Konva: {
|
|
|
193
196
|
StrongEaseInOut(t: any, b: any, c: any, d: any): any;
|
|
194
197
|
Linear(t: any, b: any, c: any, d: any): any;
|
|
195
198
|
};
|
|
196
|
-
Context: typeof import("./Context.
|
|
197
|
-
Canvas: typeof import("./Canvas.
|
|
199
|
+
Context: typeof import("./Context.ts").Context;
|
|
200
|
+
Canvas: typeof import("./Canvas.ts").Canvas;
|
|
198
201
|
} & {
|
|
199
202
|
Arc: typeof Arc;
|
|
200
203
|
Arrow: typeof Arrow;
|
|
@@ -215,24 +218,85 @@ export declare const Konva: {
|
|
|
215
218
|
Transformer: typeof Transformer;
|
|
216
219
|
Wedge: typeof Wedge;
|
|
217
220
|
Filters: {
|
|
218
|
-
Blur: import("./Node.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
221
|
+
Blur: import("./Node.ts").Filter;
|
|
222
|
+
Brightness: import("./Node.ts").Filter;
|
|
223
|
+
Brighten: import("./Node.ts").Filter;
|
|
224
|
+
Contrast: import("./Node.ts").Filter;
|
|
225
|
+
Emboss: import("./Node.ts").Filter;
|
|
226
|
+
Enhance: import("./Node.ts").Filter;
|
|
227
|
+
Grayscale: import("./Node.ts").Filter;
|
|
228
|
+
HSL: import("./Node.ts").Filter;
|
|
229
|
+
HSV: import("./Node.ts").Filter;
|
|
230
|
+
Invert: import("./Node.ts").Filter;
|
|
231
|
+
Kaleidoscope: import("./Node.ts").Filter;
|
|
232
|
+
Mask: import("./Node.ts").Filter;
|
|
233
|
+
Noise: import("./Node.ts").Filter;
|
|
234
|
+
Pixelate: import("./Node.ts").Filter;
|
|
235
|
+
Posterize: import("./Node.ts").Filter;
|
|
236
|
+
RGB: import("./Node.ts").Filter;
|
|
237
|
+
RGBA: import("./Node.ts").Filter;
|
|
238
|
+
Sepia: import("./Node.ts").Filter;
|
|
239
|
+
Solarize: import("./Node.ts").Filter;
|
|
240
|
+
Threshold: import("./Node.ts").Filter;
|
|
237
241
|
};
|
|
238
242
|
};
|
|
243
|
+
export declare namespace Konva {
|
|
244
|
+
type Vector2d = Core.Vector2d;
|
|
245
|
+
type Node = Core.Node;
|
|
246
|
+
type NodeConfig = Core.NodeConfig;
|
|
247
|
+
type KonvaEventObject<EventType> = Core.KonvaEventObject<EventType>;
|
|
248
|
+
type KonvaPointerEvent = Core.KonvaPointerEvent;
|
|
249
|
+
type KonvaEventListener<This, EventType> = Core.KonvaEventListener<This, EventType>;
|
|
250
|
+
type Container = Core.Container;
|
|
251
|
+
type ContainerConfig = Core.ContainerConfig;
|
|
252
|
+
type Transform = Core.Transform;
|
|
253
|
+
type Context = Core.Context;
|
|
254
|
+
type Stage = Core.Stage;
|
|
255
|
+
type StageConfig = Core.StageConfig;
|
|
256
|
+
type Layer = Core.Layer;
|
|
257
|
+
type LayerConfig = Core.LayerConfig;
|
|
258
|
+
type FastLayer = Core.FastLayer;
|
|
259
|
+
type Group = Core.Group;
|
|
260
|
+
type GroupConfig = Core.GroupConfig;
|
|
261
|
+
type Shape = Core.Shape;
|
|
262
|
+
type ShapeConfig = Core.ShapeConfig;
|
|
263
|
+
type Animation = Core.Animation;
|
|
264
|
+
type Tween = Core.Tween;
|
|
265
|
+
type TweenConfig = Core.TweenConfig;
|
|
266
|
+
type Arc = import('./shapes/Arc.ts').Arc;
|
|
267
|
+
type ArcConfig = import('./shapes/Arc.ts').ArcConfig;
|
|
268
|
+
type Arrow = import('./shapes/Arrow.ts').Arrow;
|
|
269
|
+
type ArrowConfig = import('./shapes/Arrow.ts').ArrowConfig;
|
|
270
|
+
type Circle = import('./shapes/Circle.ts').Circle;
|
|
271
|
+
type CircleConfig = import('./shapes/Circle.ts').CircleConfig;
|
|
272
|
+
type Ellipse = import('./shapes/Ellipse.ts').Ellipse;
|
|
273
|
+
type EllipseConfig = import('./shapes/Ellipse.ts').EllipseConfig;
|
|
274
|
+
type Image = import('./shapes/Image.ts').Image;
|
|
275
|
+
type ImageConfig = import('./shapes/Image.ts').ImageConfig;
|
|
276
|
+
type Label = import('./shapes/Label.ts').Label;
|
|
277
|
+
type LabelConfig = import('./shapes/Label.ts').LabelConfig;
|
|
278
|
+
type Tag = import('./shapes/Label.ts').Tag;
|
|
279
|
+
type TagConfig = import('./shapes/Label.ts').TagConfig;
|
|
280
|
+
type Line = import('./shapes/Line.ts').Line;
|
|
281
|
+
type LineConfig = import('./shapes/Line.ts').LineConfig;
|
|
282
|
+
type Path = import('./shapes/Path.ts').Path;
|
|
283
|
+
type PathConfig = import('./shapes/Path.ts').PathConfig;
|
|
284
|
+
type Rect = import('./shapes/Rect.ts').Rect;
|
|
285
|
+
type RectConfig = import('./shapes/Rect.ts').RectConfig;
|
|
286
|
+
type RegularPolygon = import('./shapes/RegularPolygon.ts').RegularPolygon;
|
|
287
|
+
type RegularPolygonConfig = import('./shapes/RegularPolygon.ts').RegularPolygonConfig;
|
|
288
|
+
type Ring = import('./shapes/Ring.ts').Ring;
|
|
289
|
+
type RingConfig = import('./shapes/Ring.ts').RingConfig;
|
|
290
|
+
type Sprite = import('./shapes/Sprite.ts').Sprite;
|
|
291
|
+
type SpriteConfig = import('./shapes/Sprite.ts').SpriteConfig;
|
|
292
|
+
type Star = import('./shapes/Star.ts').Star;
|
|
293
|
+
type StarConfig = import('./shapes/Star.ts').StarConfig;
|
|
294
|
+
type Text = import('./shapes/Text.ts').Text;
|
|
295
|
+
type TextConfig = import('./shapes/Text.ts').TextConfig;
|
|
296
|
+
type TextPath = import('./shapes/TextPath.ts').TextPath;
|
|
297
|
+
type TextPathConfig = import('./shapes/TextPath.ts').TextPathConfig;
|
|
298
|
+
type Transformer = import('./shapes/Transformer.ts').Transformer;
|
|
299
|
+
type TransformerConfig = import('./shapes/Transformer.ts').TransformerConfig;
|
|
300
|
+
type Wedge = import('./shapes/Wedge.ts').Wedge;
|
|
301
|
+
type WedgeConfig = import('./shapes/Wedge.ts').WedgeConfig;
|
|
302
|
+
}
|
package/lib/_FullInternals.js
CHANGED
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Transformer: Transformer_1.Transformer,
|
|
59
|
-
Wedge: Wedge_1.Wedge,
|
|
1
|
+
import { Konva as Core } from "./_CoreInternals.js";
|
|
2
|
+
import { Arc } from "./shapes/Arc.js";
|
|
3
|
+
import { Arrow } from "./shapes/Arrow.js";
|
|
4
|
+
import { Circle } from "./shapes/Circle.js";
|
|
5
|
+
import { Ellipse } from "./shapes/Ellipse.js";
|
|
6
|
+
import { Image } from "./shapes/Image.js";
|
|
7
|
+
import { Label, Tag } from "./shapes/Label.js";
|
|
8
|
+
import { Line } from "./shapes/Line.js";
|
|
9
|
+
import { Path } from "./shapes/Path.js";
|
|
10
|
+
import { Rect } from "./shapes/Rect.js";
|
|
11
|
+
import { RegularPolygon } from "./shapes/RegularPolygon.js";
|
|
12
|
+
import { Ring } from "./shapes/Ring.js";
|
|
13
|
+
import { Sprite } from "./shapes/Sprite.js";
|
|
14
|
+
import { Star } from "./shapes/Star.js";
|
|
15
|
+
import { Text } from "./shapes/Text.js";
|
|
16
|
+
import { TextPath } from "./shapes/TextPath.js";
|
|
17
|
+
import { Transformer } from "./shapes/Transformer.js";
|
|
18
|
+
import { Wedge } from "./shapes/Wedge.js";
|
|
19
|
+
import { Blur } from "./filters/Blur.js";
|
|
20
|
+
import { Brighten } from "./filters/Brighten.js";
|
|
21
|
+
import { Brightness } from "./filters/Brightness.js";
|
|
22
|
+
import { Contrast } from "./filters/Contrast.js";
|
|
23
|
+
import { Emboss } from "./filters/Emboss.js";
|
|
24
|
+
import { Enhance } from "./filters/Enhance.js";
|
|
25
|
+
import { Grayscale } from "./filters/Grayscale.js";
|
|
26
|
+
import { HSL } from "./filters/HSL.js";
|
|
27
|
+
import { HSV } from "./filters/HSV.js";
|
|
28
|
+
import { Invert } from "./filters/Invert.js";
|
|
29
|
+
import { Kaleidoscope } from "./filters/Kaleidoscope.js";
|
|
30
|
+
import { Mask } from "./filters/Mask.js";
|
|
31
|
+
import { Noise } from "./filters/Noise.js";
|
|
32
|
+
import { Pixelate } from "./filters/Pixelate.js";
|
|
33
|
+
import { Posterize } from "./filters/Posterize.js";
|
|
34
|
+
import { RGB } from "./filters/RGB.js";
|
|
35
|
+
import { RGBA } from "./filters/RGBA.js";
|
|
36
|
+
import { Sepia } from "./filters/Sepia.js";
|
|
37
|
+
import { Solarize } from "./filters/Solarize.js";
|
|
38
|
+
import { Threshold } from "./filters/Threshold.js";
|
|
39
|
+
export const Konva = Core.Util._assign(Core, {
|
|
40
|
+
Arc,
|
|
41
|
+
Arrow,
|
|
42
|
+
Circle,
|
|
43
|
+
Ellipse,
|
|
44
|
+
Image,
|
|
45
|
+
Label,
|
|
46
|
+
Tag,
|
|
47
|
+
Line,
|
|
48
|
+
Path,
|
|
49
|
+
Rect,
|
|
50
|
+
RegularPolygon,
|
|
51
|
+
Ring,
|
|
52
|
+
Sprite,
|
|
53
|
+
Star,
|
|
54
|
+
Text,
|
|
55
|
+
TextPath,
|
|
56
|
+
Transformer,
|
|
57
|
+
Wedge,
|
|
60
58
|
Filters: {
|
|
61
|
-
Blur
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
59
|
+
Blur,
|
|
60
|
+
Brightness,
|
|
61
|
+
Brighten,
|
|
62
|
+
Contrast,
|
|
63
|
+
Emboss,
|
|
64
|
+
Enhance,
|
|
65
|
+
Grayscale,
|
|
66
|
+
HSL,
|
|
67
|
+
HSV,
|
|
68
|
+
Invert,
|
|
69
|
+
Kaleidoscope,
|
|
70
|
+
Mask,
|
|
71
|
+
Noise,
|
|
72
|
+
Pixelate,
|
|
73
|
+
Posterize,
|
|
74
|
+
RGB,
|
|
75
|
+
RGBA,
|
|
76
|
+
Sepia,
|
|
77
|
+
Solarize,
|
|
78
|
+
Threshold,
|
|
80
79
|
},
|
|
81
80
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
var _b;
|
|
3
|
+
import { Konva } from "./_CoreInternals.js";
|
|
4
|
+
import * as Canvas from 'canvas';
|
|
5
|
+
const canvas = Canvas['default'] || Canvas;
|
|
6
|
+
global.DOMMatrix = canvas.DOMMatrix;
|
|
7
|
+
(_a = (_b = global).Path2D) !== null && _a !== void 0 ? _a : (_b.Path2D = class Path2D {
|
|
8
|
+
constructor(path) {
|
|
9
|
+
this.path = path;
|
|
10
|
+
}
|
|
11
|
+
get [Symbol.toStringTag]() {
|
|
12
|
+
return `Path2D`;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Konva.Util['createCanvasElement'] = () => {
|
|
16
|
+
const node = canvas.createCanvas(300, 300);
|
|
17
|
+
if (!node['style']) {
|
|
18
|
+
node['style'] = {};
|
|
19
|
+
}
|
|
20
|
+
return node;
|
|
21
|
+
};
|
|
22
|
+
Konva.Util.createImageElement = () => {
|
|
23
|
+
const node = new canvas.Image();
|
|
24
|
+
return node;
|
|
25
|
+
};
|
|
26
|
+
Konva._renderBackend = 'node-canvas';
|
|
27
|
+
export default Konva;
|
package/lib/filters/Blur.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Filter } from '../Node.
|
|
1
|
+
import type { Filter } from '../Node.ts';
|
|
2
2
|
export declare const Blur: Filter;
|
package/lib/filters/Blur.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const Factory_1 = require("../Factory");
|
|
5
|
-
const Node_1 = require("../Node");
|
|
6
|
-
const Validators_1 = require("../Validators");
|
|
1
|
+
import { Factory } from "../Factory.js";
|
|
2
|
+
import { Node } from "../Node.js";
|
|
3
|
+
import { getNumberValidator } from "../Validators.js";
|
|
7
4
|
function BlurStack() {
|
|
8
5
|
this.r = 0;
|
|
9
6
|
this.g = 0;
|
|
@@ -229,11 +226,10 @@ function filterGaussBlurRGBA(imageData, radius) {
|
|
|
229
226
|
}
|
|
230
227
|
}
|
|
231
228
|
}
|
|
232
|
-
const Blur = function Blur(imageData) {
|
|
229
|
+
export const Blur = function Blur(imageData) {
|
|
233
230
|
const radius = Math.round(this.blurRadius());
|
|
234
231
|
if (radius > 0) {
|
|
235
232
|
filterGaussBlurRGBA(imageData, radius);
|
|
236
233
|
}
|
|
237
234
|
};
|
|
238
|
-
|
|
239
|
-
Factory_1.Factory.addGetterSetter(Node_1.Node, 'blurRadius', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
|
235
|
+
Factory.addGetterSetter(Node, 'blurRadius', 0, getNumberValidator(), Factory.afterSetFilter);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Filter } from '../Node.
|
|
1
|
+
import type { Filter } from '../Node.ts';
|
|
2
2
|
export declare const Brighten: Filter;
|
package/lib/filters/Brighten.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const Node_1 = require("../Node");
|
|
6
|
-
const Validators_1 = require("../Validators");
|
|
7
|
-
const Brighten = function (imageData) {
|
|
1
|
+
import { Factory } from "../Factory.js";
|
|
2
|
+
import { Node } from "../Node.js";
|
|
3
|
+
import { getNumberValidator } from "../Validators.js";
|
|
4
|
+
export const Brighten = function (imageData) {
|
|
8
5
|
const brightness = this.brightness() * 255, data = imageData.data, len = data.length;
|
|
9
6
|
for (let i = 0; i < len; i += 4) {
|
|
10
7
|
data[i] += brightness;
|
|
@@ -12,5 +9,4 @@ const Brighten = function (imageData) {
|
|
|
12
9
|
data[i + 2] += brightness;
|
|
13
10
|
}
|
|
14
11
|
};
|
|
15
|
-
|
|
16
|
-
Factory_1.Factory.addGetterSetter(Node_1.Node, 'brightness', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
|
12
|
+
Factory.addGetterSetter(Node, 'brightness', 0, getNumberValidator(), Factory.afterSetFilter);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const Brightness = function (imageData) {
|
|
2
|
+
const brightness = this.brightness(), data = imageData.data, len = data.length;
|
|
3
|
+
for (let i = 0; i < len; i += 4) {
|
|
4
|
+
data[i] = Math.min(255, data[i] * brightness);
|
|
5
|
+
data[i + 1] = Math.min(255, data[i + 1] * brightness);
|
|
6
|
+
data[i + 2] = Math.min(255, data[i + 2] * brightness);
|
|
7
|
+
}
|
|
8
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Filter } from '../Node.
|
|
1
|
+
import type { Filter } from '../Node.ts';
|
|
2
2
|
export declare const Contrast: Filter;
|
package/lib/filters/Contrast.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const Node_1 = require("../Node");
|
|
6
|
-
const Validators_1 = require("../Validators");
|
|
7
|
-
const Contrast = function (imageData) {
|
|
1
|
+
import { Factory } from "../Factory.js";
|
|
2
|
+
import { Node } from "../Node.js";
|
|
3
|
+
import { getNumberValidator } from "../Validators.js";
|
|
4
|
+
export const Contrast = function (imageData) {
|
|
8
5
|
const adjust = Math.pow((this.contrast() + 100) / 100, 2);
|
|
9
6
|
const data = imageData.data, nPixels = data.length;
|
|
10
7
|
let red = 150, green = 150, blue = 150;
|
|
@@ -35,5 +32,4 @@ const Contrast = function (imageData) {
|
|
|
35
32
|
data[i + 2] = blue;
|
|
36
33
|
}
|
|
37
34
|
};
|
|
38
|
-
|
|
39
|
-
Factory_1.Factory.addGetterSetter(Node_1.Node, 'contrast', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
|
35
|
+
Factory.addGetterSetter(Node, 'contrast', 0, getNumberValidator(), Factory.afterSetFilter);
|
package/lib/filters/Emboss.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Filter } from '../Node.
|
|
1
|
+
import type { Filter } from '../Node.ts';
|
|
2
2
|
export declare const Emboss: Filter;
|