1/* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15/** 16 * @file 17 * @kit ArkUI 18 * @arkts 1.2 19 */ 20 21 22// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! 23 24import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from './../stateManagement/runtime' 25import { ResourceColor, Length, ResourceStr } from './units' 26import { SelectionOptions } from './common' 27import { TextDecorationType, TextDecorationStyle } from './enums' 28export enum TextDataDetectorType { 29 PHONE_NUMBER = 0, 30 URL = 1, 31 EMAIL = 2, 32 ADDRESS = 3, 33 DATE_TIME = 4 34} 35export interface TextDataDetectorConfig { 36 types: Array<TextDataDetectorType>; 37 onDetectResultUpdate?: ((breakpoints: string) => void); 38 color?: ResourceColor; 39} 40export interface TextRange { 41 start?: number; 42 end?: number; 43} 44export interface InsertValue { 45 insertOffset: number; 46 insertValue: string; 47} 48export enum TextDeleteDirection { 49 BACKWARD = 0, 50 FORWARD = 1 51} 52export enum MenuType { 53 SELECTION_MENU = 0, 54 PREVIEW_MENU = 1 55} 56export interface DeleteValue { 57 deleteOffset: number; 58 direction: TextDeleteDirection; 59 deleteValue: string; 60} 61export type OnDidChangeCallback = (rangeBefore: TextRange, rangeAfter: TextRange) => void; 62export type EditableTextOnChangeCallback = (value: string, previewText?: PreviewText) => void; 63export interface TextBaseController { 64 setSelection(selectionStart: number, selectionEnd: number, options?: SelectionOptions): void 65 closeSelectionMenu(): void 66 getLayoutManager(): LayoutManager 67} 68export interface TextEditControllerEx extends TextBaseController { 69 isEditing(): boolean 70 stopEditing(): void 71 setCaretOffset(offset: number): boolean 72 getCaretOffset(): number 73 getPreviewText(): PreviewText 74} 75 76export type Callback_StyledStringChangeValue_Boolean = (parameter: StyledStringChangeValue) => boolean; 77export interface StyledStringChangedListener { 78 onWillChange?: ((parameter: StyledStringChangeValue) => boolean); 79 onDidChange?: OnDidChangeCallback; 80} 81export interface StyledStringChangeValue { 82 range: TextRange; 83} 84export interface LayoutManager { 85 getLineCount(): number 86 getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity 87} 88export interface PositionWithAffinity { 89 position: number; 90} 91export interface CaretStyle { 92 width?: Length; 93 color?: ResourceColor; 94} 95export interface TextMenuItemId { 96 of(id: ResourceStr): TextMenuItemId 97 equals(id: TextMenuItemId): boolean 98} 99export interface PreviewText { 100 offset: number; 101 value: string; 102} 103export interface TextMenuItem { 104 content: ResourceStr; 105 icon?: ResourceStr; 106 id: TextMenuItemId; 107} 108export interface EditMenuOptions { 109 onCreateMenu(menuItems: Array<TextMenuItem>): Array<TextMenuItem> 110 onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean 111} 112export interface DecorationStyleResult { 113 type: TextDecorationType; 114 color: ResourceColor; 115 style?: TextDecorationStyle; 116} 117export interface FontSettingOptions { 118 enableVariableFontWeight?: boolean; 119}