banhaten 0.1.2 → 0.2.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 (365) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/CONTRIBUTING.md +44 -0
  3. package/README.md +145 -328
  4. package/SECURITY.md +15 -0
  5. package/banhaten.config.example.json +1 -3
  6. package/docs/design-system/README.md +20 -0
  7. package/docs/design-system/adoption-quality-remediation.md +87 -0
  8. package/docs/design-system/agent-usage.md +13 -0
  9. package/docs/design-system/appearance-presets.md +189 -0
  10. package/docs/design-system/appearances/default.md +94 -0
  11. package/docs/design-system/appearances/rounded.md +95 -0
  12. package/docs/design-system/appearances/sharp.md +95 -0
  13. package/docs/design-system/component-docs-pattern.md +81 -0
  14. package/docs/design-system/component-showcase-consistency-report.md +217 -0
  15. package/docs/design-system/component-token-consistency-audit.md +173 -0
  16. package/docs/design-system/components/README.md +75 -0
  17. package/docs/design-system/components/accordion.md +67 -0
  18. package/docs/design-system/components/activity-feed.md +106 -0
  19. package/docs/design-system/components/alert-dialog.md +87 -0
  20. package/docs/design-system/components/alert.md +111 -0
  21. package/docs/design-system/components/aspect-ratio.md +59 -0
  22. package/docs/design-system/components/attribute.md +103 -0
  23. package/docs/design-system/components/autocomplete.md +93 -0
  24. package/docs/design-system/components/avatar.md +70 -0
  25. package/docs/design-system/components/badge.md +72 -0
  26. package/docs/design-system/components/banner.md +99 -0
  27. package/docs/design-system/components/breadcrumbs.md +188 -0
  28. package/docs/design-system/components/button-group.md +117 -0
  29. package/docs/design-system/components/button.md +95 -0
  30. package/docs/design-system/components/card.md +95 -0
  31. package/docs/design-system/components/carousel.md +61 -0
  32. package/docs/design-system/components/catalog-components.md +59 -0
  33. package/docs/design-system/components/chart.md +58 -0
  34. package/docs/design-system/components/checkbox.md +68 -0
  35. package/docs/design-system/components/collapsible.md +63 -0
  36. package/docs/design-system/components/command.md +75 -0
  37. package/docs/design-system/components/context-menu.md +59 -0
  38. package/docs/design-system/components/date-picker.md +97 -0
  39. package/docs/design-system/components/divider.md +117 -0
  40. package/docs/design-system/components/empty-state.md +72 -0
  41. package/docs/design-system/components/field.md +86 -0
  42. package/docs/design-system/components/file-upload.md +199 -0
  43. package/docs/design-system/components/hover-card.md +61 -0
  44. package/docs/design-system/components/icons.md +48 -0
  45. package/docs/design-system/components/input-group.md +73 -0
  46. package/docs/design-system/components/input-otp.md +73 -0
  47. package/docs/design-system/components/input.md +84 -0
  48. package/docs/design-system/components/item.md +72 -0
  49. package/docs/design-system/components/kbd.md +62 -0
  50. package/docs/design-system/components/label.md +64 -0
  51. package/docs/design-system/components/menu.md +76 -0
  52. package/docs/design-system/components/menubar.md +60 -0
  53. package/docs/design-system/components/modal.md +119 -0
  54. package/docs/design-system/components/native-select.md +70 -0
  55. package/docs/design-system/components/navigation-menu.md +63 -0
  56. package/docs/design-system/components/onboarding-step-list-item.md +94 -0
  57. package/docs/design-system/components/page-header.md +98 -0
  58. package/docs/design-system/components/pagination.md +71 -0
  59. package/docs/design-system/components/popover.md +77 -0
  60. package/docs/design-system/components/progress-slider.md +66 -0
  61. package/docs/design-system/components/progress.md +92 -0
  62. package/docs/design-system/components/radio-card.md +65 -0
  63. package/docs/design-system/components/radio-group.md +72 -0
  64. package/docs/design-system/components/resizable.md +57 -0
  65. package/docs/design-system/components/scroll-area.md +60 -0
  66. package/docs/design-system/components/segmented-control.md +71 -0
  67. package/docs/design-system/components/select.md +87 -0
  68. package/docs/design-system/components/sheet.md +82 -0
  69. package/docs/design-system/components/sidebar.md +83 -0
  70. package/docs/design-system/components/skeleton.md +91 -0
  71. package/docs/design-system/components/slideout.md +77 -0
  72. package/docs/design-system/components/slider.md +81 -0
  73. package/docs/design-system/components/social-button.md +65 -0
  74. package/docs/design-system/components/spinner.md +77 -0
  75. package/docs/design-system/components/steps.md +77 -0
  76. package/docs/design-system/components/table.md +411 -0
  77. package/docs/design-system/components/tabs.md +69 -0
  78. package/docs/design-system/components/tag.md +95 -0
  79. package/docs/design-system/components/textarea.md +64 -0
  80. package/docs/design-system/components/timeline.md +95 -0
  81. package/docs/design-system/components/toast.md +73 -0
  82. package/docs/design-system/components/toggle.md +96 -0
  83. package/docs/design-system/components/toolbar.md +105 -0
  84. package/docs/design-system/components/tooltip.md +107 -0
  85. package/docs/design-system/components/typography.md +18 -0
  86. package/docs/design-system/density-and-elevation.md +44 -0
  87. package/docs/design-system/design-system-test-missing-items.md +368 -0
  88. package/docs/design-system/direction-and-localization.md +23 -0
  89. package/docs/design-system/form-recipes.md +73 -0
  90. package/docs/design-system/gap-promotion-policy.md +21 -0
  91. package/docs/design-system/gap-promotion-report.md +166 -0
  92. package/docs/design-system/icons.md +69 -0
  93. package/docs/design-system/installation.md +68 -0
  94. package/docs/design-system/launch-comparison-shadcn.md +98 -0
  95. package/docs/design-system/registry-and-cli.md +64 -0
  96. package/docs/design-system/release-policy.md +30 -0
  97. package/docs/design-system/roadmap.md +14 -0
  98. package/docs/design-system/support-matrix.md +23 -0
  99. package/docs/design-system/tabs.md +53 -0
  100. package/docs/design-system/token-governance.md +60 -0
  101. package/package.json +97 -65
  102. package/registry/component-contract.json +40 -0
  103. package/registry/components/alert-dialog.tsx +297 -0
  104. package/registry/components/alert.tsx +86 -65
  105. package/registry/components/aspect-ratio.tsx +30 -0
  106. package/registry/components/autocomplete.tsx +23 -9
  107. package/registry/components/avatar.tsx +7 -7
  108. package/registry/components/badge.tsx +1 -1
  109. package/registry/components/button-group.tsx +321 -4
  110. package/registry/components/button.tsx +38 -17
  111. package/registry/components/card.tsx +68 -59
  112. package/registry/components/carousel.tsx +282 -0
  113. package/registry/components/chart.tsx +203 -0
  114. package/registry/components/checkbox.tsx +3 -3
  115. package/registry/components/collapsible.tsx +69 -0
  116. package/registry/components/command.tsx +174 -0
  117. package/registry/components/context-menu.tsx +236 -0
  118. package/registry/components/date-picker.tsx +246 -105
  119. package/registry/components/expanded/ActivityFeed.tsx +6 -15
  120. package/registry/components/expanded/Banner.tsx +3 -3
  121. package/registry/components/expanded/Breadcrumbs.tsx +5 -5
  122. package/registry/components/expanded/CatalogComponentsShowcase.tsx +13 -13
  123. package/registry/components/expanded/CatalogDivider.tsx +1 -1
  124. package/registry/components/expanded/EmptyState.tsx +1 -1
  125. package/registry/components/expanded/FileUpload.tsx +9 -2
  126. package/registry/components/expanded/OnboardingStepListItem.tsx +2 -4
  127. package/registry/components/expanded/PageHeader.tsx +14 -14
  128. package/registry/components/expanded/Slideout.tsx +15 -415
  129. package/registry/components/expanded/Steps.tsx +4 -4
  130. package/registry/components/expanded/Table.tsx +116 -69
  131. package/registry/components/expanded/Timeline.tsx +3 -3
  132. package/registry/components/expanded/activityFeed.css +1 -1
  133. package/registry/components/expanded/breadcrumbs.css +139 -139
  134. package/registry/components/expanded/catalogComponentsShowcase.css +83 -83
  135. package/registry/components/expanded/divider.css +1 -1
  136. package/registry/components/expanded/emptyState.css +1 -1
  137. package/registry/components/expanded/fileUpload.css +6 -6
  138. package/registry/components/expanded/slideout.css +9 -685
  139. package/registry/components/expanded/steps.css +274 -274
  140. package/registry/components/expanded/table.css +2 -2
  141. package/registry/components/expanded/timeline.css +264 -264
  142. package/registry/components/field.tsx +230 -0
  143. package/registry/components/hover-card.tsx +48 -0
  144. package/registry/components/input-content.ts +1 -0
  145. package/registry/components/input-group.tsx +130 -0
  146. package/registry/components/input-otp.tsx +13 -3
  147. package/registry/components/input.tsx +70 -45
  148. package/registry/components/item.tsx +189 -0
  149. package/registry/components/kbd.tsx +151 -0
  150. package/registry/components/label.tsx +78 -0
  151. package/registry/components/menu.tsx +34 -246
  152. package/registry/components/menubar.tsx +226 -0
  153. package/registry/components/modal.tsx +216 -143
  154. package/registry/components/native-select.tsx +205 -0
  155. package/registry/components/navigation-menu.tsx +171 -0
  156. package/registry/components/pagination.tsx +80 -58
  157. package/registry/components/popover.tsx +162 -664
  158. package/registry/components/radio-card.tsx +116 -87
  159. package/registry/components/radio-group.tsx +1 -1
  160. package/registry/components/resizable.tsx +74 -0
  161. package/registry/components/scroll-area.tsx +67 -0
  162. package/registry/components/segmented-control.tsx +87 -0
  163. package/registry/components/select-content.tsx +2 -2
  164. package/registry/components/select.tsx +54 -20
  165. package/registry/components/sheet.tsx +305 -0
  166. package/registry/components/sidebar.tsx +352 -0
  167. package/registry/components/skeleton.css +0 -3
  168. package/registry/components/social-button.tsx +116 -30
  169. package/registry/components/spinner.tsx +18 -55
  170. package/registry/components/{expanded/tabs.css → tabs.css} +127 -106
  171. package/registry/components/tabs.tsx +246 -0
  172. package/registry/components/tag.tsx +2 -2
  173. package/registry/components/textarea.tsx +4 -4
  174. package/registry/components/toast.tsx +136 -0
  175. package/registry/components/toggle.tsx +2 -2
  176. package/registry/components/toolbar.tsx +89 -17
  177. package/registry/components/tooltip.tsx +1 -1
  178. package/registry/examples/alert-demo.tsx +25 -5
  179. package/registry/examples/alert-dialog-demo.tsx +42 -0
  180. package/registry/examples/aspect-ratio-demo.tsx +11 -0
  181. package/registry/examples/attribute-demo.tsx +1 -1
  182. package/registry/examples/autocomplete-demo.tsx +3 -3
  183. package/registry/examples/avatar-demo.tsx +7 -7
  184. package/registry/examples/badge-demo.tsx +1 -1
  185. package/registry/examples/button-demo.tsx +6 -6
  186. package/registry/examples/button-group-demo.tsx +23 -2
  187. package/registry/examples/card-demo.tsx +46 -8
  188. package/registry/examples/carousel-demo.tsx +43 -0
  189. package/registry/examples/chart-demo.tsx +33 -0
  190. package/registry/examples/checkbox-demo.tsx +5 -5
  191. package/registry/examples/collapsible-demo.tsx +16 -0
  192. package/registry/examples/collection-filter-bar-demo.tsx +135 -0
  193. package/registry/examples/command-demo.tsx +42 -0
  194. package/registry/examples/{expanded/command-bar-demo.tsx → command-palette-demo.tsx} +5 -15
  195. package/registry/examples/context-menu-demo.tsx +29 -0
  196. package/registry/examples/control-density-contract-demo.tsx +61 -0
  197. package/registry/examples/date-picker-demo.tsx +12 -12
  198. package/registry/examples/divider-demo.tsx +3 -3
  199. package/registry/examples/expanded/banner-demo.tsx +1 -1
  200. package/registry/examples/expanded/breadcrumbs-demo.tsx +1 -1
  201. package/registry/examples/expanded/empty-state-demo.tsx +1 -1
  202. package/registry/examples/expanded/file-upload-demo.tsx +1 -1
  203. package/registry/examples/expanded/onboarding-step-demo.tsx +1 -1
  204. package/registry/examples/expanded/slideout-demo.tsx +2 -2
  205. package/registry/examples/expanded/steps-demo.tsx +1 -1
  206. package/registry/examples/expanded/tabs-demo.tsx +2 -2
  207. package/registry/examples/expanded/timeline-demo.tsx +1 -1
  208. package/registry/examples/field-demo.tsx +51 -0
  209. package/registry/examples/hover-card-demo.tsx +23 -0
  210. package/registry/examples/input-demo.tsx +6 -6
  211. package/registry/examples/input-group-demo.tsx +16 -0
  212. package/registry/examples/input-otp-demo.tsx +4 -4
  213. package/registry/examples/item-demo.tsx +46 -0
  214. package/registry/examples/kbd-demo.tsx +11 -0
  215. package/registry/examples/label-demo.tsx +20 -0
  216. package/registry/examples/menu-demo.tsx +1 -1
  217. package/registry/examples/menubar-demo.tsx +34 -0
  218. package/registry/examples/modal-demo.tsx +67 -9
  219. package/registry/examples/native-select-demo.tsx +16 -0
  220. package/registry/examples/navigation-menu-demo.tsx +29 -0
  221. package/registry/examples/pagination-demo.tsx +6 -3
  222. package/registry/examples/popover-demo.tsx +19 -19
  223. package/registry/examples/progress-demo.tsx +1 -1
  224. package/registry/examples/progress-slider-demo.tsx +1 -1
  225. package/registry/examples/radio-card-demo.tsx +4 -4
  226. package/registry/examples/radio-group-demo.tsx +2 -2
  227. package/registry/examples/resizable-demo.tsx +22 -0
  228. package/registry/examples/results-toolbar-demo.tsx +44 -0
  229. package/registry/examples/scroll-area-demo.tsx +15 -0
  230. package/registry/examples/segmented-control-demo.tsx +39 -0
  231. package/registry/examples/select-demo.tsx +1 -1
  232. package/registry/examples/sheet-demo.tsx +47 -0
  233. package/registry/examples/sidebar-demo.tsx +55 -0
  234. package/registry/examples/slider-demo.tsx +3 -3
  235. package/registry/examples/social-button-demo.tsx +18 -8
  236. package/registry/examples/spinner-demo.tsx +13 -13
  237. package/registry/examples/tabs-demo.tsx +13 -0
  238. package/registry/examples/tag-demo.tsx +1 -1
  239. package/registry/examples/textarea-demo.tsx +4 -4
  240. package/registry/examples/toast-demo.tsx +35 -0
  241. package/registry/examples/toggle-demo.tsx +6 -6
  242. package/registry/examples/tooltip-demo.tsx +4 -4
  243. package/registry/guidance/USAGE.md +27 -0
  244. package/registry/hooks/use-direction.ts +193 -13
  245. package/registry/index.json +6010 -432
  246. package/registry/styles/globals.css +3112 -4690
  247. package/registry.json +1582 -0
  248. package/schema/config.schema.json +51 -0
  249. package/schema/registry.schema.json +190 -0
  250. package/schema/tokens.schema.json +163 -0
  251. package/src/cli/command-line.js +194 -0
  252. package/src/cli/config-editors.js +9 -0
  253. package/src/cli/doctor.js +399 -0
  254. package/src/cli/file-transaction.js +295 -0
  255. package/src/cli/global-css.js +153 -0
  256. package/src/cli/index.js +639 -1391
  257. package/src/cli/install-plan.js +592 -0
  258. package/src/cli/install-receipt.js +171 -0
  259. package/src/cli/jsonc.js +203 -0
  260. package/src/cli/package-install-state.js +254 -0
  261. package/src/cli/package-manager.js +238 -0
  262. package/src/cli/package-plan.js +185 -0
  263. package/src/cli/package-version.js +97 -0
  264. package/src/cli/registry-query.js +207 -0
  265. package/src/cli/reporting.js +55 -0
  266. package/src/cli/schema-validation.js +19 -0
  267. package/src/cli/source-scanner.js +686 -0
  268. package/src/cli/vite-config.js +478 -0
  269. package/tokens/banhaten.tokens.json +4313 -310
  270. package/registry/assets/avatars/avatar-02.jpg +0 -0
  271. package/registry/assets/avatars/avatar-03.jpg +0 -0
  272. package/registry/assets/avatars/avatar-04.jpg +0 -0
  273. package/registry/assets/avatars/avatar-05.jpg +0 -0
  274. package/registry/assets/avatars/avatar-06.jpg +0 -0
  275. package/registry/assets/avatars/avatar-07.jpg +0 -0
  276. package/registry/assets/avatars/avatar-08.jpg +0 -0
  277. package/registry/assets/avatars/avatar-09.jpg +0 -0
  278. package/registry/assets/avatars/avatar-10.jpg +0 -0
  279. package/registry/assets/avatars/avatar-11.jpg +0 -0
  280. package/registry/assets/avatars/avatar-12.jpg +0 -0
  281. package/registry/assets/avatars/avatar-13.jpg +0 -0
  282. package/registry/assets/avatars/avatar-14.jpg +0 -0
  283. package/registry/assets/avatars/avatar-15.jpg +0 -0
  284. package/registry/assets/avatars/avatar-16.jpg +0 -0
  285. package/registry/assets/avatars/avatar-17.jpg +0 -0
  286. package/registry/assets/avatars/avatar-18.jpg +0 -0
  287. package/registry/assets/avatars/avatar-19.jpg +0 -0
  288. package/registry/assets/avatars/avatar-20.jpg +0 -0
  289. package/registry/assets/avatars/avatar-21.jpg +0 -0
  290. package/registry/assets/avatars/avatar-22.jpg +0 -0
  291. package/registry/assets/avatars/avatar-23.jpg +0 -0
  292. package/registry/assets/avatars/avatar-24.jpg +0 -0
  293. package/registry/assets/avatars/avatar-25.jpg +0 -0
  294. package/registry/assets/avatars/avatar-26.jpg +0 -0
  295. package/registry/assets/avatars/avatar-27.jpg +0 -0
  296. package/registry/assets/avatars/avatar-28.jpg +0 -0
  297. package/registry/assets/avatars/avatar-29.jpg +0 -0
  298. package/registry/assets/avatars/avatar-30.jpg +0 -0
  299. package/registry/assets/avatars/avatar-31.jpg +0 -0
  300. package/registry/assets/avatars/avatar-32.jpg +0 -0
  301. package/registry/assets/avatars/avatar-33.jpg +0 -0
  302. package/registry/assets/avatars/avatar-34.jpg +0 -0
  303. package/registry/assets/avatars/avatar-35.jpg +0 -0
  304. package/registry/assets/image-assets.json +0 -744
  305. package/registry/assets/images/art-02.jpg +0 -0
  306. package/registry/assets/images/art-03.jpg +0 -0
  307. package/registry/assets/images/art-04.jpg +0 -0
  308. package/registry/assets/images/art-05.jpg +0 -0
  309. package/registry/assets/images/art-06.jpg +0 -0
  310. package/registry/assets/images/art-07.jpg +0 -0
  311. package/registry/assets/images/art-08.jpg +0 -0
  312. package/registry/assets/images/art-09.jpg +0 -0
  313. package/registry/assets/images/art-10.jpg +0 -0
  314. package/registry/assets/images/art-11.jpg +0 -0
  315. package/registry/assets/images/art-12.jpg +0 -0
  316. package/registry/assets/images/art-13.jpg +0 -0
  317. package/registry/assets/images/art-14.jpg +0 -0
  318. package/registry/assets/images/art-15.jpg +0 -0
  319. package/registry/assets/images/art-16.jpg +0 -0
  320. package/registry/assets/images/art-17.jpg +0 -0
  321. package/registry/assets/images/art-18.jpg +0 -0
  322. package/registry/assets/images/art-19.jpg +0 -0
  323. package/registry/assets/images/art-20.jpg +0 -0
  324. package/registry/assets/images/art-21.jpg +0 -0
  325. package/registry/assets/images/art-22.jpg +0 -0
  326. package/registry/assets/images/art-23.jpg +0 -0
  327. package/registry/assets/images/art-24.jpg +0 -0
  328. package/registry/assets/images/art-25.jpg +0 -0
  329. package/registry/assets/images/art-26.jpg +0 -0
  330. package/registry/assets/images/art-27.jpg +0 -0
  331. package/registry/assets/images/nature-01.jpg +0 -0
  332. package/registry/assets/images/nature-02.jpg +0 -0
  333. package/registry/assets/images/nature-03.jpg +0 -0
  334. package/registry/assets/images/nature-04.jpg +0 -0
  335. package/registry/assets/images/nature-05.jpg +0 -0
  336. package/registry/assets/images/nature-06.jpg +0 -0
  337. package/registry/assets/images/nature-07.jpg +0 -0
  338. package/registry/assets/images/nature-08.jpg +0 -0
  339. package/registry/assets/images/nature-09.jpg +0 -0
  340. package/registry/assets/images/nature-10.jpg +0 -0
  341. package/registry/assets/images/nature-11.jpg +0 -0
  342. package/registry/assets/images/nature-12.jpg +0 -0
  343. package/registry/assets/images/nature-13.jpg +0 -0
  344. package/registry/assets/images/nature-14.jpg +0 -0
  345. package/registry/assets/images/nature-15.jpg +0 -0
  346. package/registry/assets/images/nature-16.jpg +0 -0
  347. package/registry/assets/images/nature-17.jpg +0 -0
  348. package/registry/assets/images/nature-18.jpg +0 -0
  349. package/registry/assets/images/nature-19.jpg +0 -0
  350. package/registry/assets/images/nature-20.jpg +0 -0
  351. package/registry/components/expanded/BannerBoard.tsx +0 -225
  352. package/registry/components/expanded/CatalogTag.tsx +0 -85
  353. package/registry/components/expanded/CommandBar.tsx +0 -386
  354. package/registry/components/expanded/IconExplorer.tsx +0 -612
  355. package/registry/components/expanded/Tabs.tsx +0 -86
  356. package/registry/components/expanded/TimelineShowcase.tsx +0 -158
  357. package/registry/components/expanded/commandBar.css +0 -470
  358. package/registry/components/expanded/iconExplorer.css +0 -764
  359. package/registry/components/expanded/iconPacks.ts +0 -866
  360. package/registry/components/expanded/tag.css +0 -148
  361. package/registry/examples/expanded/icons-demo.tsx +0 -5
  362. package/tokens/Color mode.zip +0 -0
  363. package/tokens/Numbers.zip +0 -0
  364. package/tokens/Radius.zip +0 -0
  365. package/tokens/Theme.zip +0 -0
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:banhaten:schema:config",
4
+ "title": "Banhaten CLI config",
5
+ "type": "object",
6
+ "required": ["tailwind", "aliases"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string"
11
+ },
12
+ "tailwind": {
13
+ "type": "object",
14
+ "required": ["css"],
15
+ "additionalProperties": false,
16
+ "properties": {
17
+ "css": {
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "pattern": "^\\S(?:.*\\S)?$",
21
+ "description": "Path to the global CSS file that imports Tailwind and receives Banhaten tokens."
22
+ }
23
+ }
24
+ },
25
+ "aliases": {
26
+ "type": "object",
27
+ "required": ["ui", "utils", "hooks"],
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "ui": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "pattern": "^\\S(?:.*\\S)?$",
34
+ "description": "Import alias where Banhaten UI components are installed."
35
+ },
36
+ "utils": {
37
+ "type": "string",
38
+ "minLength": 1,
39
+ "pattern": "^\\S(?:.*\\S)?$",
40
+ "description": "Import alias for the cn utility file."
41
+ },
42
+ "hooks": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "pattern": "^\\S(?:.*\\S)?$",
46
+ "description": "Import alias for generated hooks."
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,190 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:banhaten:schema:registry",
4
+ "title": "Banhaten registry index",
5
+ "type": "object",
6
+ "required": ["name", "base", "components"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "name": { "type": "string", "minLength": 1 },
11
+ "base": { "$ref": "#/$defs/baseEntry" },
12
+ "components": {
13
+ "type": "object",
14
+ "minProperties": 1,
15
+ "additionalProperties": { "$ref": "#/$defs/componentEntry" }
16
+ }
17
+ },
18
+ "$defs": {
19
+ "baseEntry": {
20
+ "type": "object",
21
+ "required": ["dependencies", "files"],
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "dependencies": { "$ref": "#/$defs/dependencies" },
25
+ "files": {
26
+ "type": "array",
27
+ "minItems": 1,
28
+ "items": { "$ref": "#/$defs/registryFile" }
29
+ }
30
+ }
31
+ },
32
+ "componentEntry": {
33
+ "type": "object",
34
+ "required": [
35
+ "description",
36
+ "dependencies",
37
+ "parts",
38
+ "supportedExports",
39
+ "files",
40
+ "examples"
41
+ ],
42
+ "additionalProperties": false,
43
+ "properties": {
44
+ "description": { "type": "string", "minLength": 1 },
45
+ "status": { "enum": ["expanded"] },
46
+ "dependencies": { "$ref": "#/$defs/dependencies" },
47
+ "registryDependencies": { "$ref": "#/$defs/stringArray" },
48
+ "parts": {
49
+ "description": "Ordered, non-exhaustive component anatomy. The first value is the primary renderable part; every value must also appear in supportedExports.",
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "uniqueItems": true,
53
+ "items": { "$ref": "#/$defs/componentPartName" }
54
+ },
55
+ "supportedExports": {
56
+ "description": "Exhaustive runtime value exports, grouped by the installed source module that owns each import path. Type-only exports are intentionally excluded.",
57
+ "type": "array",
58
+ "minItems": 1,
59
+ "uniqueItems": true,
60
+ "items": { "$ref": "#/$defs/supportedExportModule" }
61
+ },
62
+ "files": {
63
+ "type": "array",
64
+ "minItems": 1,
65
+ "items": { "$ref": "#/$defs/registryFile" }
66
+ },
67
+ "examples": {
68
+ "type": "array",
69
+ "minItems": 1,
70
+ "items": { "type": "string", "minLength": 1 }
71
+ },
72
+ "props": {
73
+ "description": "Machine-readable public prop behavior, including rendered defaults for optional visual slots.",
74
+ "type": "object",
75
+ "minProperties": 1,
76
+ "additionalProperties": { "$ref": "#/$defs/componentProp" }
77
+ },
78
+ "defaults": {
79
+ "description": "Explicit defaults for array-valued capabilities. Keys must name a capability on the same component and values must belong to that capability list.",
80
+ "type": "object",
81
+ "minProperties": 1,
82
+ "additionalProperties": {
83
+ "type": ["string", "number", "boolean", "null"]
84
+ }
85
+ },
86
+ "recommendedFor": { "$ref": "#/$defs/stringArray" },
87
+ "avoidWhen": { "$ref": "#/$defs/stringArray" },
88
+ "recipes": { "$ref": "#/$defs/stringArray" },
89
+ "rtl": {
90
+ "type": "object",
91
+ "minProperties": 1,
92
+ "additionalProperties": { "type": ["string", "boolean"] }
93
+ },
94
+ "actions": { "$ref": "#/$defs/stringArray" },
95
+ "alignments": { "$ref": "#/$defs/stringArray" },
96
+ "breakpoints": { "$ref": "#/$defs/stringArray" },
97
+ "cardPositions": { "$ref": "#/$defs/stringArray" },
98
+ "colors": { "$ref": "#/$defs/stringArray" },
99
+ "controlPositions": { "$ref": "#/$defs/stringArray" },
100
+ "densities": { "$ref": "#/$defs/stringArray" },
101
+ "directions": { "$ref": "#/$defs/stringArray" },
102
+ "features": { "$ref": "#/$defs/stringArray" },
103
+ "forms": { "$ref": "#/$defs/stringArray" },
104
+ "indicators": { "$ref": "#/$defs/stringArray" },
105
+ "intents": { "$ref": "#/$defs/stringArray" },
106
+ "itemKinds": { "$ref": "#/$defs/stringArray" },
107
+ "itemTypes": { "$ref": "#/$defs/stringArray" },
108
+ "kinds": { "$ref": "#/$defs/stringArray" },
109
+ "labelPositions": { "$ref": "#/$defs/stringArray" },
110
+ "layouts": { "$ref": "#/$defs/stringArray" },
111
+ "modes": { "$ref": "#/$defs/stringArray" },
112
+ "offsets": { "$ref": "#/$defs/stringArray" },
113
+ "options": { "$ref": "#/$defs/stringArray" },
114
+ "orientations": { "$ref": "#/$defs/stringArray" },
115
+ "platforms": { "$ref": "#/$defs/stringArray" },
116
+ "pointerPositions": { "$ref": "#/$defs/stringArray" },
117
+ "selectionTypes": { "$ref": "#/$defs/stringArray" },
118
+ "shapes": { "$ref": "#/$defs/stringArray" },
119
+ "sides": { "$ref": "#/$defs/stringArray" },
120
+ "sizes": { "$ref": "#/$defs/stringArray" },
121
+ "states": { "$ref": "#/$defs/stringArray" },
122
+ "statusColors": { "$ref": "#/$defs/stringArray" },
123
+ "styles": { "$ref": "#/$defs/stringArray" },
124
+ "tokens": { "$ref": "#/$defs/stringArray" },
125
+ "tones": { "$ref": "#/$defs/stringArray" },
126
+ "types": { "$ref": "#/$defs/stringArray" },
127
+ "valueModes": { "$ref": "#/$defs/stringArray" },
128
+ "variants": { "$ref": "#/$defs/stringArray" },
129
+ "widths": { "$ref": "#/$defs/stringArray" }
130
+ }
131
+ },
132
+ "dependencies": {
133
+ "type": "object",
134
+ "additionalProperties": { "type": "string", "minLength": 1 }
135
+ },
136
+ "stringArray": {
137
+ "type": "array",
138
+ "uniqueItems": true,
139
+ "items": { "type": "string", "minLength": 1 }
140
+ },
141
+ "exportName": {
142
+ "type": "string",
143
+ "pattern": "^[A-Za-z_$][A-Za-z0-9_$]*$"
144
+ },
145
+ "componentPartName": {
146
+ "type": "string",
147
+ "pattern": "^[A-Z][A-Za-z0-9_$]*$"
148
+ },
149
+ "componentProp": {
150
+ "type": "object",
151
+ "required": ["type", "default", "description"],
152
+ "additionalProperties": false,
153
+ "properties": {
154
+ "type": { "type": "string", "minLength": 1 },
155
+ "default": {
156
+ "type": ["string", "number", "boolean", "null"]
157
+ },
158
+ "description": { "type": "string", "minLength": 1 },
159
+ "deprecated": { "type": "boolean" }
160
+ }
161
+ },
162
+ "supportedExportModule": {
163
+ "type": "object",
164
+ "required": ["source", "values"],
165
+ "additionalProperties": false,
166
+ "properties": {
167
+ "source": {
168
+ "description": "Exact TypeScript source path from this component's files array.",
169
+ "type": "string",
170
+ "pattern": "^(?!.*\\.d\\.[cm]?[jt]sx?$).+\\.[cm]?[jt]sx?$"
171
+ },
172
+ "values": {
173
+ "type": "array",
174
+ "minItems": 1,
175
+ "uniqueItems": true,
176
+ "items": { "$ref": "#/$defs/exportName" }
177
+ }
178
+ }
179
+ },
180
+ "registryFile": {
181
+ "type": "object",
182
+ "required": ["source", "target"],
183
+ "additionalProperties": false,
184
+ "properties": {
185
+ "source": { "type": "string", "minLength": 1 },
186
+ "target": { "type": "string", "minLength": 1 }
187
+ }
188
+ }
189
+ }
190
+ }
@@ -0,0 +1,163 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:banhaten:schema:tokens",
4
+ "title": "Banhaten design tokens",
5
+ "type": "object",
6
+ "required": ["name", "sourceStatus", "sourceFiles", "provenance", "modes", "cssContract", "tokens", "cssVariables"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "$schema": { "type": "string" },
10
+ "name": { "type": "string", "minLength": 1 },
11
+ "sourceStatus": { "const": "manually-curated-from-reference-archives" },
12
+ "sourceFiles": {
13
+ "type": "array",
14
+ "minItems": 1,
15
+ "uniqueItems": true,
16
+ "items": { "type": "string", "minLength": 1 }
17
+ },
18
+ "provenance": {
19
+ "type": "object",
20
+ "required": ["method", "lastReviewed", "themeSources", "notes"],
21
+ "additionalProperties": false,
22
+ "properties": {
23
+ "method": { "type": "string", "minLength": 1 },
24
+ "lastReviewed": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
25
+ "themeSources": {
26
+ "type": "object",
27
+ "minProperties": 1,
28
+ "additionalProperties": { "type": "string", "minLength": 1 }
29
+ },
30
+ "notes": {
31
+ "type": "array",
32
+ "minItems": 1,
33
+ "items": { "type": "string", "minLength": 1 }
34
+ }
35
+ }
36
+ },
37
+ "modes": {
38
+ "type": "object",
39
+ "required": ["color", "theme", "radius", "numbers"],
40
+ "additionalProperties": false,
41
+ "properties": {
42
+ "color": { "$ref": "#/$defs/stringArray" },
43
+ "theme": { "$ref": "#/$defs/stringArray" },
44
+ "radius": { "$ref": "#/$defs/stringArray" },
45
+ "numbers": { "$ref": "#/$defs/stringArray" }
46
+ }
47
+ },
48
+ "cssContract": {
49
+ "type": "object",
50
+ "required": ["semanticPrefix", "fontFamily", "fontFamilies", "defaultTheme", "defaultNeutralTheme", "defaultRadius", "shadcnAliases", "shadowTokens"],
51
+ "additionalProperties": false,
52
+ "properties": {
53
+ "semanticPrefix": { "type": "string", "minLength": 1 },
54
+ "fontFamily": { "type": "string", "minLength": 1 },
55
+ "fontFamilies": {
56
+ "type": "object",
57
+ "required": ["english", "arabic", "fallback"],
58
+ "additionalProperties": false,
59
+ "properties": {
60
+ "english": { "type": "string", "minLength": 1 },
61
+ "arabic": { "type": "string", "minLength": 1 },
62
+ "fallback": { "type": "string", "minLength": 1 }
63
+ }
64
+ },
65
+ "defaultTheme": { "type": "string", "minLength": 1 },
66
+ "defaultNeutralTheme": { "type": "string", "minLength": 1 },
67
+ "defaultRadius": { "type": "string", "minLength": 1 },
68
+ "shadowTokens": { "type": "string" },
69
+ "shadcnAliases": {
70
+ "type": "object",
71
+ "minProperties": 1,
72
+ "additionalProperties": { "type": "string", "pattern": "^--" }
73
+ }
74
+ }
75
+ },
76
+ "tokens": {
77
+ "type": "object",
78
+ "required": ["colorMode", "theme", "numbers", "radius"],
79
+ "additionalProperties": false,
80
+ "properties": {
81
+ "colorMode": { "$ref": "#/$defs/modeTokenMaps" },
82
+ "theme": { "$ref": "#/$defs/modeTokenMaps" },
83
+ "numbers": { "$ref": "#/$defs/tokenMap" },
84
+ "radius": { "$ref": "#/$defs/modeTokenMaps" }
85
+ }
86
+ },
87
+ "cssVariables": {
88
+ "type": "object",
89
+ "required": ["system", "typography", "effects", "components", "darkEffects", "scopedAliases"],
90
+ "additionalProperties": false,
91
+ "properties": {
92
+ "system": { "$ref": "#/$defs/cssVariableMap" },
93
+ "typography": { "$ref": "#/$defs/cssVariableMap" },
94
+ "effects": { "$ref": "#/$defs/cssVariableMap" },
95
+ "components": { "$ref": "#/$defs/cssVariableMap" },
96
+ "darkEffects": { "$ref": "#/$defs/cssVariableMap" },
97
+ "scopedAliases": { "$ref": "#/$defs/cssVariableMap" }
98
+ }
99
+ }
100
+ },
101
+ "$defs": {
102
+ "stringArray": {
103
+ "type": "array",
104
+ "minItems": 1,
105
+ "uniqueItems": true,
106
+ "items": { "type": "string", "minLength": 1 }
107
+ },
108
+ "modeTokenMaps": {
109
+ "type": "object",
110
+ "minProperties": 1,
111
+ "additionalProperties": { "$ref": "#/$defs/tokenMap" }
112
+ },
113
+ "tokenMap": {
114
+ "type": "object",
115
+ "minProperties": 1,
116
+ "additionalProperties": { "$ref": "#/$defs/token" }
117
+ },
118
+ "token": {
119
+ "oneOf": [
120
+ {
121
+ "type": "object",
122
+ "required": ["type", "value"],
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "type": { "const": "color" },
126
+ "value": {
127
+ "type": "string",
128
+ "pattern": "^(?:#[0-9A-Fa-f]{6,8}|rgb\\([^\\n]+\\))$"
129
+ },
130
+ "alias": { "type": ["string", "null"], "minLength": 1 }
131
+ }
132
+ },
133
+ {
134
+ "type": "object",
135
+ "required": ["type", "value"],
136
+ "additionalProperties": false,
137
+ "properties": {
138
+ "type": { "const": "number" },
139
+ "value": { "type": "number" },
140
+ "alias": { "type": ["string", "null"], "minLength": 1 }
141
+ }
142
+ }
143
+ ]
144
+ },
145
+ "cssVariableMap": {
146
+ "type": "object",
147
+ "minProperties": 1,
148
+ "propertyNames": { "pattern": "^--(?:bh|shadow)-[a-z0-9-]+$" },
149
+ "additionalProperties": { "$ref": "#/$defs/cssVariableToken" }
150
+ },
151
+ "cssVariableToken": {
152
+ "type": "object",
153
+ "required": ["type", "value"],
154
+ "additionalProperties": false,
155
+ "properties": {
156
+ "type": {
157
+ "enum": ["alias", "cubicBezier", "dimension", "duration", "number", "shadow", "string"]
158
+ },
159
+ "value": { "type": "string", "minLength": 1 }
160
+ }
161
+ }
162
+ }
163
+ }
@@ -0,0 +1,194 @@
1
+ import { parseArgs as parseNodeArgs } from "node:util"
2
+
3
+ const OPTION_DEFINITIONS = {
4
+ cwd: { type: "string" },
5
+ file: { type: "string" },
6
+ "dry-run": { type: "boolean" },
7
+ force: { type: "boolean" },
8
+ help: { type: "boolean", short: "h" },
9
+ json: { type: "boolean" },
10
+ silent: { type: "boolean", short: "s" },
11
+ version: { type: "boolean", short: "v" },
12
+ yes: { type: "boolean", short: "y" },
13
+ }
14
+
15
+ const GLOBAL_OPTIONS = ["help", "silent", "version", "yes"]
16
+
17
+ const COMMAND_SCHEMAS = {
18
+ add: commandSchema({
19
+ minPositionals: 1,
20
+ maxPositionals: Number.POSITIVE_INFINITY,
21
+ options: ["cwd", "dry-run", "force", "json"],
22
+ }),
23
+ diff: commandSchema({
24
+ maxPositionals: Number.POSITIVE_INFINITY,
25
+ options: ["cwd", "json"],
26
+ }),
27
+ docs: commandSchema({
28
+ minPositionals: 1,
29
+ maxPositionals: 1,
30
+ options: ["json"],
31
+ }),
32
+ doctor: commandSchema({
33
+ maxPositionals: 0,
34
+ options: ["cwd", "json"],
35
+ }),
36
+ help: commandSchema(),
37
+ init: commandSchema({
38
+ maxPositionals: 0,
39
+ options: ["cwd", "dry-run", "force", "json"],
40
+ }),
41
+ list: commandSchema({ maxPositionals: 0, options: ["json"] }),
42
+ search: commandSchema({
43
+ minPositionals: 1,
44
+ maxPositionals: Number.POSITIVE_INFINITY,
45
+ options: ["json"],
46
+ }),
47
+ update: commandSchema({
48
+ maxPositionals: Number.POSITIVE_INFINITY,
49
+ options: ["cwd", "dry-run", "force", "json"],
50
+ }),
51
+ version: commandSchema({ maxPositionals: 0 }),
52
+ view: commandSchema({
53
+ minPositionals: 1,
54
+ maxPositionals: 1,
55
+ options: ["file", "json"],
56
+ }),
57
+ }
58
+
59
+ export function parseCommandLine(argv) {
60
+ let parsed
61
+
62
+ try {
63
+ parsed = parseNodeArgs({
64
+ allowPositionals: true,
65
+ args: argv,
66
+ options: OPTION_DEFINITIONS,
67
+ strict: true,
68
+ tokens: true,
69
+ })
70
+ } catch (error) {
71
+ throw new Error(normalizeParseError(error))
72
+ }
73
+
74
+ assertNoDuplicateOptions(parsed.tokens)
75
+ assertNonEmptyValueOptions(parsed.values)
76
+
77
+ const [command, ...positionals] = parsed.positionals
78
+ const flags = { ...parsed.values }
79
+
80
+ if (command === undefined) {
81
+ assertRootOptions(flags)
82
+ return { command: undefined, flags, positionals }
83
+ }
84
+
85
+ const schema = COMMAND_SCHEMAS[command]
86
+ if (!schema) {
87
+ throw new Error(`unknown command "${command}"`)
88
+ }
89
+
90
+ assertAllowedOptions(command, flags, schema)
91
+
92
+ if (!flags.help && !flags.version) {
93
+ assertPositionalCount(command, positionals, schema)
94
+ }
95
+
96
+ return { command, flags, positionals }
97
+ }
98
+
99
+ function commandSchema({
100
+ minPositionals = 0,
101
+ maxPositionals = 0,
102
+ options = [],
103
+ } = {}) {
104
+ return {
105
+ minPositionals,
106
+ maxPositionals,
107
+ options: new Set([...GLOBAL_OPTIONS, ...options]),
108
+ }
109
+ }
110
+
111
+ function assertRootOptions(flags) {
112
+ const allowed = new Set(GLOBAL_OPTIONS)
113
+ for (const name of Object.keys(flags)) {
114
+ if (!allowed.has(name)) {
115
+ throw new Error(`option "--${name}" requires a command`)
116
+ }
117
+ }
118
+ }
119
+
120
+ function assertAllowedOptions(command, flags, schema) {
121
+ for (const name of Object.keys(flags)) {
122
+ if (!schema.options.has(name)) {
123
+ throw new Error(`option "--${name}" is not valid for command "${command}"`)
124
+ }
125
+ }
126
+ }
127
+
128
+ function assertPositionalCount(command, positionals, schema) {
129
+ if (positionals.length < schema.minPositionals) {
130
+ if (command === "add") {
131
+ throw new Error("missing component name. Try `banhaten add button`.")
132
+ }
133
+ if (command === "search") {
134
+ throw new Error("missing search query. Try `banhaten search input`.")
135
+ }
136
+ throw new Error(
137
+ `missing argument for command "${command}"`
138
+ )
139
+ }
140
+
141
+ if (positionals.length > schema.maxPositionals) {
142
+ const unexpected = positionals[schema.maxPositionals]
143
+ throw new Error(
144
+ `unexpected argument "${unexpected}" for command "${command}"`
145
+ )
146
+ }
147
+ }
148
+
149
+ function assertNoDuplicateOptions(tokens) {
150
+ const seen = new Set()
151
+
152
+ for (const token of tokens) {
153
+ if (token.kind !== "option") continue
154
+ if (seen.has(token.name)) {
155
+ throw new Error(`option "--${token.name}" was provided more than once`)
156
+ }
157
+ seen.add(token.name)
158
+ }
159
+ }
160
+
161
+ function assertNonEmptyValueOptions(values) {
162
+ for (const name of ["cwd", "file"]) {
163
+ if (name in values && values[name].trim() === "") {
164
+ throw new Error(`option "--${name}" requires a non-empty value`)
165
+ }
166
+ }
167
+ }
168
+
169
+ function normalizeParseError(error) {
170
+ if (error?.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
171
+ const match = error.message.match(/Unknown option '([^']+)'/)
172
+ return match ? `unknown option "${match[1]}"` : error.message
173
+ }
174
+
175
+ if (error?.code === "ERR_PARSE_ARGS_INVALID_OPTION_VALUE") {
176
+ const missing = error.message.match(/Option '([^']+)' argument missing/)
177
+ if (missing) {
178
+ const optionName = missing[1]
179
+ .split(", ")
180
+ .at(-1)
181
+ .replace(/\s*<value>\s*$/, "")
182
+ .trim()
183
+ return `option "${optionName}" requires a value`
184
+ }
185
+
186
+ const ambiguous = error.message.match(/Option '([^']+)' argument is ambiguous/)
187
+ if (ambiguous) return `option "${ambiguous[1]}" requires a value`
188
+
189
+ const booleanValue = error.message.match(/Option '([^']+)' does not take an argument/)
190
+ if (booleanValue) return `option "${booleanValue[1]}" does not take a value`
191
+ }
192
+
193
+ return error?.message || String(error)
194
+ }
@@ -0,0 +1,9 @@
1
+ // Facade over the config editors. Kept so callers have one import site while
2
+ // the JSONC, Vite, and scanner concerns stay in separate modules.
3
+
4
+ export { parseJsonc, updateJsoncAliasSource } from "./jsonc.js"
5
+ export {
6
+ readViteAliasKeys,
7
+ readViteAliasSourceRoot,
8
+ updateViteConfigSource,
9
+ } from "./vite-config.js"