@flighthq/path-formats 0.5.1-next.920.da8f530 → 0.6.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 +2 -2
- package/dist/contract.d.ts +2 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +1 -1
- package/dist/contract.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/svgPathData.d.ts +26 -19
- package/dist/svgPathData.d.ts.map +1 -1
- package/dist/svgPathData.js +497 -286
- package/dist/svgPathData.js.map +1 -1
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/package.json +5 -4
- package/src/svgPathData.test.ts +351 -155
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/path-formats`. The `
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/path-formats@0.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/path-formats@0.6.0](https://github.com/flighthq/flight/tree/ead804bfaef3e691a2e6e43e9711ddd3fd8a84a2/packages/path-formats)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/ead804bfaef3e691a2e6e43e9711ddd3fd8a84a2/LICENSE.md)
|
package/dist/contract.d.ts
CHANGED
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC9G,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/contract.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { appendSvgPathData, explainSvgPathData, formatSvgPathData, parseSvgPathData } from './svgPathData.js';
|
|
2
2
|
//# sourceMappingURL=contract.js.map
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { appendSvgPathData, formatSvgPathData, parseSvgPathData } from './contract';
|
|
1
|
+
export { appendSvgPathData, explainSvgPathData, formatSvgPathData, parseSvgPathData } from './contract.ts';
|
|
2
|
+
export type { SvgPathDataExplanation, SvgPathDataFormatOptions } from './contract.ts';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE3G,YAAY,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { appendSvgPathData, formatSvgPathData, parseSvgPathData } from './contract';
|
|
1
|
+
export { appendSvgPathData, explainSvgPathData, formatSvgPathData, parseSvgPathData } from './contract.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/svgPathData.d.ts
CHANGED
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
import type { Path } from '@flighthq/
|
|
1
|
+
import type { Path } from '@flighthq/path/contract';
|
|
2
|
+
import type { SvgPathDataExplanation, SvgPathDataFormatOptions } from './types.ts';
|
|
2
3
|
/**
|
|
3
4
|
* Parses an SVG path `d` string into the end of an existing `path`, appending its contours via the
|
|
4
|
-
*
|
|
5
|
+
* flight-path builders. Supports the full SVG path grammar: absolute (uppercase) and relative
|
|
5
6
|
* (lowercase) `M L H V C S Q T A Z`, implicit repeated commands, and the smooth-curve shorthands
|
|
6
|
-
* `S`/`T` (reflecting the previous cubic/quadratic control point). Returns `false`
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `S`/`T` (reflecting the previous cubic/quadratic control point). Returns `false` on structurally
|
|
8
|
+
* malformed input (a leading command that is not moveto, an unknown command letter, or a
|
|
9
|
+
* missing/short coordinate run); the input is parsed into a scratch path first, so a failed parse
|
|
10
|
+
* leaves `path` unchanged. Returns `true` when the whole string parses. An empty or
|
|
11
|
+
* whitespace-only string is well-formed and appends nothing.
|
|
10
12
|
*
|
|
11
|
-
* Elliptic arcs (`A`/`a`) are appended through `
|
|
12
|
-
* bezier segments
|
|
13
|
-
* cubics, not an arc verb. The geometry round-trips; the arc command
|
|
13
|
+
* Elliptic arcs (`A`/`a`) are appended through `appendPathEllipticalArcTo`, which approximates
|
|
14
|
+
* them as cubic bezier segments, so a later `forEachPathSegment` walk (and
|
|
15
|
+
* `formatSvgPathData`) sees cubics, not an arc verb. The geometry round-trips; the arc command
|
|
16
|
+
* does not.
|
|
14
17
|
*/
|
|
15
18
|
export declare function appendSvgPathData(path: Path, d: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Explains why an SVG path `d` string cannot be parsed: `undefined` for well-formed input, or the input
|
|
21
|
+
* position (UTF-16 code-unit index) and a stable reason for malformed input.
|
|
22
|
+
*/
|
|
23
|
+
export declare function explainSvgPathData(d: string): SvgPathDataExplanation | undefined;
|
|
16
24
|
/**
|
|
17
25
|
* Serializes a `Path` to an SVG path `d` string, emitting absolute commands. Each `PathSegment`
|
|
18
|
-
* maps to its SVG verb: `
|
|
19
|
-
* `
|
|
26
|
+
* maps to its SVG verb: `MoveTo`→`M`, `LineTo`→`L`, `QuadraticCurveTo`→`Q`, `CubicCurveTo`→`C`,
|
|
27
|
+
* `Close`→`Z`. Arcs are not a distinct segment kind (the path stores them as cubics), so no `A`
|
|
20
28
|
* command is produced.
|
|
21
29
|
*
|
|
22
30
|
* `options.precision`, when given, rounds every coordinate to that many decimal places and drops
|
|
23
|
-
* trailing zeros; the default emits full-precision numbers (also trailing-zero-free).
|
|
31
|
+
* trailing zeros; the default emits full-precision numbers (also trailing-zero-free). Numbers are
|
|
32
|
+
* spelled as JavaScript's `String(number)` spells them.
|
|
24
33
|
*/
|
|
25
|
-
export declare function formatSvgPathData(path: Readonly<Path>, options?: Readonly<
|
|
26
|
-
precision?: number;
|
|
27
|
-
}>): string;
|
|
34
|
+
export declare function formatSvgPathData(path: Readonly<Path>, options?: Readonly<SvgPathDataFormatOptions>): string;
|
|
28
35
|
/**
|
|
29
|
-
* Parses an SVG path `d` string into a freshly allocated `Path`, or
|
|
30
|
-
* malformed input (see `appendSvgPathData` for the malformed cases). An empty or
|
|
31
|
-
* string yields an empty path, not `
|
|
36
|
+
* Parses an SVG path `d` string into a freshly allocated `Path`, or `undefined` on structurally
|
|
37
|
+
* malformed input (see `appendSvgPathData` for the malformed cases). An empty or
|
|
38
|
+
* whitespace-only string yields an empty path, not `undefined`.
|
|
32
39
|
*/
|
|
33
|
-
export declare function parseSvgPathData(d: string): Path |
|
|
40
|
+
export declare function parseSvgPathData(d: string): Path | undefined;
|
|
34
41
|
//# sourceMappingURL=svgPathData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svgPathData.d.ts","sourceRoot":"","sources":["../src/svgPathData.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"svgPathData.d.ts","sourceRoot":"","sources":["../src/svgPathData.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAe,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAUnF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAYhE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAEhF;AAcD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,wBAAwB,CAAC,GAAG,MAAM,CA8C5G;AA+DD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAM5D"}
|