@igxjs/text2png 3.0.2 → 3.0.3

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 (3) hide show
  1. package/index.js +2 -0
  2. package/package.json +2 -1
  3. package/types.d.ts +82 -0
package/index.js CHANGED
@@ -198,3 +198,5 @@ function orOr() {
198
198
  }
199
199
 
200
200
  module.exports = text2png;
201
+
202
+ module.exports.text2png = text2png;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igxjs/text2png",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Convert text to png for node.js",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -32,6 +32,7 @@
32
32
  "bin",
33
33
  "README.md",
34
34
  "index.js",
35
+ "types.d.ts",
35
36
  "package.json",
36
37
  "LICENSE"
37
38
  ],
package/types.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ import { Readable } from 'node:stream';
2
+ import { Canvas } from 'canvas';
3
+
4
+ export interface Text2PngOptions {
5
+ /** CSS style font (default: "30px sans-serif") */
6
+ font?: string;
7
+
8
+ /** Text alignment (default: "left") */
9
+ textAlign?: "left" | "center" | "right" | "start" | "end";
10
+
11
+ /** Text color (default: "black") */
12
+ color?: string;
13
+
14
+ /** Text color (alias for color, default: "black") */
15
+ textColor?: string;
16
+
17
+ /** Background color */
18
+ backgroundColor?: string;
19
+
20
+ /** Background color (alias for backgroundColor) */
21
+ bgColor?: string;
22
+
23
+ /** Line spacing (default: 0) */
24
+ lineSpacing?: number;
25
+
26
+ /** Stroke width (default: 0) */
27
+ strokeWidth?: number;
28
+
29
+ /** Stroke color (default: "white") */
30
+ strokeColor?: string;
31
+
32
+ /** Padding for all sides (default: 0) */
33
+ padding?: number;
34
+
35
+ /** Left padding */
36
+ paddingLeft?: number;
37
+
38
+ /** Top padding */
39
+ paddingTop?: number;
40
+
41
+ /** Right padding */
42
+ paddingRight?: number;
43
+
44
+ /** Bottom padding */
45
+ paddingBottom?: number;
46
+
47
+ /** Border width for all sides (default: 0) */
48
+ borderWidth?: number;
49
+
50
+ /** Left border width (default: 0) */
51
+ borderLeftWidth?: number;
52
+
53
+ /** Top border width (default: 0) */
54
+ borderTopWidth?: number;
55
+
56
+ /** Right border width (default: 0) */
57
+ borderRightWidth?: number;
58
+
59
+ /** Bottom border width (default: 0) */
60
+ borderBottomWidth?: number;
61
+
62
+ /** Border color (default: "black") */
63
+ borderColor?: string;
64
+
65
+ /** Path to local font file (e.g., fonts/Lobster-Regular.ttf) */
66
+ localFontPath?: string;
67
+
68
+ /** Name of local font (e.g., Lobster) */
69
+ localFontName?: string;
70
+
71
+ /** Output type (default: "buffer") */
72
+ output?: "buffer" | "stream" | "dataURL" | "canvas";
73
+
74
+ /** Enable or disable image smoothing (default: false) */
75
+ imageSmoothingEnabled?: boolean;
76
+ }
77
+
78
+ declare function text2png(text: string, options?: Text2PngOptions): string | Buffer | Readable | Canvas;
79
+
80
+ export default text2png;
81
+
82
+ export { text2png };