@azuro-org/images-generator 1.3.8 → 1.3.10

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/dist/index.es.js CHANGED
@@ -107,7 +107,7 @@ function __generator(thisArg, body) {
107
107
  fs.mkdirSync(output);
108
108
  }
109
109
  filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
110
- return [4 /*yield*/, content.screenshot({ path: filePath })];
110
+ return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
111
111
  case 9:
112
112
  _d.sent();
113
113
  return [4 /*yield*/, page.close()];
@@ -3,28 +3,57 @@ declare const cardTypes: {
3
3
  readonly business: {
4
4
  readonly bottomImg: "images/business.png";
5
5
  readonly bgImg: "images/bg-business.png";
6
+ readonly stampImg: "images/stamp.png";
7
+ readonly additionalClassName: "";
6
8
  };
7
9
  readonly culture: {
8
10
  readonly bottomImg: "images/culture.png";
9
11
  readonly bgImg: "images/bg-culture.png";
12
+ readonly stampImg: "images/stamp.png";
13
+ readonly additionalClassName: "";
10
14
  };
11
15
  readonly crypto: {
12
16
  readonly bottomImg: "images/crypto.png";
13
17
  readonly bgImg: "images/bg-crypto.png";
18
+ readonly stampImg: "images/stamp.png";
19
+ readonly additionalClassName: "";
14
20
  };
15
21
  readonly politics: {
16
22
  readonly bottomImg: "images/politics.png";
17
23
  readonly bgImg: "images/bg-politics.png";
24
+ readonly stampImg: "images/stamp.png";
25
+ readonly additionalClassName: "";
18
26
  };
19
27
  readonly fomo: {
20
28
  readonly bottomImg: "images/fomo.png";
21
29
  readonly bgImg: "images/bg-fomo.png";
30
+ readonly stampImg: "images/stamp.png";
31
+ readonly additionalClassName: "";
32
+ };
33
+ readonly 'monad-1': {
34
+ readonly bottomImg: "images/monad-1.png";
35
+ readonly bgImg: "images/bg-monad-1.png";
36
+ readonly stampImg: "images/stamp-monad.png";
37
+ readonly additionalClassName: "monad";
38
+ };
39
+ readonly 'monad-2': {
40
+ readonly bottomImg: "images/monad-2.png";
41
+ readonly bgImg: "images/bg-monad-2.png";
42
+ readonly stampImg: "images/stamp-monad.png";
43
+ readonly additionalClassName: "monad";
44
+ };
45
+ readonly 'monad-3': {
46
+ readonly bottomImg: "images/monad-3.png";
47
+ readonly bgImg: "images/bg-monad-3.png";
48
+ readonly stampImg: "images/stamp-monad.png";
49
+ readonly additionalClassName: "monad";
22
50
  };
23
51
  };
24
52
  export type Props = {
25
53
  type: keyof typeof cardTypes;
26
54
  avatarUrl: string;
27
55
  username: string;
56
+ isWide?: boolean;
28
57
  };
29
58
  declare const template: Template<Props>;
30
59
  export default template;
@@ -127,17 +127,18 @@
127
127
  }
128
128
 
129
129
  .card {
130
- width: 600px;
131
- height: 749px;
132
- padding-top: 183px;
130
+ width: 850px;
131
+ height: 1060px;
132
+ padding-top: 260px;
133
133
  position: relative;
134
+ z-index: 1;
134
135
  }
135
136
 
136
137
  .bg {
137
138
  position: absolute;
138
139
  mix-blend-mode: difference;
139
- top: 0;
140
- left: 0;
140
+ top: 0px;
141
+ left: 0px;
141
142
  width: 100%;
142
143
  height: 100%;
143
144
  }
@@ -145,18 +146,18 @@
145
146
  .bottom-img {
146
147
  position: absolute;
147
148
  mix-blend-mode: multiply;
148
- bottom: 0;
149
- left: 0;
149
+ bottom: 0px;
150
+ left: 0px;
150
151
  width: 100%;
151
152
  }
152
153
 
153
154
  .avatar {
154
- width: 212px;
155
- height: 212px;
155
+ width: 300px;
156
+ height: 300px;
156
157
  border-radius: 100%;
157
- border: 2.47px solid white;
158
+ border: 3.5px solid white;
158
159
  overflow: hidden;
159
- margin: 28px auto 0;
160
+ margin: 40px auto 0;
160
161
  position: relative;
161
162
  z-index: 10;
162
163
  }
@@ -168,36 +169,64 @@
168
169
  .username {
169
170
  background-color: #111;
170
171
  color: #fff;
171
- padding: 5.6px 14px 9.2px;
172
- margin: -9.9px auto 0;
172
+ padding: 8px 20px 13px;
173
+ margin: -14px auto 0;
173
174
  width: fit-content;
174
175
  position: relative;
175
176
  z-index: 10;
176
- font-size: 25.4px;
177
+ font-size: 36px;
177
178
  line-height: 100%;
178
179
  font-weight: 400;
179
180
  }
180
181
 
181
182
  .stamp-img {
182
- width: 169px;
183
- height: 169px;
183
+ width: 240px;
184
+ height: 240px;
184
185
  position: absolute;
185
- top: 191px;
186
- right: 99px;
186
+ top: 270px;
187
+ right: 140px;
187
188
  z-index: 20;
188
189
  }
190
+
191
+ .wrapper {
192
+ width: --wrapper-width;
193
+ position: relative;
194
+ background: #393939;
195
+ }
196
+
197
+ .wrapper__img {
198
+ position: absolute;
199
+ display: block;
200
+ top: 0;
201
+ left: 50%;
202
+ transform: translateX(-50%);
203
+ height: 100%;
204
+ mix-blend-mode: multiply;
205
+ }
206
+
207
+ .monad .bottom-img {
208
+ mix-blend-mode: unset;
209
+ }
210
+
211
+ .monad .username {
212
+ box-shadow: 0px -4px 23px 0px rgba(136, 0, 255, 1) inset;
213
+ border-radius: 40px;
214
+ }
189
215
  </style>
190
216
  </head>
191
217
  <body>
192
- <div class="card">
193
- <img src="{bgImg}" alt="" class="bg">
194
- <img src="{bottomImg}" alt="" class="bottom-img">
195
- <img src="{titleImg}" alt="" class="title-img">
196
- <div class="avatar flex items-center justify-center">
197
- <img src="{avatar}" alt="">
218
+ <div class="wrapper flex justify-center {additionalClassName}">
219
+ <img src="{wrapperImg}" alt="" class="wrapper__img">
220
+ <div class="card">
221
+ <img src="{bgImg}" alt="" class="bg">
222
+ <img src="{bottomImg}" alt="" class="bottom-img">
223
+ <img src="{titleImg}" alt="" class="title-img">
224
+ <div class="avatar flex items-center justify-center">
225
+ <img src="{avatar}" alt="">
226
+ </div>
227
+ <img src="{stampImg}" alt="" class="stamp-img">
228
+ <div class="username geist-mono">{username}</div>
198
229
  </div>
199
- <img src="{stampImg}" alt="" class="stamp-img">
200
- <div class="username geist-mono">{username}</div>
201
230
  </div>
202
231
  </body>
203
232
  </html>
@@ -2,44 +2,79 @@ import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image,d as do
2
2
  'business': {
3
3
  bottomImg: 'images/business.png',
4
4
  bgImg: 'images/bg-business.png',
5
+ stampImg: 'images/stamp.png',
6
+ additionalClassName: ''
5
7
  },
6
8
  'culture': {
7
9
  bottomImg: 'images/culture.png',
8
10
  bgImg: 'images/bg-culture.png',
11
+ stampImg: 'images/stamp.png',
12
+ additionalClassName: ''
9
13
  },
10
14
  'crypto': {
11
15
  bottomImg: 'images/crypto.png',
12
16
  bgImg: 'images/bg-crypto.png',
17
+ stampImg: 'images/stamp.png',
18
+ additionalClassName: ''
13
19
  },
14
20
  'politics': {
15
21
  bottomImg: 'images/politics.png',
16
22
  bgImg: 'images/bg-politics.png',
23
+ stampImg: 'images/stamp.png',
24
+ additionalClassName: ''
17
25
  },
18
26
  'fomo': {
19
27
  bottomImg: 'images/fomo.png',
20
28
  bgImg: 'images/bg-fomo.png',
29
+ stampImg: 'images/stamp.png',
30
+ additionalClassName: ''
31
+ },
32
+ 'monad-1': {
33
+ bottomImg: 'images/monad-1.png',
34
+ bgImg: 'images/bg-monad-1.png',
35
+ stampImg: 'images/stamp-monad.png',
36
+ additionalClassName: 'monad'
37
+ },
38
+ 'monad-2': {
39
+ bottomImg: 'images/monad-2.png',
40
+ bgImg: 'images/bg-monad-2.png',
41
+ stampImg: 'images/stamp-monad.png',
42
+ additionalClassName: 'monad'
43
+ },
44
+ 'monad-3': {
45
+ bottomImg: 'images/monad-3.png',
46
+ bgImg: 'images/bg-monad-3.png',
47
+ stampImg: 'images/stamp-monad.png',
48
+ additionalClassName: 'monad'
21
49
  },
22
50
  };
51
+ // 2020
23
52
  var template = {
24
53
  width: 850,
25
54
  height: 1060,
26
55
  type: 'jpeg',
27
56
  html: function (props) { return __awaiter(void 0, void 0, void 0, function () {
28
- var type, avatarUrl, username, _a, bottomImg, bgImg, html, stampImage, bottomImage, bgImage, avatarImage;
29
- return __generator(this, function (_b) {
30
- switch (_b.label) {
57
+ var type, avatarUrl, username, _a, isWide, _b, bottomImg, bgImg, stampImg, additionalClassName, html, bottomImage, stampImage, bgImage, avatarImage;
58
+ return __generator(this, function (_c) {
59
+ switch (_c.label) {
31
60
  case 0:
32
- type = props.type, avatarUrl = props.avatarUrl, username = props.username;
33
- _a = cardTypes[type], bottomImg = _a.bottomImg, bgImg = _a.bgImg;
61
+ type = props.type, avatarUrl = props.avatarUrl, username = props.username, _a = props.isWide, isWide = _a === void 0 ? true : _a;
62
+ _b = cardTypes[type], bottomImg = _b.bottomImg, bgImg = _b.bgImg, stampImg = _b.stampImg, additionalClassName = _b.additionalClassName;
34
63
  html = getFile(path.join(__dirname, 'index.html'));
35
- stampImage = getBase64Image(path.resolve(__dirname, 'images/stamp.png'));
36
- bottomImage = getBase64Image(path.resolve(__dirname, bottomImg));
64
+ bottomImage = '';
65
+ stampImage = getBase64Image(path.resolve(__dirname, stampImg));
37
66
  bgImage = getBase64Image(path.resolve(__dirname, bgImg));
67
+ if (bottomImg) {
68
+ bottomImage = getBase64Image(path.resolve(__dirname, bottomImg));
69
+ }
38
70
  return [4 /*yield*/, downloadImage(avatarUrl)];
39
71
  case 1:
40
- avatarImage = _b.sent();
72
+ avatarImage = _c.sent();
41
73
  return [2 /*return*/, html
74
+ .replace('--wrapper-width', "".concat(isWide ? 2020 : 850, "px"))
75
+ .replace('{additionalClassName}', additionalClassName)
42
76
  .replace('{bgImg}', bgImage)
77
+ .replace('{wrapperImg}', bottomImage)
43
78
  .replace('{bottomImg}', bottomImage)
44
79
  .replace('{stampImg}', stampImage)
45
80
  .replace('{avatar}', avatarImage)
package/lib/index.js CHANGED
@@ -107,7 +107,7 @@ function __generator(thisArg, body) {
107
107
  fs__default["default"].mkdirSync(output);
108
108
  }
109
109
  filePath = "".concat(output.replace(/\/$/, ''), "/").concat(filename.replace(/\..+$/, ''), ".").concat(type);
110
- return [4 /*yield*/, content.screenshot({ path: filePath })];
110
+ return [4 /*yield*/, content.screenshot({ path: filePath, type: type })];
111
111
  case 9:
112
112
  _d.sent();
113
113
  return [4 /*yield*/, page.close()];
@@ -3,28 +3,57 @@ declare const cardTypes: {
3
3
  readonly business: {
4
4
  readonly bottomImg: "images/business.png";
5
5
  readonly bgImg: "images/bg-business.png";
6
+ readonly stampImg: "images/stamp.png";
7
+ readonly additionalClassName: "";
6
8
  };
7
9
  readonly culture: {
8
10
  readonly bottomImg: "images/culture.png";
9
11
  readonly bgImg: "images/bg-culture.png";
12
+ readonly stampImg: "images/stamp.png";
13
+ readonly additionalClassName: "";
10
14
  };
11
15
  readonly crypto: {
12
16
  readonly bottomImg: "images/crypto.png";
13
17
  readonly bgImg: "images/bg-crypto.png";
18
+ readonly stampImg: "images/stamp.png";
19
+ readonly additionalClassName: "";
14
20
  };
15
21
  readonly politics: {
16
22
  readonly bottomImg: "images/politics.png";
17
23
  readonly bgImg: "images/bg-politics.png";
24
+ readonly stampImg: "images/stamp.png";
25
+ readonly additionalClassName: "";
18
26
  };
19
27
  readonly fomo: {
20
28
  readonly bottomImg: "images/fomo.png";
21
29
  readonly bgImg: "images/bg-fomo.png";
30
+ readonly stampImg: "images/stamp.png";
31
+ readonly additionalClassName: "";
32
+ };
33
+ readonly 'monad-1': {
34
+ readonly bottomImg: "images/monad-1.png";
35
+ readonly bgImg: "images/bg-monad-1.png";
36
+ readonly stampImg: "images/stamp-monad.png";
37
+ readonly additionalClassName: "monad";
38
+ };
39
+ readonly 'monad-2': {
40
+ readonly bottomImg: "images/monad-2.png";
41
+ readonly bgImg: "images/bg-monad-2.png";
42
+ readonly stampImg: "images/stamp-monad.png";
43
+ readonly additionalClassName: "monad";
44
+ };
45
+ readonly 'monad-3': {
46
+ readonly bottomImg: "images/monad-3.png";
47
+ readonly bgImg: "images/bg-monad-3.png";
48
+ readonly stampImg: "images/stamp-monad.png";
49
+ readonly additionalClassName: "monad";
22
50
  };
23
51
  };
24
52
  export type Props = {
25
53
  type: keyof typeof cardTypes;
26
54
  avatarUrl: string;
27
55
  username: string;
56
+ isWide?: boolean;
28
57
  };
29
58
  declare const template: Template<Props>;
30
59
  export default template;
@@ -127,17 +127,18 @@
127
127
  }
128
128
 
129
129
  .card {
130
- width: 600px;
131
- height: 749px;
132
- padding-top: 183px;
130
+ width: 850px;
131
+ height: 1060px;
132
+ padding-top: 260px;
133
133
  position: relative;
134
+ z-index: 1;
134
135
  }
135
136
 
136
137
  .bg {
137
138
  position: absolute;
138
139
  mix-blend-mode: difference;
139
- top: 0;
140
- left: 0;
140
+ top: 0px;
141
+ left: 0px;
141
142
  width: 100%;
142
143
  height: 100%;
143
144
  }
@@ -145,18 +146,18 @@
145
146
  .bottom-img {
146
147
  position: absolute;
147
148
  mix-blend-mode: multiply;
148
- bottom: 0;
149
- left: 0;
149
+ bottom: 0px;
150
+ left: 0px;
150
151
  width: 100%;
151
152
  }
152
153
 
153
154
  .avatar {
154
- width: 212px;
155
- height: 212px;
155
+ width: 300px;
156
+ height: 300px;
156
157
  border-radius: 100%;
157
- border: 2.47px solid white;
158
+ border: 3.5px solid white;
158
159
  overflow: hidden;
159
- margin: 28px auto 0;
160
+ margin: 40px auto 0;
160
161
  position: relative;
161
162
  z-index: 10;
162
163
  }
@@ -168,36 +169,64 @@
168
169
  .username {
169
170
  background-color: #111;
170
171
  color: #fff;
171
- padding: 5.6px 14px 9.2px;
172
- margin: -9.9px auto 0;
172
+ padding: 8px 20px 13px;
173
+ margin: -14px auto 0;
173
174
  width: fit-content;
174
175
  position: relative;
175
176
  z-index: 10;
176
- font-size: 25.4px;
177
+ font-size: 36px;
177
178
  line-height: 100%;
178
179
  font-weight: 400;
179
180
  }
180
181
 
181
182
  .stamp-img {
182
- width: 169px;
183
- height: 169px;
183
+ width: 240px;
184
+ height: 240px;
184
185
  position: absolute;
185
- top: 191px;
186
- right: 99px;
186
+ top: 270px;
187
+ right: 140px;
187
188
  z-index: 20;
188
189
  }
190
+
191
+ .wrapper {
192
+ width: --wrapper-width;
193
+ position: relative;
194
+ background: #393939;
195
+ }
196
+
197
+ .wrapper__img {
198
+ position: absolute;
199
+ display: block;
200
+ top: 0;
201
+ left: 50%;
202
+ transform: translateX(-50%);
203
+ height: 100%;
204
+ mix-blend-mode: multiply;
205
+ }
206
+
207
+ .monad .bottom-img {
208
+ mix-blend-mode: unset;
209
+ }
210
+
211
+ .monad .username {
212
+ box-shadow: 0px -4px 23px 0px rgba(136, 0, 255, 1) inset;
213
+ border-radius: 40px;
214
+ }
189
215
  </style>
190
216
  </head>
191
217
  <body>
192
- <div class="card">
193
- <img src="{bgImg}" alt="" class="bg">
194
- <img src="{bottomImg}" alt="" class="bottom-img">
195
- <img src="{titleImg}" alt="" class="title-img">
196
- <div class="avatar flex items-center justify-center">
197
- <img src="{avatar}" alt="">
218
+ <div class="wrapper flex justify-center {additionalClassName}">
219
+ <img src="{wrapperImg}" alt="" class="wrapper__img">
220
+ <div class="card">
221
+ <img src="{bgImg}" alt="" class="bg">
222
+ <img src="{bottomImg}" alt="" class="bottom-img">
223
+ <img src="{titleImg}" alt="" class="title-img">
224
+ <div class="avatar flex items-center justify-center">
225
+ <img src="{avatar}" alt="">
226
+ </div>
227
+ <img src="{stampImg}" alt="" class="stamp-img">
228
+ <div class="username geist-mono">{username}</div>
198
229
  </div>
199
- <img src="{stampImg}" alt="" class="stamp-img">
200
- <div class="username geist-mono">{username}</div>
201
230
  </div>
202
231
  </body>
203
232
  </html>
@@ -2,44 +2,79 @@
2
2
  'business': {
3
3
  bottomImg: 'images/business.png',
4
4
  bgImg: 'images/bg-business.png',
5
+ stampImg: 'images/stamp.png',
6
+ additionalClassName: ''
5
7
  },
6
8
  'culture': {
7
9
  bottomImg: 'images/culture.png',
8
10
  bgImg: 'images/bg-culture.png',
11
+ stampImg: 'images/stamp.png',
12
+ additionalClassName: ''
9
13
  },
10
14
  'crypto': {
11
15
  bottomImg: 'images/crypto.png',
12
16
  bgImg: 'images/bg-crypto.png',
17
+ stampImg: 'images/stamp.png',
18
+ additionalClassName: ''
13
19
  },
14
20
  'politics': {
15
21
  bottomImg: 'images/politics.png',
16
22
  bgImg: 'images/bg-politics.png',
23
+ stampImg: 'images/stamp.png',
24
+ additionalClassName: ''
17
25
  },
18
26
  'fomo': {
19
27
  bottomImg: 'images/fomo.png',
20
28
  bgImg: 'images/bg-fomo.png',
29
+ stampImg: 'images/stamp.png',
30
+ additionalClassName: ''
31
+ },
32
+ 'monad-1': {
33
+ bottomImg: 'images/monad-1.png',
34
+ bgImg: 'images/bg-monad-1.png',
35
+ stampImg: 'images/stamp-monad.png',
36
+ additionalClassName: 'monad'
37
+ },
38
+ 'monad-2': {
39
+ bottomImg: 'images/monad-2.png',
40
+ bgImg: 'images/bg-monad-2.png',
41
+ stampImg: 'images/stamp-monad.png',
42
+ additionalClassName: 'monad'
43
+ },
44
+ 'monad-3': {
45
+ bottomImg: 'images/monad-3.png',
46
+ bgImg: 'images/bg-monad-3.png',
47
+ stampImg: 'images/stamp-monad.png',
48
+ additionalClassName: 'monad'
21
49
  },
22
50
  };
51
+ // 2020
23
52
  var template = {
24
53
  width: 850,
25
54
  height: 1060,
26
55
  type: 'jpeg',
27
56
  html: function (props) { return index._(void 0, void 0, void 0, function () {
28
- var type, avatarUrl, username, _a, bottomImg, bgImg, html, stampImage, bottomImage, bgImage, avatarImage;
29
- return index.a(this, function (_b) {
30
- switch (_b.label) {
57
+ var type, avatarUrl, username, _a, isWide, _b, bottomImg, bgImg, stampImg, additionalClassName, html, bottomImage, stampImage, bgImage, avatarImage;
58
+ return index.a(this, function (_c) {
59
+ switch (_c.label) {
31
60
  case 0:
32
- type = props.type, avatarUrl = props.avatarUrl, username = props.username;
33
- _a = cardTypes[type], bottomImg = _a.bottomImg, bgImg = _a.bgImg;
61
+ type = props.type, avatarUrl = props.avatarUrl, username = props.username, _a = props.isWide, isWide = _a === void 0 ? true : _a;
62
+ _b = cardTypes[type], bottomImg = _b.bottomImg, bgImg = _b.bgImg, stampImg = _b.stampImg, additionalClassName = _b.additionalClassName;
34
63
  html = index.g(path__default["default"].join(__dirname, 'index.html'));
35
- stampImage = index.b(path__default["default"].resolve(__dirname, 'images/stamp.png'));
36
- bottomImage = index.b(path__default["default"].resolve(__dirname, bottomImg));
64
+ bottomImage = '';
65
+ stampImage = index.b(path__default["default"].resolve(__dirname, stampImg));
37
66
  bgImage = index.b(path__default["default"].resolve(__dirname, bgImg));
67
+ if (bottomImg) {
68
+ bottomImage = index.b(path__default["default"].resolve(__dirname, bottomImg));
69
+ }
38
70
  return [4 /*yield*/, index.d(avatarUrl)];
39
71
  case 1:
40
- avatarImage = _b.sent();
72
+ avatarImage = _c.sent();
41
73
  return [2 /*return*/, html
74
+ .replace('--wrapper-width', "".concat(isWide ? 2020 : 850, "px"))
75
+ .replace('{additionalClassName}', additionalClassName)
42
76
  .replace('{bgImg}', bgImage)
77
+ .replace('{wrapperImg}', bottomImage)
43
78
  .replace('{bottomImg}', bottomImage)
44
79
  .replace('{stampImg}', stampImage)
45
80
  .replace('{avatar}', avatarImage)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/images-generator",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "license": "ISC",
5
5
  "engines": {
6
6
  "node": ">=16.15.1",