docs(runtime): fix host-tag comment drift after tui- prefix rename

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 (<box>/<text> -> <tui-box>/<tui-text>)
- 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) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-14 11:55:48 +08:00
parent ca63a5d04c
commit 3aadf55a3e
5 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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 + `<slot/>` |
| `Text` | template SFC | `<slot/>` + `virtual-text`/`text` branch |
| `Text` | template SFC | `<slot/>` + `tui-virtual-text`/`tui-text` branch |
| `Transform` | **render function (`.ts`)** | inspects children: all-inert children → render nothing |
## Two questions, two idioms
@@ -812,7 +812,7 @@ describe("useBoxMetrics - resize and dynamic layout", () => {
// The template-authored `<Box>` 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
+1 -1
View File
@@ -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. -->
<tui-box v-if="!srHidden && assertBoxValid(props)" v-bind="props">
<tui-text v-if="srEnabled && props.ariaLabel">{{ props.ariaLabel }}</tui-text>
<slot v-else />
@@ -32,10 +32,10 @@ export interface UseBoxMetricsReturn {
/**
* A component whose root is a `v-if`/`v-else` (e.g. the template-authored `<Box>`)
* 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<string, unknown> | null {
const subTree = (instance as { subTree?: unknown })?.subTree;
+1 -1
View File
@@ -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 (`<box>` / `<text>` / …) inside SFC templates compile to raw element
// tags (`<tui-box>` / `<tui-text>` / …) inside SFC templates compile to raw element
// vnodes instead of being resolved as components.
plugins: [
vueJsx(),