pdfn 0.4.3 → 0.4.5
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/package.json +4 -4
- package/templates/inline/report.tsx +61 -72
- package/templates/tailwind/report.tsx +61 -72
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdfn",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Dev server and PDF generation for print-ready PDFs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"ws": "^8.18.3",
|
|
57
57
|
"@pdfn/client": "0.1.0",
|
|
58
58
|
"@pdfn/react": "0.3.1",
|
|
59
|
-
"@pdfn/vite": "0.5.
|
|
59
|
+
"@pdfn/vite": "0.5.1"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/express": "^5.0.6",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"tsup": "^8.5.1",
|
|
67
67
|
"typescript": "^5.9.3",
|
|
68
68
|
"vitest": "^4.0.17",
|
|
69
|
-
"@pdfn/
|
|
70
|
-
"@pdfn/
|
|
69
|
+
"@pdfn/typescript-config": "0.0.0",
|
|
70
|
+
"@pdfn/eslint-config": "0.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsup",
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
CartesianGrid,
|
|
15
15
|
Tooltip,
|
|
16
16
|
Legend,
|
|
17
|
-
ResponsiveContainer,
|
|
18
17
|
} from "recharts";
|
|
19
18
|
|
|
20
19
|
/**
|
|
@@ -259,19 +258,15 @@ export default function Report({
|
|
|
259
258
|
>
|
|
260
259
|
Monthly Revenue vs Expenses
|
|
261
260
|
</h2>
|
|
262
|
-
<
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<Bar dataKey="expenses" name="Expenses" fill="#ef4444" radius={[2, 2, 0, 0]} />
|
|
272
|
-
</BarChart>
|
|
273
|
-
</ResponsiveContainer>
|
|
274
|
-
</div>
|
|
261
|
+
<BarChart width={580} height={200} data={monthlySales} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
262
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
263
|
+
<XAxis dataKey="month" tick={{ fontSize: 10 }} />
|
|
264
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `$${v / 1000}k`} />
|
|
265
|
+
<Tooltip formatter={(value) => formatCurrency(value as number)} />
|
|
266
|
+
<Legend wrapperStyle={{ fontSize: 10 }} />
|
|
267
|
+
<Bar dataKey="revenue" name="Revenue" fill="#3b82f6" radius={[2, 2, 0, 0]} isAnimationActive={false} />
|
|
268
|
+
<Bar dataKey="expenses" name="Expenses" fill="#ef4444" radius={[2, 2, 0, 0]} isAnimationActive={false} />
|
|
269
|
+
</BarChart>
|
|
275
270
|
</div>
|
|
276
271
|
|
|
277
272
|
{/* Two Column Layout: Pie Chart and Growth Chart */}
|
|
@@ -290,28 +285,29 @@ export default function Report({
|
|
|
290
285
|
>
|
|
291
286
|
Revenue by Category
|
|
292
287
|
</h2>
|
|
293
|
-
<
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
288
|
+
<PieChart width={280} height={160}>
|
|
289
|
+
<Pie
|
|
290
|
+
data={categoryBreakdown}
|
|
291
|
+
cx={70}
|
|
292
|
+
cy={80}
|
|
293
|
+
innerRadius={25}
|
|
294
|
+
outerRadius={55}
|
|
295
|
+
paddingAngle={2}
|
|
296
|
+
dataKey="value"
|
|
297
|
+
isAnimationActive={false}
|
|
298
|
+
>
|
|
299
|
+
{categoryBreakdown.map((entry, index) => (
|
|
300
|
+
<Cell key={`cell-${index}`} fill={entry.color || COLORS[index % COLORS.length]} />
|
|
301
|
+
))}
|
|
302
|
+
</Pie>
|
|
303
|
+
<Tooltip formatter={(value) => `${value}%`} />
|
|
304
|
+
<Legend
|
|
305
|
+
layout="vertical"
|
|
306
|
+
align="right"
|
|
307
|
+
verticalAlign="middle"
|
|
308
|
+
wrapperStyle={{ paddingLeft: 20, fontSize: 10 }}
|
|
309
|
+
/>
|
|
310
|
+
</PieChart>
|
|
315
311
|
</div>
|
|
316
312
|
|
|
317
313
|
{/* Quarterly Growth */}
|
|
@@ -328,23 +324,20 @@ export default function Report({
|
|
|
328
324
|
>
|
|
329
325
|
Quarterly Growth Rate
|
|
330
326
|
</h2>
|
|
331
|
-
<
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
</LineChart>
|
|
346
|
-
</ResponsiveContainer>
|
|
347
|
-
</div>
|
|
327
|
+
<LineChart width={280} height={160} data={quarterlyGrowth} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
328
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
329
|
+
<XAxis dataKey="quarter" tick={{ fontSize: 10 }} />
|
|
330
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `${v}%`} />
|
|
331
|
+
<Tooltip formatter={(value) => `${value}%`} />
|
|
332
|
+
<Line
|
|
333
|
+
type="monotone"
|
|
334
|
+
dataKey="growth"
|
|
335
|
+
stroke="#10b981"
|
|
336
|
+
strokeWidth={2}
|
|
337
|
+
dot={{ fill: "#10b981", strokeWidth: 2 }}
|
|
338
|
+
isAnimationActive={false}
|
|
339
|
+
/>
|
|
340
|
+
</LineChart>
|
|
348
341
|
</div>
|
|
349
342
|
</div>
|
|
350
343
|
|
|
@@ -362,25 +355,21 @@ export default function Report({
|
|
|
362
355
|
>
|
|
363
356
|
Monthly Profit Trend
|
|
364
357
|
</h2>
|
|
365
|
-
<
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
/>
|
|
381
|
-
</LineChart>
|
|
382
|
-
</ResponsiveContainer>
|
|
383
|
-
</div>
|
|
358
|
+
<LineChart width={580} height={160} data={monthlySales} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
359
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
360
|
+
<XAxis dataKey="month" tick={{ fontSize: 10 }} />
|
|
361
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `$${v / 1000}k`} />
|
|
362
|
+
<Tooltip formatter={(value) => formatCurrency(value as number)} />
|
|
363
|
+
<Line
|
|
364
|
+
type="monotone"
|
|
365
|
+
dataKey="profit"
|
|
366
|
+
name="Profit"
|
|
367
|
+
stroke="#10b981"
|
|
368
|
+
strokeWidth={2}
|
|
369
|
+
dot={{ fill: "#10b981", strokeWidth: 2 }}
|
|
370
|
+
isAnimationActive={false}
|
|
371
|
+
/>
|
|
372
|
+
</LineChart>
|
|
384
373
|
</div>
|
|
385
374
|
</Page>
|
|
386
375
|
</Document>
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
CartesianGrid,
|
|
16
16
|
Tooltip,
|
|
17
17
|
Legend,
|
|
18
|
-
ResponsiveContainer,
|
|
19
18
|
} from "recharts";
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -176,19 +175,15 @@ export default function Report({
|
|
|
176
175
|
<h2 className="text-lg font-semibold text-gray-800 mb-3 border-b border-gray-200 pb-1">
|
|
177
176
|
Monthly Revenue vs Expenses
|
|
178
177
|
</h2>
|
|
179
|
-
<
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
<Bar dataKey="expenses" name="Expenses" fill="#ef4444" radius={[2, 2, 0, 0]} />
|
|
189
|
-
</BarChart>
|
|
190
|
-
</ResponsiveContainer>
|
|
191
|
-
</div>
|
|
178
|
+
<BarChart width={580} height={200} data={monthlySales} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
179
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
180
|
+
<XAxis dataKey="month" tick={{ fontSize: 10 }} />
|
|
181
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `$${v / 1000}k`} />
|
|
182
|
+
<Tooltip formatter={(value) => formatCurrency(value as number)} />
|
|
183
|
+
<Legend wrapperStyle={{ fontSize: 10 }} />
|
|
184
|
+
<Bar dataKey="revenue" name="Revenue" fill="#3b82f6" radius={[2, 2, 0, 0]} isAnimationActive={false} />
|
|
185
|
+
<Bar dataKey="expenses" name="Expenses" fill="#ef4444" radius={[2, 2, 0, 0]} isAnimationActive={false} />
|
|
186
|
+
</BarChart>
|
|
192
187
|
</div>
|
|
193
188
|
|
|
194
189
|
{/* Two Column Layout: Pie Chart and Growth Chart */}
|
|
@@ -198,28 +193,29 @@ export default function Report({
|
|
|
198
193
|
<h2 className="text-lg font-semibold text-gray-800 mb-3 border-b border-gray-200 pb-1">
|
|
199
194
|
Revenue by Category
|
|
200
195
|
</h2>
|
|
201
|
-
<
|
|
202
|
-
<
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
196
|
+
<PieChart width={280} height={160}>
|
|
197
|
+
<Pie
|
|
198
|
+
data={categoryBreakdown}
|
|
199
|
+
cx={70}
|
|
200
|
+
cy={80}
|
|
201
|
+
innerRadius={25}
|
|
202
|
+
outerRadius={55}
|
|
203
|
+
paddingAngle={2}
|
|
204
|
+
dataKey="value"
|
|
205
|
+
isAnimationActive={false}
|
|
206
|
+
>
|
|
207
|
+
{categoryBreakdown.map((entry, index) => (
|
|
208
|
+
<Cell key={`cell-${index}`} fill={entry.color || COLORS[index % COLORS.length]} />
|
|
209
|
+
))}
|
|
210
|
+
</Pie>
|
|
211
|
+
<Tooltip formatter={(value) => `${value}%`} />
|
|
212
|
+
<Legend
|
|
213
|
+
layout="vertical"
|
|
214
|
+
align="right"
|
|
215
|
+
verticalAlign="middle"
|
|
216
|
+
wrapperStyle={{ paddingLeft: 20, fontSize: 10 }}
|
|
217
|
+
/>
|
|
218
|
+
</PieChart>
|
|
223
219
|
</div>
|
|
224
220
|
|
|
225
221
|
{/* Quarterly Growth */}
|
|
@@ -227,23 +223,20 @@ export default function Report({
|
|
|
227
223
|
<h2 className="text-lg font-semibold text-gray-800 mb-3 border-b border-gray-200 pb-1">
|
|
228
224
|
Quarterly Growth Rate
|
|
229
225
|
</h2>
|
|
230
|
-
<
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
</LineChart>
|
|
245
|
-
</ResponsiveContainer>
|
|
246
|
-
</div>
|
|
226
|
+
<LineChart width={280} height={160} data={quarterlyGrowth} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
227
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
228
|
+
<XAxis dataKey="quarter" tick={{ fontSize: 10 }} />
|
|
229
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `${v}%`} />
|
|
230
|
+
<Tooltip formatter={(value) => `${value}%`} />
|
|
231
|
+
<Line
|
|
232
|
+
type="monotone"
|
|
233
|
+
dataKey="growth"
|
|
234
|
+
stroke="#10b981"
|
|
235
|
+
strokeWidth={2}
|
|
236
|
+
dot={{ fill: "#10b981", strokeWidth: 2 }}
|
|
237
|
+
isAnimationActive={false}
|
|
238
|
+
/>
|
|
239
|
+
</LineChart>
|
|
247
240
|
</div>
|
|
248
241
|
</div>
|
|
249
242
|
|
|
@@ -252,25 +245,21 @@ export default function Report({
|
|
|
252
245
|
<h2 className="text-lg font-semibold text-gray-800 mb-3 border-b border-gray-200 pb-1">
|
|
253
246
|
Monthly Profit Trend
|
|
254
247
|
</h2>
|
|
255
|
-
<
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
/>
|
|
271
|
-
</LineChart>
|
|
272
|
-
</ResponsiveContainer>
|
|
273
|
-
</div>
|
|
248
|
+
<LineChart width={580} height={160} data={monthlySales} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>
|
|
249
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e5e7eb" />
|
|
250
|
+
<XAxis dataKey="month" tick={{ fontSize: 10 }} />
|
|
251
|
+
<YAxis tick={{ fontSize: 10 }} tickFormatter={(v) => `$${v / 1000}k`} />
|
|
252
|
+
<Tooltip formatter={(value) => formatCurrency(value as number)} />
|
|
253
|
+
<Line
|
|
254
|
+
type="monotone"
|
|
255
|
+
dataKey="profit"
|
|
256
|
+
name="Profit"
|
|
257
|
+
stroke="#10b981"
|
|
258
|
+
strokeWidth={2}
|
|
259
|
+
dot={{ fill: "#10b981", strokeWidth: 2 }}
|
|
260
|
+
isAnimationActive={false}
|
|
261
|
+
/>
|
|
262
|
+
</LineChart>
|
|
274
263
|
</div>
|
|
275
264
|
</Page>
|
|
276
265
|
</Tailwind>
|