iter(g129): 新增排版文本组件 typography

This commit is contained in:
HIsheR
2026-10-26 15:18:27 +08:00
parent 6158f49583
commit ea2a846734
13 changed files with 451 additions and 10 deletions
+84
View File
@@ -3961,3 +3961,87 @@ button.ua-step-dot:hover {
pointer-events: auto;
box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
}
/* —— 排版文本:层级靠字号与字重区分,语义色与装饰位只换颜色,不引布局 —— */
.ua-type {
color: var(--ua-color-text);
font-size: var(--ua-font-size-md);
line-height: 1.65;
margin: 0;
}
.ua-type-paragraph + .ua-type-paragraph {
margin-top: var(--ua-space-2); /* 段落之间留呼吸,单段不额外撑高 */
}
.ua-type-title {
font-weight: 600;
line-height: 1.35;
letter-spacing: -0.01em;
}
h1.ua-type-title { font-size: calc(var(--ua-font-size-lg) * 1.6); }
h2.ua-type-title { font-size: calc(var(--ua-font-size-lg) * 1.32); }
h3.ua-type-title { font-size: calc(var(--ua-font-size-lg) * 1.12); }
h4.ua-type-title { font-size: var(--ua-font-size-lg); }
h5.ua-type-title { font-size: var(--ua-font-size-md); }
.ua-type.is-secondary { color: var(--ua-color-text-muted); }
.ua-type.is-success { color: var(--ua-color-success); }
.ua-type.is-warning { color: var(--ua-color-warning); }
.ua-type.is-danger { color: var(--ua-color-danger); }
.ua-type.is-strong { font-weight: 600; }
.ua-type.is-underline { text-decoration: underline; text-underline-offset: 2px; }
.ua-type.is-delete { text-decoration: line-through; color: var(--ua-color-text-muted); }
.ua-type.is-underline.is-delete { text-decoration: underline line-through; }
.ua-type.is-mark {
background: color-mix(in srgb, var(--ua-color-warning) 24%, transparent);
border-radius: var(--ua-radius-sm);
padding: 0 2px;
}
.ua-type.is-code {
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 0.92em;
background: color-mix(in srgb, var(--ua-color-border) 45%, transparent);
border-radius: var(--ua-radius-sm);
padding: 1px var(--ua-space-1);
}
.ua-type.is-center { text-align: center; }
.ua-type.is-right { text-align: right; }
.ua-type.is-clamped {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: var(--ua-type-clamp, 1);
overflow: hidden;
text-overflow: ellipsis;
}
.ua-type-wrap {
display: inline-flex;
align-items: baseline;
gap: var(--ua-space-1);
max-width: 100%;
}
.ua-type-copy {
border: 0;
background: transparent;
color: var(--ua-color-text-muted);
font: inherit;
font-size: var(--ua-font-size-sm);
padding: 0 2px;
border-radius: var(--ua-radius-sm);
cursor: pointer;
transition: color 0.15s ease, background 0.15s ease;
}
.ua-type-copy:hover {
color: var(--ua-color-accent);
background: color-mix(in srgb, var(--ua-color-accent) 10%, transparent);
}
.ua-type-copy.is-ok { color: var(--ua-color-success); }
.ua-type-copybox {
position: fixed;
left: -9999px;
top: 0;
opacity: 0; /* 兼容复制用的离屏文本框,不参与视觉布局 */
pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
.ua-type-copy {
transition: none;
}
}