diff --git a/api/@internal/component/ets/text.d.ts b/api/@internal/component/ets/text.d.ts index 2b0b4ee1443d53316ff5a937caff9141bab13775..82ea550d6c0b03f655108de046bcb7c0098c3a35 100644 --- a/api/@internal/component/ets/text.d.ts +++ b/api/@internal/component/ets/text.d.ts @@ -18,16 +18,6 @@ * @kit ArkUI */ -/*** if arkts 1.2 */ -import { CommonMethod, ShadowOptions,Optional,Callback} from "./common"; -import { CustomBuilder } from './builder' -import { EllipsisMode, TextCase, LineBreakStrategy, TextAlign, FontStyle, FontWeight, WordBreak, TextOverflow, CopyOptions, TextHeightAdaptivePolicy, TextSelectableMode} from './enums'; -import { Resource, ResourceColor, Font, Length, LengthMetrics } from './units'; -import { TextDataDetectorConfig, LayoutManager, FontSettingOptions, EditMenuOptions } from "./textCommon"; -import { DecorationStyleInterface, StyledString } from "./styledString"; -import { SelectionMenuOptions } from './richEditor' -/*** endif */ - /** * Text overflow options. * @@ -37,8 +27,7 @@ import { SelectionMenuOptions } from './richEditor' * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ declare interface TextOverflowOptions { /** @@ -85,8 +74,7 @@ declare interface TextOverflowOptions { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ overflow: TextOverflow; } @@ -123,8 +111,7 @@ declare interface TextOverflowOptions { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ interface TextInterface { /** @@ -167,8 +154,7 @@ interface TextInterface { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ (content?: string | Resource, value?: TextOptions): TextAttribute; } @@ -197,8 +183,7 @@ interface TextInterface { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ declare class TextAttribute extends CommonMethod { /** @@ -236,8 +221,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ font(fontValue: Font, options?: FontSettingOptions): TextAttribute; @@ -277,8 +261,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ fontColor(value: ResourceColor): TextAttribute; @@ -322,8 +305,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ fontSize(value: number | string | Resource): TextAttribute; @@ -375,8 +357,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ minFontSize(value: number | string | Resource): TextAttribute; @@ -428,8 +409,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ maxFontSize(value: number | string | Resource): TextAttribute; @@ -465,7 +445,6 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @atomicservice * @since 20 - * @arkts 1.1&1.2 */ minFontScale(scale: number | Resource): TextAttribute; @@ -499,7 +478,6 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @atomicservice * @since 20 - * @arkts 1.1&1.2 */ maxFontScale(scale: number | Resource): TextAttribute; @@ -539,8 +517,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ fontStyle(value: FontStyle): TextAttribute; @@ -604,21 +581,6 @@ declare class TextAttribute extends CommonMethod { */ fontWeight(value: number | FontWeight | ResourceStr): TextAttribute; - /** - * Called when the font weight is set. - * - * @param { number | FontWeight | string } weight - * @param { FontSettingOptions } options - font setting options. - * @returns { TextAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @form - * @atomicservice - * @arkts 1.2 - * @since 20 - */ - fontWeight(weight: number | FontWeight | string, options?: FontSettingOptions): TextAttribute; - /** * Called when the font weight is set. * @@ -666,8 +628,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ lineSpacing(value: LengthMetrics): TextAttribute; @@ -732,8 +693,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ textAlign(value: TextAlign): TextAttribute; @@ -791,8 +751,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ lineHeight(value: number | string | Resource): TextAttribute; @@ -860,8 +819,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ textOverflow(options: TextOverflowOptions): TextAttribute; @@ -907,8 +865,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ fontFamily(value: string | Resource): TextAttribute; @@ -954,8 +911,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ maxLines(value: number): TextAttribute; @@ -1010,8 +966,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ decoration(value: DecorationStyleInterface): TextAttribute; @@ -1072,20 +1027,6 @@ declare class TextAttribute extends CommonMethod { * @since 20 */ letterSpacing(value: number | ResourceStr): TextAttribute; - - /** - * Called when the distance between text fonts is set. - * - * @param { number | string } value - * @returns { TextAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @form - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - letterSpacing(value: number | string): TextAttribute; /** * Called when the type of letter in the text font is set. @@ -1123,8 +1064,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ textCase(value: TextCase): TextAttribute; @@ -1183,20 +1123,6 @@ declare class TextAttribute extends CommonMethod { * @since 20 */ baselineOffset(value: number | ResourceStr): TextAttribute; - - /** - * Called when the baseline offset is set. - * - * @param { number | string } value - * @returns { TextAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @form - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - baselineOffset(value: number | string): TextAttribute; /** * Allow replication. @@ -1232,8 +1158,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ copyOption(value: CopyOptions): TextAttribute; @@ -1269,8 +1194,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ draggable(value: boolean): TextAttribute; @@ -1297,8 +1221,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ textShadow(value: ShadowOptions | Array): TextAttribute; @@ -1339,8 +1262,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ heightAdaptivePolicy(value: TextHeightAdaptivePolicy): TextAttribute; @@ -1361,8 +1283,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ textIndent(value: Length): TextAttribute; @@ -1379,8 +1300,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ wordBreak(value: WordBreak): TextAttribute; @@ -1397,8 +1317,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ lineBreakStrategy(strategy: LineBreakStrategy): TextAttribute; @@ -1411,8 +1330,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ onCopy(callback: (value: string) => void): TextAttribute; @@ -1437,8 +1355,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'11', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 11 */ selection(selectionStart: number, selectionEnd: number): TextAttribute; @@ -1450,8 +1367,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ caretColor(color: ResourceColor): TextAttribute; @@ -1463,8 +1379,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ selectedBackgroundColor(color: ResourceColor): TextAttribute; @@ -1503,8 +1418,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ ellipsisMode(value: EllipsisMode): TextAttribute; @@ -1545,8 +1459,7 @@ declare class TextAttribute extends CommonMethod { * @returns { TextAttribute } The attribute of the text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ enableDataDetector(enable: boolean): TextAttribute; @@ -1577,8 +1490,7 @@ declare class TextAttribute extends CommonMethod { * @returns { TextAttribute } The attribute of the text. * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ dataDetectorConfig(config: TextDataDetectorConfig): TextAttribute; @@ -1612,8 +1524,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ bindSelectionMenu(spanType: TextSpanType, content: CustomBuilder, responseType: TextResponseType, options?: SelectionMenuOptions): TextAttribute; @@ -1635,8 +1546,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ onTextSelectionChange(callback: (selectionStart: number, selectionEnd: number) => void): TextAttribute; @@ -1653,8 +1563,7 @@ declare class TextAttribute extends CommonMethod { * @crossplatform * @form * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ fontFeature(value: string): TextAttribute; @@ -1666,8 +1575,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ marqueeOptions(options: Optional): TextAttribute; @@ -1679,8 +1587,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ onMarqueeStateChange(callback: Callback): TextAttribute; @@ -1698,8 +1605,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @form * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ privacySensitive(supported: boolean): TextAttribute; @@ -1711,8 +1617,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ textSelectable(mode: TextSelectableMode): TextAttribute; @@ -1726,8 +1631,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ editMenuOptions(editMenu: EditMenuOptions): TextAttribute; @@ -1744,8 +1648,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ halfLeading(halfLeading: boolean): TextAttribute; @@ -1757,8 +1660,7 @@ declare class TextAttribute extends CommonMethod { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'13', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 */ enableHapticFeedback(isEnabled: boolean): TextAttribute; @@ -1888,8 +1790,7 @@ declare const Text: TextInterface; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare enum TextSpanType { /** @@ -1905,8 +1806,7 @@ declare enum TextSpanType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ TEXT = 0, @@ -1923,8 +1823,7 @@ declare enum TextSpanType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ IMAGE = 1, @@ -1941,8 +1840,7 @@ declare enum TextSpanType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ MIXED = 2, @@ -1954,8 +1852,7 @@ declare enum TextSpanType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'15', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ DEFAULT = 3, } @@ -1986,8 +1883,7 @@ declare enum TextSpanType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare enum TextResponseType { /** @@ -2003,8 +1899,7 @@ declare enum TextResponseType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ RIGHT_CLICK = 0, @@ -2021,8 +1916,7 @@ declare enum TextResponseType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ LONG_PRESS = 1, @@ -2039,8 +1933,7 @@ declare enum TextResponseType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ SELECT = 2, @@ -2052,8 +1945,7 @@ declare enum TextResponseType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'15', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 15 */ DEFAULT = 3, } @@ -2065,8 +1957,7 @@ declare enum TextResponseType { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ declare enum MarqueeState { /** @@ -2075,8 +1966,7 @@ declare enum MarqueeState { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ START = 0, @@ -2086,8 +1976,7 @@ declare enum MarqueeState { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ BOUNCE = 1, @@ -2097,8 +1986,7 @@ declare enum MarqueeState { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ FINISH = 2, } @@ -2110,8 +1998,7 @@ declare enum MarqueeState { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ declare enum MarqueeStartPolicy { /** @@ -2120,8 +2007,7 @@ declare enum MarqueeStartPolicy { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ DEFAULT = 0, @@ -2131,8 +2017,7 @@ declare enum MarqueeStartPolicy { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ ON_FOCUS = 1, } @@ -2152,8 +2037,7 @@ declare enum MarqueeStartPolicy { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare interface TextOptions { /** @@ -2171,8 +2055,7 @@ declare interface TextOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ controller: TextController; } @@ -2184,8 +2067,7 @@ declare interface TextOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ declare interface TextMarqueeOptions { /** @@ -2195,8 +2077,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ start: boolean; @@ -2207,8 +2088,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ step?: number; @@ -2219,8 +2099,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ loop?: number; @@ -2231,8 +2110,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ fromStart?: boolean; @@ -2243,8 +2121,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ delay?: number; @@ -2255,8 +2132,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ fadeout?: boolean; @@ -2267,8 +2143,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ marqueeStartPolicy?: MarqueeStartPolicy; } @@ -2286,8 +2161,7 @@ declare interface TextMarqueeOptions { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare class TextController { /** @@ -2303,8 +2177,7 @@ declare class TextController { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ closeSelectionMenu(): void; @@ -2319,8 +2192,7 @@ declare class TextController { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ setStyledString(value: StyledString): void; @@ -2331,8 +2203,7 @@ declare class TextController { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ getLayoutManager(): LayoutManager; } diff --git a/api/arkui/component/text.d.ets b/api/arkui/component/text.d.ets deleted file mode 100644 index bc4bcc9993a20446cb6fc6494e2c92d6cefad66c..0000000000000000000000000000000000000000 --- a/api/arkui/component/text.d.ets +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2024-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * @file - * @kit ArkUI - * @arkts 1.2 - */ - - -// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! - -import { TextOverflow, HitTestMode, ImageSize, Alignment, BorderStyle, ColoringStrategy, HoverEffect, Color, Visibility, ItemAlign, Direction, GradientDirection, ObscuredReasons, RenderFit, ImageRepeat, Axis, ResponseType, FunctionKey, ModifierKey, FontStyle, FontWeight, TextAlign, TextCase, CopyOptions, TextHeightAdaptivePolicy, WordBreak, LineBreakStrategy, EllipsisMode, TextSelectableMode } from './enums' -import { memo, ComponentBuilder, __memo_context_type, __memo_id_type } from './../stateManagement/runtime' -import { Resource } from './../../../api/global/resource' -import { CommonMethod, DrawModifier, Rectangle, Callback_Array_TouchTestInfo_TouchResult, TouchTestInfo, TouchResult, PixelRoundPolicy, BackgroundEffectOptions, ForegroundEffectOptions, BorderImageOption, OutlineStyle, Callback_ClickEvent_Void, ClickEvent, Callback_Boolean_HoverEvent_Void, HoverEvent, AccessibilityCallback, Callback_MouseEvent_Void, MouseEvent, Callback_TouchEvent_Void, TouchEvent, Callback_KeyEvent_Void, KeyEvent, Callback_KeyEvent_Boolean, AnimateParam, TransitionOptions, TransitionEffect, MotionBlurOptions, InvertOptions, TranslateOptions, ScaleOptions, RotateOptions, Callback_Area_Area_Void, Literal_Union_Number_Literal_Number_offset_span_lg_md_sm_xs, Literal_Number_offset_span, AlignRuleOption, LocalizedAlignRuleOptions, ClickEffect, Callback_DragEvent_String_Union_CustomBuilder_DragItemInfo, DragEvent, CustomBuilder, DragItemInfo, Callback_DragEvent_String_Void, Callback_PreDragStatus_Void, PreDragStatus, Type_CommonMethod_linearGradient_value, Tuple_ResourceColor_Number, Type_CommonMethod_sweepGradient_value, Tuple_Length_Length, Type_CommonMethod_radialGradient_value, MotionPathOptions, ShadowOptions, ShadowStyle, ProgressMask, StateStyles, PixelStretchEffectOptions, AttributeModifier, GestureModifier, BackgroundBrightnessOptions, Callback_GestureInfo_BaseGestureEvent_GestureJudgeResult, GestureRecognizerJudgeBeginCallback, ShouldBuiltInRecognizerParallelWithCallback, Callback_TouchEvent_HitTestMode, SizeChangeCallback, SafeAreaType, SafeAreaEdge, Literal_Alignment_align, BlurStyle, BackgroundBlurStyleOptions, ForegroundBlurStyleOptions, TransitionFinishCallback, BlurOptions, LinearGradientBlurOptions, EffectType, sharedTransitionOptions, ChainStyle, DragPreviewOptions, DragInteractionOptions, OverlayOptions, BlendMode, BlendApplyType, GeometryTransitionOptions, PopupOptions, CustomPopupOptions, MenuElement, MenuOptions, ContextMenuOptions, ModalTransition, ContentCoverOptions, SheetOptions, VisibleAreaChangeCallback } from './common' -import { VisualEffect, Filter, UniformDataType, Blender, Length, SizeOptions, ConstraintSizeOptions, ChainWeightOptions, Padding, LocalizedPadding, Margin, LocalizedMargin, ResourceColor, Position, BorderOptions, EdgeStyles, EdgeWidths, LocalizedEdgeWidths, EdgeColors, LocalizedEdgeColors, BorderRadiuses, LocalizedBorderRadiuses, OutlineOptions, EdgeOutlineStyles, Dimension, EdgeOutlineWidths, OutlineRadiuses, Area, Edges, LocalizedEdges, LocalizedPosition, ResourceStr, AccessibilityOptions, Font, PixelMap } from './units' -import { ComponentContent } from './../ComponentContent' -import { LengthMetrics } from './../Graphics' - -export interface TextOverflowOptions { - overflow: TextOverflow; -} -export type TextInterface = (content?: string | Resource, value?: TextOptions) => TextAttribute; -export interface TextAttribute extends CommonMethod { - @memo - font(value: Font): this; - @memo - fontColor(value: ResourceColor): this; - @memo - fontSize(value: number | string | Resource): this; - @memo - minFontSize(value: number | string | Resource): this; - @memo - maxFontSize(value: number | string | Resource): this; - @memo - minFontScale(value: number | Resource): this; - @memo - maxFontScale(value: number | Resource): this; - @memo - fontStyle(value: FontStyle): this; - @memo - fontWeight(value: number | FontWeight | string): this; - @memo - lineSpacing(value: LengthMetrics): this; - @memo - textAlign(value: TextAlign): this; - @memo - lineHeight(value: number | string | Resource): this; - @memo - textOverflow(value: TextOverflowOptions): this; - @memo - fontFamily(value: string | Resource): this; - @memo - maxLines(value: number): this; - @memo - letterSpacing(value: number | string): this; - @memo - textCase(value: TextCase): this; - @memo - baselineOffset(value: number | string): this; - @memo - copyOption(value: CopyOptions): this; - @memo - draggable(value: boolean): this; - @memo - textShadow(value: ShadowOptions | Array): this; - @memo - heightAdaptivePolicy(value: TextHeightAdaptivePolicy): this; - @memo - textIndent(value: Length): this; - @memo - wordBreak(value: WordBreak): this; - @memo - lineBreakStrategy(value: LineBreakStrategy): this; - @memo - onCopy(value: ((breakpoints: string) => void)): this; - @memo - caretColor(value: ResourceColor): this; - @memo - selectedBackgroundColor(value: ResourceColor): this; - @memo - ellipsisMode(value: EllipsisMode): this; - @memo - enableDataDetector(value: boolean): this; - @memo - onTextSelectionChange(value: ((first: number,last: number) => void)): this; - @memo - fontFeature(value: string): this; - @memo - privacySensitive(value: boolean): this; - @memo - textSelectable(value: TextSelectableMode): this; - @memo - halfLeading(value: boolean): this; - @memo - enableHapticFeedback(value: boolean): this; -} -export enum TextSpanType { - TEXT = 0, - IMAGE = 1, - MIXED = 2 -} -export enum TextResponseType { - RIGHT_CLICK = 0, - LONG_PRESS = 1, - SELECT = 2 -} -export interface TextOptions { - controller: TextController; -} -export declare class TextController { - closeSelectionMenu(): void -} -@memo -@ComponentBuilder -export declare function Text( - content?: string | Resource | undefined, - value?: TextOptions | undefined, - @memo - content_?: () => void, -): TextAttribute diff --git a/api/arkui/component/text.static.d.ets b/api/arkui/component/text.static.d.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c4e93d13272d778e6007d240d05c27e6aab1bed --- /dev/null +++ b/api/arkui/component/text.static.d.ets @@ -0,0 +1,973 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ +import { CommonMethod, ShadowOptions, Optional, Callback, AttributeModifier } from "./common"; +import { CustomBuilder } from './builder'; +import { EllipsisMode, TextCase, LineBreakStrategy, TextAlign, FontStyle, FontWeight, WordBreak, TextOverflow, CopyOptions, TextHeightAdaptivePolicy, TextSelectableMode } from "./enums"; +import { Resource, ResourceColor, Font, Length, LengthMetrics } from "./units"; +import { TextDataDetectorConfig, LayoutManager, FontSettingOptions, EditMenuOptions } from "./textCommon"; +import { DecorationStyleInterface, StyledString } from "./styledString"; +import { SelectionMenuOptions } from "./richEditor"; +import { memo, ComponentBuilder } from "./../stateManagement/runtime"; +/** + * Text overflow options. + * + * Anonymous Object Rectification. + * @interface TextOverflowOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface TextOverflowOptions { + /** + * Text overflow option. + * + * Anonymous Object Rectification. + * @type { TextOverflow } + * @default TextOverflow.Clip + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + overflow: TextOverflow; +} +/** + * TextAttribute. + * + * @extends CommonMethod + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @noninterop + */ +export declare interface TextAttribute extends CommonMethod { + /** + * Called when the font is set. + * + *

NOTE: + *
It is only effective for the Text component, not for its child components. + *

+ * + * @param { Font } fontValue - the text font size and weight and family and style. + * @param { FontSettingOptions } options - font setting options. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default font(fontValue: Font | undefined, options?: FontSettingOptions | undefined): this; + /** + * Called when the font color is set. + * + * @param { ResourceColor } value - Default value is '#e6182431'.The default value on wearable devices is '#c5ffffff'. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontColor(value: ResourceColor | undefined): this; + /** + * Called when the font size is set. + * + *

NOTE: + *
If fontSize is of the number type, the unit fp is used. + *

+ * + * @param { number | string | Resource } value - Default value is 16fp.The default value on wearable devices is 15fp. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontSize(value: number | string | Resource | undefined): this; + /** + * Called when the minimum font size of the font is set. + * + *

NOTE: + *
For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. + *
For the setting to take effect, this attribute must be used together with maxFontSize and maxLines, + * or layout constraint settings. + *
When the adaptive font size is used, the fontSize settings do not take effect. + *
If the value of minFontSize is less than or equal to 0, font size adaptation does not take effect. + *
In this case, the actual font size is determined by the value of fontSize. + *
If fontSize is not specified, the default value is used. + *
Since API version 18, this attribute takes effect on child components and styled strings, + * and the adaptive font size is applied to parts where the font size is not set. + *

+ * + * @param { number | string | Resource } value - The unit is fp. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default minFontSize(value: number | string | Resource | undefined): this; + /** + * Called when the maximum font size of the font is set. + * + *

NOTE: + *
For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. + *
For the setting to take effect, this attribute must be used together with minFontSize and maxLines, + * or layout constraint settings. + *
When the adaptive font size is used, the fontSize settings do not take effect. + *
If the value of maxFontSize is less than or equal to 0, font size adaptation does not take effect. + *
In this case, the actual font size is determined by the value of fontSize. + *
If fontSize is not specified, the default value is used. + *
Since API version 18, this attribute takes effect on child components and styled strings, + * and the adaptive font size is applied to parts where the font size is not set. + *

+ * + * @param { number | string | Resource } value - The unit is fp. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default maxFontSize(value: number | string | Resource | undefined): this; + /** + * Called when the minimum font scale of the font is set. + * Value range: [0, 1] + * + *

NOTE: + *
A value less than 0 is handled as 0. + *
A value greater than 1 is handled as 1. + *
Abnormal values are ineffective by default. + *

+ * + * @param { number | Resource } scale + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default minFontScale(scale: number | Resource | undefined): this; + /** + * Called when the maximum font scale of the font is set. + * Value range: [1, +∞) + * + *

NOTE: + *
A value less than 1 is handled as 1. + *
Abnormal values are ineffective by default. + *

+ * + * @param { number | Resource } scale + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default maxFontScale(scale: number | Resource | undefined): this; + /** + * Called when the font style of a font is set. + * + * @param { FontStyle } value - Default value is FontStyle.Normal. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontStyle(value: FontStyle | undefined): this; + /** + * Called when the font weight is set. + * + * @param { number | FontWeight | string } weight + * @param { FontSettingOptions } options - font setting options. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontWeight(weight: number | FontWeight | string | undefined, options?: FontSettingOptions | undefined): this; + /** + * Set font line spacing. + * + *

NOTE: + *
If the value specified is less than or equal to 0, the default value 0 is used. + *

+ * + * @param { LengthMetrics } value - Default value is 0. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default lineSpacing(value: LengthMetrics | undefined): this; + /** + * Called when the horizontal center mode of the font is set. + * + *

NOTE: + *
The text takes up the full width of the Text component. + *
To set vertical alignment for the text, use the align attribute. + *
The align attribute alone does not control the horizontal position of the text. + *
In other words, Alignment.TopStart, Alignment.Top, and Alignment.TopEnd produce the same effect, + * top-aligning the text; Alignment.Start, Alignment.Center, and Alignment.End produce the same effect, + * centered-aligning the text vertically; Alignment.BottomStart, Alignment.Bottom, + * and Alignment.BottomEnd produce the same effect, bottom-aligning the text. + *
When textAlign is set to TextAlign.JUSTIFY, you must set the wordBreak attribute, + * and the text in the last line is horizontally aligned with the start edge. + *

+ * + * @param { TextAlign } value - Default value is TextAlign.Start.The default value on wearable devices is TextAlign.Center. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textAlign(value: TextAlign | undefined): this; + /** + * Called when the vertical center mode of the font is set. + * + *

NOTE: + *
If the value is less than or equal to 0, the line height is not limited and the font size is adaptive. + *
If the value is of the number type, the unit fp is used. + *
For the string type, numeric string values with optional units, for example, "10" or "10fp", are supported. + *

+ * + * @param { number | string | Resource } value + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default lineHeight(value: number | string | Resource | undefined): this; + /** + * Called when the overflow mode of the font is set. + * + * Anonymous Object Rectification. + * + *

NOTE: + *
Text is clipped at the transition between words. + *
To clip text in the middle of a word, add \u200B between characters. + *
Since API version 11, preferably set the wordBreak attribute to WordBreak.BREAK_ALL to achieve the same purpose. + *
If overflow is set to TextOverflow.None, TextOverflow.Clip, or TextOverflow.Ellipsis, + * this attribute must be used with maxLines for the settings to take effect. + *
TextOverflow.None produces the same effect as TextOverflow.Clip. + *
If overflow is set to TextOverflow.MARQUEE, the text scrolls in a line, and neither maxLines nor copyOption takes effect. + *
The textAlign attribute takes effect only when the text is not scrollable. + *
With overflow set to TextOverflow.MARQUEE, the clip attribute is set to true by default. + *
TextOverflow.MARQUEE is not available for CustomSpan of the styled string. + *
Since API version 12, TextOverflow.MARQUEE is available for the ImageSpan component, + * where the text and images are displayed in scrolling mode in a line. + *

+ * + * @param { TextOverflowOptions } options - Text overflow options. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textOverflow(options: TextOverflowOptions | undefined): this; + /** + * Called when the font list of text is set. + * + *

NOTE: + *
Default font: 'HarmonyOS Sans' + *
The 'HarmonyOS Sans' font and registered custom fonts are supported for applications. + *
Only the 'HarmonyOS Sans' font is supported for widgets. + *

+ * + * @param { string | Resource } value + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontFamily(value: string | Resource | undefined): this; + /** + * Called when the maximum number of lines of text is set. + * + *

NOTE: + *
By default, text is automatically folded. + *
If this attribute is specified, the text will not exceed the specified number of lines. + *
If there is extra text, you can use textOverflow to specify how it is displayed. + *

+ * + * @param { number } value + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default maxLines(value: number | undefined): this; + /** + * Called when the text decoration of the text is set. + * + *

NOTE: + *
The style parameter cannot be used in widgets. + *

+ * + * @param { DecorationStyleInterface } value - Default value is { type: TextDecorationType.None, color: Color.Black, style: TextDecorationStyle.SOLID }. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default decoration(value: DecorationStyleInterface | undefined): this; + /** + * Called when the distance between text fonts is set. + * + * @param { number | string } value + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default letterSpacing(value: number | string | undefined): this; + /** + * Called when the type of letter in the text font is set. + * + * @param { TextCase } value - Default value is TextCase.Normal. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textCase(value: TextCase | undefined): this; + /** + * Called when the baseline offset is set. + * + * @param { number | string } value + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default baselineOffset(value: number | string | undefined): this; + /** + * Allow replication. + * + *

NOTE: + *
If this attribute is set to CopyOptions.InApp or CopyOptions.LocalDevice, + * a long press on the text will display a context menu that offers the copy and select-all options. + *
Because widgets do not have the long press event, the context menu will not be displayed when users long press text. + *

+ * + * @param { CopyOptions } value - Default value is CopyOptions.None. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default copyOption(value: CopyOptions | undefined): this; + /** + * Enable the selectable area can be dragged. + * + *

NOTE: + *
This attribute cannot be used together with the onDragStart event. + *
It must be used together with CopyOptions. + *
When it is set to true and copyOptions is set to CopyOptions.InApp or CopyOptions.LocalDevice, + * the selected text can be dragged and copied to the text box. + *

+ * + * @param { boolean } value - Default value is false. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default draggable(value: boolean | undefined): this; + /** + * Called when the text shadow is set. + * + *

NOTE: + *
This API does not work with the fill attribute or coloring strategy. + *

+ * + * @param { ShadowOptions | Array } value - The shadow options. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textShadow(value: ShadowOptions | Array | undefined): this; + /** + * Called when the height adaptive policy is set. + * + *

NOTE: + *

    + *
  • When this attribute is set to TextHeightAdaptivePolicy.MAX_LINES_FIRST, + * the maxLines attribute takes precedence for adjusting the text height. + *
    If the maxLines setting results in a layout beyond the layout constraints, + * the text will shrink to a font size between minFontSize and maxFontSize to allow for more content to be shown.
  • + *
  • If this attribute is set to TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST, + * the minFontSize attribute takes precedence for adjusting the text height. + *
    If the text fits on one line at minFontSize,the system attempts to increase the font size within the range of minFontSize + * and maxFontSize to display the text as large as possible on one line. + *
    If the text cannot fit into a single line even at minFontSize, it sticks with minFontSize.
  • + *
  • If this attribute is set to TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST, + * the layout constraints take precedence for adjusting the text height. + *
    If the resultant layout is beyond the layout constraints, + * the text will shrink to a font size between minFontSize and maxFontSize to respect the layout constraints. + *
    If the text still extends beyond the layout constraints after shrinking to minFontSize, + * the lines that exceed the constraints are deleted.
  • + *
+ *

+ * + * @param { TextHeightAdaptivePolicy } value - The height adaptive policy.Default value is TextHeightAdaptivePolicy.MAX_LINES_FIRST. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default heightAdaptivePolicy(value: TextHeightAdaptivePolicy | undefined): this; + /** + * Specify the indentation of the first line in a text-block. + * + * @param { Length } value - The length of text indent.Default value is 0. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textIndent(value: Length | undefined): this; + /** + * Set the word break type. + * + *

NOTE: + *
When used with {overflow: TextOverflow.Ellipsis} and maxLines, WordBreak.BREAK_ALL can insert line breaks + * between letters when overflow occurs and display excess content with an ellipsis (...). + *

+ * + * @param { WordBreak } value - The word break type.Default value is WordBreak.BREAK_WORD. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default wordBreak(value: WordBreak | undefined): this; + /** + * Set the text line break strategy type. + * + *

NOTE: + *
This attribute takes effect when wordBreak is not set to breakAll. + *
Hyphens are not supported. + *

+ * + * @param { LineBreakStrategy } strategy - The text line break strategy type.Default value is LineBreakStrategy.GREEDY. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default lineBreakStrategy(strategy: LineBreakStrategy | undefined): this; + /** + * Called when using the Clipboard menu + * Currently, only text can be copied. + * + * @param { function } callback - callback of the listened event. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default onCopy(callback: ((value: string) => void) | undefined): this; + /** + * Text selection is achieved by specifying the start and end positions of the text. + * + *

NOTE: + *
The selected text is highlighted, and a selection handle is displayed together with a menu of available actions. + *
When copyOption is set to CopyOptions.None, the selection attribute is not effective. + *
When overflow is set to TextOverflow.MARQUEE, the selection attribute is not effective. + *
If the value of selectionStart is greater than or equal to that of selectionEnd, no text will be selected. + *
The value range is [0, textSize], where textSize indicates the maximum number of characters in the text content. + *
If the value is less than 0, the value 0 will be used. + *
If the value is greater than textSize, textSize will be used. + *
If the value of selectionStart or selectionEnd falls within the invisible area, no text will be selected. + *
If clipping is disabled, the text selection outside of the parent component takes effect. + *

+ * + * @param { number } selectionStart - The start position of the selected text.Default value is -1. + * @param { number } selectionEnd - The end position of the selected text.Default value is -1. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default selection(selectionStart: number | undefined, selectionEnd: number | undefined): this; + /** + * Set the caret color for the selected text. + * + * @param { ResourceColor } color - The color of the selected text caret. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default caretColor(color: ResourceColor | undefined): this; + /** + * Set the selected background color of the text. + * + * @param { ResourceColor } color - The color of the selected text background. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default selectedBackgroundColor(color: ResourceColor | undefined): this; + /** + * Set the ellipsis mode. + * + *

NOTE: + *
For the settings to work, overflow must be set to TextOverflow.Ellipsis and maxLines must be specified. + *
Setting ellipsisMode alone does not take effect. + *
EllipsisMode.START and EllipsisMode.CENTER take effect only when text overflows in a single line. + *

+ * + * @param { EllipsisMode } value - The ellipsis mode.Default value is EllipsisMode.END. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default ellipsisMode(value: EllipsisMode | undefined): this; + /** + * Enable data detector. + * + *

NOTE: + *
This API only works on devices that provide text recognition. + *
When enableDataDetector is set to true, and the dataDetectorConfig attribute is not set, + * all types of entities are recognized by default, + * and the color and decoration of the recognized entities will be changed to the following styles: + * + * color: '#ff007dff', + * decoration:{ + * type: TextDecorationType.Underline, + * color: '#ff007dff', + * style: TextDecorationStyle.SOLID + * } + * + *
Touching and right-clicking an entity with the mouse will pop up the corresponding entity operation menu based on the type of entity, + * while left-clicking an entity with the mouse will directly respond to the first option of the menu. + *
This API does not work when overflow is set to TextOverflow.MARQUEE. + *
When copyOption is set to CopyOptions.None, the menu displayed after an entity is clicked does not provide the text selection, + * copy, translation, or sharing functionality. + *
When copyOption is not set to CopyOptions.None, and textSelectable is set to TextSelectableMode.UNSELECTABLE, + * the entity still has the copy functionality but does not have the text selection feature. + *

+ * + * @param { boolean } enable - Enable data detector.Default value is false. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default enableDataDetector(enable: boolean | undefined): this; + /** + * Data detector with config. + * + *

NOTE: + *
This API must be used together with enableDataDetector. + *
It takes effect only when enableDataDetector is set to true. + *
When entities A and B overlap, the following rules are followed: + *

    + *
  1. If A is a subset of B (A ⊂ B), then B is retained; otherwise, A is retained.
  2. + *
  3. If A is not a subset of B (A ⊄ B) and B is not a subset of A (B ⊄ A), + * and if the starting point of A is earlier than that of B (A.start < B.start), + * then A is retained; otherwise, B is retained.
  4. + *
+ *

+ * + * @param { TextDataDetectorConfig } config - The config of text data detector. + * @returns { TextAttribute } The attribute of the text. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default dataDetectorConfig(config: TextDataDetectorConfig | undefined): this; + /** + * Bind to the selection menu. + * + *

NOTE: + *
The duration required for a long-press gesture is 600 ms for bindSelectionMenu and 800 ms for bindContextMenu. + *
When both bindSelectionMenu and bindContextMenu are set and both are configured to be triggered by a long-press gesture, + * bindSelectionMenu is triggered first. + *
If the custom menu is too long, embed a Scroll component to prevent the keyboard from being blocked. + *

+ * + * @param { TextSpanType } spanType - Indicates the type of selection menu.Default value is TextSpanType.TEXT. + * @param { CustomBuilder } content - Indicates the content of selection menu. + * @param { TextResponseType } responseType - Indicates response type of selection menu.Default value is TextResponseType.LONG_PRESS. + * @param { SelectionMenuOptions } [options] - Indicates the options of selection menu. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default bindSelectionMenu(spanType: TextSpanType | undefined, content: CustomBuilder | undefined, responseType: TextResponseType | undefined, options?: SelectionMenuOptions | undefined): this; + /** + * Called when the text selection changes. + * + * @param { function } callback - callback of the listened event. + * @returns { TextAttribute } returns the instance of the TextAttribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default onTextSelectionChange(callback: ((selectionStart: number, selectionEnd: number) => void) | undefined): this; + /** + * Set font feature. + * + * @param { string } value - The fontFeature. + * normal | , + * where = [ | on | off ], like: "ss01" 0 + * the values of reference to doc of text component + * number of can be single or multiple, and separated by comma ','. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default fontFeature(value: string | undefined): this; + /** + * Set the marquee options. + * + * @param { Optional } options + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default marqueeOptions(options: TextMarqueeOptions | undefined): this; + /** + * Called when the text marquee state changes. + * + * @param { Callback } callback - callback of the marquee state change event. + * @returns { TextAttribute } returns the instance of the TextAttribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default onMarqueeStateChange(callback: Callback | undefined): this; + /** + * Whether to support sensitive privacy information + * + *

NOTE: + *
The value true means to enable privacy mode, in which case text is obscured as hyphens (-). + *
If this parameter is set to null, privacy mode is disabled. + *
Enabling privacy mode requires widget framework support. + *

+ * + * @param { boolean } supported - Whether to support sensitive privacy information.Default value is false. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default privacySensitive(supported: boolean | undefined): this; + /** + * set text selectable and focusable + * + * @param { TextSelectableMode } mode - Default value is TextSelectableMode.SELECTABLE_UNFOCUSABLE. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default textSelectable(mode: TextSelectableMode | undefined): this; + /** + * Set the custom text menu. + * Sets the extended options of the custom context menu on selection, + * including the text content, icon, and callback. + * + * @param { EditMenuOptions } editMenu - Customize text menu options. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default editMenuOptions(editMenu: EditMenuOptions | undefined): this; + /** + * Set the text with half leading. + * + *

NOTE: + *
The halfLeading settings configured within the component take precedence over those in module.json5. + *
The value true means that half leading is enabled, and false means the opposite. + *

+ * + * @param { boolean } halfLeading - Default value is false. + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default halfLeading(halfLeading: boolean | undefined): this; + /** + * Enable or disable haptic feedback. + * + * @param { boolean } isEnabled - Default value is true, set false to disable haptic feedback. + * @returns { TextAttribute } returns the instance of the TextAttribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default enableHapticFeedback(isEnabled: boolean | undefined): this; + /** + * Sets the attribute modifier. + * + * @param { AttributeModifier | AttributeModifier | undefined } modifier. + * @returns { TextAttribute } the attribute of the TextAttribute. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + default attributeModifier(modifier: AttributeModifier | AttributeModifier | undefined): this; +} +/** + * Defines span type. + * + *

NOTE: + *
The order for menu type matching is as follows. + *
When the user interacts with text, the system follows this order to decides which type of menu to display. + *

    + *
  1. Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.LONG_PRESS.
  2. + *
  3. Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.DEFAULT.
  4. + *
  5. Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.LONG_PRESS.
  6. + *
  7. Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.DEFAULT.
  8. + *
+ *

+ * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum TextSpanType { + /** + * Only contains text. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + TEXT = 0, + /** + * Only contains image. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + IMAGE = 1, + /** + * Contains both text and image. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + MIXED = 2, + /** + * When no other types are explicitly specified, this type will be matched. + * When this type is registered but TEXT, IMAGE, or MIXED types are not registered, + * this type will be triggered and displayed for those registered types. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DEFAULT = 3 +} +/** + * ResponseType for contextMenu + * + *

NOTE: + *
The order for menu type matching is as follows. When the user interacts with text, + * the system follows this order to decides which type of menu to display. + *

    + *
  1. Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.LONG_PRESS.
  2. + *
  3. Check whether a menu is registered for TextSpanType.TEXT and TextResponseType.DEFAULT.
  4. + *
  5. Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.LONG_PRESS.
  6. + *
  7. Check whether a menu is registered for TextSpanType.DEFAULT and TextResponseType.DEFAULT.
  8. + *
+ *

+ * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum TextResponseType { + /** + * Right click. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + RIGHT_CLICK = 0, + /** + * Long press. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + LONG_PRESS = 1, + /** + * Selected by mouse. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + SELECT = 2, + /** + * When no other types are explicitly specified, this type will be matched. + * When this type is registered but RIGHT_CLICK, LONG_PRESS, or SELECT types are not registered, + * this type will be triggered and displayed for right-click, long press, and mouse selection actions. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DEFAULT = 3 +} +/** + * Defines marquee state. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum MarqueeState { + /** + * The marquee started. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + START = 0, + /** + * The marquee a round finished and start next round. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + BOUNCE = 1, + /** + * The marquee all finished. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + FINISH = 2 +} +/** + * Defines marquee start policy. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare enum MarqueeStartPolicy { + /** + * Start marquee in any case. This is the default policy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + DEFAULT = 0, + /** + * Start marquee only when get focus. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + ON_FOCUS = 1 +} +/** + * Defines the options of Text. + * + * @interface TextOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface TextOptions { + /** + * Text controller. + * + * @type { TextController } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + controller: TextController; +} +/** + * Defines the marquee options. + * + * @interface TextMarqueeOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare interface TextMarqueeOptions { + /** + * Is need start marquee. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + start: boolean; + /** + * The step size of the marquee. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + step?: number; + /** + * The rounds of the marquee. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + loop?: number; + /** + * The running direction of the marquee. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fromStart?: boolean; + /** + * The waiting time between each round of the marquee. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + delay?: number; + /** + * Set whether the text is faded out. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + fadeout?: boolean; + /** + * The start policy for marquee. + * + * @type { ?MarqueeStartPolicy } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + marqueeStartPolicy?: MarqueeStartPolicy; +} +/** + * Defines the controller of Text. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export declare class TextController { + /** + * Close the select menu when menu is on. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + closeSelectionMenu(): void; + /** + * Update the styles of StyledString by setStyledString. + * + *

NOTE: + *
The child class MutableStyledString of StyledString can also serve as the argument. + *

+ * + * @param { StyledString } value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + setStyledString(value: StyledString): void; + /** + * Get LayoutManager. + * + * @returns { LayoutManager } - Return the LayoutManager. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + getLayoutManager(): LayoutManager; +} + +/** + * Defines Text Component. + * + * @param { string | Resource } [content] + * @param { TextOptions } [value] + * @param { function } [content_] + * @returns { TextAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @noninterop + */ +@memo +@ComponentBuilder +export declare function Text( + content?: string | Resource, value?: TextOptions, + @memo + content_?: () => void, +): TextAttribute \ No newline at end of file