@razorwind/thunderbird 0.0.2

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 ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,328 @@
1
+ <!-- START header -->
2
+ <!-- prettier-ignore-start -->
3
+ <!-- markdownlint-disable -->
4
+
5
+
6
+ <div align="center">
7
+ <picture>
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/razorwind/media/banner-1280x427-dark.gif">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/razorwind/media/banner-1280x427-light.gif">
10
+ <img src="https://public.storm-cdn.com/razorwind/media/banner-1280x427-dark.gif" width="100%" alt="Razorwind" />
11
+ </picture>
12
+ </div>
13
+ <br />
14
+
15
+ <div align="center">
16
+ <b>
17
+ <a href="https://stormsoftware.com" target="_blank">Website</a> •
18
+ <a href="https://github.com/storm-software/razorwind" target="_blank">GitHub</a> •
19
+ <a href="https://discord.gg/MQ6YVzakM5">Discord</a> • <a href="https://stormstack.github.io/stormstack/" target="_blank">Docs</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> •
20
+ <a href="https://github.com/storm-software/stack/issues/new?assignees=&labels=bug&template=bug-report.yml&title=Bug Report%3A+">Report a Bug</a>
21
+ </b>
22
+ </div>
23
+ <br />
24
+
25
+ 💨 Razorwind is a unified set of tools that make creating design systems a breeze.
26
+
27
+ <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3>
28
+ <br />
29
+
30
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/razorwind/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
+
32
+ <!-- prettier-ignore-start -->
33
+ <!-- markdownlint-disable -->
34
+
35
+ > [!IMPORTANT]
36
+ > This repository, and the apps, libraries, and tools contained within, is still in it's initial development phase. As a result, bugs and issues are expected with it's usage. When the main development phase completes, a proper release will be performed, the packages will be available through NPM (and other distributions), and this message will be removed. However, in the meantime, please feel free to report any issues you may come across.
37
+
38
+ <!-- markdownlint-restore -->
39
+ <!-- prettier-ignore-end -->
40
+
41
+ <div align="center">
42
+ <b>Be sure to ⭐ this repository on <a href="https://github.com/storm-software/razorwind" target="_blank">GitHub</a> so you can keep up to date on any daily progress!</b>
43
+ </div>
44
+
45
+ <br />
46
+
47
+ <!-- markdownlint-restore -->
48
+ <!-- prettier-ignore-end -->
49
+
50
+ <!-- END header -->
51
+
52
+ # Razorwind - Thunderbird Theme Generator
53
+
54
+ **Razorwind - Thunderbird Theme Generator** creates [Mozilla Thunderbird](https://www.thunderbird.net/) extension theme folders from design tokens. Output matches community themes such as [Dracula for Thunderbird](https://draculatheme.com/thunderbird) (`manifest.json` plus optional icons).
55
+
56
+ ## Installing
57
+
58
+ Using [pnpm](http://pnpm.io):
59
+
60
+ ```bash
61
+ pnpm add -D @razorwind/thunderbird
62
+ ```
63
+
64
+ <details>
65
+ <summary>Using npm</summary>
66
+
67
+ ```bash
68
+ npm install -D @razorwind/thunderbird
69
+ ```
70
+
71
+ </details>
72
+
73
+ <details>
74
+ <summary>Using yarn</summary>
75
+
76
+ ```bash
77
+ yarn add -D @razorwind/thunderbird
78
+ ```
79
+
80
+ </details>
81
+
82
+ ## Usage
83
+
84
+ ```ts
85
+ import { defineConfig } from "@razorwind/core";
86
+ import thunderbird, {
87
+ flattenTokens,
88
+ toThunderbirdRgbString
89
+ } from "@razorwind/thunderbird";
90
+
91
+ export default defineConfig({
92
+ plugins: [
93
+ thunderbird({
94
+ mapTheme: tokens => {
95
+ const flat = flattenTokens(tokens);
96
+ const color = (path: string) =>
97
+ toThunderbirdRgbString(
98
+ flat.find(t => t.path === path)?.cssValue ?? "#282a36"
99
+ );
100
+
101
+ return {
102
+ name: "My Thunderbird Theme",
103
+ gecko: { id: "my-theme@example.com" },
104
+ colors: {
105
+ frame: color("color.bg"),
106
+ toolbar: color("color.accent"),
107
+ tab_text: color("color.fg"),
108
+ sidebar: color("color.bg"),
109
+ toolbar_field: color("color.bg"),
110
+ tab_line: color("color.link")
111
+ },
112
+ icons: {
113
+ "200": "icon.png"
114
+ }
115
+ };
116
+ }
117
+ })
118
+ ]
119
+ });
120
+ ```
121
+
122
+ Generated files (under `thunderbird-themes/` by default):
123
+
124
+ - `{theme-slug}/manifest.json` — Thunderbird extension theme manifest from `mapTheme`
125
+ - `INSTALL.md` — zip each folder and install via Add-ons and Themes
126
+
127
+ Install like [Dracula for Thunderbird](https://draculatheme.com/thunderbird):
128
+
129
+ 1. Zip a generated theme folder so `manifest.json` is at the archive root
130
+ 2. Open Thunderbird → **Settings** → **Add-ons and Themes**
131
+ 3. Gear menu → **Install Add-on From File…** and select the ZIP
132
+
133
+ Add any icon PNGs referenced in `manifest.json` before installing.
134
+
135
+ ### Options
136
+
137
+ | Option | Default | Description |
138
+ | -------------- | ----------------- | ------------------------------------------------- |
139
+ | `mapTheme` | _(required)_ | `(tokens) =>` theme, theme array, or theme record |
140
+ | `outputPath` | `"thunderbird-themes"` | Output directory for theme folders |
141
+ | `installGuide` | _(generated)_ | Override body for generated `INSTALL.md` |
142
+
143
+ `mapTheme` return shapes: a single `ThunderbirdTheme`, an array, or a `Record<string, ThunderbirdTheme>`. Each theme needs `name`, `gecko.id`, and `colors`. Color values may be hex strings (`#rrggbb`) or `[r, g, b]` tuples (0–255); they are rendered as `rgb(r, g, b)` strings per the [Dracula Thunderbird manifest](https://github.com/dracula/thunderbird/blob/master/manifest.json). Optional fields include `icons` and `gecko.strictMinVersion`.
144
+
145
+ ## Development
146
+
147
+ ### Building
148
+
149
+ Run `nx build thunderbird` to build the library.
150
+
151
+ ### Running unit tests
152
+
153
+ Run `nx test thunderbird` to execute the unit tests via [Vitest](https://vitest.dev/).
154
+
155
+ <!-- START footer -->
156
+ <!-- prettier-ignore-start -->
157
+ <!-- markdownlint-disable -->
158
+
159
+
160
+ ## Storm Workspaces
161
+
162
+ Storm workspaces are built using
163
+ <a href="https://nx.dev/" target="_blank">Nx</a>, a set of extensible dev tools
164
+ for monorepos, which helps you develop like Google, Facebook, and Microsoft.
165
+ Building on top of Nx, the Open System provides a set of tools and patterns that
166
+ help you scale your monorepo to many teams while keeping the codebase
167
+ maintainable.
168
+
169
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
170
+ <br />
171
+
172
+ ## Roadmap
173
+
174
+ See the [open issues](https://github.com/storm-software/razorwind/issues) for
175
+ a list of proposed features (and known issues).
176
+
177
+ - [Top Feature Requests](https://github.com/storm-software/razorwind/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
178
+ (Add your votes using the 👍 reaction)
179
+ - [Top Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)
180
+ (Add your votes using the 👍 reaction)
181
+ - [Newest Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
182
+
183
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
184
+ <br />
185
+
186
+ ## Support
187
+
188
+ Reach out to the maintainer at one of the following places:
189
+
190
+ - [Contact](https://stormsoftware.com/contact)
191
+ - [GitHub discussions](https://github.com/storm-software/razorwind/discussions)
192
+ - <support@stormsoftware.com>
193
+
194
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
195
+ <br />
196
+
197
+ ## License
198
+
199
+ This project is licensed under the **Apache License 2.0**. Feel free to edit and
200
+ distribute this template as you like.
201
+
202
+ See [LICENSE](LICENSE) for more information.
203
+
204
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
205
+ <br />
206
+
207
+ ## Changelog
208
+
209
+ This project adheres to
210
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along
211
+ with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md)
212
+ file
213
+
214
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
215
+ <br />
216
+
217
+ ## Contributing
218
+
219
+ First off, thanks for taking the time to contribute! Contributions are what
220
+ makes the open-source community such an amazing place to learn, inspire, and
221
+ create. Any contributions you make will benefit everybody else and are **greatly
222
+ appreciated**.
223
+
224
+ Please try to create bug reports that are:
225
+
226
+ - _Reproducible._ Include steps to reproduce the problem.
227
+ - _Specific._ Include as much detail as possible: which version, what
228
+ environment, etc.
229
+ - _Unique._ Do not duplicate existing opened issues.
230
+ - _Scoped to a Single Bug._ One bug per report.
231
+
232
+ Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md).
233
+
234
+ You can use
235
+ [markdownlint-cli](https://github.com/storm-software/razorwind/markdownlint-cli)
236
+ to check for common markdown style inconsistency.
237
+
238
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
239
+ <br />
240
+
241
+ ## Contributors
242
+
243
+ Thanks goes to these wonderful people
244
+ ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
245
+
246
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
247
+
248
+ <table>
249
+ <tbody>
250
+ <tr>
251
+ <td align="center" valign="top" width="14.28%"><a href="http://www.sullypat.com/"><img src="https://avatars.githubusercontent.com/u/99053093?v=4?s=100" width="100px;" alt="Patrick Sullivan"/><br /><sub><b>Patrick Sullivan</b></sub></a><br /><a href="#design-sullivanpj" title="Design">🎨</a> <a href="https://github.com/storm-software/razorwind/commits?author=sullivanpj" title="Code">💻</a> <a href="#tool-sullivanpj" title="Tools">🔧</a> <a href="https://github.com/storm-software/razorwind/commits?author=sullivanpj" title="Documentation">📖</a> <a href="https://github.com/storm-software/razorwind/commits?author=sullivanpj" title="Tests">⚠️</a></td>
252
+ <td align="center" valign="top" width="14.28%"><a href="https://tylerbenning.com/"><img src="https://avatars.githubusercontent.com/u/7265547?v=4?s=100" width="100px;" alt="Tyler Benning"/><br /><sub><b>Tyler Benning</b></sub></a><br /><a href="#design-tbenning" title="Design">🎨</a></td>
253
+ <td align="center" valign="top" width="14.28%"><a href="http://stormsoftware.com"><img src="https://avatars.githubusercontent.com/u/149802440?v=4?s=100" width="100px;" alt="Stormie"/><br /><sub><b>Stormie</b></sub></a><br /><a href="#maintenance-stormie-bot" title="Maintenance">🚧</a></td>
254
+ </tr>
255
+ </tbody>
256
+ <tfoot>
257
+ <tr>
258
+ <td align="center" size="13px" colspan="7">
259
+ <img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" alt="All Contributors">
260
+ <a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
261
+ </img>
262
+ </td>
263
+ </tr>
264
+ </tfoot>
265
+ </table>
266
+
267
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
268
+
269
+ This project follows the
270
+ [all-contributors](https://allcontributors.org/docs/en/emoji-key)
271
+ specification. Contributions of any kind welcome!
272
+
273
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
274
+ <br />
275
+
276
+ <hr />
277
+ <br />
278
+
279
+ <div align="center">
280
+ <picture>
281
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp">
282
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-light.webp">
283
+ <img src="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp" width="100%" alt="Storm Software" />
284
+ </picture>
285
+ </div>
286
+ <br />
287
+
288
+ <div align="center">
289
+ <a href="https://stormsoftware.com" target="_blank">Website</a> • <a href="https://stormsoftware.com/contact" target="_blank">Contact</a> • <a href="https://linkedin.com/in/patrick-sullivan-865526b0" target="_blank">LinkedIn</a> • <a href="https://medium.com/@pat.joseph.sullivan" target="_blank">Medium</a> • <a href="https://github.com/storm-software" target="_blank">GitHub</a> • <a href="https://keybase.io/sullivanp" target="_blank">OpenPGP Key</a>
290
+ </div>
291
+
292
+ <div align="center">
293
+ <b>Fingerprint:</b> 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D
294
+ </div>
295
+ <br />
296
+
297
+ Storm Software is an open source software development organization and creator
298
+ of Acidic, StormStack and StormCloud.
299
+
300
+ Our mission is to make software development more accessible. Our ideal future is
301
+ one where anyone can create software without years of prior development
302
+ experience serving as a barrier to entry. We hope to achieve this via LLMs,
303
+ Generative AI, and intuitive, high-level data modeling/programming languages.
304
+
305
+ Join us on [Discord](https://discord.gg/MQ6YVzakM5) to chat with the team,
306
+ receive release notifications, ask questions, and get involved.
307
+
308
+ If this sounds interesting, and you would like to help us in creating the next
309
+ generation of development tools, please reach out on our
310
+ [website](https://stormsoftware.com/contact) or join our
311
+ [Slack channel](https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA)!
312
+
313
+ <br />
314
+
315
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/icons/circle-dark.webp"><source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/icons/circle-light.webp"><img src="https://public.storm-cdn.com/storm-software/icons/circle-dark.webp" width="200px" alt="Storm Software" /></picture></a></div>
316
+ <br />
317
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/misc/text/visit-us-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/misc/text/visit-us-light.png"><img src="https://public.storm-cdn.com/misc/text/visit-us-dark.png" height="90px" alt="Visit us at stormsoftware.com" /></picture></a></div>
318
+ <br />
319
+
320
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
321
+ <br />
322
+ <br />
323
+
324
+
325
+ <!-- markdownlint-restore -->
326
+ <!-- prettier-ignore-end -->
327
+
328
+ <!-- END footer -->
package/dist/index.cjs ADDED
@@ -0,0 +1,49 @@
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("@razorwind/core/plugin"),t=require("@razorwind/core/utils"),n=require("node:path");function r(e){let t=e.themes[0],n=e.title??(e.themes.length===1?t.displayName:`Thunderbird Themes`),r=e.themes.map(e=>{let t=[`\`${e.folderName}/manifest.json\``];return e.iconPaths&&e.iconPaths.length>0&&t.push(e.iconPaths.map(t=>`\`${e.folderName}/${t}\``).join(`, `)),`- ${t.join(` + `)} — ${e.displayName}`}).join(`
2
+ `),i=e.themes.map(e=>`- **${e.displayName}** — folder \`${e.folderName}/\``).join(`
3
+ `);return`# Installing ${n}
4
+
5
+ Generated by \`@razorwind/thunderbird\`.
6
+
7
+ These themes target [Mozilla Thunderbird](https://www.thunderbird.net/). Install
8
+ steps follow the same pattern as
9
+ [Dracula for Thunderbird](https://draculatheme.com/thunderbird).
10
+
11
+ ## Files
12
+
13
+ ${r}
14
+ ${e.themes.some(e=>(e.iconPaths?.length??0)>0)?`
15
+ If a theme references icons, copy the PNG files into the theme folder using the
16
+ paths from \`manifest.json\` before installing the add-on.
17
+ `:``}
18
+ ## Setup
19
+
20
+ 1. Zip the contents of a generated theme folder (for example \`${t.folderName}/\`)
21
+ so that \`manifest.json\` is at the root of the archive.
22
+
23
+ 2. Open Thunderbird and go to **Settings** (or **Preferences**) → **Add-ons and Themes**.
24
+
25
+ 3. Click the gear icon and choose **Install Add-on From File…**.
26
+
27
+ 4. Select the ZIP file. Thunderbird applies the theme immediately.
28
+
29
+ 5. Repeat for each theme variant you want installed.
30
+
31
+ To publish publicly, upload the ZIP to
32
+ [Thunderbird Add-ons](https://addons.thunderbird.net/).
33
+
34
+ ### Optional: tweak message colors
35
+
36
+ Some message text, background, and link colors are controlled separately from
37
+ the theme manifest:
38
+
39
+ 1. Open Thunderbird.
40
+ 2. Go to **Settings** → **General** → **Language & Appearance** → **Fonts & Colors** → **Colors…**
41
+ 3. Adjust the colors to your liking.
42
+
43
+ ## Select / load theme
44
+
45
+ Thunderbird applies a theme as soon as the add-on is installed. To switch themes,
46
+ open **Add-ons and Themes**, disable one theme add-on and enable another:
47
+
48
+ ${i}
49
+ `}function i(e){return(0,t.themeDisplayName)(e)}const a={name:`razorwind-thunderbird`};function o(e,n,r){return(0,t.createDocument)(e,n,a,void 0,r)}function s(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0&&(0,t.isObject)(e.gecko)&&typeof e.gecko.id==`string`&&e.gecko.id.length>0&&(0,t.isObject)(e.colors)&&Object.keys(e.colors).length>0}function c(e){if(Array.isArray(e))return e.map((e,t)=>{if(!s(e))throw TypeError(`@razorwind/thunderbird mapTheme()[${t}] must be a ThunderbirdTheme with name, gecko.id, and colors`);return e});if(s(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/thunderbird mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!s(t))throw TypeError(`@razorwind/thunderbird mapTheme()["${e}"] must be a ThunderbirdTheme with name, gecko.id, and colors`);return{...t,name:t.name||e}})}function l(e){if(!e.mapTheme)throw Error(`@razorwind/thunderbird requires options.mapTheme`)}function u(e){return Math.max(0,Math.min(255,Math.round(e)))}function d(e){let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e.trim());if(t)return[u(Number.parseInt(t[1],10)),u(Number.parseInt(t[2],10)),u(Number.parseInt(t[3],10))]}function f(e){if(Array.isArray(e)){if(e.length!==3)throw TypeError(`@razorwind/thunderbird RGB tuples must have exactly three channels`);return[u(e[0]),u(e[1]),u(e[2])]}let t=d(e);if(t)return t;let n=e.trim(),r=n.startsWith(`#`)?n.slice(1):n;if(!/^[0-9a-f]{6}$/i.test(r))throw TypeError(`@razorwind/thunderbird cannot convert color "${e}" to RGB — use #rrggbb, rgb(r, g, b), or [r, g, b]`);return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16)]}function p(e){let[t,n,r]=f(e);return`rgb(${t}, ${n}, ${r})`}function m(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,p(t)]))}function h(e){let t={manifest_version:e.manifestVersion??2,name:e.displayName??i(e),description:e.description??`A Thunderbird color theme generated for ${e.name}.`,version:e.version??`1.0.0`,applications:{gecko:{id:e.gecko.id,strict_min_version:e.gecko.strictMinVersion??`60.0`}},theme:{colors:m(e.colors)}};return e.icons&&Object.keys(e.icons).length>0&&(t.icons=e.icons),`${JSON.stringify(t,null,2)}\n`}function g(e,a){l(a);let s=a.outputPath??`thunderbird-themes`,u=c(a.mapTheme(e.tokens));if(u.length===0)throw Error(`@razorwind/thunderbird mapTheme() returned no themes`);let d={},f=/* @__PURE__ */ new Set,p=[];for(let e of u){let r=(0,t.slugifyThemeName)(e.name);if(!r)throw TypeError(`@razorwind/thunderbird theme name "${e.name}" slugifies to an empty string`);if(f.has(r)){let n=2;for(;f.has(`${(0,t.slugifyThemeName)(e.name)}-${n}`);)n+=1;r=`${(0,t.slugifyThemeName)(e.name)}-${n}`}f.add(r);let a=(0,n.join)(s,r,`manifest.json`);d[a]=o(a,h(e),`json`),p.push({name:e.name,displayName:i(e),folderName:r,iconPaths:e.icons?Object.values(e.icons):void 0})}let m=a.installGuide??r({themes:p,title:(0,t.resolveSchemaIdentity)(e).title}),g=(0,n.join)(s,`INSTALL.md`);return d[g]=o(g,m,`markdown`),d}var _=(0,e.definePlugin)(e=>({name:`thunderbird`,generate:async t=>{if(!e)throw Error(`@razorwind/thunderbird requires options: { mapTheme }`);return g(t,e)}}));exports.default=_,Object.defineProperty(exports,"flattenTokens",{enumerable:!0,get:function(){return t.flattenTokens}}),Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateThunderbirdTheme=g,exports.normalizeThemes=c,exports.renderInstallMd=r,exports.renderManifestJson=h,Object.defineProperty(exports,"resolveTokenSets",{enumerable:!0,get:function(){return t.resolveTokenSets}}),exports.themeDisplayName=i,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toThunderbirdRgb=f,exports.toThunderbirdRgbString=p;
@@ -0,0 +1,223 @@
1
+ import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
2
+ import { GeneratorFunctionResult } from "@power-plant/core";
3
+ import { Schema, Tokens } from "@razorwind/core/schema";
4
+ import { TokenType } from "@power-plant/dtcg-schema";
5
+ //#region src/types.d.ts
6
+ /**
7
+ * A flattened design token ready for Thunderbird theme mapping.
8
+ */
9
+ interface FlatToken {
10
+ /** Dot-separated token path (e.g. `color.primary`). */
11
+ path: string;
12
+ /** DTCG `$type`, when known. */
13
+ type?: TokenType | string;
14
+ /** Raw `$value` from the token document. */
15
+ value: unknown;
16
+ /** CSS-friendly string form of {@link value}. */
17
+ cssValue: string;
18
+ /** Optional DTCG `$description`. */
19
+ description?: string;
20
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
21
+ theme?: string;
22
+ }
23
+ /** RGB tuple (0–255 per channel) used when mapping theme colors. */
24
+ type ThunderbirdRgb = [number, number, number];
25
+ /**
26
+ * Color input accepted in {@link ThunderbirdTheme.colors}.
27
+ * Hex strings (`#rrggbb`) and RGB tuples are converted to `rgb(r, g, b)` strings
28
+ * when rendering.
29
+ */
30
+ type ThunderbirdColorInput = ThunderbirdRgb | string;
31
+ /**
32
+ * Gecko extension identifier for Thunderbird theme manifests.
33
+ *
34
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
35
+ */
36
+ interface ThunderbirdGeckoApplication {
37
+ /** Unique add-on id (email-style recommended). */
38
+ id: string;
39
+ /** Minimum Thunderbird version. @defaultValue `"60.0"` */
40
+ strictMinVersion?: string;
41
+ }
42
+ /**
43
+ * Well-known Thunderbird / Firefox theme color keys.
44
+ *
45
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
46
+ * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme
47
+ */
48
+ type ThunderbirdThemeColorKey = "button_background_active" | "button_background_hover" | "frame" | "icons" | "icons_attention" | "ntp_background" | "ntp_text" | "popup" | "popup_border" | "popup_highlight" | "popup_highlight_text" | "popup_text" | "sidebar" | "sidebar_border" | "sidebar_highlight" | "sidebar_highlight_text" | "sidebar_text" | "tab_background_separator" | "tab_background_text" | "tab_line" | "tab_loading" | "tab_selected" | "tab_text" | "toolbar" | "toolbar_bottom_separator" | "toolbar_field" | "toolbar_field_border" | "toolbar_field_border_focus" | "toolbar_field_highlight" | "toolbar_field_highlight_text" | "toolbar_field_separator" | "toolbar_field_text" | "toolbar_text" | "toolbar_top_separator" | "toolbar_vertical_separator" | (string & {});
49
+ /**
50
+ * Mozilla Thunderbird extension theme manifest — rendered to `manifest.json`.
51
+ *
52
+ * Load from the Add-ons manager or publish to Thunderbird Add-ons.
53
+ *
54
+ * @see https://draculatheme.com/thunderbird
55
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
56
+ */
57
+ interface ThunderbirdTheme {
58
+ /**
59
+ * Extension display name written to `manifest.json`.
60
+ * Also used to derive the output folder slug.
61
+ */
62
+ name: string;
63
+ /** Optional label for INSTALL.md when different from {@link name}. */
64
+ displayName?: string;
65
+ /** Extension description. @defaultValue derived from {@link name} */
66
+ description?: string;
67
+ /** Extension version string. @defaultValue `"1.0.0"` */
68
+ version?: string;
69
+ /** Manifest format version. @defaultValue `2` */
70
+ manifestVersion?: 2;
71
+ /**
72
+ * Gecko application metadata required by Thunderbird theme manifests.
73
+ * Provide a unique {@link ThunderbirdGeckoApplication.id} per theme.
74
+ */
75
+ gecko: ThunderbirdGeckoApplication;
76
+ /**
77
+ * Browser UI colors. Values are RGB tuples or hex strings converted to
78
+ * `rgb(r, g, b)` at render time.
79
+ */
80
+ colors: Record<ThunderbirdThemeColorKey, ThunderbirdColorInput>;
81
+ /**
82
+ * Extension icons by size (e.g. `"200"`).
83
+ * Paths are relative to the extension root — add PNG files before loading.
84
+ */
85
+ icons?: Record<string, string>;
86
+ }
87
+ /**
88
+ * Map extracted design tokens to one or more Thunderbird theme manifests.
89
+ *
90
+ * Return a single theme, an array, or a record keyed by theme id.
91
+ */
92
+ type GenerateThunderbirdTheme = (tokens: Tokens | Record<string, Tokens>) => ThunderbirdTheme | ThunderbirdTheme[] | Record<string, ThunderbirdTheme>;
93
+ /**
94
+ * Options for the Razorwind Thunderbird theme generator.
95
+ *
96
+ * @see https://draculatheme.com/thunderbird
97
+ */
98
+ interface ThunderbirdPluginOptions {
99
+ /**
100
+ * Directory (relative to the execution cwd) for generated theme folders.
101
+ *
102
+ * @defaultValue `"thunderbird-themes"`
103
+ */
104
+ outputPath?: string;
105
+ /**
106
+ * Map extracted tokens to Thunderbird `manifest.json` document(s).
107
+ *
108
+ * Required — without a mapping there is nothing to emit.
109
+ */
110
+ mapTheme: GenerateThunderbirdTheme;
111
+ /**
112
+ * Restrict flattened helper tokens to these DTCG `$type` values.
113
+ * Does not filter what {@link mapTheme} receives.
114
+ */
115
+ includeTypes?: TokenType[];
116
+ /**
117
+ * Override body for generated `INSTALL.md`. When omitted, Thunderbird install
118
+ * steps are generated from contributed themes.
119
+ */
120
+ installGuide?: string;
121
+ }
122
+ //#endregion
123
+ //#region src/install.d.ts
124
+ /**
125
+ * Build Thunderbird INSTALL.md for generated extension theme folders.
126
+ *
127
+ * Steps follow loading a theme from the Add-ons manager, as used by community
128
+ * themes such as [Dracula for Thunderbird](https://draculatheme.com/thunderbird).
129
+ */
130
+ declare function renderInstallMd(options: {
131
+ themes: Array<{
132
+ name: string;
133
+ displayName: string;
134
+ folderName: string;
135
+ iconPaths?: string[];
136
+ }>;
137
+ /** Design-system / package title from Schema when multiple themes. */
138
+ title?: string;
139
+ }): string;
140
+ /**
141
+ * Title-case a theme name for display when \`displayName\` is omitted.
142
+ */
143
+ declare function themeDisplayName(theme: ThunderbirdTheme): string;
144
+ //#endregion
145
+ //#region src/generate.d.ts
146
+ /**
147
+ * Normalize {@link ThunderbirdPluginOptions.mapTheme} results into a theme list.
148
+ */
149
+ declare function normalizeThemes(result: ThunderbirdTheme | ThunderbirdTheme[] | Record<string, ThunderbirdTheme>): ThunderbirdTheme[];
150
+ /**
151
+ * Convert a CSS hex color or RGB tuple to Thunderbird's `[r, g, b]` tuple form.
152
+ */
153
+ declare function toThunderbirdRgb(color: ThunderbirdColorInput): ThunderbirdRgb;
154
+ /**
155
+ * Format an RGB tuple as a Thunderbird theme color string (`rgb(r, g, b)`).
156
+ *
157
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
158
+ */
159
+ declare function toThunderbirdRgbString(color: ThunderbirdColorInput): string;
160
+ /**
161
+ * Serialize a Thunderbird extension theme `manifest.json`.
162
+ *
163
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
164
+ */
165
+ declare function renderManifestJson(theme: ThunderbirdTheme): string;
166
+ /**
167
+ * Generate Thunderbird extension theme folders (plus INSTALL.md) from a Razorwind schema.
168
+ *
169
+ * @see https://draculatheme.com/thunderbird
170
+ */
171
+ declare function generateThunderbirdTheme(spec: Schema, options: ThunderbirdPluginOptions): GeneratorFunctionResult<Schema, ThunderbirdPluginOptions>;
172
+ //#endregion
173
+ //#region src/index.d.ts
174
+ /**
175
+ * Razorwind plugin that turns design tokens into Mozilla Thunderbird extension
176
+ * theme manifests.
177
+ *
178
+ * Provide {@link ThunderbirdPluginOptions.mapTheme} to map extracted tokens to one
179
+ * or more `manifest.json` documents. Install generated folders via Thunderbird's
180
+ * Add-ons manager.
181
+ *
182
+ * @see https://draculatheme.com/thunderbird
183
+ * @see https://github.com/dracula/thunderbird
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * import { defineConfig } from "@razorwind/core";
188
+ * import thunderbird, {
189
+ * flattenTokens,
190
+ * toThunderbirdRgbString
191
+ * } from "@razorwind/thunderbird";
192
+ *
193
+ * export default defineConfig({
194
+ * plugins: [
195
+ * thunderbird({
196
+ * mapTheme: tokens => {
197
+ * const flat = flattenTokens(tokens);
198
+ * const color = (path: string) =>
199
+ * toThunderbirdRgbString(
200
+ * flat.find(t => t.path === path)?.cssValue ?? "#282a36"
201
+ * );
202
+ *
203
+ * return {
204
+ * name: "My Thunderbird Theme",
205
+ * gecko: { id: "my-theme@example.com" },
206
+ * colors: {
207
+ * frame: color("color.bg"),
208
+ * toolbar: color("color.accent"),
209
+ * tab_text: color("color.fg"),
210
+ * sidebar: color("color.bg"),
211
+ * toolbar_field: color("color.bg")
212
+ * }
213
+ * };
214
+ * }
215
+ * })
216
+ * ]
217
+ * });
218
+ * ```
219
+ */
220
+ declare const _default: (options?: ThunderbirdPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
221
+ //#endregion
222
+ export { type FlatToken, type GenerateThunderbirdTheme, type ThunderbirdColorInput, type ThunderbirdGeckoApplication, type ThunderbirdPluginOptions, type ThunderbirdRgb, type ThunderbirdTheme, type ThunderbirdThemeColorKey, _default as default, flattenTokens, formatTokenValue, generateThunderbirdTheme, normalizeThemes, renderInstallMd, renderManifestJson, resolveTokenSets, themeDisplayName, toCssVar, toThunderbirdRgb, toThunderbirdRgbString };
223
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAwBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;KAIU;;;;;;KAOA,wBAAwB;;;;;;UAOnB;;EAEf;;EAEA;;;;;;;;KASU;;;;;;;;;UA8CK;;;;;EAKf;;EAEA;;EAEA;;EAEA;;EAEA;;;;;EAKA,OAAO;;;;;EAKP,QAAQ,OAAO,0BAA0B;;;;;EAKzC,QAAQ;;;;;;;KAQE,4BACV,QAAQ,SAAS,eAAe,YAC7B,mBAAmB,qBAAqB,eAAe;;;;;;UAO3C;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;EAMV,eAAe;;;;;EAMf;;;;;;;;;;iBC5Jc,gBAAgB;EAC9B,QAAQ;IACN;IACA;IACA;IACA;;;EAGF;;;;;iBAsFc,iBAAiB,OAAO;;;;;;iBCtDxB,gBACd,QACE,mBAAmB,qBAAqB,eAAe,oBACxD;;;;iBAkEa,iBAAiB,OAAO,wBAAwB;;;;;;iBAuChD,uBAAuB,OAAO;;;;;;iBAsB9B,mBAAmB,OAAO;;;;;;iBAiC1B,yBACd,MAAM,QACN,SAAS,2BACR,wBAAwB,QAAQ"}
@@ -0,0 +1,223 @@
1
+ import { flattenTokens, formatTokenValue, resolveTokenSets, toCssVar } from "@razorwind/core/utils";
2
+ import { GeneratorFunctionResult } from "@power-plant/core";
3
+ import { Schema, Tokens } from "@razorwind/core/schema";
4
+ import { TokenType } from "@power-plant/dtcg-schema";
5
+ //#region src/types.d.ts
6
+ /**
7
+ * A flattened design token ready for Thunderbird theme mapping.
8
+ */
9
+ interface FlatToken {
10
+ /** Dot-separated token path (e.g. `color.primary`). */
11
+ path: string;
12
+ /** DTCG `$type`, when known. */
13
+ type?: TokenType | string;
14
+ /** Raw `$value` from the token document. */
15
+ value: unknown;
16
+ /** CSS-friendly string form of {@link value}. */
17
+ cssValue: string;
18
+ /** Optional DTCG `$description`. */
19
+ description?: string;
20
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
21
+ theme?: string;
22
+ }
23
+ /** RGB tuple (0–255 per channel) used when mapping theme colors. */
24
+ type ThunderbirdRgb = [number, number, number];
25
+ /**
26
+ * Color input accepted in {@link ThunderbirdTheme.colors}.
27
+ * Hex strings (`#rrggbb`) and RGB tuples are converted to `rgb(r, g, b)` strings
28
+ * when rendering.
29
+ */
30
+ type ThunderbirdColorInput = ThunderbirdRgb | string;
31
+ /**
32
+ * Gecko extension identifier for Thunderbird theme manifests.
33
+ *
34
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
35
+ */
36
+ interface ThunderbirdGeckoApplication {
37
+ /** Unique add-on id (email-style recommended). */
38
+ id: string;
39
+ /** Minimum Thunderbird version. @defaultValue `"60.0"` */
40
+ strictMinVersion?: string;
41
+ }
42
+ /**
43
+ * Well-known Thunderbird / Firefox theme color keys.
44
+ *
45
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
46
+ * @see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/theme
47
+ */
48
+ type ThunderbirdThemeColorKey = "button_background_active" | "button_background_hover" | "frame" | "icons" | "icons_attention" | "ntp_background" | "ntp_text" | "popup" | "popup_border" | "popup_highlight" | "popup_highlight_text" | "popup_text" | "sidebar" | "sidebar_border" | "sidebar_highlight" | "sidebar_highlight_text" | "sidebar_text" | "tab_background_separator" | "tab_background_text" | "tab_line" | "tab_loading" | "tab_selected" | "tab_text" | "toolbar" | "toolbar_bottom_separator" | "toolbar_field" | "toolbar_field_border" | "toolbar_field_border_focus" | "toolbar_field_highlight" | "toolbar_field_highlight_text" | "toolbar_field_separator" | "toolbar_field_text" | "toolbar_text" | "toolbar_top_separator" | "toolbar_vertical_separator" | (string & {});
49
+ /**
50
+ * Mozilla Thunderbird extension theme manifest — rendered to `manifest.json`.
51
+ *
52
+ * Load from the Add-ons manager or publish to Thunderbird Add-ons.
53
+ *
54
+ * @see https://draculatheme.com/thunderbird
55
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
56
+ */
57
+ interface ThunderbirdTheme {
58
+ /**
59
+ * Extension display name written to `manifest.json`.
60
+ * Also used to derive the output folder slug.
61
+ */
62
+ name: string;
63
+ /** Optional label for INSTALL.md when different from {@link name}. */
64
+ displayName?: string;
65
+ /** Extension description. @defaultValue derived from {@link name} */
66
+ description?: string;
67
+ /** Extension version string. @defaultValue `"1.0.0"` */
68
+ version?: string;
69
+ /** Manifest format version. @defaultValue `2` */
70
+ manifestVersion?: 2;
71
+ /**
72
+ * Gecko application metadata required by Thunderbird theme manifests.
73
+ * Provide a unique {@link ThunderbirdGeckoApplication.id} per theme.
74
+ */
75
+ gecko: ThunderbirdGeckoApplication;
76
+ /**
77
+ * Browser UI colors. Values are RGB tuples or hex strings converted to
78
+ * `rgb(r, g, b)` at render time.
79
+ */
80
+ colors: Record<ThunderbirdThemeColorKey, ThunderbirdColorInput>;
81
+ /**
82
+ * Extension icons by size (e.g. `"200"`).
83
+ * Paths are relative to the extension root — add PNG files before loading.
84
+ */
85
+ icons?: Record<string, string>;
86
+ }
87
+ /**
88
+ * Map extracted design tokens to one or more Thunderbird theme manifests.
89
+ *
90
+ * Return a single theme, an array, or a record keyed by theme id.
91
+ */
92
+ type GenerateThunderbirdTheme = (tokens: Tokens | Record<string, Tokens>) => ThunderbirdTheme | ThunderbirdTheme[] | Record<string, ThunderbirdTheme>;
93
+ /**
94
+ * Options for the Razorwind Thunderbird theme generator.
95
+ *
96
+ * @see https://draculatheme.com/thunderbird
97
+ */
98
+ interface ThunderbirdPluginOptions {
99
+ /**
100
+ * Directory (relative to the execution cwd) for generated theme folders.
101
+ *
102
+ * @defaultValue `"thunderbird-themes"`
103
+ */
104
+ outputPath?: string;
105
+ /**
106
+ * Map extracted tokens to Thunderbird `manifest.json` document(s).
107
+ *
108
+ * Required — without a mapping there is nothing to emit.
109
+ */
110
+ mapTheme: GenerateThunderbirdTheme;
111
+ /**
112
+ * Restrict flattened helper tokens to these DTCG `$type` values.
113
+ * Does not filter what {@link mapTheme} receives.
114
+ */
115
+ includeTypes?: TokenType[];
116
+ /**
117
+ * Override body for generated `INSTALL.md`. When omitted, Thunderbird install
118
+ * steps are generated from contributed themes.
119
+ */
120
+ installGuide?: string;
121
+ }
122
+ //#endregion
123
+ //#region src/install.d.ts
124
+ /**
125
+ * Build Thunderbird INSTALL.md for generated extension theme folders.
126
+ *
127
+ * Steps follow loading a theme from the Add-ons manager, as used by community
128
+ * themes such as [Dracula for Thunderbird](https://draculatheme.com/thunderbird).
129
+ */
130
+ declare function renderInstallMd(options: {
131
+ themes: Array<{
132
+ name: string;
133
+ displayName: string;
134
+ folderName: string;
135
+ iconPaths?: string[];
136
+ }>;
137
+ /** Design-system / package title from Schema when multiple themes. */
138
+ title?: string;
139
+ }): string;
140
+ /**
141
+ * Title-case a theme name for display when \`displayName\` is omitted.
142
+ */
143
+ declare function themeDisplayName(theme: ThunderbirdTheme): string;
144
+ //#endregion
145
+ //#region src/generate.d.ts
146
+ /**
147
+ * Normalize {@link ThunderbirdPluginOptions.mapTheme} results into a theme list.
148
+ */
149
+ declare function normalizeThemes(result: ThunderbirdTheme | ThunderbirdTheme[] | Record<string, ThunderbirdTheme>): ThunderbirdTheme[];
150
+ /**
151
+ * Convert a CSS hex color or RGB tuple to Thunderbird's `[r, g, b]` tuple form.
152
+ */
153
+ declare function toThunderbirdRgb(color: ThunderbirdColorInput): ThunderbirdRgb;
154
+ /**
155
+ * Format an RGB tuple as a Thunderbird theme color string (`rgb(r, g, b)`).
156
+ *
157
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
158
+ */
159
+ declare function toThunderbirdRgbString(color: ThunderbirdColorInput): string;
160
+ /**
161
+ * Serialize a Thunderbird extension theme `manifest.json`.
162
+ *
163
+ * @see https://github.com/dracula/thunderbird/blob/master/manifest.json
164
+ */
165
+ declare function renderManifestJson(theme: ThunderbirdTheme): string;
166
+ /**
167
+ * Generate Thunderbird extension theme folders (plus INSTALL.md) from a Razorwind schema.
168
+ *
169
+ * @see https://draculatheme.com/thunderbird
170
+ */
171
+ declare function generateThunderbirdTheme(spec: Schema, options: ThunderbirdPluginOptions): GeneratorFunctionResult<Schema, ThunderbirdPluginOptions>;
172
+ //#endregion
173
+ //#region src/index.d.ts
174
+ /**
175
+ * Razorwind plugin that turns design tokens into Mozilla Thunderbird extension
176
+ * theme manifests.
177
+ *
178
+ * Provide {@link ThunderbirdPluginOptions.mapTheme} to map extracted tokens to one
179
+ * or more `manifest.json` documents. Install generated folders via Thunderbird's
180
+ * Add-ons manager.
181
+ *
182
+ * @see https://draculatheme.com/thunderbird
183
+ * @see https://github.com/dracula/thunderbird
184
+ *
185
+ * @example
186
+ * ```ts
187
+ * import { defineConfig } from "@razorwind/core";
188
+ * import thunderbird, {
189
+ * flattenTokens,
190
+ * toThunderbirdRgbString
191
+ * } from "@razorwind/thunderbird";
192
+ *
193
+ * export default defineConfig({
194
+ * plugins: [
195
+ * thunderbird({
196
+ * mapTheme: tokens => {
197
+ * const flat = flattenTokens(tokens);
198
+ * const color = (path: string) =>
199
+ * toThunderbirdRgbString(
200
+ * flat.find(t => t.path === path)?.cssValue ?? "#282a36"
201
+ * );
202
+ *
203
+ * return {
204
+ * name: "My Thunderbird Theme",
205
+ * gecko: { id: "my-theme@example.com" },
206
+ * colors: {
207
+ * frame: color("color.bg"),
208
+ * toolbar: color("color.accent"),
209
+ * tab_text: color("color.fg"),
210
+ * sidebar: color("color.bg"),
211
+ * toolbar_field: color("color.bg")
212
+ * }
213
+ * };
214
+ * }
215
+ * })
216
+ * ]
217
+ * });
218
+ * ```
219
+ */
220
+ declare const _default: (options?: ThunderbirdPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
221
+ //#endregion
222
+ export { type FlatToken, type GenerateThunderbirdTheme, type ThunderbirdColorInput, type ThunderbirdGeckoApplication, type ThunderbirdPluginOptions, type ThunderbirdRgb, type ThunderbirdTheme, type ThunderbirdThemeColorKey, _default as default, flattenTokens, formatTokenValue, generateThunderbirdTheme, normalizeThemes, renderInstallMd, renderManifestJson, resolveTokenSets, themeDisplayName, toCssVar, toThunderbirdRgb, toThunderbirdRgbString };
223
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,50 @@
1
+ import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,flattenTokens as n,formatTokenValue as r,isObject as i,resolveSchemaIdentity as a,resolveTokenSets as o,slugifyThemeName as s,themeDisplayName as c,toCssVar as l}from"@razorwind/core/utils";import{join as u}from"node:path";function d(e){let t=e.themes[0],n=e.title??(e.themes.length===1?t.displayName:`Thunderbird Themes`),r=e.themes.map(e=>{let t=[`\`${e.folderName}/manifest.json\``];return e.iconPaths&&e.iconPaths.length>0&&t.push(e.iconPaths.map(t=>`\`${e.folderName}/${t}\``).join(`, `)),`- ${t.join(` + `)} — ${e.displayName}`}).join(`
2
+ `),i=e.themes.map(e=>`- **${e.displayName}** — folder \`${e.folderName}/\``).join(`
3
+ `);return`# Installing ${n}
4
+
5
+ Generated by \`@razorwind/thunderbird\`.
6
+
7
+ These themes target [Mozilla Thunderbird](https://www.thunderbird.net/). Install
8
+ steps follow the same pattern as
9
+ [Dracula for Thunderbird](https://draculatheme.com/thunderbird).
10
+
11
+ ## Files
12
+
13
+ ${r}
14
+ ${e.themes.some(e=>(e.iconPaths?.length??0)>0)?`
15
+ If a theme references icons, copy the PNG files into the theme folder using the
16
+ paths from \`manifest.json\` before installing the add-on.
17
+ `:``}
18
+ ## Setup
19
+
20
+ 1. Zip the contents of a generated theme folder (for example \`${t.folderName}/\`)
21
+ so that \`manifest.json\` is at the root of the archive.
22
+
23
+ 2. Open Thunderbird and go to **Settings** (or **Preferences**) → **Add-ons and Themes**.
24
+
25
+ 3. Click the gear icon and choose **Install Add-on From File…**.
26
+
27
+ 4. Select the ZIP file. Thunderbird applies the theme immediately.
28
+
29
+ 5. Repeat for each theme variant you want installed.
30
+
31
+ To publish publicly, upload the ZIP to
32
+ [Thunderbird Add-ons](https://addons.thunderbird.net/).
33
+
34
+ ### Optional: tweak message colors
35
+
36
+ Some message text, background, and link colors are controlled separately from
37
+ the theme manifest:
38
+
39
+ 1. Open Thunderbird.
40
+ 2. Go to **Settings** → **General** → **Language & Appearance** → **Fonts & Colors** → **Colors…**
41
+ 3. Adjust the colors to your liking.
42
+
43
+ ## Select / load theme
44
+
45
+ Thunderbird applies a theme as soon as the add-on is installed. To switch themes,
46
+ open **Add-ons and Themes**, disable one theme add-on and enable another:
47
+
48
+ ${i}
49
+ `}function f(e){return c(e)}const p={name:`razorwind-thunderbird`};function m(e,n,r){return t(e,n,p,void 0,r)}function h(e){return i(e)&&typeof e.name==`string`&&e.name.length>0&&i(e.gecko)&&typeof e.gecko.id==`string`&&e.gecko.id.length>0&&i(e.colors)&&Object.keys(e.colors).length>0}function g(e){if(Array.isArray(e))return e.map((e,t)=>{if(!h(e))throw TypeError(`@razorwind/thunderbird mapTheme()[${t}] must be a ThunderbirdTheme with name, gecko.id, and colors`);return e});if(h(e))return[e];if(!i(e))throw TypeError(`@razorwind/thunderbird mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!h(t))throw TypeError(`@razorwind/thunderbird mapTheme()["${e}"] must be a ThunderbirdTheme with name, gecko.id, and colors`);return{...t,name:t.name||e}})}function _(e){if(!e.mapTheme)throw Error(`@razorwind/thunderbird requires options.mapTheme`)}function v(e){return Math.max(0,Math.min(255,Math.round(e)))}function y(e){let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e.trim());if(t)return[v(Number.parseInt(t[1],10)),v(Number.parseInt(t[2],10)),v(Number.parseInt(t[3],10))]}function b(e){if(Array.isArray(e)){if(e.length!==3)throw TypeError(`@razorwind/thunderbird RGB tuples must have exactly three channels`);return[v(e[0]),v(e[1]),v(e[2])]}let t=y(e);if(t)return t;let n=e.trim(),r=n.startsWith(`#`)?n.slice(1):n;if(!/^[0-9a-f]{6}$/i.test(r))throw TypeError(`@razorwind/thunderbird cannot convert color "${e}" to RGB — use #rrggbb, rgb(r, g, b), or [r, g, b]`);return[Number.parseInt(r.slice(0,2),16),Number.parseInt(r.slice(2,4),16),Number.parseInt(r.slice(4,6),16)]}function x(e){let[t,n,r]=b(e);return`rgb(${t}, ${n}, ${r})`}function S(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,x(t)]))}function C(e){let t={manifest_version:e.manifestVersion??2,name:e.displayName??f(e),description:e.description??`A Thunderbird color theme generated for ${e.name}.`,version:e.version??`1.0.0`,applications:{gecko:{id:e.gecko.id,strict_min_version:e.gecko.strictMinVersion??`60.0`}},theme:{colors:S(e.colors)}};return e.icons&&Object.keys(e.icons).length>0&&(t.icons=e.icons),`${JSON.stringify(t,null,2)}\n`}function w(e,t){_(t);let n=t.outputPath??`thunderbird-themes`,r=g(t.mapTheme(e.tokens));if(r.length===0)throw Error(`@razorwind/thunderbird mapTheme() returned no themes`);let i={},o=/* @__PURE__ */ new Set,c=[];for(let e of r){let t=s(e.name);if(!t)throw TypeError(`@razorwind/thunderbird theme name "${e.name}" slugifies to an empty string`);if(o.has(t)){let n=2;for(;o.has(`${s(e.name)}-${n}`);)n+=1;t=`${s(e.name)}-${n}`}o.add(t);let r=u(n,t,`manifest.json`);i[r]=m(r,C(e),`json`),c.push({name:e.name,displayName:f(e),folderName:t,iconPaths:e.icons?Object.values(e.icons):void 0})}let l=t.installGuide??d({themes:c,title:a(e).title}),p=u(n,`INSTALL.md`);return i[p]=m(p,l,`markdown`),i}var T=e(e=>({name:`thunderbird`,generate:async t=>{if(!e)throw Error(`@razorwind/thunderbird requires options: { mapTheme }`);return w(t,e)}}));export{T as default,n as flattenTokens,r as formatTokenValue,w as generateThunderbirdTheme,g as normalizeThemes,d as renderInstallMd,C as renderManifestJson,o as resolveTokenSets,f as themeDisplayName,l as toCssVar,b as toThunderbirdRgb,x as toThunderbirdRgbString};
50
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@razorwind/thunderbird",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "description": "Razorwind plugin that generates Mozilla Thunderbird themes from design tokens.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/razorwind.git",
9
+ "directory": "packages/thunderbird"
10
+ },
11
+ "homepage": "https://stormsoftware.com",
12
+ "bugs": {
13
+ "url": "https://stormsoftware.com/support",
14
+ "email": "support@stormsoftware.com"
15
+ },
16
+ "author": {
17
+ "name": "Storm Software",
18
+ "email": "contact@stormsoftware.com",
19
+ "url": "https://stormsoftware.com"
20
+ },
21
+ "license": "Apache-2.0",
22
+ "private": false,
23
+ "files": ["dist"],
24
+ "keywords": [
25
+ "thunderbird",
26
+ "mozilla",
27
+ "email",
28
+ "theme",
29
+ "extension",
30
+ "razorwind",
31
+ "design-tokens",
32
+ "dtcg",
33
+ "storm-software"
34
+ ],
35
+ "exports": {
36
+ ".": {
37
+ "require": {
38
+ "types": "./dist/index.d.cts",
39
+ "default": "./dist/index.cjs"
40
+ },
41
+ "import": {
42
+ "types": "./dist/index.d.mts",
43
+ "default": "./dist/index.mjs"
44
+ },
45
+ "default": {
46
+ "types": "./dist/index.d.mts",
47
+ "default": "./dist/index.mjs"
48
+ }
49
+ },
50
+ "./generate": {
51
+ "require": {
52
+ "types": "./dist/index.d.cts",
53
+ "default": "./dist/index.cjs"
54
+ },
55
+ "import": {
56
+ "types": "./dist/index.d.mts",
57
+ "default": "./dist/index.mjs"
58
+ },
59
+ "default": {
60
+ "types": "./dist/index.d.mts",
61
+ "default": "./dist/index.mjs"
62
+ }
63
+ },
64
+ "./package.json": "./package.json"
65
+ },
66
+ "main": "./dist/index.cjs",
67
+ "module": "./dist/index.mjs",
68
+ "types": "./dist/index.d.cts",
69
+ "typings": "dist/index.d.mts",
70
+ "dependencies": {
71
+ "@power-plant/core": "^0.0.93",
72
+ "@power-plant/dtcg-schema": "^0.0.1",
73
+ "@razorwind/core": "^0.0.68"
74
+ },
75
+ "devDependencies": {
76
+ "@powerlines/plugin-tsdown": "^0.1.614",
77
+ "@types/node": "^25.9.7",
78
+ "typescript": "^6.0.3"
79
+ },
80
+ "publishConfig": { "access": "public" },
81
+ "gitHead": "1498cb7254b4a24cdbe7b1143cc513438148b863"
82
+ }