UNPKG

@pmndrs/uikit

Version:

Build performant 3D user interfaces with Three.js and yoga.

50 lines (49 loc) 3.19 kB
import { Signal } from '@preact/signals-core'; import { Matrix4, Vector2Tuple } from 'three'; import { ClippingRect } from '../../clipping.js'; import { ColorRepresentation, alignmentXMap, alignmentYMap } from '../../utils.js'; import { GlyphGroupManager, InstancedGlyphGroup } from './instanced-glyph-group.js'; import { GlyphLayout, GlyphLayoutProperties } from '../layout.js'; import { SelectionTransformation } from '../../selection.js'; import { OrderInfo } from '../../order.js'; import { Font } from '../font.js'; import { MergedProperties } from '../../properties/index.js'; import { FlexNode, FlexNodeState } from '../../flex/index.js'; import { CaretTransformation } from '../../caret.js'; export type TextAlignProperties = { textAlign?: keyof typeof alignmentXMap | 'block'; verticalAlign?: keyof typeof alignmentYMap; }; export type TextAppearanceProperties = { color?: ColorRepresentation; opacity?: number; }; export declare function createInstancedText(properties: Signal<MergedProperties>, textSignal: Signal<unknown | Signal<unknown> | Array<unknown | Signal<unknown>>>, matrix: Signal<Matrix4 | undefined>, node: Signal<FlexNode | undefined>, flexState: FlexNodeState, isVisible: Signal<boolean>, parentClippingRect: Signal<ClippingRect | undefined> | undefined, orderInfo: Signal<OrderInfo | undefined>, fontSignal: Signal<Font | undefined>, glyphGroupManager: GlyphGroupManager, selectionRange: Signal<Vector2Tuple | undefined> | undefined, selectionTransformations: Signal<Array<SelectionTransformation>> | undefined, caretTransformation: Signal<CaretTransformation | undefined> | undefined, instancedTextRef: { current?: InstancedText; } | undefined, defaultWordBreak: GlyphLayoutProperties['wordBreak'], abortSignal: AbortSignal): import("@preact/signals-core").ReadonlySignal<import("../../internals.js").CustomLayouting | undefined>; export declare class InstancedText { private group; private textAlign; private verticalAlign; private color; private opacity; private layoutSignal; private matrix; private parentClippingRect; private selectionRange; private selectionTransformations; private caretTransformation; private glyphLines; private lastLayout; private unsubscribeInitialList; private unsubscribeShowList; constructor(group: InstancedGlyphGroup, textAlign: Signal<keyof typeof alignmentXMap | 'block'>, verticalAlign: Signal<keyof typeof alignmentYMap>, color: Signal<ColorRepresentation>, opacity: Signal<number>, layoutSignal: Signal<GlyphLayout | undefined>, matrix: Signal<Matrix4 | undefined>, isVisible: Signal<boolean>, parentClippingRect: Signal<ClippingRect | undefined> | undefined, selectionRange: Signal<Vector2Tuple | undefined> | undefined, selectionTransformations: Signal<Array<SelectionTransformation>> | undefined, caretTransformation: Signal<CaretTransformation | undefined> | undefined); getCharIndex(x: number, y: number, position: 'between' | 'on'): number; private updateSelectionBoxes; private computeSelectionTransformation; private getGlyphLineAndX; private getGlyphX; private show; private hide; destroy(): void; }