tikzify 0.0.0 → 0.0.7
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 +114 -59
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,73 +1,128 @@
|
|
|
1
|
-
#
|
|
1
|
+
# tikzsvg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generate beautiful PDF books with emoji SVG overlays and custom backgrounds using XeLaTeX and TikZ.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- 📚 Create multi-page PDF books from JSON input
|
|
8
|
+
- 🎨 Gradient backgrounds with customizable colors
|
|
9
|
+
- 🖼️ Embed images with custom shaped clipping paths
|
|
10
|
+
- ✨ SVG emoji overlays with precise positioning, scaling, and rotation
|
|
11
|
+
- 🌐 RTL (right-to-left) and LTR (left-to-right) text support
|
|
12
|
+
- 🔤 Hebrew text support with Fredoka-Bold font
|
|
13
|
+
- 📄 A5 paper format with page numbering
|
|
9
14
|
|
|
10
|
-
##
|
|
15
|
+
## Prerequisites
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
- [Bun](https://bun.sh) runtime
|
|
18
|
+
- XeLaTeX (from TeX Live or similar distribution)
|
|
19
|
+
- `Fredoka-Bold.ttf` font file in the project root
|
|
13
20
|
|
|
14
|
-
##
|
|
21
|
+
## Installation
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
```bash
|
|
24
|
+
bun install
|
|
25
|
+
```
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
27
|
+
## Usage
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
tseslint.configs.recommendedTypeChecked,
|
|
28
|
-
// Alternatively, use this for stricter rules
|
|
29
|
-
tseslint.configs.strictTypeChecked,
|
|
30
|
-
// Optionally, add this for stylistic rules
|
|
31
|
-
tseslint.configs.stylisticTypeChecked,
|
|
29
|
+
### Server Mode
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
Start the HTTP server:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
bun --hot src/server.ts
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Send a POST request with JSON book data:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl http://localhost:3000/ \
|
|
41
|
+
-H "Content-Type: application/json" \
|
|
42
|
+
-d @book.json \
|
|
43
|
+
-o output.pdf
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
### Book JSON Format
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"dir": "rtl",
|
|
51
|
+
"pages": [
|
|
52
|
+
{
|
|
53
|
+
"gradient": ["#8B4513", "#FFD1E0"],
|
|
54
|
+
"textBg": "#FFF3E6",
|
|
55
|
+
"text": [
|
|
56
|
+
"Line 1 of text",
|
|
57
|
+
"Line 2 of text"
|
|
58
|
+
],
|
|
59
|
+
"emojis": {
|
|
60
|
+
"text": [
|
|
61
|
+
{
|
|
62
|
+
"x": 10,
|
|
63
|
+
"y": 20,
|
|
64
|
+
"scale": 1.8,
|
|
65
|
+
"rotate": -15,
|
|
66
|
+
"emoji": "🍄"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"image": [
|
|
70
|
+
{
|
|
71
|
+
"x": -170,
|
|
72
|
+
"y": -130,
|
|
73
|
+
"scale": 1.8,
|
|
74
|
+
"rotate": -15,
|
|
75
|
+
"emoji": "🌺"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
68
78
|
},
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
79
|
+
"jpgBase64": "base64-encoded-image-data"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
73
83
|
```
|
|
84
|
+
|
|
85
|
+
## API Reference
|
|
86
|
+
|
|
87
|
+
### Book Schema
|
|
88
|
+
|
|
89
|
+
- `dir`: Text direction (`"rtl"` or `"ltr"`)
|
|
90
|
+
- `pages`: Array of page objects
|
|
91
|
+
|
|
92
|
+
### Page Schema
|
|
93
|
+
|
|
94
|
+
- `gradient`: Array of two hex colors for background gradient
|
|
95
|
+
- `textBg`: Hex color for text background overlay
|
|
96
|
+
- `text`: Array of text lines to display
|
|
97
|
+
- `emojis.text`: Emoji overlays for text pages
|
|
98
|
+
- `emojis.image`: Emoji overlays for image pages
|
|
99
|
+
- `jpgBase64`: Base64-encoded JPEG image (max 256KB)
|
|
100
|
+
|
|
101
|
+
### Emoji Schema
|
|
102
|
+
|
|
103
|
+
- `x`, `y`: Position coordinates in points
|
|
104
|
+
- `scale`: Scale factor
|
|
105
|
+
- `rotate`: Rotation angle in degrees
|
|
106
|
+
- `emoji`: Unicode emoji character
|
|
107
|
+
|
|
108
|
+
## How It Works
|
|
109
|
+
|
|
110
|
+
1. Receives book JSON via HTTP POST
|
|
111
|
+
2. Parses and validates input using Zod schemas
|
|
112
|
+
3. Converts emoji to SVG paths using pre-defined emoji map
|
|
113
|
+
4. Generates XeLaTeX document with TikZ graphics
|
|
114
|
+
5. Runs XeLaTeX twice to resolve coordinate references
|
|
115
|
+
6. Returns compiled PDF
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
The project uses:
|
|
120
|
+
- **Bun** for runtime and package management
|
|
121
|
+
- **TypeScript** for type safety
|
|
122
|
+
- **Zod** for schema validation
|
|
123
|
+
- **SAX** for SVG parsing
|
|
124
|
+
- **p-queue** for sequential PDF generation
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tikzify",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "dist/tikzsvg.es.js",
|
|
6
6
|
"types": "dist/tikzsvg.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/gkutiel/tikzsvg.git"
|
|
13
|
+
},
|
|
10
14
|
"scripts": {},
|
|
11
15
|
"devDependencies": {
|
|
12
16
|
"@types/bun": "^1.3.6",
|
|
@@ -20,4 +24,4 @@
|
|
|
20
24
|
"sax": "^1.4.4",
|
|
21
25
|
"zod": "^4.3.5"
|
|
22
26
|
}
|
|
23
|
-
}
|
|
27
|
+
}
|