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
|
@@ -160,9 +160,13 @@
|
|
|
160
160
|
/* 浮层面板底色(surface-2/3:浮层/模态——亮色同 bg 靠阴影区分,暗色抬升一级见 _dark.css) */
|
|
161
161
|
--wf-color-bg-elevated: var(--wf-color-bg);
|
|
162
162
|
|
|
163
|
-
/* ── 字体 ──
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
/* ── 字体 ──
|
|
164
|
+
* 西文优先(拉丁字形平台最优),CJK 显式回退(中文原生:PingFang/苹方、
|
|
165
|
+
* Hiragino/冬青、雅黑、思源 Noto Sans SC——三平台中文渲染一致) */
|
|
166
|
+
--wf-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
167
|
+
'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
|
|
168
|
+
--wf-font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono',
|
|
169
|
+
'PingFang SC', 'Microsoft YaHei', monospace;
|
|
166
170
|
|
|
167
171
|
--wf-font-size-xs: 12px;
|
|
168
172
|
--wf-font-size-sm: 13px;
|
|
@@ -196,9 +200,11 @@
|
|
|
196
200
|
变暗不可见,primary 是亮蓝——明暗主题聚焦均可见) ── */
|
|
197
201
|
--wf-focus-ring: 0 0 0 2px var(--wf-color-primary-bg), 0 0 0 1px var(--wf-color-primary);
|
|
198
202
|
|
|
199
|
-
/* ── 动效 ──
|
|
200
|
-
|
|
201
|
-
|
|
203
|
+
/* ── 动效 ──
|
|
204
|
+
* --wf-transition 为派生别名(hover 类过渡统一走 dur-fast + ease-out——微流明标准节奏)。
|
|
205
|
+
* 旧 --wf-transition-duration/timing 保留为兼容(不建议新引用——新代码直接用 --wf-dur-* 系列) */
|
|
206
|
+
--wf-transition-duration: var(--wf-dur-fast);
|
|
207
|
+
--wf-transition-timing: var(--wf-ease-out);
|
|
202
208
|
--wf-transition: var(--wf-transition-duration) var(--wf-transition-timing);
|
|
203
209
|
|
|
204
210
|
/* ── 动效语言:时长阶梯 + 缓动曲线 + 位移量(组件动效统一引用,不各自硬编码) ── */
|
|
@@ -217,6 +223,12 @@
|
|
|
217
223
|
--wf-motion-md: 8px;
|
|
218
224
|
--wf-motion-lg: 24px; /* drawer 全幅位移 */
|
|
219
225
|
|
|
226
|
+
/* 循环动效族(旋转/呼吸/闪烁/进度——时长阶梯之外的循环节拍——S5 审计强制引用) */
|
|
227
|
+
--wf-dur-spin: 0.6s; /* 旋转(spinner/loading/折叠) */
|
|
228
|
+
--wf-dur-pulse: 1.2s; /* 呼吸脉冲(在线点/骨架/思考) */
|
|
229
|
+
--wf-dur-blink: 1.1s; /* 光标闪烁(流式光标/AI 回复) */
|
|
230
|
+
--wf-dur-progress: 1.4s; /* 不确定进度循环(indeterminate) */
|
|
231
|
+
|
|
220
232
|
/* ── 色彩 — 信息(补充) ── */
|
|
221
233
|
--wf-color-info: var(--wf-sky-500);
|
|
222
234
|
--wf-color-info-bg: var(--wf-sky-50);
|
|
@@ -274,6 +286,7 @@
|
|
|
274
286
|
--wf-letter-spacing: normal;
|
|
275
287
|
--wf-letter-spacing-wide: 0.5px;
|
|
276
288
|
--wf-letter-spacing-wider: 1px;
|
|
289
|
+
--wf-heading-display-tracking: -0.5px; /* 顶级标题 display 档窄字距(PageHeader display——CJK 可覆盖) */
|
|
277
290
|
|
|
278
291
|
/* ── 数字 ── */
|
|
279
292
|
--wf-nums: 'tabular-nums'; /* 数字等宽(统计/表格数值防抖动) */
|
|
@@ -721,6 +734,34 @@ body.wf-dragging {
|
|
|
721
734
|
user-select: none;
|
|
722
735
|
-webkit-user-select: none;
|
|
723
736
|
}
|
|
737
|
+
|
|
738
|
+
/* ── 微流明 · 进行态语言:stream-in 内容渐显(AI 回复/流式列表/hero 元素) ──
|
|
739
|
+
* 微流明设计语言三支柱之二(design/design-language.md)——"进行中"是可见的流
|
|
740
|
+
* 用法:元素加 wf-stream-in 类(opacity 0→1 + 上移 4px)
|
|
741
|
+
*/
|
|
742
|
+
@keyframes wf-stream-in {
|
|
743
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
744
|
+
to { opacity: 1; transform: translateY(0); }
|
|
745
|
+
}
|
|
746
|
+
.wf-stream-in {
|
|
747
|
+
animation: wf-stream-in var(--wf-dur-base) var(--wf-ease-out) both;
|
|
748
|
+
}
|
|
749
|
+
@media (prefers-reduced-motion: reduce) {
|
|
750
|
+
.wf-stream-in {
|
|
751
|
+
animation-duration: 0.01ms;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/* ── 首页 hero 打字机光标(微流明·进行态——reduced-motion 由下方降级块处理) ── */
|
|
756
|
+
.wf-hero-cursor {
|
|
757
|
+
animation: wf-hero-blink 1s step-end infinite;
|
|
758
|
+
color: var(--wf-color-primary);
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
@keyframes wf-hero-blink {
|
|
762
|
+
0%, 100% { opacity: 1; }
|
|
763
|
+
50% { opacity: 0; }
|
|
764
|
+
}
|
|
724
765
|
}
|
|
725
766
|
|
|
726
767
|
@layer layout {
|
|
@@ -1004,6 +1045,11 @@ body.wf-dragging {
|
|
|
1004
1045
|
background: var(--wf-surface-bg);
|
|
1005
1046
|
}
|
|
1006
1047
|
|
|
1048
|
+
/* 平面表面(M4 表面语言——静态卡片/面板组合 wf-border 用:阴影仅抬升语义) */
|
|
1049
|
+
.wf-surface--flat {
|
|
1050
|
+
box-shadow: none;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1007
1053
|
/* ── 背景色工具 — 引用语义 Token,免自定义 CSS ── */
|
|
1008
1054
|
.wf-bg-secondary { background: var(--wf-color-bg-secondary); }
|
|
1009
1055
|
.wf-bg-tertiary { background: var(--wf-color-bg-tertiary); }
|
|
@@ -1494,6 +1540,14 @@ body.wf-dragging {
|
|
|
1494
1540
|
/* 内容高于视口时在主区内滚动(壳固定视口高度后的唯一滚动出口) */
|
|
1495
1541
|
overflow-y: auto;
|
|
1496
1542
|
background: var(--wf-color-bg);
|
|
1543
|
+
/* 行宽约束(P5):默认 none 全宽(聊天/表格等全宽应用零影响);
|
|
1544
|
+
文档站/长文本场景设 --wf-main-max: 900px——直接子元素限宽居中 */
|
|
1545
|
+
--wf-main-max: none;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
.wf-main > * {
|
|
1549
|
+
max-width: var(--wf-main-max);
|
|
1550
|
+
margin-inline: auto;
|
|
1497
1551
|
}
|
|
1498
1552
|
|
|
1499
1553
|
/* ── 触屏:导航项 44px 命中区 ── */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/docx — docx ↔ ODES DocState 双向转换(前端/服务端通用——零依赖)
|
|
3
|
+
*
|
|
4
|
+
* 参考算法:office2json(unzip → XML 树 → 路径提取 w:body → w:p → w:r → w:t),
|
|
5
|
+
* 增强提取到 ODES IR(design/office-events-plan.md):
|
|
6
|
+
* - 段落属性:pStyle → h1/h2/h3、jc → 对齐(裁剪:样式名映射子集)
|
|
7
|
+
* - 内联格式:rPr b/i/u → marks(区间)
|
|
8
|
+
* - 表格:w:tbl → Editor 表格 embed 快照(HTML 复用现有模型)
|
|
9
|
+
* - 图片:w:drawing r:embed → rels → media → data url → img embed
|
|
10
|
+
*
|
|
11
|
+
* 导出(DocState → minimal docx):VNode 组件化(OOXML 也是 VNode——与前端
|
|
12
|
+
* "VNode → DOM"同构)→ vnodeToXml → store ZIP。块级 embed(pre/hr)打断段落。
|
|
13
|
+
*
|
|
14
|
+
* 前端可用(无需后端):ZIP 解压走 DecompressionStream(浏览器/Node 18+);
|
|
15
|
+
* base64 跨环境(Buffer 守卫/atob)。诚实裁剪:分节/页眉页脚/域代码/批注
|
|
16
|
+
* 不导入;http 图片导出裁剪(warning)。
|
|
17
|
+
*/
|
|
18
|
+
import type { DocState } from '../components/Editor/model/types.ts';
|
|
19
|
+
/** base64 → Uint8Array(跨环境——浏览器 atob / Node Buffer) */
|
|
20
|
+
export declare function base64ToBytes(b64: string): Uint8Array;
|
|
21
|
+
/** Uint8Array → base64(跨环境) */
|
|
22
|
+
export declare function bytesToBase64(u8: Uint8Array): string;
|
|
23
|
+
export interface DocxImportResult {
|
|
24
|
+
doc: DocState;
|
|
25
|
+
/** 裁剪提示(不可映射内容——诚实不静默) */
|
|
26
|
+
warnings: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function docxToDoc(u8: Uint8Array): Promise<DocxImportResult>;
|
|
29
|
+
export interface DocxExportResult {
|
|
30
|
+
data: Uint8Array;
|
|
31
|
+
warnings: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function docToDocx(doc: DocState): DocxExportResult;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/pptx — pptx ↔ ODES DeckState 双向转换(前端/服务端通用——零依赖)
|
|
3
|
+
*
|
|
4
|
+
* 参考算法:office2json(ppt/slides/slideN.xml → p:sld → p:cSld → p:spTree →
|
|
5
|
+
* p:sp → p:txBody → a:p → a:r → a:t),增强提取到 ODES IR:
|
|
6
|
+
* - 多幻灯片:slideN.xml 全量(office2json 只取文本——ODES 保留结构)
|
|
7
|
+
* - shape 几何:p:xfrm(a:off x/y + a:ext cx/cy——EMU → px:/9525)
|
|
8
|
+
* - shape 类型:p:sp(文本/图形——p:prstGeom prst)/ p:pic(图片)
|
|
9
|
+
* - 文本:txBody → 段落拼接(a:br 换行)
|
|
10
|
+
*
|
|
11
|
+
* 导出(DeckState → minimal pptx):slideN.xml(spTree 结构)+ presentation.xml
|
|
12
|
+
* + rels + contentTypes——store ZIP(VNode 组件化)。裁剪:动画/母版/备注/主题。
|
|
13
|
+
*/
|
|
14
|
+
import type { DeckState } from '../components/OfficeEditor/model/types.ts';
|
|
15
|
+
export interface PptxImportResult {
|
|
16
|
+
deck: DeckState;
|
|
17
|
+
warnings: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function pptxToDeck(u8: Uint8Array): Promise<PptxImportResult>;
|
|
20
|
+
export interface PptxExportResult {
|
|
21
|
+
data: Uint8Array;
|
|
22
|
+
warnings: string[];
|
|
23
|
+
}
|
|
24
|
+
export declare function deckToPptx(deck: DeckState): PptxExportResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/xlsx — xlsx ↔ ODES WorkbookState 双向转换(前端/服务端通用——零依赖)
|
|
3
|
+
*
|
|
4
|
+
* 参考算法:office2json(sheet1.xml → sheetData → row → c{t,v} + sharedStrings),
|
|
5
|
+
* 增强提取到 ODES IR(design/office-events-plan.md):
|
|
6
|
+
* - 多 sheet:workbook.xml(sheet 名 + rId)→ rels → 各 sheetN.xml
|
|
7
|
+
* - 单元格引用:c@r(A1——office2json 丢弃——ODES 必须)
|
|
8
|
+
* - 类型:c@t(s=shared/n=number/b=bool/f=formula)→ SheetCell.kind
|
|
9
|
+
* - 公式:f 元素(公式字符串保留——不计算——服务端导出重算)
|
|
10
|
+
* - 行高/列宽/样式索引:裁剪(v1——诚实:不读不写)
|
|
11
|
+
*
|
|
12
|
+
* 导出(WorkbookState → minimal xlsx):共享字符串表去重 + sheetData XML +
|
|
13
|
+
* store ZIP(VNode 组件化——OOXML 也是 VNode)。
|
|
14
|
+
*/
|
|
15
|
+
import type { WorkbookState } from '../components/OfficeEditor/model/types.ts';
|
|
16
|
+
export interface XlsxImportResult {
|
|
17
|
+
workbook: WorkbookState;
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function xlsxToWorkbook(u8: Uint8Array): Promise<XlsxImportResult>;
|
|
21
|
+
export interface XlsxExportResult {
|
|
22
|
+
data: Uint8Array;
|
|
23
|
+
warnings: string[];
|
|
24
|
+
}
|
|
25
|
+
export declare function workbookToXlsx(wb: WorkbookState): XlsxExportResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/xml-serialize — VNode 树 → XML 字符串(服务端 OOXML 生成)
|
|
3
|
+
*
|
|
4
|
+
* 架构(与前端 "VNode → DOM" 同构——"OOXML 也是写 VNode"):
|
|
5
|
+
* DocState → VNode 树(h()——vdom3 纯数据结构,零 DOM 依赖)
|
|
6
|
+
* → vnodeToXml(本模块)→ ZIP 打包
|
|
7
|
+
*
|
|
8
|
+
* 序列化约定(仅输出 XML 子集——与 vdom3 渲染管线解耦):
|
|
9
|
+
* - type: string = 元素名(含命名空间前缀——w:p、a:graphic 等原样输出)
|
|
10
|
+
* - props: 字符串值 = XML 属性;number/boolean 字符串化;key/children 排除
|
|
11
|
+
* - children: 字符串 = 文本(转义);VNode = 子元素;数组 = 序列
|
|
12
|
+
* - 空元素 → 自闭合 <w:b/>(OOXML 合法——MS Word 接受)
|
|
13
|
+
* - 函数/symbol type、事件 props(on*)→ 抛错(诚实——序列化器不支持)
|
|
14
|
+
*/
|
|
15
|
+
import type { VNode, VNodeChild } from '../vdom/index.ts';
|
|
16
|
+
export declare function vnodeToXml(v: VNode | VNodeChild, xmlDecl?: boolean): string;
|
|
17
|
+
/** 便捷:把 VNode 树序列化为 OOXML 部件 XML(名称检查由调用方保证) */
|
|
18
|
+
export declare function vnodeToXmlDecl(v: VNode): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/xml — 自研轻量 XML 解析(零 npm 依赖)
|
|
3
|
+
*
|
|
4
|
+
* 参考算法:office2json(@xmldom/xmldom → { name, attrs, children } 树)。
|
|
5
|
+
* OOXML 是规整 XML——只做元素树 + 文本;裁剪:DTD/实体展开(除内建五实体)/
|
|
6
|
+
* 命名空间处理(前缀保留原名——w:p 等)。解析失败抛错(诚实——不静默)。
|
|
7
|
+
*/
|
|
8
|
+
export interface XmlNode {
|
|
9
|
+
name: string;
|
|
10
|
+
attrs: Record<string, string>;
|
|
11
|
+
children: XmlNode[];
|
|
12
|
+
/** 直接文本内容(子元素外的文本) */
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
15
|
+
/** 手写扫描器:<name attrs>...</name> / <name/> / 文本 / 指令 / 注释 / CDATA */
|
|
16
|
+
export declare function parseXml(xml: string): XmlNode;
|
|
17
|
+
/** 便捷:找子元素(按名字——含命名空间前缀匹配) */
|
|
18
|
+
export declare function child(el: XmlNode, name: string): XmlNode | null;
|
|
19
|
+
export declare function children(el: XmlNode, name: string): XmlNode[];
|
|
20
|
+
/** 全部后代文本(拼接) */
|
|
21
|
+
export declare function allText(el: XmlNode): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/office/zip — 自研 ZIP 容器读写(零 npm 依赖)
|
|
3
|
+
*
|
|
4
|
+
* 参考算法:office2json(unzip 结构——EOCD → central directory → local header)。
|
|
5
|
+
* 实现取舍:
|
|
6
|
+
* - 读:EOCD(尾部扫描)→ central directory → local header offset 取数据;
|
|
7
|
+
* 压缩方法 0(store)/ 8(deflate——Node 内置 zlib.inflateRawSync)
|
|
8
|
+
* - 写:store(无压缩——合法 ZIP,文件较大但零依赖正确性优先);
|
|
9
|
+
* CRC32 自研查表
|
|
10
|
+
* - 裁剪:ZIP64/加密/数据描述符(flags bit3)/多盘——不支持(诚实——读到即抛错)
|
|
11
|
+
*/
|
|
12
|
+
export interface ZipEntry {
|
|
13
|
+
name: string;
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
export declare function crc32(buf: Uint8Array): number;
|
|
17
|
+
/** inflate(ZIP method 8)——跨环境:浏览器 DecompressionStream / Node 18+(同 API)。
|
|
18
|
+
* 老环境无 DecompressionStream → 抛错(诚实裁剪:OOXML 必用 deflate)。 */
|
|
19
|
+
export declare function inflateRaw(data: Uint8Array): Promise<Uint8Array>;
|
|
20
|
+
export declare function readZip(u8: Uint8Array): Promise<Map<string, Uint8Array>>;
|
|
21
|
+
export declare function writeZip(files: Map<string, Uint8Array>): Uint8Array;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom browser — 浏览器环境接口(依赖注入——uiServe 显式接收)
|
|
3
|
+
*
|
|
4
|
+
* 设计(2026-12):uiServe(router, { root, browser })——**无全局依赖**——
|
|
5
|
+
* 注入 window/document 两字段为基座 + **组件消费面方法**(设计规则 §5.5——
|
|
6
|
+
* 组件禁止直接访问 DOM 全局——一律经 ctx.browser 唯一入口——46 处迁移
|
|
7
|
+
* 基线)。接口按组件库消费面扩展(P2 组件迁移——activeElement/byId/
|
|
8
|
+
* copyText/scrollTop/storage 等)。
|
|
9
|
+
*
|
|
10
|
+
* 三态实现:客户端 createClientBrowser(惰性 typeof 防御)· SSR shim
|
|
11
|
+
* (null/0/false/no-op——组件 SSR 安全)· 测试 testBrowser()/jsdom。
|
|
12
|
+
*/
|
|
13
|
+
/** 浏览器环境(基座 window/document + 组件消费面方法) */
|
|
14
|
+
export interface Browser {
|
|
15
|
+
/** 浏览器窗口(location/事件/媒体查询/定时器——完整环境面) */
|
|
16
|
+
window: Window;
|
|
17
|
+
/** 文档(元素创建/查询——渲染 DOM 面) */
|
|
18
|
+
document: Document;
|
|
19
|
+
/** 复制文本 */
|
|
20
|
+
copyText(text: string): void;
|
|
21
|
+
/** 下载文件(dataURL/blob) */
|
|
22
|
+
downloadFile(filename: string, content: string, mime?: string): boolean;
|
|
23
|
+
/** 当前聚焦元素 */
|
|
24
|
+
activeElement(): HTMLElement | null;
|
|
25
|
+
/** 按 id 查询 */
|
|
26
|
+
byId(id: string): HTMLElement | null;
|
|
27
|
+
/** 查询元素(CSS 选择器) */
|
|
28
|
+
query(sel: string): HTMLElement | null;
|
|
29
|
+
queryAll(sel: string): NodeListOf<Element> | null;
|
|
30
|
+
/** 创建元素/片段/注释/文本 */
|
|
31
|
+
createElement<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K] | null;
|
|
32
|
+
createElementNS(ns: string, tag: string): Element | null;
|
|
33
|
+
createDocumentFragment(): DocumentFragment | null;
|
|
34
|
+
createComment(text: string): Comment | null;
|
|
35
|
+
createTextNode(text: string): Text | null;
|
|
36
|
+
/** 事件监听(全局——组件层统一入口) */
|
|
37
|
+
addEventListener(type: string, fn: (e: any) => void, options?: any): void;
|
|
38
|
+
removeEventListener(type: string, fn: (e: any) => void, options?: any): void;
|
|
39
|
+
/** 滚动 */
|
|
40
|
+
scrollTo(y: number): void;
|
|
41
|
+
/** 当前滚动量(scrollingElement 优先——headless 漂移防护) */
|
|
42
|
+
scrollTop(): number;
|
|
43
|
+
/** 媒体查询(matchMedia——headless 无 → null) */
|
|
44
|
+
matchMedia(query: string): MediaQueryList | null;
|
|
45
|
+
/** 可视视口(visualViewport——键盘弹起/缩放) */
|
|
46
|
+
visualViewport(): VisualViewport | null;
|
|
47
|
+
/** 滚动根元素 */
|
|
48
|
+
scrollingElement(): Element | null;
|
|
49
|
+
bodyElement(): HTMLElement | null;
|
|
50
|
+
bodyAppend(el: Node): void;
|
|
51
|
+
bodyRemove(el: Node): void;
|
|
52
|
+
clearBody(): void;
|
|
53
|
+
/** 事件构造(jsdom 兼容——跨 realm 安全) */
|
|
54
|
+
event(type: string, init?: any): Event;
|
|
55
|
+
/** 主题根元素 */
|
|
56
|
+
rootElement(): HTMLElement | null;
|
|
57
|
+
/** 选区 */
|
|
58
|
+
getSelection(): Selection | null;
|
|
59
|
+
selectionText(): string;
|
|
60
|
+
/** 存储(SSR/隐私模式安全) */
|
|
61
|
+
storageGet(key: string): string | null;
|
|
62
|
+
storageSet(key: string, value: string): void;
|
|
63
|
+
/** 定时器(SSR no-op) */
|
|
64
|
+
timeout(fn: () => void, ms: number): number;
|
|
65
|
+
/** 当前路径 */
|
|
66
|
+
pathname(): string;
|
|
67
|
+
/** 设置 hash(锚点滚动——Anchor 用) */
|
|
68
|
+
setHash(hash: string): void;
|
|
69
|
+
/** 视口高度 */
|
|
70
|
+
viewportHeight(): number;
|
|
71
|
+
/** 表单恢复回调(ui-dom 兼容——Slider/Form 字段恢复) */
|
|
72
|
+
onFormRestore?(fn: () => void): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom browser — createClientBrowser(生产浏览器环境工厂)
|
|
3
|
+
*
|
|
4
|
+
* 设计:Browser 接口 = window/document 基座 + 组件消费面方法(设计规则 §5.5
|
|
5
|
+
* 能力映射表——copyText/query/storage/scrollTop 等唯一入口——组件禁止
|
|
6
|
+
* 直接访问 DOM 全局)。**惰性环境**(对齐 ui-dom——模块加载时可能无
|
|
7
|
+
* window(SSR/测试 setup 前)——方法内 typeof 检查——setupJsdom/浏览器
|
|
8
|
+
* 就绪后可用——不捕获创建时的 null)。
|
|
9
|
+
*/
|
|
10
|
+
import type { Browser } from './Browser.ts';
|
|
11
|
+
export declare function createClientBrowser(): Browser;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom — commands(命令式 API——toast/confirm/notification——P4 apps 迁移)
|
|
3
|
+
*
|
|
4
|
+
* 设计:vdom 无 createRoot(UIRouter 唯一入口——用户决策)——命令式
|
|
5
|
+
* 浮层经 **vdom 引擎直接渲染**(renderToStream + CommandApplier 到 body
|
|
6
|
+
* 容器——独立 mini-root——不依赖应用路由)——事件代理在 applier 内。
|
|
7
|
+
*
|
|
8
|
+
* 对应组件库:Toast/Confirm/Notification 组件(声明式)+ 本模块命令式
|
|
9
|
+
* 入口(showcase 等应用用 ctx.toast/confirm/notification)。
|
|
10
|
+
*
|
|
11
|
+
* 使用:应用装配(main.tsx)注入 ctx——`ctx.toast('...')` 任意位置调用。
|
|
12
|
+
*/
|
|
13
|
+
export type ToastType = 'success' | 'error' | 'info' | 'warning';
|
|
14
|
+
/** 命令式轻提示(vdom 引擎渲染——自动消失——独立容器) */
|
|
15
|
+
export declare function toast(message: string, type?: ToastType, duration?: number): void;
|
|
16
|
+
/** 命令式注入(应用装配——ctx.toast) */
|
|
17
|
+
export declare function injectCommands<C extends Record<string, unknown>>(ctx: C): C & {
|
|
18
|
+
toast: typeof toast;
|
|
19
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom context — 组件 ctx 类型(独立实现——零引用 ui-dom)
|
|
3
|
+
*
|
|
4
|
+
* 形状对齐契约(vdom-x X-A~G + 设计规则 §4):
|
|
5
|
+
* - render(ids?) 返回 Promise(X-A7——await 精确等待含补跑——契约 §4.2)
|
|
6
|
+
* - data = 数据管道(唯一异步边界——三场景:SSR 真 fetch / hydration 种子 /
|
|
7
|
+
* SPA fetch——缓存 + 并发合并 + 失败显式 invalidate)
|
|
8
|
+
* - onUnmount(卸载清理注册)
|
|
9
|
+
* - browser / ui 由 browser/ hooks/ 模块提供实现——类型在此引用(形状细化
|
|
10
|
+
* 随模块实现推进——当前 unknown 占位——实现后替换为具体接口)
|
|
11
|
+
* - params(路由页面组件参数——UIRouter 注入)
|
|
12
|
+
* - 中间件注入面(api/auth/ws/i18n...——索引签名——可选链消费)
|
|
13
|
+
*/
|
|
14
|
+
/** 数据管道(唯一异步边界——缓存/并发合并/错误/超时由管道管理) */
|
|
15
|
+
export interface DataPipe {
|
|
16
|
+
/** 取数:命中同步返回——未命中调 fetcher 缓存并发合并;
|
|
17
|
+
* 未命中且无 fetcher(SPA 默认 fetch)——管道管理——不挂起 */
|
|
18
|
+
get<T = unknown>(key: string, fetcher?: () => Promise<T>): Promise<T>;
|
|
19
|
+
/** 写缓存(手动失效/预置) */
|
|
20
|
+
set<T = unknown>(key: string, value: T): void;
|
|
21
|
+
/** 数据是否已就绪(渲染期判断——未就绪输出加载态——管线不等待) */
|
|
22
|
+
has(key: string): boolean;
|
|
23
|
+
/** 种子注入(hydration——SSR 收集的数据预热——命中同步——零二次 fetch) */
|
|
24
|
+
preload(seed: Record<string, unknown>): void;
|
|
25
|
+
/** 失败重试(清除缓存中 reject 的 promise——显式入口——默认失败缓存不重试) */
|
|
26
|
+
invalidate(key: string): void;
|
|
27
|
+
/** 收集已解析数据(SSR——渲染后取种子——序列化进 __DATA__) */
|
|
28
|
+
seed(): Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
import type { Browser } from '../browser/Browser.ts';
|
|
31
|
+
import type { Ui } from '../hooks/env.ts';
|
|
32
|
+
export type { Ui };
|
|
33
|
+
/** 组件 ctx(类型增强方案——对齐后端 Context:
|
|
34
|
+
* - 内建面:render/data/ui/browser/onUnmount/params——具体类型
|
|
35
|
+
* - 中间件注入面:`[key: string]: unknown` 索引签名 + **declare module 合并**
|
|
36
|
+
* (应用/中间件作者扩展——同后端 `declare module 'weifuwu' { interface Context }`):
|
|
37
|
+
* ```ts
|
|
38
|
+
* declare module 'weifuwu/vdom' { interface UIContext { api: ApiClient } }
|
|
39
|
+
* ```
|
|
40
|
+
* - 组件泛型:Component<P, C = UIContext>——默认增强后的 UIContext) */
|
|
41
|
+
export interface UIContext {
|
|
42
|
+
/** 统一渲染原语(组件级闭包绑定——root/comp/语义 id 同一入口——串行调度;
|
|
43
|
+
* 返回 Promise——await 精确等待(含渲染中触发的补跑——X-A7) */
|
|
44
|
+
render(ids?: string[]): Promise<void>;
|
|
45
|
+
/** 数据管道(唯一异步边界——工厂层取数) */
|
|
46
|
+
data: DataPipe;
|
|
47
|
+
/** 卸载清理注册(ref cleanup/监听退订——unmount 时执行) */
|
|
48
|
+
onUnmount(fn: () => void): void;
|
|
49
|
+
/** 渲染完成回调注册(hook 挂载后动作——元素已挂载——serve 提供) */
|
|
50
|
+
afterRender?(fn: () => void): void;
|
|
51
|
+
/** 浏览器环境 API(注入的 window/document) */
|
|
52
|
+
browser: Browser;
|
|
53
|
+
/** hooks 注入面(usePopup/useControlled/useExternal 等 14 个——类型安全) */
|
|
54
|
+
ui: Ui;
|
|
55
|
+
/** 路由参数(页面组件——UIRouter 注入) */
|
|
56
|
+
params?: Record<string, string>;
|
|
57
|
+
/** 国际化(middlewares i18n 注入——可选——组件读组件文案面) */
|
|
58
|
+
i18n?: import('../middlewares/auth-i18n.ts').I18nState;
|
|
59
|
+
/** 中间件注入面(api/auth/ws/i18n...——可选链消费) */
|
|
60
|
+
[key: string]: unknown;
|
|
61
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom context — DataPipe 实现(数据管道——组件工厂取数的唯一异步边界)
|
|
3
|
+
*
|
|
4
|
+
* 契约(设计规则 §3.4——ctx.data):
|
|
5
|
+
* - **缓存 + 并发合并**:同 key 并发 get → 同一 promise(重复执行零成本——
|
|
6
|
+
* 组件工厂 N 实例同 key 取数合并)
|
|
7
|
+
* - **key 约定即 URL**(`/api/posts/1`)——天然唯一——key 必须含数据维度
|
|
8
|
+
* (route params、userId)
|
|
9
|
+
* - **三场景**(SSR 真 fetch / hydration 种子同步命中 / SPA 未命中触发
|
|
10
|
+
* fetcher——**无 hydration 决策后**:preload/seed 保留为 SSR 种子通道——
|
|
11
|
+
* 客户端接管时同步命中避免二次 fetch)
|
|
12
|
+
* - **失败缓存**:reject 的 promise 缓存——显式 invalidate(key) 重试
|
|
13
|
+
* (默认失败不重试——诚实语义)
|
|
14
|
+
* - 未命中且无 fetcher → 默认 fetch(key)(key = URL——JSON 解析)
|
|
15
|
+
*/
|
|
16
|
+
import type { DataPipe } from './UIContext.ts';
|
|
17
|
+
export declare function createDataPipe(timeoutMs?: number): DataPipe;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — async guard(异步超时防御——R2 挂起/饿死防御——零依赖)
|
|
3
|
+
*
|
|
4
|
+
* 背景(design/vdom-core-robustness-round4.md R2):DataPipe 缓存 pending
|
|
5
|
+
* promise 无超时——fetcher 永不 resolve(网络挂起/用户 promise 泄漏)→
|
|
6
|
+
* `await renderFn` 永不完成 → 渲染队列饿死——应用冻结。
|
|
7
|
+
*
|
|
8
|
+
* 语义:
|
|
9
|
+
* - **管道级放弃**(不杀底层异步):超时 → reject(显式错误——不再永久
|
|
10
|
+
* pending——诚实语义)——底层 promise 继续跑(完成后结果丢弃——
|
|
11
|
+
* 缓存语义由调用方决定:fail 缓存→invalidate 重试)
|
|
12
|
+
* - 配置:createDataPipe(timeoutMs) / registry.asyncTimeout——生产默认
|
|
13
|
+
* DEFAULT_ASYNC_TIMEOUT_MS(15s)——测试注入短值(假时钟零依赖)
|
|
14
|
+
* - 原生 AbortController 不可用于纯 promise 放弃(fetcher 无 signal 面)——
|
|
15
|
+
* 定时器方案——零依赖契约不变
|
|
16
|
+
*/
|
|
17
|
+
/** 默认异步超时(毫秒——生产——高于移动端慢网络阈值,低于"挂起感知"阈值) */
|
|
18
|
+
export declare const DEFAULT_ASYNC_TIMEOUT_MS = 15000;
|
|
19
|
+
/** 超时包装(ms ≤ 0 = 不超时——测试/本地禁用) */
|
|
20
|
+
export declare function withTimeout<T>(p: Promise<T>, ms: number, label: string): Promise<T>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom core — build 阶段(vnode → 全量命令事件流)
|
|
3
|
+
*
|
|
4
|
+
* 四阶段管线(route → build → diff → patch):build 是「新树渲染」——
|
|
5
|
+
* vnode → 命令事件流(create/insert/close...——done.full 全量标记——
|
|
6
|
+
* patch 据此清理旧树多余节点)。
|
|
7
|
+
*
|
|
8
|
+
* **共享渲染分发器**(createRenderDispatcher——build/diff 共用——单一
|
|
9
|
+
* 规则源):kindOf 分类 → 各 node/ 文件渲染(text/hole/array/fragment/
|
|
10
|
+
* element/component/invalid)——diff 的新侧渲染复用本分发器——
|
|
11
|
+
* **消除重复**(diff 只做对照决策——新侧渲染走这里)。
|
|
12
|
+
*/
|
|
13
|
+
import type { VNode, VNodeChild } from './vnode.ts';
|
|
14
|
+
import { type ComponentRegistry } from './node/component.ts';
|
|
15
|
+
import type { UIContext } from '../context/UIContext.ts';
|
|
16
|
+
import type { Command } from './command/index.ts';
|
|
17
|
+
/** 渲染 sink(子节点递归出口——build/diff 共用) */
|
|
18
|
+
export type RenderSink = (v: VNodeChild, parent: string, index: number, ref: string | null) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 创建渲染分发器(**共享——build 首帧/diff 新侧渲染同一实现**):
|
|
21
|
+
* emit(v, parent, index, ref)——kindOf 分类 → 各 node/ 文件渲染
|
|
22
|
+
*/
|
|
23
|
+
/** 生成端 emit 状态机(**维度 6——2026-XX**):
|
|
24
|
+
* 本流内 id 类型表(id → 节点形态)——验证:
|
|
25
|
+
* ① create 类型冲突:同 id 先 el 后 text(或反)→ 违例(投影错位)
|
|
26
|
+
* ② insert parent 容器性:parent 是已生成的锚/文本 → 违例(id 空间
|
|
27
|
+
* 错位——组件 fuzz an:root.0(div) 类在生成时暴露——而非消费/终态)
|
|
28
|
+
* 宽容项:parent 不在类型表(组件 compId——sink 特判子空间)→ 合法
|
|
29
|
+
* (段回退由消费端处理);create 同 id 同类型重复(幂等复用)→ 合法
|
|
30
|
+
* 报告:console.error(不中断生成——生成端产物仍由对账器裁决) */
|
|
31
|
+
export declare function createRenderDispatcher(emitCommand: (cmd: Command) => void, ctx: UIContext, registry: ComponentRegistry): RenderSink;
|
|
32
|
+
/**
|
|
33
|
+
* vnode → 全量命令事件流(首帧/导航——done.full——patch 清理旧树多余)
|
|
34
|
+
* ctx:组件共享上下文(serve 创建);registry:组件实例注册表
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderToStream(root: VNode, ctx?: UIContext, registry?: ComponentRegistry): ReadableStream<Command>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom command — create(节点创建命令)
|
|
3
|
+
*
|
|
4
|
+
* create 携带 attrs = 可序列化面(class/id/style/data-*——服务端 create 即吐
|
|
5
|
+
* 完整开标签——不依赖后续 setProp);运行时面(事件/ref)走 setProp。
|
|
6
|
+
*/
|
|
7
|
+
/** 创建元素(attrs 序列化面——服务端吐 HTML 开标签) */
|
|
8
|
+
export type CreateCommand = {
|
|
9
|
+
op: 'create';
|
|
10
|
+
id: string;
|
|
11
|
+
tag: string;
|
|
12
|
+
attrs: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
/** 创建文本节点 */
|
|
15
|
+
export type CreateTextCommand = {
|
|
16
|
+
op: 'createText';
|
|
17
|
+
id: string;
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
/** 创建占位锚(空洞槽——childNodes 同构——detail 诊断信息) */
|
|
21
|
+
export type CreateAnchorCommand = {
|
|
22
|
+
op: 'createAnchor';
|
|
23
|
+
id: string;
|
|
24
|
+
detail?: string;
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom command — index(命令汇总——统一导出 + 判定)
|
|
3
|
+
*
|
|
4
|
+
* 命令集 = 修改 DOM 的全部动作(流元素——纯数据——自足不依赖 vn 引用——
|
|
5
|
+
* 可序列化/可流——NDJSON 传输)。
|
|
6
|
+
*/
|
|
7
|
+
import type { CreateCommand, CreateTextCommand, CreateAnchorCommand } from './create.ts';
|
|
8
|
+
import type { InsertCommand, MoveCommand, RemoveCommand } from './insert.ts';
|
|
9
|
+
import type { SetPropCommand, SetTextCommand } from './props.ts';
|
|
10
|
+
import type { RefCommand, UnrefCommand, MountCommand, UnmountCommand, CloseCommand, DoneCommand } from './lifecycle.ts';
|
|
11
|
+
export type { CreateCommand, CreateTextCommand, CreateAnchorCommand, InsertCommand, MoveCommand, RemoveCommand, SetPropCommand, SetTextCommand, RefCommand, UnrefCommand, MountCommand, UnmountCommand, CloseCommand, DoneCommand, };
|
|
12
|
+
/** 渲染指令(流元素——修改 DOM 的最小操作集) */
|
|
13
|
+
export type Command = CreateCommand | CreateTextCommand | CreateAnchorCommand | InsertCommand | MoveCommand | RemoveCommand | SetPropCommand | SetTextCommand | RefCommand | UnrefCommand | MountCommand | UnmountCommand | CloseCommand | DoneCommand;
|
|
14
|
+
/** 命令名(调试/审计——op 类型收窄) */
|
|
15
|
+
export type CommandOp = Command['op'];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom command — insert/remove(挂载与移除命令)
|
|
3
|
+
*
|
|
4
|
+
* insert 的 ref = 已插入的**前一个兄弟**(流式渲染——后一个尚未插入)——
|
|
5
|
+
* apply 侧插到 prev 之后(insertBefore(el, prev.nextSibling));ref null =
|
|
6
|
+
* 追加尾部。
|
|
7
|
+
*/
|
|
8
|
+
/** 挂载节点(parent/ref 均为节点 id) */
|
|
9
|
+
export type InsertCommand = {
|
|
10
|
+
op: 'insert';
|
|
11
|
+
id: string;
|
|
12
|
+
parent: string;
|
|
13
|
+
ref: string | null;
|
|
14
|
+
};
|
|
15
|
+
/** 移动节点(keyed 重排——**DOM 不重建**——子树 id 重映射——
|
|
16
|
+
* id = 旧 id;ref = 前一个兄弟(insertAfter 语义——null = 尾部);
|
|
17
|
+
* first = 移到父最前(首位标记);newId = 新位置 id(子树前缀迁移)) */
|
|
18
|
+
export type MoveCommand = {
|
|
19
|
+
op: 'move';
|
|
20
|
+
id: string;
|
|
21
|
+
parent: string;
|
|
22
|
+
ref: string | null;
|
|
23
|
+
newId: string;
|
|
24
|
+
first?: boolean;
|
|
25
|
+
/** 顺移 remap-only(相对顺序一致——DOM 位置自然到位——只做 id 前缀迁移) */
|
|
26
|
+
noMove?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** 移除节点(含子树——事件监听随元素 GC) */
|
|
29
|
+
export type RemoveCommand = {
|
|
30
|
+
op: 'remove';
|
|
31
|
+
id: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vdom command — lifecycle(生命周期命令——显式指令化)
|
|
3
|
+
*
|
|
4
|
+
* 设计(2026-12——用户决策):生命周期动作**显式指令**——patch 读取指令
|
|
5
|
+
* 时处理:
|
|
6
|
+
* - ref / unref —— **DOM 节点生命周期**:
|
|
7
|
+
* ref = 节点挂载完成(insert 后——ref(el) 回调——el 已连接);
|
|
8
|
+
* unref = 节点卸载(ref(null) 回调——子树清理)
|
|
9
|
+
* - mount / unmount —— **组件生命周期**:
|
|
10
|
+
* mount = 组件实例初始化完成(工厂执行后——实例已注册);
|
|
11
|
+
* unmount = 组件卸载(onUnmounts 清理——逆序执行——实例注册表消费)
|
|
12
|
+
*
|
|
13
|
+
* close = 离开子树(服务端闭合标签时机——客户端 no-op);
|
|
14
|
+
* done = 流结束 = 渲染完成。
|
|
15
|
+
*/
|
|
16
|
+
/** 节点挂载完成(DOM 生命周期——ref(el)——fn 经函数表引用) */
|
|
17
|
+
export type RefCommand = {
|
|
18
|
+
op: 'ref';
|
|
19
|
+
id: string;
|
|
20
|
+
fn: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** 节点卸载(DOM 生命周期——ref(null)) */
|
|
23
|
+
export type UnrefCommand = {
|
|
24
|
+
op: 'unref';
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
/** 组件实例初始化完成(组件生命周期——工厂已执行——实例已注册) */
|
|
28
|
+
export type MountCommand = {
|
|
29
|
+
op: 'mount';
|
|
30
|
+
compId: string;
|
|
31
|
+
};
|
|
32
|
+
/** 组件卸载(组件生命周期——onUnmounts 清理——逆序执行) */
|
|
33
|
+
export type UnmountCommand = {
|
|
34
|
+
op: 'unmount';
|
|
35
|
+
compId: string;
|
|
36
|
+
};
|
|
37
|
+
/** 离开子树——服务端闭合标签——客户端 no-op */
|
|
38
|
+
export type CloseCommand = {
|
|
39
|
+
op: 'close';
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
42
|
+
/** 流结束 = 渲染完成(full = 全量流标记——patch 据此清理旧树多余节点;
|
|
43
|
+
* 增量流(diff)不清理——旧节点都是存活) */
|
|
44
|
+
export type DoneCommand = {
|
|
45
|
+
op: 'done';
|
|
46
|
+
full?: boolean;
|
|
47
|
+
};
|