embroidery-qc-image 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # render-embroidery-config
2
+
3
+ React component for rendering embroidery configurations on mockup images. This package allows you to display custom embroidered designs on product mockups with configurable text, icons, colors, and fonts.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install render-embroidery-config
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import React from 'react';
15
+ import { RenderEmbroidery } from 'render-embroidery-config';
16
+ import 'render-embroidery-config/dist/index.css';
17
+
18
+ const App = () => {
19
+ const config = {
20
+ image_url: "https://example.com/mockup.png",
21
+ sides: [
22
+ {
23
+ print_side: "Chest",
24
+ postitions: [
25
+ {
26
+ type: "TEXT",
27
+ text: "Brian ❤",
28
+ text_shape: "No Curved",
29
+ color: null,
30
+ font: "Times New Roman",
31
+ character_colors: ["Black (8)", "Red (1307)"],
32
+ change_character_to_heart: true,
33
+ },
34
+ {
35
+ type: "TEXT",
36
+ text: "EST. 2009",
37
+ text_shape: "No Curved",
38
+ color: "Red (1307)",
39
+ font: "Arial",
40
+ character_colors: null,
41
+ floral_pattern: "P01",
42
+ change_character_to_heart: null,
43
+ },
44
+ {
45
+ type: "ICON",
46
+ icon: "Heart 1",
47
+ layer_colors: ["White (9)", "Red (1307)"],
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ print_side: "Sleeve",
53
+ postitions: [
54
+ {
55
+ type: "TEXT",
56
+ text: "Ayanna",
57
+ text_shape: "No Curved",
58
+ color: "Red (1307)",
59
+ font: "Times New Roman",
60
+ character_colors: null,
61
+ change_character_to_heart: true,
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ };
67
+
68
+ return (
69
+ <div>
70
+ <RenderEmbroidery config={config} />
71
+ </div>
72
+ );
73
+ };
74
+
75
+ export default App;
76
+ ```
77
+
78
+ ## Props
79
+
80
+ ### RenderEmbroidery
81
+
82
+ | Prop | Type | Required | Description |
83
+ |------|------|----------|-------------|
84
+ | config | `EmbroideryConfig` | Yes | Configuration object containing embroidery details |
85
+ | className | `string` | No | Additional CSS classes |
86
+ | style | `React.CSSProperties` | No | Inline styles |
87
+
88
+ ## Configuration Structure
89
+
90
+ ### EmbroideryConfig
91
+
92
+ ```typescript
93
+ interface EmbroideryConfig {
94
+ image_url?: string; // Optional background image URL
95
+ sides: Side[]; // Array of sides to render
96
+ }
97
+
98
+ interface Side {
99
+ print_side: string; // e.g., "Chest", "Sleeve"
100
+ postitions: Position[]; // Array of positions to render
101
+ }
102
+
103
+ type Position = TextPosition | IconPosition;
104
+
105
+ interface TextPosition {
106
+ type: 'TEXT';
107
+ text: string; // Text content
108
+ text_shape: string; // "No Curved" or other shapes
109
+ color: string | null; // Color for entire text
110
+ font: string; // Font name
111
+ character_colors: string[] | null; // Array of colors for alternating characters
112
+ change_character_to_heart: boolean | null; // Replace <3 with ❤
113
+ floral_pattern?: string; // Optional floral pattern
114
+ }
115
+
116
+ interface IconPosition {
117
+ type: 'ICON';
118
+ icon: string; // Icon name (e.g., "Heart 1")
119
+ layer_colors: string[]; // Array of colors for icon layers
120
+ }
121
+ ```
122
+
123
+ ## Features
124
+
125
+ - ✅ Render custom text on mockup images
126
+ - ✅ Support for icon placement with multi-layer colors
127
+ - ✅ Character-level color customization (alternating colors)
128
+ - ✅ Font loading from CDN
129
+ - ✅ Multiple print sides (Chest, Sleeve, etc.)
130
+ - ✅ Floral pattern support
131
+ - ✅ Heart emoji conversion (<3 → ❤)
132
+ - ✅ Responsive canvas rendering
133
+ - ✅ TypeScript support
134
+
135
+ ## Supported Colors
136
+
137
+ The component automatically maps color names to hex values:
138
+ - `White (9)`, `Black (8)`, `Red (9)`, `Red (1307)`, `Blue (9)`, `Green (9)`
139
+ - `Forest Green (1397)`, `Brown (9)`, `Cream (9)`, `Beige (9)`
140
+ - `Navy (9)`, `Maroon (9)` and more...
141
+
142
+ ## Font Loading
143
+
144
+ Fonts are automatically loaded from:
145
+ ```
146
+ https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/fonts/{FontName}.woff2
147
+ ```
148
+
149
+ Supported format: WOFF2
150
+
151
+ ## Icons
152
+
153
+ Icons are loaded from:
154
+ ```
155
+ https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/icons/{IconName}.png
156
+ ```
157
+
158
+ ## Floral Patterns
159
+
160
+ Floral patterns are loaded from:
161
+ ```
162
+ https://s3.hn-1.cloud.cmctelecom.vn/god-system-images/embroidery/florals/{PatternName}.png
163
+ ```
164
+
165
+ ## License
166
+
167
+ MIT
168
+
169
+ ## Contributing
170
+
171
+ Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
172
+
173
+ ## Support
174
+
175
+ For issues and questions, please open an issue on GitHub.
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { EmbroideryQCImageProps } from "../types";
3
+ import "./EmbroideryQCImage.css";
4
+ declare const EmbroideryQCImage: React.FC<EmbroideryQCImageProps>;
5
+ export default EmbroideryQCImage;
6
+ //# sourceMappingURL=EmbroideryQCImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbroideryQCImage.d.ts","sourceRoot":"","sources":["../../src/components/EmbroideryQCImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAY,MAAM,UAAU,CAAC;AAC5D,OAAO,yBAAyB,CAAC;AA2EjC,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA08BvD,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
package/dist/index.css ADDED
@@ -0,0 +1,14 @@
1
+ .render-embroidery {
2
+ display: inline-block;
3
+ position: relative;
4
+ width: 100%;
5
+ max-width: 100%;
6
+ }
7
+
8
+ .render-embroidery-canvas {
9
+ display: block;
10
+ width: 100%;
11
+ height: auto;
12
+ image-rendering: high-quality;
13
+ background: transparent;
14
+ }
@@ -0,0 +1,36 @@
1
+ import React$1 from 'react';
2
+
3
+ interface TextPosition {
4
+ type: 'TEXT';
5
+ text: string;
6
+ text_shape?: string | null;
7
+ color?: string | null;
8
+ font?: string | null;
9
+ character_colors?: string[] | null;
10
+ change_character_to_heart?: boolean | null;
11
+ floral_pattern?: string | null;
12
+ }
13
+ interface IconPosition {
14
+ type: 'ICON';
15
+ icon: string;
16
+ layer_colors: string[];
17
+ }
18
+ type Position = TextPosition | IconPosition;
19
+ interface Side {
20
+ print_side: string;
21
+ postitions: Position[];
22
+ }
23
+ interface EmbroideryQCConfig {
24
+ image_url?: string;
25
+ sides: Side[];
26
+ }
27
+ interface EmbroideryQCImageProps {
28
+ config: EmbroideryQCConfig;
29
+ className?: string;
30
+ style?: React.CSSProperties;
31
+ }
32
+
33
+ declare const EmbroideryQCImage: React$1.FC<EmbroideryQCImageProps>;
34
+
35
+ export { EmbroideryQCImage };
36
+ export type { EmbroideryQCConfig, EmbroideryQCImageProps, IconPosition, Position, Side, TextPosition };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,14 @@
1
+ .render-embroidery {
2
+ display: inline-block;
3
+ position: relative;
4
+ width: 100%;
5
+ max-width: 100%;
6
+ }
7
+
8
+ .render-embroidery-canvas {
9
+ display: block;
10
+ width: 100%;
11
+ height: auto;
12
+ image-rendering: high-quality;
13
+ background: transparent;
14
+ }