apexify.js 4.8.1 → 4.8.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 (255) hide show
  1. package/dist/cjs/ai/ApexAI.d.ts +0 -1
  2. package/dist/cjs/ai/ApexAI.js +56 -64
  3. package/dist/cjs/ai/ApexModules.d.ts +0 -1
  4. package/dist/cjs/ai/ApexModules.js +25 -33
  5. package/dist/cjs/ai/functions/readFiles.d.ts +0 -1
  6. package/dist/cjs/ai/functions/readFiles.js +11 -51
  7. package/dist/cjs/ai/functions/tokenizer.d.ts +0 -1
  8. package/dist/cjs/ai/functions/tokenizer.js +1 -5
  9. package/dist/cjs/ai/functions/validOptions.d.ts +0 -1
  10. package/dist/cjs/ai/functions/validOptions.js +13 -23
  11. package/dist/cjs/ai/modals/electronHub/chatmodels.d.ts +0 -1
  12. package/dist/cjs/ai/modals/electronHub/chatmodels.js +5 -12
  13. package/dist/cjs/ai/modals/electronHub/imageModels.d.ts +0 -1
  14. package/dist/cjs/ai/modals/electronHub/imageModels.js +10 -17
  15. package/dist/cjs/ai/modals/electronHub/songModels.d.ts +0 -1
  16. package/dist/cjs/ai/modals/electronHub/songModels.js +1 -3
  17. package/dist/cjs/ai/modals/electronHub/speechModels.d.ts +0 -1
  18. package/dist/cjs/ai/modals/electronHub/speechModels.js +7 -14
  19. package/dist/cjs/ai/modals/electronHub/videoModels.d.ts +0 -1
  20. package/dist/cjs/ai/modals/electronHub/videoModels.js +5 -12
  21. package/dist/cjs/ai/modals/groq/chatgroq.d.ts +0 -1
  22. package/dist/cjs/ai/modals/groq/chatgroq.js +4 -11
  23. package/dist/cjs/ai/modals/groq/imageAnalyzer.d.ts +0 -1
  24. package/dist/cjs/ai/modals/groq/imageAnalyzer.js +9 -16
  25. package/dist/cjs/ai/modals/groq/whisper.d.ts +0 -1
  26. package/dist/cjs/ai/modals/groq/whisper.js +20 -27
  27. package/dist/cjs/ai/modals/hercai/chatModels.d.ts +0 -1
  28. package/dist/cjs/ai/modals/hercai/chatModels.js +3 -7
  29. package/dist/cjs/ai/utils.d.ts +4 -6
  30. package/dist/cjs/ai/utils.js +4 -17
  31. package/dist/cjs/canvas/ApexPainter.d.ts +1 -2
  32. package/dist/cjs/canvas/ApexPainter.js +93 -101
  33. package/dist/cjs/canvas/utils/Background/bg.d.ts +1 -2
  34. package/dist/cjs/canvas/utils/Background/bg.js +8 -18
  35. package/dist/cjs/canvas/utils/Charts/charts.d.ts +1 -2
  36. package/dist/cjs/canvas/utils/Charts/charts.js +14 -23
  37. package/dist/cjs/canvas/utils/Custom/customLines.d.ts +1 -2
  38. package/dist/cjs/canvas/utils/Custom/customLines.js +4 -8
  39. package/dist/cjs/canvas/utils/General/conversion.d.ts +0 -1
  40. package/dist/cjs/canvas/utils/General/conversion.js +7 -15
  41. package/dist/cjs/canvas/utils/General/general functions.d.ts +1 -2
  42. package/dist/cjs/canvas/utils/General/general functions.js +48 -64
  43. package/dist/cjs/canvas/utils/Image/imageProperties.d.ts +1 -2
  44. package/dist/cjs/canvas/utils/Image/imageProperties.js +9 -21
  45. package/dist/cjs/canvas/utils/Texts/textProperties.d.ts +1 -2
  46. package/dist/cjs/canvas/utils/Texts/textProperties.js +3 -9
  47. package/dist/cjs/canvas/utils/types.d.ts +0 -1
  48. package/dist/cjs/canvas/utils/types.js +1 -3
  49. package/dist/cjs/canvas/utils/utils.d.ts +8 -9
  50. package/dist/cjs/canvas/utils/utils.js +8 -44
  51. package/dist/cjs/index.d.ts +5 -6
  52. package/dist/cjs/index.js +15 -65
  53. package/dist/cjs/utils.d.ts +3 -4
  54. package/dist/cjs/utils.js +4 -16
  55. package/dist/esm/ai/ApexAI.d.ts +0 -1
  56. package/dist/esm/ai/ApexAI.js +56 -64
  57. package/dist/esm/ai/ApexModules.d.ts +0 -1
  58. package/dist/esm/ai/ApexModules.js +25 -33
  59. package/dist/esm/ai/functions/readFiles.d.ts +0 -1
  60. package/dist/esm/ai/functions/readFiles.js +11 -51
  61. package/dist/esm/ai/functions/tokenizer.d.ts +0 -1
  62. package/dist/esm/ai/functions/tokenizer.js +1 -5
  63. package/dist/esm/ai/functions/validOptions.d.ts +0 -1
  64. package/dist/esm/ai/functions/validOptions.js +13 -23
  65. package/dist/esm/ai/modals/electronHub/chatmodels.d.ts +0 -1
  66. package/dist/esm/ai/modals/electronHub/chatmodels.js +5 -12
  67. package/dist/esm/ai/modals/electronHub/imageModels.d.ts +0 -1
  68. package/dist/esm/ai/modals/electronHub/imageModels.js +10 -17
  69. package/dist/esm/ai/modals/electronHub/songModels.d.ts +0 -1
  70. package/dist/esm/ai/modals/electronHub/songModels.js +1 -3
  71. package/dist/esm/ai/modals/electronHub/speechModels.d.ts +0 -1
  72. package/dist/esm/ai/modals/electronHub/speechModels.js +7 -14
  73. package/dist/esm/ai/modals/electronHub/videoModels.d.ts +0 -1
  74. package/dist/esm/ai/modals/electronHub/videoModels.js +5 -12
  75. package/dist/esm/ai/modals/groq/chatgroq.d.ts +0 -1
  76. package/dist/esm/ai/modals/groq/chatgroq.js +4 -11
  77. package/dist/esm/ai/modals/groq/imageAnalyzer.d.ts +0 -1
  78. package/dist/esm/ai/modals/groq/imageAnalyzer.js +9 -16
  79. package/dist/esm/ai/modals/groq/whisper.d.ts +0 -1
  80. package/dist/esm/ai/modals/groq/whisper.js +20 -27
  81. package/dist/esm/ai/modals/hercai/chatModels.d.ts +0 -1
  82. package/dist/esm/ai/modals/hercai/chatModels.js +3 -7
  83. package/dist/esm/ai/utils.d.ts +4 -6
  84. package/dist/esm/ai/utils.js +4 -17
  85. package/dist/esm/canvas/ApexPainter.d.ts +1 -2
  86. package/dist/esm/canvas/ApexPainter.js +93 -101
  87. package/dist/esm/canvas/utils/Background/bg.d.ts +1 -2
  88. package/dist/esm/canvas/utils/Background/bg.js +8 -18
  89. package/dist/esm/canvas/utils/Charts/charts.d.ts +1 -2
  90. package/dist/esm/canvas/utils/Charts/charts.js +14 -23
  91. package/dist/esm/canvas/utils/Custom/customLines.d.ts +1 -2
  92. package/dist/esm/canvas/utils/Custom/customLines.js +4 -8
  93. package/dist/esm/canvas/utils/General/conversion.d.ts +0 -1
  94. package/dist/esm/canvas/utils/General/conversion.js +7 -15
  95. package/dist/esm/canvas/utils/General/general functions.d.ts +1 -2
  96. package/dist/esm/canvas/utils/General/general functions.js +48 -64
  97. package/dist/esm/canvas/utils/Image/imageProperties.d.ts +1 -2
  98. package/dist/esm/canvas/utils/Image/imageProperties.js +9 -21
  99. package/dist/esm/canvas/utils/Texts/textProperties.d.ts +1 -2
  100. package/dist/esm/canvas/utils/Texts/textProperties.js +3 -9
  101. package/dist/esm/canvas/utils/types.d.ts +0 -1
  102. package/dist/esm/canvas/utils/types.js +1 -3
  103. package/dist/esm/canvas/utils/utils.d.ts +8 -9
  104. package/dist/esm/canvas/utils/utils.js +8 -44
  105. package/dist/esm/index.d.ts +5 -6
  106. package/dist/esm/index.js +15 -65
  107. package/dist/esm/utils.d.ts +3 -4
  108. package/dist/esm/utils.js +4 -16
  109. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  110. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  111. package/lib/ai/ApexAI.ts +2 -2
  112. package/lib/ai/ApexModules.ts +8 -8
  113. package/lib/ai/modals/electronHub/chatmodels.ts +1 -1
  114. package/lib/ai/modals/electronHub/imageModels.ts +2 -2
  115. package/lib/ai/modals/electronHub/speechModels.ts +1 -1
  116. package/lib/ai/utils.ts +3 -5
  117. package/lib/canvas/ApexPainter.ts +4 -4
  118. package/lib/canvas/utils/Background/bg.ts +1 -1
  119. package/lib/canvas/utils/Charts/charts.ts +1 -1
  120. package/lib/canvas/utils/Custom/customLines.ts +2 -2
  121. package/lib/canvas/utils/General/general functions.ts +1 -1
  122. package/lib/canvas/utils/Image/imageProperties.ts +1 -1
  123. package/lib/canvas/utils/Texts/textProperties.ts +1 -1
  124. package/lib/canvas/utils/utils.ts +8 -8
  125. package/lib/index.ts +5 -5
  126. package/lib/utils.ts +3 -3
  127. package/package.json +7 -5
  128. package/dist/cjs/ai/ApexAI.d.ts.map +0 -1
  129. package/dist/cjs/ai/ApexAI.js.map +0 -1
  130. package/dist/cjs/ai/ApexModules.d.ts.map +0 -1
  131. package/dist/cjs/ai/ApexModules.js.map +0 -1
  132. package/dist/cjs/ai/functions/readFiles.d.ts.map +0 -1
  133. package/dist/cjs/ai/functions/readFiles.js.map +0 -1
  134. package/dist/cjs/ai/functions/tokenizer.d.ts.map +0 -1
  135. package/dist/cjs/ai/functions/tokenizer.js.map +0 -1
  136. package/dist/cjs/ai/functions/typeWriter.d.ts +0 -2
  137. package/dist/cjs/ai/functions/typeWriter.d.ts.map +0 -1
  138. package/dist/cjs/ai/functions/typeWriter.js +0 -24
  139. package/dist/cjs/ai/functions/typeWriter.js.map +0 -1
  140. package/dist/cjs/ai/functions/validOptions.d.ts.map +0 -1
  141. package/dist/cjs/ai/functions/validOptions.js.map +0 -1
  142. package/dist/cjs/ai/modals/electronHub/chatmodels.d.ts.map +0 -1
  143. package/dist/cjs/ai/modals/electronHub/chatmodels.js.map +0 -1
  144. package/dist/cjs/ai/modals/electronHub/imageModels.d.ts.map +0 -1
  145. package/dist/cjs/ai/modals/electronHub/imageModels.js.map +0 -1
  146. package/dist/cjs/ai/modals/electronHub/songModels.d.ts.map +0 -1
  147. package/dist/cjs/ai/modals/electronHub/songModels.js.map +0 -1
  148. package/dist/cjs/ai/modals/electronHub/speechModels.d.ts.map +0 -1
  149. package/dist/cjs/ai/modals/electronHub/speechModels.js.map +0 -1
  150. package/dist/cjs/ai/modals/electronHub/videoModels.d.ts.map +0 -1
  151. package/dist/cjs/ai/modals/electronHub/videoModels.js.map +0 -1
  152. package/dist/cjs/ai/modals/groq/chatgroq.d.ts.map +0 -1
  153. package/dist/cjs/ai/modals/groq/chatgroq.js.map +0 -1
  154. package/dist/cjs/ai/modals/groq/imageAnalyzer.d.ts.map +0 -1
  155. package/dist/cjs/ai/modals/groq/imageAnalyzer.js.map +0 -1
  156. package/dist/cjs/ai/modals/groq/whisper.d.ts.map +0 -1
  157. package/dist/cjs/ai/modals/groq/whisper.js.map +0 -1
  158. package/dist/cjs/ai/modals/hercai/chatModels.d.ts.map +0 -1
  159. package/dist/cjs/ai/modals/hercai/chatModels.js.map +0 -1
  160. package/dist/cjs/ai/utils.d.ts.map +0 -1
  161. package/dist/cjs/ai/utils.js.map +0 -1
  162. package/dist/cjs/canvas/ApexPainter.d.ts.map +0 -1
  163. package/dist/cjs/canvas/ApexPainter.js.map +0 -1
  164. package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts +0 -11
  165. package/dist/cjs/canvas/Themes/Level-Up/levelup.d.ts.map +0 -1
  166. package/dist/cjs/canvas/Themes/Level-Up/levelup.js +0 -163
  167. package/dist/cjs/canvas/Themes/Level-Up/levelup.js.map +0 -1
  168. package/dist/cjs/canvas/utils/Background/bg.d.ts.map +0 -1
  169. package/dist/cjs/canvas/utils/Background/bg.js.map +0 -1
  170. package/dist/cjs/canvas/utils/Charts/charts.d.ts.map +0 -1
  171. package/dist/cjs/canvas/utils/Charts/charts.js.map +0 -1
  172. package/dist/cjs/canvas/utils/Custom/customLines.d.ts.map +0 -1
  173. package/dist/cjs/canvas/utils/Custom/customLines.js.map +0 -1
  174. package/dist/cjs/canvas/utils/General/conversion.d.ts.map +0 -1
  175. package/dist/cjs/canvas/utils/General/conversion.js.map +0 -1
  176. package/dist/cjs/canvas/utils/General/general functions.d.ts.map +0 -1
  177. package/dist/cjs/canvas/utils/General/general functions.js.map +0 -1
  178. package/dist/cjs/canvas/utils/Image/imageProperties.d.ts.map +0 -1
  179. package/dist/cjs/canvas/utils/Image/imageProperties.js.map +0 -1
  180. package/dist/cjs/canvas/utils/Texts/textProperties.d.ts.map +0 -1
  181. package/dist/cjs/canvas/utils/Texts/textProperties.js.map +0 -1
  182. package/dist/cjs/canvas/utils/types.d.ts.map +0 -1
  183. package/dist/cjs/canvas/utils/types.js.map +0 -1
  184. package/dist/cjs/canvas/utils/utils.d.ts.map +0 -1
  185. package/dist/cjs/canvas/utils/utils.js.map +0 -1
  186. package/dist/cjs/index.d.ts.map +0 -1
  187. package/dist/cjs/index.js.map +0 -1
  188. package/dist/cjs/tsconfig.cjs.tsbuildinfo +0 -1
  189. package/dist/cjs/utils.d.ts.map +0 -1
  190. package/dist/cjs/utils.js.map +0 -1
  191. package/dist/esm/ai/ApexAI.d.ts.map +0 -1
  192. package/dist/esm/ai/ApexAI.js.map +0 -1
  193. package/dist/esm/ai/ApexModules.d.ts.map +0 -1
  194. package/dist/esm/ai/ApexModules.js.map +0 -1
  195. package/dist/esm/ai/functions/readFiles.d.ts.map +0 -1
  196. package/dist/esm/ai/functions/readFiles.js.map +0 -1
  197. package/dist/esm/ai/functions/tokenizer.d.ts.map +0 -1
  198. package/dist/esm/ai/functions/tokenizer.js.map +0 -1
  199. package/dist/esm/ai/functions/typeWriter.d.ts +0 -2
  200. package/dist/esm/ai/functions/typeWriter.d.ts.map +0 -1
  201. package/dist/esm/ai/functions/typeWriter.js +0 -24
  202. package/dist/esm/ai/functions/typeWriter.js.map +0 -1
  203. package/dist/esm/ai/functions/validOptions.d.ts.map +0 -1
  204. package/dist/esm/ai/functions/validOptions.js.map +0 -1
  205. package/dist/esm/ai/modals/electronHub/chatmodels.d.ts.map +0 -1
  206. package/dist/esm/ai/modals/electronHub/chatmodels.js.map +0 -1
  207. package/dist/esm/ai/modals/electronHub/imageModels.d.ts.map +0 -1
  208. package/dist/esm/ai/modals/electronHub/imageModels.js.map +0 -1
  209. package/dist/esm/ai/modals/electronHub/songModels.d.ts.map +0 -1
  210. package/dist/esm/ai/modals/electronHub/songModels.js.map +0 -1
  211. package/dist/esm/ai/modals/electronHub/speechModels.d.ts.map +0 -1
  212. package/dist/esm/ai/modals/electronHub/speechModels.js.map +0 -1
  213. package/dist/esm/ai/modals/electronHub/videoModels.d.ts.map +0 -1
  214. package/dist/esm/ai/modals/electronHub/videoModels.js.map +0 -1
  215. package/dist/esm/ai/modals/groq/chatgroq.d.ts.map +0 -1
  216. package/dist/esm/ai/modals/groq/chatgroq.js.map +0 -1
  217. package/dist/esm/ai/modals/groq/imageAnalyzer.d.ts.map +0 -1
  218. package/dist/esm/ai/modals/groq/imageAnalyzer.js.map +0 -1
  219. package/dist/esm/ai/modals/groq/whisper.d.ts.map +0 -1
  220. package/dist/esm/ai/modals/groq/whisper.js.map +0 -1
  221. package/dist/esm/ai/modals/hercai/chatModels.d.ts.map +0 -1
  222. package/dist/esm/ai/modals/hercai/chatModels.js.map +0 -1
  223. package/dist/esm/ai/utils.d.ts.map +0 -1
  224. package/dist/esm/ai/utils.js.map +0 -1
  225. package/dist/esm/canvas/ApexPainter.d.ts.map +0 -1
  226. package/dist/esm/canvas/ApexPainter.js.map +0 -1
  227. package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts +0 -11
  228. package/dist/esm/canvas/Themes/Level-Up/levelup.d.ts.map +0 -1
  229. package/dist/esm/canvas/Themes/Level-Up/levelup.js +0 -163
  230. package/dist/esm/canvas/Themes/Level-Up/levelup.js.map +0 -1
  231. package/dist/esm/canvas/utils/Background/bg.d.ts.map +0 -1
  232. package/dist/esm/canvas/utils/Background/bg.js.map +0 -1
  233. package/dist/esm/canvas/utils/Charts/charts.d.ts.map +0 -1
  234. package/dist/esm/canvas/utils/Charts/charts.js.map +0 -1
  235. package/dist/esm/canvas/utils/Custom/customLines.d.ts.map +0 -1
  236. package/dist/esm/canvas/utils/Custom/customLines.js.map +0 -1
  237. package/dist/esm/canvas/utils/General/conversion.d.ts.map +0 -1
  238. package/dist/esm/canvas/utils/General/conversion.js.map +0 -1
  239. package/dist/esm/canvas/utils/General/general functions.d.ts.map +0 -1
  240. package/dist/esm/canvas/utils/General/general functions.js.map +0 -1
  241. package/dist/esm/canvas/utils/Image/imageProperties.d.ts.map +0 -1
  242. package/dist/esm/canvas/utils/Image/imageProperties.js.map +0 -1
  243. package/dist/esm/canvas/utils/Texts/textProperties.d.ts.map +0 -1
  244. package/dist/esm/canvas/utils/Texts/textProperties.js.map +0 -1
  245. package/dist/esm/canvas/utils/types.d.ts.map +0 -1
  246. package/dist/esm/canvas/utils/types.js.map +0 -1
  247. package/dist/esm/canvas/utils/utils.d.ts.map +0 -1
  248. package/dist/esm/canvas/utils/utils.js.map +0 -1
  249. package/dist/esm/index.d.ts.map +0 -1
  250. package/dist/esm/index.js.map +0 -1
  251. package/dist/esm/tsconfig.esm.tsbuildinfo +0 -1
  252. package/dist/esm/utils.d.ts.map +0 -1
  253. package/dist/esm/utils.js.map +0 -1
  254. package/lib/ai/functions/typeWriter.ts +0 -24
  255. package/lib/canvas/Themes/Level-Up/levelup.ts +0 -183
@@ -1,15 +1,7 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.verticalBarChart = verticalBarChart;
7
- exports.pieChart = pieChart;
8
- exports.lineChart = lineChart;
9
- const canvas_1 = require("@napi-rs/canvas");
10
- const path_1 = __importDefault(require("path"));
1
+ import { createCanvas, loadImage } from '@napi-rs/canvas';
2
+ import path from 'path';
11
3
  ////////////////////////////////////////BAR CHARTS////////////////////////////////////////
12
- async function verticalBarChart(data) {
4
+ export async function verticalBarChart(data) {
13
5
  try {
14
6
  const { chartData, xLabels, yLabels, data: { xAxis, yAxis, keys, xTitle, yTitle, labelStyle } } = data;
15
7
  if (!xLabels || !yLabels || !xAxis || !yAxis) {
@@ -41,18 +33,18 @@ async function verticalBarChart(data) {
41
33
  throw new Error("Failed to fetch image.");
42
34
  }
43
35
  const buffer = await response.arrayBuffer();
44
- img = await (0, canvas_1.loadImage)(Buffer.from(buffer));
36
+ img = await loadImage(Buffer.from(buffer));
45
37
  }
46
38
  else {
47
- const imagePath = path_1.default.join(process.cwd(), chartData.bg.image);
48
- img = await (0, canvas_1.loadImage)(imagePath);
39
+ const imagePath = path.join(process.cwd(), chartData.bg.image);
40
+ img = await loadImage(imagePath);
49
41
  }
50
42
  }
51
43
  catch (error) {
52
44
  console.error('Error loading image:', error);
53
45
  }
54
46
  }
55
- const canvas = (0, canvas_1.createCanvas)(800, 600);
47
+ const canvas = createCanvas(800, 600);
56
48
  const ctx = canvas.getContext('2d');
57
49
  if (chartData?.bg?.image) {
58
50
  ctx.drawImage(img, 0, 0, 800, 600);
@@ -256,12 +248,12 @@ function drawKeys(ctx, data, pieConfig) {
256
248
  ctx.fillText(`${key || ''}: ${label || ''}`, (keyX + 95 + (content?.keys?.x || 0)), (content?.keys?.y || 0) + keyY + 70 + index * (fontSize + 10));
257
249
  });
258
250
  }
259
- async function pieChart(pieChartData) {
251
+ export async function pieChart(pieChartData) {
260
252
  const { data = [], pieConfig = {} } = pieChartData;
261
253
  const { canvas = {}, keyBox = {}, pieData = {} } = pieConfig;
262
254
  const { width: canvasWidth = 1200, height: canvasHeight = 400, bgcolor: canvasBgcolor = 'gray' } = canvas || {};
263
255
  const { width: keyBoxWidth = 200, height: keyBoxHeight = 300, radius: keyBoxRadius = 20, bgcolor: keyBoxBgcolor = '#ffffff', x: keyBoxX = 0, y: keyBoxY = 0, content: keyBoxContent } = keyBox || {};
264
- const chartCanvas = (0, canvas_1.createCanvas)(canvasWidth, canvasHeight);
256
+ const chartCanvas = createCanvas(canvasWidth, canvasHeight);
265
257
  const ctx = chartCanvas.getContext('2d');
266
258
  ctx.fillStyle = canvasBgcolor;
267
259
  ctx.fillRect(0, 0, canvasWidth, canvasHeight);
@@ -271,7 +263,7 @@ async function pieChart(pieChartData) {
271
263
  return chartCanvas.toBuffer('image/png');
272
264
  }
273
265
  ////////////////////////////////////////LINE CHARTS////////////////////////////////////////
274
- async function lineChart(data) {
266
+ export async function lineChart(data) {
275
267
  if (!data || !data.data || !Array.isArray(data.data) || data.data.length === 0 || !data.lineConfig) {
276
268
  throw new Error('Invalid data object or missing data properties');
277
269
  }
@@ -305,18 +297,18 @@ async function lineChart(data) {
305
297
  throw new Error("Failed to fetch image.");
306
298
  }
307
299
  const buffer = await response.arrayBuffer();
308
- img = await (0, canvas_1.loadImage)(Buffer.from(buffer));
300
+ img = await loadImage(Buffer.from(buffer));
309
301
  }
310
302
  else {
311
- const imagePath = path_1.default.join(process.cwd(), data.lineConfig.canvas.image);
312
- img = await (0, canvas_1.loadImage)(imagePath);
303
+ const imagePath = path.join(process.cwd(), data.lineConfig.canvas.image);
304
+ img = await loadImage(imagePath);
313
305
  }
314
306
  }
315
307
  catch (error) {
316
308
  console.error('Error loading image:', error);
317
309
  }
318
310
  }
319
- const canvas = (0, canvas_1.createCanvas)(canvasWidth, canvasHeight);
311
+ const canvas = createCanvas(canvasWidth, canvasHeight);
320
312
  const ctx = canvas.getContext('2d');
321
313
  const xAxisLabels = data.data[0].map(point => point.label);
322
314
  const yAxisLabel = data.lineConfig?.yaxisLabel?.label || 'Y Axis';
@@ -461,4 +453,3 @@ async function lineChart(data) {
461
453
  }
462
454
  return canvas.toBuffer('image/png');
463
455
  }
464
- //# sourceMappingURL=charts.js.map
@@ -1,3 +1,2 @@
1
- import { CustomOptions } from "../types";
1
+ import { CustomOptions } from "../types.js";
2
2
  export declare function customLines(ctx: any, options: CustomOptions[]): void;
3
- //# sourceMappingURL=customLines.d.ts.map
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.customLines = customLines;
4
- const imageProperties_1 = require("../Image/imageProperties");
5
- function customLines(ctx, options) {
1
+ import { createGradient } from "../Image/imageProperties.js";
2
+ export function customLines(ctx, options) {
6
3
  let previousEndCoordinates = null;
7
4
  let currentStyle = null;
8
5
  let inSingleLineSequence = false;
@@ -33,7 +30,7 @@ function customLines(ctx, options) {
33
30
  const appliedStyle = inSingleLineSequence ? currentStyle : lineStyle;
34
31
  ctx.lineWidth = appliedStyle?.width || 1;
35
32
  if (appliedStyle?.gradient) {
36
- ctx.strokeStyle = (0, imageProperties_1.createGradient)(ctx, appliedStyle.gradient, start.x, start.y, endCoordinates.x, endCoordinates.y);
33
+ ctx.strokeStyle = createGradient(ctx, appliedStyle.gradient, start.x, start.y, endCoordinates.x, endCoordinates.y);
37
34
  }
38
35
  else {
39
36
  ctx.strokeStyle = appliedStyle?.color || 'black';
@@ -87,7 +84,7 @@ function applyStroke(ctx, style, start, end) {
87
84
  const prevLineWidth = ctx.lineWidth;
88
85
  const prevLineCap = ctx.lineCap;
89
86
  if (gradient) {
90
- ctx.strokeStyle = (0, imageProperties_1.createGradient)(ctx, gradient, start.x, start.y, end.x, end.y);
87
+ ctx.strokeStyle = createGradient(ctx, gradient, start.x, start.y, end.x, end.y);
91
88
  }
92
89
  else {
93
90
  ctx.strokeStyle = color || prevStrokeStyle;
@@ -106,4 +103,3 @@ function applyStroke(ctx, style, start, end) {
106
103
  ctx.lineCap = prevLineCap;
107
104
  }
108
105
  }
109
- //# sourceMappingURL=customLines.js.map
@@ -3,4 +3,3 @@ export declare function dataURL(buffer: any): string;
3
3
  export declare function blob(buffer: any): Blob;
4
4
  export declare function base64(buffer: any): string;
5
5
  export declare function arrayBuffer(buffer: any): ArrayBuffer;
6
- //# sourceMappingURL=conversion.d.ts.map
@@ -1,13 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.url = url;
4
- exports.dataURL = dataURL;
5
- exports.blob = blob;
6
- exports.base64 = base64;
7
- exports.arrayBuffer = arrayBuffer;
8
- const imgur_1 = require("imgur");
9
- async function url(buffer) {
10
- const client = new imgur_1.ImgurClient({
1
+ import { ImgurClient } from "imgur";
2
+ export async function url(buffer) {
3
+ const client = new ImgurClient({
11
4
  clientId: "cd66e7c46e15b4e",
12
5
  clientSecret: "14a6adf67597a7b2db5e535a09c24843470fc70b",
13
6
  accessToken: "ad06eacb7c7228d8f482d2db20f490d649f58e52",
@@ -19,16 +12,15 @@ async function url(buffer) {
19
12
  });
20
13
  return response.data.link;
21
14
  }
22
- function dataURL(buffer) {
15
+ export function dataURL(buffer) {
23
16
  return `data:image/png;base64,${Buffer.from(buffer).toString('base64')}`;
24
17
  }
25
- function blob(buffer) {
18
+ export function blob(buffer) {
26
19
  return new Blob([buffer], { type: 'image/png' });
27
20
  }
28
- function base64(buffer) {
21
+ export function base64(buffer) {
29
22
  return Buffer.from(buffer).toString('base64');
30
23
  }
31
- function arrayBuffer(buffer) {
24
+ export function arrayBuffer(buffer) {
32
25
  return buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength);
33
26
  }
34
- //# sourceMappingURL=conversion.js.map
@@ -1,5 +1,5 @@
1
1
  import sharp from 'sharp';
2
- import { cropOptions, ResizeOptions } from '../types';
2
+ import { cropOptions, ResizeOptions } from '../types.js';
3
3
  export declare function loadImages(imagePath: string): Promise<sharp.Sharp>;
4
4
  /**
5
5
  * Resizes an image using Sharp with additional options for quality, kernel, and withoutEnlargement.
@@ -36,4 +36,3 @@ export declare function removeColor(inputImagePath: string, colorToRemove: {
36
36
  blue: number;
37
37
  }): Promise<Buffer | undefined>;
38
38
  export declare function bgRemoval(imgURL: string, API_KEY: string): Promise<Buffer | undefined>;
39
- //# sourceMappingURL=general%20functions.d.ts.map
@@ -1,24 +1,9 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.loadImages = loadImages;
7
- exports.resizingImg = resizingImg;
8
- exports.converter = converter;
9
- exports.applyColorFilters = applyColorFilters;
10
- exports.imgEffects = imgEffects;
11
- exports.cropInner = cropInner;
12
- exports.cropOuter = cropOuter;
13
- exports.detectColors = detectColors;
14
- exports.removeColor = removeColor;
15
- exports.bgRemoval = bgRemoval;
16
- const path_1 = __importDefault(require("path"));
17
- const sharp_1 = __importDefault(require("sharp"));
18
- const canvas_1 = require("@napi-rs/canvas");
19
- const fs_1 = __importDefault(require("fs"));
20
- const axios_1 = __importDefault(require("axios"));
21
- async function loadImages(imagePath) {
1
+ import path from 'path';
2
+ import sharp from 'sharp';
3
+ import { createCanvas, loadImage } from '@napi-rs/canvas';
4
+ import fs from "fs";
5
+ import axios from "axios";
6
+ export async function loadImages(imagePath) {
22
7
  try {
23
8
  if (!imagePath) {
24
9
  throw new Error("Image path is required.");
@@ -29,11 +14,11 @@ async function loadImages(imagePath) {
29
14
  throw new Error("Failed to fetch image.");
30
15
  }
31
16
  const buffer = await response.arrayBuffer();
32
- return (0, sharp_1.default)(buffer);
17
+ return sharp(buffer);
33
18
  }
34
19
  else {
35
- const absolutePath = path_1.default.join(process.cwd(), imagePath);
36
- return (0, sharp_1.default)(absolutePath);
20
+ const absolutePath = path.join(process.cwd(), imagePath);
21
+ return sharp(absolutePath);
37
22
  }
38
23
  }
39
24
  catch (error) {
@@ -46,7 +31,7 @@ async function loadImages(imagePath) {
46
31
  * @param resizeOptions - The options for resizing.
47
32
  * @returns A Promise that resolves with the resized image as a Buffer.
48
33
  */
49
- async function resizingImg(resizeOptions) {
34
+ export async function resizingImg(resizeOptions) {
50
35
  try {
51
36
  if (!resizeOptions.imagePath) {
52
37
  throw new Error("Image path is required for resizing.");
@@ -56,8 +41,8 @@ async function resizingImg(resizeOptions) {
56
41
  const resizeOptionsForSharp = {
57
42
  width: resizeOptions.size?.width || 500,
58
43
  height: resizeOptions.size?.height || 500,
59
- fit: resizeOptions.maintainAspectRatio ? sharp_1.default.fit.inside : sharp_1.default.fit.fill,
60
- kernel: sharp_1.default.kernel.lanczos3,
44
+ fit: resizeOptions.maintainAspectRatio ? sharp.fit.inside : sharp.fit.fill,
45
+ kernel: sharp.kernel.lanczos3,
61
46
  withoutEnlargement: true,
62
47
  };
63
48
  const quality = resizeOptions.quality ?? 90;
@@ -72,7 +57,7 @@ async function resizingImg(resizeOptions) {
72
57
  throw new Error("Failed to resize image");
73
58
  }
74
59
  }
75
- async function converter(imagePath, newExtension) {
60
+ export async function converter(imagePath, newExtension) {
76
61
  try {
77
62
  const validExtensions = ['jpeg', 'png', 'webp', 'tiff', 'gif', 'avif', 'heif', 'raw', 'pdf', 'svg'];
78
63
  const newExt = newExtension.toLowerCase();
@@ -86,14 +71,14 @@ async function converter(imagePath, newExtension) {
86
71
  throw new Error("Failed to fetch image.");
87
72
  }
88
73
  const buffer = await response.arrayBuffer();
89
- image = (0, sharp_1.default)(Buffer.from(buffer));
74
+ image = sharp(Buffer.from(buffer));
90
75
  }
91
76
  else {
92
77
  if (!imagePath) {
93
78
  throw new Error("Image path is required.");
94
79
  }
95
- const absolutePath = path_1.default.join(process.cwd(), imagePath);
96
- image = (0, sharp_1.default)(absolutePath);
80
+ const absolutePath = path.join(process.cwd(), imagePath);
81
+ image = sharp(absolutePath);
97
82
  }
98
83
  const convertedBuffer = await image.toFormat(newExt).toBuffer();
99
84
  return convertedBuffer;
@@ -103,16 +88,16 @@ async function converter(imagePath, newExtension) {
103
88
  throw new Error("Failed to change image extension");
104
89
  }
105
90
  }
106
- async function applyColorFilters(imagePath, gradientOptions, opacity = 1) {
91
+ export async function applyColorFilters(imagePath, gradientOptions, opacity = 1) {
107
92
  try {
108
93
  let image;
109
94
  if (imagePath.startsWith("http")) {
110
95
  const pngBuffer = await converter(imagePath, "png");
111
- image = (0, sharp_1.default)(pngBuffer);
96
+ image = sharp(pngBuffer);
112
97
  }
113
98
  else {
114
- const imagePathResolved = path_1.default.join(process.cwd(), imagePath);
115
- image = await (0, sharp_1.default)(imagePathResolved);
99
+ const imagePathResolved = path.join(process.cwd(), imagePath);
100
+ image = await sharp(imagePathResolved);
116
101
  }
117
102
  const metadata = await image.metadata();
118
103
  let gradientImage;
@@ -133,7 +118,7 @@ async function applyColorFilters(imagePath, gradientOptions, opacity = 1) {
133
118
  }
134
119
  }
135
120
  function createSolidColorImage(width, height, color, opacity) {
136
- const solidColorCanvas = (0, canvas_1.createCanvas)(width, height);
121
+ const solidColorCanvas = createCanvas(width, height);
137
122
  const ctx = solidColorCanvas.getContext('2d');
138
123
  ctx.globalAlpha = opacity;
139
124
  ctx.fillStyle = color;
@@ -142,7 +127,7 @@ function createSolidColorImage(width, height, color, opacity) {
142
127
  }
143
128
  function createGradientImage(width, height, options, opacity) {
144
129
  const { type, colors } = options;
145
- const gradientCanvas = (0, canvas_1.createCanvas)(width, height);
130
+ const gradientCanvas = createCanvas(width, height);
146
131
  const ctx = gradientCanvas.getContext('2d');
147
132
  if (type === 'linear') {
148
133
  const gradient = ctx.createLinearGradient(options.startX || 0, options.startY || 0, options.endX || width, options.endY || height);
@@ -162,18 +147,18 @@ function createGradientImage(width, height, options, opacity) {
162
147
  ctx.fillRect(0, 0, width, height);
163
148
  return gradientCanvas.toBuffer('image/png');
164
149
  }
165
- async function imgEffects(imagePath, filters) {
150
+ export async function imgEffects(imagePath, filters) {
166
151
  try {
167
152
  let image;
168
153
  if (imagePath.startsWith("http")) {
169
- const response = await axios_1.default.get(imagePath, { responseType: "arraybuffer" });
170
- image = await (0, canvas_1.loadImage)(response.data);
154
+ const response = await axios.get(imagePath, { responseType: "arraybuffer" });
155
+ image = await loadImage(response.data);
171
156
  }
172
157
  else {
173
- const imagePathResolved = path_1.default.resolve(process.cwd(), imagePath);
174
- image = await (0, canvas_1.loadImage)(fs_1.default.readFileSync(imagePathResolved));
158
+ const imagePathResolved = path.resolve(process.cwd(), imagePath);
159
+ image = await loadImage(fs.readFileSync(imagePathResolved));
175
160
  }
176
- const canvas = (0, canvas_1.createCanvas)(image.width, image.height);
161
+ const canvas = createCanvas(image.width, image.height);
177
162
  const ctx = canvas.getContext("2d");
178
163
  ctx.drawImage(image, 0, 0);
179
164
  for (const filter of filters) {
@@ -223,15 +208,15 @@ async function imgEffects(imagePath, filters) {
223
208
  * Crops the inner portion of the image based on the bounding box of the provided coordinates.
224
209
  * Optionally applies a clipping mask with a specified radius.
225
210
  */
226
- async function cropInner(options) {
211
+ export async function cropInner(options) {
227
212
  try {
228
213
  // Load the image (from HTTP or local path)
229
214
  let image;
230
215
  if (options.imageSource.startsWith("http")) {
231
- image = await (0, canvas_1.loadImage)(options.imageSource);
216
+ image = await loadImage(options.imageSource);
232
217
  }
233
218
  else {
234
- image = await (0, canvas_1.loadImage)(path_1.default.join(process.cwd(), options.imageSource));
219
+ image = await loadImage(path.join(process.cwd(), options.imageSource));
235
220
  }
236
221
  // Compute the bounding box from all coordinate points.
237
222
  const xs = [];
@@ -247,7 +232,7 @@ async function cropInner(options) {
247
232
  const cropWidth = maxX - minX;
248
233
  const cropHeight = maxY - minY;
249
234
  // Create a canvas with the crop dimensions.
250
- const canvas = (0, canvas_1.createCanvas)(cropWidth, cropHeight);
235
+ const canvas = createCanvas(cropWidth, cropHeight);
251
236
  const ctx = canvas.getContext('2d');
252
237
  if (!ctx)
253
238
  throw new Error("Unable to get 2D context");
@@ -292,17 +277,17 @@ async function cropInner(options) {
292
277
  * Crops the outer portion of the image by removing the area defined by the provided polygon.
293
278
  * The polygon is defined by the coordinates (with optional bezier smoothing using tension).
294
279
  */
295
- async function cropOuter(options) {
280
+ export async function cropOuter(options) {
296
281
  try {
297
282
  let image;
298
283
  if (options.imageSource.startsWith("http")) {
299
- image = await (0, canvas_1.loadImage)(options.imageSource);
284
+ image = await loadImage(options.imageSource);
300
285
  }
301
286
  else {
302
- image = await (0, canvas_1.loadImage)(path_1.default.join(process.cwd(), options.imageSource));
287
+ image = await loadImage(path.join(process.cwd(), options.imageSource));
303
288
  }
304
289
  // Create a canvas matching the full image dimensions.
305
- const canvas = (0, canvas_1.createCanvas)(image.width, image.height);
290
+ const canvas = createCanvas(image.width, image.height);
306
291
  const ctx = canvas.getContext('2d');
307
292
  if (!ctx)
308
293
  throw new Error("Unable to get 2D context");
@@ -340,7 +325,7 @@ async function cropOuter(options) {
340
325
  * @param imagePath - Local path or URL of the image.
341
326
  * @returns A sorted array of dominant colors with their frequency.
342
327
  */
343
- async function detectColors(imagePath) {
328
+ export async function detectColors(imagePath) {
344
329
  try {
345
330
  let image;
346
331
  if (imagePath.startsWith('http')) {
@@ -348,13 +333,13 @@ async function detectColors(imagePath) {
348
333
  if (!response.ok)
349
334
  throw new Error(`Failed to fetch image: ${response.statusText}`);
350
335
  const buffer = await response.arrayBuffer();
351
- image = await (0, canvas_1.loadImage)(Buffer.from(buffer));
336
+ image = await loadImage(Buffer.from(buffer));
352
337
  }
353
338
  else {
354
- const localImagePath = path_1.default.resolve(imagePath);
355
- image = await (0, canvas_1.loadImage)(localImagePath);
339
+ const localImagePath = path.resolve(imagePath);
340
+ image = await loadImage(localImagePath);
356
341
  }
357
- const canvas = (0, canvas_1.createCanvas)(image.width, image.height);
342
+ const canvas = createCanvas(image.width, image.height);
358
343
  const ctx = canvas.getContext('2d');
359
344
  ctx.drawImage(image, 0, 0, image.width, image.height);
360
345
  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
@@ -382,7 +367,7 @@ async function detectColors(imagePath) {
382
367
  return [];
383
368
  }
384
369
  }
385
- async function removeColor(inputImagePath, colorToRemove) {
370
+ export async function removeColor(inputImagePath, colorToRemove) {
386
371
  try {
387
372
  let image;
388
373
  if (inputImagePath.startsWith('http')) {
@@ -391,13 +376,13 @@ async function removeColor(inputImagePath, colorToRemove) {
391
376
  throw new Error("Failed to fetch image.");
392
377
  }
393
378
  const buffer = await response.arrayBuffer();
394
- image = await (0, canvas_1.loadImage)(Buffer.from(buffer));
379
+ image = await loadImage(Buffer.from(buffer));
395
380
  }
396
381
  else {
397
- const localImagePath = path_1.default.join(process.cwd(), inputImagePath);
398
- image = await (0, canvas_1.loadImage)(localImagePath);
382
+ const localImagePath = path.join(process.cwd(), inputImagePath);
383
+ image = await loadImage(localImagePath);
399
384
  }
400
- const canvas = (0, canvas_1.createCanvas)(image.width, image.height);
385
+ const canvas = createCanvas(image.width, image.height);
401
386
  const ctx = canvas.getContext('2d');
402
387
  ctx.drawImage(image, 0, 0, image.width, image.height);
403
388
  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
@@ -418,7 +403,7 @@ async function removeColor(inputImagePath, colorToRemove) {
418
403
  return undefined;
419
404
  }
420
405
  }
421
- async function bgRemoval(imgURL, API_KEY) {
406
+ export async function bgRemoval(imgURL, API_KEY) {
422
407
  try {
423
408
  if (!API_KEY) {
424
409
  throw new Error("API_KEY is required. Please visit remove.bg, create an account, and obtain your API key at: https://accounts.kaleido.ai/users/sign_in#api-key");
@@ -465,7 +450,7 @@ function flipCanvas(ctx, width, height, horizontal = false, vertical = false) {
465
450
  }
466
451
  function rotateCanvas(ctx, canvas, degrees) {
467
452
  const radians = (degrees * Math.PI) / 180;
468
- const newCanvas = (0, canvas_1.createCanvas)(canvas.width, canvas.height);
453
+ const newCanvas = createCanvas(canvas.width, canvas.height);
469
454
  const newCtx = newCanvas.getContext("2d");
470
455
  newCtx.translate(canvas.width / 2, canvas.height / 2);
471
456
  newCtx.rotate(radians);
@@ -603,4 +588,3 @@ function pixelate(ctx, size, startX = 0, startY = 0, width = ctx.canvas.width, h
603
588
  }
604
589
  ctx.putImageData(imageData, startX, startY);
605
590
  }
606
- //# sourceMappingURL=general%20functions.js.map
@@ -1,5 +1,5 @@
1
1
  import { Image, SKRSContext2D } from "@napi-rs/canvas";
2
- import { ImageProperties } from "../utils";
2
+ import { ImageProperties } from "../utils.js";
3
3
  /**
4
4
  * Applies shadow to the canvas context.
5
5
  * @param ctx The canvas rendering context.
@@ -112,4 +112,3 @@ export declare function applyPerspective(ctx: SKRSContext2D, image: Image, x: nu
112
112
  y: number;
113
113
  };
114
114
  }, gridCols?: number, gridRows?: number): Promise<void>;
115
- //# sourceMappingURL=imageProperties.d.ts.map
@@ -1,14 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyShadow = applyShadow;
4
- exports.applyZoom = applyZoom;
5
- exports.applyStroke = applyStroke;
6
- exports.drawShape = drawShape;
7
- exports.createGradient = createGradient;
8
- exports.applyRotation = applyRotation;
9
- exports.imageRadius = imageRadius;
10
- exports.objectRadius = objectRadius;
11
- exports.applyPerspective = applyPerspective;
12
1
  /**
13
2
  * Applies shadow to the canvas context.
14
3
  * @param ctx The canvas rendering context.
@@ -18,7 +7,7 @@ exports.applyPerspective = applyPerspective;
18
7
  * @param width The width of the shape.
19
8
  * @param height The height of the shape.
20
9
  */
21
- function applyShadow(ctx, shadow, x, y, width, height) {
10
+ export function applyShadow(ctx, shadow, x, y, width, height) {
22
11
  ctx.save();
23
12
  if (shadow) {
24
13
  ctx.globalAlpha = shadow.opacity ?? 1;
@@ -40,7 +29,7 @@ function applyShadow(ctx, shadow, x, y, width, height) {
40
29
  * @param ctx The canvas rendering context.
41
30
  * @param zoom An object with scale (zoom factor) and the x/y coordinates that act as the zoom origin.
42
31
  */
43
- function applyZoom(ctx, zoom) {
32
+ export function applyZoom(ctx, zoom) {
44
33
  if (!zoom)
45
34
  return;
46
35
  const scale = zoom.scale ?? 1;
@@ -62,7 +51,7 @@ function applyZoom(ctx, zoom) {
62
51
  * @param height The height of the shape.
63
52
  * @param blur Optional blur effect on the stroke.
64
53
  */
65
- function applyStroke(ctx, stroke, x, y, width, height, shapeName) {
54
+ export function applyStroke(ctx, stroke, x, y, width, height, shapeName) {
66
55
  if (!stroke)
67
56
  return;
68
57
  ctx.save();
@@ -146,7 +135,7 @@ function applyStroke(ctx, stroke, x, y, width, height, shapeName) {
146
135
  ctx.filter = "none";
147
136
  ctx.restore();
148
137
  }
149
- function drawShape(ctx, shapeSettings) {
138
+ export function drawShape(ctx, shapeSettings) {
150
139
  const { source, x, y, width, height, opacity, rotation = 0, borderRadius = 0, borderPosition = 'all', stroke, shadow, isFilled = false, color = "transparent", gradient, filling, } = shapeSettings;
151
140
  const shapeName = source.toLowerCase();
152
141
  ctx.save();
@@ -334,7 +323,7 @@ function drawStar(ctx, x, y, width, height) {
334
323
  }
335
324
  ctx.closePath();
336
325
  }
337
- function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
326
+ export function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
338
327
  if (!gradientOptions || !gradientOptions.type || !gradientOptions.colors) {
339
328
  throw new Error("Invalid gradient options. Provide a valid object with type and colors properties.");
340
329
  }
@@ -402,7 +391,7 @@ function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
402
391
  * @param width The width of the shape.
403
392
  * @param height The height of the shape.
404
393
  */
405
- function applyRotation(ctx, rotation, x, y, width, height) {
394
+ export function applyRotation(ctx, rotation, x, y, width, height) {
406
395
  const rotationX = x + width / 2;
407
396
  const rotationY = y + height / 2;
408
397
  ctx.translate(rotationX, rotationY);
@@ -426,7 +415,7 @@ function applyRotation(ctx, rotation, x, y, width, height) {
426
415
  * - "top-left", "top-right", "bottom-left", "bottom-right"
427
416
  * - Or a comma‑separated list (e.g., "top, left, bottom")
428
417
  */
429
- function imageRadius(ctx, image, x, y, width, height, borderRadius, borderPosition = "all") {
418
+ export function imageRadius(ctx, image, x, y, width, height, borderRadius, borderPosition = "all") {
430
419
  ctx.save();
431
420
  ctx.beginPath();
432
421
  if (borderRadius === "circular") {
@@ -483,7 +472,7 @@ function imageRadius(ctx, image, x, y, width, height, borderRadius, borderPositi
483
472
  * - "top-left", "top-right", "bottom-left", "bottom-right"
484
473
  * - Or a comma-separated list, e.g. "top-left, bottom-right" or "top, left, bottom"
485
474
  */
486
- function objectRadius(ctx, x, y, width, height, borderRadius = 0.1, borderPosition = "all") {
475
+ export function objectRadius(ctx, x, y, width, height, borderRadius = 0.1, borderPosition = "all") {
487
476
  ctx.beginPath();
488
477
  if (borderRadius === "circular") {
489
478
  // Draw a circular shape
@@ -572,7 +561,7 @@ function bilinearInterpolate(corners, t, u) {
572
561
  * @param gridCols Number of columns to subdivide (default: 10).
573
562
  * @param gridRows Number of rows to subdivide (default: 10).
574
563
  */
575
- async function applyPerspective(ctx, image, x, y, width, height, perspective, gridCols = 10, gridRows = 10) {
564
+ export async function applyPerspective(ctx, image, x, y, width, height, perspective, gridCols = 10, gridRows = 10) {
576
565
  const cellWidth = width / gridCols;
577
566
  const cellHeight = height / gridRows;
578
567
  for (let row = 0; row < gridRows; row++) {
@@ -599,4 +588,3 @@ async function applyPerspective(ctx, image, x, y, width, height, perspective, gr
599
588
  }
600
589
  }
601
590
  }
602
- //# sourceMappingURL=imageProperties.js.map
@@ -1,5 +1,5 @@
1
1
  import { SKRSContext2D } from '@napi-rs/canvas';
2
- import { TextObject } from '../types';
2
+ import { TextObject } from '../types.js';
3
3
  /**
4
4
  * The main function that draws text with optional wrapping.
5
5
  * @param ctx CanvasRenderingContext2D
@@ -14,4 +14,3 @@ export declare function WrappedText(ctx: SKRSContext2D, text: string, startX: nu
14
14
  * Creates a linear or radial gradient for fill/stroke.
15
15
  */
16
16
  export declare function createGradient(ctx: SKRSContext2D, gradientOptions: any, startX: number, startY: number, endX: number, endY: number): CanvasGradient;
17
- //# sourceMappingURL=textProperties.d.ts.map
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.drawText = drawText;
4
- exports.WrappedText = WrappedText;
5
- exports.createGradient = createGradient;
6
1
  /**
7
2
  * The main function that draws text with optional wrapping.
8
3
  * @param ctx CanvasRenderingContext2D
9
4
  * @param textOptions TextObject
10
5
  */
11
- function drawText(ctx, textOptions) {
6
+ export function drawText(ctx, textOptions) {
12
7
  ctx.save();
13
8
  // 1) Apply rotation if any
14
9
  if (textOptions.rotation && textOptions.rotation !== 0) {
@@ -52,7 +47,7 @@ function drawText(ctx, textOptions) {
52
47
  /**
53
48
  * Handles word-based wrapping. Then draws each line with stroke, fill, gradient, etc.
54
49
  */
55
- function WrappedText(ctx, text, startX, startY, maxWidth, options) {
50
+ export function WrappedText(ctx, text, startX, startY, maxWidth, options) {
56
51
  const fontSize = options.fontSize || 16;
57
52
  const lineHeight = options.lineHeight || fontSize * 1.4;
58
53
  const maxHeight = options.maxHeight;
@@ -138,7 +133,7 @@ function drawStrokeAndFill(ctx, text, x, y, options) {
138
133
  /**
139
134
  * Creates a linear or radial gradient for fill/stroke.
140
135
  */
141
- function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
136
+ export function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
142
137
  if (!gradientOptions || !gradientOptions.type || !gradientOptions.colors) {
143
138
  throw new Error("Invalid gradient options. Provide a valid object with type and colors properties.");
144
139
  }
@@ -157,4 +152,3 @@ function createGradient(ctx, gradientOptions, startX, startY, endX, endY) {
157
152
  }
158
153
  return gradient;
159
154
  }
160
- //# sourceMappingURL=textProperties.js.map
@@ -619,4 +619,3 @@ export interface BlendOptions {
619
619
  maskSource?: string | Buffer | PathLike | Uint8Array;
620
620
  }
621
621
  export {};
622
- //# sourceMappingURL=types.d.ts.map
@@ -1,7 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
1
  ;
4
2
  ;
5
3
  ;
6
4
  ;
7
- //# sourceMappingURL=types.js.map
5
+ export {};