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:
@@ -46,5 +46,8 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"vue": "^3.4.0"
|
"vue": "^3.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=22"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
TuiText,
|
TuiText,
|
||||||
TuiTransform,
|
TuiTransform,
|
||||||
} from "./nodes.ts";
|
} from "./nodes.ts";
|
||||||
|
import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts";
|
||||||
|
|
||||||
type YogaCarrier = TuiRoot | TuiBox | TuiText | TuiStatic | TuiTransform;
|
type YogaCarrier = TuiRoot | TuiBox | TuiText | TuiStatic | TuiTransform;
|
||||||
|
|
||||||
@@ -314,8 +315,6 @@ export function applyYogaProp(node: YogaCarrier, key: string, value: unknown): v
|
|||||||
|
|
||||||
// --- text measure binding ------------------------------------------------
|
// --- text measure binding ------------------------------------------------
|
||||||
|
|
||||||
import { flattenLeaves, measureTextNatural, wrapText } from "./text-measure.ts";
|
|
||||||
|
|
||||||
export function bindTextMeasure(text: TuiText): void {
|
export function bindTextMeasure(text: TuiText): void {
|
||||||
text.yoga.setMeasureFunc((availableWidth) => {
|
text.yoga.setMeasureFunc((availableWidth) => {
|
||||||
const raw = flattenLeaves(text);
|
const raw = flattenLeaves(text);
|
||||||
|
|||||||
Reference in New Issue
Block a user