Skip to content

item 19 — screen-reader 纯文本渲染 (无 ANSI 装饰) + 装饰 char 替换 (CC 2.1.208, §664) #109

Closed

Description

@dahai80

背景

enhance-0819.md P4.1 item 19。PR #86 (commit 85d0f66, 已合) 落入口点对齐 (--ax-screen-reader / FUSION_AX_SCREEN_READER / settings.axScreenReader → prefersReducedMotion)。剩余 gap (spec §664): "Ink 纯文本渲染 (无 ANSI 装饰), 删除宣告" — 现状 prefersReducedMotion 仅 gate 动画, 不剥离 ANSI 颜色/装饰, 不替换 Unicode 装饰 char。

落地

用户选 scope "中等: ANSI 剥离 + 装饰 char 替换"。

  1. ANSI 剥离 — src/ink/colorize.ts in-function gate: colorize() + applyTextStyles() 在 screenReaderAnsiGateActive 时返 raw string (零 ANSI)。module-load 读 getInitialSettings().prefersReducedMotion, export applyScreenReaderAnsiGate() 供运行时切换。in-function (非 global chalk.level=0) — 不波及非 Ink chalk (telemetry/日志/markdown.ts)。
  2. 装饰 char 替换 — src/constants/figures.ts getFigures() lazy factory: 首次调用读 prefersReducedMotion, 返 frozen Unicode 集 (default, 与现常量 byte-identical) 或 ASCII 降级集。保留现 export const (未迁移消费方 default-off 不变)。
  3. 迁移消费方 — Spinner.tsx (reducedMotion 静态点 ●→fig.BLACK_CIRCLE, default 保 ● byte-identical) + EffortIndicator.ts (EFFORT_* → fig.EFFORT_*)。
  4. inline box-drawing — ContextVisualization.tsx (12 └ tree branch → TREE_BRANCH 常量, - ASCII) + MarkdownTable.tsx (边框对象 + │/─ literal → BORDERS/VBAR/HBAR ASCII)。

default-off = byte-identical 现行为。3 新 test 文件 (colorize gate / figures factory / decor render)。30 figures 消费方 + figures npm pkg + Divider/Doctor/Passes 等 inline box-drawing defer (阶段化, 记 PR doc)。

验证

typecheck 0 / 新单测 + 全测无回归 / biome / build + build:dev:full / 手工 FUSION_AX_SCREEN_READER=1 零 ANSI + default byte-identical。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions