K + I + S 约束:SSG + Theme Island + aria-current 导航
K·I·S·S 约束如何强制执行 Jamstack 原则...
声明式 Shadow DOM 解决了封装性与可访问性之间的两难...
| 约束 | 验证 | 实现 |
|---|---|---|
| K — Knowledge | ✓ 内容在构建时已知 | SSG + DSD 输出 |
| I — Isolated | ✓ Theme Island | Shadow DOM + localStorage |
| S — Semantic | ✓ aria-current 导航 | L0 HTML + L1 CSS(非 Island) |
| S — Static | ✓ 纯静态文件 | dist/ 部署到 CDN |
导航高亮 → aria-current + CSS (L0+L1, 非 Island)
主题切换 → Island + localStorage (L4, 合法 Island)
为什么主题切换是 Island?
- 需要 localStorage API(L2)
- 需要跨 Shadow DOM 通信(L4)
- 无法用纯 CSS 实现