weifuwu 0.74.0 → 0.76.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 +20 -20
- package/dist/ai/types.d.ts +3 -1
- package/dist/components/AiChat/AiChat.d.ts +5 -1
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +5 -2
- package/dist/components/Button/Button.d.ts +2 -0
- package/dist/components/CitationCard/CitationCard.d.ts +38 -0
- package/dist/components/Command/Command.d.ts +1 -1
- package/dist/components/JsonSchemaForm/JsonSchemaForm.d.ts +48 -0
- package/dist/components/ReasoningBlock/ReasoningBlock.d.ts +25 -0
- package/dist/components/Select/Select.d.ts +11 -1
- package/dist/components/SessionList/SessionList.d.ts +42 -0
- package/dist/components/TreeSelect/TreeSelect.d.ts +3 -2
- package/dist/components/index.d.ts +10 -2
- package/dist/components/index.js +14 -14
- package/dist/components/style.css +608 -20
- package/dist/index.d.ts +0 -2
- package/dist/index.js +141 -433
- package/dist/layout/weifuwu-layout.css +9 -0
- package/dist/test/client/setup.d.ts +12 -0
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui-dom/Confirm.d.ts +5 -41
- package/dist/ui-dom/Notification.d.ts +8 -70
- package/dist/ui-dom/Toast.d.ts +8 -43
- package/dist/ui-dom/ai.d.ts +1 -1
- package/dist/ui-dom/browser.d.ts +1 -1
- package/dist/ui-dom/focus-trap.d.ts +1 -1
- package/dist/ui-dom/hooks/chat.d.ts +11 -0
- package/dist/ui-dom/hooks/events.d.ts +30 -0
- package/dist/ui-dom/hooks/external.d.ts +20 -0
- package/dist/ui-dom/hooks/index.d.ts +31 -0
- package/dist/ui-dom/hooks/input.d.ts +33 -0
- package/dist/ui-dom/hooks/media.d.ts +17 -0
- package/dist/ui-dom/hooks/popup.d.ts +37 -0
- package/dist/ui-dom/hooks/stable.d.ts +39 -0
- package/dist/ui-dom/hooks/test/hooks.test.d.ts +1 -0
- package/dist/ui-dom/hooks/types.d.ts +78 -0
- package/dist/ui-dom/index.d.ts +19 -17
- package/dist/ui-dom/index.js +12 -10
- package/dist/ui-dom/jsx-runtime.js +1 -1
- package/dist/ui-dom/middleware/api.d.ts +3 -3
- package/dist/ui-dom/middleware/auth.d.ts +1 -1
- package/dist/ui-dom/motion.d.ts +1 -1
- package/dist/ui-dom/popup.d.ts +1 -1
- package/dist/ui-dom/scroll-lock.d.ts +1 -1
- package/dist/ui-dom/store.d.ts +24 -0
- package/dist/ui-dom/testing.d.ts +74 -0
- package/dist/ui-dom/testing.js +1 -0
- package/dist/ui-dom/testing.test.d.ts +1 -0
- package/dist/ui-dom/types.d.ts +34 -17
- package/dist/ui-dom/use-chat.d.ts +19 -14
- package/dist/ui-dom/vdom/build.d.ts +34 -0
- package/dist/ui-dom/vdom/diff.d.ts +34 -0
- package/dist/ui-dom/vdom/hydration.d.ts +17 -0
- package/dist/ui-dom/vdom/index.d.ts +23 -0
- package/dist/ui-dom/vdom/mount.d.ts +49 -0
- package/dist/ui-dom/vdom/registry.d.ts +27 -0
- package/dist/ui-dom/vdom/render.d.ts +13 -0
- package/dist/ui-dom/vdom/scheduler.d.ts +13 -0
- package/dist/ui-dom/vdom/serve.d.ts +30 -0
- package/dist/ui-dom/vdom/ssr.d.ts +44 -0
- package/dist/ui-dom/vnode.d.ts +11 -44
- package/dist/user/token.d.ts +1 -1
- package/docs/compat-three-library.md +1 -1
- package/docs/components-map.md +19 -2
- package/docs/components.md +9 -4
- package/docs/custom-components.md +19 -14
- package/docs/data.md +16 -33
- package/docs/environment.md +1 -1
- package/docs/frontend-middleware.md +65 -79
- package/docs/frontend-ui-dom.md +4 -2
- package/docs/frontend.md +35 -38
- package/docs/layout.md +2 -2
- package/docs/realtime.md +23 -28
- package/docs/saas.md +8 -6
- package/package.json +5 -1
- package/dist/ui/ssr-page.d.ts +0 -41
- package/dist/ui/ssr.d.ts +0 -35
- package/dist/ui-dom/diff.d.ts +0 -28
- package/dist/ui-dom/hydration.d.ts +0 -13
- package/dist/ui-dom/reactive.d.ts +0 -6
- package/dist/ui-dom/registry.d.ts +0 -39
- package/dist/ui-dom/render.d.ts +0 -46
- package/dist/ui-dom/route-match.d.ts +0 -22
- package/dist/ui-dom/serve.d.ts +0 -28
- package/dist/ui-dom/ssr.d.ts +0 -56
- package/dist/ui-dom/ui.d.ts +0 -78
package/dist/ui-dom/ssr.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 服务端 SSR 字符串遍历器 — async 工厂组件(形态 C)的 HTML 序列化
|
|
3
|
-
*
|
|
4
|
-
* 支持:
|
|
5
|
-
* - 同步组件(mount → render → VNode → HTML)
|
|
6
|
-
* - async 工厂组件(await 工厂 → 数据进 HTML;服务端不缓存定义,数据 per-request)
|
|
7
|
-
* - Fragment / Portal(内联子节点)
|
|
8
|
-
* - innerHTML prop(原样输出)、class/style 对象序列化
|
|
9
|
-
* - 事件处理器 / ref 剥离、文本自动转义(XSS)
|
|
10
|
-
* - 服务端 ctx shim($ no-op dirty、ctx.data 预取、selfId 隔离)
|
|
11
|
-
*
|
|
12
|
-
* 产物为 HtmlSafe 标记的安全 HTML 片段,可直接内联进 ctx.ui.html 模板。
|
|
13
|
-
*/
|
|
14
|
-
import type { Component, AsyncComponent } from './vnode.ts';
|
|
15
|
-
export interface SsrOptions {
|
|
16
|
-
/** 服务端数据存储:ctx.data 预取结果写入此处,调用方序列化进 __DATA__ */
|
|
17
|
-
data?: Map<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* SSR 渲染组件 → HTML 片段(HtmlSafe 标记,可直接内联进 ctx.ui.html 模板,不二次转义)。
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* const data = new Map()
|
|
24
|
-
* const html = await ctx.ui.ssr(BlogPage, { slug }, { data })
|
|
25
|
-
* return ctx.ui.html`
|
|
26
|
-
* <div id="root">${html}</div>
|
|
27
|
-
* ${ctx.ui.ssrData(data)}
|
|
28
|
-
* `
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function ssrToString(Comp: Component | AsyncComponent, props: Record<string, any>, serverCtx: any, opts?: SsrOptions): Promise<string>;
|
|
32
|
-
/** 序列化数据存储 → window.__DATA__ 脚本(防 XSS:转义 <) */
|
|
33
|
-
export declare function serializeData(data: Map<string, unknown>): string;
|
|
34
|
-
import type { UIRouter } from './router.ts';
|
|
35
|
-
export interface SsrPageResult {
|
|
36
|
-
html: string;
|
|
37
|
-
/** __DATA__ 脚本(hydration 种子) */
|
|
38
|
-
dataScript: string;
|
|
39
|
-
/** 完整 HTML(含 dataScript) */
|
|
40
|
-
page: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* SSR 渲染路由页面 → 完整 HTML(Node 无 DOM)。
|
|
44
|
-
* 执行 router 匹配 → 中间件链 → handler(async 组件)→ vnode → renderSsr。
|
|
45
|
-
*
|
|
46
|
-
* ```ts
|
|
47
|
-
* const { page } = await ssrPage(router, { url: '/users/42' })
|
|
48
|
-
* // 客户端 uiServe(router, { root, hydrate: true }) 收养
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare function ssrPage(router: UIRouter, opts: {
|
|
52
|
-
url: string;
|
|
53
|
-
title?: string;
|
|
54
|
-
lang?: string;
|
|
55
|
-
rootId?: string;
|
|
56
|
-
}): Promise<SsrPageResult>;
|
package/dist/ui-dom/ui.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* weifuwu/client ctx.ui 工厂 — createApp 注入的 UI 能力
|
|
3
|
-
*
|
|
4
|
-
* 从 app.ts 拆出(P2 结构拆分)。createUi(deps) 返回完整 ui 对象:
|
|
5
|
-
* render / dirty / $ / useChat / useMedia / useBreakpoint / usePopupPosition / selfId
|
|
6
|
-
*
|
|
7
|
-
* 内部状态(_selfId/_selfVNode/_dirtySet/_ctxVersion)集中建模为 UiInternal,
|
|
8
|
-
* 消除 app.ts 中散落的 `as any`——跨模块状态误用由编译器拦截。
|
|
9
|
-
*/
|
|
10
|
-
import type { WfuiContext, PopupPosition } from './types.ts';
|
|
11
|
-
import type { VNode } from './vnode.ts';
|
|
12
|
-
/** 内部 UI 状态(ctx.ui 扩展字段)——跨模块共享,编译器可检查 */
|
|
13
|
-
export interface UiInternal {
|
|
14
|
-
_selfId?: string;
|
|
15
|
-
_selfVNode?: VNode;
|
|
16
|
-
_dirtySet: Set<string>;
|
|
17
|
-
_ctxVersion: number;
|
|
18
|
-
bumpCtxVersion(): void;
|
|
19
|
-
/** 异步批处理调度标记(dirty 微任务防重入) */
|
|
20
|
-
_dirtyScheduled?: boolean;
|
|
21
|
-
/** 渲染期调 render() 的推迟标记(防重入——见 ui.ts render 实现) */
|
|
22
|
-
_pendingRender?: boolean;
|
|
23
|
-
/** 渲染期调 dirty() 的推迟标记(防重入——见 ui.ts dirty 实现) */
|
|
24
|
-
_pendingDirty?: boolean;
|
|
25
|
-
/** ctx.ui.$() 的 WeakMap 缓存(每组件一个 $ 容器) */
|
|
26
|
-
_$cache?: Record<string, any>;
|
|
27
|
-
/** mount 阶段标记(内部——mountComponent 包裹) */
|
|
28
|
-
setMounting: (v: boolean) => void;
|
|
29
|
-
endMounting: () => void;
|
|
30
|
-
/** ErrorBoundary 注入的错误处理器(子组件 render 抛错时调用) */
|
|
31
|
-
_errorHandler?: (err: unknown) => void;
|
|
32
|
-
}
|
|
33
|
-
/** createUi 依赖(由 createApp 注入 app 级闭包状态) */
|
|
34
|
-
export interface UiDeps {
|
|
35
|
-
ctx: WfuiContext;
|
|
36
|
-
renderByIds: (ids: string[]) => void;
|
|
37
|
-
getSelfId: (ui: WfuiContext['ui'] | undefined) => string | undefined;
|
|
38
|
-
dirtyBatch: Set<string>;
|
|
39
|
-
dirtySet: Set<string>;
|
|
40
|
-
mediaRegistry: Map<string, {
|
|
41
|
-
mql?: MediaQueryList;
|
|
42
|
-
handler?: (e: MediaQueryListEvent) => void;
|
|
43
|
-
mqls?: Array<{
|
|
44
|
-
mql: MediaQueryList;
|
|
45
|
-
handler: () => void;
|
|
46
|
-
}>;
|
|
47
|
-
}>;
|
|
48
|
-
popupTrackers: Map<string, {
|
|
49
|
-
pos: PopupPosition;
|
|
50
|
-
getEl: () => HTMLElement | null;
|
|
51
|
-
isOpen: () => boolean;
|
|
52
|
-
compute: (rect: DOMRect) => {
|
|
53
|
-
top: number;
|
|
54
|
-
left: number;
|
|
55
|
-
width?: number;
|
|
56
|
-
};
|
|
57
|
-
}>;
|
|
58
|
-
scrollTrackers: Map<string, {
|
|
59
|
-
handle: {
|
|
60
|
-
y: number;
|
|
61
|
-
};
|
|
62
|
-
getScroller: () => HTMLElement | Window;
|
|
63
|
-
}>;
|
|
64
|
-
schedulePopupRecompute: () => void;
|
|
65
|
-
/** 惰性挂载全局 scroll/resize 监听(幂等) */
|
|
66
|
-
ensurePopupListeners: () => void;
|
|
67
|
-
destroyPopupListeners: () => void;
|
|
68
|
-
/** 渲染保护期(dirty 被忽略) */
|
|
69
|
-
isRendering: () => boolean;
|
|
70
|
-
/** mount 阶段(组件工厂执行——$ 初始化赋值丢弃) */
|
|
71
|
-
isMounting: () => boolean;
|
|
72
|
-
/** mount 阶段标记置位/恢复(mountComponent 包裹) */
|
|
73
|
-
setMounting: (v: boolean) => void;
|
|
74
|
-
endMounting: () => void;
|
|
75
|
-
/** 注册表实例(serve 注入局部;缺省 ctx.__registry) */
|
|
76
|
-
registry?: import('./registry.ts').Registry;
|
|
77
|
-
}
|
|
78
|
-
export declare function createUi(deps: UiDeps): WfuiContext['ui'] & UiInternal;
|