@thi.ng/geom-fuzz 2.2.105 → 3.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/CHANGELOG.md +17 -1
- package/README.md +2 -3
- package/api.d.ts +3 -5
- package/line.d.ts +2 -2
- package/package.json +15 -16
- package/polygon.js +4 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,22 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
# [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-fuzz@3.0.0) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### 🛑 Breaking changes
|
|
15
|
+
|
|
16
|
+
- update FuzzyPolygonOpts, internal refactoring ([2bc65e7](https://github.com/thi-ng/umbrella/commit/2bc65e7))
|
|
17
|
+
- BREAKING CHANGE: update FuzzyPolygonOpts curve config
|
|
18
|
+
- update/replace FuzzyPolygonOpts curve opts with full `CubicOpts` (from [@thi.ng/geom-api](https://github.com/thi-ng/umbrella/tree/main/packages/geom-api))
|
|
19
|
+
|
|
20
|
+
#### 🩹 Bug fixes
|
|
21
|
+
|
|
22
|
+
- update imports ([5c0450f](https://github.com/thi-ng/umbrella/commit/5c0450f))
|
|
23
|
+
|
|
24
|
+
#### ♻️ Refactoring
|
|
25
|
+
|
|
26
|
+
- remove geom-api dep, update imports ([3fa0dfc](https://github.com/thi-ng/umbrella/commit/3fa0dfc))
|
|
27
|
+
|
|
12
28
|
### [2.2.54](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-fuzz@2.2.54) (2023-11-09)
|
|
13
29
|
|
|
14
30
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -67,7 +67,7 @@ For Node.js REPL:
|
|
|
67
67
|
const gfuzz = await import("@thi.ng/geom-fuzz");
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 1.
|
|
70
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 1.19 KB
|
|
71
71
|
|
|
72
72
|
## Dependencies
|
|
73
73
|
|
|
@@ -75,7 +75,6 @@ Package sizes (brotli'd, pre-treeshake): ESM: 1.20 KB
|
|
|
75
75
|
- [@thi.ng/associative](https://github.com/thi-ng/umbrella/tree/develop/packages/associative)
|
|
76
76
|
- [@thi.ng/color](https://github.com/thi-ng/umbrella/tree/develop/packages/color)
|
|
77
77
|
- [@thi.ng/geom](https://github.com/thi-ng/umbrella/tree/develop/packages/geom)
|
|
78
|
-
- [@thi.ng/geom-api](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-api)
|
|
79
78
|
- [@thi.ng/geom-clip-line](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-clip-line)
|
|
80
79
|
- [@thi.ng/geom-resample](https://github.com/thi-ng/umbrella/tree/develop/packages/geom-resample)
|
|
81
80
|
- [@thi.ng/grid-iterators](https://github.com/thi-ng/umbrella/tree/develop/packages/grid-iterators)
|
package/api.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type { Fn } from "@thi.ng/api";
|
|
2
2
|
import type { IColor } from "@thi.ng/color";
|
|
3
|
-
import type { Polygon } from "@thi.ng/geom";
|
|
4
|
-
import type { IHiccupShape } from "@thi.ng/geom-api";
|
|
3
|
+
import type { CubicOpts, IHiccupShape2, Polygon } from "@thi.ng/geom";
|
|
5
4
|
import type { PointTransform2D } from "@thi.ng/grid-iterators/api";
|
|
6
5
|
export type Color = string | number[] | IColor;
|
|
7
|
-
export type FillFn = Fn<Polygon,
|
|
6
|
+
export type FillFn = Fn<Polygon, IHiccupShape2>;
|
|
8
7
|
export type HatchDir = "d" | "h" | "v";
|
|
9
8
|
export type FlipDir = "x" | "y" | "xy";
|
|
10
9
|
export interface FuzzyPolygonOpts {
|
|
11
10
|
num: number;
|
|
12
11
|
jitter: number;
|
|
13
|
-
|
|
14
|
-
curveScale: number;
|
|
12
|
+
curve: Partial<CubicOpts>;
|
|
15
13
|
fill: FillFn;
|
|
16
14
|
}
|
|
17
15
|
export interface FuzzyLineOpts {
|
package/line.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Fn3 } from "@thi.ng/api";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IHiccupShape2 } from "@thi.ng/geom";
|
|
3
3
|
import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
4
4
|
import { type FuzzyLineOpts } from "./api.js";
|
|
5
|
-
export declare const defLine: (opts?: Partial<FuzzyLineOpts>) => Fn3<ReadonlyVec, ReadonlyVec, boolean,
|
|
5
|
+
export declare const defLine: (opts?: Partial<FuzzyLineOpts>) => Fn3<ReadonlyVec, ReadonlyVec, boolean, IHiccupShape2>;
|
|
6
6
|
//# sourceMappingURL=line.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-fuzz",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Highly configurable, fuzzy line & polygon creation with presets and composable fill & stroke styles. Canvas & SVG support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/geom-fuzz",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,22 +36,21 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/associative": "^6.3.
|
|
41
|
-
"@thi.ng/color": "^5.6.
|
|
42
|
-
"@thi.ng/geom": "^
|
|
43
|
-
"@thi.ng/geom-
|
|
44
|
-
"@thi.ng/geom-
|
|
45
|
-
"@thi.ng/
|
|
46
|
-
"@thi.ng/
|
|
47
|
-
"@thi.ng/
|
|
48
|
-
"@thi.ng/vectors": "^7.10.31"
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/associative": "^6.3.61",
|
|
41
|
+
"@thi.ng/color": "^5.6.46",
|
|
42
|
+
"@thi.ng/geom": "^8.0.0",
|
|
43
|
+
"@thi.ng/geom-clip-line": "^2.3.90",
|
|
44
|
+
"@thi.ng/geom-resample": "^3.0.0",
|
|
45
|
+
"@thi.ng/grid-iterators": "^4.0.75",
|
|
46
|
+
"@thi.ng/transducers": "^9.0.6",
|
|
47
|
+
"@thi.ng/vectors": "^7.11.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@microsoft/api-extractor": "^7.
|
|
52
|
-
"esbuild": "^0.21.
|
|
50
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
51
|
+
"esbuild": "^0.21.5",
|
|
53
52
|
"typedoc": "^0.25.13",
|
|
54
|
-
"typescript": "^5.
|
|
53
|
+
"typescript": "^5.5.2"
|
|
55
54
|
},
|
|
56
55
|
"keywords": [
|
|
57
56
|
"2d",
|
|
@@ -121,5 +120,5 @@
|
|
|
121
120
|
],
|
|
122
121
|
"year": 2020
|
|
123
122
|
},
|
|
124
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
125
124
|
}
|
package/polygon.js
CHANGED
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import { asCubic } from "@thi.ng/geom/as-cubic";
|
|
2
2
|
import { group } from "@thi.ng/geom/group";
|
|
3
|
-
import { pathFromCubics } from "@thi.ng/geom/path";
|
|
3
|
+
import { pathFromCubics } from "@thi.ng/geom/path-from-cubics";
|
|
4
4
|
import { polygon } from "@thi.ng/geom/polygon";
|
|
5
5
|
import { jitterPoints } from "./points.js";
|
|
6
6
|
const fuzzyPoly = (pts, attribs = {}, opts = {}) => {
|
|
7
7
|
opts = {
|
|
8
8
|
num: 2,
|
|
9
9
|
jitter: 2,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
...opts
|
|
10
|
+
...opts,
|
|
11
|
+
curve: { mode: "break", ...opts.curve }
|
|
13
12
|
};
|
|
14
13
|
const acc = group(attribs, []);
|
|
15
14
|
for (; --opts.num >= 0; ) {
|
|
16
15
|
const poly = polygon(jitterPoints(pts, opts.jitter));
|
|
17
|
-
acc.children.push(
|
|
18
|
-
pathFromCubics(
|
|
19
|
-
asCubic(poly, {
|
|
20
|
-
breakPoints: opts.curveBreakPoints,
|
|
21
|
-
scale: opts.curveScale
|
|
22
|
-
})
|
|
23
|
-
)
|
|
24
|
-
);
|
|
16
|
+
acc.children.push(pathFromCubics(asCubic(poly, opts.curve)));
|
|
25
17
|
if (!opts.num && opts.fill) {
|
|
26
18
|
acc.children.push(opts.fill(poly));
|
|
27
19
|
}
|