willa-workspace 0.0.3-alpha.2739b3e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +45 -0
- package/.husky/pre-commit +1 -0
- package/AGENTS.md +128 -0
- package/CONTRIBUTING.md +138 -0
- package/README.md +27 -0
- package/docs/architecture.md +337 -0
- package/docs/component.md +333 -0
- package/docs/css.md +400 -0
- package/docs/style.md +146 -0
- package/example/index.html +12 -0
- package/example/package.json +28 -0
- package/example/src/App.tsx +613 -0
- package/example/src/UsageGuide.tsx +179 -0
- package/example/src/catalog/DocView.tsx +413 -0
- package/example/src/catalog/defineDoc.tsx +352 -0
- package/example/src/catalog/registry.ts +206 -0
- package/example/src/catalog/types.ts +38 -0
- package/example/src/docs/Alert.demo.tsx +233 -0
- package/example/src/docs/Anchor.demo.tsx +244 -0
- package/example/src/docs/AppShell.demo.tsx +192 -0
- package/example/src/docs/AttachmentList.demo.tsx +425 -0
- package/example/src/docs/AudioEmbed.demo.tsx +102 -0
- package/example/src/docs/AudioLink.demo.tsx +84 -0
- package/example/src/docs/Avatar.demo.tsx +342 -0
- package/example/src/docs/Badge.demo.tsx +196 -0
- package/example/src/docs/BorderBeam.demo.tsx +261 -0
- package/example/src/docs/Breadcrumb.demo.tsx +194 -0
- package/example/src/docs/Button.demo.tsx +304 -0
- package/example/src/docs/Calendar.demo.tsx +742 -0
- package/example/src/docs/Callout.demo.tsx +143 -0
- package/example/src/docs/Card.demo.tsx +254 -0
- package/example/src/docs/Carousel.demo.tsx +764 -0
- package/example/src/docs/ChatMessage.demo.tsx +356 -0
- package/example/src/docs/ChatThread.demo.tsx +107 -0
- package/example/src/docs/Checkbox.demo.tsx +112 -0
- package/example/src/docs/Citation.demo.tsx +297 -0
- package/example/src/docs/CodeBlock.demo.tsx +175 -0
- package/example/src/docs/CodeTabs.demo.tsx +285 -0
- package/example/src/docs/Collapse.demo.tsx +306 -0
- package/example/src/docs/ColorPicker.demo.tsx +491 -0
- package/example/src/docs/Comment.demo.tsx +333 -0
- package/example/src/docs/CommentInput.demo.tsx +894 -0
- package/example/src/docs/CommentList.demo.tsx +344 -0
- package/example/src/docs/Composer.demo.tsx +435 -0
- package/example/src/docs/Container.demo.tsx +125 -0
- package/example/src/docs/ContextPanel.demo.tsx +344 -0
- package/example/src/docs/ContextWindowMeter.demo.tsx +212 -0
- package/example/src/docs/ConversationList.demo.tsx +289 -0
- package/example/src/docs/CopyButton.demo.tsx +274 -0
- package/example/src/docs/DatePicker.demo.tsx +502 -0
- package/example/src/docs/DescriptionList.demo.tsx +265 -0
- package/example/src/docs/Dialog.demo.tsx +492 -0
- package/example/src/docs/DiffViewer.demo.tsx +307 -0
- package/example/src/docs/Download.demo.tsx +182 -0
- package/example/src/docs/Drawer.demo.tsx +300 -0
- package/example/src/docs/EmptyState.demo.tsx +406 -0
- package/example/src/docs/EnglishCards.demo.tsx +133 -0
- package/example/src/docs/FeedbackBar.demo.tsx +219 -0
- package/example/src/docs/FileCard.demo.tsx +234 -0
- package/example/src/docs/FilePreview.demo.tsx +333 -0
- package/example/src/docs/FileTree.demo.tsx +463 -0
- package/example/src/docs/FilterBar.demo.tsx +290 -0
- package/example/src/docs/FloatButton.demo.tsx +726 -0
- package/example/src/docs/Form.demo.tsx +278 -0
- package/example/src/docs/FormActions.demo.tsx +198 -0
- package/example/src/docs/FormField.demo.tsx +193 -0
- package/example/src/docs/FormGroup.demo.tsx +188 -0
- package/example/src/docs/FormMessage.demo.tsx +158 -0
- package/example/src/docs/GenerationCard.demo.tsx +393 -0
- package/example/src/docs/GitHubMention.demo.tsx +83 -0
- package/example/src/docs/GitHubRepo.demo.tsx +88 -0
- package/example/src/docs/Grid.demo.tsx +218 -0
- package/example/src/docs/Group.demo.tsx +315 -0
- package/example/src/docs/HumanApprovalCard.demo.tsx +275 -0
- package/example/src/docs/IconButton.demo.tsx +354 -0
- package/example/src/docs/Image.demo.tsx +124 -0
- package/example/src/docs/ImageGallery.demo.tsx +206 -0
- package/example/src/docs/Input.demo.tsx +238 -0
- package/example/src/docs/InputPanel.demo.tsx +255 -0
- package/example/src/docs/Kbd.demo.tsx +162 -0
- package/example/src/docs/Lightbox.demo.tsx +184 -0
- package/example/src/docs/List.demo.tsx +1009 -0
- package/example/src/docs/LogoWall.demo.tsx +178 -0
- package/example/src/docs/Masonry.demo.tsx +170 -0
- package/example/src/docs/MathExpression.demo.tsx +164 -0
- package/example/src/docs/Mdx.demo.tsx +343 -0
- package/example/src/docs/MentionInput.demo.tsx +543 -0
- package/example/src/docs/Menu.demo.tsx +430 -0
- package/example/src/docs/MessageActions.demo.tsx +355 -0
- package/example/src/docs/MessageList.demo.tsx +410 -0
- package/example/src/docs/ModelSelector.demo.tsx +297 -0
- package/example/src/docs/NumberInput.demo.tsx +816 -0
- package/example/src/docs/PageHeader.demo.tsx +198 -0
- package/example/src/docs/Pagination.demo.tsx +257 -0
- package/example/src/docs/Panel.demo.tsx +184 -0
- package/example/src/docs/Picker.demo.tsx +257 -0
- package/example/src/docs/Poem.demo.tsx +98 -0
- package/example/src/docs/Popover.demo.tsx +362 -0
- package/example/src/docs/ProfileCard.demo.tsx +161 -0
- package/example/src/docs/Progress.demo.tsx +243 -0
- package/example/src/docs/PromptInput.demo.tsx +497 -0
- package/example/src/docs/PromptTemplatePicker.demo.tsx +344 -0
- package/example/src/docs/QRCode.demo.tsx +364 -0
- package/example/src/docs/Radio.demo.tsx +120 -0
- package/example/src/docs/RangeInput.demo.tsx +405 -0
- package/example/src/docs/Rate.demo.tsx +396 -0
- package/example/src/docs/ReasoningSteps.demo.tsx +470 -0
- package/example/src/docs/Result.demo.tsx +121 -0
- package/example/src/docs/ScheduleCalendar.demo.tsx +459 -0
- package/example/src/docs/SearchInput.demo.tsx +217 -0
- package/example/src/docs/SectionHeader.demo.tsx +186 -0
- package/example/src/docs/Segmented.demo.tsx +598 -0
- package/example/src/docs/Select.demo.tsx +164 -0
- package/example/src/docs/SelectionBar.demo.tsx +315 -0
- package/example/src/docs/Separator.demo.tsx +179 -0
- package/example/src/docs/SidebarLayout.demo.tsx +183 -0
- package/example/src/docs/SiteFooter.demo.tsx +189 -0
- package/example/src/docs/SiteNav.demo.tsx +168 -0
- package/example/src/docs/Skeleton.demo.tsx +154 -0
- package/example/src/docs/SourceCard.demo.tsx +241 -0
- package/example/src/docs/Spinner.demo.tsx +166 -0
- package/example/src/docs/SplitPane.demo.tsx +544 -0
- package/example/src/docs/Stack.demo.tsx +135 -0
- package/example/src/docs/Statistic.demo.tsx +124 -0
- package/example/src/docs/Steps.demo.tsx +88 -0
- package/example/src/docs/SuggestionChips.demo.tsx +259 -0
- package/example/src/docs/Switch.demo.tsx +110 -0
- package/example/src/docs/Table.demo.tsx +2071 -0
- package/example/src/docs/Tabs.demo.tsx +285 -0
- package/example/src/docs/Tag.demo.tsx +264 -0
- package/example/src/docs/TagInput.demo.tsx +385 -0
- package/example/src/docs/TextArea.demo.tsx +185 -0
- package/example/src/docs/ThinkingIndicator.demo.tsx +248 -0
- package/example/src/docs/TimePicker.demo.tsx +464 -0
- package/example/src/docs/Timeline.demo.tsx +311 -0
- package/example/src/docs/Toast.demo.tsx +351 -0
- package/example/src/docs/ToolCallCard.demo.tsx +286 -0
- package/example/src/docs/Toolbar.demo.tsx +372 -0
- package/example/src/docs/Tooltip.demo.tsx +274 -0
- package/example/src/docs/Tour.demo.tsx +423 -0
- package/example/src/docs/TraceViewer.demo.tsx +416 -0
- package/example/src/docs/Tree.demo.tsx +507 -0
- package/example/src/docs/TreeSelect.demo.tsx +476 -0
- package/example/src/docs/Typography.demo.tsx +953 -0
- package/example/src/docs/Upload.demo.tsx +299 -0
- package/example/src/docs/VideoEmbed.demo.tsx +108 -0
- package/example/src/docs/VideoLink.demo.tsx +83 -0
- package/example/src/docs/Watermark.demo.tsx +352 -0
- package/example/src/docs/WebEmbed.demo.tsx +96 -0
- package/example/src/docs/XPostEmbed.demo.tsx +57 -0
- package/example/src/main.tsx +36 -0
- package/example/src/styles.css +919 -0
- package/example/src/vite-env.d.ts +1 -0
- package/example/vite.config.ts +11 -0
- package/package.json +40 -0
- package/packages/willa/README.md +47 -0
- package/packages/willa/auklet.config.mjs +23 -0
- package/packages/willa/package.json +83 -0
- package/packages/willa/src/Alert/index.tsx +8 -0
- package/packages/willa/src/Anchor/index.tsx +8 -0
- package/packages/willa/src/AppShell/index.tsx +2 -0
- package/packages/willa/src/AttachmentList/index.tsx +10 -0
- package/packages/willa/src/AudioEmbed/index.tsx +4 -0
- package/packages/willa/src/AudioLink/index.tsx +4 -0
- package/packages/willa/src/Avatar/index.tsx +6 -0
- package/packages/willa/src/Badge/index.tsx +7 -0
- package/packages/willa/src/BorderBeam/index.tsx +6 -0
- package/packages/willa/src/Breadcrumb/index.tsx +6 -0
- package/packages/willa/src/Button/index.tsx +6 -0
- package/packages/willa/src/Calendar/index.tsx +19 -0
- package/packages/willa/src/Callout/index.tsx +5 -0
- package/packages/willa/src/Card/index.tsx +6 -0
- package/packages/willa/src/Carousel/index.tsx +8 -0
- package/packages/willa/src/ChatMessage/index.tsx +6 -0
- package/packages/willa/src/ChatThread/index.tsx +4 -0
- package/packages/willa/src/Checkbox/index.tsx +5 -0
- package/packages/willa/src/Citation/index.tsx +6 -0
- package/packages/willa/src/CodeBlock/index.tsx +5 -0
- package/packages/willa/src/CodeTabs/index.tsx +6 -0
- package/packages/willa/src/Collapse/index.tsx +5 -0
- package/packages/willa/src/ColorPicker/index.tsx +12 -0
- package/packages/willa/src/Comment/index.tsx +6 -0
- package/packages/willa/src/CommentInput/index.tsx +8 -0
- package/packages/willa/src/CommentList/index.tsx +5 -0
- package/packages/willa/src/Composer/index.tsx +1 -0
- package/packages/willa/src/Container/index.tsx +6 -0
- package/packages/willa/src/ContextPanel/index.tsx +7 -0
- package/packages/willa/src/ContextWindowMeter/index.tsx +7 -0
- package/packages/willa/src/ConversationList/index.tsx +8 -0
- package/packages/willa/src/CopyButton/index.tsx +6 -0
- package/packages/willa/src/DatePicker/index.tsx +15 -0
- package/packages/willa/src/DescriptionList/index.tsx +8 -0
- package/packages/willa/src/Dialog/index.tsx +6 -0
- package/packages/willa/src/DiffViewer/index.tsx +5 -0
- package/packages/willa/src/Download/index.tsx +6 -0
- package/packages/willa/src/Drawer/index.tsx +6 -0
- package/packages/willa/src/EmptyState/index.tsx +7 -0
- package/packages/willa/src/EnglishCards/index.tsx +4 -0
- package/packages/willa/src/FeedbackBar/index.tsx +7 -0
- package/packages/willa/src/FileCard/index.tsx +7 -0
- package/packages/willa/src/FilePreview/index.tsx +6 -0
- package/packages/willa/src/FileTree/index.tsx +10 -0
- package/packages/willa/src/FilterBar/index.tsx +7 -0
- package/packages/willa/src/FloatButton/index.tsx +14 -0
- package/packages/willa/src/Form/index.tsx +5 -0
- package/packages/willa/src/FormActions/index.tsx +6 -0
- package/packages/willa/src/FormField/index.tsx +6 -0
- package/packages/willa/src/FormGroup/index.tsx +6 -0
- package/packages/willa/src/FormMessage/index.tsx +5 -0
- package/packages/willa/src/GenerationCard/index.tsx +6 -0
- package/packages/willa/src/GitHubMention/index.tsx +4 -0
- package/packages/willa/src/GitHubRepo/index.tsx +4 -0
- package/packages/willa/src/Grid/index.tsx +8 -0
- package/packages/willa/src/Group/index.tsx +9 -0
- package/packages/willa/src/HumanApprovalCard/index.tsx +8 -0
- package/packages/willa/src/IconButton/index.tsx +7 -0
- package/packages/willa/src/Image/index.tsx +1 -0
- package/packages/willa/src/ImageGallery/index.tsx +5 -0
- package/packages/willa/src/Input/index.tsx +6 -0
- package/packages/willa/src/InputPanel/index.tsx +8 -0
- package/packages/willa/src/Kbd/index.tsx +9 -0
- package/packages/willa/src/Lightbox/index.tsx +7 -0
- package/packages/willa/src/List/index.tsx +10 -0
- package/packages/willa/src/LogoWall/index.tsx +6 -0
- package/packages/willa/src/Masonry/index.tsx +6 -0
- package/packages/willa/src/MathExpression/index.tsx +5 -0
- package/packages/willa/src/Mdx/index.tsx +1 -0
- package/packages/willa/src/MentionInput/index.tsx +5 -0
- package/packages/willa/src/Menu/index.tsx +11 -0
- package/packages/willa/src/MessageActions/index.tsx +8 -0
- package/packages/willa/src/MessageList/index.tsx +4 -0
- package/packages/willa/src/ModelSelector/index.tsx +9 -0
- package/packages/willa/src/NumberInput/index.tsx +15 -0
- package/packages/willa/src/PageHeader/index.tsx +5 -0
- package/packages/willa/src/Pagination/index.tsx +6 -0
- package/packages/willa/src/Panel/index.tsx +6 -0
- package/packages/willa/src/Picker/index.tsx +8 -0
- package/packages/willa/src/Poem/index.tsx +1 -0
- package/packages/willa/src/Popover/index.tsx +7 -0
- package/packages/willa/src/ProfileCard/index.tsx +5 -0
- package/packages/willa/src/Progress/index.tsx +6 -0
- package/packages/willa/src/PromptInput/index.tsx +6 -0
- package/packages/willa/src/PromptTemplatePicker/index.tsx +6 -0
- package/packages/willa/src/QRCode/index.tsx +9 -0
- package/packages/willa/src/Radio/index.tsx +5 -0
- package/packages/willa/src/RangeInput/index.tsx +2 -0
- package/packages/willa/src/Rate/index.tsx +6 -0
- package/packages/willa/src/ReasoningSteps/index.tsx +8 -0
- package/packages/willa/src/ResizablePanel/index.tsx +10 -0
- package/packages/willa/src/Result/index.tsx +7 -0
- package/packages/willa/src/SearchInput/index.tsx +4 -0
- package/packages/willa/src/SectionHeader/index.tsx +6 -0
- package/packages/willa/src/Segmented/index.tsx +9 -0
- package/packages/willa/src/Select/index.tsx +7 -0
- package/packages/willa/src/SelectionBar/index.tsx +5 -0
- package/packages/willa/src/Separator/index.tsx +7 -0
- package/packages/willa/src/SidebarLayout/index.tsx +7 -0
- package/packages/willa/src/SiteFooter/index.tsx +6 -0
- package/packages/willa/src/SiteNav/index.tsx +5 -0
- package/packages/willa/src/Skeleton/index.tsx +4 -0
- package/packages/willa/src/SourceCard/index.tsx +6 -0
- package/packages/willa/src/Spinner/index.tsx +7 -0
- package/packages/willa/src/SplitPane/index.tsx +10 -0
- package/packages/willa/src/Stack/index.tsx +8 -0
- package/packages/willa/src/Statistic/index.tsx +7 -0
- package/packages/willa/src/Step/index.tsx +1 -0
- package/packages/willa/src/Steps/index.tsx +1 -0
- package/packages/willa/src/SuggestionChips/index.tsx +7 -0
- package/packages/willa/src/Switch/index.tsx +5 -0
- package/packages/willa/src/Table/index.tsx +19 -0
- package/packages/willa/src/Tabs/index.tsx +6 -0
- package/packages/willa/src/Tag/index.tsx +9 -0
- package/packages/willa/src/TagInput/index.tsx +8 -0
- package/packages/willa/src/TextArea/index.tsx +7 -0
- package/packages/willa/src/ThinkingIndicator/index.tsx +7 -0
- package/packages/willa/src/TimePicker/index.tsx +10 -0
- package/packages/willa/src/Timeline/index.tsx +8 -0
- package/packages/willa/src/Toast/index.tsx +10 -0
- package/packages/willa/src/ToolCallCard/index.tsx +5 -0
- package/packages/willa/src/Toolbar/index.tsx +6 -0
- package/packages/willa/src/Tooltip/index.tsx +7 -0
- package/packages/willa/src/Tour/index.tsx +10 -0
- package/packages/willa/src/TraceViewer/index.tsx +8 -0
- package/packages/willa/src/Tree/index.tsx +11 -0
- package/packages/willa/src/TreeSelect/index.tsx +8 -0
- package/packages/willa/src/Typography/index.tsx +20 -0
- package/packages/willa/src/Upload/index.tsx +11 -0
- package/packages/willa/src/VideoEmbed/index.tsx +4 -0
- package/packages/willa/src/VideoLink/index.tsx +4 -0
- package/packages/willa/src/Watermark/index.tsx +5 -0
- package/packages/willa/src/WebEmbed/index.tsx +4 -0
- package/packages/willa/src/XPostEmbed/index.tsx +4 -0
- package/packages/willa/src/index.ts +5 -0
- package/packages/willa/vitest.config.ts +9 -0
- package/packages/willa-ai/README.md +32 -0
- package/packages/willa-ai/auklet.config.mjs +25 -0
- package/packages/willa-ai/package.json +84 -0
- package/packages/willa-ai/src/components/AttachmentList/index.css +223 -0
- package/packages/willa-ai/src/components/AttachmentList/index.tsx +256 -0
- package/packages/willa-ai/src/components/ChatMessage/index.css +211 -0
- package/packages/willa-ai/src/components/ChatMessage/index.tsx +126 -0
- package/packages/willa-ai/src/components/Composer/index.css +137 -0
- package/packages/willa-ai/src/components/Composer/index.tsx +92 -0
- package/packages/willa-ai/src/components/ContextPanel/index.css +252 -0
- package/packages/willa-ai/src/components/ContextPanel/index.tsx +513 -0
- package/packages/willa-ai/src/components/ContextWindowMeter/index.css +237 -0
- package/packages/willa-ai/src/components/ContextWindowMeter/index.tsx +266 -0
- package/packages/willa-ai/src/components/ConversationList/index.css +260 -0
- package/packages/willa-ai/src/components/ConversationList/index.tsx +549 -0
- package/packages/willa-ai/src/components/FeedbackBar/index.css +83 -0
- package/packages/willa-ai/src/components/FeedbackBar/index.tsx +357 -0
- package/packages/willa-ai/src/components/GenerationCard/index.css +275 -0
- package/packages/willa-ai/src/components/GenerationCard/index.tsx +156 -0
- package/packages/willa-ai/src/components/HumanApprovalCard/index.css +205 -0
- package/packages/willa-ai/src/components/HumanApprovalCard/index.tsx +262 -0
- package/packages/willa-ai/src/components/MessageActions/index.css +174 -0
- package/packages/willa-ai/src/components/MessageActions/index.tsx +152 -0
- package/packages/willa-ai/src/components/MessageList/index.css +80 -0
- package/packages/willa-ai/src/components/MessageList/index.tsx +96 -0
- package/packages/willa-ai/src/components/ModelSelector/index.css +177 -0
- package/packages/willa-ai/src/components/ModelSelector/index.tsx +421 -0
- package/packages/willa-ai/src/components/PromptInput/index.css +12 -0
- package/packages/willa-ai/src/components/PromptInput/index.tsx +230 -0
- package/packages/willa-ai/src/components/PromptTemplatePicker/index.css +173 -0
- package/packages/willa-ai/src/components/PromptTemplatePicker/index.tsx +389 -0
- package/packages/willa-ai/src/components/ReasoningSteps/index.css +190 -0
- package/packages/willa-ai/src/components/ReasoningSteps/index.tsx +199 -0
- package/packages/willa-ai/src/components/SuggestionChips/index.css +164 -0
- package/packages/willa-ai/src/components/SuggestionChips/index.tsx +142 -0
- package/packages/willa-ai/src/components/ThinkingIndicator/index.css +230 -0
- package/packages/willa-ai/src/components/ThinkingIndicator/index.tsx +162 -0
- package/packages/willa-ai/src/components/ToolCallCard/index.css +244 -0
- package/packages/willa-ai/src/components/ToolCallCard/index.tsx +131 -0
- package/packages/willa-ai/src/components/TraceViewer/index.css +438 -0
- package/packages/willa-ai/src/components/TraceViewer/index.tsx +445 -0
- package/packages/willa-ai/src/index.ts +123 -0
- package/packages/willa-ai/src/internal/cardCollapse.tsx +90 -0
- package/packages/willa-ai/src/internal/searchText.ts +50 -0
- package/packages/willa-ai/src/themes/dark.css +308 -0
- package/packages/willa-ai/src/themes/light.css +303 -0
- package/packages/willa-ai/vitest.config.ts +15 -0
- package/packages/willa-content/README.md +47 -0
- package/packages/willa-content/auklet.config.mjs +25 -0
- package/packages/willa-content/package.json +86 -0
- package/packages/willa-content/src/components/Alert/index.css +158 -0
- package/packages/willa-content/src/components/Alert/index.tsx +182 -0
- package/packages/willa-content/src/components/Anchor/index.css +131 -0
- package/packages/willa-content/src/components/Anchor/index.tsx +253 -0
- package/packages/willa-content/src/components/Avatar/index.css +248 -0
- package/packages/willa-content/src/components/Avatar/index.tsx +331 -0
- package/packages/willa-content/src/components/Badge/index.css +111 -0
- package/packages/willa-content/src/components/Badge/index.tsx +56 -0
- package/packages/willa-content/src/components/Breadcrumb/index.css +92 -0
- package/packages/willa-content/src/components/Breadcrumb/index.tsx +129 -0
- package/packages/willa-content/src/components/Button/index.css +215 -0
- package/packages/willa-content/src/components/Button/index.tsx +295 -0
- package/packages/willa-content/src/components/Callout/index.css +102 -0
- package/packages/willa-content/src/components/Callout/index.tsx +61 -0
- package/packages/willa-content/src/components/Carousel/index.css +236 -0
- package/packages/willa-content/src/components/Carousel/index.tsx +488 -0
- package/packages/willa-content/src/components/ChatThread/index.css +141 -0
- package/packages/willa-content/src/components/ChatThread/index.tsx +118 -0
- package/packages/willa-content/src/components/Citation/index.css +226 -0
- package/packages/willa-content/src/components/Citation/index.tsx +135 -0
- package/packages/willa-content/src/components/CodeBlock/index.css +267 -0
- package/packages/willa-content/src/components/CodeBlock/index.tsx +173 -0
- package/packages/willa-content/src/components/CodeTabs/index.css +116 -0
- package/packages/willa-content/src/components/CodeTabs/index.tsx +88 -0
- package/packages/willa-content/src/components/Collapse/index.css +135 -0
- package/packages/willa-content/src/components/Collapse/index.tsx +108 -0
- package/packages/willa-content/src/components/Comment/index.css +184 -0
- package/packages/willa-content/src/components/Comment/index.tsx +106 -0
- package/packages/willa-content/src/components/CommentInput/index.css +96 -0
- package/packages/willa-content/src/components/CommentInput/index.tsx +84 -0
- package/packages/willa-content/src/components/CommentList/index.css +43 -0
- package/packages/willa-content/src/components/CommentList/index.tsx +79 -0
- package/packages/willa-content/src/components/CopyButton/index.css +26 -0
- package/packages/willa-content/src/components/CopyButton/index.tsx +227 -0
- package/packages/willa-content/src/components/DescriptionList/index.css +176 -0
- package/packages/willa-content/src/components/DescriptionList/index.tsx +96 -0
- package/packages/willa-content/src/components/Dialog/index.css +225 -0
- package/packages/willa-content/src/components/Dialog/index.tsx +303 -0
- package/packages/willa-content/src/components/DiffViewer/index.css +321 -0
- package/packages/willa-content/src/components/DiffViewer/index.tsx +486 -0
- package/packages/willa-content/src/components/Download/index.css +118 -0
- package/packages/willa-content/src/components/Download/index.tsx +96 -0
- package/packages/willa-content/src/components/Drawer/index.css +160 -0
- package/packages/willa-content/src/components/Drawer/index.tsx +323 -0
- package/packages/willa-content/src/components/EmptyState/index.css +220 -0
- package/packages/willa-content/src/components/EmptyState/index.tsx +78 -0
- package/packages/willa-content/src/components/FileCard/fileIcon.tsx +215 -0
- package/packages/willa-content/src/components/FileCard/index.css +242 -0
- package/packages/willa-content/src/components/FileCard/index.tsx +133 -0
- package/packages/willa-content/src/components/FilePreview/index.css +589 -0
- package/packages/willa-content/src/components/FilePreview/index.tsx +750 -0
- package/packages/willa-content/src/components/FileTree/index.css +169 -0
- package/packages/willa-content/src/components/FileTree/index.tsx +341 -0
- package/packages/willa-content/src/components/FloatButton/index.css +276 -0
- package/packages/willa-content/src/components/FloatButton/index.tsx +558 -0
- package/packages/willa-content/src/components/IconButton/index.css +196 -0
- package/packages/willa-content/src/components/IconButton/index.tsx +272 -0
- package/packages/willa-content/src/components/Image/index.css +72 -0
- package/packages/willa-content/src/components/Image/index.tsx +141 -0
- package/packages/willa-content/src/components/ImageGallery/index.css +82 -0
- package/packages/willa-content/src/components/ImageGallery/index.tsx +170 -0
- package/packages/willa-content/src/components/InputPanel/index.css +181 -0
- package/packages/willa-content/src/components/InputPanel/index.tsx +255 -0
- package/packages/willa-content/src/components/Kbd/index.css +61 -0
- package/packages/willa-content/src/components/Kbd/index.tsx +102 -0
- package/packages/willa-content/src/components/Lightbox/index.css +127 -0
- package/packages/willa-content/src/components/Lightbox/index.tsx +328 -0
- package/packages/willa-content/src/components/List/index.css +439 -0
- package/packages/willa-content/src/components/List/index.tsx +403 -0
- package/packages/willa-content/src/components/MathExpression/index.css +65 -0
- package/packages/willa-content/src/components/MathExpression/index.tsx +105 -0
- package/packages/willa-content/src/components/MentionInput/index.css +92 -0
- package/packages/willa-content/src/components/MentionInput/index.tsx +1138 -0
- package/packages/willa-content/src/components/Menu/index.css +151 -0
- package/packages/willa-content/src/components/Menu/index.tsx +356 -0
- package/packages/willa-content/src/components/Pagination/index.css +139 -0
- package/packages/willa-content/src/components/Pagination/index.tsx +373 -0
- package/packages/willa-content/src/components/Popover/index.css +128 -0
- package/packages/willa-content/src/components/Popover/index.tsx +226 -0
- package/packages/willa-content/src/components/Progress/index.css +137 -0
- package/packages/willa-content/src/components/Progress/index.tsx +117 -0
- package/packages/willa-content/src/components/Result/index.css +142 -0
- package/packages/willa-content/src/components/Result/index.tsx +85 -0
- package/packages/willa-content/src/components/Segmented/index.css +136 -0
- package/packages/willa-content/src/components/Segmented/index.tsx +283 -0
- package/packages/willa-content/src/components/SelectionBar/index.css +104 -0
- package/packages/willa-content/src/components/SelectionBar/index.tsx +120 -0
- package/packages/willa-content/src/components/Skeleton/index.css +68 -0
- package/packages/willa-content/src/components/Skeleton/index.tsx +126 -0
- package/packages/willa-content/src/components/SourceCard/index.css +177 -0
- package/packages/willa-content/src/components/SourceCard/index.tsx +108 -0
- package/packages/willa-content/src/components/Spinner/index.css +124 -0
- package/packages/willa-content/src/components/Spinner/index.tsx +55 -0
- package/packages/willa-content/src/components/Statistic/index.css +135 -0
- package/packages/willa-content/src/components/Statistic/index.tsx +90 -0
- package/packages/willa-content/src/components/Steps/index.css +167 -0
- package/packages/willa-content/src/components/Steps/index.tsx +170 -0
- package/packages/willa-content/src/components/Table/TableBody.tsx +389 -0
- package/packages/willa-content/src/components/Table/TableHeader.tsx +256 -0
- package/packages/willa-content/src/components/Table/TablePagination.tsx +46 -0
- package/packages/willa-content/src/components/Table/TableView.tsx +341 -0
- package/packages/willa-content/src/components/Table/columnState.ts +37 -0
- package/packages/willa-content/src/components/Table/columns.ts +63 -0
- package/packages/willa-content/src/components/Table/group.ts +114 -0
- package/packages/willa-content/src/components/Table/index.css +620 -0
- package/packages/willa-content/src/components/Table/index.tsx +100 -0
- package/packages/willa-content/src/components/Table/layout.ts +80 -0
- package/packages/willa-content/src/components/Table/tree.ts +28 -0
- package/packages/willa-content/src/components/Table/types.ts +177 -0
- package/packages/willa-content/src/components/Table/useTableColumnResize.ts +227 -0
- package/packages/willa-content/src/components/Table/useTableColumnState.ts +153 -0
- package/packages/willa-content/src/components/Table/useTableExpansion.ts +69 -0
- package/packages/willa-content/src/components/Table/useTableInfiniteScroll.ts +77 -0
- package/packages/willa-content/src/components/Table/useTableSelection.ts +102 -0
- package/packages/willa-content/src/components/Table/useTableState.ts +436 -0
- package/packages/willa-content/src/components/Table/useTableViewModel.ts +222 -0
- package/packages/willa-content/src/components/Table/utils.ts +251 -0
- package/packages/willa-content/src/components/Tabs/index.css +126 -0
- package/packages/willa-content/src/components/Tabs/index.tsx +154 -0
- package/packages/willa-content/src/components/Tag/index.css +171 -0
- package/packages/willa-content/src/components/Tag/index.tsx +91 -0
- package/packages/willa-content/src/components/Timeline/index.css +355 -0
- package/packages/willa-content/src/components/Timeline/index.tsx +153 -0
- package/packages/willa-content/src/components/Toast/index.css +226 -0
- package/packages/willa-content/src/components/Toast/index.tsx +280 -0
- package/packages/willa-content/src/components/Toolbar/index.css +59 -0
- package/packages/willa-content/src/components/Toolbar/index.tsx +73 -0
- package/packages/willa-content/src/components/Tooltip/index.css +83 -0
- package/packages/willa-content/src/components/Tooltip/index.tsx +265 -0
- package/packages/willa-content/src/components/Tour/index.css +312 -0
- package/packages/willa-content/src/components/Tour/index.tsx +788 -0
- package/packages/willa-content/src/components/Tree/index.css +274 -0
- package/packages/willa-content/src/components/Tree/index.tsx +564 -0
- package/packages/willa-content/src/components/Typography/TypographyActions.tsx +125 -0
- package/packages/willa-content/src/components/Typography/TypographyContent.tsx +406 -0
- package/packages/willa-content/src/components/Typography/TypographyEdit.tsx +161 -0
- package/packages/willa-content/src/components/Typography/index.css +575 -0
- package/packages/willa-content/src/components/Typography/index.tsx +145 -0
- package/packages/willa-content/src/components/Typography/types.ts +144 -0
- package/packages/willa-content/src/components/Typography/utils.tsx +192 -0
- package/packages/willa-content/src/components/Watermark/index.css +37 -0
- package/packages/willa-content/src/components/Watermark/index.tsx +294 -0
- package/packages/willa-content/src/index.ts +408 -0
- package/packages/willa-content/src/internal/buttonActionUtils.ts +46 -0
- package/packages/willa-content/src/internal/syntaxHighlight.css +82 -0
- package/packages/willa-content/src/internal/useSingleSelection.ts +80 -0
- package/packages/willa-content/src/themes/dark.css +777 -0
- package/packages/willa-content/src/themes/light.css +780 -0
- package/packages/willa-content/vitest.config.ts +15 -0
- package/packages/willa-form/README.md +33 -0
- package/packages/willa-form/auklet.config.mjs +24 -0
- package/packages/willa-form/package.json +85 -0
- package/packages/willa-form/src/components/Calendar/ScheduleCalendar.tsx +1036 -0
- package/packages/willa-form/src/components/Calendar/index.css +1081 -0
- package/packages/willa-form/src/components/Calendar/index.tsx +876 -0
- package/packages/willa-form/src/components/Calendar/utils.ts +67 -0
- package/packages/willa-form/src/components/Checkbox/index.css +133 -0
- package/packages/willa-form/src/components/Checkbox/index.tsx +104 -0
- package/packages/willa-form/src/components/ColorPicker/index.css +617 -0
- package/packages/willa-form/src/components/ColorPicker/index.tsx +724 -0
- package/packages/willa-form/src/components/ColorPicker/types.ts +21 -0
- package/packages/willa-form/src/components/DatePicker/index.css +395 -0
- package/packages/willa-form/src/components/DatePicker/index.tsx +631 -0
- package/packages/willa-form/src/components/FilterBar/index.css +122 -0
- package/packages/willa-form/src/components/FilterBar/index.tsx +98 -0
- package/packages/willa-form/src/components/Form/index.css +49 -0
- package/packages/willa-form/src/components/Form/index.tsx +50 -0
- package/packages/willa-form/src/components/FormActions/index.css +62 -0
- package/packages/willa-form/src/components/FormActions/index.tsx +44 -0
- package/packages/willa-form/src/components/FormField/index.css +71 -0
- package/packages/willa-form/src/components/FormField/index.tsx +85 -0
- package/packages/willa-form/src/components/FormGroup/index.css +62 -0
- package/packages/willa-form/src/components/FormGroup/index.tsx +64 -0
- package/packages/willa-form/src/components/FormMessage/index.css +77 -0
- package/packages/willa-form/src/components/FormMessage/index.tsx +57 -0
- package/packages/willa-form/src/components/Input/index.css +131 -0
- package/packages/willa-form/src/components/Input/index.tsx +116 -0
- package/packages/willa-form/src/components/NumberInput/index.css +315 -0
- package/packages/willa-form/src/components/NumberInput/index.tsx +567 -0
- package/packages/willa-form/src/components/Picker/index.css +323 -0
- package/packages/willa-form/src/components/Picker/index.tsx +359 -0
- package/packages/willa-form/src/components/Radio/index.css +131 -0
- package/packages/willa-form/src/components/Radio/index.tsx +70 -0
- package/packages/willa-form/src/components/RangeInput/index.css +224 -0
- package/packages/willa-form/src/components/RangeInput/index.tsx +288 -0
- package/packages/willa-form/src/components/Rate/index.css +97 -0
- package/packages/willa-form/src/components/Rate/index.tsx +378 -0
- package/packages/willa-form/src/components/SearchInput/index.css +32 -0
- package/packages/willa-form/src/components/SearchInput/index.tsx +101 -0
- package/packages/willa-form/src/components/Select/index.css +4 -0
- package/packages/willa-form/src/components/Select/index.tsx +79 -0
- package/packages/willa-form/src/components/Switch/index.css +133 -0
- package/packages/willa-form/src/components/Switch/index.tsx +75 -0
- package/packages/willa-form/src/components/TagInput/index.css +209 -0
- package/packages/willa-form/src/components/TagInput/index.tsx +497 -0
- package/packages/willa-form/src/components/TextArea/index.css +91 -0
- package/packages/willa-form/src/components/TextArea/index.tsx +87 -0
- package/packages/willa-form/src/components/TimePicker/index.css +485 -0
- package/packages/willa-form/src/components/TimePicker/index.tsx +649 -0
- package/packages/willa-form/src/components/TimePicker/types.ts +8 -0
- package/packages/willa-form/src/components/TreeSelect/index.css +331 -0
- package/packages/willa-form/src/components/TreeSelect/index.tsx +497 -0
- package/packages/willa-form/src/components/Upload/index.css +345 -0
- package/packages/willa-form/src/components/Upload/index.tsx +581 -0
- package/packages/willa-form/src/index.ts +176 -0
- package/packages/willa-form/src/internal/colorUtils.ts +206 -0
- package/packages/willa-form/src/internal/comboboxField.tsx +114 -0
- package/packages/willa-form/src/internal/floatingPanelParts.tsx +80 -0
- package/packages/willa-form/src/internal/selectablePanelKeyboard.ts +93 -0
- package/packages/willa-form/src/internal/selectablePanelParts.tsx +212 -0
- package/packages/willa-form/src/internal/timePickerParts.ts +205 -0
- package/packages/willa-form/src/internal/useComboboxState.ts +21 -0
- package/packages/willa-form/src/internal/useFloatingPanel.ts +114 -0
- package/packages/willa-form/src/internal/useSelectablePanel.ts +152 -0
- package/packages/willa-form/src/internal/useSelectionModel.ts +115 -0
- package/packages/willa-form/src/themes/dark.css +197 -0
- package/packages/willa-form/src/themes/light.css +201 -0
- package/packages/willa-form/vitest.config.ts +15 -0
- package/packages/willa-layout/README.md +33 -0
- package/packages/willa-layout/auklet.config.mjs +11 -0
- package/packages/willa-layout/package.json +83 -0
- package/packages/willa-layout/src/components/AppShell/index.css +100 -0
- package/packages/willa-layout/src/components/AppShell/index.tsx +70 -0
- package/packages/willa-layout/src/components/BorderBeam/index.css +86 -0
- package/packages/willa-layout/src/components/BorderBeam/index.tsx +161 -0
- package/packages/willa-layout/src/components/Card/index.css +179 -0
- package/packages/willa-layout/src/components/Card/index.tsx +174 -0
- package/packages/willa-layout/src/components/Container/index.css +55 -0
- package/packages/willa-layout/src/components/Container/index.tsx +43 -0
- package/packages/willa-layout/src/components/Grid/index.css +9 -0
- package/packages/willa-layout/src/components/Grid/index.tsx +100 -0
- package/packages/willa-layout/src/components/Group/index.css +21 -0
- package/packages/willa-layout/src/components/Group/index.tsx +146 -0
- package/packages/willa-layout/src/components/Masonry/index.css +12 -0
- package/packages/willa-layout/src/components/Masonry/index.tsx +71 -0
- package/packages/willa-layout/src/components/PageHeader/index.css +130 -0
- package/packages/willa-layout/src/components/PageHeader/index.tsx +76 -0
- package/packages/willa-layout/src/components/Panel/index.css +123 -0
- package/packages/willa-layout/src/components/Panel/index.tsx +63 -0
- package/packages/willa-layout/src/components/SectionHeader/index.css +104 -0
- package/packages/willa-layout/src/components/SectionHeader/index.tsx +69 -0
- package/packages/willa-layout/src/components/Separator/index.css +155 -0
- package/packages/willa-layout/src/components/Separator/index.tsx +61 -0
- package/packages/willa-layout/src/components/SidebarLayout/index.css +43 -0
- package/packages/willa-layout/src/components/SidebarLayout/index.tsx +73 -0
- package/packages/willa-layout/src/components/SplitPane/index.css +148 -0
- package/packages/willa-layout/src/components/SplitPane/index.tsx +434 -0
- package/packages/willa-layout/src/components/Stack/index.css +8 -0
- package/packages/willa-layout/src/components/Stack/index.tsx +99 -0
- package/packages/willa-layout/src/index.ts +91 -0
- package/packages/willa-layout/src/internal/headerBlock.tsx +49 -0
- package/packages/willa-layout/src/themes/dark.css +55 -0
- package/packages/willa-layout/src/themes/light.css +59 -0
- package/packages/willa-layout/vitest.config.ts +15 -0
- package/packages/willa-shared/README.md +24 -0
- package/packages/willa-shared/package.json +46 -0
- package/packages/willa-shared/src/clipboard.ts +23 -0
- package/packages/willa-shared/src/codeHighlight.ts +109 -0
- package/packages/willa-shared/src/controllableState.ts +42 -0
- package/packages/willa-shared/src/copy.ts +79 -0
- package/packages/willa-shared/src/css.ts +10 -0
- package/packages/willa-shared/src/dom.ts +12 -0
- package/packages/willa-shared/src/file.ts +214 -0
- package/packages/willa-shared/src/floating.ts +160 -0
- package/packages/willa-shared/src/floatingLayer.ts +310 -0
- package/packages/willa-shared/src/heading.ts +69 -0
- package/packages/willa-shared/src/index.ts +88 -0
- package/packages/willa-shared/src/media.ts +23 -0
- package/packages/willa-shared/src/nodes.ts +24 -0
- package/packages/willa-shared/src/number.ts +9 -0
- package/packages/willa-shared/src/refs.ts +16 -0
- package/packages/willa-shared/src/request.ts +46 -0
- package/packages/willa-shared/src/types.ts +27 -0
- package/packages/willa-shared/src/viewport.ts +12 -0
- package/packages/willa-shared/src/virtualScroll.ts +137 -0
- package/packages/willa-shared/vitest.config.ts +9 -0
- package/packages/willa-widgets/README.md +33 -0
- package/packages/willa-widgets/auklet.config.mjs +25 -0
- package/packages/willa-widgets/package.json +89 -0
- package/packages/willa-widgets/src/components/AudioEmbed/index.css +424 -0
- package/packages/willa-widgets/src/components/AudioEmbed/index.tsx +270 -0
- package/packages/willa-widgets/src/components/AudioLink/index.css +165 -0
- package/packages/willa-widgets/src/components/AudioLink/index.tsx +169 -0
- package/packages/willa-widgets/src/components/EnglishCards/Card.tsx +116 -0
- package/packages/willa-widgets/src/components/EnglishCards/Content.tsx +203 -0
- package/packages/willa-widgets/src/components/EnglishCards/Practice.tsx +91 -0
- package/packages/willa-widgets/src/components/EnglishCards/Resources.tsx +91 -0
- package/packages/willa-widgets/src/components/EnglishCards/index.css +531 -0
- package/packages/willa-widgets/src/components/EnglishCards/index.tsx +142 -0
- package/packages/willa-widgets/src/components/EnglishCards/speech.ts +29 -0
- package/packages/willa-widgets/src/components/EnglishCards/types.ts +43 -0
- package/packages/willa-widgets/src/components/GitHubMention/index.css +206 -0
- package/packages/willa-widgets/src/components/GitHubMention/index.tsx +168 -0
- package/packages/willa-widgets/src/components/GitHubRepo/index.css +194 -0
- package/packages/willa-widgets/src/components/GitHubRepo/index.tsx +172 -0
- package/packages/willa-widgets/src/components/LogoWall/index.css +122 -0
- package/packages/willa-widgets/src/components/LogoWall/index.tsx +104 -0
- package/packages/willa-widgets/src/components/Mdx/index.css +273 -0
- package/packages/willa-widgets/src/components/Mdx/index.tsx +377 -0
- package/packages/willa-widgets/src/components/Poem/index.css +101 -0
- package/packages/willa-widgets/src/components/Poem/index.tsx +74 -0
- package/packages/willa-widgets/src/components/ProfileCard/index.css +107 -0
- package/packages/willa-widgets/src/components/ProfileCard/index.tsx +116 -0
- package/packages/willa-widgets/src/components/QRCode/index.css +175 -0
- package/packages/willa-widgets/src/components/QRCode/index.tsx +257 -0
- package/packages/willa-widgets/src/components/SiteFooter/index.css +109 -0
- package/packages/willa-widgets/src/components/SiteFooter/index.tsx +104 -0
- package/packages/willa-widgets/src/components/SiteNav/index.css +93 -0
- package/packages/willa-widgets/src/components/SiteNav/index.tsx +71 -0
- package/packages/willa-widgets/src/components/VideoEmbed/index.css +230 -0
- package/packages/willa-widgets/src/components/VideoEmbed/index.tsx +134 -0
- package/packages/willa-widgets/src/components/VideoLink/index.css +118 -0
- package/packages/willa-widgets/src/components/VideoLink/index.tsx +161 -0
- package/packages/willa-widgets/src/components/WebEmbed/index.css +106 -0
- package/packages/willa-widgets/src/components/WebEmbed/index.tsx +98 -0
- package/packages/willa-widgets/src/components/XPostEmbed/index.css +52 -0
- package/packages/willa-widgets/src/components/XPostEmbed/index.tsx +88 -0
- package/packages/willa-widgets/src/index.ts +57 -0
- package/packages/willa-widgets/src/internal/media.ts +84 -0
- package/packages/willa-widgets/src/internal/mediaEmbed.tsx +52 -0
- package/packages/willa-widgets/src/internal/useGitHubHoverCardResource.ts +120 -0
- package/packages/willa-widgets/src/themes/dark.css +209 -0
- package/packages/willa-widgets/src/themes/light.css +207 -0
- package/packages/willa-widgets/vitest.config.ts +15 -0
- package/pnpm-workspace.yaml +29 -0
- package/tsconfig.json +50 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { Typography } from "willa/Typography";
|
|
3
|
+
import { Switch } from "willa/Switch";
|
|
4
|
+
import { Table, type TableItem } from "willa/Table";
|
|
5
|
+
import "willa/Typography.css";
|
|
6
|
+
import "willa/Switch.css";
|
|
7
|
+
import "willa/Table.css";
|
|
8
|
+
|
|
9
|
+
import { defineDoc } from "#example/catalog/defineDoc";
|
|
10
|
+
|
|
11
|
+
const typographyProseStyle = {
|
|
12
|
+
width: "100%",
|
|
13
|
+
maxWidth: "46rem",
|
|
14
|
+
marginInline: "auto",
|
|
15
|
+
display: "grid",
|
|
16
|
+
gap: "0.85rem",
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
const typographyReadingStyle = {
|
|
20
|
+
display: "grid",
|
|
21
|
+
gap: "0.45rem",
|
|
22
|
+
width: "100%",
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
const typographyNarrowProseStyle = {
|
|
26
|
+
width: "min(100%, 42rem)",
|
|
27
|
+
marginInline: "auto",
|
|
28
|
+
display: "grid",
|
|
29
|
+
gap: "0.85rem",
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
const typographyEditableStageStyle = {
|
|
33
|
+
width: "100%",
|
|
34
|
+
display: "grid",
|
|
35
|
+
gap: "0.85rem",
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
const typographyEditableHeaderStyle = {
|
|
39
|
+
display: "flex",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
justifyContent: "space-between",
|
|
42
|
+
gap: "1rem",
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
45
|
+
const longReleaseText =
|
|
46
|
+
"这是一段较长的说明文本,用于展示多行省略和展开行为。排版组件经常出现在组件文档、产品说明、活动日志和系统提示中,也会出现在知识库、更新记录、任务详情和搜索结果摘要里。当容器宽度有限时,正文需要先保留稳定的阅读节奏,只展示关键信息,再通过展开操作让用户继续阅读完整内容。";
|
|
47
|
+
|
|
48
|
+
const typographyMetaStyle = {
|
|
49
|
+
display: "flex",
|
|
50
|
+
flexWrap: "wrap",
|
|
51
|
+
gap: "0.38rem 0.75rem",
|
|
52
|
+
color: "var(--willa-text-soft)",
|
|
53
|
+
fontSize: "0.84rem",
|
|
54
|
+
lineHeight: 1.45,
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
const typographyEditableSummaryStyle = {
|
|
58
|
+
display: "grid",
|
|
59
|
+
gap: "0.3rem",
|
|
60
|
+
width: "100%",
|
|
61
|
+
maxWidth: "46rem",
|
|
62
|
+
marginInline: "auto",
|
|
63
|
+
} as const;
|
|
64
|
+
|
|
65
|
+
const typographyActionBlockStyle = {
|
|
66
|
+
display: "grid",
|
|
67
|
+
gap: "0.45rem",
|
|
68
|
+
width: "100%",
|
|
69
|
+
maxWidth: "46rem",
|
|
70
|
+
marginInline: "auto",
|
|
71
|
+
padding: "0.9rem 1rem",
|
|
72
|
+
border: "1px solid var(--willa-line)",
|
|
73
|
+
borderRadius: "0.55rem",
|
|
74
|
+
background: "var(--willa-surface-tint)",
|
|
75
|
+
} as const;
|
|
76
|
+
|
|
77
|
+
const typographyActionCodeStyle = {
|
|
78
|
+
margin: 0,
|
|
79
|
+
lineHeight: 1.45,
|
|
80
|
+
} as const;
|
|
81
|
+
|
|
82
|
+
const typographyColorTextStyle = {
|
|
83
|
+
margin: 0,
|
|
84
|
+
lineHeight: 1.85,
|
|
85
|
+
} as const;
|
|
86
|
+
|
|
87
|
+
const typographyTableItems: Array<TableItem> = [
|
|
88
|
+
{
|
|
89
|
+
key: "heading",
|
|
90
|
+
cells: [
|
|
91
|
+
{
|
|
92
|
+
key: "scene",
|
|
93
|
+
label: "场景",
|
|
94
|
+
value: "标题层级",
|
|
95
|
+
width: "11rem",
|
|
96
|
+
render: <Typography.Text strong>标题层级</Typography.Text>,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: "usage",
|
|
100
|
+
label: "推荐写法",
|
|
101
|
+
value: "Typography.Title level={2}",
|
|
102
|
+
render: (
|
|
103
|
+
<Typography.Text code>Typography.Title level={2}</Typography.Text>
|
|
104
|
+
),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: "note",
|
|
108
|
+
label: "说明",
|
|
109
|
+
value: "适合章节标题和文档页主标题。",
|
|
110
|
+
render: (
|
|
111
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
112
|
+
适合章节标题和文档页主标题。
|
|
113
|
+
</Typography.Paragraph>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
key: "body",
|
|
120
|
+
cells: [
|
|
121
|
+
{
|
|
122
|
+
key: "scene",
|
|
123
|
+
label: "场景",
|
|
124
|
+
value: "正文说明",
|
|
125
|
+
render: <Typography.Text strong>正文说明</Typography.Text>,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
key: "usage",
|
|
129
|
+
label: "推荐写法",
|
|
130
|
+
value: "Typography.Paragraph + Typography.Text",
|
|
131
|
+
render: (
|
|
132
|
+
<Typography.Text code>
|
|
133
|
+
Typography.Paragraph + Typography.Text
|
|
134
|
+
</Typography.Text>
|
|
135
|
+
),
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
key: "note",
|
|
139
|
+
label: "说明",
|
|
140
|
+
value: "适合把段落、强调、链接和辅助信息放在一行里。",
|
|
141
|
+
render: (
|
|
142
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
143
|
+
适合把段落、强调、链接和辅助信息放在一行里。
|
|
144
|
+
</Typography.Paragraph>
|
|
145
|
+
),
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "state",
|
|
151
|
+
cells: [
|
|
152
|
+
{
|
|
153
|
+
key: "scene",
|
|
154
|
+
label: "场景",
|
|
155
|
+
value: "状态提示",
|
|
156
|
+
render: <Typography.Text strong>状态提示</Typography.Text>,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
key: "usage",
|
|
160
|
+
label: "推荐写法",
|
|
161
|
+
value: 'Typography.Text type="warning"',
|
|
162
|
+
render: (
|
|
163
|
+
<Typography.Text code>Typography.Text type="warning"</Typography.Text>
|
|
164
|
+
),
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "note",
|
|
168
|
+
label: "说明",
|
|
169
|
+
value: "适合校验结果、风险提示和轻量说明。",
|
|
170
|
+
render: (
|
|
171
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
172
|
+
适合校验结果、风险提示和轻量说明。
|
|
173
|
+
</Typography.Paragraph>
|
|
174
|
+
),
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
const ControlledEllipsisDemo = () => {
|
|
181
|
+
const [expanded, setExpanded] = useState(false);
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<div style={typographyNarrowProseStyle}>
|
|
185
|
+
<div style={typographyMetaStyle}>
|
|
186
|
+
<span>知识库摘要</span>
|
|
187
|
+
<span>2026-06-17</span>
|
|
188
|
+
<span>阅读约 3 分钟</span>
|
|
189
|
+
</div>
|
|
190
|
+
<Typography.Paragraph
|
|
191
|
+
ellipsis={{
|
|
192
|
+
rows: 2,
|
|
193
|
+
expandable: "collapsible",
|
|
194
|
+
expanded,
|
|
195
|
+
tooltip: true,
|
|
196
|
+
suffix: "(摘要)",
|
|
197
|
+
onExpand: (_, info) => setExpanded(info.expanded),
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{longReleaseText}
|
|
201
|
+
</Typography.Paragraph>
|
|
202
|
+
</div>
|
|
203
|
+
);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const ControlledEditableDemo = () => {
|
|
207
|
+
const [editing, setEditing] = useState(true);
|
|
208
|
+
const [value, setValue] = useState(
|
|
209
|
+
"This is a design language for internal applications. It aims to keep interface details consistent across products and reduce unnecessary implementation differences.",
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<div style={typographyEditableStageStyle}>
|
|
214
|
+
<div style={typographyEditableHeaderStyle}>
|
|
215
|
+
<Switch
|
|
216
|
+
checked={editing}
|
|
217
|
+
label="编辑中"
|
|
218
|
+
size="sm"
|
|
219
|
+
onChange={(event) => setEditing(event.currentTarget.checked)}
|
|
220
|
+
/>
|
|
221
|
+
</div>
|
|
222
|
+
<Typography.Paragraph
|
|
223
|
+
copyable={{
|
|
224
|
+
text: value,
|
|
225
|
+
tooltips: ["复制文案", "已复制文案"],
|
|
226
|
+
}}
|
|
227
|
+
editable={{
|
|
228
|
+
editing,
|
|
229
|
+
text: value,
|
|
230
|
+
triggerType: ["icon", "text"],
|
|
231
|
+
autoSize: { minRows: 2, maxRows: 5 },
|
|
232
|
+
maxLength: 180,
|
|
233
|
+
onStart: () => setEditing(true),
|
|
234
|
+
onChange: (nextValue) => setValue(nextValue),
|
|
235
|
+
onCancel: () => setEditing(false),
|
|
236
|
+
onEnd: () => setEditing(false),
|
|
237
|
+
}}
|
|
238
|
+
>
|
|
239
|
+
{value}
|
|
240
|
+
</Typography.Paragraph>
|
|
241
|
+
</div>
|
|
242
|
+
);
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const TypographyPreview = () => {
|
|
246
|
+
return (
|
|
247
|
+
<div style={typographyProseStyle}>
|
|
248
|
+
<Typography>
|
|
249
|
+
<Typography.Title level={2}>基础正文</Typography.Title>
|
|
250
|
+
<Typography.Paragraph>
|
|
251
|
+
普通段落、<Typography.Text code>inline code</Typography.Text>、
|
|
252
|
+
<Typography.Link href="https://imtaotao.me/blog/demo" target="_blank">
|
|
253
|
+
站外链接
|
|
254
|
+
</Typography.Link>{" "}
|
|
255
|
+
都应该自然工作。
|
|
256
|
+
加粗字体应该正常显示,不要让读者感觉像是在看一套拼装出来的系统文案。
|
|
257
|
+
</Typography.Paragraph>
|
|
258
|
+
<Typography.Paragraph>
|
|
259
|
+
推荐用更短的写法:
|
|
260
|
+
<Typography.Text type="success">这是一段绿色文字</Typography.Text>,
|
|
261
|
+
正文里直接用预设颜色名就行。
|
|
262
|
+
<Typography.Text type="secondary">
|
|
263
|
+
辅助说明可以更轻一点
|
|
264
|
+
</Typography.Text>
|
|
265
|
+
,但不要弱到看不清。
|
|
266
|
+
</Typography.Paragraph>
|
|
267
|
+
<Typography.Paragraph style={typographyReadingStyle}>
|
|
268
|
+
<Typography.Text strong>基础正文</Typography.Text>
|
|
269
|
+
各部分应该保持自然,不要一眼看出是不同系统拼起来的。
|
|
270
|
+
</Typography.Paragraph>
|
|
271
|
+
<Typography.Paragraph style={typographyReadingStyle}>
|
|
272
|
+
<Typography.Text strong>1.1 颜色示例</Typography.Text>
|
|
273
|
+
推荐用短句承接语义色,避免大段说明把颜色本身的作用冲淡。
|
|
274
|
+
</Typography.Paragraph>
|
|
275
|
+
</Typography>
|
|
276
|
+
</div>
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export default defineDoc({
|
|
281
|
+
id: "typography",
|
|
282
|
+
name: "Typography",
|
|
283
|
+
packageName: "willa/Typography",
|
|
284
|
+
description: "用于标题、段落、行内文本、链接和常见文本操作的排版组件。",
|
|
285
|
+
imports: [{ name: "Typography", from: "willa/Typography" }],
|
|
286
|
+
css: "willa/Typography.css",
|
|
287
|
+
demo: {
|
|
288
|
+
name: "TypographyPreview",
|
|
289
|
+
component: TypographyPreview,
|
|
290
|
+
},
|
|
291
|
+
code: `
|
|
292
|
+
import { Typography } from "willa/Typography";
|
|
293
|
+
import "willa/Typography.css";
|
|
294
|
+
|
|
295
|
+
<Typography>
|
|
296
|
+
<Typography.Title level={2}>基础正文</Typography.Title>
|
|
297
|
+
<Typography.Paragraph>
|
|
298
|
+
普通段落、<Typography.Text code>inline code</Typography.Text>、
|
|
299
|
+
<Typography.Link href="https://imtaotao.me/blog/demo" target="_blank">
|
|
300
|
+
站外链接
|
|
301
|
+
</Typography.Link>{" "}
|
|
302
|
+
都应该自然工作。
|
|
303
|
+
</Typography.Paragraph>
|
|
304
|
+
<Typography.Paragraph>
|
|
305
|
+
推荐用更短的写法:<Typography.Text type="success">这是一段绿色文字</Typography.Text>,
|
|
306
|
+
正文里直接用预设颜色名就行。
|
|
307
|
+
</Typography.Paragraph>
|
|
308
|
+
</Typography>;
|
|
309
|
+
`,
|
|
310
|
+
propGroups: [
|
|
311
|
+
{
|
|
312
|
+
title: "Typography",
|
|
313
|
+
description:
|
|
314
|
+
"外层排版容器,用于统一正文、标题、段落和链接的阅读节奏,并提供 root/content/actions/action/textarea 语义槽位。",
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
title: "Semantic DOM",
|
|
318
|
+
description:
|
|
319
|
+
"Typography.classNames 和 Typography.styles 支持 root、content、actions、action 和 textarea,用来按语义槽位定制样式。",
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
title: "Typography.Text / Typography.Paragraph",
|
|
323
|
+
description:
|
|
324
|
+
"Text 和 Paragraph 共享文本语义、强调、复制、编辑和省略能力;Paragraph 渲染为段落,Text 用于行内内容。",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
title: "Typography.Title",
|
|
328
|
+
description:
|
|
329
|
+
"标题子组件复用文本能力,并通过 level 控制 h1 到 h5 的层级。",
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
title: "Typography.Link",
|
|
333
|
+
description:
|
|
334
|
+
"链接子组件复用文本能力,同时支持 href、target、rel 等链接属性。",
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
title: "Typography.copyable",
|
|
338
|
+
description:
|
|
339
|
+
"copyable 是 Text、Paragraph、Title 和 Link 的复制配置对象,用于自定义复制文本、图标、提示和回调。",
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
title: "Typography.editable",
|
|
343
|
+
description:
|
|
344
|
+
"editable 是文本编辑配置对象,用于控制触发方式、编辑态、自动高度、长度限制和编辑回调。",
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
title: "Typography.ellipsis",
|
|
348
|
+
description:
|
|
349
|
+
"ellipsis 是省略配置对象,用于多行截断、展开收起、后缀、提示和省略状态回调。",
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
sections: [
|
|
353
|
+
{
|
|
354
|
+
title: "标题层级",
|
|
355
|
+
code: `
|
|
356
|
+
<Typography>
|
|
357
|
+
<Typography.Title level={1}>一级标题</Typography.Title>
|
|
358
|
+
<Typography.Title level={2}>二级标题</Typography.Title>
|
|
359
|
+
<Typography.Title level={3}>三级标题</Typography.Title>
|
|
360
|
+
<Typography.Title level={4}>四级标题</Typography.Title>
|
|
361
|
+
<Typography.Title level={5}>五级标题</Typography.Title>
|
|
362
|
+
</Typography>;
|
|
363
|
+
`,
|
|
364
|
+
content: (
|
|
365
|
+
<div style={typographyProseStyle}>
|
|
366
|
+
<Typography>
|
|
367
|
+
<Typography.Title level={1}>一级标题</Typography.Title>
|
|
368
|
+
<Typography.Paragraph type="secondary">
|
|
369
|
+
适合页面主标题或长文档入口,用于建立清晰的信息层级。
|
|
370
|
+
</Typography.Paragraph>
|
|
371
|
+
<Typography.Title level={2}>二级标题</Typography.Title>
|
|
372
|
+
<Typography.Paragraph type="secondary">
|
|
373
|
+
适合主要章节标题,通常承接一组内容区域。
|
|
374
|
+
</Typography.Paragraph>
|
|
375
|
+
<Typography.Title level={3}>三级标题</Typography.Title>
|
|
376
|
+
<Typography.Title level={4}>四级标题</Typography.Title>
|
|
377
|
+
<Typography.Title level={5}>五级标题</Typography.Title>
|
|
378
|
+
</Typography>
|
|
379
|
+
</div>
|
|
380
|
+
),
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
title: "文本样式",
|
|
384
|
+
code: `
|
|
385
|
+
<Typography>
|
|
386
|
+
<Typography.Paragraph>
|
|
387
|
+
<Typography.Text>默认文本</Typography.Text>{" "}
|
|
388
|
+
<Typography.Text type="secondary">辅助文本</Typography.Text>{" "}
|
|
389
|
+
<Typography.Text type="success">成功文本</Typography.Text>{" "}
|
|
390
|
+
<Typography.Text type="warning">警告文本</Typography.Text>{" "}
|
|
391
|
+
<Typography.Text type="danger">危险文本</Typography.Text>
|
|
392
|
+
</Typography.Paragraph>
|
|
393
|
+
<Typography.Paragraph>
|
|
394
|
+
<Typography.Text strong>加粗</Typography.Text>{" "}
|
|
395
|
+
<Typography.Text italic>斜体</Typography.Text>{" "}
|
|
396
|
+
<Typography.Text underline>下划线</Typography.Text>{" "}
|
|
397
|
+
<Typography.Text delete>删除线</Typography.Text>{" "}
|
|
398
|
+
<Typography.Text mark>标记</Typography.Text>{" "}
|
|
399
|
+
<Typography.Text code>code</Typography.Text>{" "}
|
|
400
|
+
<Typography.Text keyboard>⌘K</Typography.Text>
|
|
401
|
+
</Typography.Paragraph>
|
|
402
|
+
</Typography>;
|
|
403
|
+
`,
|
|
404
|
+
content: (
|
|
405
|
+
<div style={typographyProseStyle}>
|
|
406
|
+
<Typography>
|
|
407
|
+
<Typography.Paragraph>
|
|
408
|
+
<Typography.Text>默认文本</Typography.Text>{" "}
|
|
409
|
+
<Typography.Text type="secondary">辅助文本</Typography.Text>{" "}
|
|
410
|
+
<Typography.Text type="success">成功文本</Typography.Text>{" "}
|
|
411
|
+
<Typography.Text type="warning">警告文本</Typography.Text>{" "}
|
|
412
|
+
<Typography.Text type="danger">危险文本</Typography.Text>
|
|
413
|
+
</Typography.Paragraph>
|
|
414
|
+
<Typography.Paragraph>
|
|
415
|
+
<Typography.Text strong>加粗</Typography.Text>{" "}
|
|
416
|
+
<Typography.Text italic>斜体</Typography.Text>{" "}
|
|
417
|
+
<Typography.Text underline>下划线</Typography.Text>{" "}
|
|
418
|
+
<Typography.Text delete>删除线</Typography.Text>{" "}
|
|
419
|
+
<Typography.Text mark>标记</Typography.Text>{" "}
|
|
420
|
+
<Typography.Text code>code</Typography.Text>{" "}
|
|
421
|
+
<Typography.Text keyboard>⌘K</Typography.Text>
|
|
422
|
+
</Typography.Paragraph>
|
|
423
|
+
<Typography.Paragraph type="secondary">
|
|
424
|
+
这些样式更适合嵌入正文,而不是单独放进展示卡里。
|
|
425
|
+
</Typography.Paragraph>
|
|
426
|
+
</Typography>
|
|
427
|
+
</div>
|
|
428
|
+
),
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
title: "语义颜色",
|
|
432
|
+
code: `
|
|
433
|
+
<Typography>
|
|
434
|
+
<Typography.Paragraph>
|
|
435
|
+
<Typography.Text>默认文本</Typography.Text>{" "}
|
|
436
|
+
<Typography.Text type="secondary">辅助文本</Typography.Text>{" "}
|
|
437
|
+
<Typography.Text type="success">成功文本</Typography.Text>{" "}
|
|
438
|
+
<Typography.Text type="warning">警告文本</Typography.Text>{" "}
|
|
439
|
+
<Typography.Text type="danger">危险文本</Typography.Text>
|
|
440
|
+
</Typography.Paragraph>
|
|
441
|
+
<Typography.Paragraph>
|
|
442
|
+
发布状态、校验提示和系统反馈都可以直接复用这些语义色。
|
|
443
|
+
</Typography.Paragraph>
|
|
444
|
+
</Typography>;
|
|
445
|
+
`,
|
|
446
|
+
content: (
|
|
447
|
+
<div style={typographyProseStyle}>
|
|
448
|
+
<Typography>
|
|
449
|
+
<Typography.Title level={2}>语义颜色</Typography.Title>
|
|
450
|
+
<Typography.Paragraph type="secondary">
|
|
451
|
+
这一组颜色更像你博客正文里的状态说明,而不是单纯的色块展示。
|
|
452
|
+
它们负责把信息权重、语气和操作风险讲清楚。
|
|
453
|
+
</Typography.Paragraph>
|
|
454
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
455
|
+
<Typography.Text strong>默认文本:</Typography.Text>
|
|
456
|
+
正文是主要信息载体, 应该保持稳定、克制和可长时间阅读。
|
|
457
|
+
</Typography.Paragraph>
|
|
458
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
459
|
+
<Typography.Text strong>辅助文本:</Typography.Text>
|
|
460
|
+
适合元信息、说明和次级标签, 用来承接不需要抢视线的内容。
|
|
461
|
+
</Typography.Paragraph>
|
|
462
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
463
|
+
<Typography.Text type="success">发布成功</Typography.Text>
|
|
464
|
+
,文档已同步到线上站点并可立即访问。
|
|
465
|
+
</Typography.Paragraph>
|
|
466
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
467
|
+
<Typography.Text type="warning">内容待确认</Typography.Text>
|
|
468
|
+
,这类提示需要读者注意, 但通常还不需要中断流程。
|
|
469
|
+
</Typography.Paragraph>
|
|
470
|
+
<Typography.Paragraph style={typographyColorTextStyle}>
|
|
471
|
+
<Typography.Text type="danger">删除不可恢复</Typography.Text>
|
|
472
|
+
,需要把后果讲清楚, 再让用户继续下一步操作。
|
|
473
|
+
</Typography.Paragraph>
|
|
474
|
+
</Typography>
|
|
475
|
+
</div>
|
|
476
|
+
),
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
title: "表格中的排版",
|
|
480
|
+
code: `
|
|
481
|
+
import { Typography } from "willa/Typography";
|
|
482
|
+
import { Table } from "willa/Table";
|
|
483
|
+
import "willa/Typography.css";
|
|
484
|
+
import "willa/Table.css";
|
|
485
|
+
|
|
486
|
+
<Table
|
|
487
|
+
caption="Typography 在表格中的用法"
|
|
488
|
+
items={[
|
|
489
|
+
{
|
|
490
|
+
key: "heading",
|
|
491
|
+
cells: [
|
|
492
|
+
{
|
|
493
|
+
label: "场景",
|
|
494
|
+
value: "标题层级",
|
|
495
|
+
render: <Typography.Text strong>标题层级</Typography.Text>,
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
label: "推荐写法",
|
|
499
|
+
value: "Typography.Title level={2}",
|
|
500
|
+
render: (
|
|
501
|
+
<Typography.Text code>
|
|
502
|
+
Typography.Title level={2}
|
|
503
|
+
</Typography.Text>
|
|
504
|
+
),
|
|
505
|
+
},
|
|
506
|
+
],
|
|
507
|
+
},
|
|
508
|
+
]}
|
|
509
|
+
/>;
|
|
510
|
+
`,
|
|
511
|
+
content: (
|
|
512
|
+
<div style={typographyProseStyle}>
|
|
513
|
+
<Typography>
|
|
514
|
+
<Typography.Title level={2}>表格中的排版</Typography.Title>
|
|
515
|
+
<Typography.Paragraph type="secondary">
|
|
516
|
+
结构化信息更适合放在表格里展示,Typography
|
|
517
|
+
负责把标题、正文和说明文案维持在同一套阅读节奏里。
|
|
518
|
+
</Typography.Paragraph>
|
|
519
|
+
</Typography>
|
|
520
|
+
<Table
|
|
521
|
+
caption="Typography 在表格中的用法"
|
|
522
|
+
footer="表格单元格里也可以继续复用 Typography 来保持正文、代码和提示的统一风格。"
|
|
523
|
+
items={typographyTableItems}
|
|
524
|
+
/>
|
|
525
|
+
</div>
|
|
526
|
+
),
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
title: "链接与操作",
|
|
530
|
+
code: `
|
|
531
|
+
import { Typography } from "willa/Typography";
|
|
532
|
+
import "willa/Typography.css";
|
|
533
|
+
|
|
534
|
+
<Typography>
|
|
535
|
+
<Typography.Paragraph>
|
|
536
|
+
查看 <Typography.Link href="#typography">排版组件说明</Typography.Link>{" "}
|
|
537
|
+
可以定位到当前文档中的组件说明。
|
|
538
|
+
</Typography.Paragraph>
|
|
539
|
+
<Typography.Text
|
|
540
|
+
code
|
|
541
|
+
copyable={{
|
|
542
|
+
text: "release: typography-ready",
|
|
543
|
+
tooltips: ["复制发布标记", "已复制发布标记"],
|
|
544
|
+
}}
|
|
545
|
+
>
|
|
546
|
+
release: typography-ready
|
|
547
|
+
</Typography.Text>
|
|
548
|
+
</Typography>;
|
|
549
|
+
`,
|
|
550
|
+
content: (
|
|
551
|
+
<div style={typographyProseStyle}>
|
|
552
|
+
<Typography>
|
|
553
|
+
<Typography.Paragraph>
|
|
554
|
+
查看{" "}
|
|
555
|
+
<Typography.Link href="#typography">排版组件说明</Typography.Link>{" "}
|
|
556
|
+
可以定位到当前文档中的组件说明。
|
|
557
|
+
</Typography.Paragraph>
|
|
558
|
+
<div style={typographyActionBlockStyle}>
|
|
559
|
+
<Typography.Text
|
|
560
|
+
code
|
|
561
|
+
copyable={{
|
|
562
|
+
text: "release: typography-ready",
|
|
563
|
+
tooltips: ["复制发布标记", "已复制发布标记"],
|
|
564
|
+
}}
|
|
565
|
+
style={typographyActionCodeStyle}
|
|
566
|
+
>
|
|
567
|
+
release: typography-ready
|
|
568
|
+
</Typography.Text>
|
|
569
|
+
<Typography.Paragraph type="secondary">
|
|
570
|
+
复制操作直接复用{" "}
|
|
571
|
+
<Typography.Text code>Typography.Text</Typography.Text> 的{" "}
|
|
572
|
+
<Typography.Text code>copyable</Typography.Text>,内部动作层
|
|
573
|
+
统一使用 <Typography.Text code>IconButton</Typography.Text> 和{" "}
|
|
574
|
+
<Typography.Text code>Tooltip</Typography.Text>。
|
|
575
|
+
</Typography.Paragraph>
|
|
576
|
+
</div>
|
|
577
|
+
</Typography>
|
|
578
|
+
</div>
|
|
579
|
+
),
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
title: "可编辑",
|
|
583
|
+
code: `
|
|
584
|
+
import { useState } from "react";
|
|
585
|
+
import { Switch } from "willa/Switch";
|
|
586
|
+
|
|
587
|
+
const [editing, setEditing] = useState(true);
|
|
588
|
+
const [value, setValue] = useState("This is a design language ...");
|
|
589
|
+
|
|
590
|
+
<>
|
|
591
|
+
<Switch
|
|
592
|
+
checked={editing}
|
|
593
|
+
label="Editing"
|
|
594
|
+
size="sm"
|
|
595
|
+
onChange={(event) => setEditing(event.currentTarget.checked)}
|
|
596
|
+
/>
|
|
597
|
+
<Typography.Paragraph
|
|
598
|
+
copyable={{
|
|
599
|
+
text: value,
|
|
600
|
+
tooltips: ["复制文案", "已复制文案"],
|
|
601
|
+
}}
|
|
602
|
+
editable={{
|
|
603
|
+
editing,
|
|
604
|
+
text: value,
|
|
605
|
+
triggerType: ["icon", "text"],
|
|
606
|
+
autoSize: { minRows: 2, maxRows: 5 },
|
|
607
|
+
maxLength: 180,
|
|
608
|
+
onStart: () => setEditing(true),
|
|
609
|
+
onChange: (nextValue) => setValue(nextValue),
|
|
610
|
+
onCancel: () => setEditing(false),
|
|
611
|
+
onEnd: () => setEditing(false),
|
|
612
|
+
}}
|
|
613
|
+
>
|
|
614
|
+
{value}
|
|
615
|
+
</Typography.Paragraph>
|
|
616
|
+
</>;
|
|
617
|
+
`,
|
|
618
|
+
content: (
|
|
619
|
+
<div style={typographyEditableSummaryStyle}>
|
|
620
|
+
<Typography.Paragraph type="secondary">
|
|
621
|
+
点击文本或编辑图标可以进入编辑态;右上角的开关用于演示受控编辑状态。
|
|
622
|
+
</Typography.Paragraph>
|
|
623
|
+
<ControlledEditableDemo />
|
|
624
|
+
</div>
|
|
625
|
+
),
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
title: "子组件",
|
|
629
|
+
code: `
|
|
630
|
+
<Typography>
|
|
631
|
+
<Typography.Title level={4}>
|
|
632
|
+
<Typography.Text>Typography.Title</Typography.Text>
|
|
633
|
+
</Typography.Title>
|
|
634
|
+
<Typography.Paragraph>
|
|
635
|
+
<Typography.Text code>Typography.Paragraph</Typography.Text> 用于正文段落,
|
|
636
|
+
<Typography.Text code>Typography.Text</Typography.Text> 用于{" "}
|
|
637
|
+
<Typography.Text strong>行内强调</Typography.Text>,
|
|
638
|
+
<Typography.Text code>Typography.Link</Typography.Text> 用于文档内跳转或外部链接。
|
|
639
|
+
</Typography.Paragraph>
|
|
640
|
+
</Typography>;
|
|
641
|
+
`,
|
|
642
|
+
content: (
|
|
643
|
+
<div style={typographyProseStyle}>
|
|
644
|
+
<Typography>
|
|
645
|
+
<Typography.Title level={4}>
|
|
646
|
+
<Typography.Text>Typography.Title</Typography.Text>
|
|
647
|
+
</Typography.Title>
|
|
648
|
+
<Typography.Paragraph>
|
|
649
|
+
<Typography.Text code>Typography.Paragraph</Typography.Text>{" "}
|
|
650
|
+
用于正文段落,
|
|
651
|
+
<Typography.Text code>Typography.Text</Typography.Text> 用于{" "}
|
|
652
|
+
<Typography.Text strong>行内强调</Typography.Text>,
|
|
653
|
+
<Typography.Text code>Typography.Link</Typography.Text>{" "}
|
|
654
|
+
用于文档内跳转或外部链接。
|
|
655
|
+
</Typography.Paragraph>
|
|
656
|
+
</Typography>
|
|
657
|
+
</div>
|
|
658
|
+
),
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
title: "省略与展开",
|
|
662
|
+
code: `
|
|
663
|
+
<Typography.Paragraph
|
|
664
|
+
ellipsis={{
|
|
665
|
+
rows: 2,
|
|
666
|
+
expandable: "collapsible",
|
|
667
|
+
tooltip: true,
|
|
668
|
+
suffix: "(摘要)",
|
|
669
|
+
}}
|
|
670
|
+
>
|
|
671
|
+
${longReleaseText}
|
|
672
|
+
</Typography.Paragraph>;
|
|
673
|
+
`,
|
|
674
|
+
content: <ControlledEllipsisDemo />,
|
|
675
|
+
},
|
|
676
|
+
],
|
|
677
|
+
props: [
|
|
678
|
+
{
|
|
679
|
+
name: "Typography.children",
|
|
680
|
+
type: "ReactNode",
|
|
681
|
+
group: "Typography",
|
|
682
|
+
description: "排版内容容器,通常包裹 Title、Paragraph、Text 和 Link。",
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
name: "Typography.className",
|
|
686
|
+
type: "string",
|
|
687
|
+
group: "Typography",
|
|
688
|
+
description: "可选的外层 className。",
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
name: "Typography.classNames",
|
|
692
|
+
type: 'Partial<Record<"root" | "content" | "actions" | "action" | "textarea", string>>',
|
|
693
|
+
group: "Typography",
|
|
694
|
+
description:
|
|
695
|
+
"语义化 className 槽位,用于精确定制根节点、内容区、操作区、操作按钮和编辑文本域。",
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
name: "Typography.styles",
|
|
699
|
+
type: 'Partial<Record<"root" | "content" | "actions" | "action" | "textarea", CSSProperties>>',
|
|
700
|
+
group: "Typography",
|
|
701
|
+
description: "语义化 style 槽位,用于按区域覆盖样式。",
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "Typography.Text.children",
|
|
705
|
+
type: "ReactNode",
|
|
706
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
707
|
+
description: "文本内容。",
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: "Typography.Text.type",
|
|
711
|
+
type: '"secondary" | "success" | "warning" | "danger"',
|
|
712
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
713
|
+
description: "文本语义色。",
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
name: "Typography.Text.strong / italic / underline / delete",
|
|
717
|
+
type: "boolean",
|
|
718
|
+
defaultValue: "false",
|
|
719
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
720
|
+
description: "常见文本强调样式。",
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
name: "Typography.Text.code / mark / keyboard",
|
|
724
|
+
type: "boolean",
|
|
725
|
+
defaultValue: "false",
|
|
726
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
727
|
+
description:
|
|
728
|
+
"代码、标记和键盘输入样式;keyboard 内部复用 Kbd 的展示结构。",
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "Typography.Text.copyable",
|
|
732
|
+
type: "boolean | TypographyCopyable",
|
|
733
|
+
defaultValue: "false",
|
|
734
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
735
|
+
description: "展示复制操作;未传 text 时会复制 children 的纯文本。",
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
name: "Typography.Text.editable",
|
|
739
|
+
type: "boolean | TypographyEditable",
|
|
740
|
+
defaultValue: "false",
|
|
741
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
742
|
+
description:
|
|
743
|
+
"展示编辑操作,支持图标触发、文本触发、受控编辑态和编辑回调。",
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
name: "Typography.Text.ellipsis",
|
|
747
|
+
type: "boolean | TypographyEllipsis",
|
|
748
|
+
defaultValue: "false",
|
|
749
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
750
|
+
description: "文本省略配置,支持多行和展开收起。",
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
name: "Typography.Text.actions",
|
|
754
|
+
type: '{ placement?: "start" | "end" }',
|
|
755
|
+
defaultValue: '{ placement: "end" }',
|
|
756
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
757
|
+
description: "复制、编辑、省略展开等操作相对文本的位置。",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "Typography.Text.disabled",
|
|
761
|
+
type: "boolean",
|
|
762
|
+
defaultValue: "false",
|
|
763
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
764
|
+
description: "禁用文本样式。",
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: "Typography.Text.classNames",
|
|
768
|
+
type: 'Partial<Record<"root" | "content" | "actions" | "action" | "textarea", string>>',
|
|
769
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
770
|
+
description:
|
|
771
|
+
"语义化 className 槽位,适用于 Text、Paragraph、Title 和 Link。",
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
name: "Typography.Text.styles",
|
|
775
|
+
type: 'Partial<Record<"root" | "content" | "actions" | "action" | "textarea", CSSProperties>>',
|
|
776
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
777
|
+
description: "语义化 style 槽位,适用于 Text、Paragraph、Title 和 Link。",
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
name: "Typography.Paragraph",
|
|
781
|
+
type: "TypographyTextProps & HTMLAttributes<HTMLParagraphElement>",
|
|
782
|
+
group: "Typography.Text / Typography.Paragraph",
|
|
783
|
+
description:
|
|
784
|
+
"Paragraph 复用 Text 的语义、强调、复制和省略属性,并渲染为段落。",
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
name: "Typography.Title.level",
|
|
788
|
+
type: "1 | 2 | 3 | 4 | 5",
|
|
789
|
+
defaultValue: "1",
|
|
790
|
+
group: "Typography.Title",
|
|
791
|
+
description: "Typography.Title 的标题层级。",
|
|
792
|
+
},
|
|
793
|
+
{
|
|
794
|
+
name: "Typography.Title",
|
|
795
|
+
type: "TypographyTextProps & HTMLAttributes<HTMLHeadingElement>",
|
|
796
|
+
group: "Typography.Title",
|
|
797
|
+
description:
|
|
798
|
+
"Title 复用 Text 的语义、强调、复制和省略属性,并根据 level 渲染 h1 到 h5。",
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
name: "Typography.Link.href",
|
|
802
|
+
type: "string",
|
|
803
|
+
group: "Typography.Link",
|
|
804
|
+
description: "链接地址。",
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: "Typography.Link",
|
|
808
|
+
type: "TypographyTextProps & AnchorHTMLAttributes<HTMLAnchorElement>",
|
|
809
|
+
group: "Typography.Link",
|
|
810
|
+
description:
|
|
811
|
+
"Link 复用 Text 的语义、强调、复制和禁用属性,并额外支持 a 标签属性。",
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
name: "copyable.text",
|
|
815
|
+
type: "string | () => string | Promise<string>",
|
|
816
|
+
group: "Typography.copyable",
|
|
817
|
+
description: "复制到剪贴板的文本;未设置时复制 children 的纯文本。",
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: "copyable.icon",
|
|
821
|
+
type: "ReactNode | [ReactNode, ReactNode]",
|
|
822
|
+
group: "Typography.copyable",
|
|
823
|
+
description: "复制按钮图标;数组形式分别表示复制前和复制后。",
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: "copyable.tooltips",
|
|
827
|
+
type: "false | [ReactNode, ReactNode]",
|
|
828
|
+
group: "Typography.copyable",
|
|
829
|
+
description: "复制按钮的提示文案;传 false 时不展示提示。",
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: "copyable.copiedDuration",
|
|
833
|
+
type: "number",
|
|
834
|
+
defaultValue: "1200",
|
|
835
|
+
group: "Typography.copyable",
|
|
836
|
+
description: "复制成功状态保持时间。",
|
|
837
|
+
},
|
|
838
|
+
{
|
|
839
|
+
name: "copyable.onCopy",
|
|
840
|
+
type: "(text: string) => void",
|
|
841
|
+
group: "Typography.copyable",
|
|
842
|
+
description: "复制成功后的回调。",
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
name: "editable.text",
|
|
846
|
+
type: "string",
|
|
847
|
+
group: "Typography.editable",
|
|
848
|
+
description: "进入编辑态时使用的文本;未设置时读取 children 的纯文本。",
|
|
849
|
+
},
|
|
850
|
+
{
|
|
851
|
+
name: "editable.editing",
|
|
852
|
+
type: "boolean",
|
|
853
|
+
group: "Typography.editable",
|
|
854
|
+
description: "受控编辑态。",
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
name: "editable.defaultEditing",
|
|
858
|
+
type: "boolean",
|
|
859
|
+
defaultValue: "false",
|
|
860
|
+
group: "Typography.editable",
|
|
861
|
+
description: "默认是否进入编辑态。",
|
|
862
|
+
},
|
|
863
|
+
{
|
|
864
|
+
name: "editable.triggerType",
|
|
865
|
+
type: 'Array<"icon" | "text">',
|
|
866
|
+
defaultValue: '["icon"]',
|
|
867
|
+
group: "Typography.editable",
|
|
868
|
+
description: "进入编辑态的触发方式。",
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
name: "editable.autoSize",
|
|
872
|
+
type: "boolean | { minRows?: number; maxRows?: number }",
|
|
873
|
+
group: "Typography.editable",
|
|
874
|
+
description: "编辑文本域是否随内容自动调整高度。",
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
name: "editable.maxLength",
|
|
878
|
+
type: "number",
|
|
879
|
+
group: "Typography.editable",
|
|
880
|
+
description: "编辑内容最大长度。",
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
name: "editable.onChange / onCancel / onStart / onEnd",
|
|
884
|
+
type: "function",
|
|
885
|
+
group: "Typography.editable",
|
|
886
|
+
description: "编辑过程回调。",
|
|
887
|
+
},
|
|
888
|
+
{
|
|
889
|
+
name: "ellipsis.rows",
|
|
890
|
+
type: "number",
|
|
891
|
+
defaultValue: "1",
|
|
892
|
+
group: "Typography.ellipsis",
|
|
893
|
+
description: "最多展示的行数。",
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
name: "ellipsis.expandable",
|
|
897
|
+
type: 'boolean | "collapsible"',
|
|
898
|
+
defaultValue: "false",
|
|
899
|
+
group: "Typography.ellipsis",
|
|
900
|
+
description: "是否展示展开操作;collapsible 支持展开后收起。",
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
name: "ellipsis.expanded / defaultExpanded",
|
|
904
|
+
type: "boolean",
|
|
905
|
+
group: "Typography.ellipsis",
|
|
906
|
+
description: "受控或非受控展开状态。",
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
name: "ellipsis.suffix",
|
|
910
|
+
type: "ReactNode",
|
|
911
|
+
group: "Typography.ellipsis",
|
|
912
|
+
description: "省略内容后缀。",
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
name: "ellipsis.symbol",
|
|
916
|
+
type: "ReactNode | ((expanded: boolean) => ReactNode)",
|
|
917
|
+
group: "Typography.ellipsis",
|
|
918
|
+
description: "自定义展开/收起文案。",
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: "ellipsis.tooltip",
|
|
922
|
+
type: "boolean | ReactNode",
|
|
923
|
+
group: "Typography.ellipsis",
|
|
924
|
+
description: "省略时展示完整内容提示;true 时使用纯文本内容。",
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: "ellipsis.onEllipsis / onExpand",
|
|
928
|
+
type: "function",
|
|
929
|
+
group: "Typography.ellipsis",
|
|
930
|
+
description: "省略状态变化和展开状态变化回调。",
|
|
931
|
+
},
|
|
932
|
+
{
|
|
933
|
+
name: "children",
|
|
934
|
+
type: "ReactNode",
|
|
935
|
+
description: "组件子节点。",
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
name: "className",
|
|
939
|
+
type: "string",
|
|
940
|
+
description: "自定义 className。",
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
name: "classNames",
|
|
944
|
+
type: "Partial<Record<TypographySemanticDOM, string>>",
|
|
945
|
+
description: "classNames 属性。",
|
|
946
|
+
},
|
|
947
|
+
{
|
|
948
|
+
name: "styles",
|
|
949
|
+
type: "Partial<Record<TypographySemanticDOM, CSSProperties>>",
|
|
950
|
+
description: "styles 属性。",
|
|
951
|
+
},
|
|
952
|
+
],
|
|
953
|
+
});
|