weifuwu 0.76.0 → 0.78.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 +38 -41
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/List/List.d.ts +3 -0
- package/dist/components/Tour/Tour.d.ts +1 -1
- package/dist/components/index.js +12 -12
- package/dist/components/style.css +17 -0
- package/dist/index.js +1272 -1228
- package/dist/scheduler/index.d.ts +7 -2
- package/dist/ui-dom/hooks/index.d.ts +0 -1
- package/dist/ui-dom/hooks/popup.d.ts +1 -10
- package/dist/ui-dom/hooks/stable.d.ts +1 -1
- package/dist/ui-dom/hooks/types.d.ts +0 -1
- package/dist/ui-dom/index.d.ts +1 -1
- package/dist/ui-dom/index.js +10 -10
- package/dist/ui-dom/jsx-runtime.js +1 -1
- package/dist/ui-dom/testing.js +1 -1
- package/dist/ui-dom/types.d.ts +31 -41
- package/dist/ui-dom/vdom/audit.d.ts +20 -0
- package/dist/ui-dom/vdom/build.d.ts +10 -3
- package/dist/ui-dom/vdom/diff.d.ts +7 -8
- package/dist/ui-dom/vdom/index.d.ts +1 -1
- package/dist/ui-dom/vdom/mount.d.ts +14 -5
- package/dist/ui-dom/vdom/render.d.ts +4 -0
- package/dist/ui-dom/vdom/serve.d.ts +1 -1
- package/dist/ui-dom/vdom/transform.d.ts +32 -0
- package/dist/ui-dom/vnode.d.ts +18 -10
- package/docs/components.md +5 -5
- package/docs/custom-components.md +86 -54
- package/docs/examples.md +35 -41
- package/docs/frontend-middleware.md +3 -4
- package/docs/frontend-ui-dom.md +22 -18
- package/docs/frontend.md +243 -168
- package/docs/mobile.md +2 -2
- package/docs/realtime.md +8 -3
- package/package.json +1 -1
- package/dist/ui-dom/focus-trap.d.ts +0 -4
- package/dist/ui-dom/scroll-lock.d.ts +0 -5
- package/dist/ui-dom/vdom/scheduler.d.ts +0 -13
package/docs/mobile.md
CHANGED
|
@@ -63,9 +63,9 @@ const popup = ctx.ui.usePopup({
|
|
|
63
63
|
// popup.portal(content, portalKey) — 定位 + clamp + portal(挂载 #__wf_portal)
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
**内置行为**:hover 桌面 / tap 触屏 / Escape(document 级,portal 内也可关)/ 外部点击 / 视口 clamp / 宽度 clamp
|
|
66
|
+
**内置行为**:hover 桌面 / tap 触屏 / Escape(document 级,portal 内也可关)/ 外部点击 / 视口 clamp / 宽度 clamp / focus 触发(DatePicker) / mask 遮罩(Command/Img/Tour)/ 会话级模态(Modal/Drawer/Confirm——presence 退场 + trapFocus + lockScroll + positioning 'none')。
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
**全部弹窗统一 usePopup 单一入口**(锚定浮层 + 居中模态 + 通知 + 引导 + 日历);`usePopupPosition` 仅 Affix/Chart 坐标工具独立使用。
|
|
69
69
|
|
|
70
70
|
## 四、手势原语
|
|
71
71
|
|
package/docs/realtime.md
CHANGED
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
> 依赖 `queue`(触发后入队执行)。三类任务:即时(queue.add 已有)、延时(`ctx.schedule`)、定时(`ctx.cron`)。
|
|
8
8
|
|
|
9
9
|
```ts
|
|
10
|
-
import { queue, scheduler } from 'weifuwu'
|
|
10
|
+
import { redis, queue, scheduler } from 'weifuwu'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
// 模式 A 显式注入:redis 是 scheduler 的第一方消费者(ZSET 延时队列 + HASH cron 注册表
|
|
13
|
+
// 直接命令 redis)——必传,与 queue({ redis }) 对齐;scheduler.close() 不关闭注入的 redis
|
|
14
|
+
const r = redis() // ctx.redis(RedisPool)
|
|
15
|
+
const q = queue({ redis: r.redis }) // 入队执行(stream)
|
|
16
|
+
app.use(r)
|
|
13
17
|
app.use(q)
|
|
14
|
-
app.use(scheduler({ queue: q }))
|
|
18
|
+
app.use(scheduler({ redis: r.redis, queue: q })) // 守护循环走 createConnection() 独立连接
|
|
15
19
|
|
|
16
20
|
// 延时任务(单次):delayMs 或指定时间
|
|
17
21
|
await ctx.schedule('email.send', { to, body }, { delayMs: 30_000 })
|
|
@@ -30,6 +34,7 @@ const worker = ctx.queue.worker('email.send', async (job) => { ... })
|
|
|
30
34
|
|
|
31
35
|
- **延时**:ZSET(score=触发时间戳)+ 守护循环(独立连接)→ 到期 `ZREM` 原子抢占(多实例不重复)→ `queue.add`
|
|
32
36
|
- **多应用隔离**:`scheduler({ prefix })`——ZSET/HASH 应用级共享,多应用共用 redis 时必须各自 prefix(同应用多实例共享 prefix = 协作消费)
|
|
37
|
+
- **连接所有权**:scheduler 内部用 `redis.createConnection()` 独立守护连接(不占池——对齐 queue worker);`scheduler.close()` 只关守护连接——**不关闭注入的 redis**(调用方负责 `r.close()`)
|
|
33
38
|
- **cron**:HASH 注册表(**field = name,同 name 重新注册 = 覆盖更新**,改表达式不残留旧定义)+ 滚动生成触发点(`ZADD NX` 幂等)→ 复用延时链路;`nextRunAt` 原子推进
|
|
34
39
|
- **取消**:`ctx.cancelCron(name)` 删定义 + 清理 pending 触发点(停用 cron 必须 cancel——定义无 TTL 会累积)
|
|
35
40
|
- **崩溃恢复**:未消费触发点留在 ZSET,重启后补扫立即触发(at-least-once,幂等由业务保证)
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { WfuiContext } from '../types.ts';
|
|
2
|
-
import type { Registry } from './registry.ts';
|
|
3
|
-
export interface Scheduler {
|
|
4
|
-
render(ids?: string[]): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export interface SchedulerOptions {
|
|
7
|
-
registry: Registry;
|
|
8
|
-
ctx: WfuiContext;
|
|
9
|
-
rootEl?: HTMLElement;
|
|
10
|
-
getCtxVersion?: (id: string) => number;
|
|
11
|
-
onError?: (e: unknown) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function createScheduler(opts: SchedulerOptions): Scheduler;
|