完成70%

This commit is contained in:
2026-07-24 07:56:22 +08:00
parent bb6431b319
commit c7f278fe79
92 changed files with 4741 additions and 14440 deletions
+28 -21
View File
@@ -1,32 +1,39 @@
$ErrorActionPreference = 'Stop'
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$component = Get-Content -LiteralPath (Join-Path $root 'components/TacVerification.vue') -Raw -Encoding UTF8
foreach ($token in @(
'v-show="visible"', 'id="jiapu-tac-dialog"', 'role="dialog"', 'aria-modal="true"',
'tabindex="-1"', 'aria-labelledby="jiapu-tac-title"',
'aria-describedby="jiapu-tac-description"', '@keydown.esc.stop.prevent="requestCancel"',
'class="tac-tool tac-tool--refresh"', 'aria-label="刷新安全验证"',
'class="tac-tool tac-tool--close"', 'aria-label="关闭安全验证"',
'const previousFocus = document.activeElement', 'activateFocusTrap()',
'deactivateFocusTrap(', 'event.key !== "Tab"', 'previousFocus?.focus?.()',
':deep(.slider-bottom .close-btn)', ':deep(.slider-bottom .refresh-btn)',
'min-width: 48px;', 'min-height: 48px;'
'v-show="visible"',
'id="jiapu-tac-host"',
':prop="renderContext"',
':change:prop="tacRenderer.onContextChange"',
'btnCloseFun:',
'btnRefreshFun:',
'this.tac = new window.TAC(config);'
)) {
if (-not $component.Contains($token)) { throw "TAC 外壳无障碍预检缺少:$token" }
if (-not $component.Contains($token)) { throw "Missing native TAC shell token: $token" }
}
$logicalScript = [regex]::Match($component, '(?s)<script>(?<Body>.*?)</script>').Groups['Body'].Value
foreach ($browserOnly in @('document.', 'window.', 'querySelector(')) {
if ($logicalScript.Contains($browserOnly)) {
throw "TAC 逻辑层不得访问浏览器专属对象:$browserOnly"
}
foreach ($forbidden in @(
'tac-panel',
'tac-heading',
'tac-tool',
'slider-bottom .close-btn',
'slider-bottom .refresh-btn',
'logoUrl:',
'i18n:',
'new window.TAC(config, {'
)) {
if ($component.Contains($forbidden)) { throw "TAC overrides vendor rendering: $forbidden" }
}
$toolButtons = [regex]::Matches($component, '(?s)<button\b[^>]*class="[^"]*tac-tool\b')
if ($toolButtons.Count -lt 2) { throw 'TAC 外壳至少要有刷新与关闭两个原生操作' }
if ([regex]::Matches($component, 'class="tac-tool tac-tool--refresh"').Count -ne 1) { throw 'TAC 刷新操作必须有唯一 owner' }
if ([regex]::Matches($component, 'class="tac-tool tac-tool--close"').Count -ne 1) { throw 'TAC 关闭操作必须有唯一 owner' }
$styleStart = $component.IndexOf('<style scoped>')
if ($styleStart -lt 0) { throw 'Missing minimal TAC mount style' }
$style = $component.Substring($styleStart)
$visualTokens = @('background:', 'border:', 'border-radius:', 'box-shadow:', 'color:', 'font-', 'padding:', 'opacity:', 'transition:')
foreach ($forbidden in $visualTokens) {
if ($style.Contains($forbidden)) { throw "TAC mount adds visual styling: $forbidden" }
}
Write-Output 'TAC-SHELL-ACCESSIBILITY-CONTRACT PASS'
Write-Output 'TAC-VENDOR-NATIVE-SHELL-CONTRACT PASS'