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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/patch — processors(命令处理器——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 职责:各命令的消费逻辑(细节)——CommandApplier(index.ts)只做
|
|
5
|
+
* 中转(apply switch → 本模块分发)。
|
|
6
|
+
*
|
|
7
|
+
* 生命周期语义:
|
|
8
|
+
* - ref(挂载完成——insert 后——el 已连接);unref/remove/done(ref(null))
|
|
9
|
+
* - mount(组件初始化标记);unmount(onUnmounts 逆序)
|
|
10
|
+
* - move(顺移 remap / 移动 + 重映射)
|
|
11
|
+
* - done.full(全量流清理旧树多余节点——资源释放完整)
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from '../command/index.ts';
|
|
14
|
+
import { RefRegistry } from '../field/ref.ts';
|
|
15
|
+
import type { CommandApplier } from './index.ts';
|
|
16
|
+
export type WfNode = HTMLElement | Text | Comment;
|
|
17
|
+
export declare function procCreate(applier: CommandApplier, cmd: Extract<Command, {
|
|
18
|
+
op: 'create';
|
|
19
|
+
}>): void;
|
|
20
|
+
/** createText 处理器(幂等) */
|
|
21
|
+
export declare function procCreateText(applier: CommandApplier, cmd: Extract<Command, {
|
|
22
|
+
op: 'createText';
|
|
23
|
+
}>): void;
|
|
24
|
+
/** createAnchor 处理器(占位锚——幂等) */
|
|
25
|
+
export declare function procCreateAnchor(applier: CommandApplier, cmd: Extract<Command, {
|
|
26
|
+
op: 'createAnchor';
|
|
27
|
+
}>): void;
|
|
28
|
+
/** insert 处理器(挂载——ref 查表触发)
|
|
29
|
+
* **ref=null 语义 = 容器头部**(diff 逐槽对照首项/新增首项——位置 0
|
|
30
|
+
* ——append 会把位置 0 的新项追加到末尾——错位——真实 bug) */
|
|
31
|
+
export declare function procInsert(applier: CommandApplier, cmd: Extract<Command, {
|
|
32
|
+
op: 'insert';
|
|
33
|
+
}>): void;
|
|
34
|
+
/** move 处理器(顺移 remap / 移动 + 重映射) */
|
|
35
|
+
export declare function procMove(applier: CommandApplier, cmd: Extract<Command, {
|
|
36
|
+
op: 'move';
|
|
37
|
+
}>): void;
|
|
38
|
+
/** remove 处理器(卸载——ref(null) + 事件表 + 节点移除) */
|
|
39
|
+
export declare function procRemove(applier: CommandApplier, cmd: Extract<Command, {
|
|
40
|
+
op: 'remove';
|
|
41
|
+
}>): void;
|
|
42
|
+
/** setText 处理器(就地更新)
|
|
43
|
+
* 防御审计(P2):!t / 非文本 = setText Pre 违例(生成层 bug——Sim 状态机
|
|
44
|
+
* 验证器在测试层显式 Reject(setText Pre 违例 throw)——生产保留静默防御
|
|
45
|
+
* (真实浏览器环境差异兜底——不中断渲染管线) */
|
|
46
|
+
export declare function procSetText(applier: CommandApplier, cmd: Extract<Command, {
|
|
47
|
+
op: 'setText';
|
|
48
|
+
}>): void;
|
|
49
|
+
/** setProp 处理器(ref 生命周期 / 事件代理 / 三通道) */
|
|
50
|
+
export declare function procSetProp(applier: CommandApplier, cmd: Extract<Command, {
|
|
51
|
+
op: 'setProp';
|
|
52
|
+
}>): void;
|
|
53
|
+
/** ref 指令(挂载完成——insert 后) */
|
|
54
|
+
export declare function procRef(applier: CommandApplier, cmd: Extract<Command, {
|
|
55
|
+
op: 'ref';
|
|
56
|
+
}>): void;
|
|
57
|
+
/** unref 指令(ref(null)) */
|
|
58
|
+
export declare function procUnref(applier: CommandApplier, cmd: Extract<Command, {
|
|
59
|
+
op: 'unref';
|
|
60
|
+
}>): void;
|
|
61
|
+
/** mount 指令(组件初始化完成——审计标记) */
|
|
62
|
+
export declare function procMount(applier: CommandApplier, cmd: Extract<Command, {
|
|
63
|
+
op: 'mount';
|
|
64
|
+
}>): void;
|
|
65
|
+
export declare function procUnmount(applier: CommandApplier, cmd: Extract<Command, {
|
|
66
|
+
op: 'unmount';
|
|
67
|
+
}>): void;
|
|
68
|
+
/** done 处理器(full 清理——旧树多余节点——资源释放完整) */
|
|
69
|
+
export declare function procDone(applier: CommandApplier, cmd: Extract<Command, {
|
|
70
|
+
op: 'done';
|
|
71
|
+
}>): void;
|
|
72
|
+
/** 命令分发(中转——switch → 处理器) */
|
|
73
|
+
export declare function dispatch(applier: CommandApplier, cmd: Command): void;
|
|
74
|
+
/** RefRegistry 内部访问(procSetProp 的 prev 查询——同包约定) */
|
|
75
|
+
export type { RefRegistry };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/patch — 状态机规格(单一实现源——P3c)
|
|
3
|
+
*
|
|
4
|
+
* 目标:NodeState 迁移 + Post 验证的**唯一规格源**——Sim(契约层对账器)
|
|
5
|
+
* 与 createDevVerifier(生产 dev 检查)共用——消灭双实现漂移(isConnected
|
|
6
|
+
* 类误报的根治——规格只有一份——两边行为恒等)。
|
|
7
|
+
*
|
|
8
|
+
* 规格(design/vdom-state-machine-plan.md §2.1/§3):
|
|
9
|
+
* ABSENT → CREATED → INSERTED → ACTIVE(close)→ REMOVED
|
|
10
|
+
* - create 族:ABSENT → CREATED(同形复用不变)
|
|
11
|
+
* - insert:CREATED → INSERTED(INSERTED/ACTIVE = 幂等 skip)
|
|
12
|
+
* - close:INSERTED → ACTIVE(ACTIVE = 幂等 skip——重建路径)
|
|
13
|
+
* - remove:任意 → REMOVED(记录前缀清除——Post:无残留)
|
|
14
|
+
* - setText/setProp/move:节点存在性 Post(类型检查由调用方——
|
|
15
|
+
* Sim 查 SimNode.kind / devVerify 查 nodeType——各层有各自数据面)
|
|
16
|
+
*
|
|
17
|
+
* 迁移返回违例数组(不 throw)——调用方决定:Sim throw(测试红)/
|
|
18
|
+
* devVerify console.error(dev 报告)。
|
|
19
|
+
*/
|
|
20
|
+
import type { Command } from '../command/index.ts';
|
|
21
|
+
export type NodeState = 'created' | 'inserted' | 'active';
|
|
22
|
+
/** 状态跟踪器(id → NodeState——调用方数据面无关) */
|
|
23
|
+
export interface StateTracker {
|
|
24
|
+
get(id: string): NodeState | undefined;
|
|
25
|
+
set(id: string, s: NodeState): void;
|
|
26
|
+
/** 前缀清除(remove/done 的子树记录) */
|
|
27
|
+
removePrefix(id: string): void;
|
|
28
|
+
/** 前缀残留检查(remove Post) */
|
|
29
|
+
hasPrefix(id: string): boolean;
|
|
30
|
+
/** 前缀重映射(move——id 空间跟随——nodes/事件/ref 同规则) */
|
|
31
|
+
remapPrefix(oldPrefix: string, newPrefix: string): void;
|
|
32
|
+
/** 全量重置(done——渲染流结束——与 touched.clear() 对齐) */
|
|
33
|
+
clear(): void;
|
|
34
|
+
}
|
|
35
|
+
/** Map 实现(Sim/devVerify 共用) */
|
|
36
|
+
export declare function createStateTracker(): StateTracker;
|
|
37
|
+
/** 状态迁移 + Post 验证(纯逻辑——单一规格源——违例返回数组) */
|
|
38
|
+
export declare function transition(tracker: StateTracker, cmd: Command): string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/patch — dev 验证器(状态机 Post 断言——dev only)
|
|
3
|
+
*
|
|
4
|
+
* 机制(P3b/P3c):CommandApplier 可选注入 devVerify——每个命令消费后
|
|
5
|
+
* 断言 Post——**状态机规格单一实现源**:patch/state-machine.ts(transition
|
|
6
|
+
* ——与 Sim(契约层对账器)共用——消灭双实现漂移)——数据面类型检查
|
|
7
|
+
* (nodeType)与挂载性(isConnected)在此补充(规格的类型维度由各数据面
|
|
8
|
+
* 承担——Sim 查 SimNode.kind / devVerify 查 nodeType)。
|
|
9
|
+
*
|
|
10
|
+
* 报告方式:console.error(不中断渲染管线——dev 可见性)——
|
|
11
|
+
* 违例 = 生成层 bug 或 Sim 与浏览器语义差异(isConnected 类问题落验)。
|
|
12
|
+
*
|
|
13
|
+
* 生产零开销:仅 window.__WF_DEV__ 开启时注入(serve.ts)。
|
|
14
|
+
*/
|
|
15
|
+
import type { Command } from '../command/index.ts';
|
|
16
|
+
import type { CommandApplier } from './index.ts';
|
|
17
|
+
export declare function createDevVerifier(): (cmd: Command, applier: CommandApplier) => void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — route 阶段(UIRouter——应用唯一入口——公共面)
|
|
3
|
+
*
|
|
4
|
+
* 设计(design/vdom-plan.md §2):Handler 签名字面同构后端——
|
|
5
|
+
* `(req: Request, ctx) => Response`——原生 Request/Response——
|
|
6
|
+
* 路由核心 = shared Trie(src/shared/router/trie.ts——前后端共用)——
|
|
7
|
+
* 静态段优先 → :param → * 通配——params 注入 req。
|
|
8
|
+
*/
|
|
9
|
+
import type { UIContext } from '../context/UIContext.ts';
|
|
10
|
+
import type { Command } from './command/index.ts';
|
|
11
|
+
/** 页面 handler——返回原生 Response(body = 命令流字节——NDJSON)——
|
|
12
|
+
* 与后端 Handler 签名字面同构:(req, ctx) => Response——req 为**标准
|
|
13
|
+
* Request**(零扩展——params/query 经 ctx 注入) */
|
|
14
|
+
export type PageHandler = (req: Request, ctx: UIContext) => Response | Promise<Response>;
|
|
15
|
+
/** 渲染入口封装:命令流 → 原生 Response(body = NDJSON 字节流——
|
|
16
|
+
* HTTP 传输层即字节——命令纯数据可序列化——服务端同源解析) */
|
|
17
|
+
export declare function commandResponse(stream: ReadableStream<Command>, init?: ResponseInit): Response;
|
|
18
|
+
/** 构造前端请求(纯标准 Request——零扩展——URL 基于 http://localhost) */
|
|
19
|
+
export declare function frontRequest(path: string): Request;
|
|
20
|
+
export declare class UIRouter {
|
|
21
|
+
private root;
|
|
22
|
+
private notFoundHandler;
|
|
23
|
+
/** 注册路由(shared Trie——静态/:param/*——params 注入 req) */
|
|
24
|
+
get(path: string, handler: PageHandler): this;
|
|
25
|
+
/** 404 兜底 */
|
|
26
|
+
notFound(handler: PageHandler): this;
|
|
27
|
+
/** 解析请求 → 响应(Trie 匹配 + **params/query 注入 ctx**——对齐后端
|
|
28
|
+
* `ctx = { params, query }`——`Object.fromEntries(searchParams)`——
|
|
29
|
+
* 不修改原始 Request) */
|
|
30
|
+
resolve(req: Request, ctx: UIContext): Promise<Response>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — uiServe(渲染落地——公共面——双端一体)
|
|
3
|
+
*
|
|
4
|
+
* 设计(design/vdom-plan.md §3/§4):
|
|
5
|
+
* - UIRouter 唯一应用入口——uiServe(router, { root }) 收养渲染(真实浏览器全局
|
|
6
|
+
* document/window——2026-12 删除 browser 注入——测试与生产同环境)
|
|
7
|
+
* - 渲染循环:初始 URL resolve → Response(command 事件流)→ patch
|
|
8
|
+
* - **ctx.render() = 重新渲染**(事件触发/fetch 结束/定时器回调的唯一入口):
|
|
9
|
+
* 重新 resolve(handler 重跑——registry 复用——组件工厂不重跑——
|
|
10
|
+
* renderFn 重调读最新状态)→ **新的 Response command 事件流** → 消费
|
|
11
|
+
* (patch 对照现有 DOM 节点——幂等——就地更新)
|
|
12
|
+
* - 函数面传输:同进程共享函数表——编码时函数 → {$fn: n} 标记——
|
|
13
|
+
* 解码时查表还原(事件绑定跨 Response 保持)
|
|
14
|
+
*
|
|
15
|
+
* 服务端面(SSR——同一 handler 同一 Response——body 经 commandToHtml()
|
|
16
|
+
* TransformStream 流式吐 HTML)后续实现。
|
|
17
|
+
*/
|
|
18
|
+
import { UIRouter } from './router.ts';
|
|
19
|
+
import type { VNode } from './vnode.ts';
|
|
20
|
+
import type { UIContext } from '../context/UIContext.ts';
|
|
21
|
+
import type { Command } from './command/index.ts';
|
|
22
|
+
/** 函数表还原($fn 标记 → 函数——编码/解码同进程共享) */
|
|
23
|
+
export declare function reviveFn(fnTable: Map<number, unknown>): (k: string, v: unknown) => unknown;
|
|
24
|
+
/** NDJSON 命令流解析(行缓冲——命令可能跨 chunk——函数表还原——
|
|
25
|
+
* 导出(测试——跨 chunk 边界/畸形行合规断言)) */
|
|
26
|
+
export declare function commandReader(reader: ReadableStreamDefaultReader<Uint8Array>, fnTable: Map<number, unknown>): AsyncGenerator<Command>;
|
|
27
|
+
/** 命令流编码(函数面 → {$fn: n}——函数表——同进程共享) */
|
|
28
|
+
export declare function encodeCommands(stream: ReadableStream<Command>, fnTable: Map<number, unknown>): ReadableStream<Uint8Array>;
|
|
29
|
+
/** 函数表(serve 级共享——编码/解码同进程) */
|
|
30
|
+
export declare function createFnTable(): Map<number, unknown>;
|
|
31
|
+
export interface UiServeOptions {
|
|
32
|
+
/** 根容器(选择器或元素——'#root') */
|
|
33
|
+
root: string | HTMLElement;
|
|
34
|
+
/** 中间件注入面(ctx.api/auth/ws/i18n——组件/页面可用——可选) */
|
|
35
|
+
api?: import('../middlewares/api.ts').ApiClient;
|
|
36
|
+
auth?: import('../middlewares/auth-i18n.ts').AuthClient;
|
|
37
|
+
ws?: import('../middlewares/ws.ts').WsClient;
|
|
38
|
+
i18n?: import('../middlewares/auth-i18n.ts').I18nState;
|
|
39
|
+
/** 命令式轻提示(ctx.toast——应用装配) */
|
|
40
|
+
toast?: (message: string, type?: 'success' | 'error' | 'info' | 'warning', duration?: number) => void;
|
|
41
|
+
/** 命令式确认(ctx.confirm——应用装配——返回 Promise<boolean>) */
|
|
42
|
+
confirm?: (message: string, options?: Record<string, unknown>) => Promise<boolean>;
|
|
43
|
+
/** 命令式通知(ctx.notification——应用装配) */
|
|
44
|
+
notification?: unknown;
|
|
45
|
+
/**
|
|
46
|
+
* 渲染错误回退 UI(R1 熔断——连续渲染错误达阈值后显示——应用可配置——
|
|
47
|
+
* 缺省内置:错误文案 + 重试按钮(独立于应用路由——不依赖 router.resolve))
|
|
48
|
+
*/
|
|
49
|
+
errorFallback?: (error: Error, ctx: UIContext) => VNode;
|
|
50
|
+
}
|
|
51
|
+
export interface UiServeHandle {
|
|
52
|
+
/** 首帧渲染完成 Promise(await 精确等待) */
|
|
53
|
+
ready: Promise<void>;
|
|
54
|
+
/** 编程式导航(URL 变化 → 重新 resolve → 新命令事件流 → 消费——
|
|
55
|
+
* root 异类型 = 整树替换;同类型 = diff 精准) */
|
|
56
|
+
navigate(path: string): Promise<void>;
|
|
57
|
+
/** 卸载(清理 DOM/监听) */
|
|
58
|
+
unmount(): void;
|
|
59
|
+
}
|
|
60
|
+
/** serve 生命周期状态机(**全部状态机化——2026-XX**):
|
|
61
|
+
* active → unmounted(unmount 消费——迁移后 render/navigate 违例报错) */
|
|
62
|
+
export type ServePhase = 'active' | 'unmounted';
|
|
63
|
+
/** 渲染队列状态机(**替代裸 rendering boolean**):
|
|
64
|
+
* idle → rendering(render 启动)→ idle(runRender 完成/错误/队列空)
|
|
65
|
+
* - rendering 中 render() → 入队(合法——FIFO 确定性——非违例)
|
|
66
|
+
* - unmounted 中 render()/navigate() → 违例报错(DOM 已清——静默渲染
|
|
67
|
+
* 是隐藏错误——审计 2026-XX) */
|
|
68
|
+
export type RenderPhase = 'idle' | 'rendering';
|
|
69
|
+
/** 页面作者渲染入口(ctx 面——vnode → Response command 事件流——
|
|
70
|
+
* 公共面仍只有 h/jsx/uiServe/UIRouter——本入口经 ctx 提供) */
|
|
71
|
+
export interface RenderCtx extends UIContext {
|
|
72
|
+
/** vnode → Response(command 事件流——函数表编码——事件绑定跨流保持) */
|
|
73
|
+
stream(vnode: VNode, init?: ResponseInit): Response;
|
|
74
|
+
}
|
|
75
|
+
export declare function uiServe(router: UIRouter, opts: UiServeOptions): UiServeHandle;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/ssr — absorb(SSR 结构吸收状态机)
|
|
3
|
+
*
|
|
4
|
+
* 首帧结构对齐:SSR 输出静态 HTML → 客户端 uiServe 接管——create 命令
|
|
5
|
+
* 按 DFS 序消费 SSR 节点(类型匹配复用——焦点/状态保持——零重建)。
|
|
6
|
+
*
|
|
7
|
+
* 职责边界(中转——命令分发细节在 processors——本文件只持有状态 +
|
|
8
|
+
* 匹配判定):
|
|
9
|
+
* - begin(DFS 序快照——不消费 root 自身)
|
|
10
|
+
* - next(匹配消费——元素按 tag 匹配 / 文本 / 注释锚——不匹配跳过)
|
|
11
|
+
* - end(done.full 收尾——剩余节点 = SSR 输出多于命令 → mismatch)
|
|
12
|
+
* - failed(serve 检测回退清空重建——原子性)
|
|
13
|
+
*
|
|
14
|
+
* 确定性前提(诚实裁剪):SSR 与客户端首帧必须同构(同路由同组件——
|
|
15
|
+
* 渲染期非确定(Date/Math.random)→ mismatch → 回退重建——dev 检测)。
|
|
16
|
+
*/
|
|
17
|
+
/** 吸收状态机(**状态机化——非法调用顺序显式 Reject**):
|
|
18
|
+
* inactive → begin → consuming →(end/next 耗尽)→ inactive/failed
|
|
19
|
+
* - begin:inactive → consuming(DFS 序快照)
|
|
20
|
+
* - next:consuming → consuming(消费)/ failed(队列耗尽)
|
|
21
|
+
* - end:consuming → inactive(无剩余)/ failed(剩余 = mismatch)
|
|
22
|
+
* - reset:任意 → inactive(回退重建)
|
|
23
|
+
* 违例(静默路径歼灭——审计 2026-XX):next/end 在 inactive 调用 →
|
|
24
|
+
* 显式 console.error(不再静默返回 null——非法顺序是 bug)
|
|
25
|
+
*/
|
|
26
|
+
import type { WfNode } from '../patch/processors.ts';
|
|
27
|
+
/** 吸收阶段(状态机枚举) */
|
|
28
|
+
export type AbsorbPhase = 'inactive' | 'consuming' | 'failed';
|
|
29
|
+
/** 吸收状态(CommandApplier 持有——apply 层消费) */
|
|
30
|
+
export declare class AbsorbState {
|
|
31
|
+
/** DFS 序快照(root 后代——create 按序消费) */
|
|
32
|
+
queue: Node[] | null;
|
|
33
|
+
/** 吸收失败(SSR 与命令流不匹配——serve 回退清空重建) */
|
|
34
|
+
failed: boolean;
|
|
35
|
+
/** 状态机阶段(迁移:begin→consuming;end/reset→inactive;耗尽→failed) */
|
|
36
|
+
phase: AbsorbPhase;
|
|
37
|
+
/** 启动吸收(root 有 SSR 内容——DFS 序快照——不消费 root 自身) */
|
|
38
|
+
begin(container: HTMLElement): void;
|
|
39
|
+
/** 吸收结束(done.full)——剩余节点 = SSR 输出多于命令——mismatch
|
|
40
|
+
* **inactive 时 = 合法 no-op**(procDone 无条件调用——非 SSR 客户端
|
|
41
|
+
* 渲染未 begin——end 无意义——不报错);consuming 时 = 正常收尾 */
|
|
42
|
+
end(): void;
|
|
43
|
+
/** 重置(回退重建后——恢复非吸收态) */
|
|
44
|
+
reset(): void;
|
|
45
|
+
/** 吸收消费(create 族——匹配下一个 SSR 节点——类型不符/耗尽 → 失败)
|
|
46
|
+
* **文本分裂(2026-08——SSR 相邻文本合流实战)**:HTML 序列化会把
|
|
47
|
+
* 相邻 createText 合并成一个 DOM 文本节点(如 ` › ` + `InputNumber`
|
|
48
|
+
* → `" › InputNumber"`)——但客户端命令流是两条 createText——按整节点
|
|
49
|
+
* 消费会吞掉后缀(后续 next 找不到文本 → 耗尽 failed)→ 前缀匹配 +
|
|
50
|
+
* splitText 分裂:剩余部分 unshift 回队列头部——命令流 1:1 对齐
|
|
51
|
+
* (procCreateText 传目标 value——prefix 判定) */
|
|
52
|
+
next(kind: 'element' | 'text' | 'comment', tag?: string, value?: string): WfNode | null;
|
|
53
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — commandToHtml(命令事件流 → HTML——流式 SSR 核心)
|
|
3
|
+
*
|
|
4
|
+
* 设计(design/vdom-plan.md §3):服务端消费同一 handler 的 Response——
|
|
5
|
+
* `res.body.pipeThrough(commandToHtml())` → HTTP 流式响应(边构建边吐
|
|
6
|
+
* HTML——React Fizz 同模式):
|
|
7
|
+
* - create(attrs 序列化面)→ 开标签(属性转义——style 对象 → CSS 文本)
|
|
8
|
+
* - createText → 转义文本;createAnchor → 注释占位
|
|
9
|
+
* - close → 闭标签(tag 栈——void 元素不闭合)
|
|
10
|
+
* - insert/remove/setProp(事件/运行时面)/done → 无输出(HTML 无交互面)
|
|
11
|
+
* - setText → 转义文本(增量流场景)
|
|
12
|
+
*
|
|
13
|
+
* 与客户端同构:同一命令流——客户端 apply DOM / 服务端吐 HTML——
|
|
14
|
+
* 精准增量流 → 增量 HTML(服务端驱动更新后续)。
|
|
15
|
+
*/
|
|
16
|
+
import type { Command } from '../command/index.ts';
|
|
17
|
+
/** HTML 转义(文本/属性值) */
|
|
18
|
+
export declare function escapeHtml(s: string): string;
|
|
19
|
+
/** void 元素(自闭——close 不吐闭标签) */
|
|
20
|
+
export declare const VOID_ELEMENTS: Set<string>;
|
|
21
|
+
/** camelCase → kebab-case(style 对象序列化) */
|
|
22
|
+
export declare function kebab(s: string): string;
|
|
23
|
+
/** create attrs → HTML 属性字符串(转义——style 对象 → CSS 文本——boolean 空串) */
|
|
24
|
+
export declare function attrsToHtml(attrs: Record<string, unknown>): string;
|
|
25
|
+
/** 命令事件流 → HTML 字符串流(TransformStream——tag 栈闭合) */
|
|
26
|
+
export declare function commandToHtml(): TransformStream<Command, string>;
|
|
27
|
+
/** 完整 HTML 文档包装(SSR 页面——<!DOCTYPE html> + root 容器) */
|
|
28
|
+
export declare function htmlDocument(html: string, opts?: {
|
|
29
|
+
title?: string;
|
|
30
|
+
rootId?: string;
|
|
31
|
+
data?: Record<string, unknown>;
|
|
32
|
+
}): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/ssr — index(SSR 中转站——自身不处理细节逻辑)
|
|
3
|
+
*
|
|
4
|
+
* 职责:服务端渲染入口(uiSsr——同一 UIRouter 同一 handler)——
|
|
5
|
+
* 具体功能交由独立文件:
|
|
6
|
+
* - html.ts(commandToHtml 流式序列化 + htmlDocument 文档包装)
|
|
7
|
+
* - absorb.ts(客户端结构吸收状态机——首帧复用 SSR DOM)
|
|
8
|
+
*
|
|
9
|
+
* 与客户端同构:同一命令流——客户端 apply DOM / 服务端吐 HTML——
|
|
10
|
+
* 首帧吸收(结构对齐)——接管原子性(mismatch → 回退清空重建)。
|
|
11
|
+
*/
|
|
12
|
+
export { escapeHtml, attrsToHtml, htmlDocument, commandToHtml, VOID_ELEMENTS, kebab } from './html.ts';
|
|
13
|
+
export { AbsorbState } from './absorb.ts';
|
|
14
|
+
import { UIRouter } from '../router.ts';
|
|
15
|
+
/** 服务端渲染选项 */
|
|
16
|
+
export interface SsrOptions {
|
|
17
|
+
title?: string;
|
|
18
|
+
/** __DATA__ 种子(ctx.data 预取结果——序列化进文档) */
|
|
19
|
+
data?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/** 服务端渲染(SSR——同一 router 同一 handler——命令流 → HTML 文档)
|
|
22
|
+
* **无 hydration**(客户端接管结构吸收——SSR = 首屏/SEO + 吸收种子);
|
|
23
|
+
* 函数面(事件)经空函数表编码为 $fn 标记——解码 undefined——
|
|
24
|
+
* commandToHtml 的 setProp no-op——HTML 无运行时面 */
|
|
25
|
+
export declare function uiSsr(router: UIRouter, url: string, opts?: SsrOptions): Promise<string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — component(组件转换——component ↔ X)
|
|
3
|
+
*
|
|
4
|
+
* 场景(条件渲染主场景——组件类型切换):
|
|
5
|
+
* component <-> null({cond && <Comp/>}——卸载/挂载)
|
|
6
|
+
* component <-> fragment(组件输出多根 ↔ 展开项)
|
|
7
|
+
* component <-> element(组件 ↔ 原生元素)
|
|
8
|
+
*
|
|
9
|
+
* 同类型 component → component 不在本表(diff 层复用——工厂不重跑——
|
|
10
|
+
* renderFn 重新调用——let/ref 状态保持);异类型组件(A <-> B)同样
|
|
11
|
+
* 走本表(旧组件卸载 + 新组件由 diff mount)。
|
|
12
|
+
*
|
|
13
|
+
* 转换职责(old=component → new=X):
|
|
14
|
+
* 1. unmountComp(onUnmounts 清理——ctx.onUnmount 注册的回调——逆序执行)
|
|
15
|
+
* 2. 旧组件输出节点移除——**区间完整移除(G2——终态等价违例)**:
|
|
16
|
+
* 组件输出多根 = 隐式 Fragment(展开槽位 parent.i+1...)——只移除首锚
|
|
17
|
+
* 会让第二节点起 DOM 残留(fuzz 实证)——经 registry 查 lastOutput
|
|
18
|
+
* → removeVNodeTree 递归(数组全形态 + 组件项 unmount)
|
|
19
|
+
* 3. 新节点由 diff 渲染到同一位置(首锚位置)
|
|
20
|
+
*/
|
|
21
|
+
import type { TransitionFn } from './index.ts';
|
|
22
|
+
/** component → X:组件卸载(onUnmounts)+ 输出区间移除(让位) */
|
|
23
|
+
export declare const transitionComponent: TransitionFn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — element(元素转换——element ↔ X)
|
|
3
|
+
*
|
|
4
|
+
* 场景:类型切换(<div/> <-> 组件 / <div/> <-> 文本 / <div/> <-> null)。
|
|
5
|
+
* 同态 element → element 不在本表(就地 patch——diff 层:属性/事件/children)。
|
|
6
|
+
*
|
|
7
|
+
* 转换职责(old=element → new=X):
|
|
8
|
+
* 1. 旧元素移除(remove oldId——含子树——事件监听随元素 GC)
|
|
9
|
+
* 2. 新节点由 diff 渲染到同一位置
|
|
10
|
+
* —— 旧元素若为组件输出根(组件卸载语义)——组件侧先 unmount
|
|
11
|
+
*/
|
|
12
|
+
import type { TransitionFn } from './index.ts';
|
|
13
|
+
/** element → X:旧元素移除(含子树——让位)
|
|
14
|
+
* **根本修复(C2——统一区间移除)**:单锚 remove 只删元素自身——子树内
|
|
15
|
+
* 组件实例(unkeyed compId = DOM 槽位 id)残留(onUnmounts 不执行——
|
|
16
|
+
* S_INST 面——组件树 fuzz 实证)——removeVNodeTree 递归:声明子树槽位 +
|
|
17
|
+
* 组件项 unmount + 组件输出区间(registry 查 lastOutput)——与
|
|
18
|
+
* transitionComponent/transitionFragment 统一——消费端零猜测
|
|
19
|
+
* (procRemove 前缀卸载因 id 空间重叠误删——deep-tour 回归——回退——
|
|
20
|
+
* 卸载信息由 diff 层完整生成) */
|
|
21
|
+
export declare const transitionElement: TransitionFn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — fragment(Fragment/数组转换——fragment ↔ X)
|
|
3
|
+
*
|
|
4
|
+
* 场景(隐式 Fragment——数组/`<></>`/组件输出多根):
|
|
5
|
+
* fragment <-> null(空数组 ↔ 条件渲染)
|
|
6
|
+
* fragment <-> element(展开项 ↔ 单元素)
|
|
7
|
+
* fragment <-> component(展开项 ↔ 组件)
|
|
8
|
+
*
|
|
9
|
+
* 同态 fragment → fragment 不在本表(diff 层逐项转换——keyed/unkeyed
|
|
10
|
+
* 列表 diff——按位置/key 逐项对比)。
|
|
11
|
+
*
|
|
12
|
+
* 转换职责(old=fragment → new=X):**旧展开区间完整清理**(数组/多节点
|
|
13
|
+
* 递归 remove——不是只清首锚——数组多项残留事故的根治)——新侧经
|
|
14
|
+
* emitNode 渲染到同一位置。
|
|
15
|
+
*/
|
|
16
|
+
import type { TransitionFn } from './index.ts';
|
|
17
|
+
/** fragment → X:旧展开区间完整清理(数组逐项递归——非只清首锚)+
|
|
18
|
+
* 新侧渲染到同一位置(展开位置连续——pathId(parent, index + ci))
|
|
19
|
+
* **单一实现源**:区间移除统一 removeVNodeTree(cleanup.ts——FRAG 展开
|
|
20
|
+
* 到父级槽位/数组全形态/组件 unmount——与 diff 各路径共享——防双实现漂移) */
|
|
21
|
+
export declare const transitionFragment: TransitionFn;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — hole(空洞转换——null <-> X 主场景)
|
|
3
|
+
*
|
|
4
|
+
* 条件渲染核心(设计规则 §6.3——占位法):`{cond && <X/>}` = false 占位锚——
|
|
5
|
+
* cond 翻转时 **占位锚 ↔ 真实节点互换**(禁止 removeChild 塌缩 childNodes——
|
|
6
|
+
* 长度恒定则预捕获索引全有效——提交按钮消失事故的根治)。
|
|
7
|
+
*
|
|
8
|
+
* 转换职责(old=hole → new=X):旧占位锚移除(让位)——新节点由 diff
|
|
9
|
+
* 主循环渲染到同一位置(parent/ref)——childNodes 长度不变(1:1 互换)。
|
|
10
|
+
*/
|
|
11
|
+
import type { TransitionFn } from './index.ts';
|
|
12
|
+
/** hole → X:旧占位锚移除(让位——新节点 diff 渲染到同一位置) */
|
|
13
|
+
export declare const transitionHole: TransitionFn;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — 节点转换状态机(节点类型之间的转换渲染)
|
|
3
|
+
*
|
|
4
|
+
* 场景(diff 重渲染——旧节点 × 新节点类型不同):
|
|
5
|
+
* null <-> component / null <-> fragment / component <-> fragment /
|
|
6
|
+
* element <-> component / hole <-> element / text <-> element ...
|
|
7
|
+
*
|
|
8
|
+
* 核心不变量(设计规则 §4.0/§6.3——占位法):
|
|
9
|
+
* - **childNodes 长度恒等于 children 数组长度**——任何转换保持节点数 1:1
|
|
10
|
+
* (空洞占位锚是 DOM 里的真实节点——转换 = 锚 ↔ 真实节点 replaceChild 互换——
|
|
11
|
+
* 禁止 removeChild 塌缩)
|
|
12
|
+
* - 组件输出多根 = 隐式 Fragment——锚点管理(首/尾锚——_childAnchors 语义)
|
|
13
|
+
* - 组件卸载 = unmountComp(onUnmounts 清理)+ 输出节点移除
|
|
14
|
+
*
|
|
15
|
+
* 转换表(table.ts):oldKind × newKind → 策略函数(各状态文件实现)
|
|
16
|
+
* text.ts / hole.ts / element.ts / component.ts / fragment.ts
|
|
17
|
+
*/
|
|
18
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
19
|
+
import type { ComponentRegistry } from '../node/component.ts';
|
|
20
|
+
export type NodeState = 'text' | 'hole' | 'element' | 'component' | 'fragment' | 'array';
|
|
21
|
+
/** 转换上下文(diff 调用——命令发射 + 新侧渲染 + 位置信息) */
|
|
22
|
+
export interface TransformContext {
|
|
23
|
+
/** 命令发射(旧侧让位:remove/unmountComp——diff 生成的命令序列) */
|
|
24
|
+
emit(cmd: unknown): void;
|
|
25
|
+
/** 新侧渲染(sink——共享分发器——转换函数内部完成完整转换) */
|
|
26
|
+
emitNode(v: VNodeChild, parent: string, index: number, ref: string | null): Promise<void>;
|
|
27
|
+
/** 旧节点锚/元素 id(旧树 id——diff 的 oldId 空间) */
|
|
28
|
+
oldId: string;
|
|
29
|
+
/** 新节点 id(新树 id——diff 的 newId 空间) */
|
|
30
|
+
newId: string;
|
|
31
|
+
/** 父节点 id('root' = 根容器) */
|
|
32
|
+
parent: string;
|
|
33
|
+
/** 新侧位置 index(emitNode 用) */
|
|
34
|
+
index: number;
|
|
35
|
+
/** 前一个兄弟 id(插入位置——null = 尾部) */
|
|
36
|
+
ref: string | null;
|
|
37
|
+
/** 旧组件实例 id(component 转换时——卸载/复用) */
|
|
38
|
+
oldCompId?: string;
|
|
39
|
+
/** 组件实例注册表(区间清理查 lastOutput——组件多根完整移除——G2) */
|
|
40
|
+
registry?: ComponentRegistry | null;
|
|
41
|
+
}
|
|
42
|
+
/** 新侧渲染 sink(与 build 的 RenderSink 同形——transform 不依赖 build) */
|
|
43
|
+
export type TransformSink = (v: VNodeChild, parent: string, index: number, ref: string | null) => Promise<void>;
|
|
44
|
+
/** 转换策略函数(各状态文件实现——**完整转换**:旧侧让位命令 + ctx.emitNode
|
|
45
|
+
* 新侧渲染——返回 Promise 支持异步组件) */
|
|
46
|
+
export type TransitionFn = (oldNode: unknown, nextNode: VNodeChild, ctx: TransformContext) => Promise<void> | void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — states(节点状态定义与判定)
|
|
3
|
+
*
|
|
4
|
+
* 状态 = 节点类别(转换状态机的维度):
|
|
5
|
+
* text —— string/number(文本节点)
|
|
6
|
+
* hole —— null/undefined/boolean(空洞占位锚——DOM 有真实注释节点)
|
|
7
|
+
* element —— string type(原生元素)
|
|
8
|
+
* component —— 函数 type(两阶段组件——输出多根 = 隐式 Fragment)
|
|
9
|
+
* fragment —— Fragment 符号/数组(隐式 Fragment——多节点展开)
|
|
10
|
+
|
|
11
|
+
* array —— VNodeChild[](childrenOf 已展开的防御态)
|
|
12
|
+
*
|
|
13
|
+
* 判定复用 node.ts kindOf(唯一判定点)——状态是 kindOf 的转换语义面。
|
|
14
|
+
*/
|
|
15
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
16
|
+
import type { NodeState } from './index.ts';
|
|
17
|
+
/** 节点状态判定(kindOf → NodeState——语义别名——invalid 归 hole 占位) */
|
|
18
|
+
export declare function stateOf(v: VNodeChild | null | undefined): NodeState;
|
|
19
|
+
/** 是否「同态」(旧新状态相同——可走就地 patch 而非重建) */
|
|
20
|
+
export declare function isSameState(oldState: NodeState, newState: NodeState): boolean;
|
|
21
|
+
/** 是否组件输出态(组件/fragment——多节点锚点管理) */
|
|
22
|
+
export declare function isMultiNode(state: NodeState): boolean;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — table(转换表——状态机核心)
|
|
3
|
+
*
|
|
4
|
+
* 转换表:oldState × newState → 策略函数(各状态文件实现)——
|
|
5
|
+
* 同态(对角)走「就地 patch」(text→setText / element→就地 diff /
|
|
6
|
+
* component→同类型复用 / hole→no-op);异态走「转换」——
|
|
7
|
+
* 占位法核心:**锚 ↔ 真实节点 replaceChild 互换**(childNodes 长度恒定——
|
|
8
|
+
* 同构不变量——禁止 removeChild 塌缩)。
|
|
9
|
+
*
|
|
10
|
+
* 转换策略(各文件实现):
|
|
11
|
+
* text.ts —— text ↔ element/component/fragment(文本节点 ↔ 结构)
|
|
12
|
+
* hole.ts —— hole ↔ element/component/fragment/text
|
|
13
|
+
* (**null <-> component / null <-> fragment 主场景**——
|
|
14
|
+
* 条件渲染 cond ? <X/> : null 的类型切换)
|
|
15
|
+
* element.ts —— element ↔ component/fragment/hole/text
|
|
16
|
+
* component.ts —— component ↔ element/fragment/hole(同类型复用——
|
|
17
|
+
* 异类型卸载 + 重建)
|
|
18
|
+
* fragment.ts —— fragment ↔ element/component/hole(多节点展开 ↔ 单节点)
|
|
19
|
+
|
|
20
|
+
*/
|
|
21
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
22
|
+
import type { NodeState, TransformContext, TransitionFn } from './index.ts';
|
|
23
|
+
/** 转换表(old × new → 策略)——同态 = 就地 patch(diff 层处理——表中为 null) */
|
|
24
|
+
export declare const TRANSITIONS: Record<NodeState, Record<NodeState, TransitionFn | null>>;
|
|
25
|
+
/** 转换调度(old × next → 策略)——同态返回 null(diff 就地 patch——不重建) */
|
|
26
|
+
export declare function transitionOf(oldState: NodeState, newState: NodeState): TransitionFn | null;
|
|
27
|
+
/** 执行转换(diff 调用——自动降级:同态/null 策略 → no-op) */
|
|
28
|
+
export declare function runTransition(oldState: NodeState, newState: NodeState, oldNode: unknown, nextNode: VNodeChild, ctx: TransformContext): Promise<void> | void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom transform — text(文本转换——text ↔ X)
|
|
3
|
+
*
|
|
4
|
+
* 场景:条件渲染/列表项类型切换('a' <-> <div/> <-> 组件...)。
|
|
5
|
+
* 转换职责(old=text → new=X):旧文本节点移除(让位)——新节点由 diff
|
|
6
|
+
* 渲染到同一位置。同态 text → text 不在本表(就地 setText——diff 层)。
|
|
7
|
+
*/
|
|
8
|
+
import type { TransitionFn } from './index.ts';
|
|
9
|
+
/** text → X:旧文本节点移除(让位) */
|
|
10
|
+
export declare const transitionText: TransitionFn;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — vnode 纯数据面(独立实现——零引用 ui-dom)
|
|
3
|
+
*
|
|
4
|
+
* 设计(对齐 vdom-x 契约 + 设计规则 §4.0/§6.3):
|
|
5
|
+
* ① vnode 纯数据——零回填字段(el/_render/_id 等全部在影子层——可自由克隆/
|
|
6
|
+
* 比较/序列化——用户写 JSX 就能推导 vnode 形状)
|
|
7
|
+
* ② h() 除 key 剥离外零转换——children 原样(false/嵌套数组保留——不 filter)
|
|
8
|
+
* ③ key 业务身份声明协议:key 从 props 剥离进 vnode.key(组件 props 不见 key)
|
|
9
|
+
* ④ children 值域协议:vnode/string/number/boolean/空洞(null/undefined)/嵌套数组
|
|
10
|
+
* (数组 = 隐式 Fragment——递归展开统一在 childrenOf——单一规则源——
|
|
11
|
+
* 空洞保留——占位法保长度恒定)
|
|
12
|
+
* ⑤ 组件两阶段:工厂 = mount(一次——初始化状态/订阅/数据预取);
|
|
13
|
+
* renderFn = 每次渲染(同步或 async——异步边界 = ctx.data 管道——不挂起)
|
|
14
|
+
* ⑥ Fragment 内部符号——公共面不导出(数组 = 隐式 Fragment;
|
|
15
|
+
* `<></>` 经 jsx-runtime 子路径)
|
|
16
|
+
*/
|
|
17
|
+
import type { UIContext } from '../context/UIContext.ts';
|
|
18
|
+
/** vnode——纯数据 */
|
|
19
|
+
export interface VNode {
|
|
20
|
+
/** 标签名 / 组件 / 内部符号(Fragment) */
|
|
21
|
+
type: string | symbol | Component;
|
|
22
|
+
props: Record<string, unknown>;
|
|
23
|
+
/** 业务身份声明(无自动生成——无 key = 位置身份) */
|
|
24
|
+
key: string | null;
|
|
25
|
+
children?: VNodeChild[];
|
|
26
|
+
}
|
|
27
|
+
/** children 值域:vnode/string/number/boolean/空洞/嵌套数组(数组 = 隐式 Fragment) */
|
|
28
|
+
export type VNodeChild = VNode | string | number | boolean | null | undefined | VNodeChild[];
|
|
29
|
+
/** renderFn——每次渲染(读最新 props——同步或 async——异步边界 = ctx.data) */
|
|
30
|
+
export type RenderFn<P = Record<string, unknown>> = (props: P) => VNode | null | (VNode | null)[] | Promise<VNode | null | (VNode | null)[]>;
|
|
31
|
+
/** 组件(两阶段):
|
|
32
|
+
* 工厂 = mount(一次——初始化状态/订阅/数据预取(await ctx.data——管道保证))
|
|
33
|
+
* renderFn = 每次渲染(ctx.render()/props 变化触发) */
|
|
34
|
+
export type Component<P = Record<string, unknown>, C = UIContext> = (initProps: P, ctx: C) => RenderFn<P> | Promise<RenderFn<P>>;
|
|
35
|
+
type HType = string | symbol | Component<any, any>;
|
|
36
|
+
/** h()——创建 vnode(纯数据——除 key 剥离外零转换)
|
|
37
|
+
* children 原样:单子节点直接存、多子节点存数组、无子节点不存——false/嵌套
|
|
38
|
+
* 数组保留(不 filter——空洞占位法在消费侧) */
|
|
39
|
+
export declare function h(type: HType, props?: Record<string, unknown> | null, ...children: VNodeChild[]): VNode;
|
|
40
|
+
/** jsx 运行时(自动导入——`<div/>` 编译目标——React 兼容签名 jsx(type, props, key)——
|
|
41
|
+
* props 内 key 同样剥离;jsxs/jsxDEV 同形状(children 已在 props.children) */
|
|
42
|
+
export declare function jsx(type: HType, props: Record<string, unknown> | null, key?: string | null): VNode;
|
|
43
|
+
export declare const jsxs: typeof jsx;
|
|
44
|
+
export declare const jsxDEV: typeof jsx;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** renderFn 执行窗口(begin/end——渲染路径副作用检测) */
|
|
2
|
+
export declare function beginRender(): void;
|
|
3
|
+
export declare function endRender(): void;
|
|
4
|
+
/** 安装守卫(幂等——patch 一次):
|
|
5
|
+
* @param target 浏览器 window / node globalThis(SSR 端)
|
|
6
|
+
* @param ssrOnly SSR 端——warn + noop(timer 不执行——unhandledRejection
|
|
7
|
+
* 崩溃链阻断——服务器进程保护);浏览器端 warn-only */
|
|
8
|
+
export declare function installEffectGuard(target: unknown, ssrOnly?: boolean): void;
|