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.
Files changed (655) hide show
  1. package/README.md +56 -45
  2. package/content/apps/admin.md +55 -0
  3. package/content/apps/agent-platform.md +35 -0
  4. package/content/apps/auth.md +49 -0
  5. package/content/apps/multi.md +44 -0
  6. package/content/apps/todo.md +51 -0
  7. package/content/backend/ai.md +28 -0
  8. package/content/backend/auth.md +20 -0
  9. package/content/backend/email.md +23 -0
  10. package/content/backend/graphql.md +23 -0
  11. package/content/backend/http.md +23 -0
  12. package/content/backend/limit.md +23 -0
  13. package/content/backend/middleware.md +17 -0
  14. package/content/backend/queue.md +23 -0
  15. package/content/backend/redis.md +26 -0
  16. package/content/backend/router.md +23 -0
  17. package/content/backend/schedule.md +23 -0
  18. package/content/backend/sql.md +27 -0
  19. package/content/backend/sse.md +26 -0
  20. package/content/backend/ws.md +26 -0
  21. package/content/capabilities/app-node.md +21 -0
  22. package/content/capabilities/data.md +21 -0
  23. package/content/capabilities/events.md +21 -0
  24. package/content/capabilities/hooks.md +22 -0
  25. package/content/capabilities/i18n.md +21 -0
  26. package/content/capabilities/popup.md +21 -0
  27. package/content/capabilities/render-only.md +23 -0
  28. package/content/capabilities/router.md +22 -0
  29. package/content/capabilities/self-id.md +21 -0
  30. package/content/capabilities/store.md +21 -0
  31. package/content/capabilities/theme.md +21 -0
  32. package/content/capabilities/two-phase.md +21 -0
  33. package/content/components/accordion.md +50 -0
  34. package/content/components/actionsheet.md +46 -0
  35. package/content/components/affix.md +51 -0
  36. package/content/components/aichat.md +57 -0
  37. package/content/components/alert.md +52 -0
  38. package/content/components/alertgroup.md +45 -0
  39. package/content/components/anchor.md +52 -0
  40. package/content/components/app.md +37 -0
  41. package/content/components/approvalcard.md +56 -0
  42. package/content/components/appshell.md +50 -0
  43. package/content/components/aspectratio.md +47 -0
  44. package/content/components/authpage.md +61 -0
  45. package/content/components/autocomplete-v2.md +40 -0
  46. package/content/components/autocomplete.md +56 -0
  47. package/content/components/avatar.md +51 -0
  48. package/content/components/avatargroup.md +47 -0
  49. package/content/components/backtop.md +53 -0
  50. package/content/components/badge.md +55 -0
  51. package/content/components/breadcrumb.md +49 -0
  52. package/content/components/button.md +63 -0
  53. package/content/components/calendar-v2.md +40 -0
  54. package/content/components/calendar.md +50 -0
  55. package/content/components/card.md +58 -0
  56. package/content/components/carousel.md +52 -0
  57. package/content/components/cascader-v2.md +39 -0
  58. package/content/components/cascader.md +54 -0
  59. package/content/components/chart.md +53 -0
  60. package/content/components/chatinput.md +63 -0
  61. package/content/components/checkbox.md +51 -0
  62. package/content/components/checkboxgroup.md +52 -0
  63. package/content/components/citationcard.md +48 -0
  64. package/content/components/codeblock.md +48 -0
  65. package/content/components/codeeditor.md +47 -0
  66. package/content/components/collapse.md +49 -0
  67. package/content/components/colorpicker.md +50 -0
  68. package/content/components/command.md +50 -0
  69. package/content/components/confirm.md +57 -0
  70. package/content/components/contextmenu.md +48 -0
  71. package/content/components/copybutton.md +51 -0
  72. package/content/components/datepicker.md +52 -0
  73. package/content/components/descriptions-v2.md +39 -0
  74. package/content/components/descriptions.md +52 -0
  75. package/content/components/diffview-v2.md +39 -0
  76. package/content/components/diffview.md +50 -0
  77. package/content/components/divider.md +48 -0
  78. package/content/components/drawer.md +55 -0
  79. package/content/components/dropdown.md +53 -0
  80. package/content/components/editor.md +49 -0
  81. package/content/components/emptystate.md +51 -0
  82. package/content/components/exportcsv.md +38 -0
  83. package/content/components/field.md +54 -0
  84. package/content/components/filepreview-office.md +37 -0
  85. package/content/components/filepreview.md +49 -0
  86. package/content/components/filetree.md +56 -0
  87. package/content/components/fileupload-v2.md +39 -0
  88. package/content/components/fileupload.md +57 -0
  89. package/content/components/floatbutton.md +52 -0
  90. package/content/components/form-v2.md +41 -0
  91. package/content/components/form.md +60 -0
  92. package/content/components/grid.md +51 -0
  93. package/content/components/highlight-v2.md +39 -0
  94. package/content/components/highlight.md +46 -0
  95. package/content/components/hovercard.md +51 -0
  96. package/content/components/icon.md +50 -0
  97. package/content/components/imagecropper.md +45 -0
  98. package/content/components/img.md +56 -0
  99. package/content/components/infinitescroll-v2.md +40 -0
  100. package/content/components/infinitescroll.md +54 -0
  101. package/content/components/input.md +65 -0
  102. package/content/components/inputnumber.md +58 -0
  103. package/content/components/inview.md +56 -0
  104. package/content/components/jsonschemaform.md +53 -0
  105. package/content/components/jsonviewer-v2.md +39 -0
  106. package/content/components/jsonviewer.md +49 -0
  107. package/content/components/kanban.md +46 -0
  108. package/content/components/label.md +48 -0
  109. package/content/components/layout.md +54 -0
  110. package/content/components/layoutcontent.md +43 -0
  111. package/content/components/layoutheader.md +43 -0
  112. package/content/components/layoutsider.md +43 -0
  113. package/content/components/link.md +52 -0
  114. package/content/components/list.md +44 -0
  115. package/content/components/loading.md +45 -0
  116. package/content/components/logviewer-v2.md +39 -0
  117. package/content/components/logviewer.md +53 -0
  118. package/content/components/markdown.md +51 -0
  119. package/content/components/markdowneditor.md +47 -0
  120. package/content/components/math.md +42 -0
  121. package/content/components/mentions-v2.md +39 -0
  122. package/content/components/mentions.md +52 -0
  123. package/content/components/menu.md +56 -0
  124. package/content/components/menubar.md +44 -0
  125. package/content/components/messagebubble.md +50 -0
  126. package/content/components/modal.md +59 -0
  127. package/content/components/navmenu.md +47 -0
  128. package/content/components/notification.md +51 -0
  129. package/content/components/pageheader.md +53 -0
  130. package/content/components/pagination.md +49 -0
  131. package/content/components/paragraph.md +45 -0
  132. package/content/components/passwordinput.md +57 -0
  133. package/content/components/pininput-v2.md +39 -0
  134. package/content/components/pininput.md +50 -0
  135. package/content/components/pipeline.md +49 -0
  136. package/content/components/popconfirm.md +58 -0
  137. package/content/components/popover.md +61 -0
  138. package/content/components/progressbar.md +50 -0
  139. package/content/components/prompttemplate.md +49 -0
  140. package/content/components/qrcode.md +50 -0
  141. package/content/components/radiogroup.md +53 -0
  142. package/content/components/rate.md +53 -0
  143. package/content/components/reasoningblock.md +47 -0
  144. package/content/components/relationgraph.md +52 -0
  145. package/content/components/resizable.md +53 -0
  146. package/content/components/result.md +49 -0
  147. package/content/components/scrollbar.md +49 -0
  148. package/content/components/searchinput.md +51 -0
  149. package/content/components/segmentedcontrol.md +59 -0
  150. package/content/components/select-searchable.md +47 -0
  151. package/content/components/select.md +66 -0
  152. package/content/components/sessionlist.md +52 -0
  153. package/content/components/sheetgrid.md +44 -0
  154. package/content/components/skeleton.md +55 -0
  155. package/content/components/slidecanvas.md +44 -0
  156. package/content/components/slider.md +62 -0
  157. package/content/components/sortablelist.md +39 -0
  158. package/content/components/space.md +52 -0
  159. package/content/components/sparkline.md +52 -0
  160. package/content/components/statcard-countdown.md +39 -0
  161. package/content/components/statcard.md +56 -0
  162. package/content/components/steps.md +48 -0
  163. package/content/components/switch.md +50 -0
  164. package/content/components/tabbar.md +45 -0
  165. package/content/components/table-v2.md +40 -0
  166. package/content/components/table.md +66 -0
  167. package/content/components/tabs.md +56 -0
  168. package/content/components/tag.md +51 -0
  169. package/content/components/tagsinput-v2.md +39 -0
  170. package/content/components/tagsinput.md +54 -0
  171. package/content/components/text.md +45 -0
  172. package/content/components/textarea.md +57 -0
  173. package/content/components/themeswitch.md +69 -0
  174. package/content/components/timeline.md +50 -0
  175. package/content/components/title.md +45 -0
  176. package/content/components/toast.md +52 -0
  177. package/content/components/toggle-togglegroup.md +52 -0
  178. package/content/components/togglegroup.md +47 -0
  179. package/content/components/toolcallcard.md +51 -0
  180. package/content/components/tooltip.md +50 -0
  181. package/content/components/tour.md +50 -0
  182. package/content/components/transfer.md +52 -0
  183. package/content/components/tree-v2.md +39 -0
  184. package/content/components/tree.md +59 -0
  185. package/content/components/treeselect.md +54 -0
  186. package/content/components/typography.md +51 -0
  187. package/content/components/videoplayer.md +52 -0
  188. package/content/components/virtuallist.md +52 -0
  189. package/content/components/virtualtable-v2.md +39 -0
  190. package/content/components/virtualtable.md +55 -0
  191. package/content/components/watermark.md +53 -0
  192. package/content/components/wave.md +43 -0
  193. package/content/guides/ai-chat-family.md +24 -0
  194. package/content/guides/choose.md +67 -0
  195. package/content/guides/component-model.md +32 -0
  196. package/content/guides/component-standards.md +123 -0
  197. package/{docs/components.md → content/guides/components-guide.md} +153 -7
  198. package/{docs/custom-components.md → content/guides/custom-component.md} +70 -55
  199. package/{docs/data.md → content/guides/data-guide.md} +5 -2
  200. package/content/guides/file-preview-family.md +18 -0
  201. package/{docs → content/guides}/frontend.md +122 -52
  202. package/content/guides/layout-choice.md +64 -0
  203. package/{docs/layout.md → content/guides/layout-guide.md} +12 -8
  204. package/{docs/frontend-middleware.md → content/guides/middleware.md} +34 -3
  205. package/{docs/mobile.md → content/guides/mobile-guide.md} +20 -24
  206. package/content/guides/page-building.md +98 -0
  207. package/content/guides/production.md +37 -0
  208. package/content/guides/quality.md +60 -0
  209. package/{docs/realtime.md → content/guides/realtime-guide.md} +6 -3
  210. package/content/guides/render-only.md +44 -0
  211. package/{docs/saas.md → content/guides/saas-guide.md} +8 -5
  212. package/{docs/server.md → content/guides/server-guide.md} +5 -2
  213. package/content/guides/start.md +41 -0
  214. package/{docs → content/guides}/styling.md +5 -1
  215. package/{docs/frontend-ui-dom.md → content/guides/ui-dom-guide.md} +7 -1
  216. package/content/index.json +4344 -0
  217. package/content/index.md +181 -0
  218. package/content/layout/align.md +20 -0
  219. package/content/layout/anchor.md +19 -0
  220. package/content/layout/app-shell.md +23 -0
  221. package/content/layout/border.md +20 -0
  222. package/content/layout/center.md +19 -0
  223. package/content/layout/cluster.md +19 -0
  224. package/content/layout/container.md +19 -0
  225. package/content/layout/fill.md +19 -0
  226. package/content/layout/grid.md +19 -0
  227. package/content/layout/hidden.md +22 -0
  228. package/content/layout/layer.md +19 -0
  229. package/content/layout/position.md +22 -0
  230. package/content/layout/row.md +23 -0
  231. package/content/layout/safe-area.md +20 -0
  232. package/content/layout/scroll.md +21 -0
  233. package/content/layout/spacing.md +22 -0
  234. package/content/layout/split.md +19 -0
  235. package/content/layout/stack.md +19 -0
  236. package/content/layout/surface.md +23 -0
  237. package/content/layout/text.md +22 -0
  238. package/content/patterns/app-shell.md +34 -0
  239. package/content/patterns/dashboard.md +36 -0
  240. package/content/patterns/data-screen.md +30 -0
  241. package/content/patterns/detail-page.md +31 -0
  242. package/content/patterns/docs.md +34 -0
  243. package/content/patterns/focus-task.md +34 -0
  244. package/content/patterns/landing.md +35 -0
  245. package/content/patterns/list-page.md +32 -0
  246. package/content/patterns/mobile.md +31 -0
  247. package/content/patterns/settings-page.md +33 -0
  248. package/content/patterns/workspace.md +32 -0
  249. package/dist/cli/apps-typecheck.test.d.ts +11 -0
  250. package/dist/cli/docs.d.ts +2 -0
  251. package/dist/cli/docs.mjs +10961 -0
  252. package/dist/cli/home-flash.test.d.ts +1 -0
  253. package/dist/{components → client/components}/Accordion/Accordion.d.ts +1 -1
  254. package/dist/client/components/ActionSheet/ActionSheet.d.ts +37 -0
  255. package/dist/{components → client/components}/Affix/Affix.d.ts +1 -1
  256. package/dist/{components → client/components}/AiChat/AiChat.d.ts +3 -3
  257. package/dist/{components → client/components}/Alert/Alert.d.ts +1 -1
  258. package/dist/{components → client/components}/AlertGroup/AlertGroup.d.ts +1 -1
  259. package/dist/{components → client/components}/Anchor/Anchor.d.ts +1 -1
  260. package/dist/client/components/AppShell/AppShell.d.ts +55 -0
  261. package/dist/{components → client/components}/ApprovalCard/ApprovalCard.d.ts +2 -2
  262. package/dist/{components → client/components}/AspectRatio/AspectRatio.d.ts +1 -1
  263. package/dist/{components → client/components}/AuthPage/AuthPage.d.ts +2 -2
  264. package/dist/{components → client/components}/AutoComplete/AutoComplete.d.ts +1 -1
  265. package/dist/{components → client/components}/Avatar/Avatar.d.ts +1 -1
  266. package/dist/{components → client/components}/AvatarGroup/AvatarGroup.d.ts +1 -1
  267. package/dist/{components → client/components}/BackTop/BackTop.d.ts +1 -1
  268. package/dist/{components → client/components}/Badge/Badge.d.ts +1 -1
  269. package/dist/{components → client/components}/Breadcrumb/Breadcrumb.d.ts +1 -1
  270. package/dist/{components → client/components}/Button/Button.d.ts +1 -1
  271. package/dist/{components → client/components}/Calendar/Calendar.d.ts +1 -1
  272. package/dist/{components → client/components}/Card/Card.d.ts +1 -1
  273. package/dist/{components → client/components}/Carousel/Carousel.d.ts +1 -1
  274. package/dist/{components → client/components}/Cascader/Cascader.d.ts +1 -1
  275. package/dist/{components → client/components}/Chart/Chart.d.ts +1 -1
  276. package/dist/{components → client/components}/Chart/chart-utils.d.ts +5 -1
  277. package/dist/{components → client/components}/ChatInput/ChatInput.d.ts +7 -7
  278. package/dist/{components → client/components}/Checkbox/Checkbox.d.ts +1 -1
  279. package/dist/{components → client/components}/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  280. package/dist/{components → client/components}/CitationCard/CitationCard.d.ts +3 -3
  281. package/dist/{components → client/components}/CodeBlock/CodeBlock.d.ts +1 -1
  282. package/dist/client/components/CodeEditor/CodeEditor.d.ts +18 -0
  283. package/dist/{components → client/components}/Collapse/Collapse.d.ts +1 -1
  284. package/dist/{components → client/components}/ColorPicker/ColorPicker.d.ts +1 -1
  285. package/dist/{components → client/components}/Command/Command.d.ts +1 -1
  286. package/dist/{components → client/components}/Confirm/Confirm.d.ts +2 -7
  287. package/dist/{components → client/components}/ContextMenu/ContextMenu.d.ts +1 -1
  288. package/dist/{components → client/components}/CopyButton/CopyButton.d.ts +1 -1
  289. package/dist/{components → client/components}/DatePicker/DatePicker.d.ts +2 -2
  290. package/dist/{components → client/components}/Descriptions/Descriptions.d.ts +1 -1
  291. package/dist/{components → client/components}/DiffView/DiffView.d.ts +1 -1
  292. package/dist/{components → client/components}/Divider/Divider.d.ts +1 -1
  293. package/dist/{components → client/components}/Drawer/Drawer.d.ts +1 -1
  294. package/dist/{components → client/components}/Dropdown/Dropdown.d.ts +1 -1
  295. package/dist/client/components/Editor/Editor.d.ts +14 -0
  296. package/dist/client/components/Editor/edit-events.d.ts +27 -0
  297. package/dist/client/components/Editor/model/apply.d.ts +23 -0
  298. package/dist/client/components/Editor/model/diff.d.ts +25 -0
  299. package/dist/client/components/Editor/model/dom.d.ts +27 -0
  300. package/dist/client/components/Editor/model/history.d.ts +21 -0
  301. package/dist/client/components/Editor/model/html.d.ts +16 -0
  302. package/dist/client/components/Editor/model/inverse.d.ts +20 -0
  303. package/dist/client/components/Editor/model/types.d.ts +116 -0
  304. package/dist/client/components/Editor/tools/table.d.ts +10 -0
  305. package/dist/{components → client/components}/Editor/tools/toolbar.d.ts +2 -2
  306. package/dist/client/components/Editor/tools/types.d.ts +40 -0
  307. package/dist/{components → client/components}/EmptyState/EmptyState.d.ts +1 -1
  308. package/dist/client/components/ExportCSV/ExportCSV.d.ts +30 -0
  309. package/dist/{components → client/components}/Field/Field.d.ts +1 -1
  310. package/dist/client/components/FilePreview/FilePreview.d.ts +42 -0
  311. package/dist/client/components/FilePreview/markdown.d.ts +23 -0
  312. package/dist/client/components/FileTree/FileTree.d.ts +57 -0
  313. package/dist/{components → client/components}/FileUpload/FileUpload.d.ts +1 -1
  314. package/dist/{components → client/components}/FloatButton/FloatButton.d.ts +1 -1
  315. package/dist/{components → client/components}/Form/Form.d.ts +1 -1
  316. package/dist/{components → client/components}/Grid/Grid.d.ts +1 -1
  317. package/dist/{components → client/components}/Highlight/Highlight.d.ts +1 -1
  318. package/dist/{components → client/components}/HoverCard/HoverCard.d.ts +5 -4
  319. package/dist/{components → client/components}/Icon/Icon.d.ts +2 -2
  320. package/dist/client/components/ImageCropper/ImageCropper.d.ts +17 -0
  321. package/dist/{components → client/components}/Img/Img.d.ts +1 -1
  322. package/dist/{components → client/components}/InView/InView.d.ts +1 -1
  323. package/dist/{components → client/components}/InfiniteScroll/InfiniteScroll.d.ts +1 -1
  324. package/dist/{components → client/components}/Input/Input.d.ts +1 -1
  325. package/dist/{components → client/components}/InputNumber/InputNumber.d.ts +1 -1
  326. package/dist/{components → client/components}/JSONViewer/JSONViewer.d.ts +1 -1
  327. package/dist/{components → client/components}/JsonSchemaForm/JsonSchemaForm.d.ts +3 -3
  328. package/dist/{components → client/components}/Kanban/Kanban.d.ts +1 -1
  329. package/dist/{components → client/components}/Label/Label.d.ts +1 -1
  330. package/dist/{components → client/components}/Layout/Layout.d.ts +1 -1
  331. package/dist/{components → client/components}/Link/Link.d.ts +1 -1
  332. package/dist/{components → client/components}/List/List.d.ts +1 -1
  333. package/dist/{components → client/components}/Loading/Loading.d.ts +1 -1
  334. package/dist/{components → client/components}/LogViewer/LogViewer.d.ts +1 -1
  335. package/dist/{components → client/components}/Markdown/Markdown.d.ts +1 -1
  336. package/dist/client/components/MarkdownEditor/MarkdownEditor.d.ts +18 -0
  337. package/dist/client/components/Math/Math.d.ts +15 -0
  338. package/dist/{components → client/components}/Mentions/Mentions.d.ts +1 -1
  339. package/dist/{components → client/components}/Menu/Menu.d.ts +1 -1
  340. package/dist/{components → client/components}/Menubar/Menubar.d.ts +1 -1
  341. package/dist/{components → client/components}/MessageBubble/MessageBubble.d.ts +1 -1
  342. package/dist/{components → client/components}/Modal/Modal.d.ts +1 -1
  343. package/dist/{components → client/components}/NavMenu/NavMenu.d.ts +2 -2
  344. package/dist/{components → client/components}/Notification/Notification.d.ts +7 -2
  345. package/dist/client/components/OfficeEditor/ai/ai-bridge.d.ts +39 -0
  346. package/dist/client/components/OfficeEditor/model/apply.d.ts +25 -0
  347. package/dist/client/components/OfficeEditor/model/types.d.ts +224 -0
  348. package/dist/{components → client/components}/PageHeader/PageHeader.d.ts +1 -1
  349. package/dist/{components → client/components}/Pagination/Pagination.d.ts +1 -1
  350. package/dist/{components → client/components}/PasswordInput/PasswordInput.d.ts +1 -1
  351. package/dist/{components → client/components}/PinInput/PinInput.d.ts +1 -1
  352. package/dist/{components → client/components}/Pipeline/Pipeline.d.ts +1 -1
  353. package/dist/{components → client/components}/Popconfirm/Popconfirm.d.ts +2 -2
  354. package/dist/{components → client/components}/Popover/Popover.d.ts +5 -4
  355. package/dist/{components → client/components}/ProgressBar/ProgressBar.d.ts +1 -1
  356. package/dist/client/components/PromptTemplate/PromptTemplate.d.ts +37 -0
  357. package/dist/{components → client/components}/QRCode/QRCode.d.ts +1 -1
  358. package/dist/{components → client/components}/RadioGroup/RadioGroup.d.ts +1 -1
  359. package/dist/{components → client/components}/Rate/Rate.d.ts +1 -1
  360. package/dist/{components → client/components}/ReasoningBlock/ReasoningBlock.d.ts +3 -3
  361. package/dist/client/components/RelationGraph/RelationGraph.d.ts +59 -0
  362. package/dist/{components → client/components}/Resizable/Resizable.d.ts +1 -1
  363. package/dist/{components → client/components}/Result/Result.d.ts +1 -1
  364. package/dist/{components → client/components}/Scrollbar/Scrollbar.d.ts +1 -1
  365. package/dist/{components → client/components}/SearchInput/SearchInput.d.ts +1 -1
  366. package/dist/{components → client/components}/SegmentedControl/SegmentedControl.d.ts +1 -1
  367. package/dist/{components → client/components}/Select/Select.d.ts +1 -1
  368. package/dist/{components → client/components}/SessionList/SessionList.d.ts +3 -3
  369. package/dist/client/components/SheetGrid/SheetGrid.d.ts +30 -0
  370. package/dist/{components → client/components}/Skeleton/Skeleton.d.ts +1 -1
  371. package/dist/client/components/SlideCanvas/SlideCanvas.d.ts +28 -0
  372. package/dist/client/components/Slider/Slider.d.ts +27 -0
  373. package/dist/client/components/SortableList/SortableList.d.ts +23 -0
  374. package/dist/{components → client/components}/Space/Space.d.ts +1 -1
  375. package/dist/{components → client/components}/Sparkline/Sparkline.d.ts +1 -1
  376. package/dist/{components → client/components}/StatCard/StatCard.d.ts +1 -1
  377. package/dist/{components → client/components}/Steps/Steps.d.ts +1 -1
  378. package/dist/{components → client/components}/Switch/Switch.d.ts +1 -1
  379. package/dist/client/components/TabBar/TabBar.d.ts +35 -0
  380. package/dist/{components → client/components}/Table/Table.d.ts +7 -1
  381. package/dist/client/components/Tabs/Tabs.d.ts +22 -0
  382. package/dist/{components → client/components}/Tag/Tag.d.ts +1 -1
  383. package/dist/{components → client/components}/TagsInput/TagsInput.d.ts +1 -1
  384. package/dist/{components → client/components}/Textarea/Textarea.d.ts +1 -1
  385. package/dist/{components → client/components}/ThemeSwitch/ThemeSwitch.d.ts +1 -1
  386. package/dist/{components → client/components}/Timeline/Timeline.d.ts +1 -1
  387. package/dist/{components → client/components}/Toast/Toast.d.ts +1 -1
  388. package/dist/{components → client/components}/ToggleGroup/ToggleGroup.d.ts +1 -1
  389. package/dist/{components → client/components}/ToolCallCard/ToolCallCard.d.ts +2 -2
  390. package/dist/{components → client/components}/Tooltip/Tooltip.d.ts +4 -3
  391. package/dist/{components → client/components}/Tour/Tour.d.ts +1 -1
  392. package/dist/{components → client/components}/Transfer/Transfer.d.ts +1 -1
  393. package/dist/{components → client/components}/Tree/Tree.d.ts +5 -1
  394. package/dist/{components → client/components}/TreeSelect/TreeSelect.d.ts +5 -1
  395. package/dist/{components → client/components}/Typography/Typography.d.ts +1 -1
  396. package/dist/client/components/VideoPlayer/VideoPlayer.d.ts +25 -0
  397. package/dist/{components → client/components}/VirtualList/VirtualList.d.ts +1 -1
  398. package/dist/{components → client/components}/VirtualTable/VirtualTable.d.ts +1 -1
  399. package/dist/{components → client/components}/Watermark/Watermark.d.ts +1 -1
  400. package/dist/client/components/Wave/Wave.d.ts +15 -0
  401. package/dist/{components → client/components}/index.d.ts +48 -2
  402. package/dist/client/components/index.js +57 -0
  403. package/dist/{components → client/components}/style.css +3554 -1896
  404. package/dist/{layout → client/layout}/weifuwu-layout.css +60 -6
  405. package/dist/client/office/docx.d.ts +33 -0
  406. package/dist/client/office/pptx.d.ts +24 -0
  407. package/dist/client/office/xlsx.d.ts +25 -0
  408. package/dist/client/office/xml-serialize.d.ts +18 -0
  409. package/dist/client/office/xml.d.ts +21 -0
  410. package/dist/client/office/zip.d.ts +21 -0
  411. package/dist/client/vdom/browser/Browser.d.ts +73 -0
  412. package/dist/client/vdom/browser/create-client-browser.d.ts +11 -0
  413. package/dist/client/vdom/commands.d.ts +19 -0
  414. package/dist/client/vdom/context/UIContext.d.ts +61 -0
  415. package/dist/client/vdom/context/data.d.ts +17 -0
  416. package/dist/client/vdom/core/async-guard.d.ts +20 -0
  417. package/dist/client/vdom/core/build.d.ts +36 -0
  418. package/dist/client/vdom/core/command/create.d.ts +25 -0
  419. package/dist/client/vdom/core/command/index.d.ts +15 -0
  420. package/dist/client/vdom/core/command/insert.d.ts +32 -0
  421. package/dist/client/vdom/core/command/lifecycle.d.ts +47 -0
  422. package/dist/client/vdom/core/command/props.d.ts +22 -0
  423. package/dist/client/vdom/core/diff/attrs.d.ts +10 -0
  424. package/dist/client/vdom/core/diff/children.d.ts +29 -0
  425. package/dist/client/vdom/core/diff/cleanup.d.ts +44 -0
  426. package/dist/client/vdom/core/diff/index.d.ts +22 -0
  427. package/dist/client/vdom/core/diff/output.d.ts +30 -0
  428. package/dist/client/vdom/core/diff/same.d.ts +22 -0
  429. package/dist/client/vdom/core/field/attributes.d.ts +15 -0
  430. package/dist/client/vdom/core/field/events.d.ts +54 -0
  431. package/dist/client/vdom/core/field/index.d.ts +19 -0
  432. package/dist/client/vdom/core/field/key.d.ts +16 -0
  433. package/dist/client/vdom/core/field/props.d.ts +15 -0
  434. package/dist/client/vdom/core/field/ref.d.ts +38 -0
  435. package/dist/client/vdom/core/field/style.d.ts +17 -0
  436. package/dist/client/vdom/core/node/children.d.ts +20 -0
  437. package/dist/client/vdom/core/node/component.d.ts +93 -0
  438. package/dist/client/vdom/core/node/fragment.d.ts +14 -0
  439. package/dist/client/vdom/core/node/hole.d.ts +22 -0
  440. package/dist/client/vdom/core/node/index.d.ts +35 -0
  441. package/dist/client/vdom/core/node/keyed.d.ts +64 -0
  442. package/dist/client/vdom/core/node/native.d.ts +20 -0
  443. package/dist/client/vdom/core/node/portal.d.ts +11 -0
  444. package/dist/client/vdom/core/patch/fields.d.ts +15 -0
  445. package/dist/client/vdom/core/patch/index.d.ts +51 -0
  446. package/dist/client/vdom/core/patch/processors.d.ts +75 -0
  447. package/dist/client/vdom/core/patch/state-machine.d.ts +38 -0
  448. package/dist/client/vdom/core/patch/verify.d.ts +17 -0
  449. package/dist/client/vdom/core/router.d.ts +31 -0
  450. package/dist/client/vdom/core/serve.d.ts +75 -0
  451. package/dist/client/vdom/core/ssr/absorb.d.ts +53 -0
  452. package/dist/client/vdom/core/ssr/html.d.ts +32 -0
  453. package/dist/client/vdom/core/ssr/index.d.ts +25 -0
  454. package/dist/client/vdom/core/transform/component.d.ts +23 -0
  455. package/dist/client/vdom/core/transform/element.d.ts +21 -0
  456. package/dist/client/vdom/core/transform/fragment.d.ts +21 -0
  457. package/dist/client/vdom/core/transform/hole.d.ts +13 -0
  458. package/dist/client/vdom/core/transform/index.d.ts +46 -0
  459. package/dist/client/vdom/core/transform/states.d.ts +22 -0
  460. package/dist/client/vdom/core/transform/table.d.ts +28 -0
  461. package/dist/client/vdom/core/transform/text.d.ts +10 -0
  462. package/dist/client/vdom/core/vnode.d.ts +45 -0
  463. package/dist/client/vdom/dev/effect-guard.d.ts +8 -0
  464. package/dist/client/vdom/hooks/ai-stream.d.ts +46 -0
  465. package/dist/client/vdom/hooks/basic.d.ts +42 -0
  466. package/dist/client/vdom/hooks/chat.d.ts +91 -0
  467. package/dist/client/vdom/hooks/controlled.d.ts +27 -0
  468. package/dist/client/vdom/hooks/drag-media.d.ts +52 -0
  469. package/dist/client/vdom/hooks/env.d.ts +119 -0
  470. package/dist/client/vdom/hooks/input.d.ts +43 -0
  471. package/dist/client/vdom/hooks/observe.d.ts +60 -0
  472. package/dist/client/vdom/hooks/popup-manager.d.ts +92 -0
  473. package/dist/client/vdom/hooks/popup.d.ts +52 -0
  474. package/dist/client/vdom/hooks/stable.d.ts +45 -0
  475. package/dist/client/vdom/index.d.ts +67 -0
  476. package/dist/client/vdom/index.js +8 -0
  477. package/dist/client/vdom/jsx-runtime.d.ts +28 -0
  478. package/dist/client/vdom/jsx-runtime.js +1 -0
  479. package/dist/client/vdom/middlewares/api.d.ts +38 -0
  480. package/dist/client/vdom/middlewares/auth-i18n.d.ts +66 -0
  481. package/dist/client/vdom/middlewares/ws.d.ts +37 -0
  482. package/dist/client/vdom/store.d.ts +49 -0
  483. package/dist/client/vdom/testing.d.ts +46 -0
  484. package/dist/client/vdom/testing.js +2 -0
  485. package/dist/dev/index.d.ts +12 -0
  486. package/dist/dev/index.js +4 -4
  487. package/dist/{ai → server/ai}/contracts.d.ts +1 -1
  488. package/dist/{ai → server/ai}/index.d.ts +2 -2
  489. package/dist/{ai → server/ai}/types.d.ts +1 -1
  490. package/dist/{core → server/core}/router.d.ts +2 -4
  491. package/dist/{db → server/db}/contracts.d.ts +1 -1
  492. package/dist/server/db/postgres-server.d.ts +37 -0
  493. package/dist/server/db/redis-server.d.ts +32 -0
  494. package/dist/server/db/server.d.ts +30 -0
  495. package/dist/server/db/test-servers.d.ts +21 -0
  496. package/dist/{email → server/email}/contracts.d.ts +1 -1
  497. package/dist/{index.js → server/index.js} +3147 -2462
  498. package/dist/{ui → server/ui}/index.d.ts +2 -2
  499. package/dist/{user → server/user}/token.d.ts +1 -1
  500. package/dist/shared/router/trie.d.ts +61 -0
  501. package/docs/components-map.md +16 -4
  502. package/docs/style-guide.md +14 -2
  503. package/examples/apps/admin/README.md +23 -0
  504. package/examples/apps/admin/api.ts +27 -0
  505. package/examples/apps/admin/app.tsx +144 -0
  506. package/examples/apps/admin/main.tsx +8 -0
  507. package/examples/apps/admin/server.ts +37 -0
  508. package/examples/apps/auth/README.md +23 -0
  509. package/examples/apps/auth/api.ts +49 -0
  510. package/examples/apps/auth/app.tsx +137 -0
  511. package/examples/apps/auth/main.tsx +8 -0
  512. package/examples/apps/auth/server.ts +37 -0
  513. package/examples/apps/multi/README.md +23 -0
  514. package/examples/apps/multi/app.tsx +83 -0
  515. package/examples/apps/multi/main.tsx +8 -0
  516. package/examples/apps/multi/server.ts +33 -0
  517. package/examples/apps/todo/README.md +23 -0
  518. package/examples/apps/todo/api.ts +26 -0
  519. package/examples/apps/todo/app.tsx +128 -0
  520. package/examples/apps/todo/main.tsx +9 -0
  521. package/examples/apps/todo/server.ts +39 -0
  522. package/examples/hello-world/README.md +9 -0
  523. package/examples/hello-world/client.ts +14 -0
  524. package/examples/hello-world/routes.tsx +26 -0
  525. package/examples/hello-world/server.ts +46 -0
  526. package/examples/patterns/AppShell.tsx +224 -0
  527. package/examples/patterns/Dashboard.tsx +153 -0
  528. package/examples/patterns/DataScreen.tsx +104 -0
  529. package/examples/patterns/DetailPage.tsx +79 -0
  530. package/examples/patterns/Docs.tsx +105 -0
  531. package/examples/patterns/FocusTask.tsx +67 -0
  532. package/examples/patterns/Landing.tsx +90 -0
  533. package/examples/patterns/ListPage.tsx +77 -0
  534. package/examples/patterns/Mobile.tsx +154 -0
  535. package/examples/patterns/SettingsPage.tsx +98 -0
  536. package/examples/patterns/SplitWorkspace.tsx +113 -0
  537. package/package.json +61 -29
  538. package/dist/components/Editor/Editor.d.ts +0 -13
  539. package/dist/components/Editor/tools/format.d.ts +0 -11
  540. package/dist/components/Editor/tools/table.d.ts +0 -7
  541. package/dist/components/Editor/tools/types.d.ts +0 -15
  542. package/dist/components/Slider/Slider.d.ts +0 -19
  543. package/dist/components/Tabs/Tabs.d.ts +0 -12
  544. package/dist/components/index.js +0 -15
  545. package/dist/ui-dom/Confirm.d.ts +0 -8
  546. package/dist/ui-dom/Notification.d.ts +0 -8
  547. package/dist/ui-dom/Toast.d.ts +0 -8
  548. package/dist/ui-dom/ai.d.ts +0 -59
  549. package/dist/ui-dom/browser.d.ts +0 -10
  550. package/dist/ui-dom/debug.d.ts +0 -21
  551. package/dist/ui-dom/hooks/chat.d.ts +0 -11
  552. package/dist/ui-dom/hooks/events.d.ts +0 -30
  553. package/dist/ui-dom/hooks/external.d.ts +0 -20
  554. package/dist/ui-dom/hooks/index.d.ts +0 -29
  555. package/dist/ui-dom/hooks/input.d.ts +0 -33
  556. package/dist/ui-dom/hooks/media.d.ts +0 -17
  557. package/dist/ui-dom/hooks/popup.d.ts +0 -30
  558. package/dist/ui-dom/hooks/stable.d.ts +0 -35
  559. package/dist/ui-dom/hooks/types.d.ts +0 -77
  560. package/dist/ui-dom/i18n.d.ts +0 -31
  561. package/dist/ui-dom/index.d.ts +0 -47
  562. package/dist/ui-dom/index.js +0 -41
  563. package/dist/ui-dom/jsx-runtime.d.ts +0 -4
  564. package/dist/ui-dom/jsx-runtime.js +0 -1
  565. package/dist/ui-dom/locale/en_US.d.ts +0 -55
  566. package/dist/ui-dom/locale/zh_CN.d.ts +0 -55
  567. package/dist/ui-dom/middleware/api.d.ts +0 -91
  568. package/dist/ui-dom/middleware/auth.d.ts +0 -30
  569. package/dist/ui-dom/middleware/ws.d.ts +0 -33
  570. package/dist/ui-dom/motion.d.ts +0 -8
  571. package/dist/ui-dom/popup-tracker.d.ts +0 -36
  572. package/dist/ui-dom/popup.d.ts +0 -42
  573. package/dist/ui-dom/store.d.ts +0 -24
  574. package/dist/ui-dom/testing.d.ts +0 -68
  575. package/dist/ui-dom/testing.js +0 -7
  576. package/dist/ui-dom/types.d.ts +0 -632
  577. package/dist/ui-dom/use-chat.d.ts +0 -95
  578. package/dist/ui-dom/vdom3/README.d.ts +0 -32
  579. package/dist/ui-dom/vdom3/app.d.ts +0 -20
  580. package/dist/ui-dom/vdom3/audit.d.ts +0 -29
  581. package/dist/ui-dom/vdom3/build.d.ts +0 -20
  582. package/dist/ui-dom/vdom3/commands.d.ts +0 -21
  583. package/dist/ui-dom/vdom3/comp-index.d.ts +0 -18
  584. package/dist/ui-dom/vdom3/delegate.d.ts +0 -48
  585. package/dist/ui-dom/vdom3/events.d.ts +0 -17
  586. package/dist/ui-dom/vdom3/index.d.ts +0 -42
  587. package/dist/ui-dom/vdom3/jsx.d.ts +0 -32
  588. package/dist/ui-dom/vdom3/record.d.ts +0 -16
  589. package/dist/ui-dom/vdom3/registry.d.ts +0 -30
  590. package/dist/ui-dom/vdom3/render.d.ts +0 -39
  591. package/dist/ui-dom/vdom3/replay.d.ts +0 -28
  592. package/dist/ui-dom/vdom3/root.d.ts +0 -24
  593. package/dist/ui-dom/vdom3/router.d.ts +0 -31
  594. package/dist/ui-dom/vdom3/scheduler.d.ts +0 -23
  595. package/dist/ui-dom/vdom3/ssr.d.ts +0 -27
  596. package/dist/ui-dom/vdom3/sync.d.ts +0 -22
  597. package/dist/ui-dom/vdom3/types.d.ts +0 -173
  598. package/dist/ui-dom/vdom3/ui.d.ts +0 -16
  599. package/dist/ui-dom/vdom3.js +0 -41
  600. package/dist/ui-dom/vnode.d.ts +0 -13
  601. /package/dist/{make-executable-schema.test.d.ts → cli/content-sync.test.d.ts} +0 -0
  602. /package/dist/{ui-dom/testing.test.d.ts → cli/docs-cli.test.d.ts} +0 -0
  603. /package/dist/{components → client/components}/CodeBlock/highlight.d.ts +0 -0
  604. /package/dist/{components → client/components}/DatePicker/calendar-utils.d.ts +0 -0
  605. /package/dist/{components → client/components}/DiffView/diff-utils.d.ts +0 -0
  606. /package/dist/{components → client/components}/Markdown/parser.d.ts +0 -0
  607. /package/dist/{components → client/components}/Pipeline/dag-utils.d.ts +0 -0
  608. /package/dist/{components → client/components}/QRCode/qr.d.ts +0 -0
  609. /package/dist/{components → client/components}/Sparkline/sparkline-utils.d.ts +0 -0
  610. /package/dist/{ai → server/ai}/agent.d.ts +0 -0
  611. /package/dist/{ai → server/ai}/client.d.ts +0 -0
  612. /package/dist/{ai → server/ai}/sse.d.ts +0 -0
  613. /package/dist/{core → server/core}/serve.d.ts +0 -0
  614. /package/dist/{core → server/core}/ws.d.ts +0 -0
  615. /package/dist/{db → server/db}/errors.d.ts +0 -0
  616. /package/dist/{db → server/db}/memory-redis.d.ts +0 -0
  617. /package/dist/{db → server/db}/memory-sql.d.ts +0 -0
  618. /package/dist/{db → server/db}/postgres/connection.d.ts +0 -0
  619. /package/dist/{db → server/db}/postgres/pool.d.ts +0 -0
  620. /package/dist/{db → server/db}/postgres/protocol.d.ts +0 -0
  621. /package/dist/{db → server/db}/postgres/schema.d.ts +0 -0
  622. /package/dist/{db → server/db}/query-builder.d.ts +0 -0
  623. /package/dist/{db → server/db}/query.d.ts +0 -0
  624. /package/dist/{db → server/db}/redis/client.d.ts +0 -0
  625. /package/dist/{db → server/db}/redis/commands.d.ts +0 -0
  626. /package/dist/{db → server/db}/redis/connection.d.ts +0 -0
  627. /package/dist/{db → server/db}/redis/pipeline.d.ts +0 -0
  628. /package/dist/{db → server/db}/redis/pool.d.ts +0 -0
  629. /package/dist/{db → server/db}/redis/resp.d.ts +0 -0
  630. /package/dist/{db → server/db}/redis/subscriber.d.ts +0 -0
  631. /package/dist/{db → server/db}/sql-parser.d.ts +0 -0
  632. /package/dist/{email → server/email}/index.d.ts +0 -0
  633. /package/dist/{email → server/email}/smtp.d.ts +0 -0
  634. /package/dist/{graphql.d.ts → server/graphql.d.ts} +0 -0
  635. /package/dist/{index.d.ts → server/index.d.ts} +0 -0
  636. /package/dist/{make-executable-schema.d.ts → server/make-executable-schema.d.ts} +0 -0
  637. /package/dist/{messager → server/messager}/index.d.ts +0 -0
  638. /package/dist/{middleware → server/middleware}/cors.d.ts +0 -0
  639. /package/dist/{middleware → server/middleware}/rate-limit.d.ts +0 -0
  640. /package/dist/{middleware → server/middleware}/static.d.ts +0 -0
  641. /package/dist/{postgres → server/postgres}/client.d.ts +0 -0
  642. /package/dist/{postgres → server/postgres}/index.d.ts +0 -0
  643. /package/dist/{postgres → server/postgres}/types.d.ts +0 -0
  644. /package/dist/{queue → server/queue}/index.d.ts +0 -0
  645. /package/dist/{redis → server/redis}/client.d.ts +0 -0
  646. /package/dist/{redis → server/redis}/index.d.ts +0 -0
  647. /package/dist/{redis → server/redis}/types.d.ts +0 -0
  648. /package/dist/{request.d.ts → server/request.d.ts} +0 -0
  649. /package/dist/{response.d.ts → server/response.d.ts} +0 -0
  650. /package/dist/{scheduler → server/scheduler}/cron.d.ts +0 -0
  651. /package/dist/{scheduler → server/scheduler}/index.d.ts +0 -0
  652. /package/dist/{types.d.ts → server/types.d.ts} +0 -0
  653. /package/dist/{ui → server/ui}/html-safe.d.ts +0 -0
  654. /package/dist/{user → server/user}/index.d.ts +0 -0
  655. /package/dist/{user → server/user}/password.d.ts +0 -0
@@ -1,3 +1,8 @@
1
+ # 前端总览与 API 速查
2
+
3
+ > 从 docs/frontend.md 迁移(content/ 文档库——随 npm 包发布,与框架版本同步)。
4
+ > 本页为叙述性指南——组件/能力逐项参考见 content/ 各域目录。
5
+
1
6
  # 前端 API 核心(weifuwu/ui-dom)
2
7
 
3
8
  > ⚠️ **引擎演进(2026-08)**:下一代引擎 **vdom3**(vnode + stream——渲染执行 = 事件流,
@@ -5,12 +10,10 @@
5
10
  > createRoot + 事件流)。vdom2(本文档)为当前生产引擎(冻结中——bug 修复在 vdom3)。
6
11
  > 迁移路线图见仓库 `design/vdom3-migration-plan.md`。
7
12
 
8
- > ⚠️ **`weifuwu/client` 已并入 `weifuwu/ui-dom`**(`src/client/` 已删除)——本页 import 均用 `weifuwu/ui-dom`。前端运行时唯一入口是 **`weifuwu/ui-dom`**(vdom3 精准事件流引擎:createRouter + createRoot——渲染全链路 `entity:action` 事件流),权威参考见 **[docs/frontend-ui-dom.md](frontend-ui-dom.md)**。
13
+ > ⚠️ **`weifuwu/client` 已并入 `weifuwu/ui-dom`**(`src/client/` 已删除)——本页 import 均用 `weifuwu/ui-dom`。前端运行时唯一入口是 **`weifuwu/ui-dom`**(vdom3 精准事件流引擎:createRouter + createRoot——渲染全链路 `entity:action` 事件流),权威参考见 **[ui-dom 指南](ui-dom-guide.md)**。
9
14
 
10
15
  > 以下为完整 API 参考,按需查阅。新手建议先阅读 README 的「核心概念」和「快速开始」。
11
16
 
12
- > 本页为 weifuwu 官方文档拆分页 · [返回 README](../README.md)
13
-
14
17
  零外部 npm 运行时依赖。组件签名:`async (initProps, ctx) => (props) => Promise<VNode>`(两阶段模型,外层 mount 只一次可 await 数据,内层 renderFn 每次变化时执行——强制异步)。同步组件已不支持;无状态组件可简写为 `async (_init) => (props) => VNode`。
15
18
 
16
19
  构建配置(esbuild):
@@ -35,6 +38,7 @@ let ctx: any = {}
35
38
  ctx = await api({ baseURL: '' })(ctx)
36
39
  ctx = await auth({ ... })(ctx)
37
40
  ctx = v3Toast()(ctx)
41
+ ctx = v3Notification()(ctx)
38
42
 
39
43
  // 路由(RouteDef[])+ 落地(事件流渲染)
40
44
  const handle = createRouter(
@@ -101,6 +105,7 @@ const Home: Component<{}, ApiInjected & RouteInjected> = async (_init, ctx) => {
101
105
  let ctx: any = {}
102
106
  ctx = api()(ctx) // 注入 ctx.api
103
107
  ctx = v3Toast()(ctx) // 注入 ctx.toast
108
+ ctx = v3Notification()(ctx) // 注入 ctx.notification
104
109
  createRouter(routes, root, { ctx })
105
110
  ```
106
111
 
@@ -133,20 +138,80 @@ h('div', { class: 'x' }, child1, child2)
133
138
  |------|------|
134
139
  | `h(type, props, ...children)` | hyperscript |
135
140
  | `jsx` / `jsxs` / `jsxDEV` | JSX 编译目标 |
136
- | `Fragment` | 片段 |
137
- | `Portal` / `createPortal(children, portalKey?)` | 渲染到 `document.body#__wf_portal` 独立容器(弹层/对话框,脱离父级 overflow 裁剪) |
141
+ | `ctx.ui.openPopup(opts)` | 命令式弹窗唯一入口(toast 心智——调用点构建内容——内核自管理挂载/更新/卸载/销毁——返回 `{ close, update, open }`) |
142
+
143
+ > **Fragment 内化(2026-12)**:不需要 import Fragment——**数组 = 隐式 Fragment**
144
+ > (任意嵌套递归展开——扁平化为同一 children 序列);`<></>` 也可(JSX 编译器
145
+ > 自动从运行时导入)。统一写法:多节点用数组,不需要任何结构符号。
146
+ > Fragment 符号保留仅用于 keyed 文本/多根列表项(`h(Fragment, { key }, ...)`)。
147
+
148
+ ### 条件渲染统一标准(值域协议)
149
+
150
+ **children 值域**(引擎契约——写组件只需要记这张表):
151
+
152
+ | 值 | 渲染 | 说明 |
153
+ |----|------|------|
154
+ | vnode / 数组(任意嵌套) | 元素 / 隐式 Fragment | 正常 |
155
+ | string / number | 文本(含 `0`/`NaN`——显示为 "0"/"NaN") | 合法——**但条件表达式避免产生** |
156
+ | `false` / `null` / `undefined` / `true` | 空洞占位(不渲染——兄弟不错位) | 条件渲染的自然产物 |
157
+ | 对象 / 函数 / Symbol | 诊断占位 + `console.warn` | 非法输入(开发期暴露) |
158
+
159
+ **写法标准**(按优先级):
138
160
 
139
161
  ```tsx
140
- import { createPortal } from 'weifuwu/ui-dom'
162
+ // ① 首选:显式三元(双分支零歧义)
163
+ cond ? <X/> : null
164
+ cond ? <A/> : <B/>
141
165
 
142
- // 内容渲染到 body 下的独立容器(不在父组件的 DOM 树内)
143
- const Tooltip = (_init, ctx) =>
144
- (props) => createPortal(
145
- <div class="tooltip">{props.text}</div>
146
- )
166
+ // ② 条件渲染(cond 必须是 boolean/确定真值——禁止 0/''/NaN 语义)
167
+ cond && <X/>
168
+ cond && [<A/>, <B/>] // 多节点条件(数组 = 隐式 Fragment)
169
+ [<A/>, cond && <B/>] // 嵌套在数组内——自然工作
170
+
171
+ // ③ 多节点分支
172
+ cond ? [<A/>, <B/>] : null
173
+ ```
174
+
175
+ **红线**(会写出 bug 的写法):
147
176
 
148
- // 配合 ctx.ui.selfId('name') 可从任何地方精准刷新 portal 内容
149
- ctx.ui.render(['name'])
177
+ ```tsx
178
+ x || <Fallback/> // ❌ x 为 0/''/NaN 时返回 x 本身——渲染 "0"/空文本
179
+ // 用:x != null ? <Fallback/> : null
180
+ 0 && <X/> // ❌ 渲染 "0"(JS 真值陷阱——cond 应保证 boolean)
181
+ { a: 1 } // ❌ 对象直接作 children(warn + 占位)
182
+ [cond && <A/>, <B/>].filter(Boolean) // ❌ filter 消除空洞 → 数组长度变化 →
183
+ // 无 key 有状态组件位置漂移(状态重置——
184
+ // A 级检测 dev error)。占位法已处理空洞:
185
+ // 直接写 [cond && <A/>, <B/>](false 占位——
186
+ // 长度恒定——B 位置稳定)
187
+ ```
188
+
189
+ **为什么不会错**:条件表达式产出的值域是受限的(vnode/数组/文本/空洞)——引擎对
190
+ 空洞做占位(同构——兄弟不错位——提交按钮事故免疫);对非法输入 warn(不静默)。
191
+ 开发者只需遵守三条:三元优先、`&&` 的左侧保证 boolean、不写 `||` 条件渲染。
192
+
193
+ > **命令式弹窗(2027-03 定稿)**:所有浮层一律 `ctx.ui.openPopup`(toast 心智——
194
+ > 调用点构建内容——内核自管理生命周期)——定位/外部点击关闭/Escape/视口夹紧/
195
+ > presence 退场/mask 全内置——组件输出纯业务(无槽无游离调用)。
196
+
197
+ ```tsx
198
+ // 浮层正确姿势:openPopup(唯一入口——锚点定位 + 外部点击关闭 + Escape + 视口夹紧)
199
+ const Tooltip = (_init, ctx) => {
200
+ let anchor: HTMLElement | null = null
201
+ let handle: import('weifuwu/client').PopupHandle | null = null
202
+ return (props) => {
203
+ // 句柄同步样板(受控 + 内容更新 + 关闭清理——每次渲染恒调用)
204
+ if (props.open && !handle)
205
+ handle = ctx.ui.openPopup({
206
+ anchor: () => anchor, // 锚点必传(触发按钮也是锚点的一部分)
207
+ content: () => h('div', { class: 'tooltip' }, props.text),
208
+ onClose: () => { handle = null; props.onOpenChange?.(false) },
209
+ })
210
+ else if (!props.open && handle) { handle.close(); handle = null }
211
+ else if (handle) handle.update(h('div', { class: 'tooltip' }, props.text))
212
+ return h('span', { ref: (el) => { anchor = el } }, props.children)
213
+ }
214
+ }
150
215
  ```
151
216
 
152
217
  ---
@@ -194,18 +259,18 @@ await browser.copyText(text)
194
259
  | `useAsync()` | `useAsync(fetcher)` | 异步取数:`data/loading/error` 响应式 + `reload()` |
195
260
  | `useControlled()` | `useControlled({ value, onChange, name })` | 受控/非受控统一:受控判定 + 缺回调 warn + 内部状态跨渲染保持 |
196
261
  | `useStableRef()` | `useStableRef(init, cleanup?)` | 稳定 ref 引用(根治内联 ref 陷阱) |
197
- | `usePopup()` 会话级模态 | `usePopup({ presence, trapFocus, lockScroll, positioning })` | **统一弹窗能力**:锚定浮层 + 会话级模态(Modal/Drawer 同款——退场状态机 + 滚动锁 + 焦点 trap + 居中定位)——一个入口按 options 组合 |
262
+ | `openPopup(opts)` | `openPopup({ content, anchor?, placement?, mask?, presence?, trapFocus?, lockScroll?, closeOnOutside?, closeOnEscape?, position?, key? })` | **命令式弹窗唯一入口**(toast 心智)——返回 `{ close, update, open }`——锚定浮层 + 会话级模态(退场状态机 + 滚动锁 + 焦点 trap + 居中定位)——一个入口按 options 组合 |
198
263
  | `useGlobalKey()` | `useGlobalKey(handler)` | 全局键盘监听(window keydown:mount 注册 + 卸载清理) |
199
264
  | `useDrag()` | `useDrag({ onMove, onStart?, onEnd? })` | 指针拖拽(pointerdown 捕获 → window move delta / up 释放) |
200
265
  | `useDragDrop()` | `useDragDrop({ onDrop, onDragOver?, onDragLeave? })` | 原生 DnD(drop/dragover/dragleave + preventDefault,dropProps spread) |
201
266
  | `useReducedMotion()` | `useReducedMotion()` | 响应式系统偏好(JS 动画侧跳过;CSS 动画已有全局降级) |
202
267
  | `useAnimationEnd()` | `useAnimationEnd(cb, { once? })` | 元素动画完成回调(stableRef:挂载绑定/卸载清理/引用恒定) |
203
268
  | `useTween()` | `useTween(target, { duration?, ease? })` | 数值补间(rAF + easeOutCubic + reduced-motion 直落;幂等 reset) |
204
- | `usePresence()` | `usePresence({ name? })` | 通用显隐状态机(open→exit→closed,animationend 延迟卸载;usePopup presence 模式内部使用) |
269
+ | `usePresence()` | `usePresence({ name? })` | 通用显隐状态机(open→exit→closed,animationend 延迟卸载;openPopup presence 模式内部使用) |
205
270
  | `useMedia()` | `useMedia(query, cb)` | 响应式媒体查询,断点变化时自动回调 |
206
271
  | `useBreakpoint()` | `useBreakpoint(cb \| bps, cb?)` | 命名断点 mobile/tablet/desktop |
207
272
  | `usePopupPosition()` | `usePopupPosition(opts)` | 弹层坐标跟随:scroll/resize 时自动重算 fixed 坐标 |
208
- | `usePopup()` | `usePopup(opts)` | **统一弹窗能力层**:触发(hover/tap 降级/longpress)+ Escape + 外部点击 + 定位/clamp + portal + 会话级模态(presence/trapFocus/lockScroll/positioning none——Modal/Drawer 同款) |
273
+ | `openPopup()` | `openPopup(opts)` | **统一弹窗能力层**(命令式):Escape + 外部点击 + 定位/clamp + mask + 会话级模态(presence/trapFocus/lockScroll/positioning none——Modal/Drawer 同款)——触发由组件自管(hover/click/longpress 事件绑定在调用侧) |
209
274
  | `useHoverCapable()` | `useHoverCapable()` | 设备是否支持 hover(`matchMedia '(hover: hover)'`),触屏降级判断 |
210
275
  | `useLongPress()` | `useLongPress({ onLongPress, duration })` | 长按手势(pointer 事件 + 位移取消 + 桌面右键兼容) |
211
276
  | `useVisualViewport()` | `useVisualViewport()` | 可视视口跟踪(键盘弹起/缩放),`{ height, offsetTop, keyboardOpen }` 响应式 |
@@ -224,7 +289,7 @@ await browser.copyText(text)
224
289
  | `ctx.ui.useMedia()` | 注册监听 | 浏览器事件驱动 | 当前组件 | **响应式媒体查询** — 断点变化时自动重渲染 |
225
290
  | `ctx.ui.useBreakpoint()` | 注册监听 | 浏览器事件驱动 | 当前组件 | **命名断点** — mobile/tablet/desktop 自动重渲染 |
226
291
  | `ctx.ui.usePopupPosition()` | 注册监听 | 浏览器事件驱动 | 当前组件 | **弹层坐标跟随** — scroll/resize 时自动重算 fixed 坐标 |
227
- | `ctx.ui.usePopup()` | 注册监听 | 事件驱动 + document 监听 | 当前组件 | **弹层组合器** — 触发 + Escape + 外部点击 + 定位/clamp + portal(移动端友好由构造保证) |
292
+ | `ctx.ui.openPopup(opts)` | 命令式(任意位置) | 内核自管理生命周期 | 调用点 | **命令式弹窗唯一入口**(toast 心智)— 定位/clamp + Escape + 外部点击 + mask + presence/trapFocus/lockScroll — 返回 `{ close, update, open }` |
228
293
  | `ctx.ui.useHoverCapable()` | mount 期判定 | 一次 matchMedia | 当前组件 | **hover 能力检测** — 触屏降级 tap 判断 |
229
294
  | `ctx.ui.useLongPress()` | 事件驱动 | pointer 事件 | 当前组件 | **长按手势** — ContextMenu 触屏触发、自定义长按操作 |
230
295
  | `ctx.ui.useVisualViewport()` | 注册监听 | visualViewport resize/scroll | 当前组件 | **键盘/缩放跟踪** — fixed 底部栏防键盘遮挡(AiChat `raiseOnKeyboard`) |
@@ -363,51 +428,55 @@ const CustomPopup = async (_init, ctx) => {
363
428
 
364
429
  已内置接入的组件:**Popover / Tooltip / Dropdown / DatePicker / Chart**(tooltip)——它们的弹出层在页面滚动、嵌套容器滚动、窗口缩放时都会自动跟随触发元素,无需额外配置。
365
430
 
366
- #### `ctx.ui.usePopup(options)` — 弹层组合器(推荐:移动端友好由构造保证)
431
+ #### `ctx.ui.openPopup(options)` — 命令式弹窗(唯一入口——toast 心智)
367
432
 
368
- `usePopupPosition` 的**上层封装**:把弹层组件的完整生命周期(打开状态 + 触发 + Escape + 外部点击 + 定位/视口 clamp + portal)收敛成一个原语。弹层组件用它替代手写样板,**移动端行为自动正确**:
433
+ **命令式内核**:调用点构建内容 → 内核自管理挂载/更新/卸载/销毁——**组件输出纯业务**
434
+ (无槽无游离调用)。`usePopup`/`portal()`/`createPortal` 已删除(2027-03)。
369
435
 
370
- - **hover 触发在触屏自动降级为 tap**(内部 `matchMedia '(hover: hover)'` 判定)
371
- - **Escape 关闭是 document 级**——焦点在 portal 弹层内按 Escape 也能关
372
- - **外部点击关闭**(document mousedown,点弹层内部不关)
373
- - **宽度自动 clamp 视口**(≤ `100vw - 32px`,375px 屏不横向溢出);`width` 支持 getter(DatePicker 跟随 trigger 宽)
374
- - **定位 + 视口夹紧**(复用 `usePopupPosition`,超高/超宽面板平移回视口)
375
- - **mask 遮罩**(`mask: true`——全屏遮罩 + 点击关闭;`maskCentered` 全屏居中——Modal 缩放预览/Command 面板;`mask: VNode` 自定义遮罩内容——Tour 挖洞高亮)
376
- - **trigger `'focus'`**(DatePicker)——focus 开 + blur 延迟关(`closeDelay` 窗口内面板交互生效)
377
- - 支持受控(`open`/`onOpenChange`)、动态 props(`placement`/`trigger`/`openDelay` 支持 getter)
436
+ **能力**:
437
+ - **定位 + 视口夹紧**(锚定浮层:anchor + placement/center/gap/margin——超高/超宽面板平移回视口;`position` 自定义坐标(光标处/跟随 trigger 宽))
438
+ - **Escape 关闭是 document 级**(`closeOnEscape` 显式 false 禁用——危险操作组件自控)
439
+ - **外部点击关闭**(document mousedown,点锚点/面板内不关——`closeOnOutside: false` 禁用)
440
+ - **mask 遮罩**(`mask: true`——全屏遮罩 + 点击关闭(maskClosable);`maskCentered` 全屏居中——Img 预览/Command 面板)
441
+ - **会话级模态**:`presence`(退场状态机 open→exit→closed + animationend)+ `trapFocus`(焦点 trap)+ `lockScroll`(滚动锁 + 焦点归还)+ `positioning: 'none'`(自定义定位——.wf-modal inset:0 居中)
442
+ - **handle**:`close()`(presence 播退场动画)/ `update(content)`(props 变化 diff 增量)/ `open`(getter)
378
443
 
379
444
  ```tsx
380
445
  const Tooltip = async (_init, ctx) => {
381
446
  let show = false
382
447
  let wrapEl: HTMLElement | null = null
383
448
  const wrapRef = (el) => { wrapEl = el }
449
+ let handle: PopupHandle | null = null
384
450
 
385
- const popup = ctx.ui.usePopup({
386
- trigger: 'hover', // 触屏自动降级 tap
387
- placement: () => latestPos, // getter:动态读最新 props
388
- el: () => wrapEl,
389
- isOpen: () => show,
390
- setOpen: (v) => { show = v; ctx.ui.render() },
391
- width: 320, // 自动 clamp 视口
392
- disabled: () => disabled,
393
- openDelay: () => delay, // hover 延迟(HoverCard 用)
394
- })
395
-
396
- return async (props) => h('div', { ref: wrapRef, ...popup.wrapProps }, [
397
- props.children,
398
- popup.portal(h('div', { class: 'wf-tooltip' }, props.content), 'tooltip'),
399
- ].filter(Boolean))
451
+ return async (props) => {
452
+ // 句柄同步样板(受控 + 内容更新 + 关闭清理——每次渲染恒调用)
453
+ if (show && !handle)
454
+ handle = ctx.ui.openPopup({
455
+ anchor: () => wrapEl, // **anchor 必传**(触发区也是锚点——否则被当外部点击关闭)
456
+ placement: () => latestPos, // getter:动态读最新 props
457
+ content: () => h('div', { class: 'wf-tooltip' }, props.content),
458
+ onClose: () => { handle = null; show = false; ctx.ui.render() },
459
+ })
460
+ else if (!show && handle) { handle.close(); handle = null }
461
+ else if (handle) handle.update(h('div', { class: 'wf-tooltip' }, props.content))
462
+
463
+ return h('div', {
464
+ ref: wrapRef,
465
+ onMouseEnter: () => { show = true; ctx.ui.render() },
466
+ onMouseLeave: () => { show = false; ctx.ui.render() },
467
+ }, props.children)
468
+ }
400
469
  }
401
470
  ```
402
471
 
403
- - `popup.wrapProps` — 触发 + Escape + focus 处理,spread 到包装/触发元素
404
- - `popup.portal(content, portalKey)` — 定位 + clamp + portal(挂载 `#__wf_portal`),关闭时返回 null;自动附加 `wf-popup` 基类;`positioning: 'none'` 时不加坐标(只 `position: fixed`——组件自定义定位,Modal/Toast 用)
405
- - `popup.open` / `popup.setOpen()` — 状态读取与设置
406
- - `popup.sync(open)` / `popup.phase` — 会话级模态模式(`presence: true`)render 期同步打开状态 + 读退场 phase(`'closed' | 'open' | 'exit'`——exit 阶段保留退场动画)
472
+ - **handle.close()** — 关闭(presence:先由组件 update exit class → 内核播退场动画 → animationend → dispose)
473
+ - **handle.update(content)** — 内容更新(props 变化——diff 增量——不重建)
474
+ - **handle.open** — 状态读取(渲染期最新)
475
+ - **onClose 回调** — 外部点击/Escape/内核 dispose 后触发——组件同步句柄 + 状态(无需显式清空)
407
476
 
408
- **会话级模态模式**(Modal/Drawer/Confirm 同款):`presence: true`(退场状态机)+ `trapFocus: true`(焦点 trap)+ `lockScroll: true`(滚动锁)+ `positioning: 'none'`(自定义定位)——全部能力 usePopup 内部实现(`trapFocus`/`lockScroll` 不对外导出)。
477
+ **会话级模态模式**(Modal/Drawer/Confirm 同款):`presence: true`(退场状态机)+ `trapFocus: true`(焦点 trap)+ `lockScroll: true`(滚动锁)+ `positioning: 'none'`(自定义定位)——全部能力 openPopup 内核实现(`trapFocus`/`lockScroll` 不对外导出)。
409
478
 
410
- **已迁移组件(全部弹窗统一 usePopup 单一入口)**:Tooltip / HoverCard / Popover / Dropdown / Menubar / Mentions / Cascader / ContextMenu / Select / AutoComplete / NavMenu / Popconfirm / DatePicker(focus 触发)/ Tour(mask 自定义遮罩)/ Toast / Notification(positioning 'none' 常驻容器)/ Modal / Drawer / Confirm / Command / Img(mask 全屏遮罩)/ TreeSelect。
479
+ **已迁移组件(全部弹窗统一 openPopup 单一入口)**:Tooltip / HoverCard / Popover / Dropdown / Menubar / Mentions / Cascader / ContextMenu / Select / AutoComplete / NavMenu / Popconfirm / DatePicker(position 跟随 trigger 宽)/ Tour(mask + 自定位)/ Toast / Notification(positioning 'none' 常驻容器)/ Modal / Drawer / Confirm / Command / Img(mask 全屏遮罩)/ TreeSelect / Editor(link/image/ai/history)/ SheetGrid / SlideCanvas(AI 面板)/ Chart(tooltip)。
411
480
 
412
481
  **usePopupPosition 独立用户**:Affix / Chart(tooltip)——坐标工具(非弹窗组合器),滚动跟随自动。
413
482
 
@@ -458,7 +527,7 @@ ctx.ui.render(['stats'])
458
527
 
459
528
  #### `ctx.ui.useChat(options)` — AI 对话会话(AiChat 配套)
460
529
 
461
- 会话语义的流式 AI 状态容器:消息累积 / 工具调用内嵌 / HITL 审批 / stop / retry,协议对页面完全透明(wf: 协议见 `docs/ai-contract.md`)。返回 handle 带 `subscribe(cb)`——子组件用 `ctx.ui.useExternal(chat)` 订阅会话变化(render-only 共享状态原语):
530
+ 会话语义的流式 AI 状态容器:消息累积 / 工具调用内嵌 / HITL 审批 / stop / retry,协议对页面完全透明(wf: 协议见 [`ai-contract`](../../docs/ai-contract.md))。返回 handle 带 `subscribe(cb)`——子组件用 `ctx.ui.useExternal(chat)` 订阅会话变化(render-only 共享状态原语):
462
531
 
463
532
  ```tsx
464
533
  // mount 阶段(服务端 `ai()` 中间件 + `AiChat` 组件配套)
@@ -514,7 +583,7 @@ return () => list.loading ? h(Loading) : list.data?.map(u => h('div', {}, u.name
514
583
  | 原语 | 层 | 说明 |
515
584
  |------|----|------|
516
585
  | `useAnimationEnd(cb, { once? })` | 生命周期 | 元素动画完成回调(stableRef:挂载绑定/卸载清理/引用恒定)——**组件内动画事件唯一入口** |
517
- | `usePresence({ name? })` | 生命周期 | 显隐状态机:open → exit → closed(animationend 延迟卸载);`usePopup` presence 模式内部使用 |
586
+ | `usePresence({ name? })` | 生命周期 | 显隐状态机:open → exit → closed(animationend 延迟卸载);openPopup presence 模式内部使用 |
518
587
  | `useTween(target, { duration?, ease? })` | 数值驱动 | 数值补间(rAF + easeOutCubic + reduced-motion 直落;幂等 reset + 每帧自动渲染) |
519
588
  | `useReducedMotion()` | 偏好感知 | 响应式系统偏好——**JS 动画**(rAF/tween)侧跳过(CSS 动画已有全局降级) |
520
589
  | `useInView` / `useScrollPosition` | 数值驱动 | 进入视口播 / 滚动位置联动(已有) |
@@ -538,7 +607,7 @@ return () => h('span', { class: 'wf-nums' }, String(n.value))
538
607
  if (!ctx.ui.useReducedMotion()) { /* 启动 rAF/动画 */ }
539
608
  ```
540
609
 
541
- > 完整动画纪律见 [custom-components.md](custom-components.md) 的「8.5 动画」章节。
610
+ > 完整动画纪律见 [custom-component.md](custom-component.md) 的「8.5 动画」章节。
542
611
 
543
612
  #### CSS 层响应式(不碰 JS)
544
613
 
@@ -571,7 +640,7 @@ if (!ctx.ui.useReducedMotion()) { /* 启动 rAF/动画 */ }
571
640
  | `wf-safe-bottom` / `wf-safe-top` | iOS 安全区:`padding: env(safe-area-inset-bottom/top)`(刘海屏/Home 条) |
572
641
  | `@media (pointer: coarse)` 44px | 触屏命中区:button/input/select 全局覆盖;非 button 交互元素由 style-audit 规则强制登记 |
573
642
 
574
- > **移动端开发指南**:断点体系 / 44px 命中区纪律 / usePopup / 手势原语 / safe-area / 验收清单 → [`docs/mobile.md`](mobile.md)
643
+ > **移动端开发指南**:断点体系 / 44px 命中区纪律 / openPopup / 手势原语 / safe-area / 验收清单 → [`移动端指南`](mobile-guide.md)
575
644
 
576
645
  ### `ctx.ui.render()` — 渲染唯一入口(render-only)
577
646
 
@@ -891,6 +960,7 @@ import type { RouterOptions } from 'weifuwu/ui-dom'
891
960
  | `ConfirmProps` | `{ open?, title?, message?, confirmText?, cancelText?, variant?, width?, onConfirm?, onCancel? }` |
892
961
  | `ConfirmOptions` | `{ title?, confirmText?, cancelText?, variant?, width? }` — 命令式 ctx.confirm 选项 |
893
962
  | `ToastOptions` | `{ position?, duration?, max? }` — 命令式 ctx.toast 配置 |
963
+ | `NotificationOptions` | `{ position?, duration?, max? }` — 命令式 ctx.notification 配置 |
894
964
  | `PopupPositionOptions` | `{ el, isOpen, compute }` — 弹层位置跟踪配置(见 usePopupPosition) |
895
965
  | `PopupPosition` | `{ top, left, width?, refresh }` — 弹层位置跟踪器 |
896
966
 
@@ -0,0 +1,64 @@
1
+ # 布局选型指南(什么时候用哪个原语)
2
+
3
+ > 解决"会用原语但不会选"——布局决策树:骨架/分区/间距/定位/响应式。
4
+ > 与 [页面组装](page-building.md) 配合:本页决定"用什么",组装决定"怎么搭"。
5
+
6
+ ## 1. 能力光谱(选型总原则)
7
+
8
+ ```
9
+ 从组合层往下找——Table 能解决不自己拼:
10
+ 组合层 Table / Form / Descriptions / StatCard (开箱即用——优先)
11
+ 命名层 Grid / Space / Typography / Card (有 API 有语义)
12
+ 裸原语 wf-grid / wf-gap-* / wf-text-* (自由但无约定——兜底)
13
+ ```
14
+
15
+ ## 2. 决策树
16
+
17
+ ```
18
+ 页面骨架?
19
+ ├─ 有侧栏+顶栏 → wf-app-shell(patterns/app-shell 蓝本)或 Layout 组件
20
+ ├─ 独立定宽页 → wf-container(--wf-max 控制宽度)
21
+ └─ 全屏/无壳 → 直接 wf-stack / wf-fill
22
+
23
+ 内容分区?
24
+ ├─ 纵向堆叠 → wf-stack(页面默认)
25
+ ├─ 横向排列 → wf-row(按钮组/表单行)
26
+ ├─ 响应式网格 → wf-grid(--wf-cols: repeat(auto-fit, minmax(...)))
27
+ ├─ 两栏固定比例 → wf-split(--wf-split-ratio)
28
+ └─ 居中专区 → wf-center(hero/空态/认证)
29
+
30
+ 间距?
31
+ ├─ 区域间 → wf-gap-lg / wf-gap-md(stack/row 的 --wf-gap)
32
+ ├─ 元素内 → wf-p-*(卡片内边距)
33
+ └─ 标题留白 → wf-mb-*(仅 margin-bottom 用 m-,其余用 gap)
34
+
35
+ 定位/层级?
36
+ ├─ 吸顶 → wf-sticky(页面级)或 Affix 组件(滚动跟随)
37
+ ├─ 悬浮按钮 → FloatButton 组件
38
+ ├─ 角标覆盖 → wf-layer + wf-pop(容器内定位)
39
+ └─ 弹层 → 组件(openPopup 命令式——禁手写定位)
40
+
41
+ 响应式?
42
+ ├─ 隐藏/显示 → wf-hidden / wf-hidden@lg / wf-flex@lg
43
+ ├─ 网格列数 → --wf-cols 的 auto-fit/auto-fill(窄屏自动收)
44
+ └─ 表格 → Table minWidth + 横向滚动
45
+ ```
46
+
47
+ ## 3. 组件 vs 原语的边界(5 个重叠组件的分工)
48
+
49
+ | 场景 | 用原语 | 用组件 |
50
+ |------|--------|--------|
51
+ | 简单响应式网格 | wf-grid | Grid(24 栅格/列偏移——antd 迁移心智) |
52
+ | 简单间距 | wf-gap-* | Space(split 分隔符/方向控制) |
53
+ | 纯分隔线 | wf-border-t | Divider(带文字/vertical) |
54
+ | 简单字号 | wf-text-* | Typography(语义标签/mark/code) |
55
+ | 普通滚动容器 | wf-scroll | Scrollbar(自定义滚动条外观) |
56
+
57
+ ## 4. 布局纪律(红线)
58
+
59
+ ```
60
+ □ 布局结构只用 wf-* 原语(零手写 CSS)
61
+ □ 先查框架再动手(layout 原语 + 组件 + patterns——三层都查过再自研)
62
+ □ 间距走 token 阶梯(--wf-space-* 派生类——不用魔数)
63
+ □ 新功能先查 wf-* 是否已覆盖(如吸顶:页面级 wf-sticky / 嵌套容器 Affix)
64
+ ```
@@ -1,10 +1,13 @@
1
- # 布局系统(weifuwu/layout)
1
+ # 布局原语使用指南
2
+
3
+ > 从 docs/layout.md 迁移(content/ 文档库——随 npm 包发布,与框架版本同步)。
4
+ > 本页为叙述性指南——组件/能力逐项参考见 content/ 各域目录。
2
5
 
3
- > 本页为 weifuwu 官方文档拆分页 · [返回 README](../README.md)
6
+ # 布局系统(weifuwu/layout)
4
7
 
5
- 纯 CSS 66 个布局原语 + 156 个工具类 + 177 个主题 Token。不绑定任何 JS 框架。
8
+ 纯 CSS 66 个布局原语 + 157 个工具类 + 182 个主题 Token。不绑定任何 JS 框架。
6
9
 
7
- > **学习路径与命名规范**:见 [`docs/style-guide.md`](style-guide.md)——统一语法 `wf-<域>-<名>`、三档学习(组件 → 10 核心原语 → 完整速查)、场景速查、变量定制。
10
+ > **学习路径与命名规范**:见 [`样式体系指南`](../../docs/style-guide.md)——统一语法 `wf-<域>-<名>`、三档学习(组件 → 10 核心原语 → 完整速查)、场景速查、变量定制。
8
11
 
9
12
  > **全栈 weifuwu 项目**:`weifuwu/components/style.css` 已包含布局系统,一条 import 就够了,无需单独引用本页。
10
13
  > 本页仅适用于**非 weifuwu 项目**或**只需 CSS 布局**的场景。
@@ -90,8 +93,8 @@ app.get('/layout.css', (req, ctx) => ctx.ui.css('weifuwu/layout'))
90
93
  | **内容排版** | `wf-prose` | 富文本正文(文章/博客/文档,一个类包 h2/p/ul/blockquote/pre…) |
91
94
  | **外壳** | `wf-app-shell` | 应用外壳:侧边栏 + 主区 grid(`--wf-sidebar-width`) |
92
95
  | | `wf-sidebar` `wf-sidebar-header` `wf-sidebar-body` `wf-sidebar-footer` | 侧边栏:品牌区/导航区/底部用户区,sticky 全高 |
93
- | | `wf-nav` `wf-nav-group` `wf-nav-item` `wf-nav-icon` | 导航:分组标题 + 链接项(`--active` 激活态) |
94
- | | `wf-main` | 主内容区(padding + min-width: 0) |
96
+ | | `wf-nav` `wf-nav-group` `wf-nav-item` `wf-nav-icon` | 导航:分组标题 + 链接项(`--active` 激活态);折叠态 `wf-nav--collapsed`(图标-only——**导航项需加 `title` 属性**提供悬停提示,CSS 无法自动补) |
97
+ | | `wf-main` | 主内容区(padding + min-width: 0;长文本设 `--wf-main-max: 900px` 限宽居中——文档站场景) |
95
98
  | | `wf-text-*` 排版工具 | 见下文「排版工具」 |
96
99
 
97
100
  ### 组合规则(冲突防线)
@@ -131,7 +134,7 @@ app.get('/layout.css', (req, ctx) => ctx.ui.css('weifuwu/layout'))
131
134
  | `wf-truncate` | 单行省略(ellipsis) |
132
135
  | `wf-line-clamp-2/3` | 多行截断 |
133
136
 
134
- ## 177 个主题 Token
137
+ ## 182 个主题 Token
135
138
 
136
139
  **双层结构**:原始层(Primitive,色值只定义一次,品牌/暗色调校改这里)+ 语义层(Semantic,组件消费)。
137
140
 
@@ -169,7 +172,8 @@ app.get('/layout.css', (req, ctx) => ctx.ui.css('weifuwu/layout'))
169
172
  /* 边框色 */
170
173
  --wf-color-border / --wf-color-border-light / --wf-color-border-dark
171
174
 
172
- /* 字体 */
175
+ /* 字体(--wf-font-sans 已含 CJK 回退:PingFang SC / Hiragino / 雅黑 / Noto Sans SC——
176
+ 中文原生:西文最优字形 + 中文三平台一致;--wf-font-mono 同) */
173
177
  --wf-font-sans / --wf-font-mono
174
178
 
175
179
  /* 字号: xs sm base lg xl 2xl 3xl 4xl 5xl display */
@@ -1,8 +1,11 @@
1
- # 前端中间件与工具(weifuwu/ui-dom)
1
+ # 中间件与 ctx 注入链
2
+
3
+ > 从 docs/frontend-middleware.md 迁移(content/ 文档库——随 npm 包发布,与框架版本同步)。
4
+ > 本页为叙述性指南——组件/能力逐项参考见 content/ 各域目录。
2
5
 
3
- > ⚠️ **`weifuwu/client` 已并入 `weifuwu/ui-dom`**——中间件(api/auth/ws/i18n)位于 `weifuwu/ui-dom`,前端运行时唯一入口为 `weifuwu/ui-dom`(vdom3 事件流引擎:createRouter + createRoot),见 [frontend-ui-dom.md](frontend-ui-dom.md)。
6
+ # 前端中间件与工具(weifuwu/ui-dom)
4
7
 
5
- > 本页为 weifuwu 官方文档拆分页 · [返回 README](../README.md)
8
+ > ⚠️ **`weifuwu/client` 已并入 `weifuwu/ui-dom`**——中间件(api/auth/ws/i18n)位于 `weifuwu/ui-dom`,前端运行时唯一入口为 `weifuwu/ui-dom`(vdom3 事件流引擎:createRouter + createRoot),见 [ui-dom 指南](ui-dom-guide.md)。
6
9
 
7
10
  ## createRouter — 前端路由(vdom3)
8
11
 
@@ -11,6 +14,7 @@ import { createRouter, h } from 'weifuwu/ui-dom'
11
14
 
12
15
  let ctx: any = {}
13
16
  ctx = v3Toast()(ctx) // 中间件面展开(ctx 注入——对齐后端 app.use)
17
+ ctx = v3Notification()(ctx) // 注入 ctx.notification
14
18
 
15
19
  const handle = createRouter(
16
20
  [
@@ -388,6 +392,33 @@ ctx.toast?.('普通消息') // 默认 type = 'info'
388
392
 
389
393
  ---
390
394
 
395
+ ## notification — 命令式通知
396
+
397
+ `ctx.notification()` 是 `<Notification>` 组件的全局命令式封装:队列式通知(title + description + icon + 操作),自动消失、手动关闭、四角定位。
398
+
399
+ ```tsx
400
+ import { v3Notification } from 'weifuwu/ui-dom'
401
+
402
+ let ctx: any = {}
403
+ ctx = v3Notification({ position: 'top-right', duration: 4500, max: 5 })(ctx)
404
+
405
+ // 任意代码中(组件事件、api 拦截器、WS 回调、定时器)
406
+ ctx.notification?.success({ title: '部署成功', description: 'v0.63.0 已上线' })
407
+ ctx.notification?.warning({ title: '磁盘空间不足', description: '已使用 92%' })
408
+ ctx.notification?.('普通通知')
409
+ ctx.notification?.open({ type: 'error', title: '请求失败', duration: 8000, action: { label: '重试', onClick: retry } })
410
+ ```
411
+
412
+ | NotificationOptions | 类型 | 默认值 | 说明 |
413
+ |-------------|------|--------|------|
414
+ | `position` | `NotificationPosition` | `'top-right'` | 容器位置(top-right/top-left/bottom-right/bottom-left) |
415
+ | `duration` | `number` | `4500` | 默认自动消失时间(ms),0 = 不消失 |
416
+ | `max` | `number` | `5` | 最大显示条数,超出移除最早 |
417
+
418
+ 单条可覆盖自动消失时间:`ctx.notification({ title: 'x', duration: 8000 })`。
419
+
420
+ ---
421
+
391
422
  ## ScrollLock / FocusTrap
392
423
 
393
424
  ```tsx
@@ -1,7 +1,12 @@
1
+ # 移动端开发指南
2
+
3
+ > 从 docs/mobile.md 迁移(content/ 文档库——随 npm 包发布,与框架版本同步)。
4
+ > 本页为叙述性指南——组件/能力逐项参考见 content/ 各域目录。
5
+
1
6
  # 移动端开发指南(weifuwu)
2
7
 
3
8
  > 移动端友好由框架构造保证:**用对原语 + 守 audit 规则**,不靠每个组件"记得"。
4
- > 落地依据:移动端支持计划(P0-P3 全落地——usePopup 全系 + safe-area + 44px 命中区 + docs/mobile 指南)。
9
+ > 落地依据:移动端支持计划(P0-P3 全落地——openPopup 全系 + safe-area + 44px 命中区 + docs/mobile 指南)。
5
10
 
6
11
  ## 一、断点体系(布局原语)
7
12
 
@@ -42,30 +47,21 @@
42
47
 
43
48
  - 小按钮(显式 `min-height` 覆盖了全局)需在组件 CSS 补 coarse 44px(参考 Pagination/Transfer/Calendar nav)
44
49
 
45
- ## 三、弹层(usePopup 组合器)
46
-
47
- **弹层组件必须用 `ctx.ui.usePopup`**——移动端友好由构造保证:
48
-
49
- ```ts
50
- const popup = ctx.ui.usePopup({
51
- trigger: 'hover', // 触屏自动降级 tap(内部 matchMedia '(hover: hover)')
52
- placement: () => latestPos, // 支持 getter 动态读 props
53
- el: () => wrapEl, // 锚定元素 ref
54
- isOpen: () => $.open,
55
- setOpen: (v) => { $.open = v; ctx.ui.render() },
56
- open: controlled ? () => latestOpen : undefined, // 受控桥(mount 期决定模式)
57
- onOpenChange: (v) => latestOnOpenChange?.(v),
58
- width: 320, // 自动 clamp 视口(≤100vw-32px)
59
- disabled: () => disabled,
60
- openDelay: () => delay, // hover 延迟(HoverCard)
61
- })
62
- // popup.wrapProps — 触发 + Escape + focus,spread 到包装元素
63
- // popup.portal(content, portalKey) — 定位 + clamp + portal(挂载 #__wf_portal)
64
- ```
50
+ ## 三、弹层(openPopup 命令式弹窗)
65
51
 
66
- **内置行为**:hover 桌面 / tap 触屏 / Escape(document 级,portal 内也可关)/ 外部点击 / 视口 clamp / 宽度 clamp / focus 触发(DatePicker) / mask 遮罩(Command/Img/Tour)/ 会话级模态(Modal/Drawer/Confirm——presence 退场 + trapFocus + lockScroll + positioning 'none')。
52
+ **弹层组件必须用 `ctx.ui.openPopup`**——移动端友好由构造保证:
67
53
 
68
- **全部弹窗统一 usePopup 单一入口**(锚定浮层 + 居中模态 + 通知 + 引导 + 日历);`usePopupPosition` 仅 Affix/Chart 坐标工具独立使用。
54
+ ```tsx
55
+ let handle: PopupHandle | null = null
56
+ if (open && !handle)
57
+ handle = ctx.ui.openPopup({
58
+ anchor: () => anchorEl, // **anchor 必传**(触发区是锚点——否则被当外部点击关闭)
59
+ content: () => h('div', { class: 'wf-popover' }, props.content),
60
+ onClose: () => { handle = null; open = false; ctx.ui.render() },
61
+ })
62
+ else if (!open && handle) { handle.close(); handle = null }
63
+ else if (handle) handle.update(h('div', { class: 'wf-popover' }, props.content))
64
+ ```
69
65
 
70
66
  ## 四、手势原语
71
67
 
@@ -87,7 +83,7 @@ const popup = ctx.ui.usePopup({
87
83
 
88
84
  ## 六、防横向溢出(375px 验收基线)
89
85
 
90
- - 弹层宽度:usePopup 自动 `max-width: min(…, calc(100vw - 32px))`;手动浮层加 `.wf-popup` 基类
86
+ - 弹层宽度:openPopup 自动视口夹紧(`calc(100vw - 32px)`);手动浮层加 `.wf-popup` 基类
91
87
  - 宽内容(表格/双栏):容器 `overflow-x: auto`(Table/Resizable 已内置)
92
88
  - 网格:`minmax(min(100%, 420px), 1fr)`(防 minmax 固定值撑破窄屏)
93
89
  - 验收:375×667 视口 `document.documentElement.scrollWidth <= innerWidth`
@@ -0,0 +1,98 @@
1
+ # 页面组装方法论(从零搭一个页面)
2
+
3
+ > 解决"我会组件、会原语,但打开编辑器不知道第一行写什么"。
4
+ > 与 [布局选型](layout-choice.md) 配合:选型决定"用什么",本页决定"怎么搭"。
5
+ > 前提:先查 patterns(`content/patterns/*.md`)——有现成蓝本直接复制,
6
+ > 本方法论用于"没有蓝本时从零搭"。
7
+
8
+ ## 1. 页面解剖学(页面 = 五层)
9
+
10
+ ```
11
+ 骨架层 页面的大形状:wf-app-shell(壳)/ wf-container(定宽)/ wf-stack(纵列)
12
+ 分区层 区域划分:header / content / footer / sider(用 row/stack 组合)
13
+ 内容层 组件就位:Table/Form/Card…(组件文档查 API)
14
+ 间距层 呼吸感:wf-gap-* / wf-p-*(间距工具)
15
+ 响应式层 多设备:wf-hidden@lg / 断点变体(布局降级)
16
+ ```
17
+
18
+ ## 2. 组装 5 步套路(固定流程,不是自由发挥)
19
+
20
+ ```
21
+ ① 定骨架:这个页面是"壳内页面"(有侧栏/顶栏 → app-shell 已存在)还是
22
+ "独立页面"(→ wf-container + wf-stack)?
23
+ ② 划分区:从上到下/从左到右画出区域(header 标题区 / 主体区 / 底部操作区)
24
+ ③ 填内容:每个区域放什么组件(标题 → PageHeader;列表 → Table;表单 → Form)
25
+ ④ 调间距:区域间 wf-gap-lg、卡片内 wf-gap-sm、标题下 wf-mb-*
26
+ ⑤ 响应式:窄屏时哪些隐藏(wf-hidden@lg)、哪些堆叠(grid 列数自适应)
27
+ ```
28
+
29
+ ## 3. 完整示例:从零搭"订单详情页"(逐步)
30
+
31
+ ### 第 1 步:定骨架(独立页面——container + stack)
32
+
33
+ ```tsx
34
+ return (
35
+ <div class="wf-container wf-stack" style="--wf-max:960px;--wf-gap:16px;padding:24px 16px">
36
+ {/* 分区占位 */}
37
+ </div>
38
+ )
39
+ ```
40
+
41
+ ### 第 2 步:划分区 + 第 3 步:填内容
42
+
43
+ ```tsx
44
+ // ① 标题区:PageHeader(标题 + 状态 Tag + 操作按钮)
45
+ <PageHeader title={`订单 ${id}`} sub="客户:张伟">
46
+ <Button variant="primary">导出</Button>
47
+ </PageHeader>
48
+
49
+ // ② 主体区:Descriptions(详情字段栅格)
50
+ <Descriptions items={[{ label: '订单号', value: id }, { label: '金额', value: '¥3,200' }]} bordered />
51
+
52
+ // ③ 历史区:Timeline(执行流)
53
+ <Timeline items={[{ key: '1', title: '已支付', time: '08-12 09:15' }]} />
54
+ ```
55
+
56
+ ### 第 4 步:调间距(gap 阶梯)
57
+
58
+ ```tsx
59
+ // 区域间 gap-lg(16px)已有(骨架 --wf-gap:16px)
60
+ // 卡片内紧凑 gap-sm、标题下留白 wf-mb-sm
61
+ <Card>
62
+ <div class="wf-text-bold wf-mb-sm">补充信息</div>
63
+ <div class="wf-stack wf-gap-xs">…</div>
64
+ </Card>
65
+ ```
66
+
67
+ ### 第 5 步:响应式降级
68
+
69
+ ```tsx
70
+ // 双栏 → 窄屏单栏(grid auto-fit)
71
+ <div class="wf-grid" style="--wf-cols:repeat(auto-fit,minmax(min(100%,300px),1fr))">
72
+ <Card>补充信息</Card><Card>执行历史</Card>
73
+ </div>
74
+ ```
75
+
76
+ **完整成品**:`examples/patterns/DetailPage.tsx`(本示例的落地版——5 步的每一步都可在源码中对应)。
77
+
78
+ ## 4. 常见页面的搭法速查
79
+
80
+ | 页面类型 | 骨架 | 分区 | 核心组件 |
81
+ |---------|------|------|---------|
82
+ | 列表页 | container+stack | 标题区/表格区/分页区 | PageHeader + SearchInput + Table + Pagination |
83
+ | 详情页 | container+stack | 标题区/详情区/历史区 | PageHeader + Descriptions + Timeline |
84
+ | 设置页 | container+stack | 标题区/分区 Tabs | PageHeader + Tabs + Form + Switch |
85
+ | 表单页 | container+stack | 标题区/表单区/操作区 | PageHeader + Form + Field + Button |
86
+ | 仪表盘 | container+stack | KPI 行/图表区/表格区 | StatCard + Chart + Table |
87
+
88
+ (每种都有对应 patterns 蓝本——`content/patterns/*.md`)
89
+
90
+ ## 5. 纪律(搭页面时的红线)
91
+
92
+ ```
93
+ □ 布局结构只用 wf-* 原语(不手写 CSS/内联 style 自定义)
94
+ □ 内容元素用组件(不裸 div/span 手搓结构)
95
+ □ 间距走 wf-gap-*/wf-p-*(不用魔数 px)
96
+ □ 图标用 Icon 组件(禁 emoji 装饰)
97
+ □ 先查 patterns——重复造轮子是最常见的浪费
98
+ ```