niuma-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +25 -0
  4. package/README.en.md +99 -0
  5. package/README.md +161 -0
  6. package/package.json +106 -0
  7. package/src/__tests__/RsBadge.spec.ts +40 -0
  8. package/src/__tests__/RsBreadcrumb.spec.ts +172 -0
  9. package/src/__tests__/RsButton.spec.ts +108 -0
  10. package/src/__tests__/RsCalendarGrid.spec.ts +82 -0
  11. package/src/__tests__/RsCard.spec.ts +97 -0
  12. package/src/__tests__/RsCheckbox.spec.ts +36 -0
  13. package/src/__tests__/RsCodeEditor.spec.ts +111 -0
  14. package/src/__tests__/RsConfirmDialog.spec.ts +158 -0
  15. package/src/__tests__/RsContainer.spec.ts +89 -0
  16. package/src/__tests__/RsContextMenu.spec.ts +118 -0
  17. package/src/__tests__/RsDatePicker.spec.ts +88 -0
  18. package/src/__tests__/RsDateTimePicker.spec.ts +69 -0
  19. package/src/__tests__/RsDialog.spec.ts +404 -0
  20. package/src/__tests__/RsDrawer.spec.ts +145 -0
  21. package/src/__tests__/RsDropdown.spec.ts +135 -0
  22. package/src/__tests__/RsEmpty.spec.ts +99 -0
  23. package/src/__tests__/RsForm.spec.ts +173 -0
  24. package/src/__tests__/RsIcon.spec.ts +244 -0
  25. package/src/__tests__/RsInput.spec.ts +269 -0
  26. package/src/__tests__/RsInputNumber.spec.ts +118 -0
  27. package/src/__tests__/RsLabel.spec.ts +106 -0
  28. package/src/__tests__/RsLink.spec.ts +49 -0
  29. package/src/__tests__/RsLoading.spec.ts +84 -0
  30. package/src/__tests__/RsMarkdown.spec.ts +143 -0
  31. package/src/__tests__/RsMenu.spec.ts +119 -0
  32. package/src/__tests__/RsNewComponents.spec.ts +17 -0
  33. package/src/__tests__/RsPagination.spec.ts +158 -0
  34. package/src/__tests__/RsPopover.spec.ts +126 -0
  35. package/src/__tests__/RsScrollbar.spec.ts +53 -0
  36. package/src/__tests__/RsSelect.spec.ts +291 -0
  37. package/src/__tests__/RsSidebar.spec.ts +119 -0
  38. package/src/__tests__/RsSplitPane.spec.ts +177 -0
  39. package/src/__tests__/RsStatCard.spec.ts +79 -0
  40. package/src/__tests__/RsSteps.spec.ts +125 -0
  41. package/src/__tests__/RsTable.perf.spec.ts +103 -0
  42. package/src/__tests__/RsTable.spec.ts +1135 -0
  43. package/src/__tests__/RsTabs.spec.ts +328 -0
  44. package/src/__tests__/RsTerminal.spec.ts +218 -0
  45. package/src/__tests__/RsTimePicker.spec.ts +77 -0
  46. package/src/__tests__/RsToaster.spec.ts +95 -0
  47. package/src/__tests__/RsToolbar.spec.ts +75 -0
  48. package/src/__tests__/RsTooltip.spec.ts +111 -0
  49. package/src/__tests__/RsTree.spec.ts +572 -0
  50. package/src/__tests__/RsUpload.spec.ts +160 -0
  51. package/src/__tests__/RsVirtualList.spec.ts +77 -0
  52. package/src/__tests__/date-picker-utils.spec.ts +70 -0
  53. package/src/__tests__/dialog-viewport.spec.ts +38 -0
  54. package/src/__tests__/iso-local-datetime.spec.ts +58 -0
  55. package/src/__tests__/rs-clipboard.spec.ts +142 -0
  56. package/src/__tests__/setup.ts +12 -0
  57. package/src/__tests__/split-pane-utils.spec.ts +136 -0
  58. package/src/__tests__/table-drag.spec.ts +35 -0
  59. package/src/__tests__/table-edit-utils.spec.ts +194 -0
  60. package/src/__tests__/table-utils.spec.ts +286 -0
  61. package/src/__tests__/theme.spec.ts +22 -0
  62. package/src/__tests__/tree-utils.spec.ts +234 -0
  63. package/src/__tests__/useTableCellTooltip.spec.ts +101 -0
  64. package/src/components/RsAvatar.vue +115 -0
  65. package/src/components/RsBadge.vue +59 -0
  66. package/src/components/RsBreadcrumb.vue +65 -0
  67. package/src/components/RsBreadcrumbItems.vue +36 -0
  68. package/src/components/RsButton.vue +393 -0
  69. package/src/components/RsCalendarGrid.vue +284 -0
  70. package/src/components/RsCard.vue +237 -0
  71. package/src/components/RsCheckbox.vue +189 -0
  72. package/src/components/RsCodeBlock.vue +278 -0
  73. package/src/components/RsCodeEditor.vue +597 -0
  74. package/src/components/RsConfigProvider.vue +92 -0
  75. package/src/components/RsConfirmDialog.vue +178 -0
  76. package/src/components/RsContainer.vue +235 -0
  77. package/src/components/RsContextMenu.vue +238 -0
  78. package/src/components/RsContextMenuItems.vue +77 -0
  79. package/src/components/RsDatePicker.vue +756 -0
  80. package/src/components/RsDateTimePicker.vue +42 -0
  81. package/src/components/RsDialog.vue +486 -0
  82. package/src/components/RsDrawer.vue +175 -0
  83. package/src/components/RsDropdown.vue +252 -0
  84. package/src/components/RsDropdownItems.vue +90 -0
  85. package/src/components/RsEmpty.vue +107 -0
  86. package/src/components/RsForm.vue +131 -0
  87. package/src/components/RsIcon.vue +104 -0
  88. package/src/components/RsInput.vue +1101 -0
  89. package/src/components/RsInputNumber.vue +532 -0
  90. package/src/components/RsLabel.vue +54 -0
  91. package/src/components/RsLink.vue +106 -0
  92. package/src/components/RsLoading.vue +171 -0
  93. package/src/components/RsMarkdown.vue +329 -0
  94. package/src/components/RsMenu.vue +256 -0
  95. package/src/components/RsMenuItems.vue +125 -0
  96. package/src/components/RsMonacoEditor.vue +541 -0
  97. package/src/components/RsPagination.vue +184 -0
  98. package/src/components/RsPopover.vue +77 -0
  99. package/src/components/RsProseEditor.vue +160 -0
  100. package/src/components/RsScrollbar.vue +171 -0
  101. package/src/components/RsSelect.vue +1045 -0
  102. package/src/components/RsSidebar.vue +121 -0
  103. package/src/components/RsSidebarGroup.vue +32 -0
  104. package/src/components/RsSidebarItem.vue +72 -0
  105. package/src/components/RsSplitPane.vue +619 -0
  106. package/src/components/RsStatCard.vue +85 -0
  107. package/src/components/RsSteps.vue +138 -0
  108. package/src/components/RsTable.vue +2664 -0
  109. package/src/components/RsTableColgroup.vue +17 -0
  110. package/src/components/RsTableHeaderRow.vue +30 -0
  111. package/src/components/RsTabs.vue +951 -0
  112. package/src/components/RsTerminal.vue +697 -0
  113. package/src/components/RsTimePicker.vue +554 -0
  114. package/src/components/RsTimePickerColumns.vue +226 -0
  115. package/src/components/RsToaster.vue +396 -0
  116. package/src/components/RsToolbar.vue +135 -0
  117. package/src/components/RsTooltip.vue +142 -0
  118. package/src/components/RsTooltipProvider.vue +20 -0
  119. package/src/components/RsTree.vue +1248 -0
  120. package/src/components/RsUpload.vue +279 -0
  121. package/src/components/RsVirtualList.vue +217 -0
  122. package/src/components/avatar-utils.ts +19 -0
  123. package/src/components/breadcrumb-utils.ts +19 -0
  124. package/src/components/class-utils.ts +29 -0
  125. package/src/components/code-editor-utils.ts +106 -0
  126. package/src/components/code-mirror-completion.ts +40 -0
  127. package/src/components/code-mirror-diagnostics.ts +52 -0
  128. package/src/components/code-mirror-ghost.ts +158 -0
  129. package/src/components/code-mirror-inline-edit.ts +55 -0
  130. package/src/components/code-mirror-intel.ts +81 -0
  131. package/src/components/code-mirror-lang.ts +128 -0
  132. package/src/components/context-menu-utils.ts +20 -0
  133. package/src/components/date-picker-utils.ts +284 -0
  134. package/src/components/date-range-validation.ts +29 -0
  135. package/src/components/date-validation.ts +38 -0
  136. package/src/components/dialog-viewport.ts +48 -0
  137. package/src/components/dialog-window.ts +253 -0
  138. package/src/components/dropdown-utils.ts +31 -0
  139. package/src/components/form-utils.ts +77 -0
  140. package/src/components/input-number-utils.ts +128 -0
  141. package/src/components/input-rules.ts +84 -0
  142. package/src/components/loading-utils.ts +8 -0
  143. package/src/components/markdown-utils.ts +126 -0
  144. package/src/components/menu-utils.ts +48 -0
  145. package/src/components/overlay-utils.ts +47 -0
  146. package/src/components/pagination-utils.ts +38 -0
  147. package/src/components/popover-utils.ts +8 -0
  148. package/src/components/reka.ts +106 -0
  149. package/src/components/resolve-radius.ts +22 -0
  150. package/src/components/resolve-size.ts +29 -0
  151. package/src/components/scrollbar-utils.ts +10 -0
  152. package/src/components/select-utils.ts +72 -0
  153. package/src/components/split-pane-utils.ts +187 -0
  154. package/src/components/steps-utils.ts +22 -0
  155. package/src/components/table/RsTableBodyRow.vue +287 -0
  156. package/src/components/table/RsTableCell.vue +239 -0
  157. package/src/components/table/RsTableCellContent.ts +18 -0
  158. package/src/components/table/RsTableCellEditor.vue +351 -0
  159. package/src/components/table/RsTableEditGutter.vue +54 -0
  160. package/src/components/table/RsTableHeaderFilter.vue +107 -0
  161. package/src/components/table/RsTableRowStatus.vue +69 -0
  162. package/src/components/table/rs-table.css +1141 -0
  163. package/src/components/table/table-context-menu.ts +53 -0
  164. package/src/components/table/table-edit-utils.ts +496 -0
  165. package/src/components/table/table-keys.ts +12 -0
  166. package/src/components/table-drag.ts +215 -0
  167. package/src/components/table-utils.ts +950 -0
  168. package/src/components/tabs-utils.ts +107 -0
  169. package/src/components/terminal-utils.ts +301 -0
  170. package/src/components/terminal-wheel.ts +49 -0
  171. package/src/components/time-picker-utils.ts +167 -0
  172. package/src/components/time-range-validation.ts +23 -0
  173. package/src/components/time-validation.ts +20 -0
  174. package/src/components/tree-utils.ts +518 -0
  175. package/src/components/upload-utils.ts +55 -0
  176. package/src/components/virtual-list-utils.ts +17 -0
  177. package/src/composables/useClickOutside.ts +22 -0
  178. package/src/composables/useRsConfig.ts +91 -0
  179. package/src/composables/useRsI18n.ts +22 -0
  180. package/src/composables/useRsTabsNav.ts +187 -0
  181. package/src/composables/useRsToast.ts +48 -0
  182. package/src/composables/useTableCellTooltip.ts +239 -0
  183. package/src/composables/useTableEdit.ts +271 -0
  184. package/src/composables/useTableRowHighlight.ts +50 -0
  185. package/src/dev/vite-codemirror-deps.ts +20 -0
  186. package/src/icons/custom/api.ts +54 -0
  187. package/src/icons/custom/clickhouse.ts +52 -0
  188. package/src/icons/custom/dameng.ts +83 -0
  189. package/src/icons/custom/ftp.ts +61 -0
  190. package/src/icons/custom/kingbase.ts +52 -0
  191. package/src/icons/custom/mongodb.ts +50 -0
  192. package/src/icons/custom/mysql.ts +51 -0
  193. package/src/icons/custom/oracle.ts +52 -0
  194. package/src/icons/custom/redis.ts +51 -0
  195. package/src/icons/custom/sqlite.ts +50 -0
  196. package/src/icons/custom/sqlserver.ts +52 -0
  197. package/src/icons/custom/vastbase.ts +57 -0
  198. package/src/icons/lucide.ts +78 -0
  199. package/src/icons/registry.ts +35 -0
  200. package/src/index.ts +425 -0
  201. package/src/lib/iso-local-datetime.ts +152 -0
  202. package/src/lib/rs-dayjs.ts +56 -0
  203. package/src/locale/messages.ts +362 -0
  204. package/src/locale/types.ts +5 -0
  205. package/src/monaco/debug-decorations.css +20 -0
  206. package/src/monaco/debug-decorations.ts +70 -0
  207. package/src/monaco/index.ts +22 -0
  208. package/src/monaco/languages/index.ts +21 -0
  209. package/src/monaco/languages/mongodb-shell.ts +125 -0
  210. package/src/monaco/languages/types.ts +55 -0
  211. package/src/monaco/setup.ts +101 -0
  212. package/src/styles.css +1040 -0
  213. package/src/theme/apply.ts +12 -0
  214. package/src/theme/brand.example.css +37 -0
  215. package/src/theme/presets.ts +69 -0
  216. package/src/theme/types.ts +81 -0
  217. package/src/utils/rs-clipboard.ts +272 -0
  218. package/src/vite-env.d.ts +7 -0
  219. package/vite-plugins/monaco-zh-nls.ts +101 -0
  220. package/vite-plugins/silence-antlr-parse-console.ts +29 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # 变更日志
2
+
3
+ 本文件记录项目的重要变更。
4
+
5
+ 格式参考 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.0] - 2026-08-11
10
+
11
+ ### 新增
12
+
13
+ - 以 **Apache License 2.0** 开源发布 `niuma-ui`(npm 包名,无 scope)。
14
+ - 公开文档:中文 / 英文 README、贡献指南、行为准则、安全策略、组件清单与消费方指南。
15
+ - GitHub Issue / PR 模板、CI(`pnpm test`)与 Playground Pages 部署工作流。
16
+ - Playground 升级为对外组件演示门面(分组导航、搜索、首页快速开始、示例代码与 API 简表)。
17
+
18
+ ### 变更
19
+
20
+ - 包名由 `@niuma/ui` 统一为 **`niuma-ui`**;公开 SemVer 基线为 **1.0.0**。
21
+ - 包不再标记为 `private`;消费方通过 npm / git tag / link 安装。
22
+ - `RsTable` 排序相关测试改为点击 `.rs-table__sort` 图标,与组件交互一致。
23
+
24
+ ### 说明
25
+
26
+ - 1.0 之前的私有 tag(如 `v0.1.0`)仅作历史记录;新接入请依赖 `v1.0.0` 及之后版本。
27
+
28
+ [Unreleased]: https://github.com/Blair-Shang/niuma-ui/compare/v1.0.0...HEAD
29
+ [1.0.0]: https://github.com/Blair-Shang/niuma-ui/releases/tag/v1.0.0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,25 @@
1
+ NiuMa UI
2
+ Copyright 2026 Blair-Shang and NiuMa UI contributors
3
+
4
+ This product includes software developed at NiuMa UI
5
+ (https://github.com/Blair-Shang/niuma-ui).
6
+
7
+ Licensed under the Apache License, Version 2.0.
8
+ See the LICENSE file for the full license text.
9
+
10
+ ----
11
+
12
+ 第三方依赖按其各自许可证分发,常见依赖如下(请以 lockfile 中的实际版本为准):
13
+
14
+ | 项目 | 常见许可证 | 用途 |
15
+ |------|------------|------|
16
+ | Vue | MIT | peer 框架 |
17
+ | Reka UI | MIT | 无障碍交互原语 |
18
+ | Lucide (lucide-vue-next) | ISC | 默认图标 |
19
+ | Monaco Editor | MIT | RsMonacoEditor |
20
+ | CodeMirror | MIT | RsCodeEditor |
21
+ | xterm.js | MIT | RsTerminal |
22
+ | marked | MIT | Markdown 解析 |
23
+ | DOMPurify | Apache-2.0 / MPL-2.0 | HTML 消毒 |
24
+ | dayjs | MIT | 日期辅助 |
25
+ | vue-sonner | MIT | Toast 原语 |
package/README.en.md ADDED
@@ -0,0 +1,99 @@
1
+ # niuma-ui
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
4
+ [![Vue 3](https://img.shields.io/badge/Vue-3.5+-42b883.svg)](https://vuejs.org/)
5
+ [![Node](https://img.shields.io/badge/Node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
6
+ [![pnpm](https://img.shields.io/badge/pnpm-%3E%3D9-yellow.svg)](https://pnpm.io/)
7
+
8
+ English | [简体中文](./README.md)
9
+
10
+ Vue 3 design system and component library. Ships consistent `Rs*` components, `--rs-*` design tokens, and optional desktop-tooling editors / terminal wrappers.
11
+
12
+ Use it for ops consoles, database workbenches, internal admin UIs, and product sites that need one visual and interaction language.
13
+
14
+ **Status:** open source from **v1.0.0** under [Apache License 2.0](./LICENSE).
15
+
16
+ ## Features
17
+
18
+ - **Design tokens** — light / dark via `data-rs-theme` and CSS variables; hosts can override a brand layer
19
+ - **Rs\* components** — Button, Form, Dialog, Table, Tree, Tabs, and more
20
+ - **Tooling-oriented** — Monaco, CodeMirror, xterm wrappers (import carefully in light apps)
21
+ - **Accessible primitives** — built on [Reka UI](https://reka-ui.com/); apps only consume `niuma-ui`
22
+ - **Vite-friendly** — source-linked HMR; optional host Vite plugins
23
+
24
+ ## Requirements
25
+
26
+ | Item | Version |
27
+ |------|---------|
28
+ | Node.js | ≥ 20 |
29
+ | Package manager | pnpm ≥ 9 (recommended) |
30
+ | Vue | ^3.5 (`peerDependency`) |
31
+ | Bundler | Vite 5+ / 8 (recommended) |
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pnpm add niuma-ui
37
+ ```
38
+
39
+ Until published to npm, install from a GitHub tag:
40
+
41
+ ```bash
42
+ pnpm add git+https://github.com/Blair-Shang/niuma-ui.git#v1.0.0
43
+ ```
44
+
45
+ Local link and Vite details: **[Consumer guide](./docs/consumers.md)** (Chinese).
46
+
47
+ ## Quick start
48
+
49
+ ```ts
50
+ import { createApp } from 'vue'
51
+ import { RsConfigProvider, RsButton } from 'niuma-ui'
52
+ import 'niuma-ui/styles.css'
53
+ import App from './App.vue'
54
+
55
+ createApp(App).mount('#app')
56
+ ```
57
+
58
+ ```vue
59
+ <script setup lang="ts">
60
+ import { RsConfigProvider, RsButton } from 'niuma-ui'
61
+ </script>
62
+
63
+ <template>
64
+ <RsConfigProvider theme="light" locale="zh-CN">
65
+ <RsButton variant="primary">Hello</RsButton>
66
+ </RsConfigProvider>
67
+ </template>
68
+ ```
69
+
70
+ ## Usage conventions
71
+
72
+ 1. Apps import only from `niuma-ui` — **do not** depend on `reka-ui` directly.
73
+ 2. Styles: `import 'niuma-ui/styles.css'`.
74
+ 3. Wrap the app with `RsConfigProvider`.
75
+ 4. Light apps should avoid pulling Monaco / Terminal / heavy table editors via the main barrel.
76
+
77
+ Component catalog: **[docs/components.md](./docs/components.md)**.
78
+
79
+ ## Live demos
80
+
81
+ - **Component site**: [https://blair-shang.github.io/niuma-ui/](https://blair-shang.github.io/niuma-ui/) (GitHub Pages, deploys from `main`)
82
+ - Local: `pnpm dev` → http://localhost:5180
83
+
84
+ ## Local development
85
+
86
+ ```bash
87
+ pnpm install
88
+ pnpm dev
89
+ pnpm build:playground
90
+ pnpm test
91
+ ```
92
+
93
+ ## Versioning
94
+
95
+ Semantic Versioning. Pin git **tags** (or exact npm versions). See [CHANGELOG.md](./CHANGELOG.md).
96
+
97
+ ## License
98
+
99
+ [Apache License 2.0](./LICENSE). See [NOTICE](./NOTICE) for attribution.
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # niuma-ui
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](./LICENSE)
4
+ [![Vue 3](https://img.shields.io/badge/Vue-3.5+-42b883.svg)](https://vuejs.org/)
5
+ [![Node](https://img.shields.io/badge/Node-%3E%3D20-brightgreen.svg)](https://nodejs.org/)
6
+ [![pnpm](https://img.shields.io/badge/pnpm-%3E%3D9-yellow.svg)](https://pnpm.io/)
7
+
8
+ [English](./README.en.md) | 简体中文
9
+
10
+ Vue 3 设计系统与组件库。提供一致的 `Rs*` 组件、`--rs-*` 设计 token,以及面向桌面工具场景的编辑器 / 终端能力。
11
+
12
+ 适用于运维控制台、数据库工作台、内部后台与产品官网等需要统一视觉与交互语言的 Vue 应用。
13
+
14
+ **状态:** 自 **v1.0.0** 起按 [Apache License 2.0](./LICENSE) 开源。
15
+
16
+ ## 特性
17
+
18
+ - **设计 token**:明暗主题通过 `data-rs-theme` 与 CSS 变量驱动,业务侧可用品牌层覆盖
19
+ - **Rs\* 组件**:Button、Form、Dialog、Table、Tree、Tabs 等完整交互控件
20
+ - **专业工具向**:Monaco、CodeMirror、xterm 等编辑器 / 终端封装(按需引入)
21
+ - **无障碍与焦点**:底层基于 [Reka UI](https://reka-ui.com/),业务层只消费 `niuma-ui`
22
+ - **Vite 友好**:源码直连联调;可选导出消费方 Vite 插件
23
+
24
+ ## 要求
25
+
26
+ | 项 | 版本 |
27
+ |----|------|
28
+ | Node.js | ≥ 20 |
29
+ | 包管理器 | pnpm ≥ 9(推荐) |
30
+ | Vue | ^3.5(peerDependency) |
31
+ | 构建 | Vite 5+ / 8(推荐) |
32
+
33
+ ## 安装
34
+
35
+ ```bash
36
+ pnpm add niuma-ui
37
+ ```
38
+
39
+ 在发布到 npm 之前,可使用 GitHub tag:
40
+
41
+ ```bash
42
+ pnpm add git+https://github.com/Blair-Shang/niuma-ui.git#v1.0.0
43
+ ```
44
+
45
+ 本地 link、Vite 配置、包体积建议见 **[消费方指南](./docs/consumers.md)**。
46
+
47
+ ## 快速开始
48
+
49
+ ```ts
50
+ import { createApp } from 'vue'
51
+ import { RsConfigProvider, RsButton } from 'niuma-ui'
52
+ import 'niuma-ui/styles.css'
53
+ import App from './App.vue'
54
+
55
+ createApp(App).mount('#app')
56
+ ```
57
+
58
+ ```vue
59
+ <script setup lang="ts">
60
+ import { RsConfigProvider, RsButton } from 'niuma-ui'
61
+ </script>
62
+
63
+ <template>
64
+ <RsConfigProvider theme="light" locale="zh-CN">
65
+ <RsButton variant="primary">Hello</RsButton>
66
+ </RsConfigProvider>
67
+ </template>
68
+ ```
69
+
70
+ ## 使用约定
71
+
72
+ 1. 应用与业务模块只允许 `import { … } from 'niuma-ui'`,**禁止**直接依赖 `reka-ui`。
73
+ 2. 样式入口:`import 'niuma-ui/styles.css'`(须在业务品牌 CSS 之前或按文档顺序加载)。
74
+ 3. 根节点使用 `RsConfigProvider` 提供主题、语言与默认控件尺寸。
75
+ 4. 营销站 / 轻量应用避免从主入口导入 Monaco、Terminal、重型 Table 编辑能力;按文件路径或自建薄封装按需引用(见消费方指南)。
76
+
77
+ 组件清单与新增组件规范见 **[组件说明](./docs/components.md)**。
78
+
79
+ ## 在线演示
80
+
81
+ - **组件演示站**:[https://blair-shang.github.io/niuma-ui/](https://blair-shang.github.io/niuma-ui/)(随 `main` 由 [pages.yml](./.github/workflows/pages.yml) 部署)
82
+ - 首次启用:仓库 **Settings → Pages → Source** 选 **GitHub Actions**
83
+ - 本地:`pnpm dev` → http://localhost:5180
84
+
85
+ ## 本地开发
86
+
87
+ ```bash
88
+ pnpm install
89
+ pnpm dev # 组件演示,默认 http://localhost:5180
90
+ pnpm build:playground # 构建演示站静态资源 → playground-dist/
91
+ pnpm test # Vitest
92
+ pnpm test:watch
93
+ ```
94
+
95
+ | 路径 | 说明 |
96
+ |------|------|
97
+ | `src/components/` | `Rs*` 组件实现 |
98
+ | `src/styles.css` | Token 与全局样式 |
99
+ | `src/theme/` | 主题应用与品牌覆盖示例 |
100
+ | `src/monaco/` | Monaco 语言与 Worker 辅助 |
101
+ | `playground/` | 组件演示应用(对外演示门面) |
102
+ | `vite-plugins/` | 可供宿主工程复用的 Vite 插件 |
103
+ | `docs/` | 接入与组件类文档 |
104
+
105
+ ## 版本与发版
106
+
107
+ 遵循 [Semantic Versioning](https://semver.org/):
108
+
109
+ | 变更类型 | 版本 |
110
+ |----------|------|
111
+ | 缺陷修复、文档(兼容) | PATCH `1.0.x` |
112
+ | 新增组件 / 能力(兼容) | MINOR `1.x.0` |
113
+ | 破坏性 API 或 token 更名 | MAJOR `x.0.0` |
114
+
115
+ ```bash
116
+ # 1. 更新 package.json 的 version
117
+ # 2. 更新 CHANGELOG.md
118
+ # 3. 提交并推送 main 后打 tag(推送 tag 会触发 Publish 流水线自动 pnpm publish)
119
+ git tag v1.0.1
120
+ git push origin v1.0.1
121
+ ```
122
+
123
+ 需在仓库 Settings → Secrets 配置 **`NPM_TOKEN`**:
124
+
125
+ 1. 打开 https://www.npmjs.com/settings/shangjian/tokens → **Generate New Token** → **Granular Access Token**
126
+ 2. Permissions:对包 `niuma-ui` 勾选 **Read and write**
127
+ 3. 务必开启 **Bypass two-factor authentication**(否则 CI 会报 `EOTP`)
128
+ 4. 把 token 填进 GitHub Secret 名 `NPM_TOKEN`
129
+
130
+ 不要配置 `NPM_OTP`:一次性验证码约 30 秒过期,无法用于自动发版。
131
+
132
+ 也可在 Actions 里手动运行 **Publish** 工作流。
133
+
134
+ 消费方应锁定 **tag**(或 npm 精确版本),避免长期跟踪 `main`。
135
+
136
+ 详见 [CHANGELOG.md](./CHANGELOG.md)。
137
+
138
+ ## 相关文档
139
+
140
+ | 文档 | 内容 |
141
+ |------|------|
142
+ | [docs/consumers.md](./docs/consumers.md) | 宿主工程接入、联调、CI、体积与插件 |
143
+ | [docs/components.md](./docs/components.md) | 公开组件清单与设计约定 |
144
+ | [CONTRIBUTING.md](./CONTRIBUTING.md) | 贡献指南 |
145
+ | [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) | 行为准则 |
146
+ | [SECURITY.md](./SECURITY.md) | 安全漏洞报告 |
147
+ | [NOTICE](./NOTICE) | Apache 版权与第三方声明 |
148
+ | [README.en.md](./README.en.md) | English README |
149
+ | [src/theme/brand.example.css](./src/theme/brand.example.css) | 品牌色覆盖示例 |
150
+
151
+ ## 仓库信息
152
+
153
+ - **包名**:`niuma-ui`
154
+ - **源码**:https://github.com/Blair-Shang/niuma-ui
155
+ - **Issues**:https://github.com/Blair-Shang/niuma-ui/issues
156
+ - **开源基线**:`v1.0.0`
157
+ - **许可**:[Apache License 2.0](./LICENSE)
158
+
159
+ ## 致谢
160
+
161
+ 交互原语基于 [Reka UI](https://reka-ui.com/);图标默认集成 [Lucide](https://lucide.dev/);代码编辑能力基于 [Monaco Editor](https://microsoft.github.io/monaco-editor/) 与 [CodeMirror](https://codemirror.net/);终端基于 [xterm.js](https://xtermjs.org/)。
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "niuma-ui",
3
+ "version": "1.0.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "description": "Vue 3 设计系统与 Rs* 组件库(--rs-* token)",
7
+ "keywords": [
8
+ "vue",
9
+ "vue3",
10
+ "ui",
11
+ "components",
12
+ "design-system",
13
+ "reka-ui",
14
+ "niuma"
15
+ ],
16
+ "author": "Blair-Shang",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Blair-Shang/niuma-ui.git"
20
+ },
21
+ "homepage": "https://github.com/Blair-Shang/niuma-ui#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/Blair-Shang/niuma-ui/issues"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "main": "./src/index.ts",
29
+ "types": "./src/index.ts",
30
+ "exports": {
31
+ ".": "./src/index.ts",
32
+ "./styles.css": "./src/styles.css",
33
+ "./theme/brand.example.css": "./src/theme/brand.example.css",
34
+ "./vite-plugins/monaco-zh-nls": "./vite-plugins/monaco-zh-nls.ts",
35
+ "./vite-plugins/silence-antlr-parse-console": "./vite-plugins/silence-antlr-parse-console.ts",
36
+ "./package.json": "./package.json"
37
+ },
38
+ "files": [
39
+ "src",
40
+ "vite-plugins",
41
+ "LICENSE",
42
+ "NOTICE",
43
+ "README.md",
44
+ "README.en.md",
45
+ "CHANGELOG.md"
46
+ ],
47
+ "peerDependencies": {
48
+ "vue": "^3.5.39"
49
+ },
50
+ "dependencies": {
51
+ "@codemirror/commands": "^6.10.2",
52
+ "@codemirror/lang-cpp": "^6.0.3",
53
+ "@codemirror/lang-css": "^6.3.1",
54
+ "@codemirror/lang-go": "^6.0.1",
55
+ "@codemirror/lang-html": "^6.4.11",
56
+ "@codemirror/lang-java": "^6.0.2",
57
+ "@codemirror/lang-javascript": "^6.2.5",
58
+ "@codemirror/lang-json": "^6.0.2",
59
+ "@codemirror/lang-markdown": "^6.5.0",
60
+ "@codemirror/lang-python": "^6.2.1",
61
+ "@codemirror/lang-rust": "^6.0.2",
62
+ "@codemirror/lang-sql": "^6.10.0",
63
+ "@codemirror/lang-xml": "^6.1.0",
64
+ "@codemirror/lang-yaml": "^6.1.3",
65
+ "@codemirror/language": "^6.12.3",
66
+ "@codemirror/legacy-modes": "^6.5.3",
67
+ "@codemirror/state": "^6.6.0",
68
+ "@codemirror/theme-one-dark": "^6.1.3",
69
+ "@codemirror/view": "^6.43.1",
70
+ "@xterm/addon-fit": "^0.11.0",
71
+ "codemirror": "^6.0.2",
72
+ "dayjs": "^1.11.21",
73
+ "dompurify": "^3.4.13",
74
+ "lucide-vue-next": "^1.0.0",
75
+ "marked": "^18.0.9",
76
+ "monaco-editor": "^0.55.1",
77
+ "monaco-sql-languages": "^1.2.0",
78
+ "reka-ui": "^2.9.10",
79
+ "vue-sonner": "^2.0.9",
80
+ "xterm": "^5.3.0"
81
+ },
82
+ "devDependencies": {
83
+ "@tailwindcss/vite": "^4.3.2",
84
+ "@types/node": "^26.1.1",
85
+ "@vitejs/plugin-vue": "^6.0.7",
86
+ "@vue/test-utils": "^2.4.11",
87
+ "jsdom": "^29.1.1",
88
+ "tailwindcss": "^4.3.2",
89
+ "typescript": "^5.9.3",
90
+ "vite": "^8.1.3",
91
+ "vitest": "^4.1.9",
92
+ "vue": "^3.5.39",
93
+ "vue-router": "^5.1.0"
94
+ },
95
+ "engines": {
96
+ "node": ">=20",
97
+ "pnpm": ">=9"
98
+ },
99
+ "scripts": {
100
+ "dev": "vite --config playground/vite.config.ts",
101
+ "build:playground": "vite build --config playground/vite.config.ts",
102
+ "preview:playground": "vite preview --config playground/vite.config.ts",
103
+ "test": "vitest run",
104
+ "test:watch": "vitest"
105
+ }
106
+ }
@@ -0,0 +1,40 @@
1
+ import { describe, expect, it } from 'vitest'
2
+ import { mount } from '@vue/test-utils'
3
+ import RsBadge from '../components/RsBadge.vue'
4
+
5
+ const variants = ['default', 'primary', 'success', 'warning', 'danger', 'info'] as const
6
+
7
+ describe('RsBadge', () => {
8
+ it('renders slot text', () => {
9
+ const wrapper = mount(RsBadge, { slots: { default: 'Open' } })
10
+ expect(wrapper.text()).toBe('Open')
11
+ })
12
+
13
+ it('renders as span with base class', () => {
14
+ const wrapper = mount(RsBadge, { slots: { default: 'Tag' } })
15
+ expect(wrapper.element.tagName).toBe('SPAN')
16
+ expect(wrapper.classes()).toContain('rs-badge')
17
+ })
18
+
19
+ it('uses default variant when variant is omitted', () => {
20
+ const wrapper = mount(RsBadge, { slots: { default: '默认' } })
21
+ expect(wrapper.classes()).toContain('rs-badge--default')
22
+ })
23
+
24
+ it.each(variants)('applies %s variant class', (variant) => {
25
+ const wrapper = mount(RsBadge, {
26
+ props: { variant },
27
+ slots: { default: variant },
28
+ })
29
+ expect(wrapper.classes()).toContain(`rs-badge--${variant}`)
30
+ })
31
+
32
+ it('renders longer slot content', () => {
33
+ const wrapper = mount(RsBadge, {
34
+ props: { variant: 'warning' },
35
+ slots: { default: '配额已用尽' },
36
+ })
37
+ expect(wrapper.text()).toBe('配额已用尽')
38
+ expect(wrapper.classes()).toContain('rs-badge--warning')
39
+ })
40
+ })