@thi.ng/hiccup-svg 5.2.19 → 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 +12 -4
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -40,11 +40,13 @@ context object, they can ONLY be invoked directly, i.e. they MUST be
|
|
|
40
40
|
called like:
|
|
41
41
|
|
|
42
42
|
```ts
|
|
43
|
+
import { circle, svg } from "@thi.ng/hiccup-svg";
|
|
44
|
+
|
|
43
45
|
// correct (direct invocation)
|
|
44
|
-
svg
|
|
46
|
+
svg({}, circle([0, 0], 100, { fill: "red" }));
|
|
45
47
|
|
|
46
48
|
// incorrect / unsupported (lazy evaluation)
|
|
47
|
-
[svg
|
|
49
|
+
[svg, {}, [circle, [0, 0], 100, { fill: "red" }]]
|
|
48
50
|
```
|
|
49
51
|
|
|
50
52
|
### SVG conversion of @thi.ng/geom & @thi.ng/hiccup-canvas shape trees
|
|
@@ -75,6 +77,8 @@ conversions). Child shapes (of a group) inherit the precision setting of their
|
|
|
75
77
|
parent.
|
|
76
78
|
|
|
77
79
|
```ts
|
|
80
|
+
import { svg } from "@thi.ng/hiccup-svg";
|
|
81
|
+
|
|
78
82
|
// create SVG root element and convert body
|
|
79
83
|
svg(
|
|
80
84
|
{ width: 100, height: 100, __convert: true, __prec: 3 },
|
|
@@ -225,6 +229,10 @@ Minimal example showing SVG conversion of a hiccup-canvas scene (also see
|
|
|
225
229
|
for another compatible approach):
|
|
226
230
|
|
|
227
231
|
```ts
|
|
232
|
+
import { svg } from "@thi.ng/hiccup-svg";
|
|
233
|
+
import { serialize } from "@thi.ng/hiccup";
|
|
234
|
+
import { writeFileSync } from "node:fs";
|
|
235
|
+
|
|
228
236
|
// scene tree defined for hiccup-canvas
|
|
229
237
|
const scene = [
|
|
230
238
|
["defs", {},
|
|
@@ -239,10 +247,10 @@ const scene = [
|
|
|
239
247
|
["circle", { fill: "$sun" }, [110, 120], 50],
|
|
240
248
|
];
|
|
241
249
|
|
|
242
|
-
|
|
250
|
+
writeFileSync(
|
|
243
251
|
"radialgradient.svg",
|
|
244
252
|
serialize(
|
|
245
|
-
svg
|
|
253
|
+
svg({ width: 300, height: 300, __convert: true }, scene)
|
|
246
254
|
)
|
|
247
255
|
);
|
|
248
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",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@thi.ng/checks": "^3.5.1",
|
|
39
|
-
"@thi.ng/color": "^5.6.
|
|
39
|
+
"@thi.ng/color": "^5.6.28",
|
|
40
40
|
"@thi.ng/prefixes": "^2.3.11"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
"parent": "@thi.ng/hiccup",
|
|
136
136
|
"year": 2016
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
|
|
139
139
|
}
|