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.
Files changed (129) hide show
  1. package/README.md +1 -1
  2. package/konva.js +664 -226
  3. package/konva.min.js +46 -4
  4. package/lib/Animation.d.ts +2 -2
  5. package/lib/Animation.js +7 -11
  6. package/lib/BezierFunctions.js +9 -15
  7. package/lib/Canvas.d.ts +1 -1
  8. package/lib/Canvas.js +14 -20
  9. package/lib/Container.d.ts +7 -6
  10. package/lib/Container.js +12 -16
  11. package/lib/Context.d.ts +7 -5
  12. package/lib/Context.js +34 -14
  13. package/lib/Core.d.ts +2 -2
  14. package/lib/Core.js +3 -7
  15. package/lib/DragAndDrop.d.ts +3 -3
  16. package/lib/DragAndDrop.js +24 -27
  17. package/lib/Factory.d.ts +2 -2
  18. package/lib/Factory.js +24 -27
  19. package/lib/FastLayer.d.ts +1 -1
  20. package/lib/FastLayer.js +6 -10
  21. package/lib/Global.d.ts +4 -3
  22. package/lib/Global.js +19 -19
  23. package/lib/Group.d.ts +4 -3
  24. package/lib/Group.js +6 -10
  25. package/lib/Layer.d.ts +10 -9
  26. package/lib/Layer.js +33 -37
  27. package/lib/Node.d.ts +16 -13
  28. package/lib/Node.js +207 -123
  29. package/lib/PointerEvents.d.ts +4 -4
  30. package/lib/PointerEvents.js +7 -14
  31. package/lib/Shape.d.ts +7 -4
  32. package/lib/Shape.js +91 -91
  33. package/lib/Stage.d.ts +8 -7
  34. package/lib/Stage.js +66 -56
  35. package/lib/Tween.d.ts +3 -2
  36. package/lib/Tween.js +29 -31
  37. package/lib/Util.d.ts +3 -2
  38. package/lib/Util.js +98 -38
  39. package/lib/Validators.js +44 -57
  40. package/lib/_CoreInternals.d.ts +49 -23
  41. package/lib/_CoreInternals.js +33 -36
  42. package/lib/_FullInternals.d.ts +126 -62
  43. package/lib/_FullInternals.js +77 -78
  44. package/lib/canvas-backend.d.ts +2 -0
  45. package/lib/canvas-backend.js +27 -0
  46. package/lib/filters/Blur.d.ts +1 -1
  47. package/lib/filters/Blur.js +5 -9
  48. package/lib/filters/Brighten.d.ts +1 -1
  49. package/lib/filters/Brighten.js +5 -9
  50. package/lib/filters/Brightness.d.ts +2 -0
  51. package/lib/filters/Brightness.js +8 -0
  52. package/lib/filters/Contrast.d.ts +1 -1
  53. package/lib/filters/Contrast.js +5 -9
  54. package/lib/filters/Emboss.d.ts +1 -1
  55. package/lib/filters/Emboss.js +95 -101
  56. package/lib/filters/Enhance.d.ts +1 -1
  57. package/lib/filters/Enhance.js +5 -9
  58. package/lib/filters/Grayscale.d.ts +1 -1
  59. package/lib/filters/Grayscale.js +1 -5
  60. package/lib/filters/HSL.d.ts +1 -1
  61. package/lib/filters/HSL.js +7 -11
  62. package/lib/filters/HSV.d.ts +1 -1
  63. package/lib/filters/HSV.js +7 -11
  64. package/lib/filters/Invert.d.ts +1 -1
  65. package/lib/filters/Invert.js +1 -5
  66. package/lib/filters/Kaleidoscope.d.ts +1 -1
  67. package/lib/filters/Kaleidoscope.js +9 -13
  68. package/lib/filters/Mask.d.ts +1 -1
  69. package/lib/filters/Mask.js +16 -10
  70. package/lib/filters/Noise.d.ts +1 -1
  71. package/lib/filters/Noise.js +5 -9
  72. package/lib/filters/Pixelate.d.ts +1 -1
  73. package/lib/filters/Pixelate.js +7 -11
  74. package/lib/filters/Posterize.d.ts +1 -1
  75. package/lib/filters/Posterize.js +5 -9
  76. package/lib/filters/RGB.d.ts +1 -1
  77. package/lib/filters/RGB.js +7 -11
  78. package/lib/filters/RGBA.d.ts +1 -1
  79. package/lib/filters/RGBA.js +8 -12
  80. package/lib/filters/Sepia.d.ts +1 -1
  81. package/lib/filters/Sepia.js +1 -5
  82. package/lib/filters/Solarize.d.ts +1 -1
  83. package/lib/filters/Solarize.js +13 -29
  84. package/lib/filters/Threshold.d.ts +1 -1
  85. package/lib/filters/Threshold.js +5 -9
  86. package/lib/index.d.ts +1 -1
  87. package/lib/index.js +2 -4
  88. package/lib/shapes/Arc.d.ts +4 -3
  89. package/lib/shapes/Arc.js +13 -17
  90. package/lib/shapes/Arrow.d.ts +4 -3
  91. package/lib/shapes/Arrow.js +13 -17
  92. package/lib/shapes/Circle.d.ts +4 -3
  93. package/lib/shapes/Circle.js +7 -11
  94. package/lib/shapes/Ellipse.d.ts +4 -3
  95. package/lib/shapes/Ellipse.js +9 -13
  96. package/lib/shapes/Image.d.ts +4 -3
  97. package/lib/shapes/Image.js +17 -21
  98. package/lib/shapes/Label.d.ts +7 -6
  99. package/lib/shapes/Label.js +13 -18
  100. package/lib/shapes/Line.d.ts +4 -3
  101. package/lib/shapes/Line.js +10 -14
  102. package/lib/shapes/Path.d.ts +3 -2
  103. package/lib/shapes/Path.js +83 -23
  104. package/lib/shapes/Rect.d.ts +4 -3
  105. package/lib/shapes/Rect.js +9 -13
  106. package/lib/shapes/RegularPolygon.d.ts +6 -3
  107. package/lib/shapes/RegularPolygon.js +19 -16
  108. package/lib/shapes/Ring.d.ts +4 -3
  109. package/lib/shapes/Ring.js +8 -12
  110. package/lib/shapes/Sprite.d.ts +5 -4
  111. package/lib/shapes/Sprite.js +15 -19
  112. package/lib/shapes/Star.d.ts +4 -3
  113. package/lib/shapes/Star.js +9 -13
  114. package/lib/shapes/Text.d.ts +16 -3
  115. package/lib/shapes/Text.js +73 -53
  116. package/lib/shapes/TextPath.d.ts +5 -4
  117. package/lib/shapes/TextPath.js +48 -41
  118. package/lib/shapes/Transformer.d.ts +8 -8
  119. package/lib/shapes/Transformer.js +90 -90
  120. package/lib/shapes/Wedge.d.ts +4 -3
  121. package/lib/shapes/Wedge.js +12 -16
  122. package/lib/skia-backend.d.ts +2 -0
  123. package/lib/skia-backend.js +24 -0
  124. package/lib/types.d.ts +22 -22
  125. package/lib/types.js +21 -25
  126. package/package.json +53 -25
  127. package/lib/index-node.d.ts +0 -2
  128. package/lib/index-node.js +0 -21
  129. package/lib/index-types.d.ts +0 -181
@@ -1,20 +1,21 @@
1
- import { Arc } from './shapes/Arc.js';
2
- import { Arrow } from './shapes/Arrow.js';
3
- import { Circle } from './shapes/Circle.js';
4
- import { Ellipse } from './shapes/Ellipse.js';
5
- import { Image } from './shapes/Image.js';
6
- import { Label, Tag } from './shapes/Label.js';
7
- import { Line } from './shapes/Line.js';
8
- import { Path } from './shapes/Path.js';
9
- import { Rect } from './shapes/Rect.js';
10
- import { RegularPolygon } from './shapes/RegularPolygon.js';
11
- import { Ring } from './shapes/Ring.js';
12
- import { Sprite } from './shapes/Sprite.js';
13
- import { Star } from './shapes/Star.js';
14
- import { Text } from './shapes/Text.js';
15
- import { TextPath } from './shapes/TextPath.js';
16
- import { Transformer } from './shapes/Transformer.js';
17
- import { Wedge } from './shapes/Wedge.js';
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
- _fixTextRendering: boolean;
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(): any;
46
- isTransforming(): any;
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.js").RGB;
71
+ _hexToRgb(hex: string): import("./types.ts").RGB;
70
72
  getRandomColor(): string;
71
- getRGB(color: string): import("./types.js").RGB;
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.js").IRect): boolean;
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.js").Vector2d;
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.js").Context, width: number, height: number, cornerRadius: number | number[]): void;
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.js").Transform;
150
- Node: typeof import("./Node.js").Node;
151
- Container: typeof import("./Container.js").Container;
152
- Stage: typeof import("./Stage.js").Stage;
153
- stages: import("./Stage.js").Stage[];
154
- Layer: typeof import("./Layer.js").Layer;
155
- FastLayer: typeof import("./FastLayer.js").FastLayer;
156
- Group: typeof import("./Group.js").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.js").NodeConfig> | undefined;
163
+ readonly node: import("./Node.ts").Node<import("./Node.ts").NodeConfig> | undefined;
161
164
  _dragElements: Map<number, {
162
- node: import("./Node.js").Node;
163
- startPointerPos: import("./types.js").Vector2d;
164
- offset: import("./types.js").Vector2d;
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.js").Shape;
175
+ Shape: typeof import("./Shape.ts").Shape;
173
176
  shapes: {
174
- [key: string]: import("./Shape").Shape<import("./Shape.js").ShapeConfig>;
177
+ [key: string]: import("./Shape.ts").Shape<import("./Shape.ts").ShapeConfig>;
175
178
  };
176
- Animation: typeof import("./Animation.js").Animation;
177
- Tween: typeof import("./Tween.js").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.js").Context;
197
- Canvas: typeof import("./Canvas.js").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.js").Filter;
219
- Brighten: import("./Node.js").Filter;
220
- Contrast: import("./Node.js").Filter;
221
- Emboss: import("./Node.js").Filter;
222
- Enhance: import("./Node.js").Filter;
223
- Grayscale: import("./Node.js").Filter;
224
- HSL: import("./Node.js").Filter;
225
- HSV: import("./Node.js").Filter;
226
- Invert: import("./Node.js").Filter;
227
- Kaleidoscope: import("./Node.js").Filter;
228
- Mask: import("./Node.js").Filter;
229
- Noise: import("./Node.js").Filter;
230
- Pixelate: import("./Node.js").Filter;
231
- Posterize: import("./Node.js").Filter;
232
- RGB: import("./Node.js").Filter;
233
- RGBA: import("./Node.js").Filter;
234
- Sepia: import("./Node.js").Filter;
235
- Solarize: import("./Node.js").Filter;
236
- Threshold: import("./Node.js").Filter;
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
+ }
@@ -1,81 +1,80 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Konva = void 0;
4
- const _CoreInternals_1 = require("./_CoreInternals");
5
- const Arc_1 = require("./shapes/Arc");
6
- const Arrow_1 = require("./shapes/Arrow");
7
- const Circle_1 = require("./shapes/Circle");
8
- const Ellipse_1 = require("./shapes/Ellipse");
9
- const Image_1 = require("./shapes/Image");
10
- const Label_1 = require("./shapes/Label");
11
- const Line_1 = require("./shapes/Line");
12
- const Path_1 = require("./shapes/Path");
13
- const Rect_1 = require("./shapes/Rect");
14
- const RegularPolygon_1 = require("./shapes/RegularPolygon");
15
- const Ring_1 = require("./shapes/Ring");
16
- const Sprite_1 = require("./shapes/Sprite");
17
- const Star_1 = require("./shapes/Star");
18
- const Text_1 = require("./shapes/Text");
19
- const TextPath_1 = require("./shapes/TextPath");
20
- const Transformer_1 = require("./shapes/Transformer");
21
- const Wedge_1 = require("./shapes/Wedge");
22
- const Blur_1 = require("./filters/Blur");
23
- const Brighten_1 = require("./filters/Brighten");
24
- const Contrast_1 = require("./filters/Contrast");
25
- const Emboss_1 = require("./filters/Emboss");
26
- const Enhance_1 = require("./filters/Enhance");
27
- const Grayscale_1 = require("./filters/Grayscale");
28
- const HSL_1 = require("./filters/HSL");
29
- const HSV_1 = require("./filters/HSV");
30
- const Invert_1 = require("./filters/Invert");
31
- const Kaleidoscope_1 = require("./filters/Kaleidoscope");
32
- const Mask_1 = require("./filters/Mask");
33
- const Noise_1 = require("./filters/Noise");
34
- const Pixelate_1 = require("./filters/Pixelate");
35
- const Posterize_1 = require("./filters/Posterize");
36
- const RGB_1 = require("./filters/RGB");
37
- const RGBA_1 = require("./filters/RGBA");
38
- const Sepia_1 = require("./filters/Sepia");
39
- const Solarize_1 = require("./filters/Solarize");
40
- const Threshold_1 = require("./filters/Threshold");
41
- exports.Konva = _CoreInternals_1.Konva.Util._assign(_CoreInternals_1.Konva, {
42
- Arc: Arc_1.Arc,
43
- Arrow: Arrow_1.Arrow,
44
- Circle: Circle_1.Circle,
45
- Ellipse: Ellipse_1.Ellipse,
46
- Image: Image_1.Image,
47
- Label: Label_1.Label,
48
- Tag: Label_1.Tag,
49
- Line: Line_1.Line,
50
- Path: Path_1.Path,
51
- Rect: Rect_1.Rect,
52
- RegularPolygon: RegularPolygon_1.RegularPolygon,
53
- Ring: Ring_1.Ring,
54
- Sprite: Sprite_1.Sprite,
55
- Star: Star_1.Star,
56
- Text: Text_1.Text,
57
- TextPath: TextPath_1.TextPath,
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: Blur_1.Blur,
62
- Brighten: Brighten_1.Brighten,
63
- Contrast: Contrast_1.Contrast,
64
- Emboss: Emboss_1.Emboss,
65
- Enhance: Enhance_1.Enhance,
66
- Grayscale: Grayscale_1.Grayscale,
67
- HSL: HSL_1.HSL,
68
- HSV: HSV_1.HSV,
69
- Invert: Invert_1.Invert,
70
- Kaleidoscope: Kaleidoscope_1.Kaleidoscope,
71
- Mask: Mask_1.Mask,
72
- Noise: Noise_1.Noise,
73
- Pixelate: Pixelate_1.Pixelate,
74
- Posterize: Posterize_1.Posterize,
75
- RGB: RGB_1.RGB,
76
- RGBA: RGBA_1.RGBA,
77
- Sepia: Sepia_1.Sepia,
78
- Solarize: Solarize_1.Solarize,
79
- Threshold: Threshold_1.Threshold,
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,2 @@
1
+ import { Konva } from './_CoreInternals.ts';
2
+ export default Konva;
@@ -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;
@@ -1,2 +1,2 @@
1
- import { Filter } from '../Node.js';
1
+ import type { Filter } from '../Node.ts';
2
2
  export declare const Blur: Filter;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Blur = void 0;
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
- exports.Blur = Blur;
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.js';
1
+ import type { Filter } from '../Node.ts';
2
2
  export declare const Brighten: Filter;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Brighten = void 0;
4
- const Factory_1 = require("../Factory");
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
- exports.Brighten = Brighten;
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,2 @@
1
+ import type { Filter } from '../Node.ts';
2
+ export declare const Brightness: Filter;
@@ -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.js';
1
+ import type { Filter } from '../Node.ts';
2
2
  export declare const Contrast: Filter;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Contrast = void 0;
4
- const Factory_1 = require("../Factory");
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
- exports.Contrast = Contrast;
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);
@@ -1,2 +1,2 @@
1
- import { Filter } from '../Node.js';
1
+ import type { Filter } from '../Node.ts';
2
2
  export declare const Emboss: Filter;