iter(g54): 新增 watermark 水印组件

This commit is contained in:
HIsheR
2026-10-26 12:18:24 +08:00
parent 30f5a4558d
commit 818e20eb95
12 changed files with 229 additions and 10 deletions
+53 -2
View File
@@ -1,6 +1,6 @@
{
"$schema": "ui-arch-registry-index/0.1",
"generatedAt": "2026-10-26T04:17:05.094Z",
"generatedAt": "2026-10-26T04:18:05.467Z",
"repoRoot": ".",
"packages": [
{
@@ -195,7 +195,8 @@
"datePicker(props):日期选择,单月网格 + 翻月 / 今天快捷键,value 为 YYYY-MM-DD 信号,min/max 闭区间限制,方向键逐日逐周可导航",
"backTop(props):返回顶部悬浮按钮,越过阈值才浮现,外环 conic-gradient 显示已滚比例,点击平滑回顶",
"colorPicker(props):颜色选择,预设色板(缺省语义令牌色)+ 原生取色器 + 手输 CSS 颜色串,value 为颜色串信号",
"tour(props):引导漫游,返回 { el, start, close } 句柄;聚光框按 target 选择器定位,卡片自动选方位,Esc / 跳过走 onClose"
"tour(props):引导漫游,返回 { el, start, close } 句柄;聚光框按 target 选择器定位,卡片自动选方位,Esc / 跳过走 onClose",
"watermark(props, ...children):内容容器 + 平铺水印覆盖层,canvas 生成单元、颜色取自令牌,覆盖层不挡交互"
],
"keyTypes": [
"ButtonProps",
@@ -2410,6 +2411,56 @@
"卡片优先落在目标下方,空间不足自动翻到上方,左右夹在视口内;滚动 / 缩放会实时重算",
"末步按钮文案变「完成」并触发 onFinish;× 或 Esc 触发 onClose,焦点归还开启前的元素"
]
},
{
"id": "watermark",
"title": "水印 Watermark",
"demo": "sec-watermark",
"props": [
{
"n": "text",
"t": "string",
"r": 1,
"d": "水印文字,支持 \\n 多行"
},
{
"n": "opacity",
"t": "number",
"d": "透明度;缺省 0.12"
},
{
"n": "rotate",
"t": "number",
"d": "旋转角度(度);缺省 -20"
},
{
"n": "gap",
"t": "number",
"d": "平铺间距像素;缺省 140"
},
{
"n": "fontSize",
"t": "number",
"d": "字号像素;缺省 14"
},
{
"n": "color",
"t": "string",
"d": "颜色(CSS 串或 var(--ua-*) 令牌);缺省取 --ua-color-text-muted 的实色"
},
{
"n": "children",
"t": "...unknown[]",
"d": "被水印覆盖的内容,作为第二个及之后的实参传入"
}
],
"example": "watermark({ text: '内部资料\\n仅限内网', gap: 160 }, card({ title: '受保护内容' }, h('p', null, '正文')))",
"steps": [
"第一个参数是配置,其后所有实参都被当作内容渲染在水印层下方",
"组件用一块 gap 见方的 canvas 画单个旋转单元,再 background-repeat 铺满,因此不需要监听尺寸变化",
"color 传 var(--ua-*) 时会先解析成计算值(canvas 不认 CSS 变量),所以暗色主题下颜色会自动跟随",
"覆盖层为 pointer-events:none,下方按钮/输入框照常可点;watermark 根节点自带圆角与裁剪"
]
}
]
},