@dicebear/glass 9.2.2 → 9.2.4
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/components/shape1.js +8 -8
- package/lib/components/shape2.js +8 -8
- package/lib/index.js +1 -1
- package/lib/schema.js +106 -160
- package/lib/utils/getColors.js +0 -1
- package/lib/utils/getComponents.d.ts +1 -1
- package/lib/utils/getComponents.js +3 -4
- package/lib/utils/pickComponent.d.ts +1 -1
- package/lib/utils/pickComponent.js +2 -2
- package/package.json +6 -6
package/lib/components/shape1.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* File: https://www.figma.com/design/MbbQiNEkuiiLZSbZuPzyVD
|
|
6
6
|
*/
|
|
7
7
|
export const shape1 = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
g: (components, colors) => `<path d="M101.6 51.1a20 20 0 0 0-14.7-14.5q-3.9-1-8.5-1.1-10 0-17 4.8A30 30 0 0 0 50.9 54q-3.6 9-3.6 21.6 0 12.8 3.5 21.8 3.4 9 10.3 14a29 29 0 0 0 17.2 4.8q9 0 15-2.6 6-2.7 9-7.5t3-11.4l6.8.7H78.7v-28h64.5v20q0 20-8.4 34.1a56 56 0 0 1-23.2 21.6Q97 150.6 78 150.6q-21.3 0-37.3-9t-25-25.8-9-39.7a87 87 0 0 1 5.4-32 67 67 0 0 1 38-38Q63 1 77.6 1q12.9 0 24 3.7 11.1 3.6 19.7 10.4a50 50 0 0 1 20.2 36z" fill="white"/>`,
|
|
9
|
+
r: (components, colors) => `<path d="M17.6 148.6V3h62.8q16.2 0 28.3 6 12 5.8 18.9 16.9a50 50 0 0 1 6.7 26.5q0 15.7-7 26.4A43 43 0 0 1 108 95q-12.5 5.5-29 5.5H41.3V69.9H71q7 0 11.8-1.7a15 15 0 0 0 7.6-5.6 17 17 0 0 0 2.7-10q0-6.3-2.7-10.2a15 15 0 0 0-7.6-5.8q-4.9-2-11.8-2H57v114zm85.2-66.8 36.4 66.8h-43L60.9 81.8z" fill="white"/>`,
|
|
10
|
+
a: (components, colors) => `<path d="M42.6 148.6H0L48 3h54l48 145.5h-42.7L75.5 43.2h-1.1zm-8-57.4h80.1v29.5h-80z" fill="white"/>`,
|
|
11
|
+
d: (components, colors) => `<path d="M67 148.6H11V3h55.4q22.5 0 38.8 8.7a60 60 0 0 1 25.3 25q9 16.4 9 39 0 22.8-9 39.1a61 61 0 0 1-25 25 81 81 0 0 1-38.5 8.7M50.5 115h15a44 44 0 0 0 18.5-3.4q7.6-3.6 11.6-12t4-23.8q0-15-4-23.7a24 24 0 0 0-12-12 47 47 0 0 0-19.2-3.5H50.5z" fill="white"/>`,
|
|
12
|
+
i: (components, colors) => `<path d="M94.8 3.1v145.5H55.3V3z" fill="white"/>`,
|
|
13
|
+
e: (components, colors) => `<path d="M22.2 148.6V3H127v32H61.7v25h59.9v31.8h-60v25h65.1v31.9z" fill="white"/>`,
|
|
14
|
+
n: (components, colors) => `<path d="M138 3.1v145.5h-33L52.5 72h-1v76.5H12.2V3h33.5l51.7 76.1h1.2v-76z" fill="white"/>`,
|
|
15
|
+
t: (components, colors) => `<path d="M11.7 35V3h126.5v32H94.4v113.7h-39V34.9z" fill="white"/>`,
|
|
16
16
|
};
|
package/lib/components/shape2.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* File: https://www.figma.com/design/MbbQiNEkuiiLZSbZuPzyVD
|
|
6
6
|
*/
|
|
7
7
|
export const shape2 = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
g: (components, colors) => `<path d="M101.6 51.2a20 20 0 0 0-14.7-14.5q-3.9-1-8.5-1-10 0-17 4.7A30 30 0 0 0 50.9 54q-3.6 9-3.6 21.6 0 12.8 3.5 21.8 3.4 9 10.3 14a29 29 0 0 0 17.2 4.8q9 0 15-2.6 6-2.7 9-7.5t3-11.4l6.8.7H78.7v-28h64.5v20q0 20-8.4 34.1a56 56 0 0 1-23.2 21.6Q97 150.7 78 150.7q-21.3 0-37.3-9t-25-25.8q-9-16.5-9-39.7a87 87 0 0 1 5.4-32 67 67 0 0 1 38-38q12.9-5 27.6-5 12.9 0 24 3.7 11.1 3.6 19.7 10.4a50 50 0 0 1 20.2 36z" fill="white"/>`,
|
|
9
|
+
r: (components, colors) => `<path d="M17.6 148.7V3.2h62.8q16.2 0 28.3 6 12 5.8 18.9 16.9a50 50 0 0 1 6.7 26.6q0 15.6-7 26.3A43 43 0 0 1 108 95.2q-12.5 5.5-29 5.5H41.3V70H71q7 0 11.8-1.7a15 15 0 0 0 7.6-5.6 17 17 0 0 0 2.7-10q0-6.3-2.7-10.2a15 15 0 0 0-7.6-5.8q-4.9-2-11.8-2H57v114zm85.2-66.8 36.4 66.8h-43L60.9 81.9z" fill="white"/>`,
|
|
10
|
+
a: (components, colors) => `<path d="M42.6 148.7H0L48 3.2h54l48 145.5h-42.7L75.5 43.3h-1.1zm-8-57.4h80.1v29.5h-80z" fill="white"/>`,
|
|
11
|
+
d: (components, colors) => `<path d="M67 148.7H11V3.2h55.4q22.5 0 38.8 8.8a60 60 0 0 1 25.3 25q9 16.2 9 39 0 22.6-9 39a61 61 0 0 1-25 25 81 81 0 0 1-38.5 8.7m-16.5-33.5h15a44 44 0 0 0 18.5-3.5q7.6-3.5 11.6-12t4-23.8q0-15-4-23.7a24 24 0 0 0-12-12 47 47 0 0 0-19.2-3.5H50.5z" fill="white"/>`,
|
|
12
|
+
i: (components, colors) => `<path d="M94.8 3.2v145.5H55.3V3.2z" fill="white"/>`,
|
|
13
|
+
e: (components, colors) => `<path d="M22.2 148.7V3.2H127V35H61.7v25h59.9v32h-60v25h65.1v31.8z" fill="white"/>`,
|
|
14
|
+
n: (components, colors) => `<path d="M138 3.2v145.5h-33L52.5 72.3h-1v76.4H12.2V3.2h33.5l51.7 76.2h1.2V3.2z" fill="white"/>`,
|
|
15
|
+
t: (components, colors) => `<path d="M11.7 35V3.2h126.5V35H94.4v113.7h-39V35z" fill="white"/>`,
|
|
16
16
|
};
|
package/lib/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export const create = ({ prng, options }) => {
|
|
|
24
24
|
attributes: {
|
|
25
25
|
viewBox: '0 0 100 100',
|
|
26
26
|
fill: 'none',
|
|
27
|
-
'shape-rendering': 'auto'
|
|
27
|
+
'shape-rendering': 'auto',
|
|
28
28
|
},
|
|
29
29
|
body: `<g style="mix-blend-mode:screen" opacity="0.6" filter="url(#dicebearGlass-a)"><g transform="translate(-25 -25)">${(_b = (_a = components.shape2) === null || _a === void 0 ? void 0 : _a.value(components, colors)) !== null && _b !== void 0 ? _b : ''}</g></g><g style="mix-blend-mode:screen" opacity="0.6" filter="url(#dicebearGlass-b)"><g transform="translate(-25 -25)">${(_d = (_c = components.shape1) === null || _c === void 0 ? void 0 : _c.value(components, colors)) !== null && _d !== void 0 ? _d : ''}</g></g><defs><filter id="dicebearGlass-a" x="-57" y="-57" width="214" height="214" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur stdDeviation="16" result="effect1_foregroundBlur_25_7"/></filter><filter id="dicebearGlass-b" x="-57" y="-57" width="214" height="214" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur stdDeviation="16" result="effect1_foregroundBlur_25_7"/></filter></defs>`,
|
|
30
30
|
extra: () => ({
|
package/lib/schema.js
CHANGED
|
@@ -5,181 +5,127 @@
|
|
|
5
5
|
* File: https://www.figma.com/design/MbbQiNEkuiiLZSbZuPzyVD
|
|
6
6
|
*/
|
|
7
7
|
export const schema = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
9
|
+
properties: {
|
|
10
|
+
backgroundColor: {
|
|
11
|
+
type: 'array',
|
|
12
|
+
items: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
pattern: '^(transparent|[a-fA-F0-9]{6})$',
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
]
|
|
16
|
+
default: [
|
|
17
|
+
'eb4747',
|
|
18
|
+
'eb6247',
|
|
19
|
+
'eb7e47',
|
|
20
|
+
'eb9947',
|
|
21
|
+
'ebb447',
|
|
22
|
+
'ebd047',
|
|
23
|
+
'ebeb47',
|
|
24
|
+
'd0eb47',
|
|
25
|
+
'b4eb47',
|
|
26
|
+
'99eb47',
|
|
27
|
+
'7eeb47',
|
|
28
|
+
'62eb47',
|
|
29
|
+
'47eb47',
|
|
30
|
+
'47eb62',
|
|
31
|
+
'47eb7e',
|
|
32
|
+
'47eb99',
|
|
33
|
+
'47ebb4',
|
|
34
|
+
'47ebd0',
|
|
35
|
+
'47ebeb',
|
|
36
|
+
'47d0eb',
|
|
37
|
+
'47b4eb',
|
|
38
|
+
'4799eb',
|
|
39
|
+
'477eeb',
|
|
40
|
+
'4762eb',
|
|
41
|
+
'4747eb',
|
|
42
|
+
'6247eb',
|
|
43
|
+
'7e47eb',
|
|
44
|
+
'9947eb',
|
|
45
|
+
'b447eb',
|
|
46
|
+
'd047eb',
|
|
47
|
+
'eb47eb',
|
|
48
|
+
'eb47d0',
|
|
49
|
+
'eb4799',
|
|
50
|
+
'eb477e',
|
|
51
|
+
'eb4762',
|
|
52
|
+
],
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"g",
|
|
60
|
-
"r",
|
|
61
|
-
"a",
|
|
62
|
-
"d",
|
|
63
|
-
"i",
|
|
64
|
-
"e",
|
|
65
|
-
"n",
|
|
66
|
-
"t"
|
|
67
|
-
]
|
|
54
|
+
shape1: {
|
|
55
|
+
type: 'array',
|
|
56
|
+
items: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
enum: ['g', 'r', 'a', 'd', 'i', 'e', 'n', 't'],
|
|
68
59
|
},
|
|
69
|
-
|
|
70
|
-
"g",
|
|
71
|
-
"r",
|
|
72
|
-
"a",
|
|
73
|
-
"d",
|
|
74
|
-
"i",
|
|
75
|
-
"e",
|
|
76
|
-
"n",
|
|
77
|
-
"t"
|
|
78
|
-
]
|
|
60
|
+
default: ['g', 'r', 'a', 'd', 'i', 'e', 'n', 't'],
|
|
79
61
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
62
|
+
shape1OffsetX: {
|
|
63
|
+
type: 'array',
|
|
64
|
+
items: {
|
|
65
|
+
type: 'integer',
|
|
66
|
+
minimum: -80,
|
|
67
|
+
maximum: 80,
|
|
86
68
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-80,
|
|
90
|
-
80
|
|
91
|
-
]
|
|
69
|
+
maxItems: 2,
|
|
70
|
+
default: [-80, 80],
|
|
92
71
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
shape1OffsetY: {
|
|
73
|
+
type: 'array',
|
|
74
|
+
items: {
|
|
75
|
+
type: 'integer',
|
|
76
|
+
minimum: -80,
|
|
77
|
+
maximum: 80,
|
|
99
78
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-80,
|
|
103
|
-
80
|
|
104
|
-
]
|
|
79
|
+
maxItems: 2,
|
|
80
|
+
default: [-80, 80],
|
|
105
81
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
82
|
+
shape1Rotation: {
|
|
83
|
+
type: 'array',
|
|
84
|
+
items: {
|
|
85
|
+
type: 'integer',
|
|
86
|
+
minimum: -180,
|
|
87
|
+
maximum: 180,
|
|
112
88
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-180,
|
|
116
|
-
180
|
|
117
|
-
]
|
|
89
|
+
maxItems: 2,
|
|
90
|
+
default: [-180, 180],
|
|
118
91
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"g",
|
|
125
|
-
"r",
|
|
126
|
-
"a",
|
|
127
|
-
"d",
|
|
128
|
-
"i",
|
|
129
|
-
"e",
|
|
130
|
-
"n",
|
|
131
|
-
"t"
|
|
132
|
-
]
|
|
92
|
+
shape2: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
items: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
enum: ['g', 'r', 'a', 'd', 'i', 'e', 'n', 't'],
|
|
133
97
|
},
|
|
134
|
-
|
|
135
|
-
"g",
|
|
136
|
-
"r",
|
|
137
|
-
"a",
|
|
138
|
-
"d",
|
|
139
|
-
"i",
|
|
140
|
-
"e",
|
|
141
|
-
"n",
|
|
142
|
-
"t"
|
|
143
|
-
]
|
|
98
|
+
default: ['g', 'r', 'a', 'd', 'i', 'e', 'n', 't'],
|
|
144
99
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
100
|
+
shape2OffsetX: {
|
|
101
|
+
type: 'array',
|
|
102
|
+
items: {
|
|
103
|
+
type: 'integer',
|
|
104
|
+
minimum: -80,
|
|
105
|
+
maximum: 80,
|
|
151
106
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
-80,
|
|
155
|
-
80
|
|
156
|
-
]
|
|
107
|
+
maxItems: 2,
|
|
108
|
+
default: [-80, 80],
|
|
157
109
|
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
110
|
+
shape2OffsetY: {
|
|
111
|
+
type: 'array',
|
|
112
|
+
items: {
|
|
113
|
+
type: 'integer',
|
|
114
|
+
minimum: -80,
|
|
115
|
+
maximum: 80,
|
|
164
116
|
},
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-80,
|
|
168
|
-
80
|
|
169
|
-
]
|
|
117
|
+
maxItems: 2,
|
|
118
|
+
default: [-80, 80],
|
|
170
119
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
120
|
+
shape2Rotation: {
|
|
121
|
+
type: 'array',
|
|
122
|
+
items: {
|
|
123
|
+
type: 'integer',
|
|
124
|
+
minimum: -160,
|
|
125
|
+
maximum: 160,
|
|
177
126
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
}
|
|
127
|
+
maxItems: 2,
|
|
128
|
+
default: [-160, 160],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
185
131
|
};
|
package/lib/utils/getColors.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* File: https://www.figma.com/design/MbbQiNEkuiiLZSbZuPzyVD
|
|
6
6
|
*/
|
|
7
7
|
import { pickComponent } from './pickComponent.js';
|
|
8
|
-
export function getComponents({ prng, options }) {
|
|
8
|
+
export function getComponents({ prng, options, }) {
|
|
9
9
|
var _a, _b, _c, _d, _e, _f;
|
|
10
10
|
const shape2Component = pickComponent({
|
|
11
11
|
prng,
|
|
@@ -28,8 +28,7 @@ export function getComponents({ prng, options }) {
|
|
|
28
28
|
offsetY: ((_f = options.shape1OffsetY) === null || _f === void 0 ? void 0 : _f.length) ? options.shape1OffsetY : [0],
|
|
29
29
|
});
|
|
30
30
|
return {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
shape2: shape2Component,
|
|
32
|
+
shape1: shape1Component,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
;
|
|
@@ -16,5 +16,5 @@ type Props = {
|
|
|
16
16
|
offsetX: number[];
|
|
17
17
|
offsetY: number[];
|
|
18
18
|
};
|
|
19
|
-
export declare function pickComponent({ prng, group, width, height, values, rotation, offsetX, offsetY }: Props): ComponentPick;
|
|
19
|
+
export declare function pickComponent({ prng, group, width, height, values, rotation, offsetX, offsetY, }: Props): ComponentPick;
|
|
20
20
|
export {};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* File: https://www.figma.com/design/MbbQiNEkuiiLZSbZuPzyVD
|
|
6
6
|
*/
|
|
7
7
|
import * as components from '../components/index.js';
|
|
8
|
-
export function pickComponent({ prng, group, width, height, values = [], rotation, offsetX, offsetY }) {
|
|
8
|
+
export function pickComponent({ prng, group, width, height, values = [], rotation, offsetX, offsetY, }) {
|
|
9
9
|
const componentCollection = components;
|
|
10
10
|
const key = prng.pick(values);
|
|
11
11
|
const pickedRotation = prng.integer(Math.min(...rotation), Math.max(...rotation));
|
|
@@ -18,7 +18,7 @@ export function pickComponent({ prng, group, width, height, values = [], rotatio
|
|
|
18
18
|
var _a, _b, _c;
|
|
19
19
|
let result = componentCollection[group][key](components, colors);
|
|
20
20
|
if (this.rotation || this.offsetX || this.offsetY) {
|
|
21
|
-
result = `<g transform="translate(${(
|
|
21
|
+
result = `<g transform="translate(${(_a = this.offsetX) !== null && _a !== void 0 ? _a : 0}, ${(_b = this.offsetY) !== null && _b !== void 0 ? _b : 0}) rotate(${(_c = this.rotation) !== null && _c !== void 0 ? _c : 0} ${width / 2} ${height / 2})">${result}</g>`;
|
|
22
22
|
}
|
|
23
23
|
return result;
|
|
24
24
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dicebear/glass",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.4",
|
|
4
4
|
"description": "Avatar style for DiceBear",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dicebear"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"test": "uvu tests"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@dicebear/core": "9.2.
|
|
33
|
-
"@tsconfig/recommended": "^1.0.
|
|
34
|
-
"del-cli": "^
|
|
35
|
-
"typescript": "^5.
|
|
32
|
+
"@dicebear/core": "9.2.4",
|
|
33
|
+
"@tsconfig/recommended": "^1.0.10",
|
|
34
|
+
"del-cli": "^6.0.0",
|
|
35
|
+
"typescript": "^5.8.3",
|
|
36
36
|
"uvu": "^0.5.6"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "b19e1a8e417d6cdaffbc46ca6dee3522bb266b29"
|
|
48
48
|
}
|