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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom command — props(属性/文本更新命令)
|
|
3
|
+
*
|
|
4
|
+
* setProp = 运行时面(事件/ref/property——不可序列化——服务端 no-op——
|
|
5
|
+
* 客户端 apply 三通道分发:on[A-Z] → events / PROPERTY_KEYS → props /
|
|
6
|
+
* ref → ref.ts / 其余 → attributes)。
|
|
7
|
+
* prev = 旧值(diff 提供——事件解绑/属性还原——引用变化重绑正确性)。
|
|
8
|
+
*/
|
|
9
|
+
/** 运行时属性/事件/ref(prev = 旧值——diff 提供) */
|
|
10
|
+
export type SetPropCommand = {
|
|
11
|
+
op: 'setProp';
|
|
12
|
+
id: string;
|
|
13
|
+
key: string;
|
|
14
|
+
value: unknown;
|
|
15
|
+
prev?: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** 文本更新 */
|
|
18
|
+
export type SetTextCommand = {
|
|
19
|
+
op: 'setText';
|
|
20
|
+
id: string;
|
|
21
|
+
value: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — attrs(属性精准 diff——值比较——最小命令集)
|
|
3
|
+
*
|
|
4
|
+
* 职责(diff 层的细节模块):静态面值比较(只发变化键 + 旧有新的没有 →
|
|
5
|
+
* undefined 移除);函数面引用比较(prev !== next 才发——prev 传递)。
|
|
6
|
+
*/
|
|
7
|
+
import type { VNode } from '../vnode.ts';
|
|
8
|
+
import type { Command } from '../command/index.ts';
|
|
9
|
+
/** 属性精准 diff(值比较——只发变化的键;函数面引用比较——prev 传递) */
|
|
10
|
+
export declare function diffAttrs(oldV: VNode, newV: VNode, id: string, emitCommand: (cmd: Command) => void): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — children(children 对照 + keyed 列表策略——细节模块)
|
|
3
|
+
*
|
|
4
|
+
* 职责:children 列表对照——A 级检测(长度变化 + 无 key 组件 warn)、
|
|
5
|
+
* 列表分类(all-keyed/含 keyed/unkeyed)、diffSlot 单槽对照(位置身份——
|
|
6
|
+
* 含 null ↔ null 空洞保持)、diffKeyedChildren(相对顺序检测——顺移
|
|
7
|
+
* noMove remap / 交换重建 / 实例复用)、emitWithKey(keyed 项渲染)。
|
|
8
|
+
*
|
|
9
|
+
* diff/same 只做中转——本文件为列表策略细节。
|
|
10
|
+
*/
|
|
11
|
+
import type { VNode, VNodeChild } from '../vnode.ts';
|
|
12
|
+
import { type ComponentRegistry } from '../node/component.ts';
|
|
13
|
+
import type { Command } from '../command/index.ts';
|
|
14
|
+
import type { RenderSink } from '../build.ts';
|
|
15
|
+
import type { UIContext } from '../../context/UIContext.ts';
|
|
16
|
+
/** children 对照(列表分类:全 unkeyed 位置身份 / 全 keyed 身份复用 / 混合) */
|
|
17
|
+
export declare function diffChildren(oldV: VNode, newV: VNode, id: string, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry): Promise<void>;
|
|
18
|
+
/** children 项对照(列表分类:全 unkeyed 位置身份 / 全 keyed 身份复用 / 混合——
|
|
19
|
+
* 组件数组输出(隐式 Fragment)同用——旧项移除清理) */
|
|
20
|
+
export declare function diffChildrenItems(oldCs: VNodeChild[], newCs: VNodeChild[], id: string, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry, shapeChanged?: boolean): Promise<void>;
|
|
21
|
+
export declare function hasKeyed(items: VNodeChild[]): boolean;
|
|
22
|
+
/** keyed 列表对照(身份映射——增删/重排状态跟随 key)
|
|
23
|
+
* **move 版**(2026-12):复用项位置变化 → **move 命令**(DOM 不重建——
|
|
24
|
+
* 节点移动 + 子树 id 重映射——焦点保持);位置不变 → 组件输出对照(精准);
|
|
25
|
+
* 真移除 → unmount + remove;新增 → 新侧渲染 */
|
|
26
|
+
export declare function diffKeyedChildren(oldCs: VNodeChild[], newCs: VNodeChild[], parent: string, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry): Promise<void>;
|
|
27
|
+
/** keyed 项渲染(compId = 位置路径 + .k{key}——身份稳定——增删/重排复用)
|
|
28
|
+
* 组件输出对照(lastOutput → diffSame 精准——move 后节点已在新位置) */
|
|
29
|
+
export declare function emitWithKey(v: VNodeChild, parent: string, index: number, ref: string | null, key: string, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — cleanup(旧输出递归清理——纯逻辑)
|
|
3
|
+
*
|
|
4
|
+
* 职责(diff 层的细节模块):组件类型切换/数组 ↔ 单节点转换——旧输出
|
|
5
|
+
* 按 vnode 结构递归 remove(同构保持)。
|
|
6
|
+
*
|
|
7
|
+
* **数组安全(G1——终态等价违例)**:lastOutput 可为数组(组件输出多根)
|
|
8
|
+
* ——childrenOf 对数组读 v.props 崩溃(TypeError 中断渲染管线——fuzz 实证)
|
|
9
|
+
* ——VNodeChild 全形态递归(数组逐项按展开槽位 id)。
|
|
10
|
+
* **组件项 unmount(G5/G7 区间语义)**:组件 vnode 项 → unmount——compId
|
|
11
|
+
* 与渲染路径一致:keyed → `${parent}.k{key}`(parent = 项所在容器 id);
|
|
12
|
+
* unkeyed → 项槽位 id(base)。
|
|
13
|
+
*/
|
|
14
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
15
|
+
import type { Command } from '../command/index.ts';
|
|
16
|
+
import { type ComponentRegistry } from '../node/component.ts';
|
|
17
|
+
/** **组件输出清理基线(C2——outIsComponent 特判的 id 空间统一)**:
|
|
18
|
+
* renderComponent 输出组件时 sink 用 compId 作 parent(特判——防 compId
|
|
19
|
+
* 冲突)——输出 DOM 的 id 空间:
|
|
20
|
+
* - 单 vnode 组件 → pathId(compId, 0)(首槽)
|
|
21
|
+
* - 数组首项组件 → compId(数组展开 pathId(compId, i))
|
|
22
|
+
* - 普通输出 → 槽位 id(slotId——锚点法)
|
|
23
|
+
* 清理递归必须以**同一基线**计算——否则组件项 unmount compId 错位
|
|
24
|
+
* (unmount 外层实例/内层残留——组件 fuzz 89% 不等价实证——S_INST 面
|
|
25
|
+
* 错乱) */
|
|
26
|
+
export declare function outputBase(out: VNodeChild, compId: string, slotId: string): string;
|
|
27
|
+
/** 组件输出清理的 parent 语义(**证明审计——sink 特判对齐——单一实现源**):
|
|
28
|
+
* 顶层/递归调用 removeVNodeTree 的 parent 参数 = 渲染时 sink 的 parent:
|
|
29
|
+
* - 输出组件(keyed)→ compId(outIsCompNode 特判——sink(组件, compId, 0)——
|
|
30
|
+
* 内层 keyed 组件 compId = keyedId(compId, key)——传槽位父则错位
|
|
31
|
+
* (root.0.0.kk1 渲染 vs root.0.kk1 清理——实证))
|
|
32
|
+
* - 输出数组 → compId(数组展开容器——数组分支内部已用 base——顶层
|
|
33
|
+
* parent 不参与——但保持 compId 语义一致)
|
|
34
|
+
* - 输出 Fragment → 槽位父(sink parent 分支——展开挂槽位父——index
|
|
35
|
+
* 推导 + 内项 keyedId(槽位父) 依赖)
|
|
36
|
+
* - 元素/文本/空洞 → 不依赖 parent(children 递归用 base)——槽位父安全 */
|
|
37
|
+
export declare function removalParent(child: VNodeChild, compId: string, slotParent: string): string;
|
|
38
|
+
/** 旧输出递归清理(组件类型切换——remove 命令——同构保持)
|
|
39
|
+
* @param v 旧输出(VNodeChild 全形态——数组 = 组件输出多根)
|
|
40
|
+
* @param base 当前项 id(顶层 = outputBase 计算;递归 = pathId(base, i))
|
|
41
|
+
* @param parent 当前容器 id(keyed 组件项 compId 用——渲染 sink 的 parent)
|
|
42
|
+
* @param registry 组件实例注册表(可选——组件项输出区间递归清理——
|
|
43
|
+
* 嵌套组件 A > B > C 的 B 多根展开——C2) */
|
|
44
|
+
export declare function removeVNodeTree(v: VNodeChild, base: string, parent: string, emitCommand: (cmd: Command) => void, registry?: ComponentRegistry | null): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — index(diff 阶段中转站)
|
|
3
|
+
*
|
|
4
|
+
* 职责:**中转站——自身不处理细节逻辑**——root 级对照决策
|
|
5
|
+
* (transitionOf 查表——异态交 transform / 同态交 diffSame)——细节
|
|
6
|
+
* 下沉独立模块:
|
|
7
|
+
* - same.ts:同态对照决策(组件/元素分支——再中转)
|
|
8
|
+
* - attrs.ts:属性值比较(精准命令)
|
|
9
|
+
* - children.ts:children 对照 + keyed 列表策略
|
|
10
|
+
* - output.ts:组件输出对照(null ↔ vnode/数组对照)
|
|
11
|
+
* - cleanup.ts:旧输出递归清理
|
|
12
|
+
* - transform/:类型转换状态机(异态执行)
|
|
13
|
+
*/
|
|
14
|
+
import type { VNode } from '../vnode.ts';
|
|
15
|
+
import type { ComponentRegistry } from '../node/component.ts';
|
|
16
|
+
import type { UIContext } from '../../context/UIContext.ts';
|
|
17
|
+
import type { Command } from '../command/index.ts';
|
|
18
|
+
/**
|
|
19
|
+
* diff:旧树 → 新树——精准增量命令事件流
|
|
20
|
+
* ctx:组件共享上下文;registry:组件实例注册表(跨渲染保持)
|
|
21
|
+
*/
|
|
22
|
+
export declare function diffStream(oldTree: VNode, newTree: VNode, ctx: UIContext, registry: ComponentRegistry): ReadableStream<Command>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — output(组件输出对照——细节模块)
|
|
3
|
+
*
|
|
4
|
+
* 职责:组件 renderFn 输出的对照决策——输出级空值转换(null ↔ vnode——
|
|
5
|
+
* transform 状态机)、单节点对照(diffSame)、数组输出对照(逐项 diffSlot)、
|
|
6
|
+
* 数组 ↔ 单节点(transform——旧展开区间递归清理)、类型切换(卸载重建)。
|
|
7
|
+
*
|
|
8
|
+
* diffSame 组件分支的 sink 在此实现——diff/same 只做中转。
|
|
9
|
+
*/
|
|
10
|
+
import type { VNode, VNodeChild } from '../vnode.ts';
|
|
11
|
+
import type { Command } from '../command/index.ts';
|
|
12
|
+
import type { RenderSink } from '../build.ts';
|
|
13
|
+
import type { ComponentRegistry, CompOutput } from '../node/component.ts';
|
|
14
|
+
import type { UIContext } from '../../context/UIContext.ts';
|
|
15
|
+
/** 组件输出对照(组件分支 sink——细节集中在此)
|
|
16
|
+
* **方案 3——判别联合穷尽**:oldOut 为 CompOutput(null 结构性消除)——
|
|
17
|
+
* switch(kind) 编译器强制——hole(空洞锚)与真实输出同等处理——
|
|
18
|
+
* undefined = 未渲染(首帧——全量渲染) */
|
|
19
|
+
export declare function diffComponentOutput(oldOut: CompOutput | undefined, out: VNodeChild, p: string, i: number, r: string | null, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry, diffSame: (oldV: VNode, newV: VNode, parent: string, index: number, ref: string | null, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry) => Promise<void>,
|
|
20
|
+
/** 组件实例 compId(**证明审计——输出形态 id 空间**):组件输出单元素
|
|
21
|
+
* 挂槽位(锚点法——id = compId);空洞/数组/组件输出挂 compId 子空间
|
|
22
|
+
* (compId.0 起)——转换的 oldId 必须按**旧输出形态**计算(p/i 是
|
|
23
|
+
* 新输出的 sink 参数——数组/空洞输出时 p=compId、i=0——outId 对新
|
|
24
|
+
* 输出正确对旧输出错位——可变输出 div→数组/收缩/展开实证——旧 div
|
|
25
|
+
* 保留 + 锚插入 + 实例残留)
|
|
26
|
+
* @param slotId 组件槽位(单元素/文本输出挂载点——= pathId(渲染父,
|
|
27
|
+
* 渲染索引)——keyed 组件 compId ≠ 槽位——必须由调用点提供)
|
|
28
|
+
* @param keyedOut keyed 组件输出回调(对照分支——keyed 输出组件的
|
|
29
|
+
* rec 在 keyedId(p, key)——diffSame 按槽位查落空——递归 emitWithKey) */
|
|
30
|
+
compId: string, slotId: string, keyedOut?: (out: VNodeChild, p: string, i: number, r: string | null, key: string) => Promise<void>): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/diff — same(同态对照决策——中转)
|
|
3
|
+
*
|
|
4
|
+
* 职责:同位置同类型的对照决策——组件分支(类型比较/复用——输出对照
|
|
5
|
+
* 细节在 output.ts)、元素分支(diffAttrs + diffChildren——细节在
|
|
6
|
+
* attrs.ts/children.ts)。
|
|
7
|
+
*
|
|
8
|
+
* 本文件是「对照决策的中转站」——具体命令生成下沉 attrs/children/output/
|
|
9
|
+
* cleanup——自身不处理细节逻辑。
|
|
10
|
+
*/
|
|
11
|
+
import type { VNode } from '../vnode.ts';
|
|
12
|
+
import { type ComponentRegistry } from '../node/component.ts';
|
|
13
|
+
import type { Command } from '../command/index.ts';
|
|
14
|
+
import type { RenderSink } from '../build.ts';
|
|
15
|
+
import type { UIContext } from '../../context/UIContext.ts';
|
|
16
|
+
/**
|
|
17
|
+
* 同态对照(同位置同类型——**精准命令生成**):
|
|
18
|
+
* 组件 → renderComponent 复用(工厂不重跑——lastOutput 对照递归);
|
|
19
|
+
* 元素 → 属性值比较(只发变化)+ 函数面引用比较 + children 递归(列表分类)
|
|
20
|
+
*/
|
|
21
|
+
export declare function diffSame(oldV: VNode, newV: VNode, parent: string, index: number, ref: string | null, emit: RenderSink, emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry): Promise<void>;
|
|
22
|
+
/** 属性精准 diff(值比较——只发变化的键;函数面引用比较——prev 传递) */
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — attribute 通道(可序列化面——create 携带的 attrs / setProp 兜底)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0 属性三通道——attribute/property/event):
|
|
5
|
+
* - class/className → setAttribute('class')
|
|
6
|
+
* - style → style.ts(对象应用/数字单位/undefined 清空——独立复杂面)
|
|
7
|
+
* - enumerated 白名单(draggable/contenteditable/spellcheck)——**空字符串解析
|
|
8
|
+
* 为 false**(Kanban 教训)——显式 'true'/'false'
|
|
9
|
+
* - boolean attribute(disabled/hidden 等)→ setAttribute(key, '')
|
|
10
|
+
* - 其余字符串化 setAttribute;null/undefined/false → removeAttribute
|
|
11
|
+
*/
|
|
12
|
+
/** enumerated 属性白名单(HTML 规范——空字符串语义非 true) */
|
|
13
|
+
export declare const ENUMERATED_KEYS: Set<string>;
|
|
14
|
+
/** attribute 通道——单键应用 */
|
|
15
|
+
export declare function applyAttribute(el: HTMLElement, key: string, value: unknown): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/field — events(事件通道——**事件代理**)
|
|
3
|
+
*
|
|
4
|
+
* 设计(2026-12 用户决策——事件代理):
|
|
5
|
+
* - **事件表**(EventRegistry——nodeId → event → handler)——setProp 事件
|
|
6
|
+
* 写入表(**不直接 addEventListener**——prev 解绑由表替换取代——
|
|
7
|
+
* 重复绑定根治天然)
|
|
8
|
+
* - **根代理**:document 捕获阶段监听(动态注册——首次绑定某事件类型)——
|
|
9
|
+
* portal(#__wf_portal 在 body 下)可达——不冒泡事件(scroll/
|
|
10
|
+
* mouseenter)捕获可达
|
|
11
|
+
* - **分发**(模拟冒泡语义——vdom3 同款):e.target 向上祖先链——
|
|
12
|
+
* data-wf-id 查表——currentTarget 还原绑定元素(组件库依赖)——
|
|
13
|
+
* handler 内 stopPropagation(cancelBubble)停止向上——与原生冒泡一致
|
|
14
|
+
* - **监听器数量 O(事件类型)** vs O(N)(列表/表格场景)——动态节点天然
|
|
15
|
+
* (增删无需绑定/解绑——查表)
|
|
16
|
+
* - 生命周期:remove/done 清理表(子树前缀);dispose 移除全部根监听
|
|
17
|
+
*
|
|
18
|
+
* 规则(设计规则 §6.4):on + 大写判定(once/only 不误判);事件名小写化;
|
|
19
|
+
* 非函数值 warn + 跳过。
|
|
20
|
+
*/
|
|
21
|
+
/** 事件注册表 + 根代理(per serve 实例——document 捕获监听) */
|
|
22
|
+
export declare class EventRegistry {
|
|
23
|
+
private table;
|
|
24
|
+
private rootTypes;
|
|
25
|
+
private doc;
|
|
26
|
+
private dispatchBound;
|
|
27
|
+
/** 容器过滤(命令式弹窗独立 applier——事件仅分发容器内 target——
|
|
28
|
+
* 独立 applier 的节点 id 与主树同路径(root.0.x)——document 捕获时
|
|
29
|
+
* 主树按钮祖先链命中独立表(onRemove 误触发——toast 多条 bug 实证)) */
|
|
30
|
+
private container?;
|
|
31
|
+
/** 生命周期状态机(**全部状态机化——2026-XX**):active → disposed
|
|
32
|
+
* (dispose 消费——之后 set/remove 违例报错——不再静默写死表) */
|
|
33
|
+
private phase;
|
|
34
|
+
constructor(doc: Document, container?: HTMLElement | null);
|
|
35
|
+
/** 事件注册(代理写入——不直接绑定) */
|
|
36
|
+
set(nodeId: string, event: string, handler: unknown): void;
|
|
37
|
+
get(nodeId: string, event: string): EventListener | undefined;
|
|
38
|
+
/** 单事件删除(差集对称——setProp undefined 消费——G4)——
|
|
39
|
+
* 与 remove(nodeId)(全子树删除)区分——只删一个 (nodeId, event) 对 */
|
|
40
|
+
removeEvent(nodeId: string, event: string): void;
|
|
41
|
+
/** 子树清理(id 前缀匹配——remove/done 卸载指令) */
|
|
42
|
+
remove(nodeId: string): void;
|
|
43
|
+
/** 根监听动态注册(document 捕获——首次绑定某事件类型——容器过滤可达) */
|
|
44
|
+
private ensureRoot;
|
|
45
|
+
/** 分发(模拟冒泡——target 向上祖先链查表——currentTarget 还原——
|
|
46
|
+
* handler 内 stopPropagation 停止向上) */
|
|
47
|
+
private dispatch;
|
|
48
|
+
/** 卸载清理(移除全部根监听 + 清表)——状态机迁移:active → disposed */
|
|
49
|
+
dispose(): void;
|
|
50
|
+
}
|
|
51
|
+
/** 事件 prop 判定(on + 大写——`once`/`only` 不误判) */
|
|
52
|
+
export declare const EVENT_RE: RegExp;
|
|
53
|
+
/** 事件名解析(onClick → click;非事件返回 null) */
|
|
54
|
+
export declare function eventName(key: string): string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/field — 属性三通道 + key/ref/style(字段处理统一出口)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0——属性三通道):setProp 按通道分发——
|
|
5
|
+
* on[A-Z] → events(事件绑定——on + 大写判定——once/only 不误判)
|
|
6
|
+
* PROPERTY_KEYS → props(DOM property——value/checked 白名单——
|
|
7
|
+
* setAttribute 不更新输入值)
|
|
8
|
+
* ref → ref(挂载 el/卸载 null——同引用幂等——设计规则 §5.1 纪律)
|
|
9
|
+
* style → style(对象/字符串/数字 px/UNITLESS/--var/清空防残留)
|
|
10
|
+
* key → key(业务身份声明协议——h/jsx 剥离——props 不泄漏)
|
|
11
|
+
* 其余 → attributes(attribute 通道——enumerated 白名单显式 true/false——
|
|
12
|
+
* boolean 空字符串=存在——null/undefined/false removeAttribute)
|
|
13
|
+
*/
|
|
14
|
+
export { applyAttribute, ENUMERATED_KEYS } from './attributes.ts';
|
|
15
|
+
export { applyProperty, isPropertyKey, PROPERTY_KEYS } from './props.ts';
|
|
16
|
+
export { applyRef, REF_KEY } from './ref.ts';
|
|
17
|
+
export { applyStyle, applyStyleValue, UNITLESS_KEYS } from './style.ts';
|
|
18
|
+
export { EventRegistry, eventName, EVENT_RE } from './events.ts';
|
|
19
|
+
export { extractKey, stripKey, KEY } from './key.ts';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — key 字段(业务身份声明协议——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0/§5.7——key 业务身份声明):
|
|
5
|
+
* - 框架**不生成身份 key**——数组项 key 只由业务声明(数据 id → keyBy /
|
|
6
|
+
* 组件内部生成 / 用户显式 key);无 key = 位置身份(unkeyed 按位置 patch)
|
|
7
|
+
* - h()/jsx 剥离 key 进 vnode.key(**props 不泄漏 key**——组件不见 key)
|
|
8
|
+
* - key 必须是 string|number(其余类型 warn + 忽略——不静默)
|
|
9
|
+
* - keyed 列表 diff(身份跟随内容——增删/重排复用正确)与 A 级检测
|
|
10
|
+
* (数组长度变化 + 无 key 组件项 → dev error)在 diff 层消费
|
|
11
|
+
*/
|
|
12
|
+
export declare const KEY = "key";
|
|
13
|
+
/** key 提取(props → vnode.key——string|number 有效——其余 warn + null) */
|
|
14
|
+
export declare function extractKey(props: Record<string, unknown> | null | undefined): string | null;
|
|
15
|
+
/** 从 props 拷贝中剥离 key(h/jsx 用——props 不泄漏 key) */
|
|
16
|
+
export declare function stripKey(props: Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — property 通道(DOM property——setAttribute 无法表达的面)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0 属性三通道):
|
|
5
|
+
* - value/checked/selected/disabled 等 → `el[key] = value`(property——
|
|
6
|
+
* setAttribute('value') 不更新输入值/勾选态)
|
|
7
|
+
* - 白名单判断(PROPERTY_KEYS)——其余走 attribute 通道
|
|
8
|
+
* - ref 特殊通道 → ref.ts(独立文件——挂载/卸载回调)
|
|
9
|
+
*/
|
|
10
|
+
/** property 白名单(DOM 节点属性——非 HTML attribute 语义) */
|
|
11
|
+
export declare const PROPERTY_KEYS: Set<string>;
|
|
12
|
+
/** 是否走 property 通道 */
|
|
13
|
+
export declare function isPropertyKey(key: string): boolean;
|
|
14
|
+
/** property 应用(值直接赋给 DOM 节点属性) */
|
|
15
|
+
export declare function applyProperty(el: HTMLElement, key: string, value: unknown): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/field — ref 通道(**全局注册表管理**——对齐事件代理模式)
|
|
3
|
+
*
|
|
4
|
+
* 纪律(设计规则 §5.1):带清理逻辑的 ref 必须定义在 mount 作用域——
|
|
5
|
+
* ref 函数引用变化时旧 ref(null) 被调用(diff 重绑定)。
|
|
6
|
+
*
|
|
7
|
+
* **RefRegistry**(全局注册表——统一管理——与 EventRegistry 同构):
|
|
8
|
+
* - set(id, fn, prev?):注册(prev 旧引用先退 null——diff 重绑)
|
|
9
|
+
* - mount(id, el):**挂载完成触发**(insert 后/ref 指令——查表 fn(el)——
|
|
10
|
+
* 未挂载注册自动挂起(insert 时查表触发——无需独立 pending 表))
|
|
11
|
+
* - unmount(id):**卸载**(ref(null) 子树——前缀匹配——表删除)
|
|
12
|
+
* - remap(oldPrefix, newPrefix):move 前缀重映射
|
|
13
|
+
* - dispose:卸载清理
|
|
14
|
+
*
|
|
15
|
+
* 生命周期整合:ref 指令(insert 后——已挂载——set + mount);
|
|
16
|
+
* setProp ref(diff 更新——已挂载立即——未挂载等 insert);remove/done →
|
|
17
|
+
* unmount(ref(null));move → remap。
|
|
18
|
+
*/
|
|
19
|
+
export declare const REF_KEY = "ref";
|
|
20
|
+
/** ref 应用(el 挂载 / null 卸载——prev 引用变化先退旧) */
|
|
21
|
+
export declare function applyRef(el: HTMLElement | null, value: unknown, prev?: unknown): void;
|
|
22
|
+
/** ref 全局注册表(per serve 实例——挂载/卸载查表触发) */
|
|
23
|
+
export declare class RefRegistry {
|
|
24
|
+
private refs;
|
|
25
|
+
/** 生命周期状态机(**全部状态机化——2026-XX**):active → disposed
|
|
26
|
+
* (dispose 消费——之后 set/mount/unmount 违例报错——不再静默) */
|
|
27
|
+
private phase;
|
|
28
|
+
/** 注册(prev 旧引用先退 null——diff 重绑;已注册同 id 覆盖——不重复触发) */
|
|
29
|
+
set(id: string, fn: unknown, prev?: unknown): void;
|
|
30
|
+
/** 挂载完成触发(insert 后/ref 指令——查表 fn(el)) */
|
|
31
|
+
mount(id: string, el: HTMLElement): void;
|
|
32
|
+
/** 卸载(ref(null) 子树——前缀匹配——表删除) */
|
|
33
|
+
unmount(id: string): void;
|
|
34
|
+
/** move 前缀重映射(节点移动——id 路径变化——表跟随) */
|
|
35
|
+
remap(oldPrefix: string, newPrefix: string): void;
|
|
36
|
+
/** 卸载清理(serve unmount)——状态机迁移:active → disposed */
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — style 通道(复杂面独立处理)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0/§6.4——style diff 只设不删已修):
|
|
5
|
+
* - 对象应用:el.style[k] = v——**undefined/null/false → 清空**(防残留——
|
|
6
|
+
* 条件显隐组件 display: undefined 残留旧 none)
|
|
7
|
+
* - 字符串直通:setAttribute('style', str)
|
|
8
|
+
* - 数字自动单位:width/height/margin... → px(UNITLESS 白名单无单位——
|
|
9
|
+
* zIndex/opacity/lineHeight/fontWeight/flex 系)
|
|
10
|
+
* - CSS 变量(--x 前缀)→ setProperty(el.style['--x'] 赋值无效)
|
|
11
|
+
*/
|
|
12
|
+
/** 无单位属性白名单(数字原样——React 同规则) */
|
|
13
|
+
export declare const UNITLESS_KEYS: Set<string>;
|
|
14
|
+
/** 单值应用(kebab/camelCase 键——CSS 变量走 setProperty) */
|
|
15
|
+
export declare function applyStyleValue(el: HTMLElement, key: string, value: unknown): void;
|
|
16
|
+
/** style 应用(对象/字符串——整体替换语义) */
|
|
17
|
+
export declare function applyStyle(el: HTMLElement, style: unknown): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — children(数组节点处理——隐式 Fragment——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0——单一规则源):
|
|
5
|
+
* - 数组/`<></>`/嵌套数组 = 隐式 Fragment——childrenOf 递归展开为同一
|
|
6
|
+
* children 序列(纯函数一次到位——路径按展开后位置——深度不漂移)
|
|
7
|
+
* - 空洞(false/null/undefined)**保留不滤除**(占位法——长度恒定——
|
|
8
|
+
* 对齐从结构上保证——filter(Boolean) 是红线)
|
|
9
|
+
* - 五消费方共用(buildVNode/renderValue/patchChildren/renderSsr/hydrate)
|
|
10
|
+
*/
|
|
11
|
+
import type { VNode, VNodeChild } from '../vnode.ts';
|
|
12
|
+
/** children 读取(单一规则源):统一 children 序列——任意嵌套递归展开 */
|
|
13
|
+
export declare function childrenOf(v: VNode): VNodeChild[];
|
|
14
|
+
/** 数组节点遍历(隐式 Fragment——按展开后位置 emit)——递归覆盖任意嵌套 */
|
|
15
|
+
export declare function forEachChild<T>(cs: VNodeChild[], fn: (c: VNodeChild, i: number) => T): void;
|
|
16
|
+
/** 槽位计数(**投影维度——单一实现源**):FRAG vnode → 递归展开槽位数;
|
|
17
|
+
* 其他项 = 1——build 的 fragment/array 展开用槽位推进(嵌套 FRAG 展开
|
|
18
|
+
* 占 N 连续槽位——按数组项数 +1 推进会覆盖后续项——fuzz seed=42/7/2026
|
|
19
|
+
* 实证——build(new) 参考树 3 项 vs diff 4 项——build 覆盖 c2) */
|
|
20
|
+
export declare function slotCount(c: VNodeChild): number;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — component(组件渲染——两阶段工厂 + renderFn——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 模型(设计规则 §3——两阶段组件):
|
|
5
|
+
* ```ts
|
|
6
|
+
* Component<P, C> = (initProps, ctx) => RenderFn<P> | Promise<RenderFn<P>>
|
|
7
|
+
* RenderFn<P> = (props) => VNode | null | Promise<VNode | null>
|
|
8
|
+
* ```
|
|
9
|
+
* - 工厂 = mount(一次——初始化状态/订阅/数据预取(await ctx.data——管道保证))
|
|
10
|
+
* - renderFn = 每次渲染(读最新 props——同步或 async——异步边界 = ctx.data)
|
|
11
|
+
*
|
|
12
|
+
* 渲染流集成(render.ts 消费):
|
|
13
|
+
* - 工厂调用(可 await)→ renderFn 调用(可 await)→ 输出 vnode 递归 emit
|
|
14
|
+
* (null → 空洞占位;数组 → 隐式 Fragment;元素/组件嵌套)
|
|
15
|
+
* - per-instance ctx:Object.create(shared) + onUnmount 覆盖——收集回调
|
|
16
|
+
* 到实例记录(组件卸载时执行——unmount 命令由 diff 发出)
|
|
17
|
+
* - 实例记录注册表(compId → { renderFn, onUnmounts })——同位置同类型
|
|
18
|
+
* 组件复用(工厂不重跑——let/ref 状态保持——diff 消费)
|
|
19
|
+
*/
|
|
20
|
+
import type { VNode, VNodeChild } from '../vnode.ts';
|
|
21
|
+
import type { Component, RenderFn } from '../vnode.ts';
|
|
22
|
+
import type { UIContext } from '../../context/UIContext.ts';
|
|
23
|
+
import type { Command } from '../command/index.ts';
|
|
24
|
+
/** 组件输出判别联合(**方案 3——null 结构性消除——编译器穷尽**):
|
|
25
|
+
* - vnode:单节点输出(元素/组件/文本——挂槽位 id——锚点法)
|
|
26
|
+
* - hole:空洞输出(原 null——锚——挂 compId.0 子空间)
|
|
27
|
+
* - array:多根输出(挂 compId 子空间——与兄弟槽位隔离)
|
|
28
|
+
* 消费点 switch(kind) 穷尽——遗漏分支 = 编译错误(而非运行时静默)——
|
|
29
|
+
* lastOutput 条件判断只用 `!== undefined`(hole 与真实输出同等处理——
|
|
30
|
+
* 4 处 `!== null` 遗漏实证——an:root.0(div) 幽灵/锚残留) */
|
|
31
|
+
export type CompOutput = {
|
|
32
|
+
kind: 'vnode';
|
|
33
|
+
v: VNode;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'hole';
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'array';
|
|
38
|
+
items: VNodeChild[];
|
|
39
|
+
};
|
|
40
|
+
/** 组件输出归一化(VNodeChild → CompOutput——null/undefined/boolean → hole) */
|
|
41
|
+
export declare function normalizeOutput(out: VNodeChild): CompOutput;
|
|
42
|
+
/** CompOutput → VNodeChild(清理/转换路径消费——outputBase 兼容) */
|
|
43
|
+
export declare function outputToChild(out: CompOutput): VNodeChild;
|
|
44
|
+
/** 组件实例记录(跨渲染保持——diff 复用) */
|
|
45
|
+
export interface ComponentRecord {
|
|
46
|
+
/** 组件函数引用(类型比较——同位置不同类型 → 卸载重建) */
|
|
47
|
+
type: Component;
|
|
48
|
+
/** renderFn(工厂产物——每次渲染调用——读最新 props) */
|
|
49
|
+
renderFn: RenderFn;
|
|
50
|
+
/** 卸载清理回调(ctx.onUnmount 收集——unmount 时执行) */
|
|
51
|
+
onUnmounts: (() => void)[];
|
|
52
|
+
/** 上次渲染输出(**判别联合 CompOutput**——diff 对照——同实例更新就地
|
|
53
|
+
* patch——不重建——undefined = 未渲染(首帧);hole = 空洞锚——同等处理) */
|
|
54
|
+
lastOutput?: CompOutput;
|
|
55
|
+
/** hook 调用顺序(渲染期重置——状态按 index 缓存) */
|
|
56
|
+
hookSeq: {
|
|
57
|
+
n: number;
|
|
58
|
+
};
|
|
59
|
+
/** 渲染期 hook 基准(mount 阶段 hook 计数——渲染 hook 用其后空间——
|
|
60
|
+
* 与 mount 的 usePopup 等分离——索引冲突根治) */
|
|
61
|
+
renderBase: number;
|
|
62
|
+
/** hook 状态缓存(per-instance——useOpen 等渲染期 hooks) */
|
|
63
|
+
hookStates: Map<number, unknown>;
|
|
64
|
+
/** 组件状态机阶段(**MOUNTING 补全——审计 2026-XX**):工厂 await 期间
|
|
65
|
+
* = 'mounting'(rec 已注册——防御异步工厂重复执行/循环引用——重复
|
|
66
|
+
* 引用显式报错);mount 命令消费后 = 'mounted' */
|
|
67
|
+
phase: 'mounting' | 'mounted';
|
|
68
|
+
}
|
|
69
|
+
/** 组件实例注册表(uiServe 持有——renderToStream 写入——diff/unmount 消费) */
|
|
70
|
+
export interface ComponentRegistry {
|
|
71
|
+
get(id: string): ComponentRecord | undefined;
|
|
72
|
+
set(id: string, rec: ComponentRecord): void;
|
|
73
|
+
delete(id: string): void;
|
|
74
|
+
/** 全部实例 id(整树替换遍历卸载) */
|
|
75
|
+
keys(): string[];
|
|
76
|
+
/** 异步超时(R2——mount 工厂/renderFn await 上限——测试可注入短值) */
|
|
77
|
+
asyncTimeout: number;
|
|
78
|
+
}
|
|
79
|
+
/** 创建注册表(per serve 实例)——asyncTimeout 默认 15s(async-guard) */
|
|
80
|
+
export declare function createComponentRegistry(): ComponentRegistry;
|
|
81
|
+
/** 整树替换:全部组件实例卸载(**LIFO——后挂载先卸载**——导航/root
|
|
82
|
+
* 类型变化——与单组件 onUnmounts 逆序一致——栈语义) */
|
|
83
|
+
export declare function disposeAllComponents(registry: ComponentRegistry): void;
|
|
84
|
+
/** 组件渲染 sink(render.ts 的 emit——子节点递归出口) */
|
|
85
|
+
export type ComponentSink = (v: VNodeChild, parent: string, index: number, ref: string | null) => Promise<void>;
|
|
86
|
+
/** 渲染一个组件(mount + renderFn——可 await——输出经 sink 递归 emit) */
|
|
87
|
+
export declare function renderComponent(vn: VNode, parent: string, index: number, ref: string | null, compId: string, sharedCtx: UIContext, registry: ComponentRegistry, sink: ComponentSink, emitCommand?: (cmd: Command) => void): Promise<boolean>;
|
|
88
|
+
/** 执行组件卸载(unmount 命令消费——onUnmounts 逆序执行)
|
|
89
|
+
* **递归清理子实例(G8——终态等价违例)**:组件 vnode 的 compId(parent.i)
|
|
90
|
+
* ≠ 其子树内子组件实例 id(parent.i.0 / parent.i.k{key} / compId.0 特判)——
|
|
91
|
+
* 单实例删除会残留子实例(onUnmounts 不执行——订阅/监听泄漏——fuzz 实证)
|
|
92
|
+
* ——按 compId 前缀递归(LIFO——与 disposeAllComponents 同语义——先子后父) */
|
|
93
|
+
export declare function disposeComponent(id: string, registry: ComponentRegistry): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — Fragment(隐式——数组 = Fragment——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 设计(设计规则 §4.0——结构符号内化):
|
|
5
|
+
* - Fragment 为内部符号——公共面不导出(数组 = 隐式 Fragment;`<></>` 经
|
|
6
|
+
* jsx-runtime 子路径自动导入——编译目标即本符号)
|
|
7
|
+
* - 数组节点处理 → children.ts(childrenOf 单一规则源——递归展开)
|
|
8
|
+
* - 单节点分类 → node.ts(kindOf——fragment 分支判定)
|
|
9
|
+
*/
|
|
10
|
+
import type { VNode } from '../vnode.ts';
|
|
11
|
+
/** Fragment 内部符号(`<></>` 编译目标——数组 = 隐式 Fragment) */
|
|
12
|
+
export declare const Fragment: unique symbol;
|
|
13
|
+
/** Fragment vnode 判定 */
|
|
14
|
+
export declare function isFragment(v: VNode): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — hole(特殊值渲染——空洞占位 + 非法输入诊断——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0/§6.3——占位法):
|
|
5
|
+
* - 空洞(null/undefined/boolean——无渲染值)→ 占位锚节点
|
|
6
|
+
* (<!--wf-hole: xxx-->)——**childNodes 长度恒等于 children 数组长度**
|
|
7
|
+
* (数组第 i 项 ⟷ childNodes 第 i 个节点——同构不变量——对齐从结构上
|
|
8
|
+
* 保证——不靠消费侧猜测)——filter(Boolean) 是红线(消除空洞破坏长度)
|
|
9
|
+
* - 非法输入(对象/数字 type/未知 Symbol)→ 诊断占位 + warn(不崩溃不静默)
|
|
10
|
+
* - 占位是静态的零 resolve 回调——≠ 动态挂载占位——不触发任何补渲染
|
|
11
|
+
*/
|
|
12
|
+
import type { Command } from '../command/index.ts';
|
|
13
|
+
/** 空洞判定(无渲染值——false/null/undefined/true——占位法保同构) */
|
|
14
|
+
export declare function isHole(v: unknown): boolean;
|
|
15
|
+
/** 非法输入判定(对象/数字 type/未知 Symbol——诊断占位 + warn) */
|
|
16
|
+
export declare function isInvalid(v: unknown): boolean;
|
|
17
|
+
/** 非法输入诊断信息(warn 提示——不崩溃) */
|
|
18
|
+
export declare function invalidDiagnostic(v: unknown): string;
|
|
19
|
+
/** 占位锚命令对(createAnchor + insert——同构长度恒定) */
|
|
20
|
+
export declare function holeCommands(id: string, parent: string, ref: string | null, detail?: string): Command[];
|
|
21
|
+
/** 占位锚入队(emitCommand 直发——render/hydrate 共用) */
|
|
22
|
+
export declare function emitHole(emit: (cmd: Command) => void, id: string, parent: string, ref: string | null, detail?: string): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — node(单节点处理——类型判定/分类——独立文件)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0——children 值域协议 + 非法输入分类):
|
|
5
|
+
* - text:string/number → 文本节点
|
|
6
|
+
* - hole:null/undefined/boolean → 空洞占位锚(hole.ts——占位法——长度恒定)
|
|
7
|
+
* - array:VNodeChild[] → 隐式 Fragment(children.ts 展开)
|
|
8
|
+
* - element:string type → 元素节点
|
|
9
|
+
* - fragment:Fragment 符号(`<></>`——与数组同义)
|
|
10
|
+
* - component:函数 type → 两阶段组件(工厂 + renderFn)
|
|
11
|
+
* - invalid:对象/数字 type/未知 Symbol → 诊断占位 + warn(hole.ts——不崩溃不静默)
|
|
12
|
+
*/
|
|
13
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
14
|
+
export type NodeKind = 'text' | 'hole' | 'array' | 'element' | 'fragment' | 'component' | 'invalid';
|
|
15
|
+
/** 单节点分类(唯一判定点——各消费方共用)
|
|
16
|
+
* **空字符串 = 空洞(2026-08——编码唯一性——映射歧义歼灭)**:'' 文本
|
|
17
|
+
* 节点在 DOM 可见性上 = 无——但客户端 createText('') 生成空文本节点、
|
|
18
|
+
* HTML 序列化(commandToHtml escapeHtml('') → 空串)不产任何节点——
|
|
19
|
+
* 同一 children 值两套物理表示——SSR 吸收文本流错位(实证:
|
|
20
|
+
* `{cond ? 'x' : ''}` 的 '' 槽位——吸收把整个 demo 面 div 当多余节点
|
|
21
|
+
* 跳过——inputnumber 页吸收耗尽 failed)——统一归空洞(锚注释——
|
|
22
|
+
* 双端同构——与 false/null/undefined 同类) */
|
|
23
|
+
export declare function kindOf(v: VNodeChild): NodeKind;
|
|
24
|
+
/** 文本值提取(text kind——string/number 统一字符串化) */
|
|
25
|
+
export declare function textOf(v: VNodeChild): string | null;
|
|
26
|
+
/** **渲染级空洞判定(2026-08——判定点收敛——单一实现源)**:
|
|
27
|
+
* null/undefined/boolean/''('' 归 kindOf hole——编码唯一性)——
|
|
28
|
+
* build/diff/transform/SSR 四端渲染分类唯一判定点——禁止模块内手写
|
|
29
|
+
* `=== null || === undefined || typeof === 'boolean'`(''→hole 曾只改
|
|
30
|
+
* kindOf——diffSlot typeof 快路径分裂——双 bug 实证)——渲染空洞语义
|
|
31
|
+
* 一律经本函数 */
|
|
32
|
+
export declare function isHoleKind(v: VNodeChild): boolean;
|
|
33
|
+
/** **渲染级文本判定**(kindOf 语义——'' 是 hole 不是文本——文本快路径
|
|
34
|
+
* 与 setText 目标判定统一——diffSlot ''↔text 转换回归的机制防线) */
|
|
35
|
+
export declare function isTextKind(v: VNodeChild): boolean;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core/node — keyed(keyed 列表语义——业务身份声明协议)
|
|
3
|
+
*
|
|
4
|
+
* 规则(设计规则 §4.0/§5.7——key 业务身份声明):
|
|
5
|
+
* - **框架不生成身份 key**——数组项 key 只由业务声明(数据 id → keyBy /
|
|
6
|
+
* 组件内部生成 / 用户显式 key);无 key = 位置身份(unkeyed 按位置 patch)
|
|
7
|
+
* - **全 keyed**:key 身份映射——增删/重排复用正确(身份跟随内容——
|
|
8
|
+
* 状态不漂移)
|
|
9
|
+
* - **全 unkeyed**:按位置对照(静态/无状态列表正确零噪音)
|
|
10
|
+
* - **混合数组**(部分 key):无 key 项由位置接管——`pos:{i}` 位置 key——
|
|
11
|
+
* 命名空间隔离(pos: 前缀——**永不与用户 key 冲突**)
|
|
12
|
+
* - **A 级检测**(dev):数组长度变化 + 无 key 组件项 → warn 引导声明 key
|
|
13
|
+
*
|
|
14
|
+
* 消费方:diff.ts(keyed 列表 diff——身份映射/复用决策)。
|
|
15
|
+
*/
|
|
16
|
+
import type { VNodeChild } from '../vnode.ts';
|
|
17
|
+
/** 位置 key 前缀(混合数组——无 key 项位置接管——命名空间隔离) */
|
|
18
|
+
export declare const POS_KEY_PREFIX = "pos:";
|
|
19
|
+
/** keyed 组件实例 id(**key 转义——id 空间注入防御**):compId =
|
|
20
|
+
* `{parent}.k{key}`——'.' 是路径分隔符——用户 key 可含任意字符(数据
|
|
21
|
+
* id——如 'a.b')——直接拼接则 'root.0.ka' 与 'root.0.ka.b'(key='a.b')
|
|
22
|
+
* 产生前缀关系——disposeComponent/remapSubtree/procRemove 的 startsWith
|
|
23
|
+
* 前缀匹配误删兄弟 keyed 实例(key 注入实证——unmount root.0.ka 误删
|
|
24
|
+
* root.0.ka.b——实例状态丢失 + onUnmounts 错乱)——'%' 先行转义(防
|
|
25
|
+
* '.' 转义后 '%' 二次歧义:'a.b'→'a%2Eb','a%2Eb'→'a%252Eb'——互不碰撞)
|
|
26
|
+
* ——build/diff/cleanup 全部生成点统一走本函数(单一实现源) */
|
|
27
|
+
export declare function keyedId(parent: string, key: string): string;
|
|
28
|
+
/** 数组项 key(vnode.key——纯数据面——非 vnode 项 = null) */
|
|
29
|
+
export declare function keyOf(v: VNodeChild): string | null;
|
|
30
|
+
/** 数组项是否显式 keyed(业务声明——vnode.key 非 null) */
|
|
31
|
+
export declare function isKeyed(v: VNodeChild): boolean;
|
|
32
|
+
/** 列表分类:全 keyed / 全 unkeyed / 混合 */
|
|
33
|
+
export type KeyedKind = 'all-keyed' | 'all-unkeyed' | 'mixed';
|
|
34
|
+
/** 列表 keyed 分类(空列表 = all-unkeyed——无身份可言) */
|
|
35
|
+
export declare function listKind(items: VNodeChild[]): KeyedKind;
|
|
36
|
+
/** 位置 key(混合数组——无 key 项的位置接管——pos: 前缀永不与用户 key 冲突) */
|
|
37
|
+
export declare function positionKey(i: number): string;
|
|
38
|
+
/** 是否为位置 key(pos: 前缀——命名空间识别) */
|
|
39
|
+
export declare function isPositionKey(k: string): boolean;
|
|
40
|
+
/** 统一身份键(keyed 项用业务 key——unkeyed 项用位置 key——混合数组同一映射) */
|
|
41
|
+
export declare function identityKey(items: VNodeChild[], i: number): string;
|
|
42
|
+
/** keyed 列表身份映射(key → 项索引——增删/重排决策用) */
|
|
43
|
+
export declare function keyIndex(items: VNodeChild[]): Map<string, number>;
|
|
44
|
+
/** keyed 复用决策(旧列表 × 新列表——key 交集 → 复用;旧有新无 → 移除;
|
|
45
|
+
* 旧无新有 → 新建)——diff 消费 */
|
|
46
|
+
export interface KeyedDiffPlan {
|
|
47
|
+
/** 复用的 key(身份保持——节点移动/就地更新) */
|
|
48
|
+
reused: string[];
|
|
49
|
+
/** 移除的旧 key(不在新列表) */
|
|
50
|
+
removed: string[];
|
|
51
|
+
/** 新建的新 key(不在旧列表) */
|
|
52
|
+
added: string[];
|
|
53
|
+
}
|
|
54
|
+
export declare function planKeyedDiff(oldItems: VNodeChild[], newItems: VNodeChild[]): KeyedDiffPlan;
|
|
55
|
+
/** A 级检测(dev——重复 key → warn 引导修正——重复 key 是非法输入:
|
|
56
|
+
* 身份映射无唯一语义——diffKeyedChildren 按首现优先处理(与 keyIndex
|
|
57
|
+
* 对齐——确定性)——但列表本身应修正(fuzz 实证:重复 key 导致 move
|
|
58
|
+
* 映射错位——旧节点残留/新节点错位——终态不等价)) */
|
|
59
|
+
export declare function detectDuplicateKey(items: VNodeChild[], context: string): void;
|
|
60
|
+
/** A 级检测(dev——数组长度变化 + 无 key 组件项 → warn 引导声明 key——
|
|
61
|
+
* 用户层引导;豁免:单子节点条件渲染的 null 空洞)——**实槽翻转语义**:
|
|
62
|
+
* 仅当组件占据/让出「非空洞非组件」的实槽(位置被占用——后续组件按位置
|
|
63
|
+
* 移位 → 重挂 → 状态丢失)才 warn——尾部/空洞槽条件渲染零漂移不报 */
|
|
64
|
+
export declare function detectMissingKey(items: VNodeChild[], context: string): void;
|