@avatar-generator/core 1.1.1 → 2.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/dist/index.js +55 -3
- package/dist/random.js +63 -0
- package/dist/svg.js +125 -0
- package/dist/types/index.d.ts +36 -13
- package/dist/types/random.d.ts +6 -0
- package/dist/types/svg.d.ts +41 -0
- package/dist/types/types.d.ts +104 -0
- package/dist/types.js +1 -0
- package/package.json +10 -2
- package/src/index.ts +77 -17
- package/src/random.ts +75 -0
- package/src/svg.ts +170 -0
- package/src/types.ts +112 -0
- package/tsconfig.json +7 -4
- package/tsconfig.tsbuildinfo +1 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
// Re-export utilities
|
|
2
|
+
export { createRandom } from "./random";
|
|
3
|
+
export { buildSvg, buildTransform, createBackground, createBorder, createCircleClip, createSquareClip, createSvgOpen, DEFAULT_COLORS, escapeXml, wrapWithTransform } from "./svg";
|
|
4
|
+
/**
|
|
5
|
+
* Creates an avatar using the specified style
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
10
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
11
|
+
*
|
|
12
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
13
|
+
* // Use avatar.svg for the SVG string
|
|
14
|
+
* // Use avatar.toDataUri() for img src
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export function createAvatar(style, options) {
|
|
18
|
+
// Apply defaults
|
|
19
|
+
const opts = {
|
|
20
|
+
size: 64,
|
|
21
|
+
square: false,
|
|
22
|
+
transparent: false,
|
|
23
|
+
rotate: 0,
|
|
24
|
+
flip: false,
|
|
25
|
+
scale: 1,
|
|
26
|
+
...options,
|
|
27
|
+
};
|
|
28
|
+
return style.create(opts);
|
|
29
|
+
}
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// Legacy v1 API (deprecated, for backwards compatibility)
|
|
32
|
+
// ============================================================================
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use createAvatar with a Style instead
|
|
35
|
+
*/
|
|
36
|
+
function getInitials(name) {
|
|
2
37
|
if (!name.trim())
|
|
3
38
|
return "?";
|
|
4
39
|
return name
|
|
@@ -7,8 +42,25 @@ const getInitials = (name) => {
|
|
|
7
42
|
.slice(0, 2)
|
|
8
43
|
.map((part) => part[0].toUpperCase())
|
|
9
44
|
.join("");
|
|
10
|
-
}
|
|
11
|
-
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates an avatar as an HTML element (legacy v1 API)
|
|
48
|
+
*
|
|
49
|
+
* @deprecated Use createAvatar with a Style instead for SVG output
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* // Legacy usage (deprecated)
|
|
54
|
+
* import { createAvatarElement } from '@avatar-generator/core';
|
|
55
|
+
* const element = createAvatarElement({ name: 'John Doe' });
|
|
56
|
+
*
|
|
57
|
+
* // New usage (recommended)
|
|
58
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
59
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
60
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function createAvatarElement({ name, backgroundColor = "#ccc", gradientDirection = "vertical", textColor = "#fff", fontSize = "40px", shape = "circle", width = "100px", height = "100px", tooltip = false, additionalClasses = "", }) {
|
|
12
64
|
const initials = getInitials(name);
|
|
13
65
|
const avatar = document.createElement("div");
|
|
14
66
|
avatar.style.width = width;
|
package/dist/random.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a hash from a string seed using a simple but effective algorithm
|
|
3
|
+
* Based on cyrb53 hash function
|
|
4
|
+
*/
|
|
5
|
+
function hashSeed(seed) {
|
|
6
|
+
let h1 = 0xdeadbeef;
|
|
7
|
+
let h2 = 0x41c6ce57;
|
|
8
|
+
for (let i = 0; i < seed.length; i++) {
|
|
9
|
+
const ch = seed.charCodeAt(i);
|
|
10
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
11
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
12
|
+
}
|
|
13
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
14
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
15
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
16
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
17
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Mulberry32 PRNG - fast, simple, and good quality
|
|
21
|
+
* Returns a function that generates the next random number
|
|
22
|
+
*/
|
|
23
|
+
function mulberry32(seed) {
|
|
24
|
+
return function () {
|
|
25
|
+
let t = (seed += 0x6d2b79f5);
|
|
26
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
27
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
28
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a deterministic random number generator from a string seed
|
|
33
|
+
* Same seed always produces the same sequence of numbers
|
|
34
|
+
*/
|
|
35
|
+
export function createRandom(seed) {
|
|
36
|
+
const numericSeed = hashSeed(seed);
|
|
37
|
+
const rng = mulberry32(numericSeed);
|
|
38
|
+
return {
|
|
39
|
+
next() {
|
|
40
|
+
return rng();
|
|
41
|
+
},
|
|
42
|
+
int(min, max) {
|
|
43
|
+
return Math.floor(rng() * (max - min)) + min;
|
|
44
|
+
},
|
|
45
|
+
pick(array) {
|
|
46
|
+
if (array.length === 0) {
|
|
47
|
+
throw new Error("Cannot pick from empty array");
|
|
48
|
+
}
|
|
49
|
+
return array[Math.floor(rng() * array.length)];
|
|
50
|
+
},
|
|
51
|
+
bool(probability = 0.5) {
|
|
52
|
+
return rng() < probability;
|
|
53
|
+
},
|
|
54
|
+
shuffle(array) {
|
|
55
|
+
// Fisher-Yates shuffle
|
|
56
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
57
|
+
const j = Math.floor(rng() * (i + 1));
|
|
58
|
+
[array[i], array[j]] = [array[j], array[i]];
|
|
59
|
+
}
|
|
60
|
+
return array;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
package/dist/svg.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default color palettes for avatar generation
|
|
3
|
+
*/
|
|
4
|
+
export const DEFAULT_COLORS = [
|
|
5
|
+
"#FF6B6B", // Red
|
|
6
|
+
"#4ECDC4", // Teal
|
|
7
|
+
"#45B7D1", // Sky blue
|
|
8
|
+
"#96CEB4", // Sage
|
|
9
|
+
"#FFEAA7", // Yellow
|
|
10
|
+
"#DDA0DD", // Plum
|
|
11
|
+
"#98D8C8", // Mint
|
|
12
|
+
"#F7DC6F", // Gold
|
|
13
|
+
"#BB8FCE", // Purple
|
|
14
|
+
"#85C1E9", // Light blue
|
|
15
|
+
];
|
|
16
|
+
/**
|
|
17
|
+
* Escapes special characters for use in SVG text content
|
|
18
|
+
*/
|
|
19
|
+
export function escapeXml(text) {
|
|
20
|
+
return text
|
|
21
|
+
.replace(/&/g, "&")
|
|
22
|
+
.replace(/</g, "<")
|
|
23
|
+
.replace(/>/g, ">")
|
|
24
|
+
.replace(/"/g, """)
|
|
25
|
+
.replace(/'/g, "'");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates the opening SVG tag with common attributes
|
|
29
|
+
*/
|
|
30
|
+
export function createSvgOpen(size) {
|
|
31
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" width="${size}" height="${size}">`;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a circle clip path for rounded avatars
|
|
35
|
+
*/
|
|
36
|
+
export function createCircleClip(id, size) {
|
|
37
|
+
const r = size / 2;
|
|
38
|
+
return `<clipPath id="${id}"><circle cx="${r}" cy="${r}" r="${r}"/></clipPath>`;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Creates a square clip path
|
|
42
|
+
*/
|
|
43
|
+
export function createSquareClip(id, size) {
|
|
44
|
+
return `<clipPath id="${id}"><rect x="0" y="0" width="${size}" height="${size}"/></clipPath>`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Creates a background rectangle
|
|
48
|
+
*/
|
|
49
|
+
export function createBackground(size, color, transparent = false) {
|
|
50
|
+
if (transparent) {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
return `<rect x="0" y="0" width="${size}" height="${size}" fill="${color}"/>`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates a border circle or rect
|
|
57
|
+
*/
|
|
58
|
+
export function createBorder(size, width, color, square) {
|
|
59
|
+
if (square) {
|
|
60
|
+
const offset = width / 2;
|
|
61
|
+
return `<rect x="${offset}" y="${offset}" width="${size - width}" height="${size - width}" fill="none" stroke="${color}" stroke-width="${width}"/>`;
|
|
62
|
+
}
|
|
63
|
+
const r = size / 2 - width / 2;
|
|
64
|
+
return `<circle cx="${size / 2}" cy="${size / 2}" r="${r}" fill="none" stroke="${color}" stroke-width="${width}"/>`;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Builds the transform attribute string from options
|
|
68
|
+
*/
|
|
69
|
+
export function buildTransform(options) {
|
|
70
|
+
const transforms = [];
|
|
71
|
+
const center = (options.size ?? 64) / 2;
|
|
72
|
+
if (options.rotate) {
|
|
73
|
+
transforms.push(`rotate(${options.rotate} ${center} ${center})`);
|
|
74
|
+
}
|
|
75
|
+
if (options.flip) {
|
|
76
|
+
transforms.push(`scale(-1, 1) translate(-${options.size ?? 64}, 0)`);
|
|
77
|
+
}
|
|
78
|
+
if (options.scale && options.scale !== 1) {
|
|
79
|
+
const offset = center * (1 - options.scale);
|
|
80
|
+
transforms.push(`translate(${offset}, ${offset}) scale(${options.scale})`);
|
|
81
|
+
}
|
|
82
|
+
return transforms.length > 0 ? ` transform="${transforms.join(" ")}"` : "";
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Wraps content with a group that applies transformations
|
|
86
|
+
*/
|
|
87
|
+
export function wrapWithTransform(content, options) {
|
|
88
|
+
const transform = buildTransform(options);
|
|
89
|
+
if (!transform) {
|
|
90
|
+
return content;
|
|
91
|
+
}
|
|
92
|
+
return `<g${transform}>${content}</g>`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Creates a complete SVG avatar from content
|
|
96
|
+
*/
|
|
97
|
+
export function buildSvg(content, options, backgroundColor) {
|
|
98
|
+
const size = options.size ?? 64;
|
|
99
|
+
const clipId = `clip-${Math.random().toString(36).slice(2, 9)}`;
|
|
100
|
+
let svg = createSvgOpen(size);
|
|
101
|
+
// Add defs with clip path
|
|
102
|
+
svg += "<defs>";
|
|
103
|
+
svg += options.square
|
|
104
|
+
? createSquareClip(clipId, size)
|
|
105
|
+
: createCircleClip(clipId, size);
|
|
106
|
+
svg += "</defs>";
|
|
107
|
+
// Apply clip path to content group
|
|
108
|
+
svg += `<g clip-path="url(#${clipId})">`;
|
|
109
|
+
// Add background
|
|
110
|
+
svg += createBackground(size, backgroundColor, options.transparent);
|
|
111
|
+
// Add transformed content
|
|
112
|
+
svg += wrapWithTransform(content, options);
|
|
113
|
+
svg += "</g>";
|
|
114
|
+
// Add border if specified (outside clip)
|
|
115
|
+
if (options.border) {
|
|
116
|
+
svg += createBorder(size, options.border.width, options.border.color, options.square ?? false);
|
|
117
|
+
}
|
|
118
|
+
svg += "</svg>";
|
|
119
|
+
return {
|
|
120
|
+
svg,
|
|
121
|
+
toDataUri() {
|
|
122
|
+
return `data:image/svg+xml;base64,${btoa(svg)}`;
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
export type { AvatarOptions, AvatarResult, GeometricOptions, InitialsOptions, LegacyAvatarOptions, PixelsOptions, Random, RingsOptions, Style } from "./types";
|
|
2
|
+
export { createRandom } from "./random";
|
|
3
|
+
export { buildSvg, buildTransform, createBackground, createBorder, createCircleClip, createSquareClip, createSvgOpen, DEFAULT_COLORS, escapeXml, wrapWithTransform } from "./svg";
|
|
4
|
+
import type { AvatarOptions, AvatarResult, LegacyAvatarOptions, Style } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* Creates an avatar using the specified style
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
11
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
12
|
+
*
|
|
13
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
14
|
+
* // Use avatar.svg for the SVG string
|
|
15
|
+
* // Use avatar.toDataUri() for img src
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function createAvatar<T extends AvatarOptions>(style: Style<T>, options: T): AvatarResult;
|
|
19
|
+
/**
|
|
20
|
+
* Creates an avatar as an HTML element (legacy v1 API)
|
|
21
|
+
*
|
|
22
|
+
* @deprecated Use createAvatar with a Style instead for SVG output
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Legacy usage (deprecated)
|
|
27
|
+
* import { createAvatarElement } from '@avatar-generator/core';
|
|
28
|
+
* const element = createAvatarElement({ name: 'John Doe' });
|
|
29
|
+
*
|
|
30
|
+
* // New usage (recommended)
|
|
31
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
32
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
33
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function createAvatarElement({ name, backgroundColor, gradientDirection, textColor, fontSize, shape, width, height, tooltip, additionalClasses, }: LegacyAvatarOptions): HTMLElement;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AvatarOptions, AvatarResult } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Default color palettes for avatar generation
|
|
4
|
+
*/
|
|
5
|
+
export declare const DEFAULT_COLORS: string[];
|
|
6
|
+
/**
|
|
7
|
+
* Escapes special characters for use in SVG text content
|
|
8
|
+
*/
|
|
9
|
+
export declare function escapeXml(text: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Creates the opening SVG tag with common attributes
|
|
12
|
+
*/
|
|
13
|
+
export declare function createSvgOpen(size: number): string;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a circle clip path for rounded avatars
|
|
16
|
+
*/
|
|
17
|
+
export declare function createCircleClip(id: string, size: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a square clip path
|
|
20
|
+
*/
|
|
21
|
+
export declare function createSquareClip(id: string, size: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a background rectangle
|
|
24
|
+
*/
|
|
25
|
+
export declare function createBackground(size: number, color: string, transparent?: boolean): string;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a border circle or rect
|
|
28
|
+
*/
|
|
29
|
+
export declare function createBorder(size: number, width: number, color: string, square: boolean): string;
|
|
30
|
+
/**
|
|
31
|
+
* Builds the transform attribute string from options
|
|
32
|
+
*/
|
|
33
|
+
export declare function buildTransform(options: AvatarOptions): string;
|
|
34
|
+
/**
|
|
35
|
+
* Wraps content with a group that applies transformations
|
|
36
|
+
*/
|
|
37
|
+
export declare function wrapWithTransform(content: string, options: AvatarOptions): string;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a complete SVG avatar from content
|
|
40
|
+
*/
|
|
41
|
+
export declare function buildSvg(content: string, options: AvatarOptions, backgroundColor: string): AvatarResult;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeded random number generator interface
|
|
3
|
+
*/
|
|
4
|
+
export interface Random {
|
|
5
|
+
/** Returns a random float between 0 (inclusive) and 1 (exclusive) */
|
|
6
|
+
next(): number;
|
|
7
|
+
/** Returns a random integer between min (inclusive) and max (exclusive) */
|
|
8
|
+
int(min: number, max: number): number;
|
|
9
|
+
/** Returns a random item from an array */
|
|
10
|
+
pick<T>(array: T[]): T;
|
|
11
|
+
/** Returns a random boolean with optional probability (default 0.5) */
|
|
12
|
+
bool(probability?: number): boolean;
|
|
13
|
+
/** Shuffles an array in place and returns it */
|
|
14
|
+
shuffle<T>(array: T[]): T[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Avatar result containing the generated SVG
|
|
18
|
+
*/
|
|
19
|
+
export interface AvatarResult {
|
|
20
|
+
/** The generated SVG string */
|
|
21
|
+
svg: string;
|
|
22
|
+
/** Convert to data URI for use in img src */
|
|
23
|
+
toDataUri(): string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Common options for all avatar styles
|
|
27
|
+
*/
|
|
28
|
+
export interface AvatarOptions {
|
|
29
|
+
/** Seed for deterministic generation (any string) */
|
|
30
|
+
seed: string;
|
|
31
|
+
/** Size of the avatar in pixels (default: 64) */
|
|
32
|
+
size?: number;
|
|
33
|
+
/** Color palette to use (style-specific defaults if not provided) */
|
|
34
|
+
colors?: string[];
|
|
35
|
+
/** Use square shape instead of circle (default: false) */
|
|
36
|
+
square?: boolean;
|
|
37
|
+
/** Make background transparent (default: false) */
|
|
38
|
+
transparent?: boolean;
|
|
39
|
+
/** Border configuration */
|
|
40
|
+
border?: {
|
|
41
|
+
width: number;
|
|
42
|
+
color: string;
|
|
43
|
+
};
|
|
44
|
+
/** Rotation in degrees (default: 0) */
|
|
45
|
+
rotate?: number;
|
|
46
|
+
/** Horizontal flip (default: false) */
|
|
47
|
+
flip?: boolean;
|
|
48
|
+
/** Scale factor (default: 1) */
|
|
49
|
+
scale?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Style-specific options extend base options
|
|
53
|
+
*/
|
|
54
|
+
export interface InitialsOptions extends AvatarOptions {
|
|
55
|
+
/** Name to extract initials from (defaults to seed) */
|
|
56
|
+
name?: string;
|
|
57
|
+
/** Font family (default: sans-serif) */
|
|
58
|
+
fontFamily?: string;
|
|
59
|
+
/** Font weight (default: 600) */
|
|
60
|
+
fontWeight?: number;
|
|
61
|
+
/** Text color (default: #fff) */
|
|
62
|
+
textColor?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface GeometricOptions extends AvatarOptions {
|
|
65
|
+
/** Grid size (default: 4) */
|
|
66
|
+
gridSize?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface PixelsOptions extends AvatarOptions {
|
|
69
|
+
/** Pixel grid size (default: 8) */
|
|
70
|
+
pixelSize?: number;
|
|
71
|
+
/** Mirror horizontally for symmetric look (default: true) */
|
|
72
|
+
mirror?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface RingsOptions extends AvatarOptions {
|
|
75
|
+
/** Number of rings (default: 4) */
|
|
76
|
+
ringCount?: number;
|
|
77
|
+
/** Gap between rings (default: 2) */
|
|
78
|
+
ringGap?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Style definition interface - each style implements this
|
|
82
|
+
*/
|
|
83
|
+
export interface Style<T extends AvatarOptions = AvatarOptions> {
|
|
84
|
+
/** Unique style identifier */
|
|
85
|
+
name: string;
|
|
86
|
+
/** Generate an avatar with the given options */
|
|
87
|
+
create(options: T): AvatarResult;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Legacy v1 options for backwards compatibility
|
|
91
|
+
* @deprecated Use AvatarOptions with a Style instead
|
|
92
|
+
*/
|
|
93
|
+
export interface LegacyAvatarOptions {
|
|
94
|
+
name: string;
|
|
95
|
+
backgroundColor?: string | string[];
|
|
96
|
+
gradientDirection?: "vertical" | "horizontal";
|
|
97
|
+
textColor?: string;
|
|
98
|
+
fontSize?: string;
|
|
99
|
+
shape?: "circle" | "square";
|
|
100
|
+
width?: string;
|
|
101
|
+
height?: string;
|
|
102
|
+
tooltip?: boolean;
|
|
103
|
+
additionalClasses?: string;
|
|
104
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avatar-generator/core",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Core logic for avatar generation",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Core logic for multi-style SVG avatar generation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"publishConfig": {
|
|
8
9
|
"access": "public"
|
|
9
10
|
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"avatar",
|
|
13
|
+
"svg",
|
|
14
|
+
"generator",
|
|
15
|
+
"identicon"
|
|
16
|
+
],
|
|
17
|
+
"license": "MIT",
|
|
10
18
|
"scripts": {
|
|
11
19
|
"build": "tsc"
|
|
12
20
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,59 @@
|
|
|
1
|
-
|
|
1
|
+
// Re-export types
|
|
2
|
+
export type {
|
|
3
|
+
AvatarOptions, AvatarResult, GeometricOptions, InitialsOptions, LegacyAvatarOptions, PixelsOptions, Random, RingsOptions,
|
|
4
|
+
Style
|
|
5
|
+
} from "./types";
|
|
6
|
+
|
|
7
|
+
// Re-export utilities
|
|
8
|
+
export { createRandom } from "./random";
|
|
9
|
+
export {
|
|
10
|
+
buildSvg, buildTransform, createBackground,
|
|
11
|
+
createBorder, createCircleClip,
|
|
12
|
+
createSquareClip, createSvgOpen, DEFAULT_COLORS,
|
|
13
|
+
escapeXml, wrapWithTransform
|
|
14
|
+
} from "./svg";
|
|
15
|
+
|
|
16
|
+
import type { AvatarOptions, AvatarResult, LegacyAvatarOptions, Style } from "./types";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates an avatar using the specified style
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
24
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
25
|
+
*
|
|
26
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
27
|
+
* // Use avatar.svg for the SVG string
|
|
28
|
+
* // Use avatar.toDataUri() for img src
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function createAvatar<T extends AvatarOptions>(
|
|
32
|
+
style: Style<T>,
|
|
33
|
+
options: T
|
|
34
|
+
): AvatarResult {
|
|
35
|
+
// Apply defaults
|
|
36
|
+
const opts = {
|
|
37
|
+
size: 64,
|
|
38
|
+
square: false,
|
|
39
|
+
transparent: false,
|
|
40
|
+
rotate: 0,
|
|
41
|
+
flip: false,
|
|
42
|
+
scale: 1,
|
|
43
|
+
...options,
|
|
44
|
+
} as T;
|
|
45
|
+
|
|
46
|
+
return style.create(opts);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ============================================================================
|
|
50
|
+
// Legacy v1 API (deprecated, for backwards compatibility)
|
|
51
|
+
// ============================================================================
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use createAvatar with a Style instead
|
|
55
|
+
*/
|
|
56
|
+
function getInitials(name: string): string {
|
|
2
57
|
if (!name.trim()) return "?";
|
|
3
58
|
|
|
4
59
|
return name
|
|
@@ -7,22 +62,26 @@ const getInitials = (name: string): string => {
|
|
|
7
62
|
.slice(0, 2)
|
|
8
63
|
.map((part) => part[0].toUpperCase())
|
|
9
64
|
.join("");
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export interface AvatarOptions {
|
|
13
|
-
name: string;
|
|
14
|
-
backgroundColor?: string | string[];
|
|
15
|
-
gradientDirection?: "vertical" | "horizontal"
|
|
16
|
-
textColor?: string;
|
|
17
|
-
fontSize?: string;
|
|
18
|
-
shape?: "circle" | "square";
|
|
19
|
-
width?: string;
|
|
20
|
-
height?: string;
|
|
21
|
-
tooltip?: boolean;
|
|
22
|
-
additionalClasses?: string;
|
|
23
65
|
}
|
|
24
66
|
|
|
25
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Creates an avatar as an HTML element (legacy v1 API)
|
|
69
|
+
*
|
|
70
|
+
* @deprecated Use createAvatar with a Style instead for SVG output
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Legacy usage (deprecated)
|
|
75
|
+
* import { createAvatarElement } from '@avatar-generator/core';
|
|
76
|
+
* const element = createAvatarElement({ name: 'John Doe' });
|
|
77
|
+
*
|
|
78
|
+
* // New usage (recommended)
|
|
79
|
+
* import { createAvatar } from '@avatar-generator/core';
|
|
80
|
+
* import { initials } from '@avatar-generator/style-initials';
|
|
81
|
+
* const avatar = createAvatar(initials, { seed: 'John Doe' });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export function createAvatarElement({
|
|
26
85
|
name,
|
|
27
86
|
backgroundColor = "#ccc",
|
|
28
87
|
gradientDirection = "vertical",
|
|
@@ -33,7 +92,7 @@ export function createAvatar({
|
|
|
33
92
|
height = "100px",
|
|
34
93
|
tooltip = false,
|
|
35
94
|
additionalClasses = "",
|
|
36
|
-
}:
|
|
95
|
+
}: LegacyAvatarOptions): HTMLElement {
|
|
37
96
|
const initials = getInitials(name);
|
|
38
97
|
|
|
39
98
|
const avatar = document.createElement("div");
|
|
@@ -41,7 +100,8 @@ export function createAvatar({
|
|
|
41
100
|
avatar.style.height = height;
|
|
42
101
|
|
|
43
102
|
if (Array.isArray(backgroundColor)) {
|
|
44
|
-
const direction =
|
|
103
|
+
const direction =
|
|
104
|
+
gradientDirection === "vertical" ? "to bottom" : "to right";
|
|
45
105
|
avatar.style.background = `linear-gradient(${direction}, ${backgroundColor.join(", ")})`;
|
|
46
106
|
} else {
|
|
47
107
|
avatar.style.backgroundColor = backgroundColor;
|
package/src/random.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Random } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a hash from a string seed using a simple but effective algorithm
|
|
5
|
+
* Based on cyrb53 hash function
|
|
6
|
+
*/
|
|
7
|
+
function hashSeed(seed: string): number {
|
|
8
|
+
let h1 = 0xdeadbeef;
|
|
9
|
+
let h2 = 0x41c6ce57;
|
|
10
|
+
|
|
11
|
+
for (let i = 0; i < seed.length; i++) {
|
|
12
|
+
const ch = seed.charCodeAt(i);
|
|
13
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
14
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
18
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
19
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
20
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
21
|
+
|
|
22
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Mulberry32 PRNG - fast, simple, and good quality
|
|
27
|
+
* Returns a function that generates the next random number
|
|
28
|
+
*/
|
|
29
|
+
function mulberry32(seed: number): () => number {
|
|
30
|
+
return function () {
|
|
31
|
+
let t = (seed += 0x6d2b79f5);
|
|
32
|
+
t = Math.imul(t ^ (t >>> 15), t | 1);
|
|
33
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
34
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a deterministic random number generator from a string seed
|
|
40
|
+
* Same seed always produces the same sequence of numbers
|
|
41
|
+
*/
|
|
42
|
+
export function createRandom(seed: string): Random {
|
|
43
|
+
const numericSeed = hashSeed(seed);
|
|
44
|
+
const rng = mulberry32(numericSeed);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
next(): number {
|
|
48
|
+
return rng();
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
int(min: number, max: number): number {
|
|
52
|
+
return Math.floor(rng() * (max - min)) + min;
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
pick<T>(array: T[]): T {
|
|
56
|
+
if (array.length === 0) {
|
|
57
|
+
throw new Error("Cannot pick from empty array");
|
|
58
|
+
}
|
|
59
|
+
return array[Math.floor(rng() * array.length)];
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
bool(probability = 0.5): boolean {
|
|
63
|
+
return rng() < probability;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
shuffle<T>(array: T[]): T[] {
|
|
67
|
+
// Fisher-Yates shuffle
|
|
68
|
+
for (let i = array.length - 1; i > 0; i--) {
|
|
69
|
+
const j = Math.floor(rng() * (i + 1));
|
|
70
|
+
[array[i], array[j]] = [array[j], array[i]];
|
|
71
|
+
}
|
|
72
|
+
return array;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/svg.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { AvatarOptions, AvatarResult } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default color palettes for avatar generation
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_COLORS = [
|
|
7
|
+
"#FF6B6B", // Red
|
|
8
|
+
"#4ECDC4", // Teal
|
|
9
|
+
"#45B7D1", // Sky blue
|
|
10
|
+
"#96CEB4", // Sage
|
|
11
|
+
"#FFEAA7", // Yellow
|
|
12
|
+
"#DDA0DD", // Plum
|
|
13
|
+
"#98D8C8", // Mint
|
|
14
|
+
"#F7DC6F", // Gold
|
|
15
|
+
"#BB8FCE", // Purple
|
|
16
|
+
"#85C1E9", // Light blue
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Escapes special characters for use in SVG text content
|
|
21
|
+
*/
|
|
22
|
+
export function escapeXml(text: string): string {
|
|
23
|
+
return text
|
|
24
|
+
.replace(/&/g, "&")
|
|
25
|
+
.replace(/</g, "<")
|
|
26
|
+
.replace(/>/g, ">")
|
|
27
|
+
.replace(/"/g, """)
|
|
28
|
+
.replace(/'/g, "'");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Creates the opening SVG tag with common attributes
|
|
33
|
+
*/
|
|
34
|
+
export function createSvgOpen(size: number): string {
|
|
35
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" width="${size}" height="${size}">`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a circle clip path for rounded avatars
|
|
40
|
+
*/
|
|
41
|
+
export function createCircleClip(id: string, size: number): string {
|
|
42
|
+
const r = size / 2;
|
|
43
|
+
return `<clipPath id="${id}"><circle cx="${r}" cy="${r}" r="${r}"/></clipPath>`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a square clip path
|
|
48
|
+
*/
|
|
49
|
+
export function createSquareClip(id: string, size: number): string {
|
|
50
|
+
return `<clipPath id="${id}"><rect x="0" y="0" width="${size}" height="${size}"/></clipPath>`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Creates a background rectangle
|
|
55
|
+
*/
|
|
56
|
+
export function createBackground(
|
|
57
|
+
size: number,
|
|
58
|
+
color: string,
|
|
59
|
+
transparent = false
|
|
60
|
+
): string {
|
|
61
|
+
if (transparent) {
|
|
62
|
+
return "";
|
|
63
|
+
}
|
|
64
|
+
return `<rect x="0" y="0" width="${size}" height="${size}" fill="${color}"/>`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Creates a border circle or rect
|
|
69
|
+
*/
|
|
70
|
+
export function createBorder(
|
|
71
|
+
size: number,
|
|
72
|
+
width: number,
|
|
73
|
+
color: string,
|
|
74
|
+
square: boolean
|
|
75
|
+
): string {
|
|
76
|
+
if (square) {
|
|
77
|
+
const offset = width / 2;
|
|
78
|
+
return `<rect x="${offset}" y="${offset}" width="${size - width}" height="${size - width}" fill="none" stroke="${color}" stroke-width="${width}"/>`;
|
|
79
|
+
}
|
|
80
|
+
const r = size / 2 - width / 2;
|
|
81
|
+
return `<circle cx="${size / 2}" cy="${size / 2}" r="${r}" fill="none" stroke="${color}" stroke-width="${width}"/>`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Builds the transform attribute string from options
|
|
86
|
+
*/
|
|
87
|
+
export function buildTransform(options: AvatarOptions): string {
|
|
88
|
+
const transforms: string[] = [];
|
|
89
|
+
const center = (options.size ?? 64) / 2;
|
|
90
|
+
|
|
91
|
+
if (options.rotate) {
|
|
92
|
+
transforms.push(`rotate(${options.rotate} ${center} ${center})`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (options.flip) {
|
|
96
|
+
transforms.push(`scale(-1, 1) translate(-${options.size ?? 64}, 0)`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (options.scale && options.scale !== 1) {
|
|
100
|
+
const offset = center * (1 - options.scale);
|
|
101
|
+
transforms.push(`translate(${offset}, ${offset}) scale(${options.scale})`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return transforms.length > 0 ? ` transform="${transforms.join(" ")}"` : "";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Wraps content with a group that applies transformations
|
|
109
|
+
*/
|
|
110
|
+
export function wrapWithTransform(
|
|
111
|
+
content: string,
|
|
112
|
+
options: AvatarOptions
|
|
113
|
+
): string {
|
|
114
|
+
const transform = buildTransform(options);
|
|
115
|
+
if (!transform) {
|
|
116
|
+
return content;
|
|
117
|
+
}
|
|
118
|
+
return `<g${transform}>${content}</g>`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Creates a complete SVG avatar from content
|
|
123
|
+
*/
|
|
124
|
+
export function buildSvg(
|
|
125
|
+
content: string,
|
|
126
|
+
options: AvatarOptions,
|
|
127
|
+
backgroundColor: string
|
|
128
|
+
): AvatarResult {
|
|
129
|
+
const size = options.size ?? 64;
|
|
130
|
+
const clipId = `clip-${Math.random().toString(36).slice(2, 9)}`;
|
|
131
|
+
|
|
132
|
+
let svg = createSvgOpen(size);
|
|
133
|
+
|
|
134
|
+
// Add defs with clip path
|
|
135
|
+
svg += "<defs>";
|
|
136
|
+
svg += options.square
|
|
137
|
+
? createSquareClip(clipId, size)
|
|
138
|
+
: createCircleClip(clipId, size);
|
|
139
|
+
svg += "</defs>";
|
|
140
|
+
|
|
141
|
+
// Apply clip path to content group
|
|
142
|
+
svg += `<g clip-path="url(#${clipId})">`;
|
|
143
|
+
|
|
144
|
+
// Add background
|
|
145
|
+
svg += createBackground(size, backgroundColor, options.transparent);
|
|
146
|
+
|
|
147
|
+
// Add transformed content
|
|
148
|
+
svg += wrapWithTransform(content, options);
|
|
149
|
+
|
|
150
|
+
svg += "</g>";
|
|
151
|
+
|
|
152
|
+
// Add border if specified (outside clip)
|
|
153
|
+
if (options.border) {
|
|
154
|
+
svg += createBorder(
|
|
155
|
+
size,
|
|
156
|
+
options.border.width,
|
|
157
|
+
options.border.color,
|
|
158
|
+
options.square ?? false
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
svg += "</svg>";
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
svg,
|
|
166
|
+
toDataUri() {
|
|
167
|
+
return `data:image/svg+xml;base64,${btoa(svg)}`;
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeded random number generator interface
|
|
3
|
+
*/
|
|
4
|
+
export interface Random {
|
|
5
|
+
/** Returns a random float between 0 (inclusive) and 1 (exclusive) */
|
|
6
|
+
next(): number;
|
|
7
|
+
/** Returns a random integer between min (inclusive) and max (exclusive) */
|
|
8
|
+
int(min: number, max: number): number;
|
|
9
|
+
/** Returns a random item from an array */
|
|
10
|
+
pick<T>(array: T[]): T;
|
|
11
|
+
/** Returns a random boolean with optional probability (default 0.5) */
|
|
12
|
+
bool(probability?: number): boolean;
|
|
13
|
+
/** Shuffles an array in place and returns it */
|
|
14
|
+
shuffle<T>(array: T[]): T[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Avatar result containing the generated SVG
|
|
19
|
+
*/
|
|
20
|
+
export interface AvatarResult {
|
|
21
|
+
/** The generated SVG string */
|
|
22
|
+
svg: string;
|
|
23
|
+
/** Convert to data URI for use in img src */
|
|
24
|
+
toDataUri(): string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Common options for all avatar styles
|
|
29
|
+
*/
|
|
30
|
+
export interface AvatarOptions {
|
|
31
|
+
/** Seed for deterministic generation (any string) */
|
|
32
|
+
seed: string;
|
|
33
|
+
/** Size of the avatar in pixels (default: 64) */
|
|
34
|
+
size?: number;
|
|
35
|
+
/** Color palette to use (style-specific defaults if not provided) */
|
|
36
|
+
colors?: string[];
|
|
37
|
+
/** Use square shape instead of circle (default: false) */
|
|
38
|
+
square?: boolean;
|
|
39
|
+
/** Make background transparent (default: false) */
|
|
40
|
+
transparent?: boolean;
|
|
41
|
+
/** Border configuration */
|
|
42
|
+
border?: {
|
|
43
|
+
width: number;
|
|
44
|
+
color: string;
|
|
45
|
+
};
|
|
46
|
+
/** Rotation in degrees (default: 0) */
|
|
47
|
+
rotate?: number;
|
|
48
|
+
/** Horizontal flip (default: false) */
|
|
49
|
+
flip?: boolean;
|
|
50
|
+
/** Scale factor (default: 1) */
|
|
51
|
+
scale?: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Style-specific options extend base options
|
|
56
|
+
*/
|
|
57
|
+
export interface InitialsOptions extends AvatarOptions {
|
|
58
|
+
/** Name to extract initials from (defaults to seed) */
|
|
59
|
+
name?: string;
|
|
60
|
+
/** Font family (default: sans-serif) */
|
|
61
|
+
fontFamily?: string;
|
|
62
|
+
/** Font weight (default: 600) */
|
|
63
|
+
fontWeight?: number;
|
|
64
|
+
/** Text color (default: #fff) */
|
|
65
|
+
textColor?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface GeometricOptions extends AvatarOptions {
|
|
69
|
+
/** Grid size (default: 4) */
|
|
70
|
+
gridSize?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface PixelsOptions extends AvatarOptions {
|
|
74
|
+
/** Pixel grid size (default: 8) */
|
|
75
|
+
pixelSize?: number;
|
|
76
|
+
/** Mirror horizontally for symmetric look (default: true) */
|
|
77
|
+
mirror?: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface RingsOptions extends AvatarOptions {
|
|
81
|
+
/** Number of rings (default: 4) */
|
|
82
|
+
ringCount?: number;
|
|
83
|
+
/** Gap between rings (default: 2) */
|
|
84
|
+
ringGap?: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Style definition interface - each style implements this
|
|
89
|
+
*/
|
|
90
|
+
export interface Style<T extends AvatarOptions = AvatarOptions> {
|
|
91
|
+
/** Unique style identifier */
|
|
92
|
+
name: string;
|
|
93
|
+
/** Generate an avatar with the given options */
|
|
94
|
+
create(options: T): AvatarResult;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Legacy v1 options for backwards compatibility
|
|
99
|
+
* @deprecated Use AvatarOptions with a Style instead
|
|
100
|
+
*/
|
|
101
|
+
export interface LegacyAvatarOptions {
|
|
102
|
+
name: string;
|
|
103
|
+
backgroundColor?: string | string[];
|
|
104
|
+
gradientDirection?: "vertical" | "horizontal";
|
|
105
|
+
textColor?: string;
|
|
106
|
+
fontSize?: string;
|
|
107
|
+
shape?: "circle" | "square";
|
|
108
|
+
width?: string;
|
|
109
|
+
height?: string;
|
|
110
|
+
tooltip?: boolean;
|
|
111
|
+
additionalClasses?: string;
|
|
112
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
3
9
|
"declaration": true,
|
|
10
|
+
"composite": true,
|
|
4
11
|
"declarationDir": "./dist/types",
|
|
5
12
|
"outDir": "./dist",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"module": "ESNext",
|
|
8
|
-
"moduleResolution": "Node",
|
|
9
|
-
"target": "ESNext",
|
|
10
13
|
"rootDir": "src"
|
|
11
14
|
},
|
|
12
15
|
"include": ["src"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2024.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.iterator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.float16.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.full.d.ts","./src/types.ts","./src/random.ts","./src/svg.ts","./src/index.ts"],"fileIdsList":[[87,88,89],[87]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","impliedFormat":1},{"version":"8fd575e12870e9944c7e1d62e1f5a73fcf23dd8d3a321f2a2c74c20d022283fe","impliedFormat":1},{"version":"2ab096661c711e4a81cc464fa1e6feb929a54f5340b46b0a07ac6bbf857471f0","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"df83c2a6c73228b625b0beb6669c7ee2a09c914637e2d35170723ad49c0f5cd4","affectsGlobalScope":true,"impliedFormat":1},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true,"impliedFormat":1},{"version":"87dc0f382502f5bbce5129bdc0aea21e19a3abbc19259e0b43ae038a9fc4e326","affectsGlobalScope":true,"impliedFormat":1},{"version":"b1cb28af0c891c8c96b2d6b7be76bd394fddcfdb4709a20ba05a7c1605eea0f9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true,"impliedFormat":1},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ece9f17b3866cc077099c73f4983bddbcb1dc7ddb943227f1ec070f529dedd1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true,"impliedFormat":1},{"version":"1c9319a09485199c1f7b0498f2988d6d2249793ef67edda49d1e584746be9032","affectsGlobalScope":true,"impliedFormat":1},{"version":"e3a2a0cee0f03ffdde24d89660eba2685bfbdeae955a6c67e8c4c9fd28928eeb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true,"impliedFormat":1},{"version":"51ad4c928303041605b4d7ae32e0c1ee387d43a24cd6f1ebf4a2699e1076d4fa","affectsGlobalScope":true,"impliedFormat":1},{"version":"60037901da1a425516449b9a20073aa03386cce92f7a1fd902d7602be3a7c2e9","affectsGlobalScope":true,"impliedFormat":1},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true,"impliedFormat":1},{"version":"22adec94ef7047a6c9d1af3cb96be87a335908bf9ef386ae9fd50eeb37f44c47","affectsGlobalScope":true,"impliedFormat":1},{"version":"196cb558a13d4533a5163286f30b0509ce0210e4b316c56c38d4c0fd2fb38405","affectsGlobalScope":true,"impliedFormat":1},{"version":"73f78680d4c08509933daf80947902f6ff41b6230f94dd002ae372620adb0f60","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5239f5c01bcfa9cd32f37c496cf19c61d69d37e48be9de612b541aac915805b","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"bde31fd423cd93b0eff97197a3f66df7c93e8c0c335cbeb113b7ff1ac35c23f4","impliedFormat":1},{"version":"d365a0278fba6e9645cd10fb6421e1abb72590d958e2398ad43771a253964145","signature":"8704c2c003ea7dcccb1fab96648cfb2e0b275c380f0eef9d51abc5deff3361db"},{"version":"d5ddb6bca281d31a216b2d0997967a83cecf6c32c585000f12be14086520173b","signature":"2977a3fd70e66a50c6775b100d91462bc4b3f91bb07982ed57c852d7c468c36f"},{"version":"464764349856925053259e0d930b61c0af2098335d2939e1886a0bf4118c16f7","signature":"39bc2b921d43a6684353331240212861024bbc8ccbddbf9a75a6cf5b4625ea06"},{"version":"220d9925f3c5af3d5d1e9d90721987e842b3a3848b0dda9666450e669f9b9945","signature":"f02625ebbe9a6daa46416f1584f435847916ec11017f67ee99854b49a250460f"}],"root":[[87,90]],"options":{"composite":true,"declaration":true,"declarationDir":"./dist/types","esModuleInterop":true,"module":99,"outDir":"./dist","rootDir":"./src","skipLibCheck":true,"strict":true,"target":99},"referencedMap":[[90,1],[88,2],[89,2]],"latestChangedDtsFile":"./dist/types/index.d.ts","version":"5.9.3"}
|