@thi.ng/hiccup-svg 5.2.18 → 5.2.20
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 +1 -1
- package/README.md +13 -16
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
<!-- Please see: https://github.com/thi-ng/umbrella/blob/develop/CONTRIBUTING.md#changes-to-readme-files -->
|
|
3
|
-
> [!IMPORTANT]
|
|
4
|
-
> ‼️ Announcing the thi.ng user survey 2024 📋
|
|
5
|
-
>
|
|
6
|
-
> [Please participate in the survey here!](https://forms.gle/XacbSDEmQMPZg8197)\
|
|
7
|
-
> (open until end of February)
|
|
8
|
-
>
|
|
9
|
-
> **To achieve a better sample size, I'd highly appreciate if you could
|
|
10
|
-
> circulate the link to this survey in your own networks.**
|
|
11
|
-
>
|
|
12
|
-
> [Discussion](https://github.com/thi-ng/umbrella/discussions/447)
|
|
13
|
-
|
|
14
3
|
# 
|
|
15
4
|
|
|
16
5
|
[](https://www.npmjs.com/package/@thi.ng/hiccup-svg)
|
|
@@ -22,7 +11,7 @@
|
|
|
22
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
23
12
|
> and anti-framework.
|
|
24
13
|
>
|
|
25
|
-
> 🚀
|
|
14
|
+
> 🚀 Please help me to work full-time on these projects by [sponsoring me on
|
|
26
15
|
> GitHub](https://github.com/sponsors/postspectacular). Thank you! ❤️
|
|
27
16
|
|
|
28
17
|
- [About](#about)
|
|
@@ -51,11 +40,13 @@ context object, they can ONLY be invoked directly, i.e. they MUST be
|
|
|
51
40
|
called like:
|
|
52
41
|
|
|
53
42
|
```ts
|
|
43
|
+
import { circle, svg } from "@thi.ng/hiccup-svg";
|
|
44
|
+
|
|
54
45
|
// correct (direct invocation)
|
|
55
|
-
svg
|
|
46
|
+
svg({}, circle([0, 0], 100, { fill: "red" }));
|
|
56
47
|
|
|
57
48
|
// incorrect / unsupported (lazy evaluation)
|
|
58
|
-
[svg
|
|
49
|
+
[svg, {}, [circle, [0, 0], 100, { fill: "red" }]]
|
|
59
50
|
```
|
|
60
51
|
|
|
61
52
|
### SVG conversion of @thi.ng/geom & @thi.ng/hiccup-canvas shape trees
|
|
@@ -86,6 +77,8 @@ conversions). Child shapes (of a group) inherit the precision setting of their
|
|
|
86
77
|
parent.
|
|
87
78
|
|
|
88
79
|
```ts
|
|
80
|
+
import { svg } from "@thi.ng/hiccup-svg";
|
|
81
|
+
|
|
89
82
|
// create SVG root element and convert body
|
|
90
83
|
svg(
|
|
91
84
|
{ width: 100, height: 100, __convert: true, __prec: 3 },
|
|
@@ -236,6 +229,10 @@ Minimal example showing SVG conversion of a hiccup-canvas scene (also see
|
|
|
236
229
|
for another compatible approach):
|
|
237
230
|
|
|
238
231
|
```ts
|
|
232
|
+
import { svg } from "@thi.ng/hiccup-svg";
|
|
233
|
+
import { serialize } from "@thi.ng/hiccup";
|
|
234
|
+
import { writeFileSync } from "node:fs";
|
|
235
|
+
|
|
239
236
|
// scene tree defined for hiccup-canvas
|
|
240
237
|
const scene = [
|
|
241
238
|
["defs", {},
|
|
@@ -250,10 +247,10 @@ const scene = [
|
|
|
250
247
|
["circle", { fill: "$sun" }, [110, 120], 50],
|
|
251
248
|
];
|
|
252
249
|
|
|
253
|
-
|
|
250
|
+
writeFileSync(
|
|
254
251
|
"radialgradient.svg",
|
|
255
252
|
serialize(
|
|
256
|
-
svg
|
|
253
|
+
svg({ width: 300, height: 300, __convert: true }, scene)
|
|
257
254
|
)
|
|
258
255
|
);
|
|
259
256
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/hiccup-svg",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.20",
|
|
4
4
|
"description": "SVG element functions for @thi.ng/hiccup & related tooling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "bun test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@thi.ng/checks": "^3.5.
|
|
39
|
-
"@thi.ng/color": "^5.6.
|
|
40
|
-
"@thi.ng/prefixes": "^2.3.
|
|
38
|
+
"@thi.ng/checks": "^3.5.1",
|
|
39
|
+
"@thi.ng/color": "^5.6.28",
|
|
40
|
+
"@thi.ng/prefixes": "^2.3.11"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@microsoft/api-extractor": "^7.40.1",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"parent": "@thi.ng/hiccup",
|
|
136
136
|
"year": 2016
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
|
|
139
139
|
}
|