v1.3.2: 契约第三批 43 份(全量 79/79)+ 令牌导出三格式

契约全量闭环
- 补齐剩余 43 份契约,components/ 现为 79 份契约 JSON(此前 36)
- 批次 A(19):tag/tabs/steps/breadcrumb/dropdown/popconfirm/buttongroup/
  expandabletable/mergedcelltable/summaryrowtable/fixedcolumntable/
  enhancedtabnav/sidemenu/topmenu/mixednavigation/quicknav/anchornav/
  backtotop/pagetransition
- 批次 B(24):bankcardinput/idcardinput/plateinput/listpicker/
  rangequickpicker/dragupload/signaturepad/messagepro/notificationpro/
  progressvariants/skeletonpro/emptypro/loadingoverlay/resultvariants/
  exceptionvariants/confirmmodal/alertmodal/formmodal/fullscreenmodal/
  themeswitcher/layoutswitcher/densityswitcher/shortcutpanel/bottomsheet
- 内容逐字来自规格原文(组件1/2/5/6/7.txt);不发明,规格未明示进
  unknowns、明确排除进 doNotInvent。校验确认 79/79 字段完整、slug 一致
- 此前 43 个扩展组件的 API 靠 extractComponentAPI() 正则启发式,现有契约
  为准、源码扫描兜底

令牌导出(文档清单 C4 项)
- build-site.ps1 构建期产出三种标准格式,与站点展示的令牌同源:
  site/tokens/tokens.css   CSS 自定义属性
  site/tokens/dtcg.json    W3C DTCG($value/$type/$description,按
                           color/typography/spacing/radius/shadow/motion/size 分组)
  site/tokens/figma.json   Figma Tokens(Tokens Studio 可直接导入)
- 设计规范页新增「令牌导出」区,三个文件可下载(HTTP 200 已验)

规格与实现对齐
- 规格色彩系统同步到 v1.3.1 的 AA 达标值(15 处),原值处标注变更原因
  与对比度实测
- 修正一处既有漂移:Rate 选中星色规格 #FAAD14 白底仅 1.90:1,不满足
  WCAG 1.4.11 的 3:1;实现取 #2F54EB,规格已对齐并注明

修复
- build-site.ps1 令牌导出段两处 PowerShell 问题:$themes/$schema 被当变量
  展开导致 Null 键;Write-Output 字符串里的 {} 被当格式占位符

验证
- 站点版本 1.3.2、契约化 79/79、令牌导出 3 文件、静态薄壳 79
- 回归保持 100%:961 断言 / 0 失败 / 36 N/A / 79 页全通过(无回退)
This commit is contained in:
aurora-admin
2026-09-11 14:42:13 +08:00
parent bb4052955c
commit 7c9516011b
57 changed files with 3604 additions and 70 deletions
+73
View File
@@ -242,6 +242,79 @@ $utf8NoBom = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText((Join-Path (Get-Location) "site/data.js"), $js, $utf8NoBom)
[System.IO.File]::WriteAllText((Join-Path (Get-Location) "site/data.json"), $json, $utf8NoBom)
# ---------------- design token export (W3C DTCG + Figma Tokens) ----------------
# Two standard interchange formats so the tokens can be consumed outside this repo
# without hand-copying values. Both are generated here, never edited by hand.
function Get-TokenGroup([string]$name) {
if ($name -match 'color|brand|text|bg|border|success|warning|error|info|mask') { return 'color' }
if ($name -match 'font|type') { return 'typography' }
if ($name -match 'radius') { return 'radius' }
if ($name -match 'space|gap|padding') { return 'spacing' }
if ($name -match 'shadow|elevation') { return 'shadow' }
if ($name -match 'duration|ease|motion') { return 'motion' }
if ($name -match 'size|height|width|icon') { return 'size' }
return 'misc'
}
# W3C Design Tokens Community Group format: nested groups, $value / $type.
$dtcg = [ordered]@{}
foreach ($t in $tokens) {
$g = Get-TokenGroup $t.name
if (-not $dtcg.Contains($g)) { $dtcg[$g] = [ordered]@{} }
$type = switch ($g) {
'color' { 'color' }
'radius' { 'dimension' }
'spacing' { 'dimension' }
'size' { 'dimension' }
'shadow' { 'shadow' }
'typography' { 'fontFamily' }
default { 'other' }
}
$node = [ordered]@{ '$value' = $t.value; '$type' = $type }
if ($t.comment) { $node['$description'] = $t.comment }
$dtcg[$g][$t.name] = $node
}
$dtcgDoc = [ordered]@{
'$schema' = 'https://schemas.design-tokens.org/draft/dtcg.json'
'$metadata' = [ordered]@{ name = 'Aurora Admin'; version = $siteVersion; brand = '#2F54EB'; generated = (Get-Date -Format 'yyyy-MM-dd HH:mm') }
'tokens' = $dtcg
}
New-Item -ItemType Directory -Force -Path "site/tokens" | Out-Null
[System.IO.File]::WriteAllText((Join-Path (Get-Location) "site/tokens/dtcg.json"), (Json-Value $dtcgDoc), $utf8NoBom)
# Figma Tokens (Tokens Studio) format: flat "global" set, value + type + description.
$figmaGlobal = [ordered]@{}
foreach ($t in $tokens) {
$g = Get-TokenGroup $t.name
$ft = switch ($g) {
'color' { 'color' }
'size' { 'sizing' }
'spacing' { 'spacing' }
'radius' { 'borderRadius' }
'shadow' { 'boxShadow' }
default { 'other' }
}
$figmaGlobal[$t.name] = [ordered]@{ value = $t.value; type = $ft; description = $t.comment }
}
$figmaDoc = [ordered]@{
global = $figmaGlobal
'$themes' = @()
'$metadata' = [ordered]@{ tokenSetOrder = @('global') }
}
[System.IO.File]::WriteAllText((Join-Path (Get-Location) "site/tokens/figma.json"), (Json-Value $figmaDoc), $utf8NoBom)
# Plain CSS custom properties — drop-in for any project that just wants the variables.
$cssLines = New-Object System.Text.StringBuilder
[void]$cssLines.AppendLine('/* Aurora Admin design tokens - generated by build-site.ps1 */')
[void]$cssLines.AppendLine(':root {')
foreach ($t in $tokens) {
$note = if ($t.comment) { ' /* ' + $t.comment + ' */' } else { '' }
[void]$cssLines.AppendLine((' --{0}: {1};{2}' -f $t.name, $t.value, $note))
}
[void]$cssLines.AppendLine('}')
[System.IO.File]::WriteAllText((Join-Path (Get-Location) "site/tokens/tokens.css"), $cssLines.ToString(), $utf8NoBom)
Write-Output ("token export: site/tokens/ (dtcg.json + figma.json + tokens.css), {0} tokens" -f $tokens.Count)
# ---------------- static thin shells + sitemap (SEO / crawler entry points) ----------------
# UPDATE $SiteUrlBase after repository deployment (GitHub Pages URL), then rebuild once.
$SiteUrlBase = "https://YOUR-ACCOUNT.github.io/aurora-admin/"