@razorwind/docgen 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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,265 @@
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 - Documentation Generator
53
+
54
+ **Razorwind - Documentation Generator** is a Power Plant generator that creates MDX documentation for the tokens/components defined in the Razorwind design system.
55
+
56
+ ## Installing
57
+
58
+ Using [pnpm](http://pnpm.io):
59
+
60
+ ```bash
61
+ pnpm add -D @razorwind/docgen
62
+ ```
63
+
64
+ <details>
65
+ <summary>Using npm</summary>
66
+
67
+ ```bash
68
+ npm install -D @razorwind/docgen
69
+ ```
70
+
71
+ </details>
72
+
73
+ <details>
74
+ <summary>Using yarn</summary>
75
+
76
+ ```bash
77
+ yarn add -D @razorwind/docgen
78
+ ```
79
+
80
+ </details>
81
+
82
+ ## Development
83
+
84
+ ### Building
85
+
86
+ Run `nx build docgen` to build the library.
87
+
88
+ ### Running unit tests
89
+
90
+ Run `nx test docgen` to execute the unit tests via [Vitest](https://vitest.dev/).
91
+
92
+ <!-- START footer -->
93
+ <!-- prettier-ignore-start -->
94
+ <!-- markdownlint-disable -->
95
+
96
+
97
+ ## Storm Workspaces
98
+
99
+ Storm workspaces are built using
100
+ <a href="https://nx.dev/" target="_blank">Nx</a>, a set of extensible dev tools
101
+ for monorepos, which helps you develop like Google, Facebook, and Microsoft.
102
+ Building on top of Nx, the Open System provides a set of tools and patterns that
103
+ help you scale your monorepo to many teams while keeping the codebase
104
+ maintainable.
105
+
106
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
107
+ <br />
108
+
109
+ ## Roadmap
110
+
111
+ See the [open issues](https://github.com/storm-software/razorwind/issues) for
112
+ a list of proposed features (and known issues).
113
+
114
+ - [Top Feature Requests](https://github.com/storm-software/razorwind/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
115
+ (Add your votes using the 👍 reaction)
116
+ - [Top Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)
117
+ (Add your votes using the 👍 reaction)
118
+ - [Newest Bugs](https://github.com/storm-software/razorwind/issues?q=is%3Aopen+is%3Aissue+label%3Abug)
119
+
120
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
121
+ <br />
122
+
123
+ ## Support
124
+
125
+ Reach out to the maintainer at one of the following places:
126
+
127
+ - [Contact](https://stormsoftware.com/contact)
128
+ - [GitHub discussions](https://github.com/storm-software/razorwind/discussions)
129
+ - <support@stormsoftware.com>
130
+
131
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
132
+ <br />
133
+
134
+ ## License
135
+
136
+ This project is licensed under the **Apache License 2.0**. Feel free to edit and
137
+ distribute this template as you like.
138
+
139
+ See [LICENSE](LICENSE) for more information.
140
+
141
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
142
+ <br />
143
+
144
+ ## Changelog
145
+
146
+ This project adheres to
147
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html). Every release, along
148
+ with the migration instructions, is documented in the [CHANGELOG](CHANGELOG.md)
149
+ file
150
+
151
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
152
+ <br />
153
+
154
+ ## Contributing
155
+
156
+ First off, thanks for taking the time to contribute! Contributions are what
157
+ makes the open-source community such an amazing place to learn, inspire, and
158
+ create. Any contributions you make will benefit everybody else and are **greatly
159
+ appreciated**.
160
+
161
+ Please try to create bug reports that are:
162
+
163
+ - _Reproducible._ Include steps to reproduce the problem.
164
+ - _Specific._ Include as much detail as possible: which version, what
165
+ environment, etc.
166
+ - _Unique._ Do not duplicate existing opened issues.
167
+ - _Scoped to a Single Bug._ One bug per report.
168
+
169
+ Please adhere to this project's [code of conduct](.github/CODE_OF_CONDUCT.md).
170
+
171
+ You can use
172
+ [markdownlint-cli](https://github.com/storm-software/razorwind/markdownlint-cli)
173
+ to check for common markdown style inconsistency.
174
+
175
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
176
+ <br />
177
+
178
+ ## Contributors
179
+
180
+ Thanks goes to these wonderful people
181
+ ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
182
+
183
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
184
+
185
+ <table>
186
+ <tbody>
187
+ <tr>
188
+ <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>
189
+ <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>
190
+ <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>
191
+ </tr>
192
+ </tbody>
193
+ <tfoot>
194
+ <tr>
195
+ <td align="center" size="13px" colspan="7">
196
+ <img src="https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg" alt="All Contributors">
197
+ <a href="https://all-contributors.js.org/docs/en/bot/usage">Add your contributions</a>
198
+ </img>
199
+ </td>
200
+ </tr>
201
+ </tfoot>
202
+ </table>
203
+
204
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
205
+
206
+ This project follows the
207
+ [all-contributors](https://github.com/all-contributors/all-contributors)
208
+ specification. Contributions of any kind welcome!
209
+
210
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
211
+ <br />
212
+
213
+ <hr />
214
+ <br />
215
+
216
+ <div align="center">
217
+ <picture>
218
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp">
219
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-light.webp">
220
+ <img src="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp" width="100%" alt="Storm Software" />
221
+ </picture>
222
+ </div>
223
+ <br />
224
+
225
+ <div align="center">
226
+ <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>
227
+ </div>
228
+
229
+ <div align="center">
230
+ <b>Fingerprint:</b> 1BD2 7192 7770 2549 F4C9 F238 E6AD C420 DA5C 4C2D
231
+ </div>
232
+ <br />
233
+
234
+ Storm Software is an open source software development organization and creator
235
+ of Acidic, StormStack and StormCloud.
236
+
237
+ Our mission is to make software development more accessible. Our ideal future is
238
+ one where anyone can create software without years of prior development
239
+ experience serving as a barrier to entry. We hope to achieve this via LLMs,
240
+ Generative AI, and intuitive, high-level data modeling/programming languages.
241
+
242
+ Join us on [Discord](https://discord.gg/MQ6YVzakM5) to chat with the team,
243
+ receive release notifications, ask questions, and get involved.
244
+
245
+ If this sounds interesting, and you would like to help us in creating the next
246
+ generation of development tools, please reach out on our
247
+ [website](https://stormsoftware.com/contact) or join our
248
+ [Slack channel](https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA)!
249
+
250
+ <br />
251
+
252
+ <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>
253
+ <br />
254
+ <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>
255
+ <br />
256
+
257
+ <div align="right">[ <a href="#table-of-contents">Back to top ▲</a> ]</div>
258
+ <br />
259
+ <br />
260
+
261
+
262
+ <!-- markdownlint-restore -->
263
+ <!-- prettier-ignore-end -->
264
+
265
+ <!-- END footer -->
package/dist/index.cjs ADDED
@@ -0,0 +1,17 @@
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){return e.trim().replaceAll(/[^\w-]+/g,`-`).replaceAll(/-{2,}/g,`-`).replaceAll(/^-|-$/g,``).toLowerCase()}function i(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`|`,`\\|`).replaceAll(`<`,`\\<`).replaceAll(`{`,`\\{`).replaceAll(/\r?\n/g,` `)}const a=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i;function o(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function s(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function c(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function l(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function u(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 d(e,n,r,i,a,f){if(!o(e))return;let p=l(e,r);if(s(e)){let r=u(e),o=n.join(`.`);f.push({path:o,type:p,value:r,cssValue:(0,t.formatTokenValue)(r,p),cssVar:(0,t.toCssVar)(o,a),description:c(e),theme:i});return}for(let[t,r]of Object.entries(e))t.startsWith(`$`)||d(r,[...n,t],p,i,a,f)}function f(e){if(!o(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));return t.length>0&&t.every(e=>a.test(e))?t.map(t=>({id:t,tokens:e[t]})):[{id:`default`,tokens:e}]}function p(e,t={}){let n=t.cssVarPrefix??`rw`,r=t.includeTypes?new Set(t.includeTypes):void 0,i=[];for(let t of f(e)){let e=t.id==="default"?void 0:t.id;d(t.tokens,[],void 0,e,n,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}function m(e){return`---\n${Object.entries(e).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(`
2
+ `)}\n---`}function h(e){return e.split(/[._-]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _(e){return e.path.split(`.`)[0]||`tokens`}function v(e){let t=new Map;for(let n of e){let e=_(n),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function y(e){return`<span style={{ display: "inline-block", width: "1.25em", height: "1.25em", borderRadius: "4px", verticalAlign: "middle", border: "1px solid rgba(128, 128, 128, 0.35)", background: ${JSON.stringify(e)} }} />`}function b(e){let t=e.some(e=>e.theme),n=e.some(e=>e.description),r=e.some(e=>e.type===`color`),a=[...r?[`Preview`]:[],`Token`,`Type`,`Value`,`CSS Variable`,...t?[`Theme`]:[],...n?[`Description`]:[]],o=e.toSorted((e,t)=>(e.theme??``).localeCompare(t.theme??``)||e.path.localeCompare(t.path)).map(e=>`| ${[...r?[e.type===`color`?y(e.cssValue):``]:[],`\`${i(e.path)}\``,e.type?`\`${i(String(e.type))}\``:`—`,`\`${i(e.cssValue)}\``,`\`${i(e.cssVar)}\``,...t?[e.theme?i(e.theme):`—`]:[],...n?[e.description?i(e.description):`—`]:[]].join(` | `)} |`);return[`| ${a.join(` | `)} |`,`| ${a.map(()=>`---`).join(` | `)} |`,...o].join(`
3
+ `)}function x(e,t){let n=h(e),r=[...new Set(t.map(e=>e.theme).filter(Boolean))],i=[m({title:n,description:`${n} design tokens for the Razorwind design system.`}),`# ${n}`,`${t.length} token${t.length===1?``:`s`} in the \`${e}\` group.`];if(r.length>1)for(let e of r.toSorted((e,t)=>e.localeCompare(t))){let n=t.filter(t=>t.theme===e);i.push(`## ${h(e)}`,b(n))}else i.push(b(t));return`${i.join(`
4
+
5
+ `)}\n`}function S(e){let{title:t,groups:n,hasComponents:i,componentPages:a=[]}=e,o=[...n.values()].reduce((e,t)=>e+t.length,0),s=[...n.keys()].toSorted((e,t)=>e.localeCompare(t)).map(e=>{let t=n.get(e)?.length??0;return`- [${h(e)}](./tokens/${r(e)}.mdx) — ${t} token${t===1?``:`s`}`}),c=[m({title:t,description:`Generated reference documentation for the ${t} design tokens and components.`}),`# ${t}`,`This documentation is generated from the design system specification. It covers ${o} design token${o===1?``:`s`} across ${n.size} group${n.size===1?``:`s`}.`,`## Design Tokens`,s.length>0?s.join(`
6
+ `):`_No design tokens found._`];if(i||a.length>0){let e=a.map(e=>`- [${e.title}](./registry/${e.slug}.mdx) — ${e.count} item${e.count===1?``:`s`}`);c.push(`## Components`,e.length>0?e.join(`
7
+ `):`_No components found._`)}return`${c.join(`
8
+
9
+ `)}\n`}const C={ui:{slug:`ui`,title:`UI Primitives`},component:{slug:`components`,title:`Components`},page:{slug:`pages`,title:`Pages`},block:{slug:`blocks`,title:`Blocks`}},w={"registry:ui":C.ui,"registry:component":C.component,"registry:page":C.page,"registry:block":C.block};function T(e,t){let n=e[t];return typeof n==`string`?n:void 0}function E(e,t){let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}function D(e,t){let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):g(n)?Object.entries(n).map(([e,t])=>typeof t==`string`&&t!==`*`?`${e}@${t}`:e):[]}function O(e){let t=E(e,`categories`);if(t.length>0)return t;let n=E(e,`tags`),r=T(e,`category`);return[...r?[r]:[],...n.filter(e=>e!==r)]}function k(e){if(!g(e))return[];let t=Object.values(e).filter(g),n=[];for(let[e,r]of Object.entries(C)){let i=t.filter(t=>t.type===e);i.length>0&&n.push({type:e,slug:r.slug,title:r.title,items:i})}return n}function A(e){let t=(Array.isArray(e.files)?e.files:[]).map(e=>{if(typeof e==`string`)return`| \`${i(e)}\` | — | — |`;if(!g(e))return;let t=T(e,`path`);if(!t)return;let n=T(e,`type`),r=T(e,`target`);return`| \`${i(t)}\` | ${n?`\`${i(n)}\``:`—`} | ${r?`\`${i(r)}\``:`—`} |`}).filter(e=>e!==void 0);return t.length===0?``:[`| Path | Type | Target |`,`| --- | --- | --- |`,...t].join(`
10
+ `)}function j(e){let t=T(e,`name`)??`unknown`,n=T(e,`title`)??h(t),r=T(e,`description`),a=T(e,`author`),o=O(e),s=D(e,`dependencies`),c=D(e,`registryDependencies`),l=[`## ${n}`];r&&l.push(r);let u=[`- **Name:** \`${t}\``,`- **Type:** \`${String(e.type)}\``,...a?[`- **Author:** ${i(a)}`]:[],...o.length>0?[`- **Categories:** ${o.map(e=>`\`${e}\``).join(`, `)}`]:[]];l.push(u.join(`
11
+ `)),s.length>0&&l.push(`### Dependencies`,s.map(e=>`- \`${e}\``).join(`
12
+ `)),c.length>0&&l.push(`### Registry Dependencies`,c.map(e=>`- \`${e}\``).join(`
13
+ `));let d=A(e);return d&&l.push(`### Files`,d),l.join(`
14
+
15
+ `)}function M(e){let t=[m({title:e.title,description:`${e.title} available in the Razorwind component registry.`}),`# ${e.title}`,`${e.items.length} \`${e.type}\` item${e.items.length===1?``:`s`} in the component registry.`],n=e.items.toSorted((e,t)=>(T(e,`name`)??``).localeCompare(T(t,`name`)??``));for(let e of n)t.push(j(e));return`${t.join(`
16
+
17
+ `)}\n`}function N(e,n,r){return(0,t.createDocument)(e,n,{name:`razorwind-docs`},r)}function P(e,t={}){let i=t.outDir??`docs/design-system`,a=t.title??`Design System`,o=p(e.tokens,t),s=v(o),c=t.skipRegistry?[]:k(e.components),l=c.length>0,u={[(0,n.join)(i,`index.mdx`)]:N((0,n.join)(i,`index.mdx`),S({title:a,groups:s,hasComponents:l,componentPages:c.map(e=>({slug:e.slug,title:e.title,count:e.items.length}))}),`mdx`)};for(let[e,t]of s){let a=(0,n.join)(i,`tokens`,`${r(e)}.mdx`);u[a]=N(a,x(e,t),`mdx`)}for(let e of c){let t=(0,n.join)(i,`registry`,`${e.slug}.mdx`);u[t]=N(t,M(e),`mdx`)}return u[(0,n.join)(i,`tokens.json`)]=N((0,n.join)(i,`tokens.json`),`${JSON.stringify(o,null,2)}\n`,`json`),u}var F=(0,e.definePlugin)({name:`razorwind-docs`,extract:async e=>e,validate:async()=>void 0,generate:async(e,t)=>P(e,t)});exports.COMPONENT_TYPES=C,exports.REGISTRY_ITEM_TYPES=w,exports.default=F,exports.escapeTableCell=i,exports.extractRegistryItems=k,exports.flattenTokens=p,Object.defineProperty(exports,"formatTokenValue",{enumerable:!0,get:function(){return t.formatTokenValue}}),exports.generateDocs=P,exports.groupTokens=v,exports.renderGroupMdx=x,exports.renderIndexMdx=S,exports.renderRegistryItemsMdx=M,exports.renderTokenTable=b,exports.resolveTokenSets=f,Object.defineProperty(exports,"toCssVar",{enumerable:!0,get:function(){return t.toCssVar}}),exports.toSlug=r;
@@ -0,0 +1,197 @@
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
+ * Options for the Razorwind MDX documentation generator.
8
+ */
9
+ interface Options {
10
+ /**
11
+ * Directory (relative to the execution cwd) where generated docs are written.
12
+ *
13
+ * @defaultValue `"docs/design-system"`
14
+ */
15
+ outDir?: string;
16
+ /**
17
+ * Title used on the generated documentation index page.
18
+ *
19
+ * @defaultValue `"Design System"`
20
+ */
21
+ title?: string;
22
+ /**
23
+ * CSS custom-property prefix used when emitting `var(--…)` references.
24
+ *
25
+ * @defaultValue `"rw"`
26
+ */
27
+ cssVarPrefix?: string;
28
+ /**
29
+ * Restrict generated docs to these DTCG `$type` values.
30
+ * When omitted, all supported types are included.
31
+ */
32
+ includeTypes?: TokenType[];
33
+ /**
34
+ * Skip generating component documentation pages.
35
+ *
36
+ * @defaultValue `false`
37
+ */
38
+ skipRegistry?: boolean;
39
+ }
40
+ /**
41
+ * A flattened design token ready for documentation rendering.
42
+ */
43
+ interface FlatToken {
44
+ /** Dot-separated token path (e.g. `color.primary`). */
45
+ path: string;
46
+ /** DTCG `$type`, when known. */
47
+ type?: TokenType | string;
48
+ /** Raw `$value` from the token document. */
49
+ value: unknown;
50
+ /** CSS-friendly string form of {@link value}. */
51
+ cssValue: string;
52
+ /** Stable CSS custom property name for this path. */
53
+ cssVar: string;
54
+ /** Optional DTCG `$description`. */
55
+ description?: string;
56
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
57
+ theme?: string;
58
+ }
59
+ //#endregion
60
+ //#region src/flatten.d.ts
61
+ interface TokenSet {
62
+ id: string;
63
+ tokens: Tokens;
64
+ }
65
+ /**
66
+ * Split `Schema.tokens` into one or more named token sets.
67
+ *
68
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
69
+ * multi-theme input; otherwise the whole document is a single set.
70
+ */
71
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
72
+ /**
73
+ * Flatten DTCG token trees into documentation rows.
74
+ */
75
+ declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<Options, "cssVarPrefix" | "includeTypes">): FlatToken[];
76
+ //#endregion
77
+ //#region src/format.d.ts
78
+ /**
79
+ * Convert an arbitrary label into a lowercase, dash-separated file slug.
80
+ */
81
+ declare function toSlug(value: string): string;
82
+ /**
83
+ * Escape a value so it renders safely inside an MDX markdown table cell.
84
+ */
85
+ declare function escapeTableCell(value: string): string;
86
+ //#endregion
87
+ //#region src/generate.d.ts
88
+ /**
89
+ * Group flattened tokens by their top-level path segment.
90
+ */
91
+ declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
92
+ /**
93
+ * Render a markdown token table for a set of flattened tokens.
94
+ */
95
+ declare function renderTokenTable(tokens: FlatToken[]): string;
96
+ /**
97
+ * Render an MDX documentation page for a single token group.
98
+ */
99
+ declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
100
+ /**
101
+ * Render the documentation index page linking to every generated page.
102
+ */
103
+ declare function renderIndexMdx(input: {
104
+ title: string;
105
+ groups: Map<string, FlatToken[]>;
106
+ hasComponents: boolean;
107
+ componentPages?: {
108
+ slug: string;
109
+ title: string;
110
+ count: number;
111
+ }[];
112
+ }): string;
113
+ /** Component types that receive a dedicated documentation page. */
114
+ declare const COMPONENT_TYPES: {
115
+ readonly ui: {
116
+ readonly slug: "ui";
117
+ readonly title: "UI Primitives";
118
+ };
119
+ readonly component: {
120
+ readonly slug: "components";
121
+ readonly title: "Components";
122
+ };
123
+ readonly page: {
124
+ readonly slug: "pages";
125
+ readonly title: "Pages";
126
+ };
127
+ readonly block: {
128
+ readonly slug: "blocks";
129
+ readonly title: "Blocks";
130
+ };
131
+ };
132
+ /** @deprecated Use {@link COMPONENT_TYPES}. */
133
+ declare const REGISTRY_ITEM_TYPES: {
134
+ readonly "registry:ui": {
135
+ readonly slug: "ui";
136
+ readonly title: "UI Primitives";
137
+ };
138
+ readonly "registry:component": {
139
+ readonly slug: "components";
140
+ readonly title: "Components";
141
+ };
142
+ readonly "registry:page": {
143
+ readonly slug: "pages";
144
+ readonly title: "Pages";
145
+ };
146
+ readonly "registry:block": {
147
+ readonly slug: "blocks";
148
+ readonly title: "Blocks";
149
+ };
150
+ };
151
+ type ComponentDocType = keyof typeof COMPONENT_TYPES;
152
+ type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
153
+ /** A documented component type together with its matching items. */
154
+ interface RegistryItemPage {
155
+ type: ComponentDocType;
156
+ slug: string;
157
+ title: string;
158
+ items: Record<string, unknown>[];
159
+ }
160
+ /**
161
+ * Extract documented components from `schema.components`, grouped by type.
162
+ *
163
+ * Only `ui`, `component`, `page` and `block` items are documented — one page
164
+ * per type.
165
+ */
166
+ declare function extractRegistryItems(components: unknown): RegistryItemPage[];
167
+ /**
168
+ * Render an MDX documentation page for all components of a single type.
169
+ */
170
+ declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
171
+ /**
172
+ * Generate MDX documentation pages from a Razorwind schema.
173
+ *
174
+ * Produces an index page, one page per top-level token group, component
175
+ * pages grouped by type, and a flattened `tokens.json` manifest.
176
+ */
177
+ declare function generateDocs(spec: Schema, options?: Options): GeneratorFunctionResult<Schema, Options>;
178
+ //#endregion
179
+ //#region src/index.d.ts
180
+ /**
181
+ * Razorwind plugin that turns the design system specification (tokens +
182
+ * optional components) into MDX documentation pages.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * import { defineConfig } from "@razorwind/core";
187
+ * import docs from "@razorwind/docs-generator";
188
+ *
189
+ * export default defineConfig({
190
+ * plugins: [docs]
191
+ * });
192
+ * ```
193
+ */
194
+ declare const _default: any;
195
+ //#endregion
196
+ export { COMPONENT_TYPES, type ComponentDocType, type FlatToken, type Options, REGISTRY_ITEM_TYPES, type RegistryItemPage, type RegistryItemType, _default as default, escapeTableCell, extractRegistryItems, flattenTokens, formatTokenValue, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, resolveTokenSets, toCssVar, toSlug };
197
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/format.ts","../src/generate.ts","../src/index.ts"],"mappings":";;;;;;;;UAuBiB;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;;;UCmCe;EACf;EACA,QAAQ;;;;;;;;iBASM,iBACd,QAAQ,SAAS,eAAe,UAC/B;;;;iBAsBa,cACd,QAAQ,SAAS,eAAe,SAChC,UAAS,KAAK,4CACb;;;;;;iBC9Ha,OAAO;;;;iBAYP,gBAAgB;;;;;;iBCmBhB,YAAY,QAAQ,cAAc,YAAY;;;;iBAoB9C,iBAAiB,QAAQ;;;;iBAiDzB,eAAe,eAAe,QAAQ;;;;iBA8BtC,eAAe;EAC7B;EACA,QAAQ,YAAY;EACpB;EACA;IAAmB;IAAc;IAAe;;;;cA8CrC;;;;;;;;;;;;;;;;;;;cAQA;;;;;;;;;;;;;;;;;;KAOD,gCAAgC;KAChC,gCAAgC;;UAG3B;EACf,MAAM;EACN;EACA;EACA,OAAO;;;;;;;;iBA8DO,qBAAqB,sBAAsB;;;;iBAmH3C,uBAAuB,MAAM;;;;;;;iBAwC7B,aACd,MAAM,QACN,UAAS,UACR,wBAAwB,QAAQ"}
@@ -0,0 +1,197 @@
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
+ * Options for the Razorwind MDX documentation generator.
8
+ */
9
+ interface Options {
10
+ /**
11
+ * Directory (relative to the execution cwd) where generated docs are written.
12
+ *
13
+ * @defaultValue `"docs/design-system"`
14
+ */
15
+ outDir?: string;
16
+ /**
17
+ * Title used on the generated documentation index page.
18
+ *
19
+ * @defaultValue `"Design System"`
20
+ */
21
+ title?: string;
22
+ /**
23
+ * CSS custom-property prefix used when emitting `var(--…)` references.
24
+ *
25
+ * @defaultValue `"rw"`
26
+ */
27
+ cssVarPrefix?: string;
28
+ /**
29
+ * Restrict generated docs to these DTCG `$type` values.
30
+ * When omitted, all supported types are included.
31
+ */
32
+ includeTypes?: TokenType[];
33
+ /**
34
+ * Skip generating component documentation pages.
35
+ *
36
+ * @defaultValue `false`
37
+ */
38
+ skipRegistry?: boolean;
39
+ }
40
+ /**
41
+ * A flattened design token ready for documentation rendering.
42
+ */
43
+ interface FlatToken {
44
+ /** Dot-separated token path (e.g. `color.primary`). */
45
+ path: string;
46
+ /** DTCG `$type`, when known. */
47
+ type?: TokenType | string;
48
+ /** Raw `$value` from the token document. */
49
+ value: unknown;
50
+ /** CSS-friendly string form of {@link value}. */
51
+ cssValue: string;
52
+ /** Stable CSS custom property name for this path. */
53
+ cssVar: string;
54
+ /** Optional DTCG `$description`. */
55
+ description?: string;
56
+ /** Theme / set id when tokens are a `Record<string, Tokens>`. */
57
+ theme?: string;
58
+ }
59
+ //#endregion
60
+ //#region src/flatten.d.ts
61
+ interface TokenSet {
62
+ id: string;
63
+ tokens: Tokens;
64
+ }
65
+ /**
66
+ * Split `Schema.tokens` into one or more named token sets.
67
+ *
68
+ * A record whose keys all look like themes (`light`, `dark`, …) is treated as
69
+ * multi-theme input; otherwise the whole document is a single set.
70
+ */
71
+ declare function resolveTokenSets(tokens: Tokens | Record<string, Tokens>): TokenSet[];
72
+ /**
73
+ * Flatten DTCG token trees into documentation rows.
74
+ */
75
+ declare function flattenTokens(tokens: Tokens | Record<string, Tokens>, options?: Pick<Options, "cssVarPrefix" | "includeTypes">): FlatToken[];
76
+ //#endregion
77
+ //#region src/format.d.ts
78
+ /**
79
+ * Convert an arbitrary label into a lowercase, dash-separated file slug.
80
+ */
81
+ declare function toSlug(value: string): string;
82
+ /**
83
+ * Escape a value so it renders safely inside an MDX markdown table cell.
84
+ */
85
+ declare function escapeTableCell(value: string): string;
86
+ //#endregion
87
+ //#region src/generate.d.ts
88
+ /**
89
+ * Group flattened tokens by their top-level path segment.
90
+ */
91
+ declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
92
+ /**
93
+ * Render a markdown token table for a set of flattened tokens.
94
+ */
95
+ declare function renderTokenTable(tokens: FlatToken[]): string;
96
+ /**
97
+ * Render an MDX documentation page for a single token group.
98
+ */
99
+ declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
100
+ /**
101
+ * Render the documentation index page linking to every generated page.
102
+ */
103
+ declare function renderIndexMdx(input: {
104
+ title: string;
105
+ groups: Map<string, FlatToken[]>;
106
+ hasComponents: boolean;
107
+ componentPages?: {
108
+ slug: string;
109
+ title: string;
110
+ count: number;
111
+ }[];
112
+ }): string;
113
+ /** Component types that receive a dedicated documentation page. */
114
+ declare const COMPONENT_TYPES: {
115
+ readonly ui: {
116
+ readonly slug: "ui";
117
+ readonly title: "UI Primitives";
118
+ };
119
+ readonly component: {
120
+ readonly slug: "components";
121
+ readonly title: "Components";
122
+ };
123
+ readonly page: {
124
+ readonly slug: "pages";
125
+ readonly title: "Pages";
126
+ };
127
+ readonly block: {
128
+ readonly slug: "blocks";
129
+ readonly title: "Blocks";
130
+ };
131
+ };
132
+ /** @deprecated Use {@link COMPONENT_TYPES}. */
133
+ declare const REGISTRY_ITEM_TYPES: {
134
+ readonly "registry:ui": {
135
+ readonly slug: "ui";
136
+ readonly title: "UI Primitives";
137
+ };
138
+ readonly "registry:component": {
139
+ readonly slug: "components";
140
+ readonly title: "Components";
141
+ };
142
+ readonly "registry:page": {
143
+ readonly slug: "pages";
144
+ readonly title: "Pages";
145
+ };
146
+ readonly "registry:block": {
147
+ readonly slug: "blocks";
148
+ readonly title: "Blocks";
149
+ };
150
+ };
151
+ type ComponentDocType = keyof typeof COMPONENT_TYPES;
152
+ type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
153
+ /** A documented component type together with its matching items. */
154
+ interface RegistryItemPage {
155
+ type: ComponentDocType;
156
+ slug: string;
157
+ title: string;
158
+ items: Record<string, unknown>[];
159
+ }
160
+ /**
161
+ * Extract documented components from `schema.components`, grouped by type.
162
+ *
163
+ * Only `ui`, `component`, `page` and `block` items are documented — one page
164
+ * per type.
165
+ */
166
+ declare function extractRegistryItems(components: unknown): RegistryItemPage[];
167
+ /**
168
+ * Render an MDX documentation page for all components of a single type.
169
+ */
170
+ declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
171
+ /**
172
+ * Generate MDX documentation pages from a Razorwind schema.
173
+ *
174
+ * Produces an index page, one page per top-level token group, component
175
+ * pages grouped by type, and a flattened `tokens.json` manifest.
176
+ */
177
+ declare function generateDocs(spec: Schema, options?: Options): GeneratorFunctionResult<Schema, Options>;
178
+ //#endregion
179
+ //#region src/index.d.ts
180
+ /**
181
+ * Razorwind plugin that turns the design system specification (tokens +
182
+ * optional components) into MDX documentation pages.
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * import { defineConfig } from "@razorwind/core";
187
+ * import docs from "@razorwind/docs-generator";
188
+ *
189
+ * export default defineConfig({
190
+ * plugins: [docs]
191
+ * });
192
+ * ```
193
+ */
194
+ declare const _default: any;
195
+ //#endregion
196
+ export { COMPONENT_TYPES, type ComponentDocType, type FlatToken, type Options, REGISTRY_ITEM_TYPES, type RegistryItemPage, type RegistryItemType, _default as default, escapeTableCell, extractRegistryItems, flattenTokens, formatTokenValue, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, resolveTokenSets, toCssVar, toSlug };
197
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types.ts","../src/flatten.ts","../src/format.ts","../src/generate.ts","../src/index.ts"],"mappings":""}
package/dist/index.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import{definePlugin as e}from"@razorwind/core/plugin";import{createDocument as t,formatTokenValue as n,toCssVar as r}from"@razorwind/core/utils";import{join as i}from"node:path";function a(e){return e.trim().replaceAll(/[^\w-]+/g,`-`).replaceAll(/-{2,}/g,`-`).replaceAll(/^-|-$/g,``).toLowerCase()}function o(e){return e.replaceAll(`\\`,`\\\\`).replaceAll(`|`,`\\|`).replaceAll(`<`,`\\<`).replaceAll(`{`,`\\{`).replaceAll(/\r?\n/g,` `)}const s=/^(?:light|dark|dim|high-contrast|hc|default|base|theme)(?:[._-].+)?$/i;function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){return`$value`in e||`value`in e||`$ref`in e||`ref`in e}function u(e){if(typeof e.$description==`string`)return e.$description;if(typeof e.description==`string`)return e.description}function d(e,t){return typeof e.$type==`string`?e.$type:typeof e.type==`string`?e.type:t}function f(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 p(e,t,i,a,o,s){if(!c(e))return;let m=d(e,i);if(l(e)){let i=f(e),c=t.join(`.`);s.push({path:c,type:m,value:i,cssValue:n(i,m),cssVar:r(c,o),description:u(e),theme:a});return}for(let[n,r]of Object.entries(e))n.startsWith(`$`)||p(r,[...t,n],m,a,o,s)}function m(e){if(!c(e))return[];let t=Object.keys(e).filter(e=>!e.startsWith(`$`));return t.length>0&&t.every(e=>s.test(e))?t.map(t=>({id:t,tokens:e[t]})):[{id:`default`,tokens:e}]}function h(e,t={}){let n=t.cssVarPrefix??`rw`,r=t.includeTypes?new Set(t.includeTypes):void 0,i=[];for(let t of m(e)){let e=t.id==="default"?void 0:t.id;p(t.tokens,[],void 0,e,n,i)}return r?i.filter(e=>!e.type||r.has(e.type)):i}function g(e){return`---\n${Object.entries(e).map(([e,t])=>`${e}: ${JSON.stringify(t)}`).join(`
2
+ `)}\n---`}function _(e){return e.split(/[._-]/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){return e.path.split(`.`)[0]||`tokens`}function b(e){let t=new Map;for(let n of e){let e=y(n),r=t.get(e)??[];r.push(n),t.set(e,r)}return t}function x(e){return`<span style={{ display: "inline-block", width: "1.25em", height: "1.25em", borderRadius: "4px", verticalAlign: "middle", border: "1px solid rgba(128, 128, 128, 0.35)", background: ${JSON.stringify(e)} }} />`}function S(e){let t=e.some(e=>e.theme),n=e.some(e=>e.description),r=e.some(e=>e.type===`color`),i=[...r?[`Preview`]:[],`Token`,`Type`,`Value`,`CSS Variable`,...t?[`Theme`]:[],...n?[`Description`]:[]],a=e.toSorted((e,t)=>(e.theme??``).localeCompare(t.theme??``)||e.path.localeCompare(t.path)).map(e=>`| ${[...r?[e.type===`color`?x(e.cssValue):``]:[],`\`${o(e.path)}\``,e.type?`\`${o(String(e.type))}\``:`—`,`\`${o(e.cssValue)}\``,`\`${o(e.cssVar)}\``,...t?[e.theme?o(e.theme):`—`]:[],...n?[e.description?o(e.description):`—`]:[]].join(` | `)} |`);return[`| ${i.join(` | `)} |`,`| ${i.map(()=>`---`).join(` | `)} |`,...a].join(`
3
+ `)}function C(e,t){let n=_(e),r=[...new Set(t.map(e=>e.theme).filter(Boolean))],i=[g({title:n,description:`${n} design tokens for the Razorwind design system.`}),`# ${n}`,`${t.length} token${t.length===1?``:`s`} in the \`${e}\` group.`];if(r.length>1)for(let e of r.toSorted((e,t)=>e.localeCompare(t))){let n=t.filter(t=>t.theme===e);i.push(`## ${_(e)}`,S(n))}else i.push(S(t));return`${i.join(`
4
+
5
+ `)}\n`}function w(e){let{title:t,groups:n,hasComponents:r,componentPages:i=[]}=e,o=[...n.values()].reduce((e,t)=>e+t.length,0),s=[...n.keys()].toSorted((e,t)=>e.localeCompare(t)).map(e=>{let t=n.get(e)?.length??0;return`- [${_(e)}](./tokens/${a(e)}.mdx) — ${t} token${t===1?``:`s`}`}),c=[g({title:t,description:`Generated reference documentation for the ${t} design tokens and components.`}),`# ${t}`,`This documentation is generated from the design system specification. It covers ${o} design token${o===1?``:`s`} across ${n.size} group${n.size===1?``:`s`}.`,`## Design Tokens`,s.length>0?s.join(`
6
+ `):`_No design tokens found._`];if(r||i.length>0){let e=i.map(e=>`- [${e.title}](./registry/${e.slug}.mdx) — ${e.count} item${e.count===1?``:`s`}`);c.push(`## Components`,e.length>0?e.join(`
7
+ `):`_No components found._`)}return`${c.join(`
8
+
9
+ `)}\n`}const T={ui:{slug:`ui`,title:`UI Primitives`},component:{slug:`components`,title:`Components`},page:{slug:`pages`,title:`Pages`},block:{slug:`blocks`,title:`Blocks`}},E={"registry:ui":T.ui,"registry:component":T.component,"registry:page":T.page,"registry:block":T.block};function D(e,t){let n=e[t];return typeof n==`string`?n:void 0}function O(e,t){let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}function k(e,t){let n=e[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):v(n)?Object.entries(n).map(([e,t])=>typeof t==`string`&&t!==`*`?`${e}@${t}`:e):[]}function A(e){let t=O(e,`categories`);if(t.length>0)return t;let n=O(e,`tags`),r=D(e,`category`);return[...r?[r]:[],...n.filter(e=>e!==r)]}function j(e){if(!v(e))return[];let t=Object.values(e).filter(v),n=[];for(let[e,r]of Object.entries(T)){let i=t.filter(t=>t.type===e);i.length>0&&n.push({type:e,slug:r.slug,title:r.title,items:i})}return n}function M(e){let t=(Array.isArray(e.files)?e.files:[]).map(e=>{if(typeof e==`string`)return`| \`${o(e)}\` | — | — |`;if(!v(e))return;let t=D(e,`path`);if(!t)return;let n=D(e,`type`),r=D(e,`target`);return`| \`${o(t)}\` | ${n?`\`${o(n)}\``:`—`} | ${r?`\`${o(r)}\``:`—`} |`}).filter(e=>e!==void 0);return t.length===0?``:[`| Path | Type | Target |`,`| --- | --- | --- |`,...t].join(`
10
+ `)}function N(e){let t=D(e,`name`)??`unknown`,n=D(e,`title`)??_(t),r=D(e,`description`),i=D(e,`author`),a=A(e),s=k(e,`dependencies`),c=k(e,`registryDependencies`),l=[`## ${n}`];r&&l.push(r);let u=[`- **Name:** \`${t}\``,`- **Type:** \`${String(e.type)}\``,...i?[`- **Author:** ${o(i)}`]:[],...a.length>0?[`- **Categories:** ${a.map(e=>`\`${e}\``).join(`, `)}`]:[]];l.push(u.join(`
11
+ `)),s.length>0&&l.push(`### Dependencies`,s.map(e=>`- \`${e}\``).join(`
12
+ `)),c.length>0&&l.push(`### Registry Dependencies`,c.map(e=>`- \`${e}\``).join(`
13
+ `));let d=M(e);return d&&l.push(`### Files`,d),l.join(`
14
+
15
+ `)}function P(e){let t=[g({title:e.title,description:`${e.title} available in the Razorwind component registry.`}),`# ${e.title}`,`${e.items.length} \`${e.type}\` item${e.items.length===1?``:`s`} in the component registry.`],n=e.items.toSorted((e,t)=>(D(e,`name`)??``).localeCompare(D(t,`name`)??``));for(let e of n)t.push(N(e));return`${t.join(`
16
+
17
+ `)}\n`}function F(e,n,r){return t(e,n,{name:`razorwind-docs`},r)}function I(e,t={}){let n=t.outDir??`docs/design-system`,r=t.title??`Design System`,o=h(e.tokens,t),s=b(o),c=t.skipRegistry?[]:j(e.components),l=c.length>0,u={[i(n,`index.mdx`)]:F(i(n,`index.mdx`),w({title:r,groups:s,hasComponents:l,componentPages:c.map(e=>({slug:e.slug,title:e.title,count:e.items.length}))}),`mdx`)};for(let[e,t]of s){let r=i(n,`tokens`,`${a(e)}.mdx`);u[r]=F(r,C(e,t),`mdx`)}for(let e of c){let t=i(n,`registry`,`${e.slug}.mdx`);u[t]=F(t,P(e),`mdx`)}return u[i(n,`tokens.json`)]=F(i(n,`tokens.json`),`${JSON.stringify(o,null,2)}\n`,`json`),u}var L=e({name:`razorwind-docs`,extract:async e=>e,validate:async()=>void 0,generate:async(e,t)=>I(e,t)});export{T as COMPONENT_TYPES,E as REGISTRY_ITEM_TYPES,L as default,o as escapeTableCell,j as extractRegistryItems,h as flattenTokens,n as formatTokenValue,I as generateDocs,b as groupTokens,C as renderGroupMdx,w as renderIndexMdx,P as renderRegistryItemsMdx,S as renderTokenTable,m as resolveTokenSets,r as toCssVar,a as toSlug};
18
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@razorwind/docgen",
3
+ "version": "0.0.4",
4
+ "type": "module",
5
+ "description": "Power Plant generator that creates MDX documentation for the tokens/components defined in the design system.",
6
+ "repository": {
7
+ "type": "github",
8
+ "url": "https://github.com/storm-software/razorwind.git",
9
+ "directory": "packages/docgen"
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
+ "maintainers": [
22
+ {
23
+ "name": "Storm Software",
24
+ "email": "contact@stormsoftware.com",
25
+ "url": "https://stormsoftware.com"
26
+ }
27
+ ],
28
+ "contributors": [
29
+ {
30
+ "name": "Storm Software",
31
+ "email": "contact@stormsoftware.com",
32
+ "url": "https://stormsoftware.com"
33
+ }
34
+ ],
35
+ "funding": {
36
+ "type": "github",
37
+ "url": "https://github.com/sponsors/storm-software"
38
+ },
39
+ "license": "Apache-2.0",
40
+ "private": false,
41
+ "files": ["dist"],
42
+ "keywords": [
43
+ "razorwind",
44
+ "design-tokens",
45
+ "design-system",
46
+ "dtcg",
47
+ "power-plant-generator",
48
+ "storm-software"
49
+ ],
50
+ "exports": {
51
+ ".": {
52
+ "require": {
53
+ "types": "./dist/index.d.cts",
54
+ "default": "./dist/index.cjs"
55
+ },
56
+ "import": {
57
+ "types": "./dist/index.d.mts",
58
+ "default": "./dist/index.mjs"
59
+ },
60
+ "default": {
61
+ "types": "./dist/index.d.mts",
62
+ "default": "./dist/index.mjs"
63
+ }
64
+ },
65
+ "./package.json": "./package.json"
66
+ },
67
+ "main": "./dist/index.cjs",
68
+ "module": "./dist/index.mjs",
69
+ "types": "./dist/index.d.cts",
70
+ "typings": "dist/index.d.mts",
71
+ "dependencies": {
72
+ "@power-plant/core": "^0.0.37",
73
+ "@power-plant/dtcg-schema": "^0.0.1",
74
+ "@razorwind/core": "^0.0.8"
75
+ },
76
+ "devDependencies": {
77
+ "@powerlines/plugin-tsdown": "^0.1.560",
78
+ "@types/node": "^25.9.5",
79
+ "typescript": "^6.0.3"
80
+ },
81
+ "publishConfig": { "access": "public" },
82
+ "gitHead": "1d74276595c13888022fafaa5f501092dc8e03a0"
83
+ }