Backed out 7 changesets (bug 1839993) for causing build bustages on DecoderTemplate...
[gecko.git] / browser / themes / BuiltInThemeConfig.sys.mjs
blob7cfea4b705a1338b1eb5c4f255808aeac4bdb819
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /**
6  * A Map of themes built in to the browser, alongwith a Map of collections those themes belong to. Params for the objects contained
7  * within the map:
8  *
9  * @param {string} id
10  *   The unique identifier for the theme. The map's key.
11  * @param {string} version
12  *   The theme add-on's semantic version, as defined in its manifest.
13  * @param {string} path
14  *   Path to the add-on files.
15  * @param {string} [expiry]
16  *  Date in YYYY-MM-DD format. Optional. If defined, the themes in the collection can no longer be
17  *  used after this date, unless the user has permission to retain it.
18  * @param {string} [collection]
19  *  The collection id that the theme is a part of. Optional.
20  */
21 export const BuiltInThemeConfig = new Map([
22   [
23     "firefox-compact-light@mozilla.org",
24     {
25       version: "1.2",
26       path: "resource://builtin-themes/light/",
27     },
28   ],
29   [
30     "firefox-compact-dark@mozilla.org",
31     {
32       version: "1.2",
33       path: "resource://builtin-themes/dark/",
34     },
35   ],
36   [
37     "firefox-alpenglow@mozilla.org",
38     {
39       version: "1.4",
40       path: "resource://builtin-themes/alpenglow/",
41     },
42   ],
43   [
44     "2022red-colorway@mozilla.org",
45     {
46       version: "1.1",
47       path: "resource://builtin-themes/colorways/2022red/",
48       collection: "true-colors",
49     },
50   ],
51   [
52     "2022orange-colorway@mozilla.org",
53     {
54       version: "1.1",
55       path: "resource://builtin-themes/colorways/2022orange/",
56       collection: "true-colors",
57     },
58   ],
59   [
60     "2022green-colorway@mozilla.org",
61     {
62       version: "1.1",
63       path: "resource://builtin-themes/colorways/2022green/",
64       collection: "true-colors",
65     },
66   ],
67   [
68     "2022yellow-colorway@mozilla.org",
69     {
70       version: "1.1",
71       path: "resource://builtin-themes/colorways/2022yellow/",
72       collection: "true-colors",
73     },
74   ],
75   [
76     "2022purple-colorway@mozilla.org",
77     {
78       version: "1.1",
79       path: "resource://builtin-themes/colorways/2022purple/",
80       collection: "true-colors",
81     },
82   ],
83   [
84     "2022blue-colorway@mozilla.org",
85     {
86       version: "1.1",
87       path: "resource://builtin-themes/colorways/2022blue/",
88       collection: "true-colors",
89     },
90   ],
91   [
92     "lush-soft-colorway@mozilla.org",
93     {
94       version: "1.1",
95       path: "resource://builtin-themes/colorways/2021lush/soft/",
96       collection: "life-in-color",
97     },
98   ],
99   [
100     "lush-balanced-colorway@mozilla.org",
101     {
102       version: "1.1",
103       path: "resource://builtin-themes/colorways/2021lush/balanced/",
104       collection: "life-in-color",
105     },
106   ],
107   [
108     "lush-bold-colorway@mozilla.org",
109     {
110       version: "1.1",
111       path: "resource://builtin-themes/colorways/2021lush/bold/",
112       collection: "life-in-color",
113     },
114   ],
115   [
116     "abstract-soft-colorway@mozilla.org",
117     {
118       version: "1.1",
119       path: "resource://builtin-themes/colorways/2021abstract/soft/",
120       collection: "life-in-color",
121     },
122   ],
123   [
124     "abstract-balanced-colorway@mozilla.org",
125     {
126       version: "1.1",
127       path: "resource://builtin-themes/colorways/2021abstract/balanced/",
128       collection: "life-in-color",
129     },
130   ],
131   [
132     "abstract-bold-colorway@mozilla.org",
133     {
134       version: "1.1",
135       path: "resource://builtin-themes/colorways/2021abstract/bold/",
136       collection: "life-in-color",
137     },
138   ],
139   [
140     "elemental-soft-colorway@mozilla.org",
141     {
142       version: "1.1",
143       path: "resource://builtin-themes/colorways/2021elemental/soft/",
144       collection: "life-in-color",
145     },
146   ],
147   [
148     "elemental-balanced-colorway@mozilla.org",
149     {
150       version: "1.1",
151       path: "resource://builtin-themes/colorways/2021elemental/balanced/",
152       collection: "life-in-color",
153     },
154   ],
155   [
156     "elemental-bold-colorway@mozilla.org",
157     {
158       version: "1.1",
159       path: "resource://builtin-themes/colorways/2021elemental/bold/",
160       collection: "life-in-color",
161     },
162   ],
163   [
164     "cheers-soft-colorway@mozilla.org",
165     {
166       version: "1.1",
167       path: "resource://builtin-themes/colorways/2021cheers/soft/",
168       collection: "life-in-color",
169     },
170   ],
171   [
172     "cheers-balanced-colorway@mozilla.org",
173     {
174       version: "1.1",
175       path: "resource://builtin-themes/colorways/2021cheers/balanced/",
176       collection: "life-in-color",
177     },
178   ],
179   [
180     "cheers-bold-colorway@mozilla.org",
181     {
182       version: "1.1",
183       path: "resource://builtin-themes/colorways/2021cheers/bold/",
184       collection: "life-in-color",
185     },
186   ],
187   [
188     "graffiti-soft-colorway@mozilla.org",
189     {
190       version: "1.1",
191       path: "resource://builtin-themes/colorways/2021graffiti/soft/",
192       collection: "life-in-color",
193     },
194   ],
195   [
196     "graffiti-balanced-colorway@mozilla.org",
197     {
198       version: "1.1",
199       path: "resource://builtin-themes/colorways/2021graffiti/balanced/",
200       collection: "life-in-color",
201     },
202   ],
203   [
204     "graffiti-bold-colorway@mozilla.org",
205     {
206       version: "1.1",
207       path: "resource://builtin-themes/colorways/2021graffiti/bold/",
208       collection: "life-in-color",
209     },
210   ],
211   [
212     "foto-soft-colorway@mozilla.org",
213     {
214       version: "1.1",
215       path: "resource://builtin-themes/colorways/2021foto/soft/",
216       collection: "life-in-color",
217     },
218   ],
219   [
220     "foto-balanced-colorway@mozilla.org",
221     {
222       version: "1.1",
223       path: "resource://builtin-themes/colorways/2021foto/balanced/",
224       collection: "life-in-color",
225     },
226   ],
227   [
228     "foto-bold-colorway@mozilla.org",
229     {
230       version: "1.1",
231       path: "resource://builtin-themes/colorways/2021foto/bold/",
232       collection: "life-in-color",
233     },
234   ],
235   [
236     "playmaker-soft-colorway@mozilla.org",
237     {
238       version: "1.1",
239       path: "resource://builtin-themes/colorways/2022playmaker/soft/",
240       collection: "independent-voices",
241       l10nId: {
242         description: "playmaker-colorway-description",
243         groupName: "playmaker-colorway-name",
244       },
245     },
246   ],
247   [
248     "playmaker-balanced-colorway@mozilla.org",
249     {
250       version: "1.1.2",
251       path: "resource://builtin-themes/colorways/2022playmaker/balanced/",
252       collection: "independent-voices",
253       l10nId: {
254         description: "playmaker-colorway-description",
255         groupName: "playmaker-colorway-name",
256       },
257     },
258   ],
259   [
260     "playmaker-bold-colorway@mozilla.org",
261     {
262       version: "1.1",
263       path: "resource://builtin-themes/colorways/2022playmaker/bold/",
264       collection: "independent-voices",
265       l10nId: {
266         description: "playmaker-colorway-description",
267         groupName: "playmaker-colorway-name",
268       },
269     },
270   ],
271   [
272     "expressionist-soft-colorway@mozilla.org",
273     {
274       version: "1.1",
275       path: "resource://builtin-themes/colorways/2022expressionist/soft/",
276       collection: "independent-voices",
277       l10nId: {
278         description: "expressionist-colorway-description",
279         groupName: "expressionist-colorway-name",
280       },
281     },
282   ],
283   [
284     "expressionist-balanced-colorway@mozilla.org",
285     {
286       version: "1.1",
287       path: "resource://builtin-themes/colorways/2022expressionist/balanced/",
288       collection: "independent-voices",
289       l10nId: {
290         description: "expressionist-colorway-description",
291         groupName: "expressionist-colorway-name",
292       },
293     },
294   ],
295   [
296     "expressionist-bold-colorway@mozilla.org",
297     {
298       version: "1.1",
299       path: "resource://builtin-themes/colorways/2022expressionist/bold/",
300       collection: "independent-voices",
301       l10nId: {
302         description: "expressionist-colorway-description",
303         groupName: "expressionist-colorway-name",
304       },
305     },
306   ],
307   [
308     "visionary-soft-colorway@mozilla.org",
309     {
310       version: "1.1",
311       path: "resource://builtin-themes/colorways/2022visionary/soft/",
312       collection: "independent-voices",
313       l10nId: {
314         description: "visionary-colorway-description",
315         groupName: "visionary-colorway-name",
316       },
317     },
318   ],
319   [
320     "visionary-balanced-colorway@mozilla.org",
321     {
322       version: "1.1.2",
323       path: "resource://builtin-themes/colorways/2022visionary/balanced/",
324       collection: "independent-voices",
325       l10nId: {
326         description: "visionary-colorway-description",
327         groupName: "visionary-colorway-name",
328       },
329     },
330   ],
331   [
332     "visionary-bold-colorway@mozilla.org",
333     {
334       version: "1.1",
335       path: "resource://builtin-themes/colorways/2022visionary/bold/",
336       collection: "independent-voices",
337       l10nId: {
338         description: "visionary-colorway-description",
339         groupName: "visionary-colorway-name",
340       },
341     },
342   ],
343   [
344     "activist-soft-colorway@mozilla.org",
345     {
346       version: "1.1",
347       path: "resource://builtin-themes/colorways/2022activist/soft/",
348       collection: "independent-voices",
349       l10nId: {
350         description: "activist-colorway-description",
351         groupName: "activist-colorway-name",
352       },
353     },
354   ],
355   [
356     "activist-balanced-colorway@mozilla.org",
357     {
358       version: "1.1.2",
359       path: "resource://builtin-themes/colorways/2022activist/balanced/",
360       collection: "independent-voices",
361       l10nId: {
362         description: "activist-colorway-description",
363         groupName: "activist-colorway-name",
364       },
365     },
366   ],
367   [
368     "activist-bold-colorway@mozilla.org",
369     {
370       version: "1.1.2",
371       path: "resource://builtin-themes/colorways/2022activist/bold/",
372       collection: "independent-voices",
373       l10nId: {
374         description: "activist-colorway-description",
375         groupName: "activist-colorway-name",
376       },
377     },
378   ],
379   [
380     "dreamer-soft-colorway@mozilla.org",
381     {
382       version: "1.1",
383       path: "resource://builtin-themes/colorways/2022dreamer/soft/",
384       collection: "independent-voices",
385       l10nId: {
386         description: "dreamer-colorway-description",
387         groupName: "dreamer-colorway-name",
388       },
389     },
390   ],
391   [
392     "dreamer-balanced-colorway@mozilla.org",
393     {
394       version: "1.1.2",
395       path: "resource://builtin-themes/colorways/2022dreamer/balanced/",
396       collection: "independent-voices",
397       l10nId: {
398         description: "dreamer-colorway-description",
399         groupName: "dreamer-colorway-name",
400       },
401     },
402   ],
403   [
404     "dreamer-bold-colorway@mozilla.org",
405     {
406       version: "1.1.1",
407       path: "resource://builtin-themes/colorways/2022dreamer/bold/",
408       collection: "independent-voices",
409       l10nId: {
410         description: "dreamer-colorway-description",
411         groupName: "dreamer-colorway-name",
412       },
413     },
414   ],
415   [
416     "innovator-soft-colorway@mozilla.org",
417     {
418       version: "1.1",
419       path: "resource://builtin-themes/colorways/2022innovator/soft/",
420       collection: "independent-voices",
421       l10nId: {
422         description: "innovator-colorway-description",
423         groupName: "innovator-colorway-name",
424       },
425     },
426   ],
427   [
428     "innovator-balanced-colorway@mozilla.org",
429     {
430       version: "1.1.1",
431       path: "resource://builtin-themes/colorways/2022innovator/balanced/",
432       collection: "independent-voices",
433       l10nId: {
434         description: "innovator-colorway-description",
435         groupName: "innovator-colorway-name",
436       },
437     },
438   ],
439   [
440     "innovator-bold-colorway@mozilla.org",
441     {
442       version: "1.1",
443       path: "resource://builtin-themes/colorways/2022innovator/bold/",
444       collection: "independent-voices",
445       l10nId: {
446         description: "innovator-colorway-description",
447         groupName: "innovator-colorway-name",
448       },
449     },
450   ],
453 const ColorwayCollections = [
454   {
455     id: "life-in-color",
456     expiry: "2022-02-08",
457   },
458   {
459     id: "true-colors",
460     expiry: "2022-05-03",
461   },
462   {
463     id: "independent-voices",
464     expiry: "2023-01-17",
465   },
468 export function _applyColorwayConfig(collections) {
469   const collectionsSorted = collections
470     .map(({ expiry, ...rest }) => ({
471       expiry: new Date(expiry),
472       ...rest,
473     }))
474     .sort((a, b) => a.expiry - b.expiry);
475   const collectionsMap = collectionsSorted.reduce((map, c) => {
476     map.set(c.id, c);
477     return map;
478   }, new Map());
479   for (let [key, value] of BuiltInThemeConfig.entries()) {
480     if (value.collection) {
481       const collectionConfig = collectionsMap.get(value.collection);
482       BuiltInThemeConfig.set(key, {
483         ...value,
484         expiry: collectionConfig.expiry,
485       });
486     }
487   }
490 _applyColorwayConfig(ColorwayCollections);