@avyn/initials-avatar 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/vue.d.cts +1 -1
- package/dist/vue.d.ts +1 -1
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @avyn/initials-avatar
|
|
2
|
+
|
|
3
|
+
Framework-agnostic SVG initials avatar generator. No dependencies, ships ESM + CJS + types, works in Node, browsers, and SSR.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
```bash
|
|
7
|
+
npm install @avyn/initials-avatar
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Quick start
|
|
11
|
+
```ts
|
|
12
|
+
import { createAvatarSvg, createAvatarDataUri, createAvatar } from '@avyn/initials-avatar';
|
|
13
|
+
|
|
14
|
+
const svg = createAvatarSvg('Ada Lovelace', { backgroundColor: '#111827', fontColor: '#f8fafc' });
|
|
15
|
+
const dataUri = createAvatarDataUri('Grace Hopper', { bold: true });
|
|
16
|
+
const { svg: svgString, dataUri } = createAvatar('Alan Turing');
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Options
|
|
20
|
+
- size (px, default 96)
|
|
21
|
+
- backgroundColor (default deterministic from name)
|
|
22
|
+
- fontColor (default white)
|
|
23
|
+
- fontSize (default 42% of size)
|
|
24
|
+
- fontFamily (default Segoe UI/Arial)
|
|
25
|
+
- borderWidth, borderColor, borderRadius
|
|
26
|
+
- bold (font weight)
|
|
27
|
+
- initialsOverride
|
|
28
|
+
|
|
29
|
+
## HTTP helpers
|
|
30
|
+
```ts
|
|
31
|
+
import { createExpressHandler, createFastifyHandler, createNestHandler } from '@avyn/initials-avatar';
|
|
32
|
+
|
|
33
|
+
app.get('/avatar', createExpressHandler({ nameKey: 'name', cacheControl: 'public, max-age=86400' }));
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## React/Vue wrappers
|
|
37
|
+
- React: `@avyn/initials-avatar-react`
|
|
38
|
+
- Vue 3: `@avyn/initials-avatar-vue`
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
MIT
|
package/dist/vue.d.cts
CHANGED
|
@@ -126,8 +126,8 @@ declare const InitialsAvatar: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
126
126
|
};
|
|
127
127
|
}>> & Readonly<{}>, {
|
|
128
128
|
alt: string;
|
|
129
|
-
as: "img" | "svg";
|
|
130
129
|
title: string;
|
|
130
|
+
as: "img" | "svg";
|
|
131
131
|
size: number;
|
|
132
132
|
backgroundColor: string;
|
|
133
133
|
fontColor: string;
|
package/dist/vue.d.ts
CHANGED
|
@@ -126,8 +126,8 @@ declare const InitialsAvatar: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
126
126
|
};
|
|
127
127
|
}>> & Readonly<{}>, {
|
|
128
128
|
alt: string;
|
|
129
|
-
as: "img" | "svg";
|
|
130
129
|
title: string;
|
|
130
|
+
as: "img" | "svg";
|
|
131
131
|
size: number;
|
|
132
132
|
backgroundColor: string;
|
|
133
133
|
fontColor: string;
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avyn/initials-avatar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Framework-agnostic SVG initials avatar generator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
|
-
"module": "dist/index.
|
|
7
|
+
"module": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"import": "./dist/index.
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
12
|
"require": "./dist/index.cjs",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"./react": {
|
|
16
|
-
"import": "./dist/react.
|
|
16
|
+
"import": "./dist/react.js",
|
|
17
17
|
"require": "./dist/react.cjs",
|
|
18
18
|
"types": "./dist/react.d.ts"
|
|
19
19
|
},
|
|
20
20
|
"./vue": {
|
|
21
|
-
"import": "./dist/vue.
|
|
21
|
+
"import": "./dist/vue.js",
|
|
22
22
|
"require": "./dist/vue.cjs",
|
|
23
23
|
"types": "./dist/vue.d.ts"
|
|
24
24
|
},
|