From 3aadf55a3e8cef7d16d3ede03599a3c3aec9367b Mon Sep 17 00:00:00 2001 From: Yunfei He Date: Sun, 14 Jun 2026 11:55:48 +0800 Subject: [PATCH] docs(runtime): fix host-tag comment drift after tui- prefix rename MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adversarial review found stale bare-host-tag references the per-file sed couldn't reach (they live in comments/docs). Code was clean — no contamination, no public API leakage, root/text-leaf/comment asymmetry consistent. Updated: - vite.config.ts isCustomElement comment (/ -> /) - component-authoring.md split-table Text row (virtual-text/text -> tui-*) - box.vue / useBoxMetrics.ts / use-box-metrics.test.tsx "the real `box` host node" comments -> `tui-box` Co-Authored-By: Claude Opus 4.8 (1M context) --- .agents/docs/component-authoring.md | 2 +- .../integration/composables/use-box-metrics.test.tsx | 2 +- packages/runtime/src/components/box.vue | 2 +- packages/runtime/src/composables/useBoxMetrics.ts | 4 ++-- packages/runtime/vite.config.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.agents/docs/component-authoring.md b/.agents/docs/component-authoring.md index b040da6..7def710 100644 --- a/.agents/docs/component-authoring.md +++ b/.agents/docs/component-authoring.md @@ -19,7 +19,7 @@ not a reason to abandon the template. Two of the fixes also corrected latent inc | `Newline` | template SFC | `"\n".repeat(count)` interpolation + a context branch | | `Static` | template SFC | reactive cursor + `v-for` scoped slot | | `Box` | template SFC | root `v-if` validation guard + `` | -| `Text` | template SFC | `` + `virtual-text`/`text` branch | +| `Text` | template SFC | `` + `tui-virtual-text`/`tui-text` branch | | `Transform` | **render function (`.ts`)** | inspects children: all-inert children → render nothing | ## Two questions, two idioms diff --git a/packages/runtime-tests/integration/composables/use-box-metrics.test.tsx b/packages/runtime-tests/integration/composables/use-box-metrics.test.tsx index 6ca9acb..6b3a738 100644 --- a/packages/runtime-tests/integration/composables/use-box-metrics.test.tsx +++ b/packages/runtime-tests/integration/composables/use-box-metrics.test.tsx @@ -812,7 +812,7 @@ describe("useBoxMetrics - resize and dynamic layout", () => { // The template-authored `` SFC has a root `v-if`, so it renders as a Vue // Fragment whose `$el` is the fragment's BOUNDARY anchor (an empty `text-leaf` -// with no `.yoga`), NOT the real `box` host node. Resolving a ref to that anchor +// with no `.yoga`), NOT the real `tui-box` host node. Resolving a ref to that anchor // would collapse metrics to 0 — or, worse, drill the wrong node. The subTree // drill in useBoxMetrics (commit 801739d) walks the component's vnode subTree to // the first genuine host node. These tests guard the tricky drill cases the diff --git a/packages/runtime/src/components/box.vue b/packages/runtime/src/components/box.vue index eb9f02d..a662734 100644 --- a/packages/runtime/src/components/box.vue +++ b/packages/runtime/src/components/box.vue @@ -21,7 +21,7 @@ const srHidden = computed(() => srEnabled.value && props.ariaHidden); Box is screen-reader-hidden (mirrors box.ts ordering: a non-emitted node never colorizes). Under a screen reader with an ariaLabel, render the label text instead of the slot. The root `v-if` makes this a fragment, but $el still - resolves to the real `box` host node, so measureElement/useBoxMetrics work. --> + resolves to the real `tui-box` host node, so measureElement/useBoxMetrics work. --> {{ props.ariaLabel }} diff --git a/packages/runtime/src/composables/useBoxMetrics.ts b/packages/runtime/src/composables/useBoxMetrics.ts index 48e1908..5939dd1 100644 --- a/packages/runtime/src/composables/useBoxMetrics.ts +++ b/packages/runtime/src/composables/useBoxMetrics.ts @@ -32,10 +32,10 @@ export interface UseBoxMetricsReturn { /** * A component whose root is a `v-if`/`v-else` (e.g. the template-authored ``) * renders as a Vue Fragment, so its `$el` resolves to the fragment's BOUNDARY anchor - * (an empty `text-leaf`), NOT the real `box` host node. The actual host node lives in + * (an empty `text-leaf`), NOT the real `tui-box` host node. The actual host node lives in * the component's `subTree`. Walk that vnode tree to the first `el` that is a genuine * host node — skipping the comment and empty-`text-leaf` anchors a fragment inserts — - * so a ref to a fragment-rooted Box still resolves to its `box` host node. + * so a ref to a fragment-rooted Box still resolves to its `tui-box` host node. */ function hostElFromSubTree(instance: unknown): Record | null { const subTree = (instance as { subTree?: unknown })?.subTree; diff --git a/packages/runtime/vite.config.ts b/packages/runtime/vite.config.ts index 5f762e8..37cbec5 100644 --- a/packages/runtime/vite.config.ts +++ b/packages/runtime/vite.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ // `VueVite` parses `.vue` SFCs in the TEST/dev graph (unit tests may import the // .vue components directly, e.g. host/text-measure.test.ts). The `pack` build has // its own `Vue` rolldown plugin below; both need `isCustomElement` so the host - // tags (`` / `` / …) inside SFC templates compile to raw element + // tags (`` / `` / …) inside SFC templates compile to raw element // vnodes instead of being resolved as components. plugins: [ vueJsx(),