@dicebear/core 5.0.0-beta.4 → 5.0.0-beta.6
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/lib/types.d.ts +6 -6
- package/lib/utils/license.js +13 -13
- package/lib/utils/options.js +2 -1
- package/package.json +4 -3
package/lib/types.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface Options {
|
|
|
23
23
|
export interface Exif {
|
|
24
24
|
[key: string]: string;
|
|
25
25
|
}
|
|
26
|
-
export
|
|
26
|
+
export type SchemaDefaults = Record<string, unknown>;
|
|
27
27
|
export interface Prng {
|
|
28
28
|
seed: string;
|
|
29
29
|
next(): void;
|
|
@@ -32,13 +32,13 @@ export interface Prng {
|
|
|
32
32
|
pick<T>(arr: T[]): T | undefined;
|
|
33
33
|
string(length: number, characters?: string): string;
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
export
|
|
35
|
+
export type StyleSchema = JSONSchema7;
|
|
36
|
+
export type StyleOptions<O extends {}> = Partial<O & Options>;
|
|
37
37
|
export interface StyleCreateProps<O extends {}> {
|
|
38
38
|
prng: Prng;
|
|
39
39
|
options: StyleOptions<O>;
|
|
40
40
|
}
|
|
41
|
-
export
|
|
41
|
+
export type StyleCreate<O extends {}> = (props: StyleCreateProps<O>) => StyleCreateResult;
|
|
42
42
|
export interface StyleCreateResultAttributes {
|
|
43
43
|
viewBox: string;
|
|
44
44
|
[key: string]: string;
|
|
@@ -58,7 +58,7 @@ export interface StyleMeta {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
export interface Style<O extends {}> {
|
|
61
|
-
meta
|
|
62
|
-
schema
|
|
61
|
+
meta?: StyleMeta;
|
|
62
|
+
schema?: StyleSchema;
|
|
63
63
|
create: StyleCreate<O>;
|
|
64
64
|
}
|
package/lib/utils/license.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import * as _ from './escape.js';
|
|
2
2
|
export function xml(style) {
|
|
3
|
-
var _a, _b, _c, _d, _e;
|
|
4
|
-
const title = (_a = style.meta.title) !== null &&
|
|
5
|
-
const creator = (
|
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
4
|
+
const title = (_b = (_a = style.meta) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'Unnamed';
|
|
5
|
+
const creator = (_d = (_c = style.meta) === null || _c === void 0 ? void 0 : _c.creator) !== null && _d !== void 0 ? _d : 'Unknown';
|
|
6
6
|
let description = `"${title}" by "${creator}"`;
|
|
7
|
-
if ((
|
|
7
|
+
if ((_f = (_e = style.meta) === null || _e === void 0 ? void 0 : _e.license) === null || _f === void 0 ? void 0 : _f.name) {
|
|
8
8
|
description += `, licensed under "${style.meta.license.name}".`;
|
|
9
9
|
}
|
|
10
10
|
description += ' / Remix of the original. - Created with dicebear.com';
|
|
11
11
|
const xmlTitle = `<dc:title>${_.xml(title)}</dc:title>`;
|
|
12
12
|
const xmlCreator = '<dc:creator>' +
|
|
13
|
-
`<cc:Agent rdf:about="${_.xml((
|
|
13
|
+
`<cc:Agent rdf:about="${_.xml((_h = (_g = style.meta) === null || _g === void 0 ? void 0 : _g.homepage) !== null && _h !== void 0 ? _h : '')}">` +
|
|
14
14
|
`<dc:title>${_.xml(creator)}</dc:title>` +
|
|
15
15
|
'</cc:Agent>' +
|
|
16
16
|
'</dc:creator>';
|
|
17
|
-
const xmlSource = style.meta.source
|
|
17
|
+
const xmlSource = ((_j = style.meta) === null || _j === void 0 ? void 0 : _j.source)
|
|
18
18
|
? `<dc:source>${_.xml(style.meta.source)}</dc:source>`
|
|
19
19
|
: '';
|
|
20
|
-
const xmlLicense = ((
|
|
20
|
+
const xmlLicense = ((_l = (_k = style.meta) === null || _k === void 0 ? void 0 : _k.license) === null || _l === void 0 ? void 0 : _l.url)
|
|
21
21
|
? `<cc:license rdf:resource="${_.xml(style.meta.license.url)}" />`
|
|
22
22
|
: '';
|
|
23
23
|
return (`<desc>${description}</desc>` +
|
|
@@ -36,11 +36,11 @@ export function xml(style) {
|
|
|
36
36
|
'</metadata>');
|
|
37
37
|
}
|
|
38
38
|
export function exif(style) {
|
|
39
|
-
var _a, _b, _c, _d;
|
|
40
|
-
const title = (_a = style.meta.title) !== null &&
|
|
41
|
-
const creator = (
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
40
|
+
const title = (_b = (_a = style.meta) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'Unnamed';
|
|
41
|
+
const creator = (_d = (_c = style.meta) === null || _c === void 0 ? void 0 : _c.creator) !== null && _d !== void 0 ? _d : 'Unknown';
|
|
42
42
|
let copyright = `"${title}" by "${creator}"`;
|
|
43
|
-
if ((
|
|
43
|
+
if ((_f = (_e = style.meta) === null || _e === void 0 ? void 0 : _e.license) === null || _f === void 0 ? void 0 : _f.name) {
|
|
44
44
|
copyright += `, licensed under "${style.meta.license.name}".`;
|
|
45
45
|
}
|
|
46
46
|
copyright += ' / Remix of the original.';
|
|
@@ -50,10 +50,10 @@ export function exif(style) {
|
|
|
50
50
|
'XMP-dc:Title': title,
|
|
51
51
|
'XMP-dc:Creator': creator,
|
|
52
52
|
};
|
|
53
|
-
if (style.meta.source) {
|
|
53
|
+
if ((_g = style.meta) === null || _g === void 0 ? void 0 : _g.source) {
|
|
54
54
|
exif['XMP-dc:Source'] = style.meta.source;
|
|
55
55
|
}
|
|
56
|
-
if ((
|
|
56
|
+
if ((_j = (_h = style.meta) === null || _h === void 0 ? void 0 : _h.license) === null || _j === void 0 ? void 0 : _j.url) {
|
|
57
57
|
exif['XMP-cc:License'] = style.meta.license.url;
|
|
58
58
|
}
|
|
59
59
|
return exif;
|
package/lib/utils/options.js
CHANGED
|
@@ -20,9 +20,10 @@ export function defaults(schema) {
|
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
22
|
export function merge(style, options) {
|
|
23
|
+
var _a;
|
|
23
24
|
let result = {
|
|
24
25
|
...defaults(schema),
|
|
25
|
-
...defaults(style.schema),
|
|
26
|
+
...defaults((_a = style.schema) !== null && _a !== void 0 ? _a : {}),
|
|
26
27
|
...options,
|
|
27
28
|
};
|
|
28
29
|
// Return a complete copy because the styles could partially customize the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/core",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.6",
|
|
4
4
|
"description": "An avatar library for designers and developers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": "Florian Körner <contact@florian-koerner.com>",
|
|
19
19
|
"type": "module",
|
|
20
|
+
"main": "./lib/index.js",
|
|
20
21
|
"exports": "./lib/index.js",
|
|
21
22
|
"types": "./lib/index.d.ts",
|
|
22
23
|
"files": [
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
"test": "uvu tests"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@dicebear/converter": "^5.0.0-beta.
|
|
35
|
+
"@dicebear/converter": "^5.0.0-beta.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@tsconfig/recommended": "^1.0.1",
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"publishConfig": {
|
|
46
47
|
"access": "public"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "1a81759251d30336383497f31843b48809d0f56b"
|
|
49
50
|
}
|