@weasel-js/svg 1.10.0 → 1.10.1

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 CHANGED
@@ -4,7 +4,7 @@ SVG import/export for @weasel-js/core: parse SVG strings into weasel-native shap
4
4
 
5
5
  Part of [weasel](https://github.com/orochi235/weasel), a domain-agnostic 2D
6
6
  scene-graph canvas kit for React. See the
7
- [API reference](https://orochi235.github.io/weasel/api/).
7
+ [API reference](https://orochi235.github.io/weasel/#pkg/svg).
8
8
 
9
9
  ## Install
10
10
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Mat3 } from '@weasel-js/geom';
1
+ import { Affine } from '@weasel-js/geom';
2
2
  import { Path, Paint, ScreenLength, StrokeAlign, MarkerRef, StyledRun, TextStyle, TextVerticalAlign, Fill, Stroke, PoseLinear, MarkerEntry, RenderNeeds, TilePatternSpec, ImageNodeData, IngestCtx } from '@weasel-js/core';
3
3
 
4
4
  /**
@@ -74,10 +74,10 @@ interface NamespacedElement {
74
74
  }
75
75
  /**
76
76
  * 2x3 affine matrix in SVG's `matrix(a b c d e f)` order, mapping
77
- * `[x', y'] = [a*x + c*y + e, b*x + d*y + f]`. It is geom's `Mat3`, so the
77
+ * `[x', y'] = [a*x + c*y + e, b*x + d*y + f]`. It is geom's `Affine`, so the
78
78
  * two are interchangeable without a conversion.
79
79
  */
80
- type Matrix = Mat3;
80
+ type Matrix = Affine;
81
81
 
82
82
  /** The identity matrix. */
83
83
  declare const IDENTITY_MATRIX: Matrix;
@@ -410,6 +410,11 @@ declare function nativeSvgKind(kind: string): boolean;
410
410
  * but renderers other than weasel blend it in sRGB. */
411
411
  declare function nativeSvgSpace(space: string | null | undefined): boolean;
412
412
 
413
+ /**
414
+ * Serialize a `SvgNode[]` tree to an SVG document string. Every path leaf is
415
+ * emitted as a `<path>`, even shapes that started as `<rect>` etc.
416
+ */
417
+
413
418
  /**
414
419
  * Produce an SVG document string. The root `viewBox` is `opts.viewBox` if
415
420
  * supplied, otherwise a tight bounding box around every leaf.
@@ -525,6 +530,9 @@ interface SvgKitTreeNode {
525
530
  kind: string;
526
531
  data: unknown;
527
532
  pose: SvgKitPose;
533
+ /** A container's copies, as the kit's `ContainerNode.copiesFromPose`
534
+ * draws them: each is written as a transformed group of its children. */
535
+ copiesFromPose?(pose: SvgKitPose, node: never): readonly Matrix[] | null;
528
536
  }
529
537
  /** The read side of a scene that {@link svgNodesFromKit} walks. A kit
530
538
  * `Scene` is one as it stands. */