@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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 NanoForge
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<br />
|
|
3
|
+
<p>
|
|
4
|
+
<a href="https://github.com/NanoForge-dev"><img src="https://github.com/NanoForge-dev/blob/main/.github/logo.png" width="546" alt="NanoForge" /></a>
|
|
5
|
+
</p>
|
|
6
|
+
<br />
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@nanoforge-dev/graphics-2d"><img src="https://img.shields.io/npm/v/@nanoforge-dev/graphics-2d.svg?maxAge=3600" alt="npm version" /></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@nanoforge-dev/graphics-2d"><img src="https://img.shields.io/npm/dt/@nanoforge-dev/graphics-2d.svg?maxAge=3600" alt="npm downloads" /></a>
|
|
10
|
+
<a href="https://github.com/NanoForge-dev/Engine/actions"><img src="https://github.com/NanoForge-dev/Engine/actions/workflows/tests.yml/badge.svg" alt="Tests status" /></a>
|
|
11
|
+
<a href="https://github.com/NanoForge-dev/Engine/commits/main/packages/graphics-2d"><img src="https://img.shields.io/github/last-commit/NanoForge-dev/Engine.svg?logo=github&logoColor=ffffff&path=packages%2Fgraphics-2d" alt="Last commit." /></a>
|
|
12
|
+
</p>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
## About
|
|
16
|
+
|
|
17
|
+
`@nanoforge-dev/graphics-2d` is a base 2D graphics library.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
**Node.js 24.11.0 or newer is required.**
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm install @nanoforge-dev/graphics-2d
|
|
25
|
+
yarn add @nanoforge-dev/graphics-2d
|
|
26
|
+
pnpm add @nanoforge-dev/graphics-2d
|
|
27
|
+
bun add @nanoforge-dev/graphics-2d
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example usage
|
|
31
|
+
|
|
32
|
+
Initialize the library in your main file with a red circle.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { type IRunClientOptions } from "@nanoforge-dev/common";
|
|
36
|
+
import { NanoforgeFactory } from "@nanoforge-dev/core";
|
|
37
|
+
import { ECSClientLibrary } from "@nanoforge-dev/ecs-client";
|
|
38
|
+
import { Circle, Graphics2DLibrary, Layer } from "@nanoforge-dev/graphics-2d";
|
|
39
|
+
|
|
40
|
+
import { CircleComponent } from "./components/CircleComponent";
|
|
41
|
+
|
|
42
|
+
export async function main(options: IRunClientOptions) {
|
|
43
|
+
const app = NanoforgeFactory.createClient();
|
|
44
|
+
|
|
45
|
+
const ecs = new ECSClientLibrary();
|
|
46
|
+
const graphics = new Graphics2DLibrary();
|
|
47
|
+
|
|
48
|
+
app.useComponentSystem(ecs);
|
|
49
|
+
app.useGraphics(graphics);
|
|
50
|
+
|
|
51
|
+
await app.init(options);
|
|
52
|
+
|
|
53
|
+
const registry = ecs.registry;
|
|
54
|
+
|
|
55
|
+
const layer = new Layer();
|
|
56
|
+
graphics.stage.add(layer);
|
|
57
|
+
|
|
58
|
+
const entity = registry.spawnEntity();
|
|
59
|
+
registry.addComponent(
|
|
60
|
+
entity,
|
|
61
|
+
new CircleComponent(
|
|
62
|
+
new Circle({
|
|
63
|
+
radius: 70,
|
|
64
|
+
fill: "red",
|
|
65
|
+
}),
|
|
66
|
+
layer,
|
|
67
|
+
),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
await app.run();
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
With circle component defined.
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { type Circle, type Layer } from "@nanoforge-dev/graphics-2d";
|
|
78
|
+
|
|
79
|
+
export class CircleComponent {
|
|
80
|
+
name = "CircleComponent";
|
|
81
|
+
component: Circle;
|
|
82
|
+
|
|
83
|
+
constructor(component: Circle, layer: Layer) {
|
|
84
|
+
this.component = component;
|
|
85
|
+
layer.add(this.component);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Links
|
|
91
|
+
|
|
92
|
+
- [GitHub][source]
|
|
93
|
+
- [npm][npm]
|
|
94
|
+
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
|
|
98
|
+
[documentation][documentation].
|
|
99
|
+
See [the contribution guide][contributing] if you'd like to submit a PR.
|
|
100
|
+
|
|
101
|
+
## Help
|
|
102
|
+
|
|
103
|
+
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in [discussions][discussions].
|
|
104
|
+
|
|
105
|
+
[documentation]: https://github.com/NanoForge-dev/Engine
|
|
106
|
+
[discussions]: https://github.com/NanoForge-dev/Engine/discussions
|
|
107
|
+
[source]: https://github.com/NanoForge-dev/Engine/tree/main/packages/graphics-2d
|
|
108
|
+
[npm]: https://www.npmjs.com/package/@nanoforge-dev/graphics-2d
|
|
109
|
+
[contributing]: https://github.com/NanoForge-dev/Engine/blob/main/.github/CONTRIBUTING.md
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var index_exports = {};
|
|
33
|
+
__export(index_exports, {
|
|
34
|
+
Animation: () => Animation,
|
|
35
|
+
Arc: () => Arc,
|
|
36
|
+
Arrow: () => Arrow,
|
|
37
|
+
Canvas: () => Canvas,
|
|
38
|
+
Circle: () => Circle,
|
|
39
|
+
Container: () => Container,
|
|
40
|
+
Context: () => Context,
|
|
41
|
+
DD: () => DD,
|
|
42
|
+
Easings: () => Easings,
|
|
43
|
+
Ellipse: () => Ellipse,
|
|
44
|
+
FastLayer: () => FastLayer,
|
|
45
|
+
Filters: () => Filters,
|
|
46
|
+
Graphics2DLibrary: () => Graphics2DLibrary,
|
|
47
|
+
Group: () => Group,
|
|
48
|
+
Image: () => Image,
|
|
49
|
+
Label: () => Label,
|
|
50
|
+
Layer: () => Layer,
|
|
51
|
+
Line: () => Line,
|
|
52
|
+
Node: () => Node,
|
|
53
|
+
Path: () => Path,
|
|
54
|
+
Rect: () => Rect,
|
|
55
|
+
RegularPolygon: () => RegularPolygon,
|
|
56
|
+
Ring: () => Ring,
|
|
57
|
+
Shape: () => Shape,
|
|
58
|
+
Sprite: () => Sprite,
|
|
59
|
+
Stage: () => Stage,
|
|
60
|
+
Star: () => Star,
|
|
61
|
+
Tag: () => Tag,
|
|
62
|
+
Text: () => Text,
|
|
63
|
+
TextPath: () => TextPath,
|
|
64
|
+
Transform: () => Transform,
|
|
65
|
+
Transformer: () => Transformer,
|
|
66
|
+
Tween: () => Tween,
|
|
67
|
+
Util: () => Util,
|
|
68
|
+
Wedge: () => Wedge,
|
|
69
|
+
_global: () => _global,
|
|
70
|
+
_injectGlobal: () => _injectGlobal,
|
|
71
|
+
_mouseDblClickPointerId: () => _mouseDblClickPointerId,
|
|
72
|
+
_mouseInDblClickWindow: () => _mouseInDblClickWindow,
|
|
73
|
+
_mouseListenClick: () => _mouseListenClick,
|
|
74
|
+
_pointerDblClickPointerId: () => _pointerDblClickPointerId,
|
|
75
|
+
_pointerInDblClickWindow: () => _pointerInDblClickWindow,
|
|
76
|
+
_pointerListenClick: () => _pointerListenClick,
|
|
77
|
+
_renderBackend: () => _renderBackend,
|
|
78
|
+
_touchDblClickPointerId: () => _touchDblClickPointerId,
|
|
79
|
+
_touchInDblClickWindow: () => _touchInDblClickWindow,
|
|
80
|
+
_touchListenClick: () => _touchListenClick,
|
|
81
|
+
angleDeg: () => angleDeg,
|
|
82
|
+
autoDrawEnabled: () => autoDrawEnabled,
|
|
83
|
+
capturePointerEventsEnabled: () => capturePointerEventsEnabled,
|
|
84
|
+
dblClickWindow: () => dblClickWindow,
|
|
85
|
+
document: () => document,
|
|
86
|
+
dragButtons: () => dragButtons,
|
|
87
|
+
dragDistance: () => dragDistance,
|
|
88
|
+
enableTrace: () => enableTrace,
|
|
89
|
+
getAngle: () => getAngle,
|
|
90
|
+
hitOnDragEnabled: () => hitOnDragEnabled,
|
|
91
|
+
isBrowser: () => isBrowser,
|
|
92
|
+
isDragReady: () => isDragReady,
|
|
93
|
+
isDragging: () => isDragging,
|
|
94
|
+
isTransforming: () => isTransforming,
|
|
95
|
+
isUnminified: () => isUnminified,
|
|
96
|
+
legacyTextRendering: () => legacyTextRendering,
|
|
97
|
+
pixelRatio: () => pixelRatio,
|
|
98
|
+
pointerEventsEnabled: () => pointerEventsEnabled,
|
|
99
|
+
releaseCanvasOnDestroy: () => releaseCanvasOnDestroy,
|
|
100
|
+
shapes: () => shapes,
|
|
101
|
+
showWarnings: () => showWarnings,
|
|
102
|
+
stages: () => stages,
|
|
103
|
+
version: () => version
|
|
104
|
+
});
|
|
105
|
+
module.exports = __toCommonJS(index_exports);
|
|
106
|
+
|
|
107
|
+
// src/graphics-2d.library.ts
|
|
108
|
+
var import_common = require("@nanoforge-dev/common");
|
|
109
|
+
|
|
110
|
+
// src/exports/konva.ts
|
|
111
|
+
var import_konva = __toESM(require("konva"), 1);
|
|
112
|
+
var Animation = import_konva.default.Animation;
|
|
113
|
+
var Arc = import_konva.default.Arc;
|
|
114
|
+
var Arrow = import_konva.default.Arrow;
|
|
115
|
+
var Canvas = import_konva.default.Canvas;
|
|
116
|
+
var Circle = import_konva.default.Circle;
|
|
117
|
+
var Container = import_konva.default.Container;
|
|
118
|
+
var Context = import_konva.default.Context;
|
|
119
|
+
var DD = import_konva.default.DD;
|
|
120
|
+
var Easings = import_konva.default.Easings;
|
|
121
|
+
var Ellipse = import_konva.default.Ellipse;
|
|
122
|
+
var FastLayer = import_konva.default.FastLayer;
|
|
123
|
+
var Filters = import_konva.default.Filters;
|
|
124
|
+
var Group = import_konva.default.Group;
|
|
125
|
+
var Image = import_konva.default.Image;
|
|
126
|
+
var Label = import_konva.default.Label;
|
|
127
|
+
var Layer = import_konva.default.Layer;
|
|
128
|
+
var Line = import_konva.default.Line;
|
|
129
|
+
var Node = import_konva.default.Node;
|
|
130
|
+
var Path = import_konva.default.Path;
|
|
131
|
+
var Rect = import_konva.default.Rect;
|
|
132
|
+
var RegularPolygon = import_konva.default.RegularPolygon;
|
|
133
|
+
var Ring = import_konva.default.Ring;
|
|
134
|
+
var Shape = import_konva.default.Shape;
|
|
135
|
+
var Sprite = import_konva.default.Sprite;
|
|
136
|
+
var Stage = import_konva.default.Stage;
|
|
137
|
+
var Star = import_konva.default.Star;
|
|
138
|
+
var Tag = import_konva.default.Tag;
|
|
139
|
+
var Text = import_konva.default.Text;
|
|
140
|
+
var TextPath = import_konva.default.TextPath;
|
|
141
|
+
var Transform = import_konva.default.Transform;
|
|
142
|
+
var Transformer = import_konva.default.Transformer;
|
|
143
|
+
var Tween = import_konva.default.Tween;
|
|
144
|
+
var Util = import_konva.default.Util;
|
|
145
|
+
var Wedge = import_konva.default.Wedge;
|
|
146
|
+
var _global = import_konva.default._global;
|
|
147
|
+
var _injectGlobal = import_konva.default._injectGlobal;
|
|
148
|
+
var _mouseDblClickPointerId = import_konva.default._mouseDblClickPointerId;
|
|
149
|
+
var _mouseInDblClickWindow = import_konva.default._mouseInDblClickWindow;
|
|
150
|
+
var _mouseListenClick = import_konva.default._mouseListenClick;
|
|
151
|
+
var _pointerDblClickPointerId = import_konva.default._pointerDblClickPointerId;
|
|
152
|
+
var _pointerInDblClickWindow = import_konva.default._pointerInDblClickWindow;
|
|
153
|
+
var _pointerListenClick = import_konva.default._pointerListenClick;
|
|
154
|
+
var _renderBackend = import_konva.default._renderBackend;
|
|
155
|
+
var _touchDblClickPointerId = import_konva.default._touchDblClickPointerId;
|
|
156
|
+
var _touchInDblClickWindow = import_konva.default._touchInDblClickWindow;
|
|
157
|
+
var _touchListenClick = import_konva.default._touchListenClick;
|
|
158
|
+
var angleDeg = import_konva.default.angleDeg;
|
|
159
|
+
var autoDrawEnabled = import_konva.default.autoDrawEnabled;
|
|
160
|
+
var capturePointerEventsEnabled = import_konva.default.capturePointerEventsEnabled;
|
|
161
|
+
var dblClickWindow = import_konva.default.dblClickWindow;
|
|
162
|
+
var document = import_konva.default.document;
|
|
163
|
+
var dragButtons = import_konva.default.dragButtons;
|
|
164
|
+
var dragDistance = import_konva.default.dragDistance;
|
|
165
|
+
var enableTrace = import_konva.default.enableTrace;
|
|
166
|
+
var getAngle = import_konva.default.getAngle;
|
|
167
|
+
var hitOnDragEnabled = import_konva.default.hitOnDragEnabled;
|
|
168
|
+
var isBrowser = import_konva.default.isBrowser;
|
|
169
|
+
var isDragReady = import_konva.default.isDragReady;
|
|
170
|
+
var isDragging = import_konva.default.isDragging;
|
|
171
|
+
var isTransforming = import_konva.default.isTransforming;
|
|
172
|
+
var isUnminified = import_konva.default.isUnminified;
|
|
173
|
+
var legacyTextRendering = import_konva.default.legacyTextRendering;
|
|
174
|
+
var pixelRatio = import_konva.default.pixelRatio;
|
|
175
|
+
var pointerEventsEnabled = import_konva.default.pointerEventsEnabled;
|
|
176
|
+
var releaseCanvasOnDestroy = import_konva.default.releaseCanvasOnDestroy;
|
|
177
|
+
var shapes = import_konva.default.shapes;
|
|
178
|
+
var showWarnings = import_konva.default.showWarnings;
|
|
179
|
+
var stages = import_konva.default.stages;
|
|
180
|
+
var version = import_konva.default.version;
|
|
181
|
+
|
|
182
|
+
// src/graphics-2d.library.ts
|
|
183
|
+
var Graphics2DLibrary = class extends import_common.BaseGraphicsLibrary {
|
|
184
|
+
static {
|
|
185
|
+
__name(this, "Graphics2DLibrary");
|
|
186
|
+
}
|
|
187
|
+
_stage;
|
|
188
|
+
get __name() {
|
|
189
|
+
return "Graphics2DLibrary";
|
|
190
|
+
}
|
|
191
|
+
get stage() {
|
|
192
|
+
if (!this._stage) this.throwNotInitializedError();
|
|
193
|
+
return this._stage;
|
|
194
|
+
}
|
|
195
|
+
async __init(context) {
|
|
196
|
+
if (!context.canvas) {
|
|
197
|
+
throw new Error("Can't initialize the canvas context");
|
|
198
|
+
}
|
|
199
|
+
this._stage = new Stage({
|
|
200
|
+
container: context.canvas.parentElement,
|
|
201
|
+
width: window.innerWidth,
|
|
202
|
+
height: window.innerHeight
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
async __run() {
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
209
|
+
0 && (module.exports = {
|
|
210
|
+
Animation,
|
|
211
|
+
Arc,
|
|
212
|
+
Arrow,
|
|
213
|
+
Canvas,
|
|
214
|
+
Circle,
|
|
215
|
+
Container,
|
|
216
|
+
Context,
|
|
217
|
+
DD,
|
|
218
|
+
Easings,
|
|
219
|
+
Ellipse,
|
|
220
|
+
FastLayer,
|
|
221
|
+
Filters,
|
|
222
|
+
Graphics2DLibrary,
|
|
223
|
+
Group,
|
|
224
|
+
Image,
|
|
225
|
+
Label,
|
|
226
|
+
Layer,
|
|
227
|
+
Line,
|
|
228
|
+
Node,
|
|
229
|
+
Path,
|
|
230
|
+
Rect,
|
|
231
|
+
RegularPolygon,
|
|
232
|
+
Ring,
|
|
233
|
+
Shape,
|
|
234
|
+
Sprite,
|
|
235
|
+
Stage,
|
|
236
|
+
Star,
|
|
237
|
+
Tag,
|
|
238
|
+
Text,
|
|
239
|
+
TextPath,
|
|
240
|
+
Transform,
|
|
241
|
+
Transformer,
|
|
242
|
+
Tween,
|
|
243
|
+
Util,
|
|
244
|
+
Wedge,
|
|
245
|
+
_global,
|
|
246
|
+
_injectGlobal,
|
|
247
|
+
_mouseDblClickPointerId,
|
|
248
|
+
_mouseInDblClickWindow,
|
|
249
|
+
_mouseListenClick,
|
|
250
|
+
_pointerDblClickPointerId,
|
|
251
|
+
_pointerInDblClickWindow,
|
|
252
|
+
_pointerListenClick,
|
|
253
|
+
_renderBackend,
|
|
254
|
+
_touchDblClickPointerId,
|
|
255
|
+
_touchInDblClickWindow,
|
|
256
|
+
_touchListenClick,
|
|
257
|
+
angleDeg,
|
|
258
|
+
autoDrawEnabled,
|
|
259
|
+
capturePointerEventsEnabled,
|
|
260
|
+
dblClickWindow,
|
|
261
|
+
document,
|
|
262
|
+
dragButtons,
|
|
263
|
+
dragDistance,
|
|
264
|
+
enableTrace,
|
|
265
|
+
getAngle,
|
|
266
|
+
hitOnDragEnabled,
|
|
267
|
+
isBrowser,
|
|
268
|
+
isDragReady,
|
|
269
|
+
isDragging,
|
|
270
|
+
isTransforming,
|
|
271
|
+
isUnminified,
|
|
272
|
+
legacyTextRendering,
|
|
273
|
+
pixelRatio,
|
|
274
|
+
pointerEventsEnabled,
|
|
275
|
+
releaseCanvasOnDestroy,
|
|
276
|
+
shapes,
|
|
277
|
+
showWarnings,
|
|
278
|
+
stages,
|
|
279
|
+
version
|
|
280
|
+
});
|
|
281
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/graphics-2d.library.ts","../src/exports/konva.ts"],"sourcesContent":["export { Graphics2DLibrary } from \"./graphics-2d.library\";\nexport * from \"./exports/konva\";\n","import { BaseGraphicsLibrary, type InitContext } from \"@nanoforge-dev/common\";\n\nimport * as Graphics from \"./exports/konva\";\n\nexport class Graphics2DLibrary extends BaseGraphicsLibrary {\n private _stage?: Graphics.Stage;\n\n get __name(): string {\n return \"Graphics2DLibrary\";\n }\n\n get stage(): Graphics.Stage {\n if (!this._stage) this.throwNotInitializedError();\n return this._stage;\n }\n\n public override async __init(context: InitContext): Promise<void> {\n if (!context.canvas) {\n throw new Error(\"Can't initialize the canvas context\");\n }\n this._stage = new Graphics.Stage({\n container: context.canvas.parentElement as HTMLDivElement,\n width: window.innerWidth,\n height: window.innerHeight,\n });\n }\n\n public async __run(): Promise<void> {}\n}\n","import Konva from \"konva\";\n\nexport const Animation = Konva.Animation;\nexport type Animation = Konva.Animation;\n\nexport const Arc = Konva.Arc;\nexport type Arc = Konva.Arc;\n\nexport type ArcConfig = Konva.ArcConfig;\n\nexport const Arrow = Konva.Arrow;\nexport type Arrow = Konva.Arrow;\n\nexport type ArrowConfig = Konva.ArrowConfig;\n\nexport const Canvas = Konva.Canvas;\nexport type Canvas = typeof Konva.Canvas;\n\nexport const Circle = Konva.Circle;\nexport type Circle = Konva.Circle;\n\nexport type CircleConfig = Konva.CircleConfig;\n\nexport const Container = Konva.Container;\nexport type Container = Konva.Container;\n\nexport type ContainerConfig = Konva.ContainerConfig;\n\nexport const Context = Konva.Context;\nexport type Context = Konva.Context;\n\nexport const DD = Konva.DD;\nexport type DD = typeof Konva.DD;\n\nexport const Easings = Konva.Easings;\nexport type Easings = typeof Konva.Easings;\n\nexport const Ellipse = Konva.Ellipse;\nexport type Ellipse = Konva.Ellipse;\n\nexport type EllipseConfig = Konva.EllipseConfig;\n\nexport const FastLayer = Konva.FastLayer;\nexport type FastLayer = Konva.FastLayer;\n\nexport const Filters = Konva.Filters;\nexport type Filters = typeof Konva.Filters;\n\nexport const Group = Konva.Group;\nexport type Group = Konva.Group;\n\nexport type GroupConfig = Konva.GroupConfig;\n\nexport const Image = Konva.Image;\nexport type Image = Konva.Image;\n\nexport type ImageConfig = Konva.ImageConfig;\n\nexport type KonvaEventListener<This, EventType> = Konva.KonvaEventListener<This, EventType>;\n\nexport type KonvaEventObject<EventType> = Konva.KonvaEventObject<EventType>;\n\nexport type KonvaPointerEvent = Konva.KonvaPointerEvent;\n\nexport const Label = Konva.Label;\nexport type Label = Konva.Label;\n\nexport type LabelConfig = Konva.LabelConfig;\n\nexport const Layer = Konva.Layer;\nexport type Layer = Konva.Layer;\n\nexport type LayerConfig = Konva.LayerConfig;\n\nexport const Line = Konva.Line;\nexport type Line = Konva.Line;\n\nexport type LineConfig = Konva.LineConfig;\n\nexport const Node = Konva.Node;\nexport type Node = Konva.Node;\n\nexport type NodeConfig = Konva.NodeConfig;\n\nexport const Path = Konva.Path;\nexport type Path = Konva.Path;\n\nexport type PathConfig = Konva.PathConfig;\n\nexport const Rect = Konva.Rect;\nexport type Rect = Konva.Rect;\n\nexport type RectConfig = Konva.RectConfig;\n\nexport const RegularPolygon = Konva.RegularPolygon;\nexport type RegularPolygon = Konva.RegularPolygon;\n\nexport type RegularPolygonConfig = Konva.RegularPolygonConfig;\n\nexport const Ring = Konva.Ring;\nexport type Ring = Konva.Ring;\n\nexport type RingConfig = Konva.RingConfig;\n\nexport const Shape = Konva.Shape;\nexport type Shape = Konva.Shape;\n\nexport type ShapeConfig = Konva.ShapeConfig;\n\nexport const Sprite = Konva.Sprite;\nexport type Sprite = Konva.Sprite;\n\nexport type SpriteConfig = Konva.SpriteConfig;\n\nexport const Stage = Konva.Stage;\nexport type Stage = Konva.Stage;\n\nexport type StageConfig = Konva.StageConfig;\n\nexport const Star = Konva.Star;\nexport type Star = Konva.Star;\n\nexport type StarConfig = Konva.StarConfig;\n\nexport const Tag = Konva.Tag;\nexport type Tag = Konva.Tag;\n\nexport type TagConfig = Konva.TagConfig;\n\nexport const Text = Konva.Text;\nexport type Text = Konva.Text;\n\nexport type TextConfig = Konva.TextConfig;\n\nexport const TextPath = Konva.TextPath;\nexport type TextPath = Konva.TextPath;\n\nexport type TextPathConfig = Konva.TextPathConfig;\n\nexport const Transform = Konva.Transform;\nexport type Transform = Konva.Transform;\n\nexport const Transformer = Konva.Transformer;\nexport type Transformer = Konva.Transformer;\n\nexport type TransformerConfig = Konva.TransformerConfig;\n\nexport const Tween = Konva.Tween;\nexport type Tween = Konva.Tween;\n\nexport type TweenConfig = Konva.TweenConfig;\n\nexport const Util = Konva.Util;\nexport type Util = typeof Konva.Util;\n\nexport type Vector2d = Konva.Vector2d;\n\nexport const Wedge = Konva.Wedge;\nexport type Wedge = Konva.Wedge;\n\nexport type WedgeConfig = Konva.WedgeConfig;\n\nexport const _global = Konva._global;\n\nexport const _injectGlobal = Konva._injectGlobal;\n\nexport const _mouseDblClickPointerId = Konva._mouseDblClickPointerId;\n\nexport const _mouseInDblClickWindow = Konva._mouseInDblClickWindow;\n\nexport const _mouseListenClick = Konva._mouseListenClick;\n\nexport const _pointerDblClickPointerId = Konva._pointerDblClickPointerId;\n\nexport const _pointerInDblClickWindow = Konva._pointerInDblClickWindow;\n\nexport const _pointerListenClick = Konva._pointerListenClick;\n\nexport const _renderBackend = Konva._renderBackend;\n\nexport const _touchDblClickPointerId = Konva._touchDblClickPointerId;\n\nexport const _touchInDblClickWindow = Konva._touchInDblClickWindow;\n\nexport const _touchListenClick = Konva._touchListenClick;\n\nexport const angleDeg = Konva.angleDeg;\n\nexport const autoDrawEnabled = Konva.autoDrawEnabled;\n\nexport const capturePointerEventsEnabled = Konva.capturePointerEventsEnabled;\n\nexport const dblClickWindow = Konva.dblClickWindow;\n\nexport const document = Konva.document;\n\nexport const dragButtons = Konva.dragButtons;\n\nexport const dragDistance = Konva.dragDistance;\n\nexport const enableTrace = Konva.enableTrace;\n\nexport const getAngle = Konva.getAngle;\n\nexport const hitOnDragEnabled = Konva.hitOnDragEnabled;\n\nexport const isBrowser = Konva.isBrowser;\n\nexport const isDragReady = Konva.isDragReady;\n\nexport const isDragging = Konva.isDragging;\n\nexport const isTransforming = Konva.isTransforming;\n\nexport const isUnminified = Konva.isUnminified;\n\nexport const legacyTextRendering = Konva.legacyTextRendering;\n\nexport const pixelRatio = Konva.pixelRatio;\n\nexport const pointerEventsEnabled = Konva.pointerEventsEnabled;\n\nexport const releaseCanvasOnDestroy = Konva.releaseCanvasOnDestroy;\n\nexport const shapes = Konva.shapes;\n\nexport const showWarnings = Konva.showWarnings;\n\nexport const stages = Konva.stages;\n\nexport const version = Konva.version;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAAsD;;;ACAtD,mBAAkB;AAEX,IAAM,YAA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