chore: hoist text-measure import in yoga.ts; declare node>=22 engine

Addresses PR #23 review: move the mid-file text-measure import to the
top-level import block, and declare engines.node>=22 to match the
upgraded text stack (cli-truncate@6, slice-ansi@9 require node>=22).
This commit is contained in:
Yunfei He
2026-05-28 17:40:25 +08:00
parent 7b8ed05ef9
commit a5a96fed31
2 changed files with 4 additions and 2 deletions
+3
View File
@@ -46,5 +46,8 @@
},
"peerDependencies": {
"vue": "^3.4.0"
},
"engines": {
"node": ">=22"
}
}
+1 -2
View File
@@ -9,6 +9,7 @@ import type {
TuiText,
TuiTransform,
} from "./nodes.ts";
import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts";
type YogaCarrier = TuiRoot | TuiBox | TuiText | TuiStatic | TuiTransform;
@@ -314,8 +315,6 @@ export function applyYogaProp(node: YogaCarrier, key: string, value: unknown): v
// --- text measure binding ------------------------------------------------
import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts";
export function bindTextMeasure(text: TuiText): void {
text.yoga.setMeasureFunc((availableWidth) => {
const raw = flattenLeaves(text);