@dicebear/core 5.0.0-beta.5 → 5.0.0-beta.7

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/index.d.ts CHANGED
@@ -4,8 +4,9 @@
4
4
  * Code licensed under MIT (https://github.com/dicebear/dicebear/blob/main/LICENSE)
5
5
  * Copyright (c) 2022 Florian Körner
6
6
  */
7
+ import * as license from './utils/license.js';
8
+ import * as escape from './utils/escape.js';
7
9
  export * from './core.js';
8
10
  export * from './schema.js';
9
- export * as license from './utils/license.js';
10
- export * as escape from './utils/escape.js';
11
11
  export * from './types.js';
12
+ export { license, escape };
package/lib/index.js CHANGED
@@ -4,8 +4,9 @@
4
4
  * Code licensed under MIT (https://github.com/dicebear/dicebear/blob/main/LICENSE)
5
5
  * Copyright (c) 2022 Florian Körner
6
6
  */
7
+ import * as license from './utils/license.js';
8
+ import * as escape from './utils/escape.js';
7
9
  export * from './core.js';
8
10
  export * from './schema.js';
9
- export * as license from './utils/license.js';
10
- export * as escape from './utils/escape.js';
11
11
  export * from './types.js';
12
+ export { license, escape };
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 declare type SchemaDefaults = Record<string, unknown>;
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 declare type StyleSchema = JSONSchema7;
36
- export declare type StyleOptions<O extends {}> = Partial<O & Options>;
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 declare type StyleCreate<O extends {}> = (props: StyleCreateProps<O>) => StyleCreateResult;
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: StyleMeta;
62
- schema: StyleSchema;
61
+ meta?: StyleMeta;
62
+ schema?: StyleSchema;
63
63
  create: StyleCreate<O>;
64
64
  }
@@ -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 && _a !== void 0 ? _a : 'Unnamed';
5
- const creator = (_b = style.meta.creator) !== null && _b !== void 0 ? _b : 'Unknown';
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 ((_c = style.meta.license) === null || _c === void 0 ? void 0 : _c.name) {
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((_d = style.meta.homepage) !== null && _d !== void 0 ? _d : '')}">` +
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 = ((_e = style.meta.license) === null || _e === void 0 ? void 0 : _e.url)
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 && _a !== void 0 ? _a : 'Unnamed';
41
- const creator = (_b = style.meta.creator) !== null && _b !== void 0 ? _b : 'Unknown';
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 ((_c = style.meta.license) === null || _c === void 0 ? void 0 : _c.name) {
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 ((_d = style.meta.license) === null || _d === void 0 ? void 0 : _d.url) {
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;
@@ -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.5",
3
+ "version": "5.0.0-beta.7",
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": "^5.0.0-beta.5"
35
+ "@dicebear/converter": "^5.0.0-beta.7"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@tsconfig/recommended": "^1.0.1",
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "067460b00a40a7720d556f45edb32d9311edde14"
49
+ "gitHead": "6864a0fec66652d8740f6feb2d99dc7a118ebd79"
50
50
  }