Repository navigation
feat(app-kit): 目录大纲迁入 app-kit(解析 + 浮层 + 滚动注入)(#510) - #518
Merged
Merged
Conversation
- lib/outline.ts 的 extractHeadings 与 components/OutlineMenu.tsx 整体搬进 packages/app-kit/src/outline/,搬迁为逐字复制,只有 import 与两处类型声明变化; - OutlineHeading 不再各写一份:以 contracts.ts(#507 已定义)为唯一事实来源, headings.ts 只是再导出; - OutlineMenu 增加可选的 navigator?: OutlineNavigator —— 提供时优先走注入实现, 不提供则沿用原有 CM6 / 预览 DOM 分支,行为零变化;Electron 侧可注入自己的编辑器; - EditorMode 不跨包引用 web 的组件模块,app-kit 按同一值集合声明 OutlineMode; - exports 逐条枚举 ./outline、./outline/headings、./outline/OutlineMenu(该目录含 .tsx, *.ts 通配匹配不到); - apps/web/src/index.css 增加 @source 指向 packages/app-kit/src/outline:Tailwind v4 默认只扫 apps/web,组件搬家后 w-60 / backdrop-blur-xl 等 utility 会静默不生成; - v2-outline e2e 增加计算样式断言(浮层宽度 = 240px),避免「元素在但样式塌了」的假绿; - 老位置退化为 re-export 垫片,App.tsx 未动,接线留在 #511。 单测:renderer 121 / editor 957 / app-kit 14 / web 416 全绿;typecheck、lint、build 通过。 refs #510
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更概述
目录大纲(解析 + 浮层组件)迁入
@md-bundle/app-kit/outline,滚动抽象成可注入接口;web 老路径退化为 re-export 垫片,用户可见行为零变化。关联 Issue
fixes #510
变更内容
packages/app-kit(新增src/outline/)、apps/web/src(2 个文件退化垫片 + Tailwind 源扫描)、apps/web/test(大纲 e2e 加计算样式断言)packages/app-kit/src/outline/{headings,types,OutlineMenu,index}.ts(x)apps/web/src/lib/outline.ts、apps/web/src/components/OutlineMenu.tsxpackages/app-kit/package.json:exports增加./outline/./outline/headings/./outline/OutlineMenu(逐条枚举——该目录含.tsx,*.ts通配匹配不到)apps/web/src/index.css:@source '../../../packages/app-kit/src/outline'apps/web/test/v2-outline.spec.ts:浮层计算宽度断言extractHeadings与OutlineMenu是逐字搬运(机械 diff:组件仅 import 3 行 +mode类型 2 处 + 新增navigator字段/注入分支/依赖数组;解析函数仅 import 与 interface 两处)。OutlineHeading不再各写一份:以contracts.ts([change=app-kit/1] 新建 @md-bundle/app-kit 包骨架与契约 #507 起即为契约源)为准,headings.ts只再导出。OutlineMenu新增可选navigator?: OutlineNavigator:给了就走注入实现,没给走原有 CM6 / 预览 DOM 分支。原来的CM6ViewLike本来就是本地结构化声明(没有 import@codemirror/view),保持原样不动。OutlineMode按同一值集合在 app-kit 声明一次,避免反向依赖apps/web的Toolbar。影响范围
@md-bundle/app-kit新增 3 个 outline 入口;OutlineMenuProps只多一个可选字段;extractHeadings签名与返回形状不变。App.tsx未改动,仍从./components/OutlineMenu拿组件,[change=app-kit/5] 剪贴板能力加 seam(copyImage 可注入) #511 的接线位置未被抢占。packages/后若不声明@source,w-60/backdrop-blur-xl会静默不生成,浮层样式塌掉而测试全绿。已加@source并用计算样式断言锁死。验证方式与结果
pnpm -r typecheck— 4 个包全 Donepnpm -r lint— 0 errors(2 + 1 条既有 warning)pnpm -r test— renderer 121 / editor 957 / app-kit 14 / web 416pnpm -r build— 全 Done(web dist 4.87s)playwright test test/v2-outline.spec.ts test/v2-outline-multitab.spec.ts --retries=0— 15 passedVISUAL=1 playwright test test/visual-baseline.spec.ts— 8 passed#不泄漏;长文档 40 项,点击第 40 项.cm-scroller从 0 滚到 9821.36px 且该项变outline-current;浮层计算宽度 240px、backdrop-filter为blur(24px)(证明 Tailwind 类仍生成)QG-5 验证基于 e1be5d4)质量门禁引用
v2-outline*两个 e2e,不能只交单测。v2-outline.spec.ts补断言,而不是标no-ui-impact跳过。App.tsx、不删垫片。getComputedStyle(menu).width === '240px')而不是「元素存在」;组件搬迁最容易的失败模式就是「元素在、样式没了」,只断言可见性会假绿。e1be5d4。pnpm -r build+ 真实浏览器打开(bsk 探针即「用户现在能看到的」记录)。已知缺口
scrollToDomId(id)与contracts.ts既有的scrollToHeading(id)是同一能力;以契约为准,未改名(改一个已发布类型名只为一个措辞不划算)。风险评估
risk-lowai-generatedgit revert <merge-commit>即可回滚(纯位置搬迁 + 垫片)