mudlet-map-renderer 0.36.0-konva → 0.37.0-konva
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 +11 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +564 -338
- package/dist/index.mjs.map +1 -1
- package/dist/style/ChaosStyle.d.ts +46 -0
- package/dist/style/index.d.ts +4 -1
- package/package.json +3 -4
- package/dist/index.cjs +0 -6
- package/dist/index.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -279,9 +279,17 @@ Writing a new exporter — e.g. PDF — means shipping a class that implements
|
|
|
279
279
|
|
|
280
280
|
### Headless rendering (no DOM)
|
|
281
281
|
|
|
282
|
-
For server-side or offscreen rendering,
|
|
282
|
+
For server-side or offscreen rendering (Node.js), install [`canvas`](https://www.npmjs.com/package/canvas) alongside this package and import Konva's canvas backend once at startup. `canvas` is a peer dependency — it isn't shipped transitively because browsers don't need it.
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
yarn add canvas
|
|
286
|
+
```
|
|
283
287
|
|
|
284
288
|
```ts
|
|
289
|
+
import "konva/canvas-backend"; // must run before creating a MapRenderer
|
|
290
|
+
import { MapRenderer, createSettings, SvgExporter, PngBytesExporter } from "mudlet-map-renderer";
|
|
291
|
+
|
|
292
|
+
// Omit the container argument for headless rendering.
|
|
285
293
|
const renderer = new MapRenderer(mapReader, createSettings());
|
|
286
294
|
|
|
287
295
|
renderer.drawArea(42, 0);
|
|
@@ -291,6 +299,8 @@ const svg = renderer.export(new SvgExporter({ padding: 5 }));
|
|
|
291
299
|
const png = renderer.export(new PngBytesExporter({ width: 1920, height: 1080 }));
|
|
292
300
|
```
|
|
293
301
|
|
|
302
|
+
SVG export doesn't actually hit Konva, so if you only need SVG you can skip both the `canvas` install and the `konva/canvas-backend` import. PNG / canvas exporters and anything that builds a Konva stage do require them.
|
|
303
|
+
|
|
294
304
|
### Overlays
|
|
295
305
|
|
|
296
306
|
Two kinds, picked by what you need:
|
package/dist/index.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export type { DrawingBackend, GroupNode, LayerNode, CoordFn, RectConfig, CircleC
|
|
|
11
11
|
export { BaseStyle, compose, identityStyle, IDENTITY_TRANSFORM } from './backend/DrawingBackend';
|
|
12
12
|
export { CanvasBackend } from './backend/CanvasBackend';
|
|
13
13
|
export { SvgBackend, SvgGroupNode, SvgLayerNode } from './backend/SvgBackend';
|
|
14
|
-
export { SketchyStyle, ParchmentStyle, BlueprintStyle, NeonStyle, IsometricStyle, } from './style';
|
|
14
|
+
export { SketchyStyle, ParchmentStyle, BlueprintStyle, NeonStyle, ChaosStyle, IsometricStyle, } from './style';
|
|
15
15
|
export type { IsometricRotation } from './style';
|
|
16
|
-
export { Parchment, Blueprint, Neon, Sketchy, Isometric, } from './style';
|
|
16
|
+
export { Parchment, Blueprint, Neon, Chaos, Sketchy, Isometric, } from './style';
|
|
17
17
|
export type { SketchyOptions, IsometricOptions } from './style';
|
|
18
18
|
export type { Exporter, ExportContext, ExportCanvas } from './export/Exporter';
|
|
19
19
|
export { SvgExporter } from './export/SvgExporter';
|