@razorwind/zsh 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,322 @@
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-1280x640-dark.gif">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/razorwind/media/banner-1280x640-light.gif">
10
+ <img src="https://public.storm-cdn.com/razorwind/media/banner-1280x640-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 - Oh My Zsh Theme Generator
53
+
54
+ **Razorwind - Oh My Zsh Theme Generator** creates [Oh My Zsh](https://ohmyz.sh/) `*.zsh-theme` files from design tokens. Prompt layout follows [Dracula for Zsh](https://draculatheme.com/zsh) (status arrow, optional time/context, directory, git).
55
+
56
+ ## Installing
57
+
58
+ Using [pnpm](http://pnpm.io):
59
+
60
+ ```bash
61
+ pnpm add -D @razorwind/zsh
62
+ ```
63
+
64
+ <details>
65
+ <summary>Using npm</summary>
66
+
67
+ ```bash
68
+ npm install -D @razorwind/zsh
69
+ ```
70
+
71
+ </details>
72
+
73
+ <details>
74
+ <summary>Using yarn</summary>
75
+
76
+ ```bash
77
+ yarn add -D @razorwind/zsh
78
+ ```
79
+
80
+ </details>
81
+
82
+ ## Usage
83
+
84
+ ```ts
85
+ import { defineConfig } from "@razorwind/core";
86
+ import zsh, { flattenTokens } from "@razorwind/zsh";
87
+
88
+ export default defineConfig({
89
+ plugins: [
90
+ zsh({
91
+ mapTheme: tokens => {
92
+ const flat = flattenTokens(tokens);
93
+ const color = (path: string) =>
94
+ flat.find(t => t.path === path)?.cssValue ?? "#50fa7b";
95
+
96
+ return {
97
+ name: "my-theme",
98
+ colors: {
99
+ success: color("color.success"),
100
+ error: color("color.error"),
101
+ directory: color("color.primary"),
102
+ git: color("color.accent"),
103
+ context: color("color.secondary"),
104
+ warning: color("color.warning")
105
+ }
106
+ };
107
+ }
108
+ })
109
+ ]
110
+ });
111
+ ```
112
+
113
+ Generated files (under `zsh-themes/` by default):
114
+
115
+ - `{theme-name}.zsh-theme` — Oh My Zsh theme scripts from `mapTheme`
116
+ - `INSTALL.md` — copy into themes dir, set `ZSH_THEME`, reload shell
117
+
118
+ Activate like [Dracula Zsh](https://draculatheme.com/zsh):
119
+
120
+ ```sh
121
+ cp zsh-themes/my-theme.zsh-theme "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/"
122
+ # in ~/.zshrc:
123
+ ZSH_THEME="my-theme"
124
+ source ~/.zshrc
125
+ ```
126
+
127
+ ### Options
128
+
129
+ | Option | Default | Description |
130
+ | -------------- | ---------------- | ------------------------------------------------- |
131
+ | `mapTheme` | _(required)_ | `(tokens) =>` theme, theme array, or theme record |
132
+ | `outputPath` | `"zsh-themes"` | Output directory for theme files |
133
+ | `installGuide` | _(generated)_ | Override body for generated `INSTALL.md` |
134
+
135
+ `mapTheme` return shapes: a single `ZshTheme`, an array, or a `Record<string, ZshTheme>`. Each theme needs a `name`. Map token colors into `colors` (`success`, `error`, `directory`, `git`, …). Optional: `displayTime`, `displayContext`, `displayFullCwd`, `arrowIcon`, or a full `prompt` override.
136
+
137
+ Runtime toggles in `~/.zshrc` (before the theme loads): `RW_ZSH_DISPLAY_GIT`, `RW_ZSH_DISPLAY_TIME`, `RW_ZSH_DISPLAY_CONTEXT`, `RW_ZSH_DISPLAY_FULL_CWD`, `RW_ZSH_DISPLAY_NEW_LINE`, `RW_ZSH_ARROW_ICON`, `RW_ZSH_CUSTOM_VARIABLE`.
138
+
139
+ ## Development
140
+
141
+ ### Building
142
+
143
+ Run `nx build zsh` to build the library.
144
+
145
+ ### Running unit tests
146
+
147
+ Run `nx test zsh` to execute the unit tests via [Vitest](https://vitest.dev/).
148
+
149
+ <!-- START footer -->
150
+ <!-- prettier-ignore-start -->
151
+ <!-- markdownlint-disable -->
152
+
153
+
154
+ ## Storm Workspaces
155
+
156
+ Storm workspaces are built using
157
+ <a href="https://nx.dev/" target="_blank">Nx</a>, a set of extensible dev tools
158
+ for monorepos, which helps you develop like Google, Facebook, and Microsoft.
159
+ Building on top of Nx, the Open System provides a set of tools and patterns that
160
+ help you scale your monorepo to many teams while keeping the codebase
161
+ maintainable.
162
+
163
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
164
+ <br />
165
+
166
+ ## Roadmap
167
+
168
+ See the [open issues](https://github.com/storm-software/razorwind/issues) for
169
+ a list of proposed features (and known issues).
170
+
171
+ - [Top Feature Requests](https://github.com/storm-software/razorwind/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
172
+ (Add your votes using the 👍 reaction)
173
+ - [Top Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)
174
+ (Add your votes using the 👍 reaction)
175
+ - [Newest Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
176
+
177
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
178
+ <br />
179
+
180
+ ## Support
181
+
182
+ Reach out to the maintainer at one of the following places:
183
+
184
+ - [Contact](https://stormsoftware.com/contact)
185
+ - [GitHub discussions](https://github.com/storm-software/razorwind/discussions)
186
+ - <support@stormsoftware.com>
187
+
188
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
189
+ <br />
190
+
191
+ ## License
192
+
193
+ This project is licensed under the **Apache License 2.0**. Feel free to edit and
194
+ distribute this template as you like.
195
+
196
+ See [LICENSE](LICENSE) for more information.
197
+
198
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
199
+ <br />
200
+
201
+ ## Changelog
202
+
203
+ This project adheres to
204
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along
205
+ with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md)
206
+ file
207
+
208
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
209
+ <br />
210
+
211
+ ## Contributing
212
+
213
+ First off, thanks for taking the time to contribute! Contributions are what
214
+ makes the open-source community such an amazing place to learn, inspire, and
215
+ create. Any contributions you make will benefit everybody else and are **greatly
216
+ appreciated**.
217
+
218
+ Please try to create bug reports that are:
219
+
220
+ - _Reproducible._ Include steps to reproduce the problem.
221
+ - _Specific._ Include as much detail as possible: which version, what
222
+ environment, etc.
223
+ - _Unique._ Do not duplicate existing opened issues.
224
+ - _Scoped to a Single Bug._ One bug per report.
225
+
226
+ Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md).
227
+
228
+ You can use
229
+ [markdownlint-cli](https://github.com/storm-software/razorwind/markdownlint-cli)
230
+ to check for common markdown style inconsistency.
231
+
232
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
233
+ <br />
234
+
235
+ ## Contributors
236
+
237
+ Thanks goes to these wonderful people
238
+ ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
239
+
240
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
241
+
242
+ <table>
243
+ <tbody>
244
+ <tr>
245
+ <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>
246
+ <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>
247
+ <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>
248
+ </tr>
249
+ </tbody>
250
+ <tfoot>
251
+ <tr>
252
+ <td align="center" size="13px" colspan="7">
253
+ <img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" alt="All Contributors">
254
+ <a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
255
+ </img>
256
+ </td>
257
+ </tr>
258
+ </tfoot>
259
+ </table>
260
+
261
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
262
+
263
+ This project follows the
264
+ [all-contributors](https://allcontributors.org/docs/en/emoji-key)
265
+ specification. Contributions of any kind welcome!
266
+
267
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
268
+ <br />
269
+
270
+ <hr />
271
+ <br />
272
+
273
+ <div align="center">
274
+ <picture>
275
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp">
276
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-light.webp">
277
+ <img src="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp" width="100%" alt="Storm Software" />
278
+ </picture>
279
+ </div>
280
+ <br />
281
+
282
+ <div align="center">
283
+ <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>
284
+ </div>
285
+
286
+ <div align="center">
287
+ <b>Fingerprint:</b> 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D
288
+ </div>
289
+ <br />
290
+
291
+ Storm Software is an open source software development organization and creator
292
+ of Acidic, StormStack and StormCloud.
293
+
294
+ Our mission is to make software development more accessible. Our ideal future is
295
+ one where anyone can create software without years of prior development
296
+ experience serving as a barrier to entry. We hope to achieve this via LLMs,
297
+ Generative AI, and intuitive, high-level data modeling/programming languages.
298
+
299
+ Join us on [Discord](https://discord.gg/MQ6YVzakM5) to chat with the team,
300
+ receive release notifications, ask questions, and get involved.
301
+
302
+ If this sounds interesting, and you would like to help us in creating the next
303
+ generation of development tools, please reach out on our
304
+ [website](https://stormsoftware.com/contact) or join our
305
+ [Slack channel](https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA)!
306
+
307
+ <br />
308
+
309
+ <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>
310
+ <br />
311
+ <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>
312
+ <br />
313
+
314
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
315
+ <br />
316
+ <br />
317
+
318
+
319
+ <!-- markdownlint-restore -->
320
+ <!-- prettier-ignore-end -->
321
+
322
+ <!-- END footer -->
package/dist/index.cjs ADDED
@@ -0,0 +1,50 @@
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");const r=/^(?:light|dark|dim|dimmed|high-contrast|hc|protanopia|deuteranopia|tritanopia|achromatopsia|achromatomaly|monochrome|monochromatic|grayscale|greyscale|bw|black-and-white|black-white|blackWhite|default|base|theme)(?:[A-Z]\w*|[._-].+)?$/i;function i(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function a(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function o(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function s(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function c(e,n,r,l,u){if(!(0,t.isObject)(e))return;let d=o(e,r);if(i(e)){let r=s(e);u.push({path:n.join(`.`),type:d,value:r,cssValue:(0,t.formatTokenValue)(r,d),description:a(e),theme:l});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)||c(r,[...n,t],d,l,u)}function l(e){if(!(0,t.isObject)(e))return[];let n=Object.keys(e).filter(e=>!e.startsWith(`$`));if(n.length>0&&n.every(e=>r.test(e))){let t=e;return n.map(e=>({id:e,tokens:t[e]}))}return[{id:`default`,tokens:e}]}function u(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of l(e)){let e=t.id==="default"?void 0:t.id;c(t.tokens,[],void 0,e,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}function d(e){return e.split(/[-_.\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function f(e){let t=e.themes[0],n=e.themes.length===1?t.displayName:`Oh My Zsh Themes`,r=e.themes.map(e=>`- \`${e.fileName}\` — ${e.displayName} (\`ZSH_THEME="${e.name}"\`)`).join(`
2
+ `),i=e.themes.map(e=>`- \`${e.name}\` (${e.displayName})`).join(`
3
+ `);return`# Installing ${n}
4
+
5
+ Generated by \`@razorwind/zsh\`.
6
+
7
+ These themes target [Oh My Zsh](https://ohmyz.sh/). Install steps follow the
8
+ same pattern as [Dracula for Zsh](https://draculatheme.com/zsh).
9
+
10
+ ## Files
11
+
12
+ ${r}
13
+
14
+ ## Setup
15
+
16
+ 1. Copy each \`*.zsh-theme\` into your Oh My Zsh themes directory (prefer custom):
17
+
18
+ \`\`\`sh
19
+ mkdir -p "\${ZSH_CUSTOM:-\$HOME/.oh-my-zsh/custom}/themes"
20
+ cp *.zsh-theme "\${ZSH_CUSTOM:-\$HOME/.oh-my-zsh/custom}/themes/"
21
+ \`\`\`
22
+
23
+ Or into the built-in themes folder:
24
+
25
+ \`\`\`sh
26
+ cp *.zsh-theme "\${ZSH:-\$HOME/.oh-my-zsh}/themes/"
27
+ \`\`\`
28
+
29
+ 2. Open \`~/.zshrc\` and set \`ZSH_THEME\` to the theme basename (no extension):
30
+
31
+ \`\`\`sh
32
+ ZSH_THEME="${t.name}"
33
+ \`\`\`
34
+
35
+ Available ids:
36
+
37
+ ${i}
38
+
39
+ 3. Reload the shell:
40
+
41
+ \`\`\`sh
42
+ source ~/.zshrc
43
+ \`\`\`
44
+
45
+ ## Select / load theme
46
+
47
+ \`ZSH_THEME\` must match the \`*.zsh-theme\` filename without the extension
48
+ (e.g. \`${t.fileName}\` → \`${t.name}\`).
49
+ `}function p(e){return e.displayName??d(e.name)}const m={name:`razorwind-zsh`},h={success:`#50fa7b`,error:`#ff5555`,warning:`#f1fa8c`,time:`#50fa7b`,context:`#ff79c6`,directory:`#bd93f9`,custom:`#f1fa8c`,git:`#8be9fd`,gitClean:`#50fa7b`,gitDirty:`#f1fa8c`};function g(e,n,r){return(0,t.createDocument)(e,n,m,r)}function _(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function v(e){return(0,t.isObject)(e)&&typeof e.name==`string`&&e.name.length>0}function y(e){if(Array.isArray(e))return e.map((e,t)=>{if(!v(e))throw TypeError(`@razorwind/zsh mapTheme()[${t}] must be a ZshTheme with name`);return e});if(v(e))return[e];if(!(0,t.isObject)(e))throw TypeError(`@razorwind/zsh mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!v(t))throw TypeError(`@razorwind/zsh mapTheme()["${e}"] must be a ZshTheme with name`);return{...t,name:t.name||e}})}function b(e){if(!e.mapTheme)throw Error(`@razorwind/zsh requires options.mapTheme`)}function x(e){return{success:e?.success??h.success,error:e?.error??h.error,warning:e?.warning??h.warning,time:e?.time??h.time,context:e?.context??h.context,directory:e?.directory??h.directory,custom:e?.custom??h.custom,git:e?.git??h.git,gitClean:e?.gitClean??h.gitClean,gitDirty:e?.gitDirty??h.gitDirty}}function S(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():t}function C(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function w(e,t){return e??t?`1`:`0`}function T(e){let t=x(e.colors),n=p(e),r=e.arrowIcon??`➜ `,i=e.timeFormat??`%-H:%M`,a=e.dirTrim??0,o=w(e.displayGit,!0),s=w(e.displayTime,!1),c=w(e.displayContext,!1),l=w(e.displayFullCwd,!1),u=w(e.displayNewLine,!1),d=S(t.success),f=S(t.error),m=S(t.warning),h=S(t.time),g=S(t.context),_=S(t.directory),v=S(t.custom),y=S(t.git),b=S(t.gitClean),T=S(t.gitDirty),E=e.gitPromptPrefix??`%F{${y}}%B(`,D=e.gitPromptSuffix??`%f%b`,O=e.gitPromptClean??`) %F{${b}}%B✓ `,k=e.gitPromptDirty??`) %F{${T}}%B✗ `,A=[`# -*- mode: sh; -*-`,`# vim: set ft=sh :`,`# ${n} — generated by @razorwind/zsh`,`#`,`# Oh My Zsh theme. Segment layout inspired by Dracula for Zsh:`,`# https://draculatheme.com/zsh`,`#`,``,`setopt PROMPT_SUBST`,``];return e.prompt===void 0?A.push(`# Configuration (override in ~/.zshrc before the theme loads)`,`RW_ZSH_DISPLAY_GIT=\${RW_ZSH_DISPLAY_GIT:-${o}}`,`RW_ZSH_DISPLAY_TIME=\${RW_ZSH_DISPLAY_TIME:-${s}}`,`RW_ZSH_DISPLAY_CONTEXT=\${RW_ZSH_DISPLAY_CONTEXT:-${c}}`,`RW_ZSH_DISPLAY_FULL_CWD=\${RW_ZSH_DISPLAY_FULL_CWD:-${l}}`,`RW_ZSH_DIR_TRIM=\${RW_ZSH_DIR_TRIM:-${a}}`,`RW_ZSH_DISPLAY_NEW_LINE=\${RW_ZSH_DISPLAY_NEW_LINE:-${u}}`,`RW_ZSH_ARROW_ICON=\${RW_ZSH_ARROW_ICON:-${C(r)}}`,`RW_ZSH_TIME_FORMAT=\${RW_ZSH_TIME_FORMAT:-${C(i)}}`,``,`rw_zsh_arrow() {`,` if [[ "$1" = "start" ]] && (( ! RW_ZSH_DISPLAY_NEW_LINE )); then`,` print -P -- "$RW_ZSH_ARROW_ICON"`,` elif [[ "$1" = "end" ]] && (( RW_ZSH_DISPLAY_NEW_LINE )); then`,` print -P -- "\\n$RW_ZSH_ARROW_ICON"`,` fi`,`}`,``,`rw_zsh_time_segment() {`,` if (( RW_ZSH_DISPLAY_TIME )); then`,` print -P "%D{$RW_ZSH_TIME_FORMAT} "`,` fi`,`}`,``,`rw_zsh_context() {`,` if (( RW_ZSH_DISPLAY_CONTEXT )); then`,' if [[ -n "${SSH_CONNECTION-}${SSH_CLIENT-}${SSH_TTY-}" ]] || (( EUID == 0 )); then',` print -- '%n@%m '`,` else`,` print -- '%n '`,` fi`,` fi`,`}`,``,`rw_zsh_directory() {`,` if (( RW_ZSH_DISPLAY_FULL_CWD )); then`,' print -P "%${RW_ZSH_DIR_TRIM}~ "',` else`,` print -P '%c '`,` fi`,`}`,``,`rw_zsh_custom_variable() {`,` [[ -z "$RW_ZSH_CUSTOM_VARIABLE" ]] && return`,` print -- "%F{${v}}$RW_ZSH_CUSTOM_VARIABLE "`,`}`,``,`rw_zsh_git_info() {`,` (( ! RW_ZSH_DISPLAY_GIT )) && return`,` print -P -- "$(git_prompt_info)"`,`}`,``,`PROMPT=''`,`# Status arrow — success=${d}, error=${f}, vi-cmd=${m}`,`PROMPT+='%(?:%F{${d}}:%F{${f}})%B$(rw_zsh_arrow start)'`,`PROMPT+='%F{${h}}%B$(rw_zsh_time_segment)'`,`PROMPT+='%F{${g}}%B$(rw_zsh_context)'`,`PROMPT+='%F{${_}}%B$(rw_zsh_directory)'`,`PROMPT+='$(rw_zsh_custom_variable)'`,`PROMPT+='$(rw_zsh_git_info)'`,`PROMPT+='%(?:%F{${d}}:%F{${f}})%B$(rw_zsh_arrow end)'`,`PROMPT+='%f%b'`,``):A.push(`PROMPT=${C(e.prompt)}`,``),e.rprompt!==void 0&&A.push(`RPROMPT=${C(e.rprompt)}`,``),A.push(`ZSH_THEME_GIT_PROMPT_PREFIX=${C(E)}`,`ZSH_THEME_GIT_PROMPT_SUFFIX=${C(D)}`,`ZSH_THEME_GIT_PROMPT_CLEAN=${C(O)}`,`ZSH_THEME_GIT_PROMPT_DIRTY=${C(k)}`,``),e.extra&&A.push(e.extra.replace(/\n$/,``),``),`${A.join(`
50
+ `)}\n`}function E(e,t){b(t);let r=t.outputPath??`zsh-themes`,i=y(t.mapTheme(e.tokens));if(i.length===0)throw Error(`@razorwind/zsh mapTheme() returned no themes`);let a={},o=new Set,s=[];for(let e of i){let t=_(e.name);if(!t)throw TypeError(`@razorwind/zsh theme name "${e.name}" slugifies to an empty string`);if(o.has(t)){let n=2;for(;o.has(`${_(e.name)}-${n}`);)n+=1;t=`${_(e.name)}-${n}`}o.add(t);let i=`${t}.zsh-theme`,c=(0,n.join)(r,i);a[c]=g(c,T({...e,name:t}),`shellscript`),s.push({name:t,displayName:p(e),fileName:i})}let c=t.installGuide??f({themes:s}),l=(0,n.join)(r,`INSTALL.md`);return a[l]=g(l,c,`markdown`),a}var D=(0,e.definePlugin)(e=>({name:`zsh`,generate:async t=>{if(!e)throw Error(`@razorwind/zsh requires options: { mapTheme }`);return E(t,e)}}));exports.default=D,exports.flattenTokens=u,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateZshTheme=E,exports.normalizeThemes=y,exports.renderInstallMd=f,exports.renderZshTheme=T,exports.resolveTokenSets=l,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toZshFg=S;
@@ -0,0 +1,292 @@
1
+ import { Schema, Tokens } from "@razorwind/core/schema";
2
+ import { TokenType } from "@power-plant/dtcg-schema";
3
+ import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
4
+ import { GeneratorFunctionResult } from "@power-plant/core";
5
+ //#region src/types.d.ts
6
+ /**
7
+ * A flattened design token ready for Oh My Zsh 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
+ /**
24
+ * Prompt segment colors for a generated Oh My Zsh theme.
25
+ *
26
+ * Values should be CSS hex (`#rrggbb`) or Zsh named/256 colors. Hex is written
27
+ * as `%F{#rrggbb}` (truecolor), matching modern Zsh prompt styling used by
28
+ * themes such as [Dracula for Zsh](https://draculatheme.com/zsh).
29
+ *
30
+ * @see https://draculatheme.com/zsh
31
+ * @see https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html
32
+ */
33
+ interface ZshThemeColors {
34
+ /** Arrow when last command succeeded (Dracula: green). */
35
+ success?: string;
36
+ /** Arrow when last command failed (Dracula: red). */
37
+ error?: string;
38
+ /** Vi command mode / dirty git accent (Dracula: yellow). */
39
+ warning?: string;
40
+ /** Time segment (Dracula: green). */
41
+ time?: string;
42
+ /** Username / host context (Dracula: magenta). */
43
+ context?: string;
44
+ /** Working directory (Dracula: blue). */
45
+ directory?: string;
46
+ /** Custom variable segment (Dracula: yellow). */
47
+ custom?: string;
48
+ /** Git branch prefix (Dracula: cyan). */
49
+ git?: string;
50
+ /** Git clean indicator (Dracula: green). */
51
+ gitClean?: string;
52
+ /** Git dirty indicator (Dracula: yellow). */
53
+ gitDirty?: string;
54
+ }
55
+ /**
56
+ * Oh My Zsh theme document — rendered to a `*.zsh-theme` script.
57
+ *
58
+ * Segment layout follows the Dracula Zsh theme (arrow, optional time/context,
59
+ * directory, git via `$(git_prompt_info)`). Override `prompt` / `rprompt` for
60
+ * a fully custom prompt string.
61
+ *
62
+ * @see https://draculatheme.com/zsh
63
+ * @see https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
64
+ */
65
+ interface ZshTheme {
66
+ /**
67
+ * Theme id — becomes the `*.zsh-theme` basename and `ZSH_THEME` value.
68
+ * Prefer lowercase with hyphens (e.g. `my-theme`).
69
+ */
70
+ name: string;
71
+ /**
72
+ * Human-readable label for INSTALL.md. Defaults to {@link name}.
73
+ */
74
+ displayName?: string;
75
+ /**
76
+ * Prompt segment colors. Unset keys fall back to Dracula-inspired defaults.
77
+ */
78
+ colors?: ZshThemeColors;
79
+ /**
80
+ * Arrow / prompt marker.
81
+ *
82
+ * @defaultValue `"➜ "`
83
+ */
84
+ arrowIcon?: string;
85
+ /**
86
+ * Full left `PROMPT` override. When set, segment builders are skipped
87
+ * (git prompt vars still emit unless you clear them).
88
+ */
89
+ prompt?: string;
90
+ /**
91
+ * Optional right prompt (`RPROMPT`).
92
+ */
93
+ rprompt?: string;
94
+ /**
95
+ * Show git status via Oh My Zsh `git_prompt_info`.
96
+ *
97
+ * @defaultValue `true`
98
+ */
99
+ displayGit?: boolean;
100
+ /**
101
+ * Show the time segment.
102
+ *
103
+ * @defaultValue `false`
104
+ */
105
+ displayTime?: boolean;
106
+ /**
107
+ * Show username (and host when SSH / root).
108
+ *
109
+ * @defaultValue `false`
110
+ */
111
+ displayContext?: boolean;
112
+ /**
113
+ * Use `%~` (full path under home) instead of `%c` (tail only).
114
+ *
115
+ * @defaultValue `false`
116
+ */
117
+ displayFullCwd?: boolean;
118
+ /**
119
+ * Put the arrow / command input on a new line.
120
+ *
121
+ * @defaultValue `false`
122
+ */
123
+ displayNewLine?: boolean;
124
+ /**
125
+ * When {@link displayFullCwd} is on, trim to this many path segments
126
+ * (`%N~`). `0` = no trim.
127
+ *
128
+ * @defaultValue `0`
129
+ */
130
+ dirTrim?: number;
131
+ /**
132
+ * `strftime`-style time format for `%D{...}`.
133
+ *
134
+ * @defaultValue `"%-H:%M"`
135
+ */
136
+ timeFormat?: string;
137
+ /**
138
+ * Override `ZSH_THEME_GIT_PROMPT_PREFIX`.
139
+ */
140
+ gitPromptPrefix?: string;
141
+ /**
142
+ * Override `ZSH_THEME_GIT_PROMPT_SUFFIX`.
143
+ */
144
+ gitPromptSuffix?: string;
145
+ /**
146
+ * Override `ZSH_THEME_GIT_PROMPT_CLEAN`.
147
+ */
148
+ gitPromptClean?: string;
149
+ /**
150
+ * Override `ZSH_THEME_GIT_PROMPT_DIRTY`.
151
+ */
152
+ gitPromptDirty?: string;
153
+ /**
154
+ * Extra shell appended after the generated theme body.
155
+ */
156
+ extra?: string;
157
+ }
158
+ /**
159
+ * Map extracted design tokens to one or more Oh My Zsh theme documents.
160
+ *
161
+ * Return a single theme, an array, or a record keyed by theme id.
162
+ */
163
+ type GenerateZshTheme = (tokens: Tokens | Record<string, Tokens>) => ZshTheme | ZshTheme[] | Record<string, ZshTheme>;
164
+ /**
165
+ * Options for the Razorwind Oh My Zsh theme generator.
166
+ *
167
+ * @see https://draculatheme.com/zsh
168
+ */
169
+ interface ZshPluginOptions {
170
+ /**
171
+ * Directory (relative to the execution cwd) for generated theme files.
172
+ *
173
+ * @defaultValue `"zsh-themes"`
174
+ */
175
+ outputPath?: string;
176
+ /**
177
+ * Map extracted tokens to Oh My Zsh theme document(s).
178
+ *
179
+ * Required — without a mapping there is nothing to emit.
180
+ */
181
+ mapTheme: GenerateZshTheme;
182
+ /**
183
+ * Override body for generated `INSTALL.md`. When omitted, Oh My Zsh install
184
+ * steps are written (copy into themes dir, set `ZSH_THEME`).
185
+ *
186
+ * @see https://draculatheme.com/zsh
187
+ */
188
+ installGuide?: string;
189
+ /**
190
+ * Restrict flattened helper tokens to these DTCG `$type` values.
191
+ * Does not filter what {@link mapTheme} receives.
192
+ */
193
+ includeTypes?: TokenType[];
194
+ }
195
+ //#endregion
196
+ //#region src/flatten.d.ts
197
+ interface TokenSet {
198
+ id: string;
199
+ tokens: Tokens;
200
+ }
201
+ /**
202
+ * Split `Schema.tokens` into one or more named token sets.
203
+ */
204
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
205
+ /**
206
+ * Flatten DTCG token trees into rows helpful for {@link ZshPluginOptions.mapTheme}.
207
+ */
208
+ declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<ZshPluginOptions, "includeTypes">): FlatToken[];
209
+ //#endregion
210
+ //#region src/install.d.ts
211
+ /**
212
+ * Build Oh My Zsh INSTALL.md for generated `*.zsh-theme` files.
213
+ *
214
+ * Steps mirror the [Dracula Zsh](https://draculatheme.com/zsh) Oh My Zsh
215
+ * activation flow: copy into the themes directory, set `ZSH_THEME`, reload.
216
+ */
217
+ declare function renderInstallMd(options: {
218
+ themes: Array<{
219
+ name: string;
220
+ displayName: string;
221
+ fileName: string;
222
+ }>;
223
+ }): string;
224
+ //#endregion
225
+ //#region src/generate.d.ts
226
+ /**
227
+ * Normalize {@link ZshPluginOptions.mapTheme} results into a theme list.
228
+ */
229
+ declare function normalizeThemes(result: ZshTheme | ZshTheme[] | Record<string, ZshTheme>): ZshTheme[];
230
+ /**
231
+ * Format a color for Zsh `%F{...}` — hex keeps `#`, named/256 pass through.
232
+ */
233
+ declare function toZshFg(color: string): string;
234
+ /**
235
+ * Serialize an Oh My Zsh `*.zsh-theme` script.
236
+ *
237
+ * Segment layout follows [Dracula for Zsh](https://draculatheme.com/zsh):
238
+ * status arrow, optional time/context, directory, custom var, git via
239
+ * Oh My Zsh `git_prompt_info` (no async lib required).
240
+ *
241
+ * @see https://draculatheme.com/zsh
242
+ */
243
+ declare function renderZshTheme(theme: ZshTheme): string;
244
+ /**
245
+ * Generate Oh My Zsh `*.zsh-theme` files (plus INSTALL.md) from a Razorwind schema.
246
+ *
247
+ * @see https://draculatheme.com/zsh
248
+ */
249
+ declare function generateZshTheme(spec: Schema, options: ZshPluginOptions): GeneratorFunctionResult<Schema, ZshPluginOptions>;
250
+ //#endregion
251
+ //#region src/index.d.ts
252
+ /**
253
+ * Razorwind plugin that turns design tokens into Oh My Zsh `*.zsh-theme` files.
254
+ *
255
+ * @remarks
256
+ * Provide {@link ZshPluginOptions.mapTheme} to map extracted tokens to one or more theme documents. Generated output includes `INSTALL.md` with Oh My Zsh activation steps.
257
+ *
258
+ * @see https://draculatheme.com/zsh
259
+ *
260
+ * @example
261
+ * ```ts
262
+ * import { defineConfig } from "@razorwind/core";
263
+ * import zsh, { flattenTokens } from "@razorwind/zsh";
264
+ *
265
+ * export default defineConfig({
266
+ * plugins: [
267
+ * zsh({
268
+ * mapTheme: tokens => {
269
+ * const flat = flattenTokens(tokens);
270
+ * const color = (path: string) =>
271
+ * flat.find(t => t.path === path)?.cssValue ?? "#50fa7b";
272
+ *
273
+ * return {
274
+ * name: "my-theme",
275
+ * colors: {
276
+ * success: color("color.success"),
277
+ * error: color("color.error"),
278
+ * directory: color("color.primary"),
279
+ * git: color("color.accent"),
280
+ * context: color("color.secondary")
281
+ * }
282
+ * };
283
+ * }
284
+ * })
285
+ * ]
286
+ * });
287
+ * ```
288
+ */
289
+ declare const _default: (options?: ZshPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
290
+ //#endregion
291
+ export { type FlatToken, type GenerateZshTheme, type ZshPluginOptions, type ZshTheme, type ZshThemeColors, _default as default, flattenTokens, formatTokenValue, generateZshTheme, normalizeThemes, renderInstallMd, renderZshTheme, resolveTokenSets, toCssVar, toZshFg };
292
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAyBiB;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;UAae;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;;;UAae;;;;;EAKf;;;;EAKA;;;;EAKA,SAAS;;;;;;EAOT;;;;;EAMA;;;;EAKA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;;EAQA;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;;;;KAQU,oBACV,QAAQ,SAAS,eAAe,YAC7B,WAAW,aAAa,eAAe;;;;;;UAO3B;;;;;;EAMf;;;;;;EAOA,UAAU;;;;;;;EAQV;;;;;EAMA,eAAe;;;;UC9HA;EACf;EACA,QAAQ;;;;;iBAMM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAwBa,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,oCACb;;;;;;;;;iBC/Ga,gBAAgB;EAC9B,QAAQ;IAAQ;IAAc;IAAqB;;;;;;;;iBCoCrC,gBACd,QAAQ,WAAW,aAAa,eAAe,YAC9C;;;;iBA+Da,QAAQ;;;;;;;;;;iBAyBR,eAAe,OAAO;;;;;;iBA4ItB,iBACd,MAAM,QACN,SAAS,mBACR,wBAAwB,QAAQ"}
@@ -0,0 +1,292 @@
1
+ import { formatTokenValue, toCssVar } from "@razorwind/core/utils";
2
+ import { Schema, Tokens } from "@razorwind/core/schema";
3
+ import { TokenType } from "@power-plant/dtcg-schema";
4
+ import { GeneratorFunctionResult } from "@power-plant/core";
5
+ //#region src/types.d.ts
6
+ /**
7
+ * A flattened design token ready for Oh My Zsh 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
+ /**
24
+ * Prompt segment colors for a generated Oh My Zsh theme.
25
+ *
26
+ * Values should be CSS hex (`#rrggbb`) or Zsh named/256 colors. Hex is written
27
+ * as `%F{#rrggbb}` (truecolor), matching modern Zsh prompt styling used by
28
+ * themes such as [Dracula for Zsh](https://draculatheme.com/zsh).
29
+ *
30
+ * @see https://draculatheme.com/zsh
31
+ * @see https://zsh.sourceforge.io/Doc/Release/Prompt-Expansion.html
32
+ */
33
+ interface ZshThemeColors {
34
+ /** Arrow when last command succeeded (Dracula: green). */
35
+ success?: string;
36
+ /** Arrow when last command failed (Dracula: red). */
37
+ error?: string;
38
+ /** Vi command mode / dirty git accent (Dracula: yellow). */
39
+ warning?: string;
40
+ /** Time segment (Dracula: green). */
41
+ time?: string;
42
+ /** Username / host context (Dracula: magenta). */
43
+ context?: string;
44
+ /** Working directory (Dracula: blue). */
45
+ directory?: string;
46
+ /** Custom variable segment (Dracula: yellow). */
47
+ custom?: string;
48
+ /** Git branch prefix (Dracula: cyan). */
49
+ git?: string;
50
+ /** Git clean indicator (Dracula: green). */
51
+ gitClean?: string;
52
+ /** Git dirty indicator (Dracula: yellow). */
53
+ gitDirty?: string;
54
+ }
55
+ /**
56
+ * Oh My Zsh theme document — rendered to a `*.zsh-theme` script.
57
+ *
58
+ * Segment layout follows the Dracula Zsh theme (arrow, optional time/context,
59
+ * directory, git via `$(git_prompt_info)`). Override `prompt` / `rprompt` for
60
+ * a fully custom prompt string.
61
+ *
62
+ * @see https://draculatheme.com/zsh
63
+ * @see https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
64
+ */
65
+ interface ZshTheme {
66
+ /**
67
+ * Theme id — becomes the `*.zsh-theme` basename and `ZSH_THEME` value.
68
+ * Prefer lowercase with hyphens (e.g. `my-theme`).
69
+ */
70
+ name: string;
71
+ /**
72
+ * Human-readable label for INSTALL.md. Defaults to {@link name}.
73
+ */
74
+ displayName?: string;
75
+ /**
76
+ * Prompt segment colors. Unset keys fall back to Dracula-inspired defaults.
77
+ */
78
+ colors?: ZshThemeColors;
79
+ /**
80
+ * Arrow / prompt marker.
81
+ *
82
+ * @defaultValue `"➜ "`
83
+ */
84
+ arrowIcon?: string;
85
+ /**
86
+ * Full left `PROMPT` override. When set, segment builders are skipped
87
+ * (git prompt vars still emit unless you clear them).
88
+ */
89
+ prompt?: string;
90
+ /**
91
+ * Optional right prompt (`RPROMPT`).
92
+ */
93
+ rprompt?: string;
94
+ /**
95
+ * Show git status via Oh My Zsh `git_prompt_info`.
96
+ *
97
+ * @defaultValue `true`
98
+ */
99
+ displayGit?: boolean;
100
+ /**
101
+ * Show the time segment.
102
+ *
103
+ * @defaultValue `false`
104
+ */
105
+ displayTime?: boolean;
106
+ /**
107
+ * Show username (and host when SSH / root).
108
+ *
109
+ * @defaultValue `false`
110
+ */
111
+ displayContext?: boolean;
112
+ /**
113
+ * Use `%~` (full path under home) instead of `%c` (tail only).
114
+ *
115
+ * @defaultValue `false`
116
+ */
117
+ displayFullCwd?: boolean;
118
+ /**
119
+ * Put the arrow / command input on a new line.
120
+ *
121
+ * @defaultValue `false`
122
+ */
123
+ displayNewLine?: boolean;
124
+ /**
125
+ * When {@link displayFullCwd} is on, trim to this many path segments
126
+ * (`%N~`). `0` = no trim.
127
+ *
128
+ * @defaultValue `0`
129
+ */
130
+ dirTrim?: number;
131
+ /**
132
+ * `strftime`-style time format for `%D{...}`.
133
+ *
134
+ * @defaultValue `"%-H:%M"`
135
+ */
136
+ timeFormat?: string;
137
+ /**
138
+ * Override `ZSH_THEME_GIT_PROMPT_PREFIX`.
139
+ */
140
+ gitPromptPrefix?: string;
141
+ /**
142
+ * Override `ZSH_THEME_GIT_PROMPT_SUFFIX`.
143
+ */
144
+ gitPromptSuffix?: string;
145
+ /**
146
+ * Override `ZSH_THEME_GIT_PROMPT_CLEAN`.
147
+ */
148
+ gitPromptClean?: string;
149
+ /**
150
+ * Override `ZSH_THEME_GIT_PROMPT_DIRTY`.
151
+ */
152
+ gitPromptDirty?: string;
153
+ /**
154
+ * Extra shell appended after the generated theme body.
155
+ */
156
+ extra?: string;
157
+ }
158
+ /**
159
+ * Map extracted design tokens to one or more Oh My Zsh theme documents.
160
+ *
161
+ * Return a single theme, an array, or a record keyed by theme id.
162
+ */
163
+ type GenerateZshTheme = (tokens: Tokens | Record<string, Tokens>) => ZshTheme | ZshTheme[] | Record<string, ZshTheme>;
164
+ /**
165
+ * Options for the Razorwind Oh My Zsh theme generator.
166
+ *
167
+ * @see https://draculatheme.com/zsh
168
+ */
169
+ interface ZshPluginOptions {
170
+ /**
171
+ * Directory (relative to the execution cwd) for generated theme files.
172
+ *
173
+ * @defaultValue `"zsh-themes"`
174
+ */
175
+ outputPath?: string;
176
+ /**
177
+ * Map extracted tokens to Oh My Zsh theme document(s).
178
+ *
179
+ * Required — without a mapping there is nothing to emit.
180
+ */
181
+ mapTheme: GenerateZshTheme;
182
+ /**
183
+ * Override body for generated `INSTALL.md`. When omitted, Oh My Zsh install
184
+ * steps are written (copy into themes dir, set `ZSH_THEME`).
185
+ *
186
+ * @see https://draculatheme.com/zsh
187
+ */
188
+ installGuide?: string;
189
+ /**
190
+ * Restrict flattened helper tokens to these DTCG `$type` values.
191
+ * Does not filter what {@link mapTheme} receives.
192
+ */
193
+ includeTypes?: TokenType[];
194
+ }
195
+ //#endregion
196
+ //#region src/flatten.d.ts
197
+ interface TokenSet {
198
+ id: string;
199
+ tokens: Tokens;
200
+ }
201
+ /**
202
+ * Split `Schema.tokens` into one or more named token sets.
203
+ */
204
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
205
+ /**
206
+ * Flatten DTCG token trees into rows helpful for {@link ZshPluginOptions.mapTheme}.
207
+ */
208
+ declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<ZshPluginOptions, "includeTypes">): FlatToken[];
209
+ //#endregion
210
+ //#region src/install.d.ts
211
+ /**
212
+ * Build Oh My Zsh INSTALL.md for generated `*.zsh-theme` files.
213
+ *
214
+ * Steps mirror the [Dracula Zsh](https://draculatheme.com/zsh) Oh My Zsh
215
+ * activation flow: copy into the themes directory, set `ZSH_THEME`, reload.
216
+ */
217
+ declare function renderInstallMd(options: {
218
+ themes: Array<{
219
+ name: string;
220
+ displayName: string;
221
+ fileName: string;
222
+ }>;
223
+ }): string;
224
+ //#endregion
225
+ //#region src/generate.d.ts
226
+ /**
227
+ * Normalize {@link ZshPluginOptions.mapTheme} results into a theme list.
228
+ */
229
+ declare function normalizeThemes(result: ZshTheme | ZshTheme[] | Record<string, ZshTheme>): ZshTheme[];
230
+ /**
231
+ * Format a color for Zsh `%F{...}` — hex keeps `#`, named/256 pass through.
232
+ */
233
+ declare function toZshFg(color: string): string;
234
+ /**
235
+ * Serialize an Oh My Zsh `*.zsh-theme` script.
236
+ *
237
+ * Segment layout follows [Dracula for Zsh](https://draculatheme.com/zsh):
238
+ * status arrow, optional time/context, directory, custom var, git via
239
+ * Oh My Zsh `git_prompt_info` (no async lib required).
240
+ *
241
+ * @see https://draculatheme.com/zsh
242
+ */
243
+ declare function renderZshTheme(theme: ZshTheme): string;
244
+ /**
245
+ * Generate Oh My Zsh `*.zsh-theme` files (plus INSTALL.md) from a Razorwind schema.
246
+ *
247
+ * @see https://draculatheme.com/zsh
248
+ */
249
+ declare function generateZshTheme(spec: Schema, options: ZshPluginOptions): GeneratorFunctionResult<Schema, ZshPluginOptions>;
250
+ //#endregion
251
+ //#region src/index.d.ts
252
+ /**
253
+ * Razorwind plugin that turns design tokens into Oh My Zsh `*.zsh-theme` files.
254
+ *
255
+ * @remarks
256
+ * Provide {@link ZshPluginOptions.mapTheme} to map extracted tokens to one or more theme documents. Generated output includes `INSTALL.md` with Oh My Zsh activation steps.
257
+ *
258
+ * @see https://draculatheme.com/zsh
259
+ *
260
+ * @example
261
+ * ```ts
262
+ * import { defineConfig } from "@razorwind/core";
263
+ * import zsh, { flattenTokens } from "@razorwind/zsh";
264
+ *
265
+ * export default defineConfig({
266
+ * plugins: [
267
+ * zsh({
268
+ * mapTheme: tokens => {
269
+ * const flat = flattenTokens(tokens);
270
+ * const color = (path: string) =>
271
+ * flat.find(t => t.path === path)?.cssValue ?? "#50fa7b";
272
+ *
273
+ * return {
274
+ * name: "my-theme",
275
+ * colors: {
276
+ * success: color("color.success"),
277
+ * error: color("color.error"),
278
+ * directory: color("color.primary"),
279
+ * git: color("color.accent"),
280
+ * context: color("color.secondary")
281
+ * }
282
+ * };
283
+ * }
284
+ * })
285
+ * ]
286
+ * });
287
+ * ```
288
+ */
289
+ declare const _default: (options?: ZshPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
290
+ //#endregion
291
+ export { type FlatToken, type GenerateZshTheme, type ZshPluginOptions, type ZshTheme, type ZshThemeColors, _default as default, flattenTokens, formatTokenValue, generateZshTheme, normalizeThemes, renderInstallMd, renderZshTheme, resolveTokenSets, toCssVar, toZshFg };
292
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/install.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,51 @@
1
+ import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,formatTokenValue as n,formatTokenValue as r,isObject as i,toCssVar as a}from"@razorwind/core/utils";import{join as o}from"node:path";const s=/^(?:light|dark|dim|dimmed|high-contrast|hc|protanopia|deuteranopia|tritanopia|achromatopsia|achromatomaly|monochrome|monochromatic|grayscale|greyscale|bw|black-and-white|black-white|blackWhite|default|base|theme)(?:[A-Z]\w*|[._-].+)?$/i;function c(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function l(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function u(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function d(e){if(`$value`in e)return e.$value;if(`value`in e)return e.value;if(typeof e.$ref==`string`)return e.$ref;if(typeof e.ref==`string`)return e.ref}function f(e,t,n,a,o){if(!i(e))return;let s=u(e,n);if(c(e)){let n=d(e);o.push({path:t.join(`.`),type:s,value:n,cssValue:r(n,s),description:l(e),theme:a});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)||f(r,[...t,n],s,a,o)}function p(e){if(!i(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));if(t.length>0&&t.every(e=>s.test(e))){let n=e;return t.map(e=>({id:e,tokens:n[e]}))}return[{id:`default`,tokens:e}]}function m(e,t={}){let n=t.includeTypes?new Set(t.includeTypes):void 0,r=[];for(let t of p(e)){let e=t.id==="default"?void 0:t.id;f(t.tokens,[],void 0,e,r)}return n?r.filter(e=>!e.type||n.has(e.type)):r}function h(e){return e.split(/[-_.\s]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function g(e){let t=e.themes[0],n=e.themes.length===1?t.displayName:`Oh My Zsh Themes`,r=e.themes.map(e=>`- \`${e.fileName}\` — ${e.displayName} (\`ZSH_THEME="${e.name}"\`)`).join(`
2
+ `),i=e.themes.map(e=>`- \`${e.name}\` (${e.displayName})`).join(`
3
+ `);return`# Installing ${n}
4
+
5
+ Generated by \`@razorwind/zsh\`.
6
+
7
+ These themes target [Oh My Zsh](https://ohmyz.sh/). Install steps follow the
8
+ same pattern as [Dracula for Zsh](https://draculatheme.com/zsh).
9
+
10
+ ## Files
11
+
12
+ ${r}
13
+
14
+ ## Setup
15
+
16
+ 1. Copy each \`*.zsh-theme\` into your Oh My Zsh themes directory (prefer custom):
17
+
18
+ \`\`\`sh
19
+ mkdir -p "\${ZSH_CUSTOM:-\$HOME/.oh-my-zsh/custom}/themes"
20
+ cp *.zsh-theme "\${ZSH_CUSTOM:-\$HOME/.oh-my-zsh/custom}/themes/"
21
+ \`\`\`
22
+
23
+ Or into the built-in themes folder:
24
+
25
+ \`\`\`sh
26
+ cp *.zsh-theme "\${ZSH:-\$HOME/.oh-my-zsh}/themes/"
27
+ \`\`\`
28
+
29
+ 2. Open \`~/.zshrc\` and set \`ZSH_THEME\` to the theme basename (no extension):
30
+
31
+ \`\`\`sh
32
+ ZSH_THEME="${t.name}"
33
+ \`\`\`
34
+
35
+ Available ids:
36
+
37
+ ${i}
38
+
39
+ 3. Reload the shell:
40
+
41
+ \`\`\`sh
42
+ source ~/.zshrc
43
+ \`\`\`
44
+
45
+ ## Select / load theme
46
+
47
+ \`ZSH_THEME\` must match the \`*.zsh-theme\` filename without the extension
48
+ (e.g. \`${t.fileName}\` → \`${t.name}\`).
49
+ `}function _(e){return e.displayName??h(e.name)}const v={name:`razorwind-zsh`},y={success:`#50fa7b`,error:`#ff5555`,warning:`#f1fa8c`,time:`#50fa7b`,context:`#ff79c6`,directory:`#bd93f9`,custom:`#f1fa8c`,git:`#8be9fd`,gitClean:`#50fa7b`,gitDirty:`#f1fa8c`};function b(e,n,r){return t(e,n,v,r)}function x(e){return e.trim().toLowerCase().replaceAll(/[^a-z0-9]+/g,`-`).replaceAll(/^-+|-+$/g,``)}function S(e){return i(e)&&typeof e.name==`string`&&e.name.length>0}function C(e){if(Array.isArray(e))return e.map((e,t)=>{if(!S(e))throw TypeError(`@razorwind/zsh mapTheme()[${t}] must be a ZshTheme with name`);return e});if(S(e))return[e];if(!i(e))throw TypeError(`@razorwind/zsh mapTheme() must return a theme, theme array, or theme record`);return Object.entries(e).map(([e,t])=>{if(!S(t))throw TypeError(`@razorwind/zsh mapTheme()["${e}"] must be a ZshTheme with name`);return{...t,name:t.name||e}})}function w(e){if(!e.mapTheme)throw Error(`@razorwind/zsh requires options.mapTheme`)}function T(e){return{success:e?.success??y.success,error:e?.error??y.error,warning:e?.warning??y.warning,time:e?.time??y.time,context:e?.context??y.context,directory:e?.directory??y.directory,custom:e?.custom??y.custom,git:e?.git??y.git,gitClean:e?.gitClean??y.gitClean,gitDirty:e?.gitDirty??y.gitDirty}}function E(e){let t=e.trim();return t.startsWith(`#`)?t.toLowerCase():t}function D(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function O(e,t){return e??t?`1`:`0`}function k(e){let t=T(e.colors),n=_(e),r=e.arrowIcon??`➜ `,i=e.timeFormat??`%-H:%M`,a=e.dirTrim??0,o=O(e.displayGit,!0),s=O(e.displayTime,!1),c=O(e.displayContext,!1),l=O(e.displayFullCwd,!1),u=O(e.displayNewLine,!1),d=E(t.success),f=E(t.error),p=E(t.warning),m=E(t.time),h=E(t.context),g=E(t.directory),v=E(t.custom),y=E(t.git),b=E(t.gitClean),x=E(t.gitDirty),S=e.gitPromptPrefix??`%F{${y}}%B(`,C=e.gitPromptSuffix??`%f%b`,w=e.gitPromptClean??`) %F{${b}}%B✓ `,k=e.gitPromptDirty??`) %F{${x}}%B✗ `,A=[`# -*- mode: sh; -*-`,`# vim: set ft=sh :`,`# ${n} — generated by @razorwind/zsh`,`#`,`# Oh My Zsh theme. Segment layout inspired by Dracula for Zsh:`,`# https://draculatheme.com/zsh`,`#`,``,`setopt PROMPT_SUBST`,``];return e.prompt===void 0?A.push(`# Configuration (override in ~/.zshrc before the theme loads)`,`RW_ZSH_DISPLAY_GIT=\${RW_ZSH_DISPLAY_GIT:-${o}}`,`RW_ZSH_DISPLAY_TIME=\${RW_ZSH_DISPLAY_TIME:-${s}}`,`RW_ZSH_DISPLAY_CONTEXT=\${RW_ZSH_DISPLAY_CONTEXT:-${c}}`,`RW_ZSH_DISPLAY_FULL_CWD=\${RW_ZSH_DISPLAY_FULL_CWD:-${l}}`,`RW_ZSH_DIR_TRIM=\${RW_ZSH_DIR_TRIM:-${a}}`,`RW_ZSH_DISPLAY_NEW_LINE=\${RW_ZSH_DISPLAY_NEW_LINE:-${u}}`,`RW_ZSH_ARROW_ICON=\${RW_ZSH_ARROW_ICON:-${D(r)}}`,`RW_ZSH_TIME_FORMAT=\${RW_ZSH_TIME_FORMAT:-${D(i)}}`,``,`rw_zsh_arrow() {`,` if [[ "$1" = "start" ]] && (( ! RW_ZSH_DISPLAY_NEW_LINE )); then`,` print -P -- "$RW_ZSH_ARROW_ICON"`,` elif [[ "$1" = "end" ]] && (( RW_ZSH_DISPLAY_NEW_LINE )); then`,` print -P -- "\\n$RW_ZSH_ARROW_ICON"`,` fi`,`}`,``,`rw_zsh_time_segment() {`,` if (( RW_ZSH_DISPLAY_TIME )); then`,` print -P "%D{$RW_ZSH_TIME_FORMAT} "`,` fi`,`}`,``,`rw_zsh_context() {`,` if (( RW_ZSH_DISPLAY_CONTEXT )); then`,' if [[ -n "${SSH_CONNECTION-}${SSH_CLIENT-}${SSH_TTY-}" ]] || (( EUID == 0 )); then',` print -- '%n@%m '`,` else`,` print -- '%n '`,` fi`,` fi`,`}`,``,`rw_zsh_directory() {`,` if (( RW_ZSH_DISPLAY_FULL_CWD )); then`,' print -P "%${RW_ZSH_DIR_TRIM}~ "',` else`,` print -P '%c '`,` fi`,`}`,``,`rw_zsh_custom_variable() {`,` [[ -z "$RW_ZSH_CUSTOM_VARIABLE" ]] && return`,` print -- "%F{${v}}$RW_ZSH_CUSTOM_VARIABLE "`,`}`,``,`rw_zsh_git_info() {`,` (( ! RW_ZSH_DISPLAY_GIT )) && return`,` print -P -- "$(git_prompt_info)"`,`}`,``,`PROMPT=''`,`# Status arrow — success=${d}, error=${f}, vi-cmd=${p}`,`PROMPT+='%(?:%F{${d}}:%F{${f}})%B$(rw_zsh_arrow start)'`,`PROMPT+='%F{${m}}%B$(rw_zsh_time_segment)'`,`PROMPT+='%F{${h}}%B$(rw_zsh_context)'`,`PROMPT+='%F{${g}}%B$(rw_zsh_directory)'`,`PROMPT+='$(rw_zsh_custom_variable)'`,`PROMPT+='$(rw_zsh_git_info)'`,`PROMPT+='%(?:%F{${d}}:%F{${f}})%B$(rw_zsh_arrow end)'`,`PROMPT+='%f%b'`,``):A.push(`PROMPT=${D(e.prompt)}`,``),e.rprompt!==void 0&&A.push(`RPROMPT=${D(e.rprompt)}`,``),A.push(`ZSH_THEME_GIT_PROMPT_PREFIX=${D(S)}`,`ZSH_THEME_GIT_PROMPT_SUFFIX=${D(C)}`,`ZSH_THEME_GIT_PROMPT_CLEAN=${D(w)}`,`ZSH_THEME_GIT_PROMPT_DIRTY=${D(k)}`,``),e.extra&&A.push(e.extra.replace(/\n$/,``),``),`${A.join(`
50
+ `)}\n`}function A(e,t){w(t);let n=t.outputPath??`zsh-themes`,r=C(t.mapTheme(e.tokens));if(r.length===0)throw Error(`@razorwind/zsh mapTheme() returned no themes`);let i={},a=new Set,s=[];for(let e of r){let t=x(e.name);if(!t)throw TypeError(`@razorwind/zsh theme name "${e.name}" slugifies to an empty string`);if(a.has(t)){let n=2;for(;a.has(`${x(e.name)}-${n}`);)n+=1;t=`${x(e.name)}-${n}`}a.add(t);let r=`${t}.zsh-theme`,c=o(n,r);i[c]=b(c,k({...e,name:t}),`shellscript`),s.push({name:t,displayName:_(e),fileName:r})}let c=t.installGuide??g({themes:s}),l=o(n,`INSTALL.md`);return i[l]=b(l,c,`markdown`),i}var j=e(e=>({name:`zsh`,generate:async t=>{if(!e)throw Error(`@razorwind/zsh requires options: { mapTheme }`);return A(t,e)}}));export{j as default,m as flattenTokens,n as formatTokenValue,A as generateZshTheme,C as normalizeThemes,g as renderInstallMd,k as renderZshTheme,p as resolveTokenSets,a as toCssVar,E as toZshFg};
51
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@razorwind/zsh",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "description": "Razorwind plugin that generates Oh My Zsh themes from design tokens.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/razorwind.git",
9
+ "directory": "packages/zsh"
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
+ "zsh",
26
+ "oh-my-zsh",
27
+ "theme",
28
+ "prompt",
29
+ "razorwind",
30
+ "design-tokens",
31
+ "dtcg",
32
+ "storm-software"
33
+ ],
34
+ "exports": {
35
+ ".": {
36
+ "require": {
37
+ "types": "./dist/index.d.cts",
38
+ "default": "./dist/index.cjs"
39
+ },
40
+ "import": {
41
+ "types": "./dist/index.d.mts",
42
+ "default": "./dist/index.mjs"
43
+ },
44
+ "default": {
45
+ "types": "./dist/index.d.mts",
46
+ "default": "./dist/index.mjs"
47
+ }
48
+ },
49
+ "./generate": {
50
+ "require": {
51
+ "types": "./dist/index.d.cts",
52
+ "default": "./dist/index.cjs"
53
+ },
54
+ "import": {
55
+ "types": "./dist/index.d.mts",
56
+ "default": "./dist/index.mjs"
57
+ },
58
+ "default": {
59
+ "types": "./dist/index.d.mts",
60
+ "default": "./dist/index.mjs"
61
+ }
62
+ },
63
+ "./package.json": "./package.json"
64
+ },
65
+ "main": "./dist/index.cjs",
66
+ "module": "./dist/index.mjs",
67
+ "types": "./dist/index.d.cts",
68
+ "typings": "dist/index.d.mts",
69
+ "dependencies": {
70
+ "@power-plant/core": "^0.0.75",
71
+ "@power-plant/dtcg-schema": "^0.0.1",
72
+ "@razorwind/core": "0.0.28"
73
+ },
74
+ "devDependencies": {
75
+ "@powerlines/plugin-tsdown": "^0.1.589",
76
+ "@types/node": "^25.9.5",
77
+ "typescript": "^6.0.3"
78
+ },
79
+ "publishConfig": { "access": "public" },
80
+ "gitHead": "1035cb442a4b46f2373951c74b1c89821749be2b"
81
+ }