@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 CHANGED
@@ -1,133 +1,163 @@
1
- # Money Generator
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
- ![Money Generator Preview](docs/preview.png)
5
+ **[Live Demo](https://antontranelis.github.io/money-printer/)**
6
6
 
7
7
  ## Features
8
8
 
9
- - **Custom Portrait**: Upload your photo and optionally enhance it with AI for a vintage currency look
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
- - **Portrait Zoom**: Adjust the portrait size with an intuitive zoom slider
16
+ - **Responsive**: Works on desktop and mobile with touch support
15
17
 
16
- ## Demo
18
+ ## Installation
17
19
 
18
- Try it live: [Money Generator Demo](https://yourusername.github.io/money-generator/)
20
+ ```bash
21
+ npm install @antontranelis/money-printer
22
+ ```
19
23
 
20
- ## Tech Stack
24
+ ## Usage
21
25
 
22
- - **React 19** - UI Framework
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
- ## Getting Started
28
+ ```tsx
29
+ import { MoneyPrinter } from '@antontranelis/money-printer';
30
30
 
31
- ### Prerequisites
31
+ function App() {
32
+ return <MoneyPrinter />;
33
+ }
34
+ ```
32
35
 
33
- - Node.js 18+
34
- - npm or yarn
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
- ### Installation
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
- ```bash
39
- # Clone the repository
40
- git clone https://github.com/yourusername/money-generator.git
41
- cd money-generator
85
+ ## Portrait Controls
42
86
 
43
- # Install dependencies
44
- npm install
87
+ ### Zoom & Pan
45
88
 
46
- # Start development server
47
- npm run dev
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
- ### Build
93
+ ### Background Removal
51
94
 
52
- ```bash
53
- # Build for production
54
- npm run build
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
- # Preview production build
57
- npm run preview
58
- ```
99
+ ### Sepia Effect
59
100
 
60
- ## Usage
61
-
62
- 1. **Upload a Portrait**: Click the upload area or drag & drop an image
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 Portrait Enhancement (Optional)
105
+ ## AI Features (Optional)
70
106
 
71
- The app includes optional AI-powered portrait enhancement using Stability AI. This transforms your photo into a vintage currency engraving style.
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 "Add API Key for better results" in the app
76
- 3. Or set the environment variable: `VITE_STABILITY_API_KEY=your-key`
110
+ 2. Click "Remove background" toggle in the app
111
+ 3. Enter your API key when prompted
77
112
 
78
- Without an API key, a basic canvas-based enhancement is available.
113
+ The sepia/engraving effect runs locally and doesn't require an API key.
79
114
 
80
- ## Customization
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
- ### Templates
123
+ ## Templates
83
124
 
84
- Templates are located in `public/templates/`. The app supports two template sets:
125
+ The package includes two template sets:
85
126
 
86
- - **German (DE)**: High-DPI templates (6144x4096px)
127
+ - **German (DE)**: High-DPI templates (6144x3200px)
87
128
  - **English (EN)**: Standard-DPI templates (1536x1024px)
88
129
 
89
- To customize, replace the template images and update the layout coordinates in `src/constants/templates.ts`.
130
+ Templates are bundled in `public/templates/`.
90
131
 
91
- ### Translations
132
+ ## Development
92
133
 
93
- All text is internationalized. Add or modify translations in `src/constants/translations.ts`.
134
+ ```bash
135
+ # Clone the repository
136
+ git clone https://github.com/antontranelis/money-printer.git
137
+ cd money-printer
94
138
 
95
- ## Project Structure
139
+ # Install dependencies
140
+ npm install
96
141
 
97
- ```
98
- src/
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
- ## Contributing
145
+ # Build library
146
+ npm run build:lib
117
147
 
118
- Contributions are welcome! Please feel free to submit a Pull Request.
148
+ # Build standalone app
149
+ npm run build
150
+ ```
119
151
 
120
- 1. Fork the repository
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
- ## License
154
+ The image processing is optimized for smooth performance:
127
155
 
128
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
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
- ## Acknowledgments
161
+ ## License
131
162
 
132
- - Inspired by the concept of "Zeitgutscheine" (time vouchers) as meaningful gifts
133
- - Built with modern React patterns and best practices
163
+ MIT License - see [LICENSE](LICENSE) for details.