@oyolincc/create 0.3.0 → 0.5.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 (392) hide show
  1. package/package.json +2 -2
  2. package/templates/hono-fullstack/.codegraph/.gitignore +5 -0
  3. package/templates/hono-fullstack/README.md +22 -1
  4. package/templates/hono-fullstack/_gitignore +1 -0
  5. package/templates/hono-fullstack/apps/server/package.json +7 -2
  6. package/templates/hono-fullstack/apps/server/src/adapters/cloudflare/entry.ts +4 -30
  7. package/templates/hono-fullstack/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
  8. package/templates/hono-fullstack/apps/server/src/adapters/nodejs/entry.ts +7 -57
  9. package/templates/hono-fullstack/apps/server/src/app.ts +37 -21
  10. package/templates/hono-fullstack/apps/server/src/config.ts +1 -1
  11. package/templates/hono-fullstack/apps/server/src/di-container.ts +51 -0
  12. package/templates/hono-fullstack/apps/server/src/infra/logger/getter.ts +1 -1
  13. package/templates/hono-fullstack/apps/server/src/infra/logger/pino.ts +21 -34
  14. package/templates/hono-fullstack/apps/server/src/infra/work-runner/errors.ts +22 -0
  15. package/templates/hono-fullstack/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
  16. package/templates/hono-fullstack/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
  17. package/templates/hono-fullstack/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
  18. package/templates/hono-fullstack/apps/server/src/infra/work-runner/types.ts +2 -16
  19. package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
  20. package/templates/hono-fullstack/apps/server/src/infra/work-runner/utils/message.ts +5 -17
  21. package/templates/hono-fullstack/apps/server/src/middlewares/cors.ts +16 -22
  22. package/templates/hono-fullstack/apps/server/src/middlewares/logger.ts +34 -0
  23. package/templates/hono-fullstack/apps/server/src/modules/example/module.ts +8 -0
  24. package/templates/hono-fullstack/apps/server/src/modules/example/queries.ts +8 -0
  25. package/templates/hono-fullstack/apps/server/src/modules/example/routes.ts +74 -68
  26. package/templates/hono-fullstack/apps/server/src/modules/example/service.test.ts +53 -0
  27. package/templates/hono-fullstack/apps/server/src/modules/example/service.ts +54 -0
  28. package/templates/hono-fullstack/apps/server/src/modules/example/types.ts +12 -0
  29. package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
  30. package/templates/hono-fullstack/apps/server/src/modules/example/work-task/tasks.ts +15 -46
  31. package/templates/hono-fullstack/apps/server/src/shared/errors/defs/index.ts +6 -1
  32. package/templates/hono-fullstack/apps/server/src/shared/errors/handler.ts +1 -1
  33. package/templates/hono-fullstack/apps/server/src/shared/network/openapi/index.ts +1 -1
  34. package/templates/hono-fullstack/apps/server/src/shared/types/app.ts +51 -0
  35. package/templates/hono-fullstack/apps/server/src/shared/types/db.ts +126 -0
  36. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/check.ts +19 -0
  37. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/model.ts +47 -0
  38. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/params.ts +105 -0
  39. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
  40. package/templates/hono-fullstack/apps/server/src/shared/utils/data-access/query.ts +236 -0
  41. package/templates/hono-fullstack/apps/server/vite.config.ts +2 -2
  42. package/templates/hono-fullstack/apps/server/wrangler.jsonc +1 -1
  43. package/templates/hono-fullstack/apps/stack/frontend/assets/styles.css +6 -0
  44. package/templates/hono-fullstack/apps/stack/frontend/components/general/ErrorMessage.tsx +3 -1
  45. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/AppLayout.tsx +2 -1
  46. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Header.tsx +14 -2
  47. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/Page.tsx +2 -1
  48. package/templates/hono-fullstack/apps/stack/frontend/components/layouts/PageContainer.tsx +4 -1
  49. package/templates/hono-fullstack/apps/stack/frontend/modules/example/api.ts +16 -9
  50. package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleForm.tsx +25 -12
  51. package/templates/hono-fullstack/apps/stack/frontend/modules/example/components/ExampleList.tsx +13 -4
  52. package/templates/hono-fullstack/apps/stack/frontend/modules/example/hooks/api-hooks.ts +21 -8
  53. package/templates/hono-fullstack/apps/stack/frontend/routes/__root.tsx +1 -1
  54. package/templates/hono-fullstack/apps/stack/frontend/routes/index.tsx +35 -12
  55. package/templates/hono-fullstack/apps/stack/frontend/shared/network/query-hooks.ts +33 -0
  56. package/templates/hono-fullstack/apps/stack/package.json +9 -4
  57. package/templates/hono-fullstack/apps/stack/panda.config.ts +31 -0
  58. package/templates/hono-fullstack/apps/stack/tsconfig.json +1 -0
  59. package/templates/hono-fullstack/apps/stack/turbo.json +20 -0
  60. package/templates/hono-fullstack/apps/stack/vite.config.ts +48 -12
  61. package/templates/hono-fullstack/apps/stack/wrangler.jsonc +1 -1
  62. package/templates/hono-fullstack/envs/.env.example.sqlite-d1 +1 -0
  63. package/templates/hono-fullstack/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  64. package/templates/hono-fullstack/libs/db/package.json +1 -0
  65. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  66. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  67. package/templates/hono-fullstack/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  68. package/templates/hono-fullstack/libs/definition/README.md +81 -0
  69. package/templates/hono-fullstack/libs/definition/package.json +3 -1
  70. package/templates/hono-fullstack/libs/definition/src/constants/index.ts +1 -0
  71. package/templates/hono-fullstack/libs/definition/src/constants/pagination.ts +3 -0
  72. package/templates/hono-fullstack/libs/definition/src/modules/common-contracts.ts +24 -0
  73. package/templates/hono-fullstack/libs/definition/src/modules/example/contracts.ts +34 -0
  74. package/templates/hono-fullstack/libs/definition/src/modules/example/index.ts +1 -16
  75. package/templates/hono-fullstack/libs/definition/src/modules/index.ts +2 -0
  76. package/templates/hono-fullstack/libs/definition/src/modules/vo-generated-types.ts +12 -0
  77. package/templates/hono-fullstack/libs/ui/.storybook/main.ts +32 -0
  78. package/templates/hono-fullstack/libs/ui/.storybook/panda.config.ts +22 -0
  79. package/templates/hono-fullstack/libs/ui/.storybook/preview.tsx +79 -0
  80. package/templates/hono-fullstack/libs/ui/.storybook/styles.css +1 -0
  81. package/templates/hono-fullstack/libs/ui/.storybook/vite.config.ts +37 -0
  82. package/templates/hono-fullstack/libs/ui/components.json +15 -0
  83. package/templates/hono-fullstack/libs/ui/package.json +114 -0
  84. package/templates/hono-fullstack/libs/ui/panda.config.ts +41 -0
  85. package/templates/hono-fullstack/libs/ui/src/Tooltip.tsx +47 -0
  86. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/Button.tsx +80 -0
  87. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/CloseButton.tsx +15 -0
  88. package/templates/hono-fullstack/libs/ui/src/components/atoms/buttons/IconButton.tsx +10 -0
  89. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Combobox.tsx +91 -0
  90. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/Select.tsx +88 -0
  91. package/templates/hono-fullstack/libs/ui/src/components/atoms/collections/TreeView.tsx +142 -0
  92. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Avatar.tsx +64 -0
  93. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Badge.tsx +7 -0
  94. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Card.tsx +23 -0
  95. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Clipboard.tsx +77 -0
  96. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Icon.tsx +9 -0
  97. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Table.tsx +51 -0
  98. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Tag.tsx +23 -0
  99. package/templates/hono-fullstack/libs/ui/src/components/atoms/data-display/Timeline.tsx +33 -0
  100. package/templates/hono-fullstack/libs/ui/src/components/atoms/date-and-time/DatePicker.tsx +255 -0
  101. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Accordion.tsx +48 -0
  102. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Breadcrumb.tsx +50 -0
  103. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Collapsible.tsx +34 -0
  104. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Pagination.tsx +74 -0
  105. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Steps.tsx +91 -0
  106. package/templates/hono-fullstack/libs/ui/src/components/atoms/disclosure/Tabs.tsx +37 -0
  107. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Alert.tsx +52 -0
  108. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Progress.tsx +41 -0
  109. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/ProgressCircle.tsx +40 -0
  110. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Skeleton.tsx +37 -0
  111. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Spinner.tsx +7 -0
  112. package/templates/hono-fullstack/libs/ui/src/components/atoms/feedback/Toast.tsx +99 -0
  113. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Checkbox.tsx +95 -0
  114. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/ColorPicker.tsx +148 -0
  115. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Editable.tsx +44 -0
  116. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Field.tsx +36 -0
  117. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Fieldset.tsx +34 -0
  118. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/FileUpload.tsx +143 -0
  119. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Input.tsx +7 -0
  120. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputAddon.tsx +7 -0
  121. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/InputGroup.tsx +61 -0
  122. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NativeSelect.tsx +81 -0
  123. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/NumberInput.tsx +63 -0
  124. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PasswordInput.tsx +76 -0
  125. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/PinInput.tsx +36 -0
  126. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioCard.tsx +96 -0
  127. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RadioGroup.tsx +61 -0
  128. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/RatingGroup.tsx +106 -0
  129. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/SegmentGroup.tsx +68 -0
  130. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Slider.tsx +87 -0
  131. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Switch.tsx +74 -0
  132. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/TagsInput.tsx +77 -0
  133. package/templates/hono-fullstack/libs/ui/src/components/atoms/forms/Textarea.tsx +7 -0
  134. package/templates/hono-fullstack/libs/ui/src/components/atoms/index.ts +98 -0
  135. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/AbsoluteCenter.tsx +7 -0
  136. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Loader.tsx +69 -0
  137. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/Span.tsx +5 -0
  138. package/templates/hono-fullstack/libs/ui/src/components/atoms/internal/create-layout.ts +18 -0
  139. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Float.tsx +7 -0
  140. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Grid.tsx +17 -0
  141. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Group.tsx +7 -0
  142. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/ScrollArea.tsx +46 -0
  143. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Separator.tsx +26 -0
  144. package/templates/hono-fullstack/libs/ui/src/components/atoms/layout/Stack.tsx +54 -0
  145. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Dialog.tsx +69 -0
  146. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Drawer.tsx +49 -0
  147. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/HoverCard.tsx +37 -0
  148. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Menu.tsx +74 -0
  149. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.test.ts +124 -0
  150. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/OverlayManager.tsx +189 -0
  151. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Popover.tsx +57 -0
  152. package/templates/hono-fullstack/libs/ui/src/components/atoms/overlays/Tooltip.tsx +37 -0
  153. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Heading.tsx +6 -0
  154. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Link.tsx +7 -0
  155. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/LinkOverlay.tsx +21 -0
  156. package/templates/hono-fullstack/libs/ui/src/components/atoms/typography/Text.tsx +6 -0
  157. package/templates/hono-fullstack/libs/ui/src/components/atoms/utilities/VisuallyHidden.tsx +13 -0
  158. package/templates/hono-fullstack/libs/ui/src/hooks.ts +242 -0
  159. package/templates/hono-fullstack/libs/ui/src/index.ts +19 -0
  160. package/templates/hono-fullstack/libs/ui/src/theme/animation-styles.ts +50 -0
  161. package/templates/hono-fullstack/libs/ui/src/theme/breakpoints.ts +7 -0
  162. package/templates/hono-fullstack/libs/ui/src/theme/conditions.ts +12 -0
  163. package/templates/hono-fullstack/libs/ui/src/theme/containers.ts +16 -0
  164. package/templates/hono-fullstack/libs/ui/src/theme/global-css.ts +12 -0
  165. package/templates/hono-fullstack/libs/ui/src/theme/keyframes.ts +157 -0
  166. package/templates/hono-fullstack/libs/ui/src/theme/layer-styles.ts +11 -0
  167. package/templates/hono-fullstack/libs/ui/src/theme/patterns/grid.ts +51 -0
  168. package/templates/hono-fullstack/libs/ui/src/theme/patterns/index.ts +60 -0
  169. package/templates/hono-fullstack/libs/ui/src/theme/patterns/stack.ts +46 -0
  170. package/templates/hono-fullstack/libs/ui/src/theme/recipes/absolute-center.ts +38 -0
  171. package/templates/hono-fullstack/libs/ui/src/theme/recipes/accordion.ts +68 -0
  172. package/templates/hono-fullstack/libs/ui/src/theme/recipes/alert.ts +83 -0
  173. package/templates/hono-fullstack/libs/ui/src/theme/recipes/avatar.ts +155 -0
  174. package/templates/hono-fullstack/libs/ui/src/theme/recipes/badge.ts +67 -0
  175. package/templates/hono-fullstack/libs/ui/src/theme/recipes/breadcrumb.ts +69 -0
  176. package/templates/hono-fullstack/libs/ui/src/theme/recipes/button.ts +149 -0
  177. package/templates/hono-fullstack/libs/ui/src/theme/recipes/card.ts +36 -0
  178. package/templates/hono-fullstack/libs/ui/src/theme/recipes/checkbox.ts +120 -0
  179. package/templates/hono-fullstack/libs/ui/src/theme/recipes/clipboard.ts +22 -0
  180. package/templates/hono-fullstack/libs/ui/src/theme/recipes/collapsible.ts +26 -0
  181. package/templates/hono-fullstack/libs/ui/src/theme/recipes/color-picker.ts +299 -0
  182. package/templates/hono-fullstack/libs/ui/src/theme/recipes/combobox.ts +141 -0
  183. package/templates/hono-fullstack/libs/ui/src/theme/recipes/date-picker.ts +302 -0
  184. package/templates/hono-fullstack/libs/ui/src/theme/recipes/dialog.ts +191 -0
  185. package/templates/hono-fullstack/libs/ui/src/theme/recipes/drawer.ts +170 -0
  186. package/templates/hono-fullstack/libs/ui/src/theme/recipes/editable.ts +64 -0
  187. package/templates/hono-fullstack/libs/ui/src/theme/recipes/field.ts +41 -0
  188. package/templates/hono-fullstack/libs/ui/src/theme/recipes/fieldset.ts +47 -0
  189. package/templates/hono-fullstack/libs/ui/src/theme/recipes/file-upload.ts +86 -0
  190. package/templates/hono-fullstack/libs/ui/src/theme/recipes/group.ts +78 -0
  191. package/templates/hono-fullstack/libs/ui/src/theme/recipes/heading.ts +24 -0
  192. package/templates/hono-fullstack/libs/ui/src/theme/recipes/hover-card.ts +47 -0
  193. package/templates/hono-fullstack/libs/ui/src/theme/recipes/icon.ts +25 -0
  194. package/templates/hono-fullstack/libs/ui/src/theme/recipes/index.ts +120 -0
  195. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-addon.ts +51 -0
  196. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input-group.ts +77 -0
  197. package/templates/hono-fullstack/libs/ui/src/theme/recipes/input.ts +99 -0
  198. package/templates/hono-fullstack/libs/ui/src/theme/recipes/link.ts +36 -0
  199. package/templates/hono-fullstack/libs/ui/src/theme/recipes/menu.ts +114 -0
  200. package/templates/hono-fullstack/libs/ui/src/theme/recipes/native-select.ts +92 -0
  201. package/templates/hono-fullstack/libs/ui/src/theme/recipes/number-input.ts +91 -0
  202. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pagination.ts +9 -0
  203. package/templates/hono-fullstack/libs/ui/src/theme/recipes/pin-input.ts +33 -0
  204. package/templates/hono-fullstack/libs/ui/src/theme/recipes/popover.ts +78 -0
  205. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress-circle.ts +50 -0
  206. package/templates/hono-fullstack/libs/ui/src/theme/recipes/progress.ts +112 -0
  207. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-card.ts +223 -0
  208. package/templates/hono-fullstack/libs/ui/src/theme/recipes/radio-group.ts +78 -0
  209. package/templates/hono-fullstack/libs/ui/src/theme/recipes/rating-group.ts +98 -0
  210. package/templates/hono-fullstack/libs/ui/src/theme/recipes/scroll-area.ts +119 -0
  211. package/templates/hono-fullstack/libs/ui/src/theme/recipes/segment-group.ts +162 -0
  212. package/templates/hono-fullstack/libs/ui/src/theme/recipes/select.ts +157 -0
  213. package/templates/hono-fullstack/libs/ui/src/theme/recipes/separator.ts +25 -0
  214. package/templates/hono-fullstack/libs/ui/src/theme/recipes/skeleton.ts +65 -0
  215. package/templates/hono-fullstack/libs/ui/src/theme/recipes/slider.ts +164 -0
  216. package/templates/hono-fullstack/libs/ui/src/theme/recipes/spinner.ts +34 -0
  217. package/templates/hono-fullstack/libs/ui/src/theme/recipes/steps.ts +162 -0
  218. package/templates/hono-fullstack/libs/ui/src/theme/recipes/switch.ts +150 -0
  219. package/templates/hono-fullstack/libs/ui/src/theme/recipes/table.ts +150 -0
  220. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tabs.ts +128 -0
  221. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tag.ts +114 -0
  222. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tags-input.ts +201 -0
  223. package/templates/hono-fullstack/libs/ui/src/theme/recipes/text.ts +7 -0
  224. package/templates/hono-fullstack/libs/ui/src/theme/recipes/textarea.ts +90 -0
  225. package/templates/hono-fullstack/libs/ui/src/theme/recipes/timeline.ts +137 -0
  226. package/templates/hono-fullstack/libs/ui/src/theme/recipes/toast.ts +52 -0
  227. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tooltip.ts +44 -0
  228. package/templates/hono-fullstack/libs/ui/src/theme/recipes/tree-view.ts +200 -0
  229. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/amber.ts +91 -0
  230. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/gray.ts +103 -0
  231. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/green.ts +88 -0
  232. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/index.ts +14 -0
  233. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/lime.ts +91 -0
  234. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/colors/red.ts +88 -0
  235. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/index.ts +8 -0
  236. package/templates/hono-fullstack/libs/ui/src/theme/semanticTokens/shadows.ts +46 -0
  237. package/templates/hono-fullstack/libs/ui/src/theme/text-styles.ts +82 -0
  238. package/templates/hono-fullstack/libs/ui/src/theme/tokens/animations.ts +8 -0
  239. package/templates/hono-fullstack/libs/ui/src/theme/tokens/aspect-ratio.ts +6 -0
  240. package/templates/hono-fullstack/libs/ui/src/theme/tokens/borders.ts +5 -0
  241. package/templates/hono-fullstack/libs/ui/src/theme/tokens/colors.ts +35 -0
  242. package/templates/hono-fullstack/libs/ui/src/theme/tokens/durations.ts +11 -0
  243. package/templates/hono-fullstack/libs/ui/src/theme/tokens/easings.ts +9 -0
  244. package/templates/hono-fullstack/libs/ui/src/theme/tokens/index.ts +42 -0
  245. package/templates/hono-fullstack/libs/ui/src/theme/tokens/radii.ts +13 -0
  246. package/templates/hono-fullstack/libs/ui/src/theme/tokens/sizes.ts +27 -0
  247. package/templates/hono-fullstack/libs/ui/src/theme/tokens/spacing.ts +41 -0
  248. package/templates/hono-fullstack/libs/ui/src/theme/tokens/typography.ts +86 -0
  249. package/templates/hono-fullstack/libs/ui/src/theme/tokens/z-index.ts +43 -0
  250. package/templates/hono-fullstack/libs/ui/stories/README.md +107 -0
  251. package/templates/hono-fullstack/libs/ui/stories/actions/Button.stories.tsx +260 -0
  252. package/templates/hono-fullstack/libs/ui/stories/actions/Clipboard.stories.tsx +87 -0
  253. package/templates/hono-fullstack/libs/ui/stories/actions/IconButton.stories.tsx +33 -0
  254. package/templates/hono-fullstack/libs/ui/stories/collections/Combobox.stories.tsx +334 -0
  255. package/templates/hono-fullstack/libs/ui/stories/collections/Select.stories.tsx +342 -0
  256. package/templates/hono-fullstack/libs/ui/stories/collections/TreeView.stories.tsx +252 -0
  257. package/templates/hono-fullstack/libs/ui/stories/color/ColorPicker.stories.tsx +217 -0
  258. package/templates/hono-fullstack/libs/ui/stories/date/DatePicker.stories.tsx +302 -0
  259. package/templates/hono-fullstack/libs/ui/stories/disclosure/Accordion.stories.tsx +105 -0
  260. package/templates/hono-fullstack/libs/ui/stories/disclosure/Collapsible.stories.tsx +55 -0
  261. package/templates/hono-fullstack/libs/ui/stories/disclosure/Steps.stories.tsx +208 -0
  262. package/templates/hono-fullstack/libs/ui/stories/disclosure/Tabs.stories.tsx +176 -0
  263. package/templates/hono-fullstack/libs/ui/stories/display/Avatar.stories.tsx +108 -0
  264. package/templates/hono-fullstack/libs/ui/stories/display/Badge.stories.tsx +90 -0
  265. package/templates/hono-fullstack/libs/ui/stories/display/Card.stories.tsx +121 -0
  266. package/templates/hono-fullstack/libs/ui/stories/display/Heading.stories.tsx +62 -0
  267. package/templates/hono-fullstack/libs/ui/stories/display/Icon.stories.tsx +51 -0
  268. package/templates/hono-fullstack/libs/ui/stories/display/Table.stories.tsx +222 -0
  269. package/templates/hono-fullstack/libs/ui/stories/display/Tag.stories.tsx +168 -0
  270. package/templates/hono-fullstack/libs/ui/stories/display/Text.stories.tsx +32 -0
  271. package/templates/hono-fullstack/libs/ui/stories/display/Timeline.stories.tsx +241 -0
  272. package/templates/hono-fullstack/libs/ui/stories/feedback/Alert.stories.tsx +122 -0
  273. package/templates/hono-fullstack/libs/ui/stories/feedback/Progress.stories.tsx +163 -0
  274. package/templates/hono-fullstack/libs/ui/stories/feedback/ProgressCircle.stories.tsx +176 -0
  275. package/templates/hono-fullstack/libs/ui/stories/feedback/Skeleton.stories.tsx +75 -0
  276. package/templates/hono-fullstack/libs/ui/stories/feedback/Spinner.stories.tsx +49 -0
  277. package/templates/hono-fullstack/libs/ui/stories/feedback/Toast.stories.tsx +145 -0
  278. package/templates/hono-fullstack/libs/ui/stories/forms/Checkbox.stories.tsx +281 -0
  279. package/templates/hono-fullstack/libs/ui/stories/forms/Editable.stories.tsx +94 -0
  280. package/templates/hono-fullstack/libs/ui/stories/forms/Field.stories.tsx +72 -0
  281. package/templates/hono-fullstack/libs/ui/stories/forms/Fieldset.stories.tsx +109 -0
  282. package/templates/hono-fullstack/libs/ui/stories/forms/FileUpload.stories.tsx +115 -0
  283. package/templates/hono-fullstack/libs/ui/stories/forms/Form.stories.tsx +120 -0
  284. package/templates/hono-fullstack/libs/ui/stories/forms/Input.stories.tsx +155 -0
  285. package/templates/hono-fullstack/libs/ui/stories/forms/InputGroup.stories.tsx +79 -0
  286. package/templates/hono-fullstack/libs/ui/stories/forms/NativeSelect.stories.tsx +160 -0
  287. package/templates/hono-fullstack/libs/ui/stories/forms/NumberInput.stories.tsx +149 -0
  288. package/templates/hono-fullstack/libs/ui/stories/forms/PasswordInput.stories.tsx +141 -0
  289. package/templates/hono-fullstack/libs/ui/stories/forms/PinInput.stories.tsx +155 -0
  290. package/templates/hono-fullstack/libs/ui/stories/forms/RadioCard.stories.tsx +265 -0
  291. package/templates/hono-fullstack/libs/ui/stories/forms/RadioGroup.stories.tsx +109 -0
  292. package/templates/hono-fullstack/libs/ui/stories/forms/RatingGroup.stories.tsx +123 -0
  293. package/templates/hono-fullstack/libs/ui/stories/forms/SegmentGroup.stories.tsx +130 -0
  294. package/templates/hono-fullstack/libs/ui/stories/forms/Slider.stories.tsx +190 -0
  295. package/templates/hono-fullstack/libs/ui/stories/forms/Switch.stories.tsx +124 -0
  296. package/templates/hono-fullstack/libs/ui/stories/forms/TagsInput.stories.tsx +154 -0
  297. package/templates/hono-fullstack/libs/ui/stories/forms/Textarea.stories.tsx +148 -0
  298. package/templates/hono-fullstack/libs/ui/stories/layout/Grid.stories.tsx +60 -0
  299. package/templates/hono-fullstack/libs/ui/stories/layout/Positioning.stories.tsx +90 -0
  300. package/templates/hono-fullstack/libs/ui/stories/layout/ScrollArea.stories.tsx +68 -0
  301. package/templates/hono-fullstack/libs/ui/stories/layout/Stack.stories.tsx +87 -0
  302. package/templates/hono-fullstack/libs/ui/stories/navigation/Breadcrumb.stories.tsx +104 -0
  303. package/templates/hono-fullstack/libs/ui/stories/navigation/Link.stories.tsx +62 -0
  304. package/templates/hono-fullstack/libs/ui/stories/navigation/LinkBox.stories.tsx +45 -0
  305. package/templates/hono-fullstack/libs/ui/stories/navigation/Pagination.stories.tsx +74 -0
  306. package/templates/hono-fullstack/libs/ui/stories/overlays/Dialog.stories.tsx +255 -0
  307. package/templates/hono-fullstack/libs/ui/stories/overlays/Drawer.stories.tsx +114 -0
  308. package/templates/hono-fullstack/libs/ui/stories/overlays/HoverCard.stories.tsx +47 -0
  309. package/templates/hono-fullstack/libs/ui/stories/overlays/Menu.stories.tsx +133 -0
  310. package/templates/hono-fullstack/libs/ui/stories/overlays/OverlayManager.stories.tsx +206 -0
  311. package/templates/hono-fullstack/libs/ui/stories/overlays/Popover.stories.tsx +73 -0
  312. package/templates/hono-fullstack/libs/ui/stories/overlays/Tooltip.stories.tsx +114 -0
  313. package/templates/hono-fullstack/libs/ui/stories/tsconfig.json +14 -0
  314. package/templates/hono-fullstack/libs/ui/tsconfig.build.json +5 -0
  315. package/templates/hono-fullstack/libs/ui/tsconfig.json +13 -0
  316. package/templates/hono-fullstack/libs/ui/turbo.json +28 -0
  317. package/templates/hono-fullstack/libs/ui/vite.config.ts +33 -0
  318. package/templates/hono-fullstack/oyo.config.json +31 -1
  319. package/templates/hono-fullstack/package.json +1 -0
  320. package/templates/hono-fullstack/pnpm-workspace.yaml +20 -10
  321. package/templates/hono-fullstack/turbo.json +10 -0
  322. package/templates/hono-server/.codegraph/.gitignore +5 -0
  323. package/templates/hono-server/README.md +9 -1
  324. package/templates/hono-server/_gitignore +1 -0
  325. package/templates/hono-server/apps/server/package.json +7 -2
  326. package/templates/hono-server/apps/server/src/adapters/cloudflare/entry.ts +4 -30
  327. package/templates/hono-server/apps/server/src/adapters/nodejs/bootstrap.ts +20 -12
  328. package/templates/hono-server/apps/server/src/adapters/nodejs/entry.ts +7 -57
  329. package/templates/hono-server/apps/server/src/app.ts +37 -21
  330. package/templates/hono-server/apps/server/src/config.ts +1 -1
  331. package/templates/hono-server/apps/server/src/di-container.ts +51 -0
  332. package/templates/hono-server/apps/server/src/infra/logger/getter.ts +1 -1
  333. package/templates/hono-server/apps/server/src/infra/logger/pino.ts +21 -34
  334. package/templates/hono-server/apps/server/src/infra/work-runner/errors.ts +22 -0
  335. package/templates/hono-server/apps/server/src/infra/work-runner/pass-through/runner.ts +28 -22
  336. package/templates/hono-server/apps/server/src/infra/work-runner/piscina/runner.ts +11 -34
  337. package/templates/hono-server/apps/server/src/infra/work-runner/{example → piscina}/worker-entry.ts +6 -2
  338. package/templates/hono-server/apps/server/src/infra/work-runner/types.ts +2 -16
  339. package/templates/hono-server/apps/server/src/infra/work-runner/utils/business-error.ts +10 -5
  340. package/templates/hono-server/apps/server/src/infra/work-runner/utils/message.ts +5 -17
  341. package/templates/hono-server/apps/server/src/middlewares/cors.ts +16 -22
  342. package/templates/hono-server/apps/server/src/middlewares/logger.ts +34 -0
  343. package/templates/hono-server/apps/server/src/modules/example/module.ts +8 -0
  344. package/templates/hono-server/apps/server/src/modules/example/queries.ts +8 -0
  345. package/templates/hono-server/apps/server/src/modules/example/routes.ts +74 -68
  346. package/templates/hono-server/apps/server/src/modules/example/service.test.ts +53 -0
  347. package/templates/hono-server/apps/server/src/modules/example/service.ts +54 -0
  348. package/templates/hono-server/apps/server/src/modules/example/types.ts +12 -0
  349. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.test.ts +9 -35
  350. package/templates/hono-server/apps/server/src/modules/example/work-task/tasks.ts +15 -46
  351. package/templates/hono-server/apps/server/src/shared/errors/defs/index.ts +6 -1
  352. package/templates/hono-server/apps/server/src/shared/errors/handler.ts +1 -1
  353. package/templates/hono-server/apps/server/src/shared/network/openapi/index.ts +1 -1
  354. package/templates/hono-server/apps/server/src/shared/types/app.ts +51 -0
  355. package/templates/hono-server/apps/server/src/shared/types/db.ts +126 -0
  356. package/templates/hono-server/apps/server/src/shared/utils/data-access/check.ts +19 -0
  357. package/templates/hono-server/apps/server/src/shared/utils/data-access/model.ts +47 -0
  358. package/templates/hono-server/apps/server/src/shared/utils/data-access/params.ts +105 -0
  359. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.test.ts +139 -0
  360. package/templates/hono-server/apps/server/src/shared/utils/data-access/query.ts +236 -0
  361. package/templates/hono-server/apps/server/vite.config.ts +2 -2
  362. package/templates/hono-server/apps/server/wrangler.jsonc +1 -1
  363. package/templates/hono-server/docker/README.md +1 -1
  364. package/templates/hono-server/envs/.env.example.sqlite-d1 +1 -0
  365. package/templates/hono-server/libs/db/drizzle-kit/sqlite-d1.config.ts +29 -10
  366. package/templates/hono-server/libs/db/package.json +1 -0
  367. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/columns.ts +1 -1
  368. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/modules/examples/examples.ts +6 -3
  369. package/templates/hono-server/libs/db/src/dialects/sqlite/schema/vo.ts +7 -1
  370. package/templates/hono-server/libs/definition/README.md +81 -0
  371. package/templates/hono-server/libs/definition/package.json +3 -1
  372. package/templates/hono-server/libs/definition/src/constants/index.ts +1 -0
  373. package/templates/hono-server/libs/definition/src/constants/pagination.ts +3 -0
  374. package/templates/hono-server/libs/definition/src/modules/common-contracts.ts +24 -0
  375. package/templates/hono-server/libs/definition/src/modules/example/contracts.ts +34 -0
  376. package/templates/hono-server/libs/definition/src/modules/example/index.ts +1 -16
  377. package/templates/hono-server/libs/definition/src/modules/index.ts +2 -0
  378. package/templates/hono-server/libs/definition/src/modules/vo-generated-types.ts +12 -0
  379. package/templates/hono-server/oyo.config.json +31 -1
  380. package/templates/hono-server/package.json +1 -0
  381. package/templates/hono-server/pnpm-workspace.yaml +9 -7
  382. package/templates/hono-server/turbo.json +10 -0
  383. package/templates/monorepo/.codegraph/.gitignore +5 -0
  384. package/templates/monorepo/_gitignore +1 -0
  385. package/templates/monorepo/oyo.config.json +7 -1
  386. package/templates/monorepo/pnpm-workspace.yaml +4 -4
  387. package/templates/monorepo/turbo.json +10 -0
  388. package/templates/hono-fullstack/apps/server/src/modules/example/contracts.ts +0 -9
  389. package/templates/hono-fullstack/apps/server/src/shared/app/types.ts +0 -44
  390. package/templates/hono-fullstack/apps/stack/frontend/styles.css +0 -23
  391. package/templates/hono-server/apps/server/src/modules/example/contracts.ts +0 -9
  392. package/templates/hono-server/apps/server/src/shared/app/types.ts +0 -44
@@ -0,0 +1,176 @@
1
+ import { Button, Tabs } from '@repo/ui'
2
+ import { useRef, useState } from 'react'
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+ function PanelCounter({ label }: { label: string }) {
7
+ const [count, setCount] = useState(0)
8
+ return (
9
+ <Button type="button" variant="outline" onClick={() => setCount((value) => value + 1)}>
10
+ {label}计数:{count}
11
+ </Button>
12
+ )
13
+ }
14
+ const meta = {
15
+ title: 'Disclosure/Tabs',
16
+ component: Tabs.Root,
17
+ parameters: {
18
+ controls: { disable: true },
19
+ docs: {
20
+ source: { type: 'code' },
21
+ description: { component: '自动与手动激活、焦点、状态保留和尺寸定制。' },
22
+ },
23
+ },
24
+ } satisfies Meta<typeof Tabs.Root>
25
+ export default meta
26
+ type Story = StoryObj<typeof meta>
27
+ export const ControlledAutomatic: Story = {
28
+ render: function ControlledAutomatic() {
29
+ const [value, setValue] = useState('overview')
30
+ const [focusedValue, setFocusedValue] = useState<string | null>(null)
31
+ const triggerRef = useRef<HTMLButtonElement>(null)
32
+ return (
33
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
34
+ <p>水平自动模式:左右方向键切换并跳过禁用项,Home/End 跳到首尾;计数应在切换后保留。</p>
35
+ <Tabs.Root
36
+ value={value}
37
+ onValueChange={(details) => setValue(details.value)}
38
+ onFocusChange={(details) => setFocusedValue(details.focusedValue)}
39
+ lazyMount
40
+ variant="line"
41
+ size="md"
42
+ maxWidth="xl">
43
+ <Tabs.List aria-label="受控自动切换">
44
+ <Tabs.Trigger
45
+ ref={triggerRef}
46
+ value="overview"
47
+ css={{
48
+ _focus: {
49
+ outline: '2px solid',
50
+ outlineColor: 'colorPalette.solid.bg',
51
+ outlineOffset: '2px',
52
+ },
53
+ }}>
54
+ 概览
55
+ </Tabs.Trigger>
56
+ <Tabs.Trigger value="disabled" disabled>
57
+ 禁用标签
58
+ </Tabs.Trigger>
59
+ <Tabs.Trigger value="settings">设置</Tabs.Trigger>
60
+ <Tabs.Indicator />
61
+ </Tabs.List>
62
+ <Tabs.Content value="overview">
63
+ <PanelCounter label="概览" />
64
+ </Tabs.Content>
65
+ <Tabs.Content value="settings">
66
+ <PanelCounter label="设置" />
67
+ </Tabs.Content>
68
+ </Tabs.Root>
69
+ <div className={css({ display: 'flex', flexWrap: 'wrap', gap: '3' })}>
70
+ <Button type="button" variant="outline" onClick={() => setValue('settings')}>
71
+ 从外部切到设置
72
+ </Button>
73
+ <Button type="button" variant="outline" onClick={() => triggerRef.current?.focus()}>
74
+ 通过 ref 聚焦概览
75
+ </Button>
76
+ </div>
77
+ <p role="status">
78
+ 当前受控标签:{value};焦点标签:{focusedValue || '无'}
79
+ </p>
80
+ <p>通过 ref 聚焦只移动焦点,不切换选中项;聚焦概览后可用 Enter/空格选中。</p>
81
+ </div>
82
+ )
83
+ },
84
+ }
85
+ export const VerticalManual: Story = {
86
+ render: function VerticalManual() {
87
+ return (
88
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
89
+ <p>垂直手动模式:上下方向键仅移动焦点,Enter/空格确认;退出面板再返回时计数归零。</p>
90
+ <Tabs.Root
91
+ defaultValue="profile"
92
+ orientation="vertical"
93
+ activationMode="manual"
94
+ lazyMount
95
+ unmountOnExit
96
+ variant="subtle"
97
+ size="sm">
98
+ <Tabs.List aria-label="垂直手动切换">
99
+ <Tabs.Trigger value="profile">资料</Tabs.Trigger>
100
+ <Tabs.Trigger value="activity">活动</Tabs.Trigger>
101
+ <Tabs.Indicator />
102
+ </Tabs.List>
103
+ <Tabs.Content value="profile">
104
+ <PanelCounter label="资料" />
105
+ </Tabs.Content>
106
+ <Tabs.Content value="activity">
107
+ <PanelCounter label="活动" />
108
+ </Tabs.Content>
109
+ </Tabs.Root>
110
+ </div>
111
+ )
112
+ },
113
+ }
114
+ export const Fitted: Story = {
115
+ render: function Fitted() {
116
+ return (
117
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
118
+ <Tabs.Root defaultValue="first" variant="enclosed" size="lg" fitted maxWidth="xl">
119
+ <Tabs.List aria-label="等宽标签">
120
+ <Tabs.Trigger value="first">第一项</Tabs.Trigger>
121
+ <Tabs.Trigger value="second">第二项</Tabs.Trigger>
122
+ <Tabs.Indicator />
123
+ </Tabs.List>
124
+ <Tabs.Content value="first">Enclosed:第一项面板</Tabs.Content>
125
+ <Tabs.Content value="second">Enclosed:第二项面板</Tabs.Content>
126
+ </Tabs.Root>
127
+ </div>
128
+ )
129
+ },
130
+ }
131
+ export const Customization: Story = {
132
+ render: function Customization() {
133
+ return (
134
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
135
+ <p>分维度定制:紧凑尺寸保留 line 外观;自定外观保留默认尺寸与键盘切换。</p>
136
+ <Tabs.Root defaultValue="first" size="unstyled" gap="2">
137
+ <Tabs.List aria-label="自定尺寸标签">
138
+ <Tabs.Trigger value="first" height="32px" px="3" textStyle="sm">
139
+ 概览
140
+ </Tabs.Trigger>
141
+ <Tabs.Trigger value="second" height="32px" px="3" textStyle="sm">
142
+ 详情
143
+ </Tabs.Trigger>
144
+ <Tabs.Indicator />
145
+ </Tabs.List>
146
+ <Tabs.Content value="first">自定尺寸:概览</Tabs.Content>
147
+ <Tabs.Content value="second">自定尺寸:详情</Tabs.Content>
148
+ </Tabs.Root>
149
+ <Tabs.Root defaultValue="first" variant="unstyled">
150
+ <Tabs.List aria-label="自定外观标签">
151
+ <Tabs.Trigger
152
+ value="first"
153
+ borderRadius="full"
154
+ focusVisibleRing="outside"
155
+ css={{ _selected: { bg: 'lime.3', color: 'lime.11' } }}>
156
+ 概览
157
+ </Tabs.Trigger>
158
+ <Tabs.Trigger
159
+ value="second"
160
+ borderRadius="full"
161
+ focusVisibleRing="outside"
162
+ css={{ _selected: { bg: 'lime.3', color: 'lime.11' } }}>
163
+ 详情
164
+ </Tabs.Trigger>
165
+ </Tabs.List>
166
+ <Tabs.Content value="first" focusVisibleRing="inside">
167
+ 自定外观:概览
168
+ </Tabs.Content>
169
+ <Tabs.Content value="second" focusVisibleRing="inside">
170
+ 自定外观:详情
171
+ </Tabs.Content>
172
+ </Tabs.Root>
173
+ </div>
174
+ )
175
+ },
176
+ }
@@ -0,0 +1,108 @@
1
+ import { Avatar, Heading, Text } from '@repo/ui'
2
+
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Display/Avatar',
9
+ component: Avatar.Root,
10
+ args: { shape: 'full', size: 'md', variant: 'subtle' },
11
+ argTypes: {
12
+ shape: { control: 'select', options: ['full', 'rounded', 'square', 'unstyled'] },
13
+ size: {
14
+ control: 'select',
15
+ options: ['2xl', '2xs', 'full', 'lg', 'md', 'sm', 'unstyled', 'xl', 'xs'],
16
+ },
17
+ variant: { control: 'select', options: ['outline', 'solid', 'subtle', 'surface', 'unstyled'] },
18
+ },
19
+ parameters: {
20
+ controls: { disable: true },
21
+ docs: {
22
+ source: { type: 'code' },
23
+ description: { component: '图片、姓名缩写、回退内容和形状定制。' },
24
+ },
25
+ },
26
+ } satisfies Meta<typeof Avatar.Root>
27
+ export default meta
28
+ type Story = StoryObj<typeof meta>
29
+ export const Playground: Story = {
30
+ parameters: {
31
+ controls: { disable: false, include: ['shape', 'size', 'variant'] },
32
+ docs: { source: { type: 'dynamic' } },
33
+ },
34
+ render: (args) => (
35
+ <div className={css({ maxWidth: '2xl' })}>
36
+ <Avatar.Root {...args}>
37
+ <Avatar.Fallback name="News Now" />
38
+ </Avatar.Root>
39
+ </div>
40
+ ),
41
+ }
42
+
43
+ export const FallbacksAndImage: Story = {
44
+ render: function FallbacksAndImage() {
45
+ return (
46
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
47
+ <div className={css({ display: 'grid', gap: '3' })}>
48
+ <Heading as="h3" textStyle="lg">
49
+ 头像与回退
50
+ </Heading>
51
+ <div
52
+ className={css({ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '4' })}>
53
+ <Avatar.Root size="sm" variant="solid">
54
+ <Avatar.Fallback name="Park UI" />
55
+ </Avatar.Root>
56
+ <Avatar.Root size="md" variant="surface" shape="rounded">
57
+ <Avatar.Fallback name=" News Now " />
58
+ </Avatar.Root>
59
+ <Avatar.Root size="lg" variant="outline" shape="square">
60
+ <Avatar.Fallback />
61
+ </Avatar.Root>
62
+ <Avatar.Root shape="full" size="lg">
63
+ <Avatar.Fallback name="Random User" />
64
+ <Avatar.Image src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2296%22%20height%3D%2296%22%20viewBox%3D%220%200%2096%2096%22%3E%3Crect%20width%3D%2296%22%20height%3D%2296%22%20fill%3D%22%233b82f6%22%2F%3E%3Ccircle%20cx%3D%2248%22%20cy%3D%2236%22%20r%3D%2218%22%20fill%3D%22%23fff%22%2F%3E%3Cpath%20d%3D%22M12%2096a36%2036%200%200%201%2072%200%22%20fill%3D%22%23fff%22%2F%3E%3C%2Fsvg%3E" />
65
+ </Avatar.Root>
66
+ <Avatar.Root size="xl">
67
+ <Avatar.Fallback asChild>
68
+ <span>自定义</span>
69
+ </Avatar.Fallback>
70
+ </Avatar.Root>
71
+ </div>
72
+ <Text color="fg.muted">
73
+ 支持姓名缩写、默认图标、自定义节点和本地图片,不请求外部头像服务。
74
+ </Text>
75
+ </div>
76
+ </div>
77
+ )
78
+ },
79
+ }
80
+ export const Customization: Story = {
81
+ render: function Customization() {
82
+ return (
83
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
84
+ <div className={css({ display: 'flex', alignItems: 'center', gap: '3', flexWrap: 'wrap' })}>
85
+ <Avatar.Root
86
+ size="unstyled"
87
+ width="36px"
88
+ height="36px"
89
+ fontSize="14px"
90
+ aria-label="自定尺寸头像">
91
+ <Avatar.Fallback name="News Now" lineHeight="1" css={{ _icon: { boxSize: '4' } }} />
92
+ </Avatar.Root>
93
+ <Avatar.Root
94
+ variant="unstyled"
95
+ bg="lime.3"
96
+ color="lime.11"
97
+ fontWeight="bold"
98
+ aria-label="自定外观头像">
99
+ <Avatar.Fallback name="Ada Lovelace" />
100
+ </Avatar.Root>
101
+ <Avatar.Root shape="unstyled" borderRadius="10px" aria-label="自定形状头像">
102
+ <Avatar.Fallback name="Park UI" borderRadius="inherit" />
103
+ </Avatar.Root>
104
+ </div>
105
+ </div>
106
+ )
107
+ },
108
+ }
@@ -0,0 +1,90 @@
1
+ import { Badge } from '@repo/ui'
2
+
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Display/Badge',
9
+ component: Badge,
10
+ args: { size: 'md', variant: 'subtle', children: '标签' },
11
+ argTypes: {
12
+ size: { control: 'select', options: ['2xl', 'lg', 'md', 'sm', 'unstyled', 'xl'] },
13
+ variant: { control: 'select', options: ['outline', 'solid', 'subtle', 'surface', 'unstyled'] },
14
+ children: { control: 'text' },
15
+ },
16
+ parameters: {
17
+ controls: { disable: true },
18
+ docs: {
19
+ source: { type: 'code' },
20
+ description: { component: '标签的配色、外观、尺寸和 asChild。' },
21
+ },
22
+ },
23
+ } satisfies Meta<typeof Badge>
24
+ export default meta
25
+ type Story = StoryObj<typeof meta>
26
+ export const Playground: Story = {
27
+ parameters: {
28
+ controls: { disable: false, include: ['size', 'variant', 'children'] },
29
+ docs: { source: { type: 'dynamic' } },
30
+ },
31
+ render: (args) => (
32
+ <div className={css({ maxWidth: '2xl' })}>
33
+ <Badge {...args} />
34
+ </div>
35
+ ),
36
+ }
37
+
38
+ export const Variants: Story = {
39
+ tags: ['!dev'],
40
+ render: function Variants() {
41
+ return (
42
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
43
+ <div className={css({ display: 'grid', gap: '3' })}>
44
+ <h3 className={css({ textStyle: 'lg', fontWeight: 'semibold' })}>Badge 配方与尺寸</h3>
45
+ <div
46
+ className={css({ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '3' })}>
47
+ <Badge variant="solid">Solid</Badge>
48
+ <Badge variant="surface">Surface</Badge>
49
+ <Badge variant="subtle">Subtle</Badge>
50
+ <Badge variant="outline">Outline</Badge>
51
+ <Badge colorPalette="red">错误</Badge>
52
+ <Badge colorPalette="green">成功</Badge>
53
+ <Badge colorPalette="gray" asChild>
54
+ <span>asChild:span</span>
55
+ </Badge>
56
+ </div>
57
+ <div
58
+ className={css({ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '3' })}>
59
+ <Badge size="sm">sm</Badge>
60
+ <Badge size="md">md</Badge>
61
+ <Badge size="lg">lg</Badge>
62
+ <Badge size="xl">xl</Badge>
63
+ <Badge size="2xl">2xl</Badge>
64
+ </div>
65
+ </div>
66
+ </div>
67
+ )
68
+ },
69
+ }
70
+ export const Customization: Story = {
71
+ render: function Customization() {
72
+ return (
73
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
74
+ <div className={css({ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '3' })}>
75
+ <Badge size="unstyled" height="22px" px="2" gap="1" fontSize="12px" lineHeight="1">
76
+ 自定尺寸
77
+ </Badge>
78
+ <Badge
79
+ variant="unstyled"
80
+ bg="lime.3"
81
+ color="lime.11"
82
+ borderRadius="full"
83
+ fontWeight="semibold">
84
+ 自定外观
85
+ </Badge>
86
+ </div>
87
+ </div>
88
+ )
89
+ },
90
+ }
@@ -0,0 +1,121 @@
1
+ import { Badge, Button, Card } from '@repo/ui'
2
+ import { useState } from 'react'
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Display/Card',
9
+ component: Card.Root,
10
+ args: { variant: 'outline' },
11
+ argTypes: {
12
+ variant: { control: 'select', options: ['elevated', 'outline', 'subtle', 'unstyled'] },
13
+ },
14
+ parameters: {
15
+ controls: { disable: true },
16
+ docs: { source: { type: 'code' }, description: { component: '卡片插槽、外观与操作反馈。' } },
17
+ },
18
+ } satisfies Meta<typeof Card.Root>
19
+ export default meta
20
+ type Story = StoryObj<typeof meta>
21
+ export const Playground: Story = {
22
+ parameters: {
23
+ controls: { disable: false, include: ['variant'] },
24
+ docs: { source: { type: 'dynamic' } },
25
+ },
26
+ render: (args) => (
27
+ <div className={css({ maxWidth: '2xl' })}>
28
+ <Card.Root {...args}>
29
+ <Card.Header>
30
+ <Card.Title>卡片标题</Card.Title>
31
+ <Card.Description>卡片描述</Card.Description>
32
+ </Card.Header>
33
+ <Card.Body>内容区域</Card.Body>
34
+ <Card.Footer>
35
+ <Button>操作</Button>
36
+ </Card.Footer>
37
+ </Card.Root>
38
+ </div>
39
+ ),
40
+ }
41
+
42
+ export const Variants: Story = {
43
+ tags: ['!dev'],
44
+ render: function Variants() {
45
+ const [actions, setActions] = useState(0)
46
+ return (
47
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
48
+ <div
49
+ className={css({
50
+ display: 'grid',
51
+ gap: '4',
52
+ gridTemplateColumns: { base: '1fr', lg: 'repeat(3, minmax(0, 1fr))' },
53
+ })}>
54
+ <Card.Root variant="outline">
55
+ <Card.Header>
56
+ <Card.Title asChild>
57
+ <h3>Outline 卡片</h3>
58
+ </Card.Title>
59
+ <Card.Description>默认配方:边框与背景。</Card.Description>
60
+ </Card.Header>
61
+ <Card.Body>Header、Body 和 Footer 应保持一致的内边距。</Card.Body>
62
+ <Card.Footer>
63
+ <Button
64
+ type="button"
65
+ variant="outline"
66
+ onClick={() => setActions((count) => count + 1)}>
67
+ 操作
68
+ </Button>
69
+ </Card.Footer>
70
+ </Card.Root>
71
+ <Card.Root variant="elevated">
72
+ <Card.Header>
73
+ <Card.Title>Elevated 卡片</Card.Title>
74
+ <Card.Description>阴影配方。</Card.Description>
75
+ </Card.Header>
76
+ <Card.Body>卡片内容通过插槽组合,支持 css 和原生属性。</Card.Body>
77
+ <Card.Footer>
78
+ <Button type="button" onClick={() => setActions((count) => count + 1)}>
79
+ 操作
80
+ </Button>
81
+ </Card.Footer>
82
+ </Card.Root>
83
+ <Card.Root variant="subtle">
84
+ <Card.Header>
85
+ <Card.Title>Subtle 卡片</Card.Title>
86
+ <Card.Description>柔和背景配方。</Card.Description>
87
+ </Card.Header>
88
+ <Card.Body>Footer 使用 div,不应被识别为额外标题。</Card.Body>
89
+ <Card.Footer>
90
+ <Badge>仅供展示</Badge>
91
+ </Card.Footer>
92
+ </Card.Root>
93
+ </div>
94
+ <p role="status">卡片操作执行 {actions} 次。</p>
95
+ </div>
96
+ )
97
+ },
98
+ }
99
+ export const CustomAppearance: Story = {
100
+ render: function CustomAppearance() {
101
+ const [, setActions] = useState(0)
102
+ return (
103
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
104
+ <Card.Root variant="unstyled" bg="gray.3" borderRadius="lg">
105
+ <Card.Header>
106
+ <Card.Title fontWeight="bold">自定外观,保留卡片间距</Card.Title>
107
+ <Card.Description color="gray.11">
108
+ 单档尺寸继续保留,不需要重新设置全部 slots。
109
+ </Card.Description>
110
+ </Card.Header>
111
+ <Card.Body>背景、圆角、标题字重与描述颜色由当前实例定义。</Card.Body>
112
+ <Card.Footer>
113
+ <Button type="button" size="sm" onClick={() => setActions((count) => count + 1)}>
114
+ 操作
115
+ </Button>
116
+ </Card.Footer>
117
+ </Card.Root>
118
+ </div>
119
+ )
120
+ },
121
+ }
@@ -0,0 +1,62 @@
1
+ import { Heading } from '@repo/ui'
2
+
3
+ import { css } from 'styled-system/css'
4
+
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Display/Heading',
9
+ component: Heading,
10
+ args: { size: 'xl', children: '组件标题' },
11
+ argTypes: {
12
+ size: {
13
+ control: 'select',
14
+ options: ['2xl', '3xl', '4xl', '5xl', '6xl', '7xl', 'lg', 'md', 'sm', 'unstyled', 'xl', 'xs'],
15
+ },
16
+ children: { control: 'text' },
17
+ },
18
+ parameters: {
19
+ controls: { disable: true },
20
+ docs: {
21
+ source: { type: 'code' },
22
+ description: { component: 'HTML 标题层级、字号和样式覆盖。' },
23
+ },
24
+ },
25
+ } satisfies Meta<typeof Heading>
26
+ export default meta
27
+ type Story = StoryObj<typeof meta>
28
+ export const Playground: Story = {
29
+ parameters: {
30
+ controls: { disable: false, include: ['size', 'children'] },
31
+ docs: { source: { type: 'dynamic' } },
32
+ },
33
+ render: (args) => (
34
+ <div className={css({ maxWidth: '2xl' })}>
35
+ <Heading {...args} />
36
+ </div>
37
+ ),
38
+ }
39
+
40
+ export const LevelsAndSizes: Story = {
41
+ render: function LevelsAndSizes() {
42
+ return (
43
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
44
+ <div className={css({ display: 'grid', gap: '3' })}>
45
+ <Heading as="h3" size="lg">
46
+ 标题 size 与 HTML 层级分别控制
47
+ </Heading>
48
+ <Heading as="h4" size="sm">
49
+ sm 标题
50
+ </Heading>
51
+ <Heading as="h4" size="lg" textStyle="sm">
52
+ textStyle 可以覆盖 size 的文字样式
53
+ </Heading>
54
+ </div>
55
+ <Heading as="h3">默认标题 · xl</Heading>
56
+ <Heading as="h4" size="unstyled" fontSize="17px" lineHeight="1.5">
57
+ 自定字号,保留默认字重
58
+ </Heading>
59
+ </div>
60
+ )
61
+ },
62
+ }
@@ -0,0 +1,51 @@
1
+ import { Icon } from '@repo/ui'
2
+
3
+ import { css } from 'styled-system/css'
4
+ import { SearchIcon } from 'lucide-react'
5
+ import type { Meta, StoryObj } from '@storybook/react-vite'
6
+
7
+ const meta = {
8
+ title: 'Display/Icon',
9
+ component: Icon,
10
+ args: { size: 'md' },
11
+ argTypes: {
12
+ size: { control: 'select', options: ['2xs', 'lg', 'md', 'sm', 'unstyled', 'xl', 'xs'] },
13
+ },
14
+ parameters: {
15
+ controls: { disable: true },
16
+ docs: { source: { type: 'code' }, description: { component: '图标组合、尺寸和颜色。' } },
17
+ },
18
+ } satisfies Meta<typeof Icon>
19
+ export default meta
20
+ type Story = StoryObj<typeof meta>
21
+ export const Playground: Story = {
22
+ parameters: {
23
+ controls: { disable: false, include: ['size'] },
24
+ docs: { source: { type: 'dynamic' } },
25
+ },
26
+ render: (args) => (
27
+ <div className={css({ maxWidth: '2xl' })}>
28
+ <Icon {...args} asChild>
29
+ <SearchIcon />
30
+ </Icon>
31
+ </div>
32
+ ),
33
+ }
34
+
35
+ export const CompositionAndSize: Story = {
36
+ render: function CompositionAndSize() {
37
+ return (
38
+ <div className={css({ display: 'grid', gap: '4', maxWidth: '4xl' })}>
39
+ <Icon asChild size="lg" color="fg.muted">
40
+ <SearchIcon aria-hidden="true" />
41
+ </Icon>
42
+ <span className={css({ display: 'inline-flex', alignItems: 'center', gap: '2' })}>
43
+ <Icon asChild size="unstyled" width="18px" height="18px" color="lime.11">
44
+ <SearchIcon />
45
+ </Icon>
46
+ 自定图标尺寸
47
+ </span>
48
+ </div>
49
+ )
50
+ },
51
+ }