@azuro-org/images-generator 2.0.0 → 2.0.2

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.
Files changed (49) hide show
  1. package/dist/index.es.js +3 -3
  2. package/dist/templates/trendle-trading/images/default.png +0 -0
  3. package/dist/templates/trendle-trading/index.d.ts +1 -3
  4. package/dist/templates/trendle-trading/index.html +40 -32
  5. package/dist/templates/trendle-trading/index.js +13 -13
  6. package/lib/index.js +3 -3
  7. package/lib/templates/trendle-trading/images/default.png +0 -0
  8. package/lib/templates/trendle-trading/index.d.ts +1 -3
  9. package/lib/templates/trendle-trading/index.html +40 -32
  10. package/lib/templates/trendle-trading/index.js +12 -12
  11. package/package.json +1 -1
  12. package/dist/templates/trendle-trading/images/arnold.png +0 -0
  13. package/dist/templates/trendle-trading/images/bg.png +0 -0
  14. package/dist/templates/trendle-trading/images/crash.png +0 -0
  15. package/dist/templates/trendle-trading/images/drake.png +0 -0
  16. package/dist/templates/trendle-trading/images/elon-2.png +0 -0
  17. package/dist/templates/trendle-trading/images/elon.png +0 -0
  18. package/dist/templates/trendle-trading/images/lewis.png +0 -0
  19. package/dist/templates/trendle-trading/images/loss.png +0 -0
  20. package/dist/templates/trendle-trading/images/macron.png +0 -0
  21. package/dist/templates/trendle-trading/images/mark.png +0 -0
  22. package/dist/templates/trendle-trading/images/obama.png +0 -0
  23. package/dist/templates/trendle-trading/images/person-1.png +0 -0
  24. package/dist/templates/trendle-trading/images/person-2.png +0 -0
  25. package/dist/templates/trendle-trading/images/powell.png +0 -0
  26. package/dist/templates/trendle-trading/images/profit.png +0 -0
  27. package/dist/templates/trendle-trading/images/sydney.png +0 -0
  28. package/dist/templates/trendle-trading/images/taylor.png +0 -0
  29. package/dist/templates/trendle-trading/images/tramp-2.png +0 -0
  30. package/dist/templates/trendle-trading/images/tramp.png +0 -0
  31. package/lib/templates/trendle-trading/images/arnold.png +0 -0
  32. package/lib/templates/trendle-trading/images/bg.png +0 -0
  33. package/lib/templates/trendle-trading/images/crash.png +0 -0
  34. package/lib/templates/trendle-trading/images/drake.png +0 -0
  35. package/lib/templates/trendle-trading/images/elon-2.png +0 -0
  36. package/lib/templates/trendle-trading/images/elon.png +0 -0
  37. package/lib/templates/trendle-trading/images/lewis.png +0 -0
  38. package/lib/templates/trendle-trading/images/loss.png +0 -0
  39. package/lib/templates/trendle-trading/images/macron.png +0 -0
  40. package/lib/templates/trendle-trading/images/mark.png +0 -0
  41. package/lib/templates/trendle-trading/images/obama.png +0 -0
  42. package/lib/templates/trendle-trading/images/person-1.png +0 -0
  43. package/lib/templates/trendle-trading/images/person-2.png +0 -0
  44. package/lib/templates/trendle-trading/images/powell.png +0 -0
  45. package/lib/templates/trendle-trading/images/profit.png +0 -0
  46. package/lib/templates/trendle-trading/images/sydney.png +0 -0
  47. package/lib/templates/trendle-trading/images/taylor.png +0 -0
  48. package/lib/templates/trendle-trading/images/tramp-2.png +0 -0
  49. package/lib/templates/trendle-trading/images/tramp.png +0 -0
package/dist/index.es.js CHANGED
@@ -138,7 +138,7 @@ function __generator(thisArg, body) {
138
138
  return __generator(this, function (_l) {
139
139
  switch (_l.label) {
140
140
  case 0:
141
- if (!(!this.browser || !this.browser.connected)) return [3 /*break*/, 2];
141
+ if (!!this.browser) return [3 /*break*/, 2];
142
142
  return [4 /*yield*/, this.run()];
143
143
  case 1:
144
144
  _l.sent();
@@ -167,8 +167,8 @@ function __generator(thisArg, body) {
167
167
  page.on('request', function (req) {
168
168
  var resourceType = req.resourceType();
169
169
  // Block only truly unnecessary resources that don't affect rendering
170
- // Allow images, stylesheets, scripts, and data URLs
171
- if (['font', 'media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
170
+ // Allow images, stylesheets, scripts, fonts, and data URLs
171
+ if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
172
172
  req.abort();
173
173
  }
174
174
  else {
@@ -1,9 +1,7 @@
1
1
  import { type Template } from '../../utils';
2
- type Person = 'obama' | 'drake' | 'crash' | 'sydney' | 'tramp' | 'elon' | 'lewis' | 'mark' | 'powell' | 'macron' | 'arnold' | 'person-1' | 'tramp-2' | 'elon-2' | 'person-2' | 'taylor';
3
2
  export type Props = {
4
- type: Person;
5
3
  trend: {
6
- image: string;
4
+ image: string | undefined;
7
5
  title: string;
8
6
  };
9
7
  position: {
@@ -4,8 +4,10 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
7
9
  <link
8
- href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Mona+Sans:wdth,wght@75..125,700&display=swap"
10
+ href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Mona+Sans:ital,wdth,wght@0,125,200..900;1,125,200..900&display=swap"
9
11
  rel="stylesheet">
10
12
  <style>
11
13
  html {
@@ -26,6 +28,13 @@
26
28
  font-style: normal;
27
29
  }
28
30
 
31
+ .geist-mono {
32
+ font-family: "Geist Mono", monospace;
33
+ font-optical-sizing: auto;
34
+ font-weight: 400;
35
+ font-style: normal;
36
+ }
37
+
29
38
  * {
30
39
  box-sizing: border-box;
31
40
  }
@@ -130,22 +139,31 @@
130
139
  text-transform: uppercase;
131
140
  }
132
141
 
142
+ .text-underline {
143
+ text-decoration: underline;
144
+ }
145
+
133
146
  .text-center {
134
147
  text-align: center;
135
148
  }
136
149
 
150
+ .text-bold {
151
+ font-weight: 700;
152
+ }
153
+
137
154
  .card {
138
155
  background: --card-bg-color;
139
156
  width: 1200px;
140
- height: 630px;
141
- padding: 48px;
157
+ height: 675px;
158
+ padding: 40px 36px 30px;
142
159
  position: relative;
143
160
  }
144
161
 
145
162
  .logo {
146
- height: 38px;
147
- width: 266px;
163
+ height: 24px;
164
+ width: 156px;
148
165
  display: block;
166
+ margin-right: 45px;
149
167
  }
150
168
 
151
169
  .trend {
@@ -235,38 +253,28 @@
235
253
  .level-box {
236
254
  margin-left: 125px;
237
255
  }
256
+
257
+ .box {
258
+ background: #0F0F0F;
259
+ border-radius: 33px;
260
+ height: 100%;
261
+ width: fit-content;
262
+ padding: 30px 30px 55px;
263
+ }
264
+
265
+ .box-bottom {
266
+ margin-top: 30px;
267
+ }
238
268
  </style>
239
269
  </head>
240
270
 
241
271
  <body>
242
272
  <div class="card flex flex-col justify-between">
243
- <img class="bg-img" src={bgImg} alt="">
244
- <img class="right-img" src={rightImg} alt="">
245
- <img class="person-img" src={personImg} alt="">
246
- <img src="{logo}" class="logo" alt="">
247
- <div>
248
- <div class="trend flex items-center">
249
- <div class="trend__img flex items-center justify-center">
250
- <img src="{trendImage}" alt="">
251
- </div>
252
- <div>
253
- <div class="trend__title">{trendTitle}</div>
254
- <div class="trend__badge">
255
- <img class="arrow" src="{arrowImage}" alt="">
256
- <span>{positionInfo}</span>
257
- </div>
258
- </div>
259
- </div>
260
- <div class="pnl">{pnl}%</div>
261
- <div class="level-wrapper flex items-center">
262
- <div>
263
- <div class="level-title">Entry level:</div>
264
- <div class="level-content">{openLevel}</div>
265
- </div>
266
- <div class="level-box {exitLevelClass}">
267
- <div class="level-title">Exit level:</div>
268
- <div class="level-content">{exitLevel}</div>
269
- </div>
273
+ <img class="person-img" src={trendImage} alt="">
274
+ <div class="box"></div>
275
+ <div class="box-bottom flex items-end">
276
+ <img src="{logo}" class="logo" alt="">
277
+ <div class="text-upper geist-mono">trade attention on <span class="text-underline text-bold">Trendle.fi</span>
270
278
  </div>
271
279
  </div>
272
280
  </div>
@@ -1,10 +1,8 @@
1
- import {_ as __awaiter,a as __generator,g as getFile,b as getBase64Image,d as downloadImage}from'../../index-6ec143bc.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var cardTypes = {
1
+ import {_ as __awaiter,a as __generator,b as getBase64Image,g as getFile,d as downloadImage}from'../../index-6ec143bc.js';import path from'path';import'fs';import'util';import'stream';import'http';import'https';import'url';import'crypto';import'http2';import'assert';import'tty';import'zlib';import'events';var cardTypes = {
2
2
  'profit': {
3
- rightImg: 'images/profit.png',
4
3
  bgColor: '#72FF4B',
5
4
  },
6
5
  'loss': {
7
- rightImg: 'images/loss.png',
8
6
  bgColor: '#FF604B',
9
7
  }
10
8
  };
@@ -13,30 +11,32 @@ var template = {
13
11
  height: 630,
14
12
  type: 'jpeg',
15
13
  html: function (props) { return __awaiter(void 0, void 0, void 0, function () {
16
- var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
14
+ var trend, pnl, position, isProfit, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, arrowImage, trendImage, _a, positionInfo;
17
15
  return __generator(this, function (_b) {
18
16
  switch (_b.label) {
19
17
  case 0:
20
- type = props.type, trend = props.trend, pnl = props.pnl, position = props.position;
18
+ trend = props.trend, pnl = props.pnl, position = props.position;
21
19
  isProfit = pnl > 0;
22
- _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
20
+ bgColor = (isProfit ? cardTypes.profit : cardTypes.loss).bgColor;
23
21
  leverage = position.leverage, isLong = position.isLong, openLevel = position.openLevel, exitLevel = position.exitLevel;
24
22
  html = getFile(path.join(__dirname, 'index.html'));
25
23
  logo = getBase64Image(path.resolve(__dirname, 'images/logo.png'));
26
- bgImage = getBase64Image(path.resolve(__dirname, 'images/bg.png'));
27
- rightImage = getBase64Image(path.resolve(__dirname, rightImg));
28
- personImage = getBase64Image(path.resolve(__dirname, "images/".concat(type, ".png")));
29
24
  arrowImage = getBase64Image(path.resolve(__dirname, isLong ? 'images/arrow-up.png' : 'images/arrow-down.png'));
25
+ if (!trend.image) return [3 /*break*/, 2];
30
26
  return [4 /*yield*/, downloadImage(trend.image)];
31
27
  case 1:
32
- trendImage = _b.sent();
28
+ _a = _b.sent();
29
+ return [3 /*break*/, 3];
30
+ case 2:
31
+ _a = getBase64Image(path.resolve(__dirname, 'images/default.png'));
32
+ _b.label = 3;
33
+ case 3:
34
+ trendImage = _a;
33
35
  positionInfo = "".concat(isLong ? ' Up' : ' Down', ", Boost x").concat(leverage);
34
36
  return [2 /*return*/, html
35
37
  .replace('{logo}', logo)
36
38
  .replace('--card-bg-color', bgColor)
37
- .replace('{bgImg}', bgImage)
38
- .replace('{rightImg}', rightImage)
39
- .replace('{personImg}', personImage)
39
+ .replace('{personImg}', trendImage)
40
40
  .replace('{trendImage}', trendImage)
41
41
  .replace('{trendTitle}', trend.title)
42
42
  .replace('{positionInfo}', positionInfo)
package/lib/index.js CHANGED
@@ -138,7 +138,7 @@ function __generator(thisArg, body) {
138
138
  return __generator(this, function (_l) {
139
139
  switch (_l.label) {
140
140
  case 0:
141
- if (!(!this.browser || !this.browser.connected)) return [3 /*break*/, 2];
141
+ if (!!this.browser) return [3 /*break*/, 2];
142
142
  return [4 /*yield*/, this.run()];
143
143
  case 1:
144
144
  _l.sent();
@@ -167,8 +167,8 @@ function __generator(thisArg, body) {
167
167
  page.on('request', function (req) {
168
168
  var resourceType = req.resourceType();
169
169
  // Block only truly unnecessary resources that don't affect rendering
170
- // Allow images, stylesheets, scripts, and data URLs
171
- if (['font', 'media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
170
+ // Allow images, stylesheets, scripts, fonts, and data URLs
171
+ if (['media', 'websocket', 'manifest', 'texttrack'].includes(resourceType)) {
172
172
  req.abort();
173
173
  }
174
174
  else {
@@ -1,9 +1,7 @@
1
1
  import { type Template } from '../../utils';
2
- type Person = 'obama' | 'drake' | 'crash' | 'sydney' | 'tramp' | 'elon' | 'lewis' | 'mark' | 'powell' | 'macron' | 'arnold' | 'person-1' | 'tramp-2' | 'elon-2' | 'person-2' | 'taylor';
3
2
  export type Props = {
4
- type: Person;
5
3
  trend: {
6
- image: string;
4
+ image: string | undefined;
7
5
  title: string;
8
6
  };
9
7
  position: {
@@ -4,8 +4,10 @@
4
4
  <head>
5
5
  <meta charset="UTF-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
7
9
  <link
8
- href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Mona+Sans:wdth,wght@75..125,700&display=swap"
10
+ href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Mona+Sans:ital,wdth,wght@0,125,200..900;1,125,200..900&display=swap"
9
11
  rel="stylesheet">
10
12
  <style>
11
13
  html {
@@ -26,6 +28,13 @@
26
28
  font-style: normal;
27
29
  }
28
30
 
31
+ .geist-mono {
32
+ font-family: "Geist Mono", monospace;
33
+ font-optical-sizing: auto;
34
+ font-weight: 400;
35
+ font-style: normal;
36
+ }
37
+
29
38
  * {
30
39
  box-sizing: border-box;
31
40
  }
@@ -130,22 +139,31 @@
130
139
  text-transform: uppercase;
131
140
  }
132
141
 
142
+ .text-underline {
143
+ text-decoration: underline;
144
+ }
145
+
133
146
  .text-center {
134
147
  text-align: center;
135
148
  }
136
149
 
150
+ .text-bold {
151
+ font-weight: 700;
152
+ }
153
+
137
154
  .card {
138
155
  background: --card-bg-color;
139
156
  width: 1200px;
140
- height: 630px;
141
- padding: 48px;
157
+ height: 675px;
158
+ padding: 40px 36px 30px;
142
159
  position: relative;
143
160
  }
144
161
 
145
162
  .logo {
146
- height: 38px;
147
- width: 266px;
163
+ height: 24px;
164
+ width: 156px;
148
165
  display: block;
166
+ margin-right: 45px;
149
167
  }
150
168
 
151
169
  .trend {
@@ -235,38 +253,28 @@
235
253
  .level-box {
236
254
  margin-left: 125px;
237
255
  }
256
+
257
+ .box {
258
+ background: #0F0F0F;
259
+ border-radius: 33px;
260
+ height: 100%;
261
+ width: fit-content;
262
+ padding: 30px 30px 55px;
263
+ }
264
+
265
+ .box-bottom {
266
+ margin-top: 30px;
267
+ }
238
268
  </style>
239
269
  </head>
240
270
 
241
271
  <body>
242
272
  <div class="card flex flex-col justify-between">
243
- <img class="bg-img" src={bgImg} alt="">
244
- <img class="right-img" src={rightImg} alt="">
245
- <img class="person-img" src={personImg} alt="">
246
- <img src="{logo}" class="logo" alt="">
247
- <div>
248
- <div class="trend flex items-center">
249
- <div class="trend__img flex items-center justify-center">
250
- <img src="{trendImage}" alt="">
251
- </div>
252
- <div>
253
- <div class="trend__title">{trendTitle}</div>
254
- <div class="trend__badge">
255
- <img class="arrow" src="{arrowImage}" alt="">
256
- <span>{positionInfo}</span>
257
- </div>
258
- </div>
259
- </div>
260
- <div class="pnl">{pnl}%</div>
261
- <div class="level-wrapper flex items-center">
262
- <div>
263
- <div class="level-title">Entry level:</div>
264
- <div class="level-content">{openLevel}</div>
265
- </div>
266
- <div class="level-box {exitLevelClass}">
267
- <div class="level-title">Exit level:</div>
268
- <div class="level-content">{exitLevel}</div>
269
- </div>
273
+ <img class="person-img" src={trendImage} alt="">
274
+ <div class="box"></div>
275
+ <div class="box-bottom flex items-end">
276
+ <img src="{logo}" class="logo" alt="">
277
+ <div class="text-upper geist-mono">trade attention on <span class="text-underline text-bold">Trendle.fi</span>
270
278
  </div>
271
279
  </div>
272
280
  </div>
@@ -1,10 +1,8 @@
1
1
  'use strict';var index=require('../../index-efa024cc.js'),path=require('path');require('fs'),require('util'),require('stream'),require('http'),require('https'),require('url'),require('crypto'),require('http2'),require('assert'),require('tty'),require('zlib'),require('events');function _interopDefaultLegacy(e){return e&&typeof e==='object'&&'default'in e?e:{'default':e}}var path__default=/*#__PURE__*/_interopDefaultLegacy(path);var cardTypes = {
2
2
  'profit': {
3
- rightImg: 'images/profit.png',
4
3
  bgColor: '#72FF4B',
5
4
  },
6
5
  'loss': {
7
- rightImg: 'images/loss.png',
8
6
  bgColor: '#FF604B',
9
7
  }
10
8
  };
@@ -13,30 +11,32 @@ var template = {
13
11
  height: 630,
14
12
  type: 'jpeg',
15
13
  html: function (props) { return index._(void 0, void 0, void 0, function () {
16
- var type, trend, pnl, position, isProfit, _a, rightImg, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, bgImage, rightImage, personImage, arrowImage, trendImage, positionInfo;
14
+ var trend, pnl, position, isProfit, bgColor, leverage, isLong, openLevel, exitLevel, html, logo, arrowImage, trendImage, _a, positionInfo;
17
15
  return index.a(this, function (_b) {
18
16
  switch (_b.label) {
19
17
  case 0:
20
- type = props.type, trend = props.trend, pnl = props.pnl, position = props.position;
18
+ trend = props.trend, pnl = props.pnl, position = props.position;
21
19
  isProfit = pnl > 0;
22
- _a = isProfit ? cardTypes.profit : cardTypes.loss, rightImg = _a.rightImg, bgColor = _a.bgColor;
20
+ bgColor = (isProfit ? cardTypes.profit : cardTypes.loss).bgColor;
23
21
  leverage = position.leverage, isLong = position.isLong, openLevel = position.openLevel, exitLevel = position.exitLevel;
24
22
  html = index.g(path__default["default"].join(__dirname, 'index.html'));
25
23
  logo = index.b(path__default["default"].resolve(__dirname, 'images/logo.png'));
26
- bgImage = index.b(path__default["default"].resolve(__dirname, 'images/bg.png'));
27
- rightImage = index.b(path__default["default"].resolve(__dirname, rightImg));
28
- personImage = index.b(path__default["default"].resolve(__dirname, "images/".concat(type, ".png")));
29
24
  arrowImage = index.b(path__default["default"].resolve(__dirname, isLong ? 'images/arrow-up.png' : 'images/arrow-down.png'));
25
+ if (!trend.image) return [3 /*break*/, 2];
30
26
  return [4 /*yield*/, index.d(trend.image)];
31
27
  case 1:
32
- trendImage = _b.sent();
28
+ _a = _b.sent();
29
+ return [3 /*break*/, 3];
30
+ case 2:
31
+ _a = index.b(path__default["default"].resolve(__dirname, 'images/default.png'));
32
+ _b.label = 3;
33
+ case 3:
34
+ trendImage = _a;
33
35
  positionInfo = "".concat(isLong ? ' Up' : ' Down', ", Boost x").concat(leverage);
34
36
  return [2 /*return*/, html
35
37
  .replace('{logo}', logo)
36
38
  .replace('--card-bg-color', bgColor)
37
- .replace('{bgImg}', bgImage)
38
- .replace('{rightImg}', rightImage)
39
- .replace('{personImg}', personImage)
39
+ .replace('{personImg}', trendImage)
40
40
  .replace('{trendImage}', trendImage)
41
41
  .replace('{trendTitle}', trend.title)
42
42
  .replace('{positionInfo}', positionInfo)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azuro-org/images-generator",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "license": "ISC",
5
5
  "engines": {
6
6
  "node": ">=16.15.1",