@@ -67,11 +67,37 @@ const verify = async () => {
6767| -------------- | ---------------------- | ----------------------------------- | ----------------------------------------------------- |
6868| text | 标题/说明/按钮文案 | ` HumanCaptchaTextOptions ` | 内置中文默认文案 |
6969| position | 随机定位与 clamp | ` HumanCaptchaPositionOptions ` | ` { centerJitterPx: 120, clampMarginPx: 12 } ` |
70- | size | 弹窗尺寸 | ` HumanCaptchaSizeOptions ` | ` { widthPx: 360, heightPx: 220 } ` |
70+ | size | 弹窗尺寸 | ` HumanCaptchaSizeOptions ` | ` { widthPx: 360, heightPx: 200 } ` |
71+ | canvas | canvas 文案绘制样式 | ` HumanCaptchaCanvasOptions ` | ` {} ` |
7172| antiAutomation | 反自动化信号(可关闭) | ` HumanCaptchaAntiAutomationOptions ` | ` { minSolveTimeMs: 700, requirePointerTravelPx: 80 } ` |
7273| challenge | 挑战类型(可插拔) | ` HumanCaptchaChallengeOption ` | ` click-button ` |
74+ | security | 安全相关配置 | ` HumanCaptchaSecurityOptions ` | ` { shadowRootMode: 'closed' } ` |
7375| timeoutMs | 超时自动取消 | ` number ` | ` 0 ` (不超时) |
7476
77+ ### canvas
78+
79+ 用于控制标题/说明/按钮文案的 canvas 绘制样式(可选)。常见需求是调整字号或颜色:
80+
81+ ``` ts
82+ import { createHumanCaptcha } from ' tml-ui'
83+
84+ const captcha = createHumanCaptcha ({
85+ canvas: {
86+ titleStyle: { fontSizePx: 18 , fontWeight: 600 },
87+ messageStyle: { fontSizePx: 14 },
88+ buttonStyle: { fontSizePx: 14 }
89+ }
90+ })
91+
92+ await captcha .verify ()
93+ ```
94+
95+ ### security
96+
97+ | 字段 | 说明 | 类型 | 备注 |
98+ | -------------- | -------------------------------------- | ---------------------- | ---- |
99+ | shadowRootMode | ShadowRoot 模式(默认 closed,尽力而为) | ` 'closed' \| 'open' ` | ` open ` 建议仅用于测试/调试 |
100+
75101### antiAutomation
76102
77103| 字段 | 说明 | 类型 | 备注 |
@@ -92,8 +118,13 @@ const captcha = createHumanCaptcha({
92118 type: ' custom' ,
93119 factory : (ctx ) => {
94120 // 你的 UI 可以挂载到 ctx.mountPoint
95- // 完成挑战后调用 ctx.requestSolve()
121+ // 注意:mountPoint 初始会包含默认按钮,你可以复用/替换它
122+
123+ // 完成挑战后调用 ctx.requestSolve()(会应用 antiAutomation 门槛)
96124 // 取消则调用 ctx.cancel()
125+
126+ // 如需读取信号,可使用:
127+ // const { openedAtMs, pointerTravelPx } = ctx.getSignals()
97128 ctx .requestSolve ()
98129
99130 return {
0 commit comments