weifuwu 0.86.0 → 0.87.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.
- package/README.md +56 -45
- package/content/apps/admin.md +55 -0
- package/content/apps/agent-platform.md +35 -0
- package/content/apps/auth.md +49 -0
- package/content/apps/multi.md +44 -0
- package/content/apps/todo.md +51 -0
- package/content/backend/ai.md +28 -0
- package/content/backend/auth.md +20 -0
- package/content/backend/email.md +23 -0
- package/content/backend/graphql.md +23 -0
- package/content/backend/http.md +23 -0
- package/content/backend/limit.md +23 -0
- package/content/backend/middleware.md +17 -0
- package/content/backend/queue.md +23 -0
- package/content/backend/redis.md +26 -0
- package/content/backend/router.md +23 -0
- package/content/backend/schedule.md +23 -0
- package/content/backend/sql.md +27 -0
- package/content/backend/sse.md +26 -0
- package/content/backend/ws.md +26 -0
- package/content/capabilities/app-node.md +21 -0
- package/content/capabilities/data.md +21 -0
- package/content/capabilities/events.md +21 -0
- package/content/capabilities/hooks.md +22 -0
- package/content/capabilities/i18n.md +21 -0
- package/content/capabilities/popup.md +21 -0
- package/content/capabilities/render-only.md +23 -0
- package/content/capabilities/router.md +22 -0
- package/content/capabilities/self-id.md +21 -0
- package/content/capabilities/store.md +21 -0
- package/content/capabilities/theme.md +21 -0
- package/content/capabilities/two-phase.md +21 -0
- package/content/components/accordion.md +50 -0
- package/content/components/actionsheet.md +46 -0
- package/content/components/affix.md +51 -0
- package/content/components/aichat.md +57 -0
- package/content/components/alert.md +52 -0
- package/content/components/alertgroup.md +45 -0
- package/content/components/anchor.md +52 -0
- package/content/components/app.md +37 -0
- package/content/components/approvalcard.md +56 -0
- package/content/components/appshell.md +50 -0
- package/content/components/aspectratio.md +47 -0
- package/content/components/authpage.md +61 -0
- package/content/components/autocomplete-v2.md +40 -0
- package/content/components/autocomplete.md +56 -0
- package/content/components/avatar.md +51 -0
- package/content/components/avatargroup.md +47 -0
- package/content/components/backtop.md +53 -0
- package/content/components/badge.md +55 -0
- package/content/components/breadcrumb.md +49 -0
- package/content/components/button.md +63 -0
- package/content/components/calendar-v2.md +40 -0
- package/content/components/calendar.md +50 -0
- package/content/components/card.md +58 -0
- package/content/components/carousel.md +52 -0
- package/content/components/cascader-v2.md +39 -0
- package/content/components/cascader.md +54 -0
- package/content/components/chart.md +53 -0
- package/content/components/chatinput.md +63 -0
- package/content/components/checkbox.md +51 -0
- package/content/components/checkboxgroup.md +52 -0
- package/content/components/citationcard.md +48 -0
- package/content/components/codeblock.md +48 -0
- package/content/components/codeeditor.md +47 -0
- package/content/components/collapse.md +49 -0
- package/content/components/colorpicker.md +50 -0
- package/content/components/command.md +50 -0
- package/content/components/confirm.md +57 -0
- package/content/components/contextmenu.md +48 -0
- package/content/components/copybutton.md +51 -0
- package/content/components/datepicker.md +52 -0
- package/content/components/descriptions-v2.md +39 -0
- package/content/components/descriptions.md +52 -0
- package/content/components/diffview-v2.md +39 -0
- package/content/components/diffview.md +50 -0
- package/content/components/divider.md +48 -0
- package/content/components/drawer.md +55 -0
- package/content/components/dropdown.md +53 -0
- package/content/components/editor.md +49 -0
- package/content/components/emptystate.md +51 -0
- package/content/components/exportcsv.md +38 -0
- package/content/components/field.md +54 -0
- package/content/components/filepreview-office.md +37 -0
- package/content/components/filepreview.md +49 -0
- package/content/components/filetree.md +56 -0
- package/content/components/fileupload-v2.md +39 -0
- package/content/components/fileupload.md +57 -0
- package/content/components/floatbutton.md +52 -0
- package/content/components/form-v2.md +41 -0
- package/content/components/form.md +60 -0
- package/content/components/grid.md +51 -0
- package/content/components/highlight-v2.md +39 -0
- package/content/components/highlight.md +46 -0
- package/content/components/hovercard.md +51 -0
- package/content/components/icon.md +50 -0
- package/content/components/imagecropper.md +45 -0
- package/content/components/img.md +56 -0
- package/content/components/infinitescroll-v2.md +40 -0
- package/content/components/infinitescroll.md +54 -0
- package/content/components/input.md +65 -0
- package/content/components/inputnumber.md +58 -0
- package/content/components/inview.md +56 -0
- package/content/components/jsonschemaform.md +53 -0
- package/content/components/jsonviewer-v2.md +39 -0
- package/content/components/jsonviewer.md +49 -0
- package/content/components/kanban.md +46 -0
- package/content/components/label.md +48 -0
- package/content/components/layout.md +54 -0
- package/content/components/layoutcontent.md +43 -0
- package/content/components/layoutheader.md +43 -0
- package/content/components/layoutsider.md +43 -0
- package/content/components/link.md +52 -0
- package/content/components/list.md +44 -0
- package/content/components/loading.md +45 -0
- package/content/components/logviewer-v2.md +39 -0
- package/content/components/logviewer.md +53 -0
- package/content/components/markdown.md +51 -0
- package/content/components/markdowneditor.md +47 -0
- package/content/components/math.md +42 -0
- package/content/components/mentions-v2.md +39 -0
- package/content/components/mentions.md +52 -0
- package/content/components/menu.md +56 -0
- package/content/components/menubar.md +44 -0
- package/content/components/messagebubble.md +50 -0
- package/content/components/modal.md +59 -0
- package/content/components/navmenu.md +47 -0
- package/content/components/notification.md +51 -0
- package/content/components/pageheader.md +53 -0
- package/content/components/pagination.md +49 -0
- package/content/components/paragraph.md +45 -0
- package/content/components/passwordinput.md +57 -0
- package/content/components/pininput-v2.md +39 -0
- package/content/components/pininput.md +50 -0
- package/content/components/pipeline.md +49 -0
- package/content/components/popconfirm.md +58 -0
- package/content/components/popover.md +61 -0
- package/content/components/progressbar.md +50 -0
- package/content/components/prompttemplate.md +49 -0
- package/content/components/qrcode.md +50 -0
- package/content/components/radiogroup.md +53 -0
- package/content/components/rate.md +53 -0
- package/content/components/reasoningblock.md +47 -0
- package/content/components/relationgraph.md +52 -0
- package/content/components/resizable.md +53 -0
- package/content/components/result.md +49 -0
- package/content/components/scrollbar.md +49 -0
- package/content/components/searchinput.md +51 -0
- package/content/components/segmentedcontrol.md +59 -0
- package/content/components/select-searchable.md +47 -0
- package/content/components/select.md +66 -0
- package/content/components/sessionlist.md +52 -0
- package/content/components/sheetgrid.md +44 -0
- package/content/components/skeleton.md +55 -0
- package/content/components/slidecanvas.md +44 -0
- package/content/components/slider.md +62 -0
- package/content/components/sortablelist.md +39 -0
- package/content/components/space.md +52 -0
- package/content/components/sparkline.md +52 -0
- package/content/components/statcard-countdown.md +39 -0
- package/content/components/statcard.md +56 -0
- package/content/components/steps.md +48 -0
- package/content/components/switch.md +50 -0
- package/content/components/tabbar.md +45 -0
- package/content/components/table-v2.md +40 -0
- package/content/components/table.md +66 -0
- package/content/components/tabs.md +56 -0
- package/content/components/tag.md +51 -0
- package/content/components/tagsinput-v2.md +39 -0
- package/content/components/tagsinput.md +54 -0
- package/content/components/text.md +45 -0
- package/content/components/textarea.md +57 -0
- package/content/components/themeswitch.md +69 -0
- package/content/components/timeline.md +50 -0
- package/content/components/title.md +45 -0
- package/content/components/toast.md +52 -0
- package/content/components/toggle-togglegroup.md +52 -0
- package/content/components/togglegroup.md +47 -0
- package/content/components/toolcallcard.md +51 -0
- package/content/components/tooltip.md +50 -0
- package/content/components/tour.md +50 -0
- package/content/components/transfer.md +52 -0
- package/content/components/tree-v2.md +39 -0
- package/content/components/tree.md +59 -0
- package/content/components/treeselect.md +54 -0
- package/content/components/typography.md +51 -0
- package/content/components/videoplayer.md +52 -0
- package/content/components/virtuallist.md +52 -0
- package/content/components/virtualtable-v2.md +39 -0
- package/content/components/virtualtable.md +55 -0
- package/content/components/watermark.md +53 -0
- package/content/components/wave.md +43 -0
- package/content/guides/ai-chat-family.md +24 -0
- package/content/guides/choose.md +67 -0
- package/content/guides/component-model.md +32 -0
- package/content/guides/component-standards.md +123 -0
- package/{docs/components.md → content/guides/components-guide.md} +31 -7
- package/{docs/custom-components.md → content/guides/custom-component.md} +70 -55
- package/{docs/data.md → content/guides/data-guide.md} +5 -2
- package/content/guides/file-preview-family.md +18 -0
- package/{docs → content/guides}/frontend.md +122 -52
- package/content/guides/layout-choice.md +64 -0
- package/{docs/layout.md → content/guides/layout-guide.md} +12 -8
- package/{docs/frontend-middleware.md → content/guides/middleware.md} +34 -3
- package/{docs/mobile.md → content/guides/mobile-guide.md} +20 -24
- package/content/guides/page-building.md +98 -0
- package/content/guides/production.md +37 -0
- package/content/guides/quality.md +60 -0
- package/{docs/realtime.md → content/guides/realtime-guide.md} +6 -3
- package/content/guides/render-only.md +44 -0
- package/{docs/saas.md → content/guides/saas-guide.md} +8 -5
- package/{docs/server.md → content/guides/server-guide.md} +5 -2
- package/content/guides/start.md +41 -0
- package/{docs → content/guides}/styling.md +5 -1
- package/{docs/frontend-ui-dom.md → content/guides/ui-dom-guide.md} +7 -1
- package/content/index.json +4344 -0
- package/content/index.md +181 -0
- package/content/layout/align.md +20 -0
- package/content/layout/anchor.md +19 -0
- package/content/layout/app-shell.md +23 -0
- package/content/layout/border.md +20 -0
- package/content/layout/center.md +19 -0
- package/content/layout/cluster.md +19 -0
- package/content/layout/container.md +19 -0
- package/content/layout/fill.md +19 -0
- package/content/layout/grid.md +19 -0
- package/content/layout/hidden.md +22 -0
- package/content/layout/layer.md +19 -0
- package/content/layout/position.md +22 -0
- package/content/layout/row.md +23 -0
- package/content/layout/safe-area.md +20 -0
- package/content/layout/scroll.md +21 -0
- package/content/layout/spacing.md +22 -0
- package/content/layout/split.md +19 -0
- package/content/layout/stack.md +19 -0
- package/content/layout/surface.md +23 -0
- package/content/layout/text.md +22 -0
- package/content/patterns/app-shell.md +34 -0
- package/content/patterns/dashboard.md +36 -0
- package/content/patterns/data-screen.md +30 -0
- package/content/patterns/detail-page.md +31 -0
- package/content/patterns/docs.md +34 -0
- package/content/patterns/focus-task.md +34 -0
- package/content/patterns/landing.md +35 -0
- package/content/patterns/list-page.md +32 -0
- package/content/patterns/mobile.md +31 -0
- package/content/patterns/settings-page.md +33 -0
- package/content/patterns/workspace.md +32 -0
- package/dist/cli/apps-typecheck.test.d.ts +11 -0
- package/dist/cli/docs.d.ts +2 -0
- package/dist/cli/docs.mjs +10961 -0
- package/dist/cli/home-flash.test.d.ts +1 -0
- package/dist/{components → client/components}/Accordion/Accordion.d.ts +1 -1
- package/dist/client/components/ActionSheet/ActionSheet.d.ts +37 -0
- package/dist/{components → client/components}/Affix/Affix.d.ts +1 -1
- package/dist/{components → client/components}/AiChat/AiChat.d.ts +3 -3
- package/dist/{components → client/components}/Alert/Alert.d.ts +1 -1
- package/dist/{components → client/components}/AlertGroup/AlertGroup.d.ts +1 -1
- package/dist/{components → client/components}/Anchor/Anchor.d.ts +1 -1
- package/dist/client/components/AppShell/AppShell.d.ts +55 -0
- package/dist/{components → client/components}/ApprovalCard/ApprovalCard.d.ts +2 -2
- package/dist/{components → client/components}/AspectRatio/AspectRatio.d.ts +1 -1
- package/dist/{components → client/components}/AuthPage/AuthPage.d.ts +2 -2
- package/dist/{components → client/components}/AutoComplete/AutoComplete.d.ts +1 -1
- package/dist/{components → client/components}/Avatar/Avatar.d.ts +1 -1
- package/dist/{components → client/components}/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/{components → client/components}/BackTop/BackTop.d.ts +1 -1
- package/dist/{components → client/components}/Badge/Badge.d.ts +1 -1
- package/dist/{components → client/components}/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/{components → client/components}/Button/Button.d.ts +1 -1
- package/dist/{components → client/components}/Calendar/Calendar.d.ts +1 -1
- package/dist/{components → client/components}/Card/Card.d.ts +1 -1
- package/dist/{components → client/components}/Carousel/Carousel.d.ts +1 -1
- package/dist/{components → client/components}/Cascader/Cascader.d.ts +1 -1
- package/dist/{components → client/components}/Chart/Chart.d.ts +1 -1
- package/dist/{components → client/components}/Chart/chart-utils.d.ts +5 -1
- package/dist/{components → client/components}/ChatInput/ChatInput.d.ts +7 -7
- package/dist/{components → client/components}/Checkbox/Checkbox.d.ts +1 -1
- package/dist/{components → client/components}/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/{components → client/components}/CitationCard/CitationCard.d.ts +3 -3
- package/dist/{components → client/components}/CodeBlock/CodeBlock.d.ts +1 -1
- package/dist/client/components/CodeEditor/CodeEditor.d.ts +18 -0
- package/dist/{components → client/components}/Collapse/Collapse.d.ts +1 -1
- package/dist/{components → client/components}/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/{components → client/components}/Command/Command.d.ts +1 -1
- package/dist/{components → client/components}/Confirm/Confirm.d.ts +2 -7
- package/dist/{components → client/components}/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/{components → client/components}/CopyButton/CopyButton.d.ts +1 -1
- package/dist/{components → client/components}/DatePicker/DatePicker.d.ts +2 -2
- package/dist/{components → client/components}/Descriptions/Descriptions.d.ts +1 -1
- package/dist/{components → client/components}/DiffView/DiffView.d.ts +1 -1
- package/dist/{components → client/components}/Divider/Divider.d.ts +1 -1
- package/dist/{components → client/components}/Drawer/Drawer.d.ts +1 -1
- package/dist/{components → client/components}/Dropdown/Dropdown.d.ts +1 -1
- package/dist/{components → client/components}/Editor/Editor.d.ts +1 -1
- package/dist/{components → client/components}/Editor/tools/toolbar.d.ts +1 -1
- package/dist/{components → client/components}/EmptyState/EmptyState.d.ts +1 -1
- package/dist/client/components/ExportCSV/ExportCSV.d.ts +30 -0
- package/dist/{components → client/components}/Field/Field.d.ts +1 -1
- package/dist/{components → client/components}/FilePreview/FilePreview.d.ts +1 -1
- package/dist/client/components/FileTree/FileTree.d.ts +57 -0
- package/dist/{components → client/components}/FileUpload/FileUpload.d.ts +1 -1
- package/dist/{components → client/components}/FloatButton/FloatButton.d.ts +1 -1
- package/dist/{components → client/components}/Form/Form.d.ts +1 -1
- package/dist/{components → client/components}/Grid/Grid.d.ts +1 -1
- package/dist/{components → client/components}/Highlight/Highlight.d.ts +1 -1
- package/dist/{components → client/components}/HoverCard/HoverCard.d.ts +5 -4
- package/dist/{components → client/components}/Icon/Icon.d.ts +2 -2
- package/dist/client/components/ImageCropper/ImageCropper.d.ts +17 -0
- package/dist/{components → client/components}/Img/Img.d.ts +1 -1
- package/dist/{components → client/components}/InView/InView.d.ts +1 -1
- package/dist/{components → client/components}/InfiniteScroll/InfiniteScroll.d.ts +1 -1
- package/dist/{components → client/components}/Input/Input.d.ts +1 -1
- package/dist/{components → client/components}/InputNumber/InputNumber.d.ts +1 -1
- package/dist/{components → client/components}/JSONViewer/JSONViewer.d.ts +1 -1
- package/dist/{components → client/components}/JsonSchemaForm/JsonSchemaForm.d.ts +3 -3
- package/dist/{components → client/components}/Kanban/Kanban.d.ts +1 -1
- package/dist/{components → client/components}/Label/Label.d.ts +1 -1
- package/dist/{components → client/components}/Layout/Layout.d.ts +1 -1
- package/dist/{components → client/components}/Link/Link.d.ts +1 -1
- package/dist/{components → client/components}/List/List.d.ts +1 -1
- package/dist/{components → client/components}/Loading/Loading.d.ts +1 -1
- package/dist/{components → client/components}/LogViewer/LogViewer.d.ts +1 -1
- package/dist/{components → client/components}/Markdown/Markdown.d.ts +1 -1
- package/dist/client/components/MarkdownEditor/MarkdownEditor.d.ts +18 -0
- package/dist/client/components/Math/Math.d.ts +15 -0
- package/dist/{components → client/components}/Mentions/Mentions.d.ts +1 -1
- package/dist/{components → client/components}/Menu/Menu.d.ts +1 -1
- package/dist/{components → client/components}/Menubar/Menubar.d.ts +1 -1
- package/dist/{components → client/components}/MessageBubble/MessageBubble.d.ts +1 -1
- package/dist/{components → client/components}/Modal/Modal.d.ts +1 -1
- package/dist/{components → client/components}/NavMenu/NavMenu.d.ts +2 -2
- package/dist/{components → client/components}/Notification/Notification.d.ts +7 -2
- package/dist/{components → client/components}/PageHeader/PageHeader.d.ts +1 -1
- package/dist/{components → client/components}/Pagination/Pagination.d.ts +1 -1
- package/dist/{components → client/components}/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/{components → client/components}/PinInput/PinInput.d.ts +1 -1
- package/dist/{components → client/components}/Pipeline/Pipeline.d.ts +1 -1
- package/dist/{components → client/components}/Popconfirm/Popconfirm.d.ts +2 -2
- package/dist/{components → client/components}/Popover/Popover.d.ts +5 -4
- package/dist/{components → client/components}/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/client/components/PromptTemplate/PromptTemplate.d.ts +37 -0
- package/dist/{components → client/components}/QRCode/QRCode.d.ts +1 -1
- package/dist/{components → client/components}/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/{components → client/components}/Rate/Rate.d.ts +1 -1
- package/dist/{components → client/components}/ReasoningBlock/ReasoningBlock.d.ts +3 -3
- package/dist/client/components/RelationGraph/RelationGraph.d.ts +59 -0
- package/dist/{components → client/components}/Resizable/Resizable.d.ts +1 -1
- package/dist/{components → client/components}/Result/Result.d.ts +1 -1
- package/dist/{components → client/components}/Scrollbar/Scrollbar.d.ts +1 -1
- package/dist/{components → client/components}/SearchInput/SearchInput.d.ts +1 -1
- package/dist/{components → client/components}/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/{components → client/components}/Select/Select.d.ts +1 -1
- package/dist/{components → client/components}/SessionList/SessionList.d.ts +3 -3
- package/dist/{components → client/components}/SheetGrid/SheetGrid.d.ts +1 -1
- package/dist/{components → client/components}/Skeleton/Skeleton.d.ts +1 -1
- package/dist/{components → client/components}/SlideCanvas/SlideCanvas.d.ts +1 -1
- package/dist/client/components/Slider/Slider.d.ts +27 -0
- package/dist/client/components/SortableList/SortableList.d.ts +23 -0
- package/dist/{components → client/components}/Space/Space.d.ts +1 -1
- package/dist/{components → client/components}/Sparkline/Sparkline.d.ts +1 -1
- package/dist/{components → client/components}/StatCard/StatCard.d.ts +1 -1
- package/dist/{components → client/components}/Steps/Steps.d.ts +1 -1
- package/dist/{components → client/components}/Switch/Switch.d.ts +1 -1
- package/dist/client/components/TabBar/TabBar.d.ts +35 -0
- package/dist/{components → client/components}/Table/Table.d.ts +7 -1
- package/dist/client/components/Tabs/Tabs.d.ts +22 -0
- package/dist/{components → client/components}/Tag/Tag.d.ts +1 -1
- package/dist/{components → client/components}/TagsInput/TagsInput.d.ts +1 -1
- package/dist/{components → client/components}/Textarea/Textarea.d.ts +1 -1
- package/dist/{components → client/components}/ThemeSwitch/ThemeSwitch.d.ts +1 -1
- package/dist/{components → client/components}/Timeline/Timeline.d.ts +1 -1
- package/dist/{components → client/components}/Toast/Toast.d.ts +1 -1
- package/dist/{components → client/components}/ToggleGroup/ToggleGroup.d.ts +1 -1
- package/dist/{components → client/components}/ToolCallCard/ToolCallCard.d.ts +2 -2
- package/dist/{components → client/components}/Tooltip/Tooltip.d.ts +4 -3
- package/dist/{components → client/components}/Tour/Tour.d.ts +1 -1
- package/dist/{components → client/components}/Transfer/Transfer.d.ts +1 -1
- package/dist/{components → client/components}/Tree/Tree.d.ts +5 -1
- package/dist/{components → client/components}/TreeSelect/TreeSelect.d.ts +5 -1
- package/dist/{components → client/components}/Typography/Typography.d.ts +1 -1
- package/dist/client/components/VideoPlayer/VideoPlayer.d.ts +25 -0
- package/dist/{components → client/components}/VirtualList/VirtualList.d.ts +1 -1
- package/dist/{components → client/components}/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/{components → client/components}/Watermark/Watermark.d.ts +1 -1
- package/dist/client/components/Wave/Wave.d.ts +15 -0
- package/dist/{components → client/components}/index.d.ts +44 -5
- package/dist/client/components/index.js +57 -0
- package/dist/{components → client/components}/style.css +1081 -98
- package/dist/{layout → client/layout}/weifuwu-layout.css +60 -6
- package/dist/{office → client/office}/xml-serialize.d.ts +1 -1
- package/dist/client/vdom/browser/Browser.d.ts +73 -0
- package/dist/client/vdom/browser/create-client-browser.d.ts +11 -0
- package/dist/client/vdom/commands.d.ts +19 -0
- package/dist/client/vdom/context/UIContext.d.ts +61 -0
- package/dist/client/vdom/context/data.d.ts +17 -0
- package/dist/client/vdom/core/async-guard.d.ts +20 -0
- package/dist/client/vdom/core/build.d.ts +36 -0
- package/dist/client/vdom/core/command/create.d.ts +25 -0
- package/dist/client/vdom/core/command/index.d.ts +15 -0
- package/dist/client/vdom/core/command/insert.d.ts +32 -0
- package/dist/client/vdom/core/command/lifecycle.d.ts +47 -0
- package/dist/client/vdom/core/command/props.d.ts +22 -0
- package/dist/client/vdom/core/diff/attrs.d.ts +10 -0
- package/dist/client/vdom/core/diff/children.d.ts +29 -0
- package/dist/client/vdom/core/diff/cleanup.d.ts +44 -0
- package/dist/client/vdom/core/diff/index.d.ts +22 -0
- package/dist/client/vdom/core/diff/output.d.ts +30 -0
- package/dist/client/vdom/core/diff/same.d.ts +22 -0
- package/dist/client/vdom/core/field/attributes.d.ts +15 -0
- package/dist/client/vdom/core/field/events.d.ts +54 -0
- package/dist/client/vdom/core/field/index.d.ts +19 -0
- package/dist/client/vdom/core/field/key.d.ts +16 -0
- package/dist/client/vdom/core/field/props.d.ts +15 -0
- package/dist/client/vdom/core/field/ref.d.ts +38 -0
- package/dist/client/vdom/core/field/style.d.ts +17 -0
- package/dist/client/vdom/core/node/children.d.ts +20 -0
- package/dist/client/vdom/core/node/component.d.ts +93 -0
- package/dist/client/vdom/core/node/fragment.d.ts +14 -0
- package/dist/client/vdom/core/node/hole.d.ts +22 -0
- package/dist/client/vdom/core/node/index.d.ts +35 -0
- package/dist/client/vdom/core/node/keyed.d.ts +64 -0
- package/dist/client/vdom/core/node/native.d.ts +20 -0
- package/dist/client/vdom/core/node/portal.d.ts +11 -0
- package/dist/client/vdom/core/patch/fields.d.ts +15 -0
- package/dist/client/vdom/core/patch/index.d.ts +51 -0
- package/dist/client/vdom/core/patch/processors.d.ts +75 -0
- package/dist/client/vdom/core/patch/state-machine.d.ts +38 -0
- package/dist/client/vdom/core/patch/verify.d.ts +17 -0
- package/dist/client/vdom/core/router.d.ts +31 -0
- package/dist/client/vdom/core/serve.d.ts +75 -0
- package/dist/client/vdom/core/ssr/absorb.d.ts +53 -0
- package/dist/client/vdom/core/ssr/html.d.ts +32 -0
- package/dist/client/vdom/core/ssr/index.d.ts +25 -0
- package/dist/client/vdom/core/transform/component.d.ts +23 -0
- package/dist/client/vdom/core/transform/element.d.ts +21 -0
- package/dist/client/vdom/core/transform/fragment.d.ts +21 -0
- package/dist/client/vdom/core/transform/hole.d.ts +13 -0
- package/dist/client/vdom/core/transform/index.d.ts +46 -0
- package/dist/client/vdom/core/transform/states.d.ts +22 -0
- package/dist/client/vdom/core/transform/table.d.ts +28 -0
- package/dist/client/vdom/core/transform/text.d.ts +10 -0
- package/dist/client/vdom/core/vnode.d.ts +45 -0
- package/dist/client/vdom/dev/effect-guard.d.ts +8 -0
- package/dist/client/vdom/hooks/ai-stream.d.ts +46 -0
- package/dist/client/vdom/hooks/basic.d.ts +42 -0
- package/dist/client/vdom/hooks/chat.d.ts +91 -0
- package/dist/client/vdom/hooks/controlled.d.ts +27 -0
- package/dist/client/vdom/hooks/drag-media.d.ts +52 -0
- package/dist/client/vdom/hooks/env.d.ts +119 -0
- package/dist/client/vdom/hooks/input.d.ts +43 -0
- package/dist/client/vdom/hooks/observe.d.ts +60 -0
- package/dist/client/vdom/hooks/popup-manager.d.ts +92 -0
- package/dist/client/vdom/hooks/popup.d.ts +52 -0
- package/dist/client/vdom/hooks/stable.d.ts +45 -0
- package/dist/client/vdom/index.d.ts +67 -0
- package/dist/client/vdom/index.js +8 -0
- package/dist/client/vdom/jsx-runtime.d.ts +28 -0
- package/dist/client/vdom/jsx-runtime.js +1 -0
- package/dist/client/vdom/middlewares/api.d.ts +38 -0
- package/dist/client/vdom/middlewares/auth-i18n.d.ts +66 -0
- package/dist/client/vdom/middlewares/ws.d.ts +37 -0
- package/dist/client/vdom/store.d.ts +49 -0
- package/dist/client/vdom/testing.d.ts +46 -0
- package/dist/client/vdom/testing.js +2 -0
- package/dist/dev/index.d.ts +12 -0
- package/dist/dev/index.js +4 -4
- package/dist/{ai → server/ai}/contracts.d.ts +1 -1
- package/dist/{ai → server/ai}/index.d.ts +2 -2
- package/dist/{ai → server/ai}/types.d.ts +1 -1
- package/dist/{core → server/core}/router.d.ts +2 -4
- package/dist/{db → server/db}/contracts.d.ts +1 -1
- package/dist/server/db/postgres-server.d.ts +37 -0
- package/dist/server/db/redis-server.d.ts +32 -0
- package/dist/server/db/server.d.ts +30 -0
- package/dist/server/db/test-servers.d.ts +21 -0
- package/dist/{email → server/email}/contracts.d.ts +1 -1
- package/dist/{index.js → server/index.js} +3145 -2487
- package/dist/{ui → server/ui}/index.d.ts +2 -2
- package/dist/{user → server/user}/token.d.ts +1 -1
- package/dist/shared/router/trie.d.ts +61 -0
- package/docs/components-map.md +5 -5
- package/docs/style-guide.md +14 -2
- package/examples/apps/admin/README.md +23 -0
- package/examples/apps/admin/api.ts +27 -0
- package/examples/apps/admin/app.tsx +144 -0
- package/examples/apps/admin/main.tsx +8 -0
- package/examples/apps/admin/server.ts +37 -0
- package/examples/apps/auth/README.md +23 -0
- package/examples/apps/auth/api.ts +49 -0
- package/examples/apps/auth/app.tsx +137 -0
- package/examples/apps/auth/main.tsx +8 -0
- package/examples/apps/auth/server.ts +37 -0
- package/examples/apps/multi/README.md +23 -0
- package/examples/apps/multi/app.tsx +83 -0
- package/examples/apps/multi/main.tsx +8 -0
- package/examples/apps/multi/server.ts +33 -0
- package/examples/apps/todo/README.md +23 -0
- package/examples/apps/todo/api.ts +26 -0
- package/examples/apps/todo/app.tsx +128 -0
- package/examples/apps/todo/main.tsx +9 -0
- package/examples/apps/todo/server.ts +39 -0
- package/examples/hello-world/README.md +9 -0
- package/examples/hello-world/client.ts +14 -0
- package/examples/hello-world/routes.tsx +26 -0
- package/examples/hello-world/server.ts +46 -0
- package/examples/patterns/AppShell.tsx +224 -0
- package/examples/patterns/Dashboard.tsx +153 -0
- package/examples/patterns/DataScreen.tsx +104 -0
- package/examples/patterns/DetailPage.tsx +79 -0
- package/examples/patterns/Docs.tsx +105 -0
- package/examples/patterns/FocusTask.tsx +67 -0
- package/examples/patterns/Landing.tsx +90 -0
- package/examples/patterns/ListPage.tsx +77 -0
- package/examples/patterns/Mobile.tsx +154 -0
- package/examples/patterns/SettingsPage.tsx +98 -0
- package/examples/patterns/SplitWorkspace.tsx +113 -0
- package/package.json +61 -29
- package/dist/components/Slider/Slider.d.ts +0 -19
- package/dist/components/Tabs/Tabs.d.ts +0 -12
- package/dist/components/index.js +0 -55
- package/dist/ui-dom/Confirm.d.ts +0 -8
- package/dist/ui-dom/Notification.d.ts +0 -8
- package/dist/ui-dom/Toast.d.ts +0 -8
- package/dist/ui-dom/ai.d.ts +0 -59
- package/dist/ui-dom/browser.d.ts +0 -10
- package/dist/ui-dom/debug.d.ts +0 -21
- package/dist/ui-dom/hooks/chat.d.ts +0 -11
- package/dist/ui-dom/hooks/events.d.ts +0 -30
- package/dist/ui-dom/hooks/external.d.ts +0 -20
- package/dist/ui-dom/hooks/index.d.ts +0 -29
- package/dist/ui-dom/hooks/input.d.ts +0 -33
- package/dist/ui-dom/hooks/media.d.ts +0 -17
- package/dist/ui-dom/hooks/popup.d.ts +0 -30
- package/dist/ui-dom/hooks/stable.d.ts +0 -35
- package/dist/ui-dom/hooks/types.d.ts +0 -77
- package/dist/ui-dom/i18n.d.ts +0 -31
- package/dist/ui-dom/index.d.ts +0 -47
- package/dist/ui-dom/index.js +0 -41
- package/dist/ui-dom/jsx-runtime.d.ts +0 -4
- package/dist/ui-dom/jsx-runtime.js +0 -1
- package/dist/ui-dom/locale/en_US.d.ts +0 -69
- package/dist/ui-dom/locale/zh_CN.d.ts +0 -69
- package/dist/ui-dom/middleware/api.d.ts +0 -91
- package/dist/ui-dom/middleware/auth.d.ts +0 -30
- package/dist/ui-dom/middleware/ws.d.ts +0 -33
- package/dist/ui-dom/motion.d.ts +0 -8
- package/dist/ui-dom/popup-tracker.d.ts +0 -36
- package/dist/ui-dom/popup.d.ts +0 -42
- package/dist/ui-dom/store.d.ts +0 -24
- package/dist/ui-dom/testing.d.ts +0 -68
- package/dist/ui-dom/testing.js +0 -7
- package/dist/ui-dom/types.d.ts +0 -634
- package/dist/ui-dom/use-chat.d.ts +0 -95
- package/dist/ui-dom/vdom3/README.d.ts +0 -32
- package/dist/ui-dom/vdom3/app.d.ts +0 -20
- package/dist/ui-dom/vdom3/audit.d.ts +0 -29
- package/dist/ui-dom/vdom3/build.d.ts +0 -20
- package/dist/ui-dom/vdom3/commands.d.ts +0 -21
- package/dist/ui-dom/vdom3/comp-index.d.ts +0 -18
- package/dist/ui-dom/vdom3/delegate.d.ts +0 -53
- package/dist/ui-dom/vdom3/events.d.ts +0 -17
- package/dist/ui-dom/vdom3/index.d.ts +0 -42
- package/dist/ui-dom/vdom3/jsx.d.ts +0 -32
- package/dist/ui-dom/vdom3/record.d.ts +0 -16
- package/dist/ui-dom/vdom3/registry.d.ts +0 -30
- package/dist/ui-dom/vdom3/render.d.ts +0 -39
- package/dist/ui-dom/vdom3/replay.d.ts +0 -28
- package/dist/ui-dom/vdom3/root.d.ts +0 -24
- package/dist/ui-dom/vdom3/router.d.ts +0 -31
- package/dist/ui-dom/vdom3/scheduler.d.ts +0 -23
- package/dist/ui-dom/vdom3/ssr.d.ts +0 -27
- package/dist/ui-dom/vdom3/sync.d.ts +0 -22
- package/dist/ui-dom/vdom3/types.d.ts +0 -173
- package/dist/ui-dom/vdom3/ui.d.ts +0 -16
- package/dist/ui-dom/vdom3.js +0 -41
- package/dist/ui-dom/vnode.d.ts +0 -13
- /package/dist/{make-executable-schema.test.d.ts → cli/content-sync.test.d.ts} +0 -0
- /package/dist/{ui-dom/testing.test.d.ts → cli/docs-cli.test.d.ts} +0 -0
- /package/dist/{components → client/components}/CodeBlock/highlight.d.ts +0 -0
- /package/dist/{components → client/components}/DatePicker/calendar-utils.d.ts +0 -0
- /package/dist/{components → client/components}/DiffView/diff-utils.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/edit-events.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/apply.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/diff.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/dom.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/history.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/html.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/inverse.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/model/types.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/tools/table.d.ts +0 -0
- /package/dist/{components → client/components}/Editor/tools/types.d.ts +0 -0
- /package/dist/{components → client/components}/FilePreview/markdown.d.ts +0 -0
- /package/dist/{components → client/components}/Markdown/parser.d.ts +0 -0
- /package/dist/{components → client/components}/OfficeEditor/ai/ai-bridge.d.ts +0 -0
- /package/dist/{components → client/components}/OfficeEditor/model/apply.d.ts +0 -0
- /package/dist/{components → client/components}/OfficeEditor/model/types.d.ts +0 -0
- /package/dist/{components → client/components}/Pipeline/dag-utils.d.ts +0 -0
- /package/dist/{components → client/components}/QRCode/qr.d.ts +0 -0
- /package/dist/{components → client/components}/Sparkline/sparkline-utils.d.ts +0 -0
- /package/dist/{office → client/office}/docx.d.ts +0 -0
- /package/dist/{office → client/office}/pptx.d.ts +0 -0
- /package/dist/{office → client/office}/xlsx.d.ts +0 -0
- /package/dist/{office → client/office}/xml.d.ts +0 -0
- /package/dist/{office → client/office}/zip.d.ts +0 -0
- /package/dist/{ai → server/ai}/agent.d.ts +0 -0
- /package/dist/{ai → server/ai}/client.d.ts +0 -0
- /package/dist/{ai → server/ai}/sse.d.ts +0 -0
- /package/dist/{core → server/core}/serve.d.ts +0 -0
- /package/dist/{core → server/core}/ws.d.ts +0 -0
- /package/dist/{db → server/db}/errors.d.ts +0 -0
- /package/dist/{db → server/db}/memory-redis.d.ts +0 -0
- /package/dist/{db → server/db}/memory-sql.d.ts +0 -0
- /package/dist/{db → server/db}/postgres/connection.d.ts +0 -0
- /package/dist/{db → server/db}/postgres/pool.d.ts +0 -0
- /package/dist/{db → server/db}/postgres/protocol.d.ts +0 -0
- /package/dist/{db → server/db}/postgres/schema.d.ts +0 -0
- /package/dist/{db → server/db}/query-builder.d.ts +0 -0
- /package/dist/{db → server/db}/query.d.ts +0 -0
- /package/dist/{db → server/db}/redis/client.d.ts +0 -0
- /package/dist/{db → server/db}/redis/commands.d.ts +0 -0
- /package/dist/{db → server/db}/redis/connection.d.ts +0 -0
- /package/dist/{db → server/db}/redis/pipeline.d.ts +0 -0
- /package/dist/{db → server/db}/redis/pool.d.ts +0 -0
- /package/dist/{db → server/db}/redis/resp.d.ts +0 -0
- /package/dist/{db → server/db}/redis/subscriber.d.ts +0 -0
- /package/dist/{db → server/db}/sql-parser.d.ts +0 -0
- /package/dist/{email → server/email}/index.d.ts +0 -0
- /package/dist/{email → server/email}/smtp.d.ts +0 -0
- /package/dist/{graphql.d.ts → server/graphql.d.ts} +0 -0
- /package/dist/{index.d.ts → server/index.d.ts} +0 -0
- /package/dist/{make-executable-schema.d.ts → server/make-executable-schema.d.ts} +0 -0
- /package/dist/{messager → server/messager}/index.d.ts +0 -0
- /package/dist/{middleware → server/middleware}/cors.d.ts +0 -0
- /package/dist/{middleware → server/middleware}/rate-limit.d.ts +0 -0
- /package/dist/{middleware → server/middleware}/static.d.ts +0 -0
- /package/dist/{postgres → server/postgres}/client.d.ts +0 -0
- /package/dist/{postgres → server/postgres}/index.d.ts +0 -0
- /package/dist/{postgres → server/postgres}/types.d.ts +0 -0
- /package/dist/{queue → server/queue}/index.d.ts +0 -0
- /package/dist/{redis → server/redis}/client.d.ts +0 -0
- /package/dist/{redis → server/redis}/index.d.ts +0 -0
- /package/dist/{redis → server/redis}/types.d.ts +0 -0
- /package/dist/{request.d.ts → server/request.d.ts} +0 -0
- /package/dist/{response.d.ts → server/response.d.ts} +0 -0
- /package/dist/{scheduler → server/scheduler}/cron.d.ts +0 -0
- /package/dist/{scheduler → server/scheduler}/index.d.ts +0 -0
- /package/dist/{types.d.ts → server/types.d.ts} +0 -0
- /package/dist/{ui → server/ui}/html-safe.d.ts +0 -0
- /package/dist/{user → server/user}/index.d.ts +0 -0
- /package/dist/{user → server/user}/password.d.ts +0 -0
package/dist/ui-dom/types.d.ts
DELETED
|
@@ -1,634 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* weifuwu/ui-dom 类型定义
|
|
3
|
-
*/
|
|
4
|
-
import type { UseChatHandle, UseChatOptions } from './use-chat.ts';
|
|
5
|
-
import type { VNode } from './vdom3/types.ts';
|
|
6
|
-
export type { VNode } from './vdom3/types.ts';
|
|
7
|
-
import type { Placement } from './popup.ts';
|
|
8
|
-
/** 弹层位置跟踪配置 — 供 ctx.ui.usePopupPosition 使用 */
|
|
9
|
-
export interface PopupPositionOptions {
|
|
10
|
-
/** 锚定元素 getter(通常是 ref 保存的触发元素) */
|
|
11
|
-
el: () => HTMLElement | null;
|
|
12
|
-
/** 弹层是否显示(getter,闭包读取最新状态) */
|
|
13
|
-
isOpen: () => boolean;
|
|
14
|
-
/** rect → fixed 坐标(可返回 width 等附加属性) */
|
|
15
|
-
compute: (rect: DOMRect) => {
|
|
16
|
-
top: number;
|
|
17
|
-
left: number;
|
|
18
|
-
width?: number;
|
|
19
|
-
};
|
|
20
|
-
/** 弹层面板元素 getter(可选):提供后坐标自动夹紧到视口内(防超高/超宽时底部按钮不可点) */
|
|
21
|
-
panel?: () => HTMLElement | null;
|
|
22
|
-
/** 视口边缘安全边距(px,默认 8) */
|
|
23
|
-
margin?: number;
|
|
24
|
-
}
|
|
25
|
-
/** 异步取数工具返回值 — ctx.ui.useAsync()(data/loading/error 响应式,reload 重跑) */
|
|
26
|
-
export interface UseAsyncHandle<T = any> {
|
|
27
|
-
data?: T;
|
|
28
|
-
loading: boolean;
|
|
29
|
-
error?: unknown;
|
|
30
|
-
reload: () => void;
|
|
31
|
-
}
|
|
32
|
-
/** 弹层位置跟踪器 — usePopupPosition 的返回值 */
|
|
33
|
-
export interface PopupPosition {
|
|
34
|
-
top: number;
|
|
35
|
-
left: number;
|
|
36
|
-
width?: number;
|
|
37
|
-
/** 立即重算一次坐标(不触发渲染,调用方负责 render) */
|
|
38
|
-
refresh: () => void;
|
|
39
|
-
}
|
|
40
|
-
/** 弹层触发方式 — usePopup 的 trigger */
|
|
41
|
-
export type PopupTrigger = 'hover' | 'click' | 'longpress' | 'focus' | 'manual';
|
|
42
|
-
/** 弹层组合器配置 — 供 ctx.ui.usePopup 使用 */
|
|
43
|
-
export interface UsePopupOptions {
|
|
44
|
-
/** 触发方式(支持 getter——动态读最新 props;hover 在触屏环境自动降级为 tap)。
|
|
45
|
-
* 可选——缺省 'manual'(无触发 handler——Modal/Drawer 会话级模态场景) */
|
|
46
|
-
trigger?: PopupTrigger | (() => PopupTrigger);
|
|
47
|
-
/** 弹出方向(支持 getter——动态读最新 props),默认 'bottom' */
|
|
48
|
-
placement?: Placement | (() => Placement);
|
|
49
|
-
/** 自由定位(支持 getter):提供则忽略 placement,直接用坐标(如右键菜单光标处)。
|
|
50
|
-
* 可返回 width(可选)——portal 内联 style 精确宽度(DatePicker 跟随 trigger 宽) */
|
|
51
|
-
position?: () => {
|
|
52
|
-
x: number;
|
|
53
|
-
y: number;
|
|
54
|
-
width?: number;
|
|
55
|
-
};
|
|
56
|
-
/** 水平对齐:center=居中于触发元素(默认),start=左对齐(Menubar 面板用) */
|
|
57
|
-
center?: boolean;
|
|
58
|
-
/** 与触发元素间距(px,默认 6) */
|
|
59
|
-
gap?: number;
|
|
60
|
-
/** 视口安全边距(px,默认 8) */
|
|
61
|
-
margin?: number;
|
|
62
|
-
/** 锚定元素 getter(ref 保存的触发元素);positioning 'none' 场景可省略 */
|
|
63
|
-
el?: () => HTMLElement | null;
|
|
64
|
-
/** 是否打开(getter) */
|
|
65
|
-
isOpen: () => boolean;
|
|
66
|
-
/** 非受控:设置打开状态(调用方负责 render/dirty) */
|
|
67
|
-
setOpen: (open: boolean) => void;
|
|
68
|
-
/** 受控(可选,boolean 或 getter——动态读最新 props):传了则组件内不直接改状态,只回调 onOpenChange */
|
|
69
|
-
open?: boolean | (() => boolean);
|
|
70
|
-
/** 受控回调(可选) */
|
|
71
|
-
onOpenChange?: (open: boolean) => void;
|
|
72
|
-
/** 面板宽度(px 或 getter,可选):自动 clamp 到视口(≤ 100vw - 32px);getter 动态跟随
|
|
73
|
-
* (DatePicker date 模式跟随 trigger 宽,range 模式返回 undefined 自适应双面板) */
|
|
74
|
-
width?: number | (() => number | undefined);
|
|
75
|
-
/** 点外部关闭(默认 true) */
|
|
76
|
-
closeOnOutside?: boolean;
|
|
77
|
-
/** Escape 关闭(默认 true) */
|
|
78
|
-
closeOnEscape?: boolean;
|
|
79
|
-
/** 遮罩(默认 false):渲染全屏 overlay(--wf-overlay,点击遮罩关闭,
|
|
80
|
-
* 模态语义阻断页面交互)。false = 无遮罩 document 外部点击(§5.4 默认)。
|
|
81
|
-
* 遮罩层 z-index = --wf-z-overlay(80) < 面板 --wf-z-popover(120)。
|
|
82
|
-
* 配合 maskClosable 控制遮罩点击是否关闭。
|
|
83
|
-
* 传 VNode = 自定义遮罩内容(Tour 挖洞高亮遮罩——交互组件自控,不自动 onClick) */
|
|
84
|
-
mask?: boolean | VNode;
|
|
85
|
-
/** 遮罩点击关闭(默认 true;mask:true 时生效——危险确认 maskClosable=false 防误触) */
|
|
86
|
-
maskClosable?: boolean;
|
|
87
|
-
/** 遮罩面板居中(默认 false;mask:true 时生效):面板覆盖全屏 flex 居中
|
|
88
|
-
* (预览图/全屏浮层场景——忽略 trigger 定位,替代 dropdown 的 bottom 定位) */
|
|
89
|
-
maskCentered?: boolean;
|
|
90
|
-
/** 长按触发时长(ms,仅 trigger='longpress',默认 500) */
|
|
91
|
-
longPressDuration?: number;
|
|
92
|
-
/** 打开触发回调(longpress 计时到/右键兼容时调用,携带光标坐标——右键菜单定位用) */
|
|
93
|
-
onTrigger?: (e: {
|
|
94
|
-
clientX: number;
|
|
95
|
-
clientY: number;
|
|
96
|
-
}) => void;
|
|
97
|
-
/** hover 打开延迟(ms 或 getter——动态读最新 props,仅 trigger='hover',默认 0) */
|
|
98
|
-
openDelay?: number | (() => number);
|
|
99
|
-
/** hover 关闭延迟(ms 或 getter,仅 trigger='hover',默认 0) */
|
|
100
|
-
closeDelay?: number | (() => number);
|
|
101
|
-
/** 禁用(getter):禁用时所有触发不生效且 portal 不渲染 */
|
|
102
|
-
disabled?: () => boolean;
|
|
103
|
-
/** 定位模式:'anchor'(默认——锚定 el 计算坐标)/ 'none'(不加坐标——组件自定义定位,
|
|
104
|
-
* 如 Modal 的 .wf-modal inset:0 居中) */
|
|
105
|
-
positioning?: 'anchor' | 'none';
|
|
106
|
-
/** 会话级模态能力(Modal/Drawer 用——锚定弹层默认全关,零成本) */
|
|
107
|
-
/** 退场状态机(open → exit → closed + animationend 卸载):组件 render 阶段调 sync(open) 驱动 */
|
|
108
|
-
presence?: boolean;
|
|
109
|
-
/** 焦点 trap(面板挂载时锁定焦点,卸载归还——会话级模态专用) */
|
|
110
|
-
trapFocus?: boolean;
|
|
111
|
-
/** 滚动锁(sync(true) 锁 body 滚动 / 面板卸载释放——会话级模态专用) */
|
|
112
|
-
lockScroll?: boolean;
|
|
113
|
-
}
|
|
114
|
-
/** 弹层组合器返回值 — usePopup */
|
|
115
|
-
export interface UsePopupHandle {
|
|
116
|
-
/** 当前打开状态(渲染期读取) */
|
|
117
|
-
open: boolean;
|
|
118
|
-
setOpen: (open: boolean) => void;
|
|
119
|
-
/** 当前阶段(presence 模式:open → exit → closed;非 presence:open/closed 二态) */
|
|
120
|
-
phase?: 'closed' | 'open' | 'exit';
|
|
121
|
-
/** 同步打开状态(render 阶段调用——presence 模式驱动退场状态机,返回当前 phase;非 presence 模式返回二态) */
|
|
122
|
-
sync?: (open: boolean) => 'closed' | 'open' | 'exit';
|
|
123
|
-
/** spread 到触发/包装元素:触发(hover 门控/tap 降级/longpress)+ Escape + focus */
|
|
124
|
-
wrapProps: Record<string, any>;
|
|
125
|
-
/** 包装弹层内容:定位 + 视口/宽度 clamp + portal;关闭时返回 null */
|
|
126
|
-
portal: (content: VNode | null, portalKey?: string) => VNode | null;
|
|
127
|
-
/** 立即重算坐标(打开/动画结束后调用) */
|
|
128
|
-
refresh: () => void;
|
|
129
|
-
}
|
|
130
|
-
/** 长按配置 — 供 ctx.ui.useLongPress 使用 */
|
|
131
|
-
export interface UseLongPressOptions {
|
|
132
|
-
/** 长按时长(ms,默认 500) */
|
|
133
|
-
duration?: number;
|
|
134
|
-
/** 长按触发回调(接收触发事件,含 clientX/clientY) */
|
|
135
|
-
onLongPress: (e: PointerEvent | MouseEvent) => void;
|
|
136
|
-
}
|
|
137
|
-
/** 长按返回的触发 props — spread 到目标元素 */
|
|
138
|
-
export interface UseLongPressHandle {
|
|
139
|
-
onPointerDown: (e: PointerEvent) => void;
|
|
140
|
-
onPointerUp: (e: PointerEvent) => void;
|
|
141
|
-
onPointerLeave: (e: PointerEvent) => void;
|
|
142
|
-
onPointerMove: (e: PointerEvent) => void;
|
|
143
|
-
/** 桌面右键兼容(移动端浏览器 contextmenu 也会触发) */
|
|
144
|
-
onContextMenu: (e: MouseEvent) => void;
|
|
145
|
-
}
|
|
146
|
-
/** 可视视口(visualViewport)状态 — useVisualViewport 返回值 */
|
|
147
|
-
export interface VisualViewportHandle {
|
|
148
|
-
/** 可视视口高度(visualViewport.height;无 visualViewport 时 = innerHeight) */
|
|
149
|
-
height: number;
|
|
150
|
-
/** 可视视口相对布局视口顶部的偏移(键盘弹起时 > 0) */
|
|
151
|
-
offsetTop: number;
|
|
152
|
-
/** 键盘是否弹起(height < 0.9 × innerHeight 近似) */
|
|
153
|
-
keyboardOpen: boolean;
|
|
154
|
-
}
|
|
155
|
-
/** 可见性观察配置 — 供 ctx.ui.useInView 使用(IntersectionObserver 封装,替代 scroll 监听) */
|
|
156
|
-
export interface UseInViewOptions {
|
|
157
|
-
/** IO 根元素 getter(默认视口;滚动容器场景传 target) */
|
|
158
|
-
root?: () => Element | null;
|
|
159
|
-
/** IO rootMargin(支持函数——动态读最新 props,observe 时求值) */
|
|
160
|
-
rootMargin?: string | (() => string);
|
|
161
|
-
/** IO threshold(默认 0;支持函数——动态读最新 props) */
|
|
162
|
-
threshold?: number | number[] | (() => number | number[]);
|
|
163
|
-
/** IO 触发回调(entry.boundingClientRect 读取安全,非 scroll handler) */
|
|
164
|
-
onChange?: (entry: IntersectionObserverEntry, isIn: boolean) => void;
|
|
165
|
-
}
|
|
166
|
-
/** 可见性观察器 — useInView 的返回值 */
|
|
167
|
-
export interface UseInViewHandle {
|
|
168
|
-
/** 是否在可见区(响应式:变化自动 dirty 当前组件) */
|
|
169
|
-
isIn: boolean;
|
|
170
|
-
/** 是否已就绪(首次 IO 回调完成;未就绪时 isIn 为初始 false,组件应保守处理) */
|
|
171
|
-
ready: boolean;
|
|
172
|
-
/** 观察元素(ref 挂载时调用;传 null 断开) */
|
|
173
|
-
observe(el: HTMLElement | null): void;
|
|
174
|
-
/** 重建观察(rootMargin 等配置变化后调用) */
|
|
175
|
-
refresh(): void;
|
|
176
|
-
/** 手动断开观察 */
|
|
177
|
-
disconnect(): void;
|
|
178
|
-
}
|
|
179
|
-
/** 滚动位置跟踪配置 — 供 ctx.ui.useScrollPosition 使用 */
|
|
180
|
-
export interface UseScrollPositionOptions {
|
|
181
|
-
/** 滚动容器 getter(默认 window;内部滚动容器传 ref 元素) */
|
|
182
|
-
getScroller?: () => HTMLElement | Window;
|
|
183
|
-
}
|
|
184
|
-
/** 滚动位置跟踪器 — useScrollPosition 的返回值(y 响应式,变化自动 dirty 当前组件) */
|
|
185
|
-
export interface UseScrollPositionHandle {
|
|
186
|
-
/** 滚动位置(px,scrollY/scrollTop) */
|
|
187
|
-
y: number;
|
|
188
|
-
/** 手动重读一次滚动位置(不触发渲染) */
|
|
189
|
-
refresh(): void;
|
|
190
|
-
}
|
|
191
|
-
/** 应用上下文 */
|
|
192
|
-
/**
|
|
193
|
-
* 浏览器环境抽象(ctx.browser)——组件不直接引用 window/document:
|
|
194
|
-
* ① SSR 安全(shim 返回安全默认)② 测试可 mock(jsdom 无关)③ 复制等
|
|
195
|
-
* 重复模式统一。客户端由 createClientBrowser 实现,SSR 由 createSsrContext 注入。
|
|
196
|
-
*/
|
|
197
|
-
export interface BrowserEnv {
|
|
198
|
-
/** 当前焦点元素(键盘导航) */
|
|
199
|
-
activeElement(): HTMLElement | null;
|
|
200
|
-
/** 按 id 查询元素 */
|
|
201
|
-
byId(id: string): HTMLElement | null;
|
|
202
|
-
/** CSS 选择器查询元素 */
|
|
203
|
-
query(sel: string): HTMLElement | null;
|
|
204
|
-
/** CSS 选择器批量查询 */
|
|
205
|
-
queryAll(sel: string): NodeListOf<Element> | null;
|
|
206
|
-
/** 创建元素 */
|
|
207
|
-
createElement<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K] | null;
|
|
208
|
-
/** 创建 SVG/命名空间元素 */
|
|
209
|
-
createElementNS(ns: string, tag: string): Element | null;
|
|
210
|
-
/** 创建文档片段 */
|
|
211
|
-
createDocumentFragment(): DocumentFragment | null;
|
|
212
|
-
/** 创建注释节点 */
|
|
213
|
-
createComment(text: string): Comment | null;
|
|
214
|
-
/** 创建文本节点 */
|
|
215
|
-
createTextNode(text: string): Text | null;
|
|
216
|
-
/** 全局事件监听(scroll/resize/popstate 等) */
|
|
217
|
-
addEventListener(type: string, fn: (e: any) => void, options?: any): void;
|
|
218
|
-
/** 全局事件移除 */
|
|
219
|
-
removeEventListener(type: string, fn: (e: any) => void, options?: any): void;
|
|
220
|
-
/** 滚动到指定 y(window.scrollTo) */
|
|
221
|
-
scrollTo(y: number): void;
|
|
222
|
-
/** 媒体查询(组件 useMedia 入口) */
|
|
223
|
-
matchMedia(query: string): MediaQueryList | null;
|
|
224
|
-
/** 视觉视口(键盘弹起感知——完整对象,含 addEventListener 监听) */
|
|
225
|
-
visualViewport(): VisualViewport | null;
|
|
226
|
-
/** scrollingElement(滚动量读取优先源) */
|
|
227
|
-
scrollingElement(): Element | null;
|
|
228
|
-
/** body 引用(容器/断言) */
|
|
229
|
-
bodyElement(): HTMLElement | null;
|
|
230
|
-
/** body 追加/移除 */
|
|
231
|
-
bodyAppend(el: Node): void;
|
|
232
|
-
bodyRemove(el: Node): void;
|
|
233
|
-
/** 清空 body(测试清理 / 命令式重置) */
|
|
234
|
-
clearBody(): void;
|
|
235
|
-
/** 创建浏览器事件(Event/KeyboardEvent/PointerEvent——按 init 推断构造器) */
|
|
236
|
-
event(type: string, init?: any): Event;
|
|
237
|
-
/** 派发事件到目标(测试/命令式触发) */
|
|
238
|
-
dispatchEvent(target: EventTarget, evt: Event): boolean;
|
|
239
|
-
/** 编程式导航(history.pushState + popstate——路由驱动) */
|
|
240
|
-
navigate(url: string): void;
|
|
241
|
-
/** 整页重载(location.reload——SSR no-op;错误重试场景) */
|
|
242
|
-
reload(): void;
|
|
243
|
-
/** 文本遍历(TreeWalker) */
|
|
244
|
-
createTreeWalker(root: Node, whatToShow?: number): TreeWalker | null;
|
|
245
|
-
/** 复制文本(clipboard API + execCommand 降级,统一组件重复实现) */
|
|
246
|
-
copyText(text: string): Promise<boolean>;
|
|
247
|
-
/** 下载文本文件(Blob + a[download]——SSR no-op false;导出/报表用) */
|
|
248
|
-
downloadFile(filename: string, content: string, mime?: string): boolean;
|
|
249
|
-
/** execCommand(富文本编辑器) */
|
|
250
|
-
execCommand(cmd: string, value?: string): boolean;
|
|
251
|
-
/** 编辑器选区文本 */
|
|
252
|
-
selectionText(): string | null;
|
|
253
|
-
/** 编辑器选区对象(完整 Selection——Editor 需要 range 操作) */
|
|
254
|
-
getSelection(): Selection | null;
|
|
255
|
-
/** 编辑器格式状态查询(document.queryCommandState) */
|
|
256
|
-
queryCommandState(cmd: string): boolean;
|
|
257
|
-
/** 编辑器格式值查询(document.queryCommandValue) */
|
|
258
|
-
queryCommandValue(cmd: string): string;
|
|
259
|
-
/** 视口高度 */
|
|
260
|
-
viewportHeight(): number;
|
|
261
|
-
/** 视口宽度 */
|
|
262
|
-
viewportWidth(): number;
|
|
263
|
-
/** 当前位置路径(location.pathname) */
|
|
264
|
-
pathname(): string;
|
|
265
|
-
/** 滚动量(scrollingElement 优先) */
|
|
266
|
-
scrollTop(): number;
|
|
267
|
-
/** location.hash */
|
|
268
|
-
hash(): string;
|
|
269
|
-
setHash(h: string): void;
|
|
270
|
-
/** 定时器(SSR no-op) */
|
|
271
|
-
timeout(fn: () => void, ms: number): number;
|
|
272
|
-
/** 表单状态恢复监听(load/pageshow——浏览器刷新/后退导航覆盖受控 value 兜底) */
|
|
273
|
-
onFormRestore?(cb: () => void): () => void;
|
|
274
|
-
/** document.documentElement(主题应用) */
|
|
275
|
-
rootElement(): HTMLElement | null;
|
|
276
|
-
/** localStorage 读取(SSR/隐私模式返回 null) */
|
|
277
|
-
storageGet(key: string): string | null;
|
|
278
|
-
/** localStorage 写入(SSR/隐私模式 no-op) */
|
|
279
|
-
storageSet(key: string, value: string): void;
|
|
280
|
-
}
|
|
281
|
-
export interface WfuiContext {
|
|
282
|
-
[key: string]: unknown;
|
|
283
|
-
/** 浏览器环境抽象(SSR shim 安全默认)——组件禁直接 window/document */
|
|
284
|
-
browser?: BrowserEnv;
|
|
285
|
-
/** i18n(i18n() 中间件注入——运行时语言切换 + 应用级文案) */
|
|
286
|
-
i18n?: import('./i18n.ts').I18nState;
|
|
287
|
-
/** UI 框架能力(由 createApp.mount 注入) */
|
|
288
|
-
ui: {
|
|
289
|
-
/** 触发组件重渲染(无参 = 当前组件——同步调度(vdom3)或异步(兼容面)——
|
|
290
|
-
* 统一契约 void | Promise<void>:调用方不 await(fire-and-forget) */
|
|
291
|
-
render: (ids?: string[]) => void | Promise<void>;
|
|
292
|
-
/** 组件卸载钩子(mount 阶段注册——组件卸载时调用 fn;SSR no-op;返回退订) */
|
|
293
|
-
onUnmount?: (fn: () => void) => (() => void) | undefined;
|
|
294
|
-
/**
|
|
295
|
-
* AI 对话会话:$ 超集(会话语义 + 工具调用内嵌 + HITL 审批)
|
|
296
|
-
*
|
|
297
|
-
* ```tsx
|
|
298
|
-
* const $ = ctx.ui.useChat({ url: '/api/chat', approveUrl: '/api/approve' })
|
|
299
|
-
* // $.messages / $.input / $.streaming / $.error / $.usage / $.step
|
|
300
|
-
* // $.send() / $.stop() / $.retry() / $.clear() / $.approve(decision, note?)
|
|
301
|
-
* ```
|
|
302
|
-
*/
|
|
303
|
-
useChat: (options: UseChatOptions) => UseChatHandle;
|
|
304
|
-
/** 响应式媒体查询:注册监听,值变化时自动 dirty(立即回调一次当前值) */
|
|
305
|
-
useMedia: (query: string, callback: (matches: boolean) => void) => void;
|
|
306
|
-
/** 响应式断点:mobile/tablet/desktop 或自定义断点,值变化时自动 dirty */
|
|
307
|
-
useBreakpoint: (bpsOrCallback: Record<string, string> | ((vp: string) => void), callback?: (vp: string) => void) => void;
|
|
308
|
-
/** 弹层位置跟踪:滚动/resize 时自动重算 fixed 坐标 */
|
|
309
|
-
usePopupPosition: (options: PopupPositionOptions) => PopupPosition;
|
|
310
|
-
/**
|
|
311
|
-
* 弹层组合器:收敛 open 状态 + 触发(hover/tap 降级/longpress)+ Escape +
|
|
312
|
-
* 外部点击 + 定位/视口 clamp + portal。移动端友好由构造保证。
|
|
313
|
-
*
|
|
314
|
-
* ```ts
|
|
315
|
-
* const popup = ctx.ui.usePopup({
|
|
316
|
-
* trigger: 'hover', // 触屏自动降级 tap
|
|
317
|
-
* el: () => wrapEl,
|
|
318
|
-
* isOpen: () => $.open,
|
|
319
|
-
* setOpen: (v) => { $.open = v; ctx.ui.render() },
|
|
320
|
-
* width: 320, // 自动 clamp 视口
|
|
321
|
-
* })
|
|
322
|
-
* return () => h('div', { ref: wrapRef, ...popup.wrapProps }, [
|
|
323
|
-
* children, popup.portal(h('div', { class: 'wf-panel' }, content)),
|
|
324
|
-
* ].filter(Boolean))
|
|
325
|
-
* ```
|
|
326
|
-
*/
|
|
327
|
-
usePopup: (options: UsePopupOptions) => UsePopupHandle;
|
|
328
|
-
/** 当前设备是否支持 hover(matchMedia '(hover: hover)',mount 期一次判定) */
|
|
329
|
-
useHoverCapable: () => boolean;
|
|
330
|
-
/**
|
|
331
|
-
* 稳定 ref 引用(根治内联 ref 陷阱):mount 作用域持有,跨渲染引用恒等。
|
|
332
|
-
* ref-diff 在 ref 函数引用变化时调用旧 ref(null)——内联 ref 每次渲染都是新函数,
|
|
333
|
-
* 清理逻辑(退订/dispose)会反复触发而非仅在卸载时。
|
|
334
|
-
*
|
|
335
|
-
* ```tsx
|
|
336
|
-
* const listRef = ctx.ui.useStableRef(
|
|
337
|
-
* (el) => { instance = init(el) },
|
|
338
|
-
* () => { instance?.dispose() },
|
|
339
|
-
* )
|
|
340
|
-
* return () => h('div', { ref: listRef })
|
|
341
|
-
* ```
|
|
342
|
-
*/
|
|
343
|
-
useStableRef: (init: (el: HTMLElement | null) => void, cleanup?: () => void) => (el: HTMLElement | null) => void;
|
|
344
|
-
/**
|
|
345
|
-
* 全局键盘监听(window keydown):mount 注册、组件卸载自动清理;返回退订函数。
|
|
346
|
-
* 覆盖 Command 全局快捷键 / Img preview Escape 等 document/window 级键盘场景。
|
|
347
|
-
*
|
|
348
|
-
* ```tsx
|
|
349
|
-
* ctx.ui.useGlobalKey((e) => { if (e.key === 'k' && (e.ctrlKey || e.metaKey)) toggle() })
|
|
350
|
-
* ```
|
|
351
|
-
*/
|
|
352
|
-
useGlobalKey: (handler: (e: KeyboardEvent) => void) => () => void;
|
|
353
|
-
/**
|
|
354
|
-
* 指针拖拽(pointerdown 捕获 → window pointermove/up,up 自动释放):
|
|
355
|
-
* 覆盖 Resizable 等拖拽场景。返回 props spread 到拖拽把手。
|
|
356
|
-
*
|
|
357
|
-
* ```tsx
|
|
358
|
-
* const drag = ctx.ui.useDrag({ onMove: (_e, d) => { setSize(startSize + d.x) } })
|
|
359
|
-
* return () => h('div', { class: 'handle', ...drag })
|
|
360
|
-
* ```
|
|
361
|
-
*/
|
|
362
|
-
useDrag: (options: {
|
|
363
|
-
onStart?: (e: PointerEvent) => void;
|
|
364
|
-
onMove: (e: PointerEvent, delta: {
|
|
365
|
-
x: number;
|
|
366
|
-
y: number;
|
|
367
|
-
}) => void;
|
|
368
|
-
onEnd?: (e: PointerEvent) => void;
|
|
369
|
-
}) => {
|
|
370
|
-
onPointerDown: (e: PointerEvent) => void;
|
|
371
|
-
};
|
|
372
|
-
/**
|
|
373
|
-
* 原生 DnD(drop/dragover/dragleave,dragover 自动 preventDefault):
|
|
374
|
-
* 覆盖 FileUpload 等拖放区。返回 dropProps spread 到容器(VNode props,渲染器绑定/清理)。
|
|
375
|
-
*
|
|
376
|
-
* ```tsx
|
|
377
|
-
* const { dropProps } = ctx.ui.useDragDrop({ onDrop: (e) => files(e.dataTransfer) })
|
|
378
|
-
* return () => h('div', { class: 'zone', ...dropProps })
|
|
379
|
-
* ```
|
|
380
|
-
*/
|
|
381
|
-
useDragDrop: (options: {
|
|
382
|
-
onDrop?: (e: DragEvent) => void;
|
|
383
|
-
onDragOver?: (e: DragEvent) => void;
|
|
384
|
-
onDragLeave?: (e: DragEvent) => void;
|
|
385
|
-
/** 拖拽源侧:draggable + onDragStart/onDragEnd(返回 dragProps spread 到拖拽源) */
|
|
386
|
-
onDragStart?: (e: DragEvent) => void;
|
|
387
|
-
onDragEnd?: (e: DragEvent) => void;
|
|
388
|
-
}) => {
|
|
389
|
-
dropProps: Record<string, any>;
|
|
390
|
-
dragProps: Record<string, any>;
|
|
391
|
-
};
|
|
392
|
-
/**
|
|
393
|
-
* 订阅共享状态(render-only 共享原语——design 归档):
|
|
394
|
-
* mount 注册订阅(任何变化 → 自身重渲染),unmount 自动退订;返回 store 本身(活引用)。
|
|
395
|
-
* 参数契约:任何 { subscribe(cb): unsub } 的可订阅对象(createStore 产物 / useChat handle)。
|
|
396
|
-
*
|
|
397
|
-
* ```tsx
|
|
398
|
-
* const store = createStore({ count: 0 })
|
|
399
|
-
* const Comp = (_init, ctx) => {
|
|
400
|
-
* ctx.ui.useExternal(store)
|
|
401
|
-
* return () => h('div', {}, store.state.count)
|
|
402
|
-
* }
|
|
403
|
-
* ```
|
|
404
|
-
*/
|
|
405
|
-
useExternal: (store: {
|
|
406
|
-
subscribe(cb: () => void): () => void;
|
|
407
|
-
[key: string]: any;
|
|
408
|
-
}) => any;
|
|
409
|
-
/**
|
|
410
|
-
* 可视视口跟踪(visualViewport):键盘弹起/缩放时自动更新 + dirty。
|
|
411
|
-
* 无 visualViewport(桌面)降级 innerHeight。fixed 底部栏防键盘遮挡用。
|
|
412
|
-
*/
|
|
413
|
-
useVisualViewport: () => VisualViewportHandle;
|
|
414
|
-
/**
|
|
415
|
-
* 长按手势:pointerdown 按住 duration 触发,提前松开/位移取消,桌面右键兼容。
|
|
416
|
-
* 返回的 props spread 到目标元素。
|
|
417
|
-
*/
|
|
418
|
-
useLongPress: (options: UseLongPressOptions) => UseLongPressHandle;
|
|
419
|
-
/**
|
|
420
|
-
* 可见性观察(IntersectionObserver 封装):替代组件自建 scroll 监听。
|
|
421
|
-
* IO 在合成器线程评估,滚动/尺寸变化自动触发,无 scroll-linked 定位警告。
|
|
422
|
-
*
|
|
423
|
-
* ```tsx
|
|
424
|
-
* const inView = ctx.ui.useInView({
|
|
425
|
-
* rootMargin: () => `-${propsRef.offsetTop ?? 0}px 0px 0px 0px`,
|
|
426
|
-
* })
|
|
427
|
-
* const ref = (el) => inView.observe(el)
|
|
428
|
-
* return () => h('div', { ref }, fixed = !inView.isIn ...)
|
|
429
|
-
* ```
|
|
430
|
-
*/
|
|
431
|
-
useInView: (options: UseInViewOptions) => UseInViewHandle;
|
|
432
|
-
/**
|
|
433
|
-
* 滚动位置跟踪(全局 scroll 监听 + rAF 节流,仿 usePopupPosition):
|
|
434
|
-
* 返回响应式 scrollY/scrollTop,变化自动 dirty 当前组件。替代组件自建 scroll 监听。
|
|
435
|
-
*
|
|
436
|
-
* ```tsx
|
|
437
|
-
* const scroll = ctx.ui.useScrollPosition({ getScroller: () => wrapEl })
|
|
438
|
-
* return () => h('div', { ref }, fixed = scroll.y >= threshold)
|
|
439
|
-
* ```
|
|
440
|
-
*/
|
|
441
|
-
useScrollPosition: (options: UseScrollPositionOptions) => UseScrollPositionHandle;
|
|
442
|
-
/**
|
|
443
|
-
* 异步取数工具(mount 阶段调用):loading/error 自动管理 + 数据就绪自动渲染。
|
|
444
|
-
*
|
|
445
|
-
* ```tsx
|
|
446
|
-
* const list = ctx.ui.useAsync(() => ctx.api.get<User[]>('/users'))
|
|
447
|
-
* return () => list.loading ? h(Loading) : list.data?.map(...)
|
|
448
|
-
* ```
|
|
449
|
-
* data/loading/error 响应式;reload() 重跑;组件卸载后旧 Promise resolve 不再触发渲染。
|
|
450
|
-
*/
|
|
451
|
-
useAsync: <T = any>(fetcher: () => Promise<T>) => UseAsyncHandle<T>;
|
|
452
|
-
/**
|
|
453
|
-
* 受控/非受控状态统一(收敛组件库重复的受控判定 + 缺回调 warn):
|
|
454
|
-
* value !== undefined → 受控(setValue 只走 onChange,值由父组件回流);
|
|
455
|
-
* 否则 → 内部状态 + 自动 render。受控但缺 onChange 时 console.warn 一次(按 name 幂等)。
|
|
456
|
-
*
|
|
457
|
-
* ```tsx
|
|
458
|
-
* const ctrl = ctx.ui.useControlled({ value: props.value, onChange: props.onChange, name: 'Collapse' })
|
|
459
|
-
* const open = ctrl.value ?? false
|
|
460
|
-
* // 交互:ctrl.setValue(!open)
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
|
-
useControlled: <T>(options: {
|
|
464
|
-
value?: T;
|
|
465
|
-
onChange?: (v: T) => void;
|
|
466
|
-
name?: string;
|
|
467
|
-
}) => {
|
|
468
|
-
value: T | undefined;
|
|
469
|
-
setValue: (v: T) => void;
|
|
470
|
-
controlled: boolean;
|
|
471
|
-
};
|
|
472
|
-
/** 受控输入原语(C3):useControlled + 内部输入态/选中态(keyword/selectedLabel) */
|
|
473
|
-
useControlledInput: (options: {
|
|
474
|
-
value?: string;
|
|
475
|
-
onChange?: (v: string) => void;
|
|
476
|
-
name?: string;
|
|
477
|
-
}) => {
|
|
478
|
-
value: string | undefined;
|
|
479
|
-
setValue: (v: string) => void;
|
|
480
|
-
controlled: boolean;
|
|
481
|
-
keyword: string;
|
|
482
|
-
setKeyword: (v: string) => void;
|
|
483
|
-
selectedLabel: string;
|
|
484
|
-
setSelectedLabel: (v: string) => void;
|
|
485
|
-
};
|
|
486
|
-
/** 显隐打开状态机(C4):trigger/focus 协调(onClick 只开——防 focus 开+click 关冲突);弹层双向场景用 open/setOpen(受控走 onOpenChange + 缺回调 warn) */
|
|
487
|
-
useOpen: (options: {
|
|
488
|
-
open?: boolean;
|
|
489
|
-
onOpenChange?: (open: boolean) => void;
|
|
490
|
-
openOnFocus?: boolean;
|
|
491
|
-
name?: string;
|
|
492
|
-
}) => {
|
|
493
|
-
open: boolean;
|
|
494
|
-
setOpen: (open: boolean) => void;
|
|
495
|
-
triggerProps: {
|
|
496
|
-
onClick: () => void;
|
|
497
|
-
onFocus: () => void;
|
|
498
|
-
};
|
|
499
|
-
};
|
|
500
|
-
usePresence: (options?: {
|
|
501
|
-
name?: string;
|
|
502
|
-
}) => {
|
|
503
|
-
phase: 'closed' | 'open' | 'exit';
|
|
504
|
-
/** 挂到根元素(animationend 监听:exit 结束才真正卸载) */
|
|
505
|
-
ref: (el: HTMLElement | null) => void;
|
|
506
|
-
/** render 阶段同步 open → 返回当前 phase */
|
|
507
|
-
sync: (open: boolean) => 'closed' | 'open' | 'exit';
|
|
508
|
-
};
|
|
509
|
-
/** 响应式系统偏好(prefers-reduced-motion):JS 动画(rAF/tween)侧跳过用。
|
|
510
|
-
* CSS 动画已有 _base.css 全局降级(0.01ms)——此原语覆盖 JS 动画路径。 */
|
|
511
|
-
useReducedMotion: () => boolean;
|
|
512
|
-
/** 数值补间(rAF + ease + reduced-motion 直落终值):count-up / 进度 / 指示器。
|
|
513
|
-
* 目标值变化自动补间;返回 `{ value }`(当前值,render 读)。 */
|
|
514
|
-
useTween: (target: number, opts?: {
|
|
515
|
-
duration?: number;
|
|
516
|
-
ease?: 'linear' | 'easeOutCubic';
|
|
517
|
-
}) => {
|
|
518
|
-
value: number;
|
|
519
|
-
/** 重设目标(幂等:同目标且动画运行中不重启——render 每帧调用安全) */
|
|
520
|
-
reset: (to: number) => void;
|
|
521
|
-
};
|
|
522
|
-
/** 注册组件实例的自定义语义 ID,同名冲突抛错 */
|
|
523
|
-
selfId: (name: string) => void;
|
|
524
|
-
/** 当前组件实例 ID(仅供内部使用,通过 ctx 扩展注入) */
|
|
525
|
-
_selfId?: string;
|
|
526
|
-
/** 当前组件 VNode 引用(仅供内部使用,通过 ctx 扩展注入) */
|
|
527
|
-
_selfVNode?: VNode;
|
|
528
|
-
};
|
|
529
|
-
/** 路由(由 router 中间件注入) */
|
|
530
|
-
route?: {
|
|
531
|
-
path: string;
|
|
532
|
-
params: Record<string, string>;
|
|
533
|
-
query: Record<string, string>;
|
|
534
|
-
[key: string]: any;
|
|
535
|
-
};
|
|
536
|
-
/** 应用方法 */
|
|
537
|
-
app?: {
|
|
538
|
-
navigate: (path: string) => void;
|
|
539
|
-
[key: string]: any;
|
|
540
|
-
};
|
|
541
|
-
/** WebSocket 客户端(由 ws 中间件注入) */
|
|
542
|
-
ws?: {
|
|
543
|
-
send: (msg: any) => void;
|
|
544
|
-
onMessage: (fn: (msg: any) => void) => () => void;
|
|
545
|
-
isConnected: boolean;
|
|
546
|
-
[key: string]: any;
|
|
547
|
-
};
|
|
548
|
-
/** API 客户端(由 api 中间件注入);options 为 ApiRequestOptions 形状(headers/signal) */
|
|
549
|
-
api?: {
|
|
550
|
-
get: <T = any>(url: string, options?: {
|
|
551
|
-
headers?: Record<string, string>;
|
|
552
|
-
signal?: AbortSignal;
|
|
553
|
-
}) => Promise<T>;
|
|
554
|
-
post: <T = any>(url: string, body?: unknown, options?: {
|
|
555
|
-
headers?: Record<string, string>;
|
|
556
|
-
signal?: AbortSignal;
|
|
557
|
-
}) => Promise<T>;
|
|
558
|
-
put: <T = any>(url: string, body?: unknown, options?: {
|
|
559
|
-
headers?: Record<string, string>;
|
|
560
|
-
signal?: AbortSignal;
|
|
561
|
-
}) => Promise<T>;
|
|
562
|
-
patch: <T = any>(url: string, body?: unknown, options?: {
|
|
563
|
-
headers?: Record<string, string>;
|
|
564
|
-
signal?: AbortSignal;
|
|
565
|
-
}) => Promise<T>;
|
|
566
|
-
delete: <T = any>(url: string, options?: {
|
|
567
|
-
headers?: Record<string, string>;
|
|
568
|
-
signal?: AbortSignal;
|
|
569
|
-
}) => Promise<T>;
|
|
570
|
-
[key: string]: any;
|
|
571
|
-
};
|
|
572
|
-
/** 数据管道(由 createApp 注入):ctx.data.get(key, fetcher) */
|
|
573
|
-
data?: {
|
|
574
|
-
/**
|
|
575
|
-
* 获取数据:
|
|
576
|
-
* - SSR:服务端真 fetch,结果序列化进 __DATA__
|
|
577
|
-
* - hydration:从 __DATA__ 缓存同步命中(工厂 await 微任务即 resolve)
|
|
578
|
-
* - SPA:未命中则触发 fetcher,同 key 并发请求合并
|
|
579
|
-
*
|
|
580
|
-
* key 约定即 URL(`/api/posts/1`),天然唯一。
|
|
581
|
-
*/
|
|
582
|
-
get: <T = any>(key: string, fetcher?: () => Promise<T>) => Promise<T>;
|
|
583
|
-
/** 向缓存写入值(如 hydration 种子) */
|
|
584
|
-
set: (key: string, value: unknown) => void;
|
|
585
|
-
/** 是否存在缓存(未触发 fetch) */
|
|
586
|
-
has: (key: string) => boolean;
|
|
587
|
-
[key: string]: any;
|
|
588
|
-
};
|
|
589
|
-
/** 认证状态 */
|
|
590
|
-
auth?: {
|
|
591
|
-
token: string | null;
|
|
592
|
-
user: any;
|
|
593
|
-
isLoggedIn: boolean;
|
|
594
|
-
login: (token: string, user: any, refreshToken?: string) => void;
|
|
595
|
-
logout: () => void;
|
|
596
|
-
[key: string]: any;
|
|
597
|
-
};
|
|
598
|
-
/** 命令式确认(由 components 的 confirm() 中间件注入):ctx.confirm(msg) → Promise<boolean> */
|
|
599
|
-
confirm?: (message: string, options?: Record<string, any>) => Promise<boolean>;
|
|
600
|
-
/** 命令式轻提示(由 components 的 toast() 中间件注入):ctx.toast(msg, type?, duration?, action?) */
|
|
601
|
-
toast?: (message: string, type?: string, duration?: number, action?: {
|
|
602
|
-
label: string;
|
|
603
|
-
onClick: () => void;
|
|
604
|
-
}) => void;
|
|
605
|
-
}
|
|
606
|
-
/** 中间件签名 */
|
|
607
|
-
/**
|
|
608
|
-
* 前端中间件:输入 ctx 需要 I,输出 ctx 注入 O(链式累积,createApp().use() 类型自动合并)
|
|
609
|
-
* api() → AppMiddleware<{}, ApiInjected> 注入 ctx.api
|
|
610
|
-
* router()→ AppMiddleware<{}, RouteInjected> 注入 ctx.route / ctx.app
|
|
611
|
-
*/
|
|
612
|
-
export type AppMiddleware<I extends object = {}, O extends object = I> = (ctx: WfuiContext & I) => (WfuiContext & O) | Promise<WfuiContext & O>;
|
|
613
|
-
/** 路由定义 */
|
|
614
|
-
export interface RouteDef {
|
|
615
|
-
path: string;
|
|
616
|
-
component?: (props: any, ctx: WfuiContext) => any;
|
|
617
|
-
layout?: (props: any, ctx: WfuiContext) => any;
|
|
618
|
-
children?: RouteDef[];
|
|
619
|
-
auth?: boolean;
|
|
620
|
-
title?: string;
|
|
621
|
-
[key: string]: any;
|
|
622
|
-
}
|
|
623
|
-
/** 扩展 ctx — 创建新对象,原 ctx 的 getter 通过原型链继承 */
|
|
624
|
-
export declare function extendCtx<T extends Record<string, unknown>>(ctx: WfuiContext, fields: T): WfuiContext & T;
|
|
625
|
-
/** SSR 数据种子(ssr.ts 序列化进 window.__DATA__ 脚本,hydration 时客户端读取) */
|
|
626
|
-
declare global {
|
|
627
|
-
interface Window {
|
|
628
|
-
__DATA__?: Record<string, unknown>;
|
|
629
|
-
}
|
|
630
|
-
var __DATA__: Record<string, unknown> | undefined;
|
|
631
|
-
}
|
|
632
|
-
export {};
|
|
633
|
-
/** 组件 ctx:WfuiContext(vdom3 V3Ctx extends 统一——组件声明面) */
|
|
634
|
-
/** 路由由 vdom3 createRouter(RouteDef)统一承担——UIRouter 时代类型已删除 */
|