@avatar-generator/svelte 3.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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/dist/Avatar.svelte +12 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hugo García Benjumea
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @avatar-generator/svelte
|
|
2
|
+
|
|
3
|
+
Svelte component for [`@avatar-generator`](https://github.com/hugoogb/avatar-generator) —
|
|
4
|
+
deterministic SVG avatars, where the same seed always renders the same avatar.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @avatar-generator/core @avatar-generator/svelte @avatar-generator/style-initials
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`svelte` and `@avatar-generator/core` are peer dependencies.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```svelte
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import Avatar from "@avatar-generator/svelte";
|
|
19
|
+
import { initials } from "@avatar-generator/style-initials";
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<Avatar style={initials} options={{ seed: "john.doe@example.com", size: 64 }} alt="John Doe" />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Styles
|
|
26
|
+
|
|
27
|
+
Any of the eleven style packages works here:
|
|
28
|
+
`@avatar-generator/style-initials`, `@avatar-generator/style-geometric`, `@avatar-generator/style-pixels`, `@avatar-generator/style-rings`, `@avatar-generator/style-faces`, `@avatar-generator/style-illustrated`, `@avatar-generator/style-anime`, `@avatar-generator/style-abstract`, `@avatar-generator/style-emoji`, `@avatar-generator/style-animals`, `@avatar-generator/style-gradient`
|
|
29
|
+
|
|
30
|
+
See the [Svelte guide](https://avatar-generator-two.vercel.app/guides/svelte/) for the full prop list.
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
Full documentation: [avatar-generator-two.vercel.app](https://avatar-generator-two.vercel.app)
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT © [Hugo García Benjumea](https://github.com/hugoogb)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
import { createAvatar } from "@avatar-generator/core";
|
|
3
|
+
export let style;
|
|
4
|
+
export let options;
|
|
5
|
+
export let alt = "Avatar";
|
|
6
|
+
let className = "";
|
|
7
|
+
export { className as class };
|
|
8
|
+
$: avatar = createAvatar(style, options);
|
|
9
|
+
$: size = options.size ?? 64;
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<img src={avatar.toDataUri()} {alt} class={className} width={size} height={size} />
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var index_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(index_exports);
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// The Svelte component lives in Avatar.svelte, which the consumer's Svelte\n// toolchain resolves via the `\"svelte\"` export condition. This file exists\n// so a non-Svelte consumer (e.g. plain TypeScript importing types) still has\n// a default entry point.\nexport {};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avatar-generator/svelte",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"avatar",
|
|
6
|
+
"svelte",
|
|
7
|
+
"svg",
|
|
8
|
+
"component"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/hugoogb/avatar-generator.git",
|
|
14
|
+
"directory": "src/packages/svelte"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/hugoogb/avatar-generator#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/hugoogb/avatar-generator/issues"
|
|
19
|
+
},
|
|
20
|
+
"type": "module",
|
|
21
|
+
"main": "./dist/index.cjs",
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"svelte": "./dist/Avatar.svelte",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"svelte": "./dist/Avatar.svelte",
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"require": {
|
|
33
|
+
"types": "./dist/index.d.cts",
|
|
34
|
+
"default": "./dist/index.cjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json",
|
|
38
|
+
"./Avatar.svelte": "./dist/Avatar.svelte"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"README.md",
|
|
44
|
+
"CHANGELOG.md"
|
|
45
|
+
],
|
|
46
|
+
"sideEffects": false,
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=18"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"svelte": "^4.0.0 || ^5.0.0",
|
|
52
|
+
"@avatar-generator/core": "^3.0.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"svelte": "^4.2.19",
|
|
56
|
+
"tsup": "^8.5.0",
|
|
57
|
+
"esbuild": "^0.25.0",
|
|
58
|
+
"@avatar-generator/core": "3.0.0"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsup src/index.ts --format esm,cjs --dts --sourcemap --clean --target es2020 && node scripts/build-component.mjs",
|
|
65
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
66
|
+
"publint": "publint --strict",
|
|
67
|
+
"attw": "attw --pack . --exclude-entrypoints ./Avatar.svelte"
|
|
68
|
+
}
|
|
69
|
+
}
|