@dicebear/core 7.0.4 → 7.1.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/lib/utils/license.d.ts +1 -0
- package/lib/utils/license.js +60 -48
- package/package.json +3 -3
package/lib/utils/license.d.ts
CHANGED
package/lib/utils/license.js
CHANGED
|
@@ -1,60 +1,72 @@
|
|
|
1
1
|
import * as _ from './escape.js';
|
|
2
2
|
export function xml(style) {
|
|
3
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
4
|
-
const title = (
|
|
5
|
-
const creator = (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4
|
+
const title = (_a = style.meta) === null || _a === void 0 ? void 0 : _a.title;
|
|
5
|
+
const creator = (_b = style.meta) === null || _b === void 0 ? void 0 : _b.creator;
|
|
6
|
+
const source = (_c = style.meta) === null || _c === void 0 ? void 0 : _c.source;
|
|
7
|
+
const license = (_e = (_d = style.meta) === null || _d === void 0 ? void 0 : _d.license) === null || _e === void 0 ? void 0 : _e.url;
|
|
8
|
+
const rights = text(style);
|
|
9
|
+
if (!title && !creator && !source && !license && !rights) {
|
|
10
|
+
return '';
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`<dc:title>${_.xml(creator)}</dc:title>` +
|
|
15
|
-
'</cc:Agent>' +
|
|
16
|
-
'</dc:creator>';
|
|
17
|
-
const xmlSource = ((_j = style.meta) === null || _j === void 0 ? void 0 : _j.source)
|
|
18
|
-
? `<dc:source>${_.xml(style.meta.source)}</dc:source>`
|
|
19
|
-
: '';
|
|
20
|
-
const xmlLicense = ((_l = (_k = style.meta) === null || _k === void 0 ? void 0 : _k.license) === null || _l === void 0 ? void 0 : _l.url)
|
|
21
|
-
? `<cc:license rdf:resource="${_.xml(style.meta.license.url)}" />`
|
|
22
|
-
: '';
|
|
23
|
-
return (`<desc>${description}</desc>` +
|
|
24
|
-
'<metadata' +
|
|
12
|
+
// https://nsteffel.github.io/dublin_core_generator/generator.html
|
|
13
|
+
return ('<metadata' +
|
|
14
|
+
' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' +
|
|
15
|
+
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
|
|
25
16
|
' xmlns:dc="http://purl.org/dc/elements/1.1/"' +
|
|
26
|
-
' xmlns:
|
|
27
|
-
' xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">' +
|
|
17
|
+
' xmlns:dcterms="http://purl.org/dc/terms/">' +
|
|
28
18
|
'<rdf:RDF>' +
|
|
29
|
-
'<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
'<rdf:Description>' +
|
|
20
|
+
(title ? `<dc:title>${_.xml(title)}</dc:title>` : '') +
|
|
21
|
+
(creator ? `<dc:creator>${_.xml(creator)}</dc:creator>` : '') +
|
|
22
|
+
(source ? `<dc:source xsi:type="dcterms:URI">${_.xml((_g = (_f = style.meta) === null || _f === void 0 ? void 0 : _f.source) !== null && _g !== void 0 ? _g : '')}</dc:source>` : '') +
|
|
23
|
+
(license ? `<dcterms:license xsi:type="dcterms:URI">${_.xml(license)}</dcterms:license>` : '') +
|
|
24
|
+
(rights ? `<dc:rights>${_.xml(rights)}</dc:rights>` : '') +
|
|
25
|
+
'</rdf:Description>' +
|
|
35
26
|
'</rdf:RDF>' +
|
|
36
27
|
'</metadata>');
|
|
37
28
|
}
|
|
38
|
-
export function
|
|
39
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
copyright += `, licensed under "${style.meta.license.name}".`;
|
|
29
|
+
export function text(style) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
31
|
+
let title = ((_a = style.meta) === null || _a === void 0 ? void 0 : _a.title) ? `„${(_b = style.meta) === null || _b === void 0 ? void 0 : _b.title}”` : 'Design';
|
|
32
|
+
let creator = `„${(_d = (_c = style.meta) === null || _c === void 0 ? void 0 : _c.creator) !== null && _d !== void 0 ? _d : 'Unknown'}”`;
|
|
33
|
+
if ((_e = style.meta) === null || _e === void 0 ? void 0 : _e.source) {
|
|
34
|
+
title += ` (${style.meta.source})`;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Copyright: copyright,
|
|
50
|
-
'XMP-dc:Title': title,
|
|
51
|
-
'XMP-dc:Creator': creator,
|
|
52
|
-
};
|
|
53
|
-
if ((_g = style.meta) === null || _g === void 0 ? void 0 : _g.source) {
|
|
54
|
-
exif['XMP-dc:Source'] = style.meta.source;
|
|
36
|
+
let result = '';
|
|
37
|
+
if (((_g = (_f = style.meta) === null || _f === void 0 ? void 0 : _f.license) === null || _g === void 0 ? void 0 : _g.name) !== 'MIT' && ((_h = style.meta) === null || _h === void 0 ? void 0 : _h.title)) {
|
|
38
|
+
result += 'Remix of ';
|
|
55
39
|
}
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
result += `${title} by ${creator}`;
|
|
41
|
+
if ((_k = (_j = style.meta) === null || _j === void 0 ? void 0 : _j.license) === null || _k === void 0 ? void 0 : _k.name) {
|
|
42
|
+
result += `, licensed under „${(_m = (_l = style.meta) === null || _l === void 0 ? void 0 : _l.license) === null || _m === void 0 ? void 0 : _m.name}”`;
|
|
43
|
+
if ((_p = (_o = style.meta) === null || _o === void 0 ? void 0 : _o.license) === null || _p === void 0 ? void 0 : _p.url) {
|
|
44
|
+
result += ` (${style.meta.license.url})`;
|
|
45
|
+
}
|
|
58
46
|
}
|
|
59
|
-
return
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
export function exif(style) {
|
|
50
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
51
|
+
const copyright = text(style);
|
|
52
|
+
// https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata
|
|
53
|
+
// https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata
|
|
54
|
+
return {
|
|
55
|
+
// Title
|
|
56
|
+
'IPTC:ObjectName': (_a = style.meta) === null || _a === void 0 ? void 0 : _a.title,
|
|
57
|
+
'XMP-dc:Title': (_b = style.meta) === null || _b === void 0 ? void 0 : _b.title,
|
|
58
|
+
// Copyright
|
|
59
|
+
'IPTC:CopyrightNotice': copyright,
|
|
60
|
+
'XMP-dc:Rights': copyright,
|
|
61
|
+
// Creator
|
|
62
|
+
'IPTC:By-line': (_c = style.meta) === null || _c === void 0 ? void 0 : _c.creator,
|
|
63
|
+
'XMP-dc:Creator': (_d = style.meta) === null || _d === void 0 ? void 0 : _d.creator,
|
|
64
|
+
// Credit
|
|
65
|
+
'IPTC:Credit': (_e = style.meta) === null || _e === void 0 ? void 0 : _e.creator,
|
|
66
|
+
'XMP-photoshop:Credit': (_f = style.meta) === null || _f === void 0 ? void 0 : _f.creator,
|
|
67
|
+
// Licensor
|
|
68
|
+
'XMP-plus:LicensorURL': (_g = style.meta) === null || _g === void 0 ? void 0 : _g.source,
|
|
69
|
+
// Rights
|
|
70
|
+
'XMP-xmpRights:WebStatement': (_j = (_h = style.meta) === null || _h === void 0 ? void 0 : _h.license) === null || _j === void 0 ? void 0 : _j.url,
|
|
71
|
+
};
|
|
60
72
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/core",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "An avatar library for designers and developers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"avatar",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"test": "uvu tests"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@dicebear/converter": "7.0
|
|
35
|
+
"@dicebear/converter": "7.1.0",
|
|
36
36
|
"@types/json-schema": "^7.0.11"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "04b74170d60c613e1cff891f6fc4bdc573c39808"
|
|
51
51
|
}
|