@ideare/kit 0.0.0-stage → 0.1.0-next.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/LICENSE +21 -0
- package/README.md +148 -2
- package/THIRD_PARTY.md +52 -0
- package/dist/brand/schema.d.ts +265 -0
- package/dist/brand/schema.js +271 -0
- package/dist/check/copy.d.ts +27 -0
- package/dist/check/copy.js +139 -0
- package/dist/check/index.d.ts +54 -0
- package/dist/check/index.js +492 -0
- package/dist/color/contrast.d.ts +41 -0
- package/dist/color/contrast.js +84 -0
- package/dist/color/palette.d.ts +27 -0
- package/dist/color/palette.js +114 -0
- package/dist/color/wcag.d.ts +22 -0
- package/dist/color/wcag.js +50 -0
- package/dist/draft/draft.d.ts +61 -0
- package/dist/draft/draft.js +383 -0
- package/dist/editor/history.d.ts +78 -0
- package/dist/editor/history.js +221 -0
- package/dist/editor/operations.d.ts +112 -0
- package/dist/editor/operations.js +621 -0
- package/dist/files/docs.d.ts +49 -0
- package/dist/files/docs.js +392 -0
- package/dist/files/generate.d.ts +47 -0
- package/dist/files/generate.js +254 -0
- package/dist/files/png.d.ts +40 -0
- package/dist/files/png.js +168 -0
- package/dist/files/raster.d.ts +14 -0
- package/dist/files/raster.js +0 -0
- package/dist/files/templates.d.ts +162 -0
- package/dist/files/templates.js +390 -0
- package/dist/files/tokens.d.ts +22 -0
- package/dist/files/tokens.js +204 -0
- package/dist/fonts/catalog.d.ts +3 -0
- package/dist/fonts/catalog.js +345 -0
- package/dist/fonts/ofl.d.ts +5 -0
- package/dist/fonts/ofl.js +5 -0
- package/dist/fonts/pick.d.ts +33 -0
- package/dist/fonts/pick.js +73 -0
- package/dist/imports/folder.d.ts +80 -0
- package/dist/imports/folder.js +124 -0
- package/dist/imports/unzip.d.ts +32 -0
- package/dist/imports/unzip.js +128 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +34 -0
- package/dist/marks/draw.d.ts +48 -0
- package/dist/marks/draw.js +149 -0
- package/dist/marks/icons.data.d.ts +5 -0
- package/dist/marks/icons.data.js +600 -0
- package/dist/marks/svg.d.ts +46 -0
- package/dist/marks/svg.js +341 -0
- package/dist/node/index.d.ts +13 -0
- package/dist/node/index.js +41 -0
- package/dist/posts/pix.d.ts +19 -0
- package/dist/posts/pix.js +49 -0
- package/dist/posts/templates.d.ts +45 -0
- package/dist/posts/templates.js +868 -0
- package/dist/resvg/index.d.ts +2 -0
- package/dist/resvg/index.js +22 -0
- package/dist/scene/brand-art.d.ts +49 -0
- package/dist/scene/brand-art.js +154 -0
- package/dist/scene/frame.d.ts +89 -0
- package/dist/scene/frame.js +213 -0
- package/dist/scene/grain.d.ts +7 -0
- package/dist/scene/grain.js +7 -0
- package/dist/scene/qr.d.ts +10 -0
- package/dist/scene/qr.js +359 -0
- package/dist/scene/render.d.ts +76 -0
- package/dist/scene/render.js +557 -0
- package/dist/scene/schema.d.ts +271 -0
- package/dist/scene/schema.js +257 -0
- package/dist/sign.d.ts +47 -0
- package/dist/sign.js +88 -0
- package/dist/text/engine.d.ts +128 -0
- package/dist/text/engine.js +245 -0
- package/dist/text/fonts.d.ts +56 -0
- package/dist/text/fonts.js +65 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/dist/wasm/index.d.ts +15 -0
- package/dist/wasm/index.js +46 -0
- package/package.json +78 -5
- package/schema/brand.v1.json +442 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/** 37 OFL families from Google Fonts, each with a latin subset for pt-BR and es. */
|
|
2
|
+
export const FONT_CATALOG = [
|
|
3
|
+
{
|
|
4
|
+
family: "Instrument Sans",
|
|
5
|
+
id: "instrument-sans",
|
|
6
|
+
version: "5.3.0",
|
|
7
|
+
category: "sans-serif",
|
|
8
|
+
weights: [400, 500, 600, 700],
|
|
9
|
+
roles: ["display", "text"],
|
|
10
|
+
tags: { Business: 90, Calm: 80, Competent: 85, Loud: 54, Sincere: 63, Stiff: 54 },
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
family: "Funnel Sans",
|
|
14
|
+
id: "funnel-sans",
|
|
15
|
+
version: "5.3.0",
|
|
16
|
+
category: "sans-serif",
|
|
17
|
+
weights: [300, 400, 500, 600, 700, 800],
|
|
18
|
+
roles: ["display"],
|
|
19
|
+
tags: { Competent: 68 },
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
family: "Onest",
|
|
23
|
+
id: "onest",
|
|
24
|
+
version: "5.3.1",
|
|
25
|
+
category: "sans-serif",
|
|
26
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
27
|
+
roles: ["display", "text"],
|
|
28
|
+
tags: { Business: 55, Calm: 70, Competent: 62, Loud: 84 },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
family: "DM Sans",
|
|
32
|
+
id: "dm-sans",
|
|
33
|
+
version: "5.3.0",
|
|
34
|
+
category: "sans-serif",
|
|
35
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
36
|
+
roles: ["display", "text"],
|
|
37
|
+
tags: { Business: 77, Calm: 83, Loud: 81 },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
family: "Manrope",
|
|
41
|
+
id: "manrope",
|
|
42
|
+
version: "5.3.0",
|
|
43
|
+
category: "sans-serif",
|
|
44
|
+
weights: [200, 300, 400, 500, 600, 700, 800],
|
|
45
|
+
roles: ["display", "text"],
|
|
46
|
+
tags: { Business: 55, Calm: 75, Competent: 72, Rugged: 50 },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
family: "Plus Jakarta Sans",
|
|
50
|
+
id: "plus-jakarta-sans",
|
|
51
|
+
version: "5.3.0",
|
|
52
|
+
category: "sans-serif",
|
|
53
|
+
weights: [200, 300, 400, 500, 600, 700, 800],
|
|
54
|
+
roles: ["display", "text"],
|
|
55
|
+
tags: { Business: 60, Calm: 77, Competent: 73 },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
family: "Outfit",
|
|
59
|
+
id: "outfit",
|
|
60
|
+
version: "5.3.0",
|
|
61
|
+
category: "sans-serif",
|
|
62
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
63
|
+
roles: ["display", "text"],
|
|
64
|
+
tags: { Business: 59, Calm: 82, Competent: 70, Loud: 87 },
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
family: "Sora",
|
|
68
|
+
id: "sora",
|
|
69
|
+
version: "5.3.0",
|
|
70
|
+
category: "sans-serif",
|
|
71
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800],
|
|
72
|
+
roles: ["display", "text"],
|
|
73
|
+
tags: { Business: 60, Calm: 70, Competent: 74 },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
family: "Work Sans",
|
|
77
|
+
id: "work-sans",
|
|
78
|
+
version: "5.3.0",
|
|
79
|
+
category: "sans-serif",
|
|
80
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
81
|
+
roles: ["display", "text"],
|
|
82
|
+
tags: { Business: 70, Calm: 75, Competent: 89, Loud: 88, Vintage: 40 },
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
family: "Nunito",
|
|
86
|
+
id: "nunito",
|
|
87
|
+
version: "5.3.0",
|
|
88
|
+
category: "sans-serif",
|
|
89
|
+
weights: [200, 300, 400, 500, 600, 700, 800, 900],
|
|
90
|
+
roles: ["display", "text"],
|
|
91
|
+
tags: { Business: 70, Calm: 80, Competent: 70, Happy: 70, Loud: 84 },
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
family: "Karla",
|
|
95
|
+
id: "karla",
|
|
96
|
+
version: "5.3.0",
|
|
97
|
+
category: "sans-serif",
|
|
98
|
+
weights: [200, 300, 400, 500, 600, 700, 800],
|
|
99
|
+
roles: ["display", "text"],
|
|
100
|
+
tags: { Business: 80, Calm: 66, Competent: 69 },
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
family: "Public Sans",
|
|
104
|
+
id: "public-sans",
|
|
105
|
+
version: "5.3.0",
|
|
106
|
+
category: "sans-serif",
|
|
107
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
108
|
+
roles: ["display", "text"],
|
|
109
|
+
tags: { Business: 85, Calm: 70, Competent: 80, Loud: 86 },
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
family: "Albert Sans",
|
|
113
|
+
id: "albert-sans",
|
|
114
|
+
version: "5.3.0",
|
|
115
|
+
category: "sans-serif",
|
|
116
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
117
|
+
roles: ["display", "text"],
|
|
118
|
+
tags: { Business: 80, Calm: 66, Competent: 46, Loud: 85, Sincere: 50 },
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
family: "Hanken Grotesk",
|
|
122
|
+
id: "hanken-grotesk",
|
|
123
|
+
version: "5.3.0",
|
|
124
|
+
category: "sans-serif",
|
|
125
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
126
|
+
roles: ["display", "text"],
|
|
127
|
+
tags: { Business: 68, Calm: 70, Competent: 55, Loud: 80 },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
family: "Urbanist",
|
|
131
|
+
id: "urbanist",
|
|
132
|
+
version: "5.3.0",
|
|
133
|
+
category: "sans-serif",
|
|
134
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
135
|
+
roles: ["display", "text"],
|
|
136
|
+
tags: { Business: 59, Calm: 70, Competent: 56, Loud: 82, Vintage: 40 },
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
family: "Be Vietnam Pro",
|
|
140
|
+
id: "be-vietnam-pro",
|
|
141
|
+
version: "5.3.0",
|
|
142
|
+
category: "sans-serif",
|
|
143
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
144
|
+
roles: ["display", "text"],
|
|
145
|
+
tags: { Business: 55, Calm: 83, Rugged: 40 },
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
family: "Poppins",
|
|
149
|
+
id: "poppins",
|
|
150
|
+
version: "5.3.0",
|
|
151
|
+
category: "sans-serif",
|
|
152
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
153
|
+
roles: ["display", "text"],
|
|
154
|
+
tags: { Business: 60, Calm: 85, Competent: 40, Rugged: 50, Sincere: 50 },
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
family: "Literata",
|
|
158
|
+
id: "literata",
|
|
159
|
+
version: "5.3.0",
|
|
160
|
+
category: "serif",
|
|
161
|
+
weights: [200, 300, 400, 500, 600, 700, 800, 900],
|
|
162
|
+
roles: ["display", "text"],
|
|
163
|
+
tags: { Business: 75, Competent: 70, Loud: 86, Rugged: 45, Sincere: 45 },
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
family: "Newsreader",
|
|
167
|
+
id: "newsreader",
|
|
168
|
+
version: "5.3.0",
|
|
169
|
+
category: "serif",
|
|
170
|
+
weights: [200, 300, 400, 500, 600, 700, 800],
|
|
171
|
+
roles: ["display", "text"],
|
|
172
|
+
tags: { Business: 75, Competent: 83, Fancy: 66, Sincere: 64 },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
family: "Libre Baskerville",
|
|
176
|
+
id: "libre-baskerville",
|
|
177
|
+
version: "5.3.0",
|
|
178
|
+
category: "serif",
|
|
179
|
+
weights: [400, 500, 600, 700],
|
|
180
|
+
roles: ["display", "text"],
|
|
181
|
+
tags: { Business: 75, Calm: 60, Competent: 84, Sincere: 50, Vintage: 85 },
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
family: "Fraunces",
|
|
185
|
+
id: "fraunces",
|
|
186
|
+
version: "5.3.0",
|
|
187
|
+
category: "serif",
|
|
188
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
189
|
+
roles: ["display"],
|
|
190
|
+
tags: { Happy: 45, Loud: 82, Vintage: 60 },
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
family: "Gloock",
|
|
194
|
+
id: "gloock",
|
|
195
|
+
version: "5.3.0",
|
|
196
|
+
category: "serif",
|
|
197
|
+
weights: [400],
|
|
198
|
+
roles: ["display"],
|
|
199
|
+
tags: { Rugged: 58, Vintage: 60 },
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
family: "Instrument Serif",
|
|
203
|
+
id: "instrument-serif",
|
|
204
|
+
version: "5.3.0",
|
|
205
|
+
category: "serif",
|
|
206
|
+
weights: [400],
|
|
207
|
+
roles: ["display"],
|
|
208
|
+
tags: { Business: 55, Sincere: 67, Vintage: 80 },
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
family: "Bodoni Moda",
|
|
212
|
+
id: "bodoni-moda",
|
|
213
|
+
version: "5.3.0",
|
|
214
|
+
category: "serif",
|
|
215
|
+
weights: [400, 500, 600, 700, 800, 900],
|
|
216
|
+
roles: ["display"],
|
|
217
|
+
tags: { Business: 60, Calm: 50, Fancy: 80, Loud: 58, Sincere: 76, Vintage: 70 },
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
family: "EB Garamond",
|
|
221
|
+
id: "eb-garamond",
|
|
222
|
+
version: "5.3.0",
|
|
223
|
+
category: "serif",
|
|
224
|
+
weights: [400, 500, 600, 700, 800],
|
|
225
|
+
roles: ["display", "text"],
|
|
226
|
+
tags: { Business: 81, Calm: 60, Competent: 79, Sincere: 80, Vintage: 84 },
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
family: "Bebas Neue",
|
|
230
|
+
id: "bebas-neue",
|
|
231
|
+
version: "5.3.0",
|
|
232
|
+
category: "sans-serif",
|
|
233
|
+
weights: [400],
|
|
234
|
+
roles: ["display"],
|
|
235
|
+
tags: { Rugged: 65, Vintage: 40 },
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
family: "Anton",
|
|
239
|
+
id: "anton",
|
|
240
|
+
version: "5.3.0",
|
|
241
|
+
category: "sans-serif",
|
|
242
|
+
weights: [400],
|
|
243
|
+
roles: ["display"],
|
|
244
|
+
tags: { Loud: 80, Rugged: 69, Vintage: 40 },
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
family: "Pacifico",
|
|
248
|
+
id: "pacifico",
|
|
249
|
+
version: "5.3.0",
|
|
250
|
+
category: "handwriting",
|
|
251
|
+
weights: [400],
|
|
252
|
+
roles: ["display"],
|
|
253
|
+
tags: { Artistic: 61, Childlike: 40, Cute: 40, Loud: 50, Playful: 50, Vintage: 64 },
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
family: "Fredoka",
|
|
257
|
+
id: "fredoka",
|
|
258
|
+
version: "5.3.0",
|
|
259
|
+
category: "sans-serif",
|
|
260
|
+
weights: [300, 400, 500, 600, 700],
|
|
261
|
+
roles: ["display", "text"],
|
|
262
|
+
tags: {
|
|
263
|
+
Active: 42,
|
|
264
|
+
Calm: 72,
|
|
265
|
+
Childlike: 50,
|
|
266
|
+
Competent: 65,
|
|
267
|
+
Cute: 52,
|
|
268
|
+
Happy: 58,
|
|
269
|
+
Loud: 78,
|
|
270
|
+
Playful: 75,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
family: "Baloo 2",
|
|
275
|
+
id: "baloo-2",
|
|
276
|
+
version: "5.3.0",
|
|
277
|
+
category: "display",
|
|
278
|
+
weights: [400, 500, 600, 700, 800],
|
|
279
|
+
roles: ["display"],
|
|
280
|
+
tags: { Business: 60, Calm: 56, Competent: 60, Rugged: 45 },
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
family: "Syne",
|
|
284
|
+
id: "syne",
|
|
285
|
+
version: "5.3.0",
|
|
286
|
+
category: "sans-serif",
|
|
287
|
+
weights: [400, 500, 600, 700, 800],
|
|
288
|
+
roles: ["display"],
|
|
289
|
+
tags: { Awkward: 50, Business: 60, Competent: 46, Excited: 40, Rugged: 90, Stiff: 60 },
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
family: "Calistoga",
|
|
293
|
+
id: "calistoga",
|
|
294
|
+
version: "5.3.0",
|
|
295
|
+
category: "display",
|
|
296
|
+
weights: [400],
|
|
297
|
+
roles: ["display"],
|
|
298
|
+
tags: { Rugged: 70, Sincere: 78, Vintage: 40 },
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
family: "Shrikhand",
|
|
302
|
+
id: "shrikhand",
|
|
303
|
+
version: "5.3.0",
|
|
304
|
+
category: "display",
|
|
305
|
+
weights: [400],
|
|
306
|
+
roles: ["display"],
|
|
307
|
+
tags: { Active: 75, Cute: 52, Loud: 84, Rugged: 65, Vintage: 70 },
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
family: "Titan One",
|
|
311
|
+
id: "titan-one",
|
|
312
|
+
version: "5.3.0",
|
|
313
|
+
category: "display",
|
|
314
|
+
weights: [400],
|
|
315
|
+
roles: ["display"],
|
|
316
|
+
tags: { Cute: 40, Loud: 87, Rugged: 70, Vintage: 44 },
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
family: "Grandstander",
|
|
320
|
+
id: "grandstander",
|
|
321
|
+
version: "5.3.0",
|
|
322
|
+
category: "display",
|
|
323
|
+
weights: [100, 200, 300, 400, 500, 600, 700, 800, 900],
|
|
324
|
+
roles: ["display"],
|
|
325
|
+
tags: { Childlike: 80, Happy: 88, Loud: 87, Playful: 57, Sincere: 45, Vintage: 60 },
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
family: "Caprasimo",
|
|
329
|
+
id: "caprasimo",
|
|
330
|
+
version: "5.3.0",
|
|
331
|
+
category: "display",
|
|
332
|
+
weights: [400],
|
|
333
|
+
roles: ["display"],
|
|
334
|
+
tags: { Cute: 54, Loud: 79, Rugged: 58, Sincere: 76, Vintage: 62 },
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
family: "Funnel Display",
|
|
338
|
+
id: "funnel-display",
|
|
339
|
+
version: "5.3.0",
|
|
340
|
+
category: "display",
|
|
341
|
+
weights: [300, 400, 500, 600, 700, 800],
|
|
342
|
+
roles: ["display"],
|
|
343
|
+
tags: { Competent: 42, Futuristic: 45 },
|
|
344
|
+
},
|
|
345
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SIL Open Font License 1.1, as Google Fonts ships it under each family's copyright line.
|
|
3
|
+
* fonts.css and the font zip carry it, because OFL fonts must travel with their license (OFL 2).
|
|
4
|
+
*/
|
|
5
|
+
export declare const OFL_TEXT = "This Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttps://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded,\nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SIL Open Font License 1.1, as Google Fonts ships it under each family's copyright line.
|
|
3
|
+
* fonts.css and the font zip carry it, because OFL fonts must travel with their license (OFL 2).
|
|
4
|
+
*/
|
|
5
|
+
export const OFL_TEXT = 'This Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttps://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded,\nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n"Font Software" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n"Reserved Font Name" refers to any names specified as such after the\ncopyright statement(s).\n\n"Original Version" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n"Modified Version" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n"Author" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FontRole } from "../brand/schema.ts";
|
|
2
|
+
/** google/fonts' expressive tags, scored 0 to 100 per family. */
|
|
3
|
+
export declare const FONT_TAGS: readonly ["Active", "Artistic", "Awkward", "Business", "Calm", "Childlike", "Competent", "Cute", "Excited", "Fancy", "Futuristic", "Happy", "Innovative", "Loud", "Playful", "Rugged", "Sincere", "Sophisticated", "Stiff", "Vintage"];
|
|
4
|
+
export type FontTag = (typeof FONT_TAGS)[number];
|
|
5
|
+
export type CatalogFont = {
|
|
6
|
+
family: string;
|
|
7
|
+
/** The Fontsource id. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** The Fontsource release the kit pins, so a brand always draws with the same bytes. */
|
|
10
|
+
version: string;
|
|
11
|
+
category: string;
|
|
12
|
+
/** Static weights Fontsource serves as TTF. */
|
|
13
|
+
weights: number[];
|
|
14
|
+
roles: FontRole[];
|
|
15
|
+
tags: Partial<Record<FontTag, number>>;
|
|
16
|
+
};
|
|
17
|
+
/** Fontsource versions for every catalog family, for fetchFontResolver's `versions`. */
|
|
18
|
+
export declare function catalogVersions(): Record<string, string>;
|
|
19
|
+
export declare function catalogFont(id: string): CatalogFont | undefined;
|
|
20
|
+
/** The nearest available static weight, for a role that asks for, say, 800 on a 700 family. */
|
|
21
|
+
export declare function nearestWeight(font: {
|
|
22
|
+
weights: number[];
|
|
23
|
+
}, wanted: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* A display and a text family for a voice, as tags (the AI text step suggests them, or the
|
|
26
|
+
* studio maps the owner's words). `variant` walks down the ranking for "Try another", and the
|
|
27
|
+
* text face is chosen to read well (Business, Competent, Calm) and to differ from the display
|
|
28
|
+
* face in category, which is how pairs stay clear apart.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pickFonts(tags: readonly FontTag[], variant?: number): {
|
|
31
|
+
display: CatalogFont;
|
|
32
|
+
text: CatalogFont;
|
|
33
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { FONT_CATALOG } from "./catalog.js";
|
|
2
|
+
/** google/fonts' expressive tags, scored 0 to 100 per family. */
|
|
3
|
+
export const FONT_TAGS = [
|
|
4
|
+
"Active",
|
|
5
|
+
"Artistic",
|
|
6
|
+
"Awkward",
|
|
7
|
+
"Business",
|
|
8
|
+
"Calm",
|
|
9
|
+
"Childlike",
|
|
10
|
+
"Competent",
|
|
11
|
+
"Cute",
|
|
12
|
+
"Excited",
|
|
13
|
+
"Fancy",
|
|
14
|
+
"Futuristic",
|
|
15
|
+
"Happy",
|
|
16
|
+
"Innovative",
|
|
17
|
+
"Loud",
|
|
18
|
+
"Playful",
|
|
19
|
+
"Rugged",
|
|
20
|
+
"Sincere",
|
|
21
|
+
"Sophisticated",
|
|
22
|
+
"Stiff",
|
|
23
|
+
"Vintage",
|
|
24
|
+
];
|
|
25
|
+
/** Fontsource versions for every catalog family, for fetchFontResolver's `versions`. */
|
|
26
|
+
export function catalogVersions() {
|
|
27
|
+
return Object.fromEntries(FONT_CATALOG.map((font) => [font.id, font.version]));
|
|
28
|
+
}
|
|
29
|
+
export function catalogFont(id) {
|
|
30
|
+
return FONT_CATALOG.find((font) => font.id === id);
|
|
31
|
+
}
|
|
32
|
+
function score(font, tags) {
|
|
33
|
+
if (tags.length === 0)
|
|
34
|
+
return 0;
|
|
35
|
+
return tags.reduce((sum, tag) => sum + (font.tags[tag] ?? 0), 0) / tags.length;
|
|
36
|
+
}
|
|
37
|
+
/** The nearest available static weight, for a role that asks for, say, 800 on a 700 family. */
|
|
38
|
+
export function nearestWeight(font, wanted) {
|
|
39
|
+
return ([...font.weights].sort((a, b) => Math.abs(a - wanted) - Math.abs(b - wanted) || b - a)[0] ??
|
|
40
|
+
400);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A display and a text family for a voice, as tags (the AI text step suggests them, or the
|
|
44
|
+
* studio maps the owner's words). `variant` walks down the ranking for "Try another", and the
|
|
45
|
+
* text face is chosen to read well (Business, Competent, Calm) and to differ from the display
|
|
46
|
+
* face in category, which is how pairs stay clear apart.
|
|
47
|
+
*/
|
|
48
|
+
export function pickFonts(tags, variant = 0) {
|
|
49
|
+
const displays = FONT_CATALOG.filter((font) => font.roles.includes("display"))
|
|
50
|
+
.map((font) => ({ font, rank: score(font, tags) }))
|
|
51
|
+
.sort((a, b) => b.rank - a.rank || a.font.id.localeCompare(b.font.id));
|
|
52
|
+
const display = displays[variant % displays.length]?.font ?? FONT_CATALOG[0];
|
|
53
|
+
if (!display)
|
|
54
|
+
throw new Error("The font catalog is empty");
|
|
55
|
+
const reading = ["Business", "Competent", "Calm"];
|
|
56
|
+
const texts = FONT_CATALOG.filter((font) => font.roles.includes("text"))
|
|
57
|
+
.map((font) => {
|
|
58
|
+
const sameFamily = font.id === display.id;
|
|
59
|
+
const sameCategory = font.category === display.category;
|
|
60
|
+
// One family can do both jobs when it is a reading face; otherwise contrast them.
|
|
61
|
+
const pairing = sameFamily
|
|
62
|
+
? display.roles.includes("text")
|
|
63
|
+
? 5
|
|
64
|
+
: -100
|
|
65
|
+
: sameCategory
|
|
66
|
+
? -10
|
|
67
|
+
: 10;
|
|
68
|
+
return { font, rank: score(font, reading) + score(font, tags) / 2 + pairing };
|
|
69
|
+
})
|
|
70
|
+
.sort((a, b) => b.rank - a.rank || a.font.id.localeCompare(b.font.id));
|
|
71
|
+
const text = texts[Math.floor(variant / displays.length) % texts.length]?.font ?? display;
|
|
72
|
+
return { display, text };
|
|
73
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which files of a brand folder or zip ideare reads. The studio and the CLI ask the same
|
|
3
|
+
* question before anything is sent, so both send the same files and skip the same ones, each
|
|
4
|
+
* with its reason: files the computer made (`__MACOSX`, `.DS_Store`, `Thumbs.db`), hidden files,
|
|
5
|
+
* types ideare can't read, empty files, and anything past the limits.
|
|
6
|
+
*/
|
|
7
|
+
export declare const IMPORT_LIMITS: {
|
|
8
|
+
/** Files sent from one folder or zip. */
|
|
9
|
+
readonly files: 200;
|
|
10
|
+
/** Bytes of all of them together. */
|
|
11
|
+
readonly totalBytes: number;
|
|
12
|
+
/** Bytes of one file. */
|
|
13
|
+
readonly fileBytes: number;
|
|
14
|
+
};
|
|
15
|
+
/** What each file ending is sent as. The type is what the upload signs; the server still reads
|
|
16
|
+
* the bytes to know what a file really is. */
|
|
17
|
+
declare const TYPES: {
|
|
18
|
+
readonly png: "image/png";
|
|
19
|
+
readonly jpg: "image/jpeg";
|
|
20
|
+
readonly jpeg: "image/jpeg";
|
|
21
|
+
readonly webp: "image/webp";
|
|
22
|
+
readonly svg: "image/svg+xml";
|
|
23
|
+
readonly heic: "image/heic";
|
|
24
|
+
readonly heif: "image/heif";
|
|
25
|
+
readonly ttf: "font/ttf";
|
|
26
|
+
readonly otf: "font/otf";
|
|
27
|
+
readonly woff: "font/woff";
|
|
28
|
+
readonly woff2: "font/woff2";
|
|
29
|
+
readonly pdf: "application/pdf";
|
|
30
|
+
};
|
|
31
|
+
export type ImportMime = (typeof TYPES)[keyof typeof TYPES];
|
|
32
|
+
/** Every type a folder import sends. */
|
|
33
|
+
export declare const IMPORT_MIMES: readonly ImportMime[];
|
|
34
|
+
export type ImportSkipReason =
|
|
35
|
+
/** Made by the computer, not the owner. */
|
|
36
|
+
"system"
|
|
37
|
+
/** A hidden file or folder (its name starts with a dot). */
|
|
38
|
+
| "hidden"
|
|
39
|
+
/** A type ideare can't read, like .ai, .psd or .mp4. `ext` says which. */
|
|
40
|
+
| "type" | "empty"
|
|
41
|
+
/** Over IMPORT_LIMITS.fileBytes. */
|
|
42
|
+
| "tooBig"
|
|
43
|
+
/** Past IMPORT_LIMITS.files. */
|
|
44
|
+
| "tooMany"
|
|
45
|
+
/** Past IMPORT_LIMITS.totalBytes. */
|
|
46
|
+
| "tooMuch"
|
|
47
|
+
/** A damaged or password-locked file inside a zip. */
|
|
48
|
+
| "unreadable";
|
|
49
|
+
export type ImportEntry = {
|
|
50
|
+
path: string;
|
|
51
|
+
size: number;
|
|
52
|
+
};
|
|
53
|
+
export type ImportCheck = {
|
|
54
|
+
ok: true;
|
|
55
|
+
mime: ImportMime;
|
|
56
|
+
} | {
|
|
57
|
+
ok: false;
|
|
58
|
+
reason: ImportSkipReason;
|
|
59
|
+
ext?: string;
|
|
60
|
+
};
|
|
61
|
+
export type ImportPlan<T extends ImportEntry> = {
|
|
62
|
+
send: (T & {
|
|
63
|
+
mime: ImportMime;
|
|
64
|
+
})[];
|
|
65
|
+
skipped: (T & {
|
|
66
|
+
reason: ImportSkipReason;
|
|
67
|
+
ext?: string;
|
|
68
|
+
})[];
|
|
69
|
+
};
|
|
70
|
+
/** A path as a zip or a folder gives it, with forward slashes and no leading `./` or `/`. */
|
|
71
|
+
export declare function importPath(raw: string): string;
|
|
72
|
+
/** One file on its own: read it, or why not. The count and total limits are planImport's. */
|
|
73
|
+
export declare function checkImportEntry(path: string, size: number): ImportCheck;
|
|
74
|
+
/**
|
|
75
|
+
* Every file of a folder sorted into what to send and what to skip, with the limits held: at most
|
|
76
|
+
* IMPORT_LIMITS.files files and IMPORT_LIMITS.totalBytes in all. The same files always give the
|
|
77
|
+
* same plan, whatever order the folder listed them in.
|
|
78
|
+
*/
|
|
79
|
+
export declare function planImport<T extends ImportEntry>(entries: readonly T[]): ImportPlan<T>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which files of a brand folder or zip ideare reads. The studio and the CLI ask the same
|
|
3
|
+
* question before anything is sent, so both send the same files and skip the same ones, each
|
|
4
|
+
* with its reason: files the computer made (`__MACOSX`, `.DS_Store`, `Thumbs.db`), hidden files,
|
|
5
|
+
* types ideare can't read, empty files, and anything past the limits.
|
|
6
|
+
*/
|
|
7
|
+
export const IMPORT_LIMITS = {
|
|
8
|
+
/** Files sent from one folder or zip. */
|
|
9
|
+
files: 200,
|
|
10
|
+
/** Bytes of all of them together. */
|
|
11
|
+
totalBytes: 200 * 1024 * 1024,
|
|
12
|
+
/** Bytes of one file. */
|
|
13
|
+
fileBytes: 25 * 1024 * 1024,
|
|
14
|
+
};
|
|
15
|
+
/** What each file ending is sent as. The type is what the upload signs; the server still reads
|
|
16
|
+
* the bytes to know what a file really is. */
|
|
17
|
+
const TYPES = {
|
|
18
|
+
png: "image/png",
|
|
19
|
+
jpg: "image/jpeg",
|
|
20
|
+
jpeg: "image/jpeg",
|
|
21
|
+
webp: "image/webp",
|
|
22
|
+
svg: "image/svg+xml",
|
|
23
|
+
heic: "image/heic",
|
|
24
|
+
heif: "image/heif",
|
|
25
|
+
ttf: "font/ttf",
|
|
26
|
+
otf: "font/otf",
|
|
27
|
+
woff: "font/woff",
|
|
28
|
+
woff2: "font/woff2",
|
|
29
|
+
pdf: "application/pdf",
|
|
30
|
+
};
|
|
31
|
+
/** Every type a folder import sends. */
|
|
32
|
+
export const IMPORT_MIMES = [...new Set(Object.values(TYPES))];
|
|
33
|
+
/** Files a computer makes on its own, never the owner's: macOS resource forks, folder settings
|
|
34
|
+
* and indexes, Windows thumbnails. */
|
|
35
|
+
const SYSTEM_PARTS = new Set([
|
|
36
|
+
"__macosx",
|
|
37
|
+
".ds_store",
|
|
38
|
+
"thumbs.db",
|
|
39
|
+
"ehthumbs.db",
|
|
40
|
+
"desktop.ini",
|
|
41
|
+
"icon\r",
|
|
42
|
+
".spotlight-v100",
|
|
43
|
+
".trashes",
|
|
44
|
+
".fseventsd",
|
|
45
|
+
".localized",
|
|
46
|
+
]);
|
|
47
|
+
/** A path as a zip or a folder gives it, with forward slashes and no leading `./` or `/`. */
|
|
48
|
+
export function importPath(raw) {
|
|
49
|
+
return raw
|
|
50
|
+
.replace(/\\/g, "/")
|
|
51
|
+
.replace(/^(?:\.\/|\/)+/, "")
|
|
52
|
+
.replace(/\/{2,}/g, "/");
|
|
53
|
+
}
|
|
54
|
+
/** The ending after the last dot of the file's own name, lowercase, or "" when it has none. */
|
|
55
|
+
function extension(path) {
|
|
56
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
57
|
+
const dot = name.lastIndexOf(".");
|
|
58
|
+
return dot > 0 ? name.slice(dot + 1).toLowerCase() : "";
|
|
59
|
+
}
|
|
60
|
+
function isType(ext) {
|
|
61
|
+
return Object.hasOwn(TYPES, ext);
|
|
62
|
+
}
|
|
63
|
+
/** One file on its own: read it, or why not. The count and total limits are planImport's. */
|
|
64
|
+
export function checkImportEntry(path, size) {
|
|
65
|
+
const parts = importPath(path).split("/").filter(Boolean);
|
|
66
|
+
if (parts.some((part) => SYSTEM_PARTS.has(part.toLowerCase())))
|
|
67
|
+
return { ok: false, reason: "system" };
|
|
68
|
+
// macOS writes "._name" beside every file it copies to a disk that can't hold its extras.
|
|
69
|
+
if (parts.some((part) => part.startsWith(".")))
|
|
70
|
+
return { ok: false, reason: "hidden" };
|
|
71
|
+
const ext = extension(path);
|
|
72
|
+
if (!isType(ext))
|
|
73
|
+
return { ok: false, reason: "type", ...(ext ? { ext } : {}) };
|
|
74
|
+
if (size <= 0)
|
|
75
|
+
return { ok: false, reason: "empty" };
|
|
76
|
+
if (size > IMPORT_LIMITS.fileBytes)
|
|
77
|
+
return { ok: false, reason: "tooBig" };
|
|
78
|
+
return { ok: true, mime: TYPES[ext] };
|
|
79
|
+
}
|
|
80
|
+
/** The guide and the fonts first, then vectors, then pictures: when a folder holds more than the
|
|
81
|
+
* limits, what tells the most about the brand is what gets sent. */
|
|
82
|
+
function priority(mime) {
|
|
83
|
+
if (mime === "application/pdf")
|
|
84
|
+
return 0;
|
|
85
|
+
if (mime.startsWith("font/"))
|
|
86
|
+
return 1;
|
|
87
|
+
if (mime === "image/svg+xml")
|
|
88
|
+
return 2;
|
|
89
|
+
return 3;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Every file of a folder sorted into what to send and what to skip, with the limits held: at most
|
|
93
|
+
* IMPORT_LIMITS.files files and IMPORT_LIMITS.totalBytes in all. The same files always give the
|
|
94
|
+
* same plan, whatever order the folder listed them in.
|
|
95
|
+
*/
|
|
96
|
+
export function planImport(entries) {
|
|
97
|
+
const plan = { send: [], skipped: [] };
|
|
98
|
+
const readable = [];
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
const check = checkImportEntry(entry.path, entry.size);
|
|
101
|
+
if (check.ok)
|
|
102
|
+
readable.push({ ...entry, mime: check.mime });
|
|
103
|
+
else
|
|
104
|
+
plan.skipped.push({
|
|
105
|
+
...entry,
|
|
106
|
+
reason: check.reason,
|
|
107
|
+
...(check.ext ? { ext: check.ext } : {}),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
readable.sort((a, b) => priority(a.mime) - priority(b.mime) ||
|
|
111
|
+
importPath(a.path).localeCompare(importPath(b.path)));
|
|
112
|
+
let total = 0;
|
|
113
|
+
for (const entry of readable) {
|
|
114
|
+
if (plan.send.length >= IMPORT_LIMITS.files)
|
|
115
|
+
plan.skipped.push({ ...entry, reason: "tooMany" });
|
|
116
|
+
else if (total + entry.size > IMPORT_LIMITS.totalBytes)
|
|
117
|
+
plan.skipped.push({ ...entry, reason: "tooMuch" });
|
|
118
|
+
else {
|
|
119
|
+
total += entry.size;
|
|
120
|
+
plan.send.push(entry);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return plan;
|
|
124
|
+
}
|