@antontranelis/money-printer 1.0.18 → 1.0.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/README.md +116 -86
- package/dist/index.cjs +354 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.js +1206 -654
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,133 +1,163 @@
|
|
|
1
|
-
# Money
|
|
1
|
+
# Money Printer
|
|
2
2
|
|
|
3
3
|
Create personalized time vouchers that look like real currency. Design your own "Zeitgutscheine" (time vouchers) with custom portraits, names, and descriptions - perfect as unique gifts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**[Live Demo](https://antontranelis.github.io/money-printer/)**
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Custom Portrait**: Upload your photo
|
|
9
|
+
- **Custom Portrait**: Upload your photo with zoom and pan controls
|
|
10
|
+
- **Background Removal**: AI-powered background removal with adjustable opacity and blur
|
|
11
|
+
- **Sepia Effect**: Local vintage currency engraving effect (no API required)
|
|
10
12
|
- **Personalization**: Add your name, email, and phone number
|
|
11
13
|
- **Multiple Denominations**: Choose between 1, 5, or 10 hour vouchers
|
|
12
14
|
- **Bilingual**: Full support for German and English
|
|
13
15
|
- **High-Quality Export**: Download as print-ready PDF (A4 landscape)
|
|
14
|
-
- **
|
|
16
|
+
- **Responsive**: Works on desktop and mobile with touch support
|
|
15
17
|
|
|
16
|
-
##
|
|
18
|
+
## Installation
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
```bash
|
|
21
|
+
npm install @antontranelis/money-printer
|
|
22
|
+
```
|
|
19
23
|
|
|
20
|
-
##
|
|
24
|
+
## Usage
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
- **TypeScript** - Type Safety
|
|
24
|
-
- **Zustand** - State Management
|
|
25
|
-
- **jsPDF** - PDF Generation
|
|
26
|
-
- **Tailwind CSS + DaisyUI** - Styling
|
|
27
|
-
- **Vite** - Build Tool
|
|
26
|
+
### As a React Component
|
|
28
27
|
|
|
29
|
-
|
|
28
|
+
```tsx
|
|
29
|
+
import { MoneyPrinter } from '@antontranelis/money-printer';
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
function App() {
|
|
32
|
+
return <MoneyPrinter />;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
### Individual Components
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import {
|
|
40
|
+
BillForm,
|
|
41
|
+
BillPreview,
|
|
42
|
+
ExportButton,
|
|
43
|
+
PortraitUpload,
|
|
44
|
+
useBillStore
|
|
45
|
+
} from '@antontranelis/money-printer';
|
|
46
|
+
|
|
47
|
+
function CustomEditor() {
|
|
48
|
+
const portrait = useBillStore((state) => state.portrait);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div>
|
|
52
|
+
<PortraitUpload />
|
|
53
|
+
<BillPreview />
|
|
54
|
+
<ExportButton />
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
35
59
|
|
|
36
|
-
###
|
|
60
|
+
### Services
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import {
|
|
64
|
+
// PDF Generation
|
|
65
|
+
generateBillPDF,
|
|
66
|
+
exportBillAsPDF,
|
|
67
|
+
|
|
68
|
+
// Canvas Rendering
|
|
69
|
+
renderFrontSide,
|
|
70
|
+
renderBackSide,
|
|
71
|
+
|
|
72
|
+
// Image Effects (local, no API)
|
|
73
|
+
applyEngravingEffect,
|
|
74
|
+
resizeImage,
|
|
75
|
+
compositeWithBackground,
|
|
76
|
+
clearImageCache,
|
|
77
|
+
|
|
78
|
+
// AI Enhancement (requires API key)
|
|
79
|
+
removeBackground,
|
|
80
|
+
setApiKey,
|
|
81
|
+
hasApiKey,
|
|
82
|
+
} from '@antontranelis/money-printer';
|
|
83
|
+
```
|
|
37
84
|
|
|
38
|
-
|
|
39
|
-
# Clone the repository
|
|
40
|
-
git clone https://github.com/yourusername/money-generator.git
|
|
41
|
-
cd money-generator
|
|
85
|
+
## Portrait Controls
|
|
42
86
|
|
|
43
|
-
|
|
44
|
-
npm install
|
|
87
|
+
### Zoom & Pan
|
|
45
88
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
89
|
+
- **Zoom Slider**: Adjust portrait size from 50% to 200%
|
|
90
|
+
- **Pan/Drag**: When zoomed in, drag the portrait to reposition (mouse & touch supported)
|
|
91
|
+
- Works in both the avatar preview and the bill preview canvas
|
|
49
92
|
|
|
50
|
-
###
|
|
93
|
+
### Background Removal
|
|
51
94
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
95
|
+
1. Toggle "Remove background" (requires Stability AI API key)
|
|
96
|
+
2. Adjust **Background Opacity** (0-100%) to blend original background
|
|
97
|
+
3. Adjust **Blur** (0-100%) for depth-of-field effect
|
|
55
98
|
|
|
56
|
-
|
|
57
|
-
npm run preview
|
|
58
|
-
```
|
|
99
|
+
### Sepia Effect
|
|
59
100
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
2. **Adjust Zoom**: Use the slider to zoom in/out on your portrait
|
|
64
|
-
3. **Enter Details**: Fill in your name and contact information
|
|
65
|
-
4. **Choose Hours**: Select 1, 5, or 10 hours for your voucher
|
|
66
|
-
5. **Add Description**: Optionally add a custom description
|
|
67
|
-
6. **Download PDF**: Click the download button to get your print-ready voucher
|
|
101
|
+
- Local processing, no API required
|
|
102
|
+
- Adjustable intensity (0-100%)
|
|
103
|
+
- Applies vintage currency engraving look
|
|
68
104
|
|
|
69
|
-
## AI
|
|
105
|
+
## AI Features (Optional)
|
|
70
106
|
|
|
71
|
-
|
|
107
|
+
Background removal uses Stability AI. To enable:
|
|
72
108
|
|
|
73
|
-
To enable:
|
|
74
109
|
1. Get an API key from [Stability AI](https://stability.ai/)
|
|
75
|
-
2. Click "
|
|
76
|
-
3.
|
|
110
|
+
2. Click "Remove background" toggle in the app
|
|
111
|
+
3. Enter your API key when prompted
|
|
77
112
|
|
|
78
|
-
|
|
113
|
+
The sepia/engraving effect runs locally and doesn't require an API key.
|
|
79
114
|
|
|
80
|
-
##
|
|
115
|
+
## Tech Stack
|
|
116
|
+
|
|
117
|
+
- **React 18/19** - UI Framework
|
|
118
|
+
- **TypeScript** - Type Safety
|
|
119
|
+
- **Zustand** - State Management
|
|
120
|
+
- **jsPDF** - PDF Generation
|
|
121
|
+
- **Canvas API** - Image Processing
|
|
81
122
|
|
|
82
|
-
|
|
123
|
+
## Templates
|
|
83
124
|
|
|
84
|
-
|
|
125
|
+
The package includes two template sets:
|
|
85
126
|
|
|
86
|
-
- **German (DE)**: High-DPI templates (
|
|
127
|
+
- **German (DE)**: High-DPI templates (6144x3200px)
|
|
87
128
|
- **English (EN)**: Standard-DPI templates (1536x1024px)
|
|
88
129
|
|
|
89
|
-
|
|
130
|
+
Templates are bundled in `public/templates/`.
|
|
90
131
|
|
|
91
|
-
|
|
132
|
+
## Development
|
|
92
133
|
|
|
93
|
-
|
|
134
|
+
```bash
|
|
135
|
+
# Clone the repository
|
|
136
|
+
git clone https://github.com/antontranelis/money-printer.git
|
|
137
|
+
cd money-printer
|
|
94
138
|
|
|
95
|
-
|
|
139
|
+
# Install dependencies
|
|
140
|
+
npm install
|
|
96
141
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
├── components/ # React components
|
|
100
|
-
│ ├── BillForm.tsx # Main form container
|
|
101
|
-
│ ├── BillPreview.tsx # Canvas preview
|
|
102
|
-
│ ├── ExportButton.tsx # PDF download
|
|
103
|
-
│ ├── PortraitUpload.tsx
|
|
104
|
-
│ └── ...
|
|
105
|
-
├── services/ # Core services
|
|
106
|
-
│ ├── pdfGenerator.ts # PDF creation
|
|
107
|
-
│ ├── canvasRenderer.ts # Canvas drawing
|
|
108
|
-
│ └── stabilityAI.ts # AI enhancement
|
|
109
|
-
├── stores/ # Zustand stores
|
|
110
|
-
│ └── billStore.ts # App state
|
|
111
|
-
├── types/ # TypeScript types
|
|
112
|
-
├── constants/ # Templates & translations
|
|
113
|
-
└── hooks/ # Custom React hooks
|
|
114
|
-
```
|
|
142
|
+
# Start development server
|
|
143
|
+
npm run dev
|
|
115
144
|
|
|
116
|
-
|
|
145
|
+
# Build library
|
|
146
|
+
npm run build:lib
|
|
117
147
|
|
|
118
|
-
|
|
148
|
+
# Build standalone app
|
|
149
|
+
npm run build
|
|
150
|
+
```
|
|
119
151
|
|
|
120
|
-
|
|
121
|
-
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
122
|
-
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
123
|
-
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
124
|
-
5. Open a Pull Request
|
|
152
|
+
## Performance Optimizations
|
|
125
153
|
|
|
126
|
-
|
|
154
|
+
The image processing is optimized for smooth performance:
|
|
127
155
|
|
|
128
|
-
|
|
156
|
+
- **Image Caching**: Avoids reloading the same data URLs
|
|
157
|
+
- **Uint32Array**: Fast pixel manipulation for sepia effect
|
|
158
|
+
- **Reusable Canvas**: Reduces garbage collection pressure
|
|
159
|
+
- **Debounced Updates**: Slider changes are debounced to prevent lag
|
|
129
160
|
|
|
130
|
-
##
|
|
161
|
+
## License
|
|
131
162
|
|
|
132
|
-
|
|
133
|
-
- Built with modern React patterns and best practices
|
|
163
|
+
MIT License - see [LICENSE](LICENSE) for details.
|