weifuwu 0.85.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} +153 -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/client/components/Editor/Editor.d.ts +14 -0
- package/dist/client/components/Editor/edit-events.d.ts +27 -0
- package/dist/client/components/Editor/model/apply.d.ts +23 -0
- package/dist/client/components/Editor/model/diff.d.ts +25 -0
- package/dist/client/components/Editor/model/dom.d.ts +27 -0
- package/dist/client/components/Editor/model/history.d.ts +21 -0
- package/dist/client/components/Editor/model/html.d.ts +16 -0
- package/dist/client/components/Editor/model/inverse.d.ts +20 -0
- package/dist/client/components/Editor/model/types.d.ts +116 -0
- package/dist/client/components/Editor/tools/table.d.ts +10 -0
- package/dist/{components → client/components}/Editor/tools/toolbar.d.ts +2 -2
- package/dist/client/components/Editor/tools/types.d.ts +40 -0
- 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/client/components/FilePreview/FilePreview.d.ts +42 -0
- package/dist/client/components/FilePreview/markdown.d.ts +23 -0
- 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/client/components/OfficeEditor/ai/ai-bridge.d.ts +39 -0
- package/dist/client/components/OfficeEditor/model/apply.d.ts +25 -0
- package/dist/client/components/OfficeEditor/model/types.d.ts +224 -0
- 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/client/components/SheetGrid/SheetGrid.d.ts +30 -0
- package/dist/{components → client/components}/Skeleton/Skeleton.d.ts +1 -1
- package/dist/client/components/SlideCanvas/SlideCanvas.d.ts +28 -0
- 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 +48 -2
- package/dist/client/components/index.js +57 -0
- package/dist/{components → client/components}/style.css +3554 -1896
- package/dist/{layout → client/layout}/weifuwu-layout.css +60 -6
- package/dist/client/office/docx.d.ts +33 -0
- package/dist/client/office/pptx.d.ts +24 -0
- package/dist/client/office/xlsx.d.ts +25 -0
- package/dist/client/office/xml-serialize.d.ts +18 -0
- package/dist/client/office/xml.d.ts +21 -0
- package/dist/client/office/zip.d.ts +21 -0
- 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} +3147 -2462
- 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 +16 -4
- 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/Editor/Editor.d.ts +0 -13
- package/dist/components/Editor/tools/format.d.ts +0 -11
- package/dist/components/Editor/tools/table.d.ts +0 -7
- package/dist/components/Editor/tools/types.d.ts +0 -15
- package/dist/components/Slider/Slider.d.ts +0 -19
- package/dist/components/Tabs/Tabs.d.ts +0 -12
- package/dist/components/index.js +0 -15
- 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 -55
- package/dist/ui-dom/locale/zh_CN.d.ts +0 -55
- 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 -632
- 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 -48
- 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}/Markdown/parser.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/{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
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ctx.ui.useChat — AI 会话语义层(client)
|
|
3
|
-
*
|
|
4
|
-
* 在 aiStream(传输解码)之上加一层「一段对话」的语义:
|
|
5
|
-
* 消息累积、工具调用内嵌、HITL 审批、错误恢复、stop/retry/clear。
|
|
6
|
-
*
|
|
7
|
-
* - 协议透明:消费 wf: 事件(docs/ai-contract.md),页面不需要知道事件名
|
|
8
|
-
* - 状态即共享 store(render-only 方案——design 归档):
|
|
9
|
-
* state 是**普通对象**(非 Proxy),变化 → notify() → 订阅者(useExternal)重渲染;
|
|
10
|
-
* handle 带 subscribe——可被 useExternal 订阅(AiChat 等共享会话的子组件)
|
|
11
|
-
* - 就地累积:token 经 state.messages[idx] 就地 append(O(1)/token,
|
|
12
|
-
* 不重建数组;配合 key 稳定引用 → VDOM 只 patch 文本节点)
|
|
13
|
-
* - 工具内嵌:wf:tool_call/progress/result 按 toolCallId/id 聚合到
|
|
14
|
-
* 消息的 toolCalls[],ToolCallCard 直接消费(call/progress/result)
|
|
15
|
-
* - 审批:approval 挂消息,approve() POST approveUrl(协议 §4.5)
|
|
16
|
-
* - 生命周期:dispose() 中止流(组件卸载时调用;卸载防泄漏)
|
|
17
|
-
*
|
|
18
|
-
* 核心与框架无关:transport 注入(默认 aiStream),node 直接测。
|
|
19
|
-
*/
|
|
20
|
-
import type { AiStreamCallbacks, AiStreamHandle } from './ai.ts';
|
|
21
|
-
import type { ChatMessage, WfApprovalDecision, WfApprovalRequest, WfError, WfStep, WfToolCall, WfToolProgress, WfToolResult, WfUsage } from '../ai/types.ts';
|
|
22
|
-
/** 工具调用显示条目:ToolCallCard 的三个 props 聚合 + 状态机 */
|
|
23
|
-
export interface UiToolCall {
|
|
24
|
-
call: WfToolCall;
|
|
25
|
-
progress?: WfToolProgress;
|
|
26
|
-
result?: WfToolResult;
|
|
27
|
-
status: 'running' | 'ok' | 'error';
|
|
28
|
-
}
|
|
29
|
-
/** 对话消息(显示模型):provider 形状 + UI 状态字段 */
|
|
30
|
-
export interface UiMessage {
|
|
31
|
-
id: string;
|
|
32
|
-
role: 'user' | 'assistant';
|
|
33
|
-
content: string;
|
|
34
|
-
/** thinking 模式推理过程(wf:done 下发后挂上,ReasoningBlock 展示) */
|
|
35
|
-
reasoning?: string;
|
|
36
|
-
status: 'streaming' | 'done' | 'error';
|
|
37
|
-
usage?: WfUsage;
|
|
38
|
-
toolCalls?: UiToolCall[];
|
|
39
|
-
approval?: WfApprovalRequest;
|
|
40
|
-
error?: WfError;
|
|
41
|
-
}
|
|
42
|
-
/** useChat 会话状态(普通对象 + 订阅——不再挂组件 $) */
|
|
43
|
-
export interface UseChatState {
|
|
44
|
-
messages: UiMessage[];
|
|
45
|
-
input: string;
|
|
46
|
-
streaming: boolean;
|
|
47
|
-
error: WfError | null;
|
|
48
|
-
usage: WfUsage | null;
|
|
49
|
-
/** 最近 wf:step(思考/工具指示),done/error 时清空 */
|
|
50
|
-
step: WfStep | null;
|
|
51
|
-
/** 页面自有状态与 chat 状态共处一个 store(订阅者共享) */
|
|
52
|
-
[key: string]: any;
|
|
53
|
-
}
|
|
54
|
-
/** useChat 操作(挂到 state 上的方法;调用不触发渲染,内部 notify 触发) */
|
|
55
|
-
export interface ChatApi {
|
|
56
|
-
/** 发送当前输入:追加 user + assistant 占位 → POST url */
|
|
57
|
-
send: () => void;
|
|
58
|
-
/** 中止当前流;空占位移除,有内容则标记 done */
|
|
59
|
-
stop: () => void;
|
|
60
|
-
/** 截断到最后一条 user 消息并重新生成其回复(错误恢复) */
|
|
61
|
-
retry: () => void;
|
|
62
|
-
/** 清空会话并中止 */
|
|
63
|
-
clear: () => void;
|
|
64
|
-
/** 响应 HITL 审批(协议 §4.5):清卡片 + POST approveUrl;modified 决策带修改后参数 */
|
|
65
|
-
approve: (decision: WfApprovalDecision, note?: string, modifiedArgs?: Record<string, unknown>) => Promise<void>;
|
|
66
|
-
/** 中止流并释放(组件卸载时调用) */
|
|
67
|
-
dispose: () => void;
|
|
68
|
-
}
|
|
69
|
-
/** useChat 返回句柄:状态 + 方法 + subscribe(可被 useExternal 订阅——AiChat 等共享子组件) */
|
|
70
|
-
export type UseChatHandle = UseChatState & ChatApi & {
|
|
71
|
-
/** 订阅会话状态变更(任何变化 → cb);返回退订 */
|
|
72
|
-
subscribe: (cb: () => void) => () => void;
|
|
73
|
-
};
|
|
74
|
-
export interface UseChatOptions {
|
|
75
|
-
/** POST 端点(返回 wf: SSE 流) */
|
|
76
|
-
url: string;
|
|
77
|
-
/** HITL 审批上行端点(协议 §4.5);缺省时 approve() 只清卡片不请求 */
|
|
78
|
-
approveUrl?: string;
|
|
79
|
-
/** 历史会话种子(app 数据注入;hook 不持有持久化) */
|
|
80
|
-
initialMessages?: UiMessage[];
|
|
81
|
-
/** 定制请求体(agent 模式携带 tools/mode 等);缺省 { messages } */
|
|
82
|
-
body?: (messages: UiMessage[]) => unknown;
|
|
83
|
-
headers?: Record<string, string>;
|
|
84
|
-
signal?: AbortSignal;
|
|
85
|
-
/** x:* 自定义事件透传(协议 §6) */
|
|
86
|
-
onEvent?: (name: string, data: unknown) => void;
|
|
87
|
-
}
|
|
88
|
-
/** 传输层(默认 aiStream):POST + SSE 解析 + abort */
|
|
89
|
-
export type ChatTransport = (url: string, body: unknown, callbacks: AiStreamCallbacks, opts?: {
|
|
90
|
-
signal?: AbortSignal;
|
|
91
|
-
headers?: Record<string, string>;
|
|
92
|
-
}) => AiStreamHandle;
|
|
93
|
-
/** UiMessage[] → provider ChatMessage[](剥离 UI 字段;reasoning 回传——thinking 模式闭环) */
|
|
94
|
-
export declare function toChatMessages(msgs: UiMessage[]): ChatMessage[];
|
|
95
|
-
export declare function createChatSession(state: UseChatState, transport: ChatTransport, options: UseChatOptions, notify?: () => void): ChatApi;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
/**
|
|
3
|
-
* vdom3 — vnode + stream 前端引擎(2026-08)
|
|
4
|
-
*
|
|
5
|
-
* 与 vdom2 的差异:**渲染执行 = 事件流**(vnode 树保留声明式——renderFn 输出完整树)。
|
|
6
|
-
*
|
|
7
|
-
* vdom2:状态 → renderFn → vnode 树 → diff(命令式比较)→ DOM 变更 + 旁路事件记录
|
|
8
|
-
* vdom3:状态 → renderFn → vnode 树 → **渲染事件流**(CREATE/INSERT/UPDATE/REMOVE)
|
|
9
|
-
* → 执行器消费事件 → DOM(事件流是引擎本体——DOM = fold(事件流))
|
|
10
|
-
*
|
|
11
|
-
* 核心不变量:
|
|
12
|
-
* 1. vnode 树保留声明式(与 vdom2 同模型——两阶段组件兼容)
|
|
13
|
-
* 2. 渲染即事件:节点创建/属性设置/文本更新/插入/移除都是事件(可回放/取消/断言)
|
|
14
|
-
* 3. DOM = fold(事件流):初始 DOM + 事件序列 = 任意时刻 DOM(时间旅行)
|
|
15
|
-
* 4. 更新最小化:同位置同类型(含 key)复用——仅变化发事件
|
|
16
|
-
* (TEXT_UPDATE/PROP_UPDATE——无整树 diff 决策噪音;异类型 → 重建事件)
|
|
17
|
-
*
|
|
18
|
-
* 事件流覆盖(location → DOM)——统一命名:对象 + 动作 + 参数(entity + action + target + payload):
|
|
19
|
-
* route:change → comp:mount → node:text:create → node:insert → prop:text:update
|
|
20
|
-
* → node:remove/move(更新时)→ comp:unmount
|
|
21
|
-
* 每层同构:location(route:change)/ jsx(comp:render·build·mount·unmount、props:update)
|
|
22
|
-
* / vdom(vnode:patch 决策——strategy 参数)/ dom(node:text:prop:event:ref 的 create·insert·
|
|
23
|
-
* remove·move·update·bind·unbind·cleanup)——任何事件触发最终落到 dom 层的精准状态变化
|
|
24
|
-
*
|
|
25
|
-
* 模块:
|
|
26
|
-
* types.ts — VNode(native/文本/Fragment)+ V3Event + EventStream 契约
|
|
27
|
-
* jsx.ts — h(vnode 创建——单数组参数自动展开)
|
|
28
|
-
* render.ts — mount/patch:树 → 事件流 → DOM(同类型复用/异类型重建/文本属性特判)
|
|
29
|
-
* events.ts — 事件流(记录/回放/逆操作/断言——DOM = fold(events))
|
|
30
|
-
*
|
|
31
|
-
* 与 vdom2 并行(不兼容演进)——vdom2 资产保留,vdom3 验证「事件流即执行」范式。
|
|
32
|
-
*/
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 app — 应用注册表(多应用加载——app 节点消费)
|
|
3
|
-
*
|
|
4
|
-
* registerApp(appId, factory):注册子应用(factory 返回子应用根 vnode——
|
|
5
|
-
* 可 await 初始化——应用实例状态由工厂闭包持有——appId 复用不重跑)。
|
|
6
|
-
* 渲染时(app 节点 build):查注册表 → 工厂调用(首次/应用实例复用)→
|
|
7
|
-
* 子应用根在父流构建——app:* 边界事件(mount/update/unmount/error——带 appId)。
|
|
8
|
-
*
|
|
9
|
-
* 不隔离设计(design/vdom3-app-node.md):共享流/全局 id——天然归属唯一——
|
|
10
|
-
* app 的价值 = 应用编排(注册表 + 生命周期 + 边界事件)。
|
|
11
|
-
*/
|
|
12
|
-
import type { VNode, V3Ctx } from './types.ts';
|
|
13
|
-
/** 子应用工厂:(props, ctx) => 子应用根 vnode(可 await——应用初始化) */
|
|
14
|
-
export type AppFactory = (props: Record<string, unknown>, ctx: V3Ctx) => Promise<VNode> | VNode;
|
|
15
|
-
/** 注册子应用(模块级——appId 全局唯一) */
|
|
16
|
-
export declare function registerApp(appId: string, factory: AppFactory): void;
|
|
17
|
-
/** 查询(app 节点 build 消费——未注册返回 null——app:error unknown-app) */
|
|
18
|
-
export declare function getAppFactory(appId: string): AppFactory | null;
|
|
19
|
-
/** 测试隔离 */
|
|
20
|
-
export declare function resetAppRegistry(): void;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 audit — 开发期不变量校验(防御——测试之外的第二道防线)
|
|
3
|
-
*
|
|
4
|
-
* 启用:__WF_V3_AUDIT !== '0'(默认开——与 vdom2 audit 对齐)。
|
|
5
|
-
* 校验点(渲染后):
|
|
6
|
-
* 1. 孤儿节点:DOM 中 data-v3-id 节点在 registry 有记录(patch 泄漏检测)
|
|
7
|
-
* 2. vnode/DOM 一致性:有 el 的 children 项在 DOM 中的顺序与 children 顺序一致
|
|
8
|
-
* (空洞错位——prevNode 锚修复的回归防线)
|
|
9
|
-
* 校验失败 → console.warn('[vdom3/audit] ...')(不中断渲染——观测性)
|
|
10
|
-
*/
|
|
11
|
-
import type { VNode } from './types.ts';
|
|
12
|
-
/** 渲染后校验(patch 完成调用——root 为挂载容器) */
|
|
13
|
-
export declare function auditAfterRender(root: Element): void;
|
|
14
|
-
/** vnode/DOM 顺序一致性(children 有 el 的项——DOM 顺序 = children 顺序)
|
|
15
|
-
* 索引比较(父下 childNodes indexOf——无 compareDocumentPosition 的跨树/同节点歧义) */
|
|
16
|
-
export declare function auditOrder(_el: Element, v: VNode): void;
|
|
17
|
-
/**
|
|
18
|
-
* DOM ↔ 事件流对照审计(不变量"无事件流不渲染"的运行时守护——dev 模式)
|
|
19
|
-
*
|
|
20
|
-
* 启用:__WF_VDOM_AUDIT === '1'(独立开关——默认关——审计开销仅 dev)。
|
|
21
|
-
* 机制:MutationObserver 观察挂载点(childList——added/removedNodes)——
|
|
22
|
-
* 对照事件流(node:insert/remove 的 target)——无事件对应的 DOM 结构变化
|
|
23
|
-
* = 绕过点(静默渲染)——warn。
|
|
24
|
-
* 例外(白名单):无 data-v3-id 的节点(内部容器/文本包装);挂载点自身清空
|
|
25
|
-
* (mount/unmount——初始/销毁语义)。
|
|
26
|
-
*/
|
|
27
|
-
export declare function auditDomEvents(root: Element, getRecent: () => Array<{
|
|
28
|
-
target?: string;
|
|
29
|
-
}>): () => void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 build — 异步组件构建(两阶段组件 → 纯 vnode 树)
|
|
3
|
-
*
|
|
4
|
-
* 与 vdom2 同模型:先 await 组件工厂 + renderFn → 构建产物(纯树)→ 同步渲染。
|
|
5
|
-
* 组件实例复用:同位置同类型(patch 判定)→ 工厂不重跑(内部状态保持)。
|
|
6
|
-
*/
|
|
7
|
-
import type { VNode, PortalVNode, V3Ctx } from './types.ts';
|
|
8
|
-
import { Fragment } from './types.ts';
|
|
9
|
-
export declare function runUnmountHooks(id: string): void;
|
|
10
|
-
export declare function isVNode(v: unknown): v is VNode;
|
|
11
|
-
/** 构建 vnode 树(组件展开——异步;native/text 同步递归)——**纯函数式**:
|
|
12
|
-
* 每层返回克隆(不就地修改入参)——update 的对照树(current)不被污染。
|
|
13
|
-
* oldV:旧树同位置对照——同类型组件复用 _render(工厂不重跑——内部状态保持)。
|
|
14
|
-
* isRoot:整树 rerender(createRoot/router 顶层)——根组件不剪枝(内部状态
|
|
15
|
-
* (闭包 let)变化时 props 不变——剪枝跳过 renderFn = 读旧闭包值;根必须重跑。
|
|
16
|
-
* 嵌套剪枝保留:子组件内部状态由自身 ctx.render(组件级——绕开 build)维护,
|
|
17
|
-
* 父重跑时剪枝复用其最新输出——安全。 */
|
|
18
|
-
export declare function buildVNode(vnode: VNode, ctx: V3Ctx, oldV?: VNode | null, isRoot?: boolean): Promise<VNode>;
|
|
19
|
-
export declare function isPortal(v: unknown): v is PortalVNode;
|
|
20
|
-
export { Fragment };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 commands — 命令式中间件(confirm/toast——vdom2 mountCommand 的 vdom3 等价)
|
|
3
|
-
*
|
|
4
|
-
* vdom2 的 confirm()/toast()(组件库)用 mountCommand 挂载——依赖 vdom2 引擎。
|
|
5
|
-
* vdom3 适配:复用 Confirm/Toast 组件(vdom2 组件——hooks shim 可跑)——
|
|
6
|
-
* createRoot 挂载到命令式容器——resolve 时 handle.unmount 清理。
|
|
7
|
-
*/
|
|
8
|
-
/** 命令式中间件注入类型(confirm/toast 挂到 ctx——中间件面) */
|
|
9
|
-
export interface V3CommandInjected {
|
|
10
|
-
confirm(message: string, options?: Record<string, unknown>): Promise<boolean>;
|
|
11
|
-
toast(message: string, variant?: 'success' | 'error' | 'warning' | 'info'): void;
|
|
12
|
-
}
|
|
13
|
-
/** 命令式确认(vdom3——createRoot 挂载 Confirm 组件——Modal portal 退场)
|
|
14
|
-
* 泛型 ctx(兼容 UIRouter(WfuiContext)与 vdom3(V3Ctx)双入口) */
|
|
15
|
-
export declare function v3Confirm<C extends {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}>(): (ctx: C) => C & V3CommandInjected;
|
|
18
|
-
/** 命令式轻提示(vdom3——createRoot 挂载 Toast 组件——自动消失) */
|
|
19
|
-
export declare function v3Toast<C extends {
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
}>(): (ctx: C) => C & V3CommandInjected;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 comp-index — 组件实例索引(组件 id → 当前树 vnode 引用)
|
|
3
|
-
*
|
|
4
|
-
* 优化:updateComponent(组件级更新——ctx.render 高频路径)原为 DFS 整树
|
|
5
|
-
* 定位(O(树大小))——滚动跟随 renderByIds 每帧多次——大应用热点。
|
|
6
|
-
* 索引定位 O(1)——注册(build 组件分支)/ 注销(组件移除)/ miss 回退 DFS(防御)。
|
|
7
|
-
*
|
|
8
|
-
* id 全局唯一(nextNodeId)——索引全局——与 delegate 注册表同模式。
|
|
9
|
-
*/
|
|
10
|
-
import type { VNode } from './types.ts';
|
|
11
|
-
/** 注册(build 组件分支——mount/reuse 时——指向当前树的最新克隆) */
|
|
12
|
-
export declare function indexComponent(v: VNode): void;
|
|
13
|
-
/** 注销(组件实例从树中移除——条件渲染/列表删除) */
|
|
14
|
-
export declare function unindexComponent(compId: string): void;
|
|
15
|
-
/** O(1) 定位(updateComponent 消费——miss 由调用方回退 DFS) */
|
|
16
|
-
export declare function getIndexedComponent(compId: string): VNode | null;
|
|
17
|
-
/** 测试隔离(跨测试残留——id 从 n1 重新分配——旧索引 miss 回退安全——整洁清理) */
|
|
18
|
-
export declare function resetCompIndex(): void;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 event delegation — 事件代理(用户决策:事件注册到代理而非组件自身)
|
|
3
|
-
*
|
|
4
|
-
* 架构:
|
|
5
|
-
* 组件渲染 → handler 写入代理注册表(按节点 id——Map 覆盖零重绑)
|
|
6
|
-
* 挂载点(createRoot/createRouter 的 root + portal 容器)注册原生监听
|
|
7
|
-
* (每挂载点每事件一次——监听器 O(1))——惰性(首次绑定某事件时注册)
|
|
8
|
-
* 事件冒泡 → 挂载点监听 → e.target 向上找最近 [data-v3-id] → 查注册表 → 分发
|
|
9
|
-
*
|
|
10
|
-
* 收益:
|
|
11
|
-
* - 监听器 O(1)(每挂载点每事件一次——非每元素)
|
|
12
|
-
* - 零重绑(handler 变化 = Map 覆盖——事件流零噪音——§5.1 稳定引用仅为性能建议)
|
|
13
|
-
* - 生命周期:EVENT_BIND(挂载点首次注册)/ EVENT_UNBIND(节点移除时代理删除)
|
|
14
|
-
*/
|
|
15
|
-
/** event → (nodeId → 条目{handler, once})——模块级全局(节点 id 全局唯一) */
|
|
16
|
-
/** 监听计数 API(round3 阶段 4——泄漏检测:unmount 后残留检查——
|
|
17
|
-
* handlers[event][nodeId] 数 = 某节点的绑定数) */
|
|
18
|
-
export declare function listenerCount(nodeId: string | null): number;
|
|
19
|
-
/** 绑定/更新 handler(Map 覆盖——零重绑零事件) */
|
|
20
|
-
export declare function bindEvent(nodeId: string, event: string, handler: EventListener, once?: boolean): void;
|
|
21
|
-
/** 解绑(节点移除——代理删除 + EVENT_UNBIND) */
|
|
22
|
-
export declare function unbindEvent(nodeId: string, event: string): void;
|
|
23
|
-
/** 解绑节点的全部事件(移除统一清理——注册表与元素级标记解耦) */
|
|
24
|
-
export declare function unbindAll(nodeId: string): void;
|
|
25
|
-
/** 元素级监听统一入口(动画生命周期等——ref 回调的 el):
|
|
26
|
-
* 注册到代理(once 自动解绑)+ 挂载点监听(el 已挂载——向上找)——返回退订 */
|
|
27
|
-
export declare function bindElementListener(el: Element, event: string, handler: EventListener, once?: boolean): () => void;
|
|
28
|
-
/** 测试/调试隔离:清空注册表与挂载点(模块级 handlers 跨测试残留——
|
|
29
|
-
* 节点 id 各测试从 n1 重新分配——旧 handler 可能被错误分发) */
|
|
30
|
-
export declare function resetDelegation(): void;
|
|
31
|
-
/** 注册挂载点(createRoot/createRouter 挂载时调用) */
|
|
32
|
-
export declare function ensureDelegationRoot(root: Element): void;
|
|
33
|
-
/** 移除挂载点(卸载——removeEventListener 配对 + 注册表清理;
|
|
34
|
-
* handler 由节点移除清理(unbindAll)) */
|
|
35
|
-
export declare function removeDelegationRoot(root: Element): void;
|
|
36
|
-
/** 全局监听(document/window 级——hooks 统一入口):
|
|
37
|
-
* 同事件多 handler 聚合到一个目标监听(EventTarget 每事件一次)——
|
|
38
|
-
* 统一注册/退订 + 事件流可观测(EVENT_BIND/UNBIND——delegated: true)。
|
|
39
|
-
* options.capture:scroll 等不冒泡事件的捕获监听(嵌套容器滚动跟踪)。
|
|
40
|
-
* mql/visualViewport 等浏览器 API 对象(无事件冒泡语义)不纳入——保持直接监听。 */
|
|
41
|
-
export interface GlobalListenerOptions {
|
|
42
|
-
capture?: boolean;
|
|
43
|
-
passive?: boolean;
|
|
44
|
-
}
|
|
45
|
-
export declare function addGlobalListener(target: EventTarget, event: string, handler: EventListener, opts?: GlobalListenerOptions): () => void;
|
|
46
|
-
/** 渲染时绑定(createNode/patchProps 调用——事件 props 处理):
|
|
47
|
-
* 注册 handler + 确保挂载点监听(向上找——首次) */
|
|
48
|
-
export declare function bindDelegated(nodeId: string, event: string, handler: EventListener, parent: Node | null): void;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 events — 事件流(引擎本体——渲染全程可记录/回放/取消)
|
|
3
|
-
*
|
|
4
|
-
* 不变量:DOM = fold(事件流)——初始 DOM + 事件序列 = 任意时刻 DOM。
|
|
5
|
-
* 事件不可变;DOM 指令可逆(取消 = 应用逆事件)。
|
|
6
|
-
*/
|
|
7
|
-
import type { EventStream, V3Event, Entity, Action } from './types.ts';
|
|
8
|
-
/** 事件构造(统一命名:对象 + 动作 + 参数——每层同构) */
|
|
9
|
-
export declare function ev(entity: Entity, action: Action, target?: string, payload?: Record<string, unknown>): V3Event;
|
|
10
|
-
/** 事件键(断言/审计:'comp:render'——对象:动作) */
|
|
11
|
-
export declare function evKey(ev: V3Event): string;
|
|
12
|
-
export declare function createEventStream(max?: number, opts?: {
|
|
13
|
-
watermark?: number;
|
|
14
|
-
}): EventStream;
|
|
15
|
-
/** 全局流(默认实例——后续 per-app 实例化) */
|
|
16
|
-
export declare const stream: EventStream;
|
|
17
|
-
export declare function nextNodeId(): string;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 — vnode + stream 前端引擎(全新架构,2026-08)
|
|
3
|
-
*
|
|
4
|
-
* 与 vdom2 的差异:**渲染执行 = 事件流**(不是命令式 diff + 旁路记录)。
|
|
5
|
-
*
|
|
6
|
-
* vdom2:状态 → renderFn → vnode 树 → diff(命令式比较)→ DOM 变更 + 旁路事件记录
|
|
7
|
-
* vdom3:状态 → renderFn → vnode 树 → **渲染事件流**(CREATE/INSERT/UPDATE/REMOVE)
|
|
8
|
-
* → 执行器消费事件 → DOM(事件流是引擎本体——DOM = fold(事件流))
|
|
9
|
-
*
|
|
10
|
-
* 核心不变量:
|
|
11
|
-
* 1. **vnode 树保留声明式**(renderFn 输出完整树——与 vdom2 同模型)
|
|
12
|
-
* 2. **渲染即事件**:节点创建/属性设置/文本更新/插入/移除都是事件(可回放/取消/断言)
|
|
13
|
-
* 3. **DOM = fold(事件流)**:初始 DOM + 事件序列 = 任意时刻 DOM(时间旅行)
|
|
14
|
-
* 4. **更新最小化**:同位置同类型(含 key)复用——仅变化发事件(无整树 diff 决策噪音)
|
|
15
|
-
*
|
|
16
|
-
* 事件流覆盖(location → DOM):
|
|
17
|
-
* ROUTE_CHANGE → COMP_MOUNT → NODE_CREATE/TEXT_CREATE → INSERT → PROP_UPDATE/TEXT_UPDATE
|
|
18
|
-
* → REMOVE/MOVE(更新时)→ COMP_UNMOUNT
|
|
19
|
-
*
|
|
20
|
-
* 与 vdom2 并行(不兼容演进)——vdom2 资产(两阶段组件/状态机/观测体系)保留,
|
|
21
|
-
* vdom3 验证"事件流即执行"范式。
|
|
22
|
-
*/
|
|
23
|
-
export { h, Fragment } from './jsx.ts';
|
|
24
|
-
export { mount, patch } from './render.ts';
|
|
25
|
-
export { buildVNode, isVNode } from './build.ts';
|
|
26
|
-
export { createRoot } from './root.ts';
|
|
27
|
-
export { scheduler, Scheduler } from './scheduler.ts';
|
|
28
|
-
export { replay, applyEvent, undo, eventsOf, hasEvent, expectEventSequence } from './replay.ts';
|
|
29
|
-
export { NodeRegistry } from './registry.ts';
|
|
30
|
-
export { createRouter, type RouteDef } from './router.ts';
|
|
31
|
-
export { renderToEvents, renderToEventStream, serializeEvents, deserializeEvents, eventsToHtml } from './ssr.ts';
|
|
32
|
-
export { recordToTest, summarizeEvents } from './record.ts';
|
|
33
|
-
export { createPortal } from './jsx.ts';
|
|
34
|
-
export { Portal, App } from './types.ts';
|
|
35
|
-
export { ensurePortalContainer } from './registry.ts';
|
|
36
|
-
export { createV3Ui } from './ui.ts';
|
|
37
|
-
export { createSync, autoSync } from './sync.ts';
|
|
38
|
-
export { v3Confirm, v3Toast, type V3CommandInjected } from './commands.ts';
|
|
39
|
-
export { createEventStream, stream, nextNodeId, ev, evKey } from './events.ts';
|
|
40
|
-
export { registerApp, getAppFactory, resetAppRegistry } from './app.ts';
|
|
41
|
-
export { addGlobalListener, bindElementListener, bindDelegated, unbindEvent, unbindAll, ensureDelegationRoot, removeDelegationRoot, resetDelegation, } from './delegate.ts';
|
|
42
|
-
export type { VNode, VNodeChild, V3Event, EventStream, Renderer } from './types.ts';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 jsx — vnode 创建(声明式——vdom2 同模型:renderFn 输出完整树)
|
|
3
|
-
*
|
|
4
|
-
* 统一 JSX 入口:h/jsx/jsxs/jsxDEV + createPortal + Fragment/Portal——
|
|
5
|
-
* vdom2 时代 vnode.ts 的工厂全部收敛到此处(组件库 249 处 import 经转发层零改动)。
|
|
6
|
-
*/
|
|
7
|
-
import type { VNode, VNodeChild } from './types.ts';
|
|
8
|
-
import { Fragment, Portal, App } from './types.ts';
|
|
9
|
-
import type { Component } from './types.ts';
|
|
10
|
-
type HType = string | symbol | Component<any, any>;
|
|
11
|
-
export declare function h(type: HType, props?: Record<string, unknown> | null, ...children: VNodeChild[]): VNode;
|
|
12
|
-
/** JSX 编译产物入口(jsxImportSource: weifuwu/ui-dom——jsx-runtime 转发) */
|
|
13
|
-
export declare function jsx(type: HType, props: Record<string, unknown> | null, key?: string | null): VNode;
|
|
14
|
-
/** jsxs = jsx(children 数组已在 props.children——h 语义同构) */
|
|
15
|
-
export declare const jsxs: typeof jsx;
|
|
16
|
-
export declare function jsxDEV(type: HType, props: Record<string, unknown> | null, key?: string | null): VNode;
|
|
17
|
-
/** Portal:children 渲染到远程容器(#__wf_portal > [data-wf-portal-key=key]) */
|
|
18
|
-
export declare function createPortal(children: VNodeChild, portalKey?: string): VNode;
|
|
19
|
-
export { Fragment, Portal };
|
|
20
|
-
/** JSX 类型声明(jsxImportSource: weifuwu/ui-dom——组件/用户 JSX 编译产物类型) */
|
|
21
|
-
declare global {
|
|
22
|
-
namespace JSX {
|
|
23
|
-
type Element = import('./types.ts').VNode | null;
|
|
24
|
-
type ElementType = string | ((props: any, ctx: any) => any) | typeof Fragment | typeof Portal | typeof App;
|
|
25
|
-
interface IntrinsicElements {
|
|
26
|
-
[tag: string]: any;
|
|
27
|
-
}
|
|
28
|
-
interface IntrinsicAttributes {
|
|
29
|
-
key?: string | number | null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 record — 录制转测试(事故 → 自动生成可运行测试)
|
|
3
|
-
*
|
|
4
|
-
* 闭环:渲染/交互 → 事件流(录制)→ recordToTest 生成 jsdom 测试骨架
|
|
5
|
-
* → 回放 + 事件序列断言(DOM = fold 验证 + 精确渲染描述)。
|
|
6
|
-
*
|
|
7
|
-
* 事故转测试:任意渲染异常 → 录制事件流 → 生成回归测试(无需手动复现)。
|
|
8
|
-
*
|
|
9
|
-
* 事件统一命名:对象 + 动作 + 参数(entity + action + target + payload)——
|
|
10
|
-
* 键格式 `entity:action`(如 'node:create' / 'comp:render')。
|
|
11
|
-
*/
|
|
12
|
-
import type { V3Event } from './types.ts';
|
|
13
|
-
/** 事件流 → jsdom 测试代码(可写盘/执行) */
|
|
14
|
-
export declare function recordToTest(events: V3Event[], name?: string): string;
|
|
15
|
-
/** 事件流摘要(录制信息——时间/类型计数) */
|
|
16
|
-
export declare function summarizeEvents(events: V3Event[]): string;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 registry — 节点注册表(id ↔ DOM 节点双向映射)
|
|
3
|
-
*
|
|
4
|
-
* 事件流指令用 id 定位(NODE_CREATE id / INSERT parent/child)——回放/取消需要
|
|
5
|
-
* 从 id 解析节点。native 元素用 data-v3-id 属性;文本/注释节点无属性——用 WeakMap。
|
|
6
|
-
* REMOVE 时保存被移除节点(undo 恢复——取消的节点快照)。
|
|
7
|
-
*/
|
|
8
|
-
/** portal 容器(#__wf_portal > [data-wf-portal-key]——lazy 创建——组件库浮层基础) */
|
|
9
|
-
export declare function ensurePortalContainer(key: string): HTMLElement;
|
|
10
|
-
export declare class NodeRegistry {
|
|
11
|
-
private byId;
|
|
12
|
-
private idByNode;
|
|
13
|
-
/** 被移除节点(id → node——undo 恢复用) */
|
|
14
|
-
private removed;
|
|
15
|
-
/** portal 容器 id 约定(事件流 parent 用——replay 可解析) */
|
|
16
|
-
static PORTAL: (key: string) => string;
|
|
17
|
-
/** 解析父 id(portal: 前缀 → lazy 容器;否则查注册表) */
|
|
18
|
-
resolveParent(id: string): Node | null;
|
|
19
|
-
/** id → 节点(回放/取消)——含 portal 容器 */
|
|
20
|
-
get(id: string): Node | null;
|
|
21
|
-
register(id: string, node: Node): void;
|
|
22
|
-
/** 节点 → id(native 元素读 data-v3-id;其他查 WeakMap) */
|
|
23
|
-
idOf(node: Node | null): string;
|
|
24
|
-
/** 移除记录(REMOVE 时调用——保存节点供 undo) */
|
|
25
|
-
unregister(id: string, node: Node): void;
|
|
26
|
-
/** 恢复被移除节点(undo 的 REMOVE 逆操作) */
|
|
27
|
-
takeRemoved(id: string): Node | null;
|
|
28
|
-
/** 根节点 id(replay 目标容器映射) */
|
|
29
|
-
static ROOT: string;
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 render — 渲染执行器:**构建后的纯树** → 事件流 → DOM
|
|
3
|
-
*
|
|
4
|
-
* 核心:**渲染即事件**——节点创建/属性设置/文本更新/插入/移除都是事件(stream.emit),
|
|
5
|
-
* 执行器消费事件操作 DOM。DOM = fold(事件流)。
|
|
6
|
-
*
|
|
7
|
-
* 组件 vnode(已 build):输出 _child(渲染组件输出——无重复构建);
|
|
8
|
-
* 卸载:COMP_UNMOUNT 事件(类型/位置变化时——由 patch 顶层判定)。
|
|
9
|
-
*/
|
|
10
|
-
import type { VNode, PortalVNode } from './types.ts';
|
|
11
|
-
import { Fragment } from './types.ts';
|
|
12
|
-
/** Portal 判定(symbol 恒等 + props.portalKey——兼容 vdom2 组件产出的 Portal vnode) */
|
|
13
|
-
export declare function isPortalNode(v: unknown): v is PortalVNode;
|
|
14
|
-
/** Fragment 判定(symbol 且非 Portal——vdom2/vdom3 Fragment 都认) */
|
|
15
|
-
export declare function isFragmentNode(v: unknown): boolean;
|
|
16
|
-
import { NodeRegistry } from './registry.ts';
|
|
17
|
-
/** 节点注册表(id ↔ Node——事件流指令定位)——模块级可变(mount/patch 支持
|
|
18
|
-
* per-call 注入(测试隔离)——同步段切换安全(并发交错在 await 点) */
|
|
19
|
-
declare let registry: NodeRegistry;
|
|
20
|
-
export { registry };
|
|
21
|
-
/** 挂载:纯树 → 事件流 → DOM(reg 可选——per-call 隔离;默认全局)
|
|
22
|
-
* 挂载前清空容器(首次挂载语义——清除 HTML 预置的 boot-loading 等占位——
|
|
23
|
-
* 不残留「加载中...」) */
|
|
24
|
-
export declare function mount(vnode: VNode, root: HTMLElement, reg?: NodeRegistry): void;
|
|
25
|
-
/**
|
|
26
|
-
* patch:旧树(纯)vs 新树(纯)→ 事件流 → DOM。
|
|
27
|
-
* 同位置同类型(含 key)复用——仅变化发事件;异类型 → REMOVE+CREATE+INSERT(重建事件)。
|
|
28
|
-
*/
|
|
29
|
-
export declare function patch(oldV: VNode | null, newV: VNode | string | number | null | undefined | boolean, parent: Node, anchor?: Node | null, reg?: NodeRegistry): Node | null;
|
|
30
|
-
/** 递归调 ref(null)(移除树——ref 纪律:卸载清理(lockScroll/focus)依赖
|
|
31
|
-
* ——portal/组件输出等嵌套结构的 ref 全部清理——REF_CLEANUP 事件(生命周期可观测))
|
|
32
|
-
* 导出(组件级 update 用) */
|
|
33
|
-
export declare function callRefCleanup(v: VNode | null | undefined): void;
|
|
34
|
-
/** 节点移除的完整清理(REMOVE 事件 + EVENT_UNBIND(绑定生命周期)+ ref(null) + registry) */
|
|
35
|
-
export declare function removeNodeWithLifecycle(node: Node, parent: Node, vnodeRef?: VNode | null): void;
|
|
36
|
-
/** 移除 portal 内容(远程容器清空——子树 REMOVE 事件 + ref(null)——ref 纪律:
|
|
37
|
-
* 卸载必须调 ref(null)(usePopup 的 portalPanelRef 清理——lockScroll/focus 恢复)) */
|
|
38
|
-
export declare function removePortalContent(pv: PortalVNode): void;
|
|
39
|
-
export { Fragment };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 replay — 事件流回放 / 取消 / 断言(DOM = fold(事件流))
|
|
3
|
-
*
|
|
4
|
-
* 回放(replay):从目标容器重放事件流——node:create 建节点(id→节点映射)、
|
|
5
|
-
* node:insert 挂载、prop:text update 应用——结果 = 原渲染的 DOM(fold 不变量)。
|
|
6
|
-
*
|
|
7
|
-
* 取消(undo):从事件流末尾取 N 个事件 → 应用逆操作——insert→remove、
|
|
8
|
-
* remove→恢复(registry 保存的节点)、update→恢复 prev。
|
|
9
|
-
*
|
|
10
|
-
* 断言(eventsOf/hasEvent):渲染 = 事件序列断言(测试/调试)。
|
|
11
|
-
*
|
|
12
|
-
* 事件统一命名:对象 + 动作 + 参数(entity + action + target + payload)——
|
|
13
|
-
* 键格式 `entity:action`(如 'node:create')。
|
|
14
|
-
*/
|
|
15
|
-
import type { V3Event } from './types.ts';
|
|
16
|
-
import { NodeRegistry } from './registry.ts';
|
|
17
|
-
/** 应用单个事件(流式客户端逐事件消费——replay 循环的拆解) */
|
|
18
|
-
export declare function applyEvent(ev: V3Event, target: HTMLElement, reg: NodeRegistry): void;
|
|
19
|
-
/** 回放事件流到目标容器(DOM = fold(events)——结果与原始渲染同构) */
|
|
20
|
-
export declare function replay(events: V3Event[], target: HTMLElement, reg?: NodeRegistry): void;
|
|
21
|
-
/** 取消:从事件流末尾取 n 个 DOM 指令 → 应用逆操作(撤销渲染变化) */
|
|
22
|
-
export declare function undo(events: V3Event[], n: number, reg?: NodeRegistry): void;
|
|
23
|
-
/** 断言工具:过滤事件(按 entity:action 键——如 'node:create') */
|
|
24
|
-
export declare function eventsOf(events: V3Event[], type: string): V3Event[];
|
|
25
|
-
/** 断言工具:是否存在匹配事件 */
|
|
26
|
-
export declare function hasEvent(events: V3Event[], predicate: (e: V3Event) => boolean): boolean;
|
|
27
|
-
/** 断言:渲染 = 事件序列(测试——精确描述渲染做了什么;键格式 entity:action) */
|
|
28
|
-
export declare function expectEventSequence(events: V3Event[], expected: string[]): void;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 root — 应用入口:createRoot(挂载 + 组件渲染上下文)
|
|
3
|
-
*
|
|
4
|
-
* 组件 ctx.render():调度自身重渲染(同 tick 合并——一次 patch)。
|
|
5
|
-
* 渲染流程:renderFn 重跑 → buildVNode(oldV 对照复用)→ patch(事件流 → DOM)。
|
|
6
|
-
*/
|
|
7
|
-
import type { VNode, V3Ctx } from './types.ts';
|
|
8
|
-
export interface RootHandle {
|
|
9
|
-
ctx: V3Ctx;
|
|
10
|
-
/** 组件重渲染(ctx.render 内部路径——同 tick 合并) */
|
|
11
|
-
rerender(): void;
|
|
12
|
-
/** 立即刷新(测试) */
|
|
13
|
-
flush(): void;
|
|
14
|
-
unmount(): void;
|
|
15
|
-
/** 首帧完成 Promise(初始挂载——工厂 await + 渲染落地) */
|
|
16
|
-
ready: Promise<void>;
|
|
17
|
-
}
|
|
18
|
-
/** 树中按组件 _id 定位(组件级更新的定位——DFS——含组件输出 _child) */
|
|
19
|
-
export declare function findComponent(v: VNode | null | undefined, compId: string): VNode | null;
|
|
20
|
-
/** 创建应用根(挂载组件树——组件获得 ctx.render 调度能力;options.ctx 注入扩展字段
|
|
21
|
-
* ——中间件面(app/i18n/auth/data 等——组件 ctx 可选链消费)) */
|
|
22
|
-
export declare function createRoot(vnode: VNode, root: HTMLElement, options?: {
|
|
23
|
-
ctx?: Record<string, unknown>;
|
|
24
|
-
}): RootHandle;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 router — 路由(location → ROUTE_CHANGE 事件 → 组件挂载 → DOM 全链路)
|
|
3
|
-
*
|
|
4
|
-
* 事件流覆盖:ROUTE_CHANGE(path, params) → COMP_MOUNT → NODE_CREATE/INSERT → ...
|
|
5
|
-
* 页面切换 = 异类型 patch(旧页面 COMP_UNMOUNT + REMOVE;新页面 MOUNT + CREATE/INSERT)——
|
|
6
|
-
* 全链路事件化(location→DOM 的完整因果链可回放)。
|
|
7
|
-
*/
|
|
8
|
-
import type { VNode } from './types.ts';
|
|
9
|
-
/** 布局包裹(跨路由复用——layout 函数引用稳定 → patch 同位置同类型复用——
|
|
10
|
-
* 工厂不重跑——内部状态(折叠/高亮)保持——vdom2 布局层语义) */
|
|
11
|
-
export type RouteLayout = (page: VNode) => VNode;
|
|
12
|
-
export interface RouteDef {
|
|
13
|
-
path: string;
|
|
14
|
-
/** 页面渲染(params 注入——:id 等) */
|
|
15
|
-
render: (params: Record<string, string>) => VNode;
|
|
16
|
-
/** 布局包裹(可选——页面在布局插槽内) */
|
|
17
|
-
layout?: RouteLayout;
|
|
18
|
-
}
|
|
19
|
-
export interface RouterHandle {
|
|
20
|
-
navigate(path: string): void;
|
|
21
|
-
/** 当前路径 */
|
|
22
|
-
path(): string;
|
|
23
|
-
/** 立即处理当前 URL(测试/恢复) */
|
|
24
|
-
refresh(): void;
|
|
25
|
-
close(): void;
|
|
26
|
-
}
|
|
27
|
-
/** 创建路由应用(初始挂载 + popstate 导航;options.ctx 注入中间件面——页面组件消费) */
|
|
28
|
-
export declare function createRouter(routes: RouteDef[], root: HTMLElement, options?: {
|
|
29
|
-
initialPath?: string;
|
|
30
|
-
ctx?: Record<string, unknown>;
|
|
31
|
-
}): RouterHandle;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 scheduler — 渲染调度(同 tick 合并 + 批处理 + 防死循环)
|
|
3
|
-
*
|
|
4
|
-
* 语义:
|
|
5
|
-
* - schedule(fn):收集渲染请求——同 tick 多次 schedule 合并为一次 flush(微任务)
|
|
6
|
-
* - flush:批量执行(一次事件循环内所有待渲染请求)
|
|
7
|
-
* - 渲染中再次 schedule(组件 renderFn 内触发)→ 排队到下一轮(合并补跑)
|
|
8
|
-
* - 防死循环:单次 flush 内重渲染次数上限(吸取 vdom2 pending 死循环教训)
|
|
9
|
-
*/
|
|
10
|
-
export declare class Scheduler {
|
|
11
|
-
private queue;
|
|
12
|
-
private running;
|
|
13
|
-
private iterations;
|
|
14
|
-
/** 调度渲染(同 tick 合并——微任务批量执行) */
|
|
15
|
-
schedule(fn: () => void): void;
|
|
16
|
-
/** 立即执行队列(测试/显式刷新用) */
|
|
17
|
-
flush(): void;
|
|
18
|
-
/** 待处理数量(测试断言——合并语义) */
|
|
19
|
-
pending(): number;
|
|
20
|
-
get isRunning(): boolean;
|
|
21
|
-
}
|
|
22
|
-
/** 全局调度器(默认实例——后续 per-app 实例化) */
|
|
23
|
-
export declare const scheduler: Scheduler;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vdom3 ssr — 服务端事件流生成(dry-run——不创建 DOM)
|
|
3
|
-
*
|
|
4
|
-
* 差异化能力(可移植执行记录):服务端执行组件(buildVNode)→ 生成渲染事件流
|
|
5
|
-
* (NODE_CREATE/PROP_UPDATE/INSERT/TEXT_CREATE——自包含指令)→ 序列化传输 →
|
|
6
|
-
* 客户端 replay(events, root) 重建 DOM——**零 DOM 猜测**(事件流自带全部指令)。
|
|
7
|
-
*
|
|
8
|
-
* 与 vdom2 SSR(HTML 字符串 + hydrate 游标收养)的本质区别:
|
|
9
|
-
* - vdom2:服务端序列化 HTML → 客户端解析 + 游标匹配(DOM 结构猜测)
|
|
10
|
-
* - vdom3:服务端生成事件流 → 客户端重放(精确增量——无猜测)
|
|
11
|
-
*/
|
|
12
|
-
import type { VNode, V3Event } from './types.ts';
|
|
13
|
-
import { stream } from './events.ts';
|
|
14
|
-
/** 服务端渲染 → 事件流(dry-run:只生成指令,不创建 DOM——可传输/回放) */
|
|
15
|
-
export declare function renderToEvents(vnode: VNode): Promise<V3Event[]>;
|
|
16
|
-
/**
|
|
17
|
-
* 流式渲染:服务端逐事件推送(AsyncGenerator)→ 客户端逐事件应用
|
|
18
|
-
* ——TTFB 后首帧渐进(根节点先到 → 内容逐块)——vdom2 无法做到(HTML 需完整)
|
|
19
|
-
*/
|
|
20
|
-
export declare function renderToEventStream(vnode: VNode): AsyncGenerator<V3Event>;
|
|
21
|
-
/** 事件流 → HTML 字符串(首帧序列化——SEO/爬虫/首帧;客户端用事件流重建——零 DOM 猜测) */
|
|
22
|
-
export declare function eventsToHtml(events: V3Event[]): string;
|
|
23
|
-
/** 序列化(传输——事件流 JSON 化) */
|
|
24
|
-
export declare function serializeEvents(events: V3Event[]): string;
|
|
25
|
-
/** 反序列化 */
|
|
26
|
-
export declare function deserializeEvents(json: string): V3Event[];
|
|
27
|
-
export { stream };
|