• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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/**
17 * @file
18 * @kit ArkUI
19 */
20
21/*** if arkts 1.2 */
22import { ResourceColor, ResourceStr, Length } from './units';
23import { DecorationStyleInterface, MutableStyledString, StyledString } from './styled_string';
24import { SelectionOptions, Callback } from './common';
25import { TextDecorationType, TextDecorationStyle } from './enums';
26/*** endif */
27
28/**
29 * Defines the text data detector type.
30 *
31 * @enum { number }
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @since 11
34 */
35/**
36 * Defines the text data detector type.
37 *
38 * @enum { number }
39 * @syscap SystemCapability.ArkUI.ArkUI.Full
40 * @atomicservice
41 * @since arkts {'1.1':'12','1.2':'20'}
42 * @arkts 1.1&1.2
43 */
44declare enum TextDataDetectorType {
45  /**
46   * Detector type phone number.
47   *
48   * @syscap SystemCapability.ArkUI.ArkUI.Full
49   * @since 11
50   */
51  /**
52   * Detector type phone number.
53   *
54   * @syscap SystemCapability.ArkUI.ArkUI.Full
55   * @atomicservice
56   * @since arkts {'1.1':'12','1.2':'20'}
57   * @arkts 1.1&1.2
58   */
59  PHONE_NUMBER = 0,
60
61  /**
62   * Detector type URL.
63   *
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @since 11
66   */
67  /**
68   * Detector type URL.
69   *
70   * @syscap SystemCapability.ArkUI.ArkUI.Full
71   * @atomicservice
72   * @since arkts {'1.1':'12','1.2':'20'}
73   * @arkts 1.1&1.2
74   */
75  URL = 1,
76
77  /**
78   * Detector type email.
79   *
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @since 11
82   */
83  /**
84   * Detector type email.
85   *
86   * @syscap SystemCapability.ArkUI.ArkUI.Full
87   * @atomicservice
88   * @since arkts {'1.1':'12','1.2':'20'}
89   * @arkts 1.1&1.2
90   */
91  EMAIL = 2,
92
93  /**
94   * Detector type address.
95   *
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @since 11
98   */
99  /**
100   * Detector type address.
101   *
102   * @syscap SystemCapability.ArkUI.ArkUI.Full
103   * @atomicservice
104   * @since arkts {'1.1':'12','1.2':'20'}
105   * @arkts 1.1&1.2
106   */
107  ADDRESS = 3,
108
109  /**
110   * Detector type datetime.
111   *
112   * @syscap SystemCapability.ArkUI.ArkUI.Full
113   * @atomicservice
114   * @since arkts {'1.1':'12','1.2':'20'}
115   * @arkts 1.1&1.2
116   */
117  DATE_TIME = 4,
118}
119
120/**
121 * Text data detector config.
122 *
123 * @interface TextDataDetectorConfig
124 * @syscap SystemCapability.ArkUI.ArkUI.Full
125 * @since 11
126 */
127/**
128 * Text data detector config.
129 *
130 * @interface TextDataDetectorConfig
131 * @syscap SystemCapability.ArkUI.ArkUI.Full
132 * @atomicservice
133 * @since arkts {'1.1':'12','1.2':'20'}
134 * @arkts 1.1&1.2
135 */
136declare interface TextDataDetectorConfig {
137  /**
138   * Text data detector types.
139   *
140   * @type { TextDataDetectorType[] }
141   * @syscap SystemCapability.ArkUI.ArkUI.Full
142   * @since 11
143   */
144  /**
145   * Text data detector types.
146   *
147   * @type { TextDataDetectorType[] }
148   * @syscap SystemCapability.ArkUI.ArkUI.Full
149   * @atomicservice
150   * @since arkts {'1.1':'12','1.2':'20'}
151   * @arkts 1.1&1.2
152   */
153  types: TextDataDetectorType[]
154
155  /**
156   * Text data detect result callback.
157   *
158   * @type { ?function }
159   * @syscap SystemCapability.ArkUI.ArkUI.Full
160   * @since 11
161   */
162  /**
163   * Text data detect result callback.
164   *
165   * @type { ?Callback<string> }
166   * @syscap SystemCapability.ArkUI.ArkUI.Full
167   * @atomicservice
168   * @since arkts {'1.1':'12','1.2':'20'}
169   * @arkts 1.1&1.2
170   */
171  onDetectResultUpdate?: Callback<string>
172  /**
173   * The color of AI entity.
174   *
175   * @type { ?ResourceColor }
176   * @syscap SystemCapability.ArkUI.ArkUI.Full
177   * @atomicservice
178   * @since arkts {'1.1':'12','1.2':'20'}
179   * @arkts 1.1&1.2
180   */
181  color?: ResourceColor,
182
183  /**
184   * The decoration of AI entity.
185   *
186   * @type { ?DecorationStyleInterface }
187   * @syscap SystemCapability.ArkUI.ArkUI.Full
188   * @atomicservice
189   * @since arkts {'1.1':'12','1.2':'20'}
190   * @arkts 1.1&1.2
191   */
192  decoration?: DecorationStyleInterface;
193
194  /**
195   * Used to set whether the preview window will be displayed when long-presses and selects a word.
196   *
197   * @type { ?boolean }
198   * @syscap SystemCapability.ArkUI.ArkUI.Full
199   * @atomicservice
200   * @since 20
201   */
202  enablePreviewMenu?: boolean;
203}
204
205/**
206 * Defines range of text type component.
207 *
208 * @interface TextRange
209 * @syscap SystemCapability.ArkUI.ArkUI.Full
210 * @crossplatform
211 * @atomicservice
212 * @since arkts {'1.1':'12','1.2':'20'}
213 * @arkts 1.1&1.2
214 */
215declare interface TextRange {
216  /**
217   * Start offset.
218   *
219   * @type { ?number }
220   * @default 0
221   * @syscap SystemCapability.ArkUI.ArkUI.Full
222   * @crossplatform
223   * @atomicservice
224   * @since arkts {'1.1':'12','1.2':'20'}
225   * @arkts 1.1&1.2
226   */
227  start?: number;
228
229  /**
230   * End offset.
231   *
232   * @type { ?number }
233   * @default text length
234   * @syscap SystemCapability.ArkUI.ArkUI.Full
235   * @crossplatform
236   * @atomicservice
237   * @since arkts {'1.1':'12','1.2':'20'}
238   * @arkts 1.1&1.2
239   */
240  end?: number;
241}
242
243/**
244 * Defines the inserted text value info.
245 *
246 * @interface InsertValue
247 * @syscap SystemCapability.ArkUI.ArkUI.Full
248 * @crossplatform
249 * @atomicservice
250 * @since arkts {'1.1':'12','1.2':'20'}
251 * @arkts 1.1&1.2
252 */
253declare interface InsertValue {
254  /**
255   * The location info where the value will be inserted.
256   *
257   * @type { number }
258   * @syscap SystemCapability.ArkUI.ArkUI.Full
259   * @crossplatform
260   * @atomicservice
261   * @since arkts {'1.1':'12','1.2':'20'}
262   * @arkts 1.1&1.2
263   */
264  insertOffset: number;
265
266  /**
267   * The inserted value.
268   *
269   * @type { string }
270   * @syscap SystemCapability.ArkUI.ArkUI.Full
271   * @crossplatform
272   * @atomicservice
273   * @since arkts {'1.1':'12','1.2':'20'}
274   * @arkts 1.1&1.2
275   */
276  insertValue: string;
277}
278
279/**
280 * Defines delete text direction.
281 *
282 * @enum { number }
283 * @syscap SystemCapability.ArkUI.ArkUI.Full
284 * @crossplatform
285 * @atomicservice
286 * @since arkts {'1.1':'12','1.2':'20'}
287 * @arkts 1.1&1.2
288 */
289declare enum TextDeleteDirection {
290  /**
291   * Delete backward.
292   *
293   * @syscap SystemCapability.ArkUI.ArkUI.Full
294   * @crossplatform
295   * @atomicservice
296   * @since arkts {'1.1':'12','1.2':'20'}
297   * @arkts 1.1&1.2
298   */
299  BACKWARD = 0,
300
301  /**
302   * Delete forward.
303   *
304   * @syscap SystemCapability.ArkUI.ArkUI.Full
305   * @crossplatform
306   * @atomicservice
307   * @since arkts {'1.1':'12','1.2':'20'}
308   * @arkts 1.1&1.2
309   */
310  FORWARD = 1,
311}
312
313/**
314 * Defines the superscript style.
315 *
316 * @enum { number }
317 * @syscap SystemCapability.ArkUI.ArkUI.Full
318 * @crossplatform
319 * @atomicservice
320 * @since 20
321 */
322declare enum SuperscriptStyle {
323  /**
324   * normal font style.
325   *
326   * @syscap SystemCapability.ArkUI.ArkUI.Full
327   * @crossplatform
328   * @atomicservice
329   * @since 20
330   */
331  NORMAL = 0,
332
333  /**
334   * Superscript font style.
335   *
336   * @syscap SystemCapability.ArkUI.ArkUI.Full
337   * @crossplatform
338   * @atomicservice
339   * @since 20
340   */
341  SUPERSCRIPT = 1,
342
343  /**
344   * Subscript font style.
345   *
346   * @syscap SystemCapability.ArkUI.ArkUI.Full
347   * @crossplatform
348   * @atomicservice
349   * @since 20
350   */
351  SUBSCRIPT = 2,
352}
353
354/**
355 * Defines menu type.
356 *
357 * @enum { number }
358 * @syscap SystemCapability.ArkUI.ArkUI.Full
359 * @crossplatform
360 * @atomicservice
361 * @since arkts {'1.1':'13','1.2':'20'}
362 * @arkts 1.1&1.2
363 */
364declare enum MenuType {
365  /**
366   * Selection menu.
367   *
368   * @syscap SystemCapability.ArkUI.ArkUI.Full
369   * @crossplatform
370   * @atomicservice
371   * @since arkts {'1.1':'13','1.2':'20'}
372   * @arkts 1.1&1.2
373   */
374  SELECTION_MENU = 0,
375
376  /**
377   * Preview menu, only for image.
378   *
379   * @syscap SystemCapability.ArkUI.ArkUI.Full
380   * @crossplatform
381   * @atomicservice
382   * @since arkts {'1.1':'13','1.2':'20'}
383   * @arkts 1.1&1.2
384   */
385  PREVIEW_MENU = 1,
386}
387
388/**
389 * Declare the type of automatic case mode switching.
390 *
391 * @enum { number }
392 * @syscap SystemCapability.ArkUI.ArkUI.Full
393 * @crossplatform
394 * @atomicservice
395 * @since arkts {'1.1':'20','1.2':'20'}
396 * @arkts 1.1&1.2
397 */
398declare enum AutoCapitalizationMode {
399  /**
400   * The default status is invalid.
401   *
402   * @syscap SystemCapability.ArkUI.ArkUI.Full
403   * @crossplatform
404   * @atomicservice
405   * @since arkts {'1.1':'20','1.2':'20'}
406   * @arkts 1.1&1.2
407   */
408  NONE = 0,
409
410  /**
411   * Automatic case by words.
412   *
413   * @syscap SystemCapability.ArkUI.ArkUI.Full
414   * @crossplatform
415   * @atomicservice
416   * @since arkts {'1.1':'20','1.2':'20'}
417   * @arkts 1.1&1.2
418   */
419  WORDS = 1,
420
421  /**
422   * Automatic case by sentences.
423   *
424   * @syscap SystemCapability.ArkUI.ArkUI.Full
425   * @crossplatform
426   * @atomicservice
427   * @since arkts {'1.1':'20','1.2':'20'}
428   * @arkts 1.1&1.2
429   */
430  SENTENCES = 2,
431
432  /**
433   * Automatic case by full characters.
434   *
435   * @syscap SystemCapability.ArkUI.ArkUI.Full
436   * @crossplatform
437   * @atomicservice
438   * @since arkts {'1.1':'20','1.2':'20'}
439   * @arkts 1.1&1.2
440   */
441  ALL_CHARACTERS = 3,
442}
443
444/**
445 * Provides an interface for deleting value from text.
446 *
447 * @interface DeleteValue
448 * @syscap SystemCapability.ArkUI.ArkUI.Full
449 * @crossplatform
450 * @atomicservice
451 * @since arkts {'1.1':'12','1.2':'20'}
452 * @arkts 1.1&1.2
453 */
454declare interface DeleteValue {
455  /**
456   * The location info where the value will be deleted.
457   *
458   * @type { number }
459   * @syscap SystemCapability.ArkUI.ArkUI.Full
460   * @crossplatform
461   * @atomicservice
462   * @since arkts {'1.1':'12','1.2':'20'}
463   * @arkts 1.1&1.2
464   */
465  deleteOffset: number;
466
467  /**
468   * The deleted direction.
469   *
470   * @type { TextDeleteDirection }
471   * @syscap SystemCapability.ArkUI.ArkUI.Full
472   * @crossplatform
473   * @atomicservice
474   * @since arkts {'1.1':'12','1.2':'20'}
475   * @arkts 1.1&1.2
476   */
477  direction: TextDeleteDirection;
478
479  /**
480   * The deleted value.
481   *
482   * @type { string }
483   * @syscap SystemCapability.ArkUI.ArkUI.Full
484   * @crossplatform
485   * @atomicservice
486   * @since arkts {'1.1':'12','1.2':'20'}
487   * @arkts 1.1&1.2
488   */
489  deleteValue: string;
490}
491
492/**
493 * Callback after content changed.
494 *
495 * @typedef { function } OnDidChangeCallback
496 * @param { TextRange } rangeBefore - Range of content that had been replaced.
497 * @param { TextRange } rangeAfter - Range of content that newly added.
498 * @syscap SystemCapability.ArkUI.ArkUI.Full
499 * @crossplatform
500 * @atomicservice
501 * @since arkts {'1.1':'12','1.2':'20'}
502 * @arkts 1.1&1.2
503 */
504declare type OnDidChangeCallback = (rangeBefore: TextRange, rangeAfter: TextRange) => void;
505
506/**
507 * Callback when input sometimes has info of previewText.
508 *
509 * @typedef { function } EditableTextOnChangeCallback
510 * @param { string } value - Value of body text, without previewText value.
511 * @param { PreviewText } [previewText] - info of previewText, contains previewText value and start index.
512 * @syscap SystemCapability.ArkUI.ArkUI.Full
513 * @crossplatform
514 * @atomicservice
515 * @since arkts {'1.1':'12','1.2':'20'}
516 * @arkts 1.1&1.2
517 */
518/**
519 * Callback when input sometimes has info of previewText.
520 *
521 * @typedef { function } EditableTextOnChangeCallback
522 * @param { string } value - Value of body text, without previewText value.
523 * @param { PreviewText } [previewText] - info of previewText, contains previewText value and start index.
524 * @param { TextChangeOptions } [options] - contains the selection range before and after the change, as well as the old content.
525 * @syscap SystemCapability.ArkUI.ArkUI.Full
526 * @crossplatform
527 * @atomicservice
528 * @since arkts {'1.1':'15','1.2':'20'}
529 * @arkts 1.1&1.2
530 */
531declare type EditableTextOnChangeCallback = (value: string, previewText?: PreviewText, options?: TextChangeOptions) => void;
532
533/**
534 * Define the text selection controller.
535 *
536 * @interface TextBaseController
537 * @syscap SystemCapability.ArkUI.ArkUI.Full
538 * @crossplatform
539 * @atomicservice
540 * @since arkts {'1.1':'12','1.2':'20'}
541 * @arkts 1.1&1.2
542 */
543declare interface TextBaseController {
544  /**
545   * Set selection to select a range of content.
546   *
547   * @param { number } selectionStart - The start position of the selected text.
548   * @param { number } selectionEnd - The end position of the selected text.
549   * @param { SelectionOptions } [options] - Indicates the options of selection.
550   * @syscap SystemCapability.ArkUI.ArkUI.Full
551   * @crossplatform
552   * @atomicservice
553   * @since arkts {'1.1':'12','1.2':'20'}
554   * @arkts 1.1&1.2
555   */
556  setSelection(selectionStart: number, selectionEnd: number, options?: SelectionOptions): void;
557
558  /**
559   * Close the select menu when menu is on.
560   *
561   * @syscap SystemCapability.ArkUI.ArkUI.Full
562   * @crossplatform
563   * @atomicservice
564   * @since arkts {'1.1':'12','1.2':'20'}
565   * @arkts 1.1&1.2
566   */
567  closeSelectionMenu(): void;
568
569  /**
570   * Get LayoutManager.
571   *
572   * @returns { LayoutManager } - Return the LayoutManager.
573   * @syscap SystemCapability.ArkUI.ArkUI.Full
574   * @crossplatform
575   * @atomicservice
576   * @since arkts {'1.1':'12','1.2':'20'}
577   * @arkts 1.1&1.2
578   */
579  getLayoutManager(): LayoutManager;
580}
581
582/**
583 * Define the text extended editing controller.
584 *
585 * @extends TextBaseController
586 * @interface TextEditControllerEx
587 * @syscap SystemCapability.ArkUI.ArkUI.Full
588 * @crossplatform
589 * @atomicservice
590 * @since arkts {'1.1':'12','1.2':'20'}
591 * @arkts 1.1&1.2
592 */
593declare interface TextEditControllerEx extends TextBaseController {
594  /**
595   * Judge whether is in editing state
596   *
597   * @returns { boolean } - true means that the component is in editing state, false means is non in editing status
598   * @syscap SystemCapability.ArkUI.ArkUI.Full
599   * @crossplatform
600   * @atomicservice
601   * @since arkts {'1.1':'12','1.2':'20'}
602   * @arkts 1.1&1.2
603   */
604  isEditing(): boolean;
605
606  /**
607   * Stop editing state.
608   *
609   * @syscap SystemCapability.ArkUI.ArkUI.Full
610   * @crossplatform
611   * @atomicservice
612   * @since arkts {'1.1':'12','1.2':'20'}
613   * @arkts 1.1&1.2
614   */
615  stopEditing(): void;
616
617  /**
618   * Set caret offset.
619   *
620   * @param { number } offset - caret offset.
621   * @returns { boolean } - Return true if the caret offset was successfully set, false otherwise.
622   * @syscap SystemCapability.ArkUI.ArkUI.Full
623   * @crossplatform
624   * @atomicservice
625   * @since arkts {'1.1':'12','1.2':'20'}
626   * @arkts 1.1&1.2
627   */
628  setCaretOffset(offset: number): boolean;
629
630  /**
631   * Get caret offset from controller.
632   *
633   * @returns { number }
634   * @syscap SystemCapability.ArkUI.ArkUI.Full
635   * @crossplatform
636   * @atomicservice
637   * @since arkts {'1.1':'12','1.2':'20'}
638   * @arkts 1.1&1.2
639   */
640  getCaretOffset(): number;
641
642  /**
643   * Get PreviewText.
644   *
645   * @returns { PreviewText } - Return the PreviewText.
646   * @syscap SystemCapability.ArkUI.ArkUI.Full
647   * @crossplatform
648   * @atomicservice
649   * @since 12
650   */
651  getPreviewText?(): PreviewText;
652
653  /**
654   * Get PreviewText.
655   *
656   * @returns { PreviewText } - Return the PreviewText.
657   * @syscap SystemCapability.ArkUI.ArkUI.Full
658   * @crossplatform
659   * @atomicservice
660   * @since 20
661   * @arkts 1.2
662   */
663  getPreviewText(): PreviewText;
664}
665
666/**
667 * The previewText.
668 * @interface PreviewText
669 * @syscap SystemCapability.ArkUI.ArkUI.Full
670 * @crossplatform
671 * @atomicservice
672 * @since arkts {'1.1':'12','1.2':'20'}
673 * @arkts 1.1&1.2
674 */
675declare interface PreviewText {
676  /**
677   * Start offset of the previewText
678   *
679   * @type { number }
680   * @syscap SystemCapability.ArkUI.ArkUI.Full
681   * @crossplatform
682   * @atomicservice
683   * @since arkts {'1.1':'12','1.2':'20'}
684   * @arkts 1.1&1.2
685   */
686  offset: number;
687
688  /**
689   * Value of the previewText.
690   *
691   * @type { string }
692   * @syscap SystemCapability.ArkUI.ArkUI.Full
693   * @crossplatform
694   * @atomicservice
695   * @since arkts {'1.1':'12','1.2':'20'}
696   * @arkts 1.1&1.2
697   */
698  value: string;
699}
700
701/**
702 * Define the StyledString controller.
703 *
704 * @interface StyledStringController
705 * @syscap SystemCapability.ArkUI.ArkUI.Full
706 * @crossplatform
707 * @atomicservice
708 * @since arkts {'1.1':'12','1.2':'20'}
709 * @arkts 1.1&1.2
710 */
711declare interface StyledStringController {
712  /**
713   * Set the StyledString of the component.
714   *
715   * @param { StyledString } styledString - StyledString.
716   * @syscap SystemCapability.ArkUI.ArkUI.Full
717   * @crossplatform
718   * @atomicservice
719   * @since arkts {'1.1':'12','1.2':'20'}
720   * @arkts 1.1&1.2
721   */
722  setStyledString(styledString: StyledString): void;
723
724  /**
725   * Get the StyledString of the component.
726   *
727   * @returns { MutableStyledString }
728   * @syscap SystemCapability.ArkUI.ArkUI.Full
729   * @crossplatform
730   * @atomicservice
731   * @since arkts {'1.1':'12','1.2':'20'}
732   * @arkts 1.1&1.2
733   */
734  getStyledString(): MutableStyledString;
735}
736
737/**
738 * Define the StyledString changed listener.
739 *
740 * @interface StyledStringChangedListener
741 * @syscap SystemCapability.ArkUI.ArkUI.Full
742 * @crossplatform
743 * @atomicservice
744 * @since arkts {'1.1':'12','1.2':'20'}
745 * @arkts 1.1&1.2
746 */
747declare interface StyledStringChangedListener {
748  /**
749   * Called before text changed.
750   *
751   * @type { ?Callback<StyledStringChangeValue, boolean> }
752   * @syscap SystemCapability.ArkUI.ArkUI.Full
753   * @crossplatform
754   * @atomicservice
755   * @since arkts {'1.1':'12','1.2':'20'}
756   * @arkts 1.1&1.2
757   */
758  onWillChange?: Callback<StyledStringChangeValue, boolean>;
759
760  /**
761   * Called after text changed.
762   *
763   * @type { ?OnDidChangeCallback }
764   * @syscap SystemCapability.ArkUI.ArkUI.Full
765   * @crossplatform
766   * @atomicservice
767   * @since arkts {'1.1':'12','1.2':'20'}
768   * @arkts 1.1&1.2
769   */
770  onDidChange?: OnDidChangeCallback;
771}
772
773/**
774 * Define the StyledString changed value.
775 *
776 * @interface StyledStringChangeValue
777 * @syscap SystemCapability.ArkUI.ArkUI.Full
778 * @crossplatform
779 * @atomicservice
780 * @since arkts {'1.1':'12','1.2':'20'}
781 * @arkts 1.1&1.2
782 */
783interface StyledStringChangeValue {
784  /**
785   * Range of the content to be replaced.
786   *
787   * @type { TextRange }
788   * @syscap SystemCapability.ArkUI.ArkUI.Full
789   * @crossplatform
790   * @atomicservice
791   * @since arkts {'1.1':'12','1.2':'20'}
792   * @arkts 1.1&1.2
793   */
794  range: TextRange;
795
796  /**
797   * StyledString to replace.
798   *
799   * @type { StyledString }
800   * @syscap SystemCapability.ArkUI.ArkUI.Full
801   * @crossplatform
802   * @atomicservice
803   * @since arkts {'1.1':'12','1.2':'20'}
804   * @arkts 1.1&1.2
805   */
806  replacementString: StyledString;
807
808  /**
809   * Preview StyledString
810   *
811   * @type { ?StyledString }
812   * @syscap SystemCapability.ArkUI.ArkUI.Full
813   * @crossplatform
814   * @atomicservice
815   * @since arkts {'1.1':'12','1.2':'20'}
816   * @arkts 1.1&1.2
817   */
818  previewText?: StyledString;
819}
820
821/**
822 * Define the LayoutManager for querying layout information.
823 *
824 * @interface LayoutManager
825 * @syscap SystemCapability.ArkUI.ArkUI.Full
826 * @crossplatform
827 * @atomicservice
828 * @since arkts {'1.1':'12','1.2':'20'}
829 * @arkts 1.1&1.2
830 */
831declare interface LayoutManager {
832  /**
833   * Get the line count.
834   *
835   * @returns { number } The line count value returned to the caller.
836   * @syscap SystemCapability.ArkUI.ArkUI.Full
837   * @crossplatform
838   * @atomicservice
839   * @since arkts {'1.1':'12','1.2':'20'}
840   * @arkts 1.1&1.2
841   */
842  getLineCount(): number;
843
844  /**
845   * Get the glyph position at coordinate.
846   *
847   * @param { number } x - the positionX of typography.
848   * @param { number } y - the positionY of typography.
849   * @returns { PositionWithAffinity } TextBlob object.
850   * @syscap SystemCapability.ArkUI.ArkUI.Full
851   * @crossplatform
852   * @atomicservice
853   * @since arkts {'1.1':'12','1.2':'20'}
854   * @arkts 1.1&1.2
855   */
856  getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity;
857
858  /**
859   * Get LineMetrics.
860   *
861   * @param { number } lineNumber - the number of line.
862   * @returns { LineMetrics } The line Metrics.
863   * @syscap SystemCapability.ArkUI.ArkUI.Full
864   * @crossplatform
865   * @atomicservice
866   * @since 12
867   */
868  getLineMetrics(lineNumber: number): LineMetrics;
869
870  /**
871   * Get the rects for range.
872   * @param { TextRange } range - The range to set.
873   * @param { RectWidthStyle } widthStyle - Width style to set.
874   * @param { RectHeightStyle } heightStyle - Height style to set.
875   * @returns { Array<TextBox> } The rects for range.
876   * @syscap SystemCapability.ArkUI.ArkUI.Full
877   * @crossplatform
878   * @atomicservice
879   * @since 14
880   */
881  getRectsForRange(range: TextRange, widthStyle: RectWidthStyle, heightStyle: RectHeightStyle): Array<TextBox>;
882}
883
884/**
885 * Position and affinity.
886 *
887 * @typedef PositionWithAffinity
888 * @syscap SystemCapability.ArkUI.ArkUI.Full
889 * @crossplatform
890 * @atomicservice
891 * @since arkts {'1.1':'12','1.2':'20'}
892 * @arkts 1.1&1.2
893 */
894interface PositionWithAffinity {
895  /**
896   * Position of text.
897   *
898   * @type { number }
899   * @syscap SystemCapability.ArkUI.ArkUI.Full
900   * @crossplatform
901   * @atomicservice
902   * @since arkts {'1.1':'12','1.2':'20'}
903   * @arkts 1.1&1.2
904   */
905  position: number;
906
907  /**
908   * Affinity of text.
909   *
910   * @type { Affinity }
911   * @syscap SystemCapability.ArkUI.ArkUI.Full
912   * @crossplatform
913   * @atomicservice
914   * @since 12
915   */
916  affinity: Affinity;
917}
918
919/**
920 * Define the Affinity type.
921 *
922 * @typedef { import('../api/@ohos.graphics.text').default.Affinity } Affinity
923 * @syscap SystemCapability.ArkUI.ArkUI.Full
924 * @crossplatform
925 * @atomicservice
926 * @since 12
927 */
928declare type Affinity = import('../api/@ohos.graphics.text').default.Affinity;
929
930/**
931 * Define the LineMetrics type.
932 *
933 * @typedef { import('../api/@ohos.graphics.text').default.LineMetrics } LineMetrics
934 * @syscap SystemCapability.ArkUI.ArkUI.Full
935 * @crossplatform
936 * @atomicservice
937 * @since 12
938 */
939declare type LineMetrics = import('../api/@ohos.graphics.text').default.LineMetrics;
940
941/**
942 * Define the RectWidthStyle type.
943 *
944 * @typedef { import('../api/@ohos.graphics.text').default.RectWidthStyle } RectWidthStyle
945 * @syscap SystemCapability.ArkUI.ArkUI.Full
946 * @crossplatform
947 * @atomicservice
948 * @since 14
949 */
950declare type RectWidthStyle = import('../api/@ohos.graphics.text').default.RectWidthStyle;
951
952/**
953 * Define the RectHeightStyle type.
954 *
955 * @typedef { import('../api/@ohos.graphics.text').default.RectHeightStyle } RectHeightStyle
956 * @syscap SystemCapability.ArkUI.ArkUI.Full
957 * @crossplatform
958 * @atomicservice
959 * @since 14
960 */
961declare type RectHeightStyle = import('../api/@ohos.graphics.text').default.RectHeightStyle;
962
963/**
964 * Define the TextBox type.
965 *
966 * @typedef { import('../api/@ohos.graphics.text').default.TextBox } TextBox
967 * @syscap SystemCapability.ArkUI.ArkUI.Full
968 * @crossplatform
969 * @atomicservice
970 * @since 14
971 */
972declare type TextBox = import('../api/@ohos.graphics.text').default.TextBox;
973
974/**
975 * The Paragraph type provide detailed information about a paragraph,
976 * including properties such as line count, line height and other relevant metrics.
977 *
978 * @typedef { import('../api/@ohos.graphics.text').default.Paragraph } Paragraph
979 * @syscap SystemCapability.ArkUI.ArkUI.Full
980 * @since 20
981 */
982declare type Paragraph = import('../api/@ohos.graphics.text').default.Paragraph;
983
984/**
985 * Defines the cursor style
986 *
987 * @interface CaretStyle
988 * @syscap SystemCapability.ArkUI.ArkUI.Full
989 * @crossplatform
990 * @since 10
991 */
992/**
993 * Defines the cursor style
994 *
995 * @interface CaretStyle
996 * @syscap SystemCapability.ArkUI.ArkUI.Full
997 * @crossplatform
998 * @atomicservice
999 * @since arkts {'1.1':'11','1.2':'20'}
1000 * @arkts 1.1&1.2
1001 */
1002interface CaretStyle {
1003  /**
1004   * Set the cursor width
1005   *
1006   * @type { ?Length }
1007   * @syscap SystemCapability.ArkUI.ArkUI.Full
1008   * @crossplatform
1009   * @since 10
1010   */
1011  /**
1012   * Set the cursor width
1013   *
1014   * @type { ?Length }
1015   * @syscap SystemCapability.ArkUI.ArkUI.Full
1016   * @crossplatform
1017   * @atomicservice
1018   * @since arkts {'1.1':'11','1.2':'20'}
1019   * @arkts 1.1&1.2
1020   */
1021  width?: Length,
1022
1023  /**
1024   * Set the cursor color
1025   *
1026   * @type { ?ResourceColor }
1027   * @syscap SystemCapability.ArkUI.ArkUI.Full
1028   * @crossplatform
1029   * @since 10
1030   */
1031  /**
1032   * Set the cursor color
1033   *
1034   * @type { ?ResourceColor }
1035   * @syscap SystemCapability.ArkUI.ArkUI.Full
1036   * @crossplatform
1037   * @atomicservice
1038   * @since arkts {'1.1':'11','1.2':'20'}
1039   * @arkts 1.1&1.2
1040   */
1041  color?: ResourceColor,
1042}
1043
1044/**
1045 * Defines the TextMenuItemId.
1046 *
1047 * @syscap SystemCapability.ArkUI.ArkUI.Full
1048 * @crossplatform
1049 * @atomicservice
1050 * @since arkts {'1.1':'12','1.2':'20'}
1051 * @arkts 1.1&1.2
1052 */
1053declare class TextMenuItemId {
1054  /**
1055   * Init a TextMenuItemId with id.
1056   *
1057   * @param { ResourceStr } id - The id of the TextMenuItemId.
1058   * @returns { TextMenuItemId } - Returns the TextMenuItemId object.
1059   * @static
1060   * @syscap SystemCapability.ArkUI.ArkUI.Full
1061   * @crossplatform
1062   * @atomicservice
1063   * @since arkts {'1.1':'12','1.2':'20'}
1064   * @arkts 1.1&1.2
1065   */
1066  static of(id: ResourceStr): TextMenuItemId;
1067
1068  /**
1069   * Judge if two TextMenuItemId are equal.
1070   *
1071   * @param { TextMenuItemId } id - id TextMenuItemId.
1072   * @returns { boolean }
1073   * @syscap SystemCapability.ArkUI.ArkUI.Full
1074   * @crossplatform
1075   * @atomicservice
1076   * @since arkts {'1.1':'12','1.2':'20'}
1077   * @arkts 1.1&1.2
1078   */
1079  equals(id: TextMenuItemId): boolean;
1080
1081  /**
1082   * Indicates the TextMenuItemId to copy and delete the currently selected text.
1083   *
1084   * @type { TextMenuItemId }
1085   * @readonly
1086   * @static
1087   * @syscap SystemCapability.ArkUI.ArkUI.Full
1088   * @atomicservice
1089   * @since arkts {'1.1':'12','1.2':'20'}
1090   * @arkts 1.1&1.2
1091   */
1092  static readonly CUT: TextMenuItemId;
1093
1094  /**
1095   * Indicates the TextMenuItemId to copy the currently selected text to the clipboard.
1096   *
1097   * @type { TextMenuItemId }
1098   * @readonly
1099   * @static
1100   * @syscap SystemCapability.ArkUI.ArkUI.Full
1101   * @atomicservice
1102   * @since arkts {'1.1':'12','1.2':'20'}
1103   * @arkts 1.1&1.2
1104   */
1105  static readonly COPY: TextMenuItemId;
1106
1107  /**
1108   * Indicates the TextMenuItemId to copy the current contents of the clipboard into the text view.
1109   *
1110   * @type { TextMenuItemId }
1111   * @readonly
1112   * @static
1113   * @syscap SystemCapability.ArkUI.ArkUI.Full
1114   * @atomicservice
1115   * @since arkts {'1.1':'12','1.2':'20'}
1116   * @arkts 1.1&1.2
1117   */
1118  static readonly PASTE: TextMenuItemId;
1119
1120  /**
1121   * Indicates the TextMenuItemId to select all text in a text view.
1122   *
1123   * @type { TextMenuItemId }
1124   * @readonly
1125   * @static
1126   * @syscap SystemCapability.ArkUI.ArkUI.Full
1127   * @atomicservice
1128   * @since arkts {'1.1':'12','1.2':'20'}
1129   * @arkts 1.1&1.2
1130   */
1131  static readonly SELECT_ALL: TextMenuItemId;
1132
1133  /**
1134   * Indicates the TextMenuItemId for collaboration service menu items.
1135   *
1136   * @type { TextMenuItemId }
1137   * @readonly
1138   * @static
1139   * @syscap SystemCapability.ArkUI.ArkUI.Full
1140   * @atomicservice
1141   * @since arkts {'1.1':'12','1.2':'20'}
1142   * @arkts 1.1&1.2
1143   */
1144  static readonly COLLABORATION_SERVICE: TextMenuItemId;
1145
1146  /**
1147   * Indicates the TextMenuItemId to recognize the text in the picture and input it into the text view.
1148   *
1149   * @type { TextMenuItemId }
1150   * @readonly
1151   * @static
1152   * @syscap SystemCapability.ArkUI.ArkUI.Full
1153   * @atomicservice
1154   * @since arkts {'1.1':'12','1.2':'20'}
1155   * @arkts 1.1&1.2
1156   */
1157  static readonly CAMERA_INPUT: TextMenuItemId;
1158
1159  /**
1160   * Indicates the TextMenuItemId to help with text creation by invoking large models.
1161   *
1162   * @type { TextMenuItemId }
1163   * @readonly
1164   * @static
1165   * @syscap SystemCapability.ArkUI.ArkUI.Full
1166   * @atomicservice
1167   * @since arkts {'1.1':'13','1.2':'20'}
1168   * @arkts 1.1&1.2
1169   */
1170  static readonly AI_WRITER: TextMenuItemId;
1171
1172  /**
1173   * Indicates the TextMenuItemId to translate the selected content.
1174   *
1175   * @type { TextMenuItemId }
1176   * @readonly
1177   * @static
1178   * @syscap SystemCapability.ArkUI.ArkUI.Full
1179   * @atomicservice
1180   * @since arkts {'1.1':'15','1.2':'20'}
1181   * @arkts 1.1&1.2
1182   */
1183  static readonly TRANSLATE: TextMenuItemId;
1184
1185  /**
1186   * Indicates the TextMenuItemId to search the selected content.
1187   *
1188   * @type { TextMenuItemId }
1189   * @readonly
1190   * @static
1191   * @syscap SystemCapability.ArkUI.ArkUI.Full
1192   * @atomicservice
1193   * @since arkts {'1.1':'18','1.2':'20'}
1194   * @arkts 1.1&1.2
1195   */
1196  static readonly SEARCH: TextMenuItemId;
1197
1198  /**
1199   * Indicates the TextMenuItemId to share the selected content.
1200   *
1201   * @type { TextMenuItemId }
1202   * @readonly
1203   * @static
1204   * @syscap SystemCapability.ArkUI.ArkUI.Full
1205   * @atomicservice
1206   * @since arkts {'1.1':'18','1.2':'20'}
1207   * @arkts 1.1&1.2
1208   */
1209  static readonly SHARE: TextMenuItemId;
1210
1211  /**
1212   * Indicates the TextMenuItemId to open url.
1213   *
1214   * @type { TextMenuItemId }
1215   * @readonly
1216   * @static
1217   * @syscap SystemCapability.ArkUI.ArkUI.Full
1218   * @atomicservice
1219   * @since 20
1220   */
1221  static readonly url: TextMenuItemId;
1222
1223  /**
1224   * Indicates the TextMenuItemId to open email.
1225   *
1226   * @type { TextMenuItemId }
1227   * @readonly
1228   * @static
1229   * @syscap SystemCapability.ArkUI.ArkUI.Full
1230   * @atomicservice
1231   * @since 20
1232   */
1233  static readonly email: TextMenuItemId;
1234
1235  /**
1236   * Indicates the TextMenuItemId to call the phone number.
1237   *
1238   * @type { TextMenuItemId }
1239   * @readonly
1240   * @static
1241   * @syscap SystemCapability.ArkUI.ArkUI.Full
1242   * @atomicservice
1243   * @since 20
1244   */
1245  static readonly phoneNumber: TextMenuItemId;
1246
1247  /**
1248   * Indicates the TextMenuItemId to open map.
1249   *
1250   * @type { TextMenuItemId }
1251   * @readonly
1252   * @static
1253   * @syscap SystemCapability.ArkUI.ArkUI.Full
1254   * @atomicservice
1255   * @since 20
1256   */
1257  static readonly address: TextMenuItemId;
1258
1259  /**
1260   * Indicates the TextMenuItemId to open calendar.
1261   *
1262   * @type { TextMenuItemId }
1263   * @readonly
1264   * @static
1265   * @syscap SystemCapability.ArkUI.ArkUI.Full
1266   * @atomicservice
1267   * @since 20
1268   */
1269  static readonly dateTime: TextMenuItemId;
1270
1271
1272  /**
1273   * Indicates the TextMenuItemId for asking AI.
1274   *
1275   * @type { TextMenuItemId }
1276   * @readonly
1277   * @static
1278   * @syscap SystemCapability.ArkUI.ArkUI.Full
1279   * @atomicservice
1280   * @since 20
1281   * @arkts 1.1&1.2
1282   */
1283  static readonly askAI: TextMenuItemId;
1284}
1285
1286/**
1287 * TextMenuItem
1288 *
1289 * @interface TextMenuItem
1290 * @syscap SystemCapability.ArkUI.ArkUI.Full
1291 * @crossplatform
1292 * @atomicservice
1293 * @since arkts {'1.1':'12','1.2':'20'}
1294 * @arkts 1.1&1.2
1295 */
1296declare interface TextMenuItem {
1297  /**
1298   * Customize what the menu displays.
1299   *
1300   * @type { ResourceStr }
1301   * @syscap SystemCapability.ArkUI.ArkUI.Full
1302   * @crossplatform
1303   * @atomicservice
1304   * @since arkts {'1.1':'12','1.2':'20'}
1305   * @arkts 1.1&1.2
1306   */
1307  content: ResourceStr;
1308  /**
1309   * Customize the icon before the menu displays content.
1310   *
1311   * @type { ?ResourceStr }
1312   * @syscap SystemCapability.ArkUI.ArkUI.Full
1313   * @crossplatform
1314   * @atomicservice
1315   * @since arkts {'1.1':'12','1.2':'20'}
1316   * @arkts 1.1&1.2
1317   */
1318  icon?: ResourceStr;
1319  /**
1320   * Distinguish clicked menu content by Id.
1321   *
1322   * @type { TextMenuItemId }
1323   * @syscap SystemCapability.ArkUI.ArkUI.Full
1324   * @crossplatform
1325   * @atomicservice
1326   * @since arkts {'1.1':'12','1.2':'20'}
1327   * @arkts 1.1&1.2
1328   */
1329  id: TextMenuItemId;
1330  /**
1331   * Customize what the menu item shortcut displays.
1332   *
1333   * @type { ?ResourceStr }
1334   * @syscap SystemCapability.ArkUI.ArkUI.Full
1335   * @crossplatform
1336   * @atomicservice
1337   * @since arkts {'1.1':'15','1.2':'20'}
1338   * @arkts 1.1&1.2
1339   */
1340  labelInfo?: ResourceStr;
1341}
1342
1343/**
1344 * Callback before displaying the menu when the selection range changes.
1345 *
1346 * @typedef { function } OnPrepareMenuCallback
1347 * @param { Array<TextMenuItem> } menuItems - currently displayed menu items.
1348 * @returns { Array<TextMenuItem> } Return the menu items will displayed after operations.
1349 * @syscap SystemCapability.ArkUI.ArkUI.Full
1350 * @crossplatform
1351 * @atomicservice
1352 * @since 20
1353 */
1354type OnPrepareMenuCallback = (menuItems: Array<TextMenuItem>) => Array<TextMenuItem>;
1355
1356/**
1357 * Callback function when the selection menu create.
1358 *
1359 * @typedef { function } OnCreateMenuCallback
1360 * @param { Array<TextMenuItem> } menuItems - currently displayed menu items.
1361 * @returns { Array<TextMenuItem> } Return the menu items will displayed after operations.
1362 * @syscap SystemCapability.ArkUI.ArkUI.Full
1363 * @crossplatform
1364 * @atomicservice
1365 * @since 20
1366 * @arkts 1.2
1367 */
1368type OnCreateMenuCallback = (menuItems: Array<TextMenuItem>) => Array<TextMenuItem>;
1369
1370/**
1371 * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior.
1372 *
1373 * @typedef { function } OnMenuItemClickCallback
1374 * @param { TextMenuItem } menuItem - current default menu.
1375 * @param { TextRange } range - current selected range.
1376 * @returns { boolean } - Return True, the event is consumed, false otherwise.
1377 * @syscap SystemCapability.ArkUI.ArkUI.Full
1378 * @crossplatform
1379 * @atomicservice
1380 * @since 20
1381 * @arkts 1.2
1382 */
1383type OnMenuItemClickCallback = (menuItem: TextMenuItem, range: TextRange) => boolean
1384
1385/**
1386 * EditMenuOptions
1387 *
1388 * @interface EditMenuOptions
1389 * @syscap SystemCapability.ArkUI.ArkUI.Full
1390 * @crossplatform
1391 * @atomicservice
1392 * @since arkts {'1.1':'12','1.2':'20'}
1393 * @arkts 1.1&1.2
1394 */
1395declare interface EditMenuOptions {
1396  /**
1397   * Passes the default menu, invokes before every display to generate a menu for triggering click events.
1398   *
1399   * @param { Array<TextMenuItem> } menuItems - current default menu array.
1400   * @returns { Array<TextMenuItem> } - Return the menu after operations.
1401   * @syscap SystemCapability.ArkUI.ArkUI.Full
1402   * @crossplatform
1403   * @atomicservice
1404   * @since 12
1405   */
1406  onCreateMenu(menuItems: Array<TextMenuItem>): Array<TextMenuItem>;
1407  /**
1408   * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior.
1409   *
1410   * @param { TextMenuItem } menuItem - current default menu.
1411   * @param { TextRange } range - current selected range.
1412   * @returns { boolean } - Return True, the event is consumed, false otherwise.
1413   * @syscap SystemCapability.ArkUI.ArkUI.Full
1414   * @crossplatform
1415   * @atomicservice
1416   * @since 12
1417   */
1418  onMenuItemClick(menuItem: TextMenuItem, range: TextRange): boolean;
1419  /**
1420   * Callback before displaying the menu when the selection range changes.
1421   *
1422   * @type { ?OnPrepareMenuCallback }
1423   * @syscap SystemCapability.ArkUI.ArkUI.Full
1424   * @crossplatform
1425   * @atomicservice
1426   * @since 20
1427   */
1428  onPrepareMenu?: OnPrepareMenuCallback;
1429
1430  /**
1431   * Passes the default menu, invokes before every display to generate a menu for triggering click events.
1432   *
1433   * @type { OnCreateMenuCallback }
1434   * @syscap SystemCapability.ArkUI.ArkUI.Full
1435   * @crossplatform
1436   * @atomicservice
1437   * @since 20
1438   * @arkts 1.2
1439   */
1440  onCreateMenu: OnCreateMenuCallback;
1441
1442  /**
1443   * Invoke upon clicking an item, capable of intercepting the default system menu execution behavior.
1444   *
1445   * @type { OnMenuItemClickCallback }
1446   * @syscap SystemCapability.ArkUI.ArkUI.Full
1447   * @crossplatform
1448   * @atomicservice
1449   * @since 20
1450   * @arkts 1.2
1451   */
1452  onMenuItemClick: OnMenuItemClickCallback;
1453}
1454
1455/**
1456 * Defines the font decoration result.
1457 *
1458 * @interface DecorationStyleResult
1459 * @syscap SystemCapability.ArkUI.ArkUI.Full
1460 * @crossplatform
1461 * @atomicservice
1462 * @since arkts {'1.1':'12','1.2':'20'}
1463 * @arkts 1.1&1.2
1464 */
1465interface DecorationStyleResult {
1466  /**
1467   * Font decoration type.
1468   *
1469   * @type { TextDecorationType }
1470   * @syscap SystemCapability.ArkUI.ArkUI.Full
1471   * @crossplatform
1472   * @atomicservice
1473   * @since arkts {'1.1':'12','1.2':'20'}
1474   * @arkts 1.1&1.2
1475   */
1476  type: TextDecorationType;
1477
1478  /**
1479   * Font decoration color.
1480   *
1481   * @type { ResourceColor }
1482   * @syscap SystemCapability.ArkUI.ArkUI.Full
1483   * @crossplatform
1484   * @atomicservice
1485   * @since arkts {'1.1':'12','1.2':'20'}
1486   * @arkts 1.1&1.2
1487   */
1488  color: ResourceColor;
1489
1490  /**
1491   * The style value of the decoration property object.
1492   *
1493   * @type { ?TextDecorationStyle }
1494   * @syscap SystemCapability.ArkUI.ArkUI.Full
1495   * @crossplatform
1496   * @atomicservice
1497   * @since arkts {'1.1':'12','1.2':'20'}
1498   * @arkts 1.1&1.2
1499   */
1500  style?: TextDecorationStyle;
1501
1502  /**
1503   * The thicknessScale value of the decoration property object.
1504   *
1505   * @type { ?number }
1506   * @syscap SystemCapability.ArkUI.ArkUI.Full
1507   * @crossplatform
1508   * @atomicservice
1509   * @since 20
1510   */
1511  thicknessScale?: number;
1512}
1513
1514/**
1515 * Defines the options of font.
1516 *
1517 * @interface FontSettingOptions
1518 * @syscap SystemCapability.ArkUI.ArkUI.Full
1519 * @crossplatform
1520 * @form
1521 * @atomicservice
1522 * @since arkts {'1.1':'12','1.2':'20'}
1523 * @arkts 1.1&1.2
1524 */
1525declare interface FontSettingOptions {
1526  /**
1527    * Define whether VariableFontWeight is supported.
1528    *
1529    * @type { ?boolean }
1530    * @syscap SystemCapability.ArkUI.ArkUI.Full
1531    * @crossplatform
1532    * @form
1533    * @atomicservice
1534    * @since arkts {'1.1':'12','1.2':'20'}
1535    * @arkts 1.1&1.2
1536    */
1537  enableVariableFontWeight?: boolean;
1538 }
1539
1540 /**
1541 * The TextChangeOptions.
1542 * @interface TextChangeOptions
1543 * @syscap SystemCapability.ArkUI.ArkUI.Full
1544 * @crossplatform
1545 * @atomicservice
1546 * @since arkts {'1.1':'15','1.2':'20'}
1547 * @arkts 1.1&1.2
1548 */
1549declare interface TextChangeOptions {
1550  /**
1551   * The selected area before the change.
1552   *
1553   * @type { TextRange }
1554   * @syscap SystemCapability.ArkUI.ArkUI.Full
1555   * @crossplatform
1556   * @atomicservice
1557   * @since arkts {'1.1':'15','1.2':'20'}
1558   * @arkts 1.1&1.2
1559   */
1560  rangeBefore: TextRange;
1561
1562  /**
1563   * The selected area after the change.
1564   *
1565   * @type { TextRange }
1566   * @syscap SystemCapability.ArkUI.ArkUI.Full
1567   * @crossplatform
1568   * @atomicservice
1569   * @since arkts {'1.1':'15','1.2':'20'}
1570   * @arkts 1.1&1.2
1571   */
1572  rangeAfter: TextRange;
1573
1574  /**
1575   * The content before the change.
1576   *
1577   * @type { string }
1578   * @syscap SystemCapability.ArkUI.ArkUI.Full
1579   * @crossplatform
1580   * @atomicservice
1581   * @since arkts {'1.1':'15','1.2':'20'}
1582   * @arkts 1.1&1.2
1583   */
1584  oldContent: string;
1585
1586  /**
1587   * The info of PreviewText before the change.
1588   *
1589   * @type { PreviewText }
1590   * @syscap SystemCapability.ArkUI.ArkUI.Full
1591   * @crossplatform
1592   * @atomicservice
1593   * @since arkts {'1.1':'15','1.2':'20'}
1594   * @arkts 1.1&1.2
1595   */
1596  oldPreviewText: PreviewText;
1597}
1598
1599/**
1600 * Define the editableText Component changed value.
1601 *
1602 * @interface EditableTextChangeValue
1603 * @syscap SystemCapability.ArkUI.ArkUI.Full
1604 * @crossplatform
1605 * @atomicservice
1606 * @since arkts {'1.1':'15','1.2':'20'}
1607 * @arkts 1.1&1.2
1608 */
1609interface EditableTextChangeValue {
1610  /**
1611   * Value of body text, without previewText value.
1612   *
1613   * @type { string }
1614   * @syscap SystemCapability.ArkUI.ArkUI.Full
1615   * @crossplatform
1616   * @atomicservice
1617   * @since arkts {'1.1':'15','1.2':'20'}
1618   * @arkts 1.1&1.2
1619   */
1620  content: string;
1621
1622  /**
1623   * Info of previewText, contains previewText value and start index.
1624   *
1625   * @type { ?PreviewText }
1626   * @syscap SystemCapability.ArkUI.ArkUI.Full
1627   * @crossplatform
1628   * @atomicservice
1629   * @since arkts {'1.1':'15','1.2':'20'}
1630   * @arkts 1.1&1.2
1631   */
1632  previewText?: PreviewText;
1633
1634  /**
1635   * The TextChangeOptions.
1636   *
1637   * @type { TextChangeOptions }
1638   * @syscap SystemCapability.ArkUI.ArkUI.Full
1639   * @crossplatform
1640   * @atomicservice
1641   * @since arkts {'1.1':'15','1.2':'20'}
1642   * @arkts 1.1&1.2
1643   */
1644  options?: TextChangeOptions;
1645}
1646
1647 /**
1648  * Defines text menu show mode.
1649  *
1650  * @enum { number }
1651  * @syscap SystemCapability.ArkUI.ArkUI.Full
1652  * @crossplatform
1653  * @atomicservice
1654  * @since arkts {'1.1':'16','1.2':'20'}
1655  * @arkts 1.1&1.2
1656  */
1657declare enum TextMenuShowMode {
1658  /**
1659   * Display the text selection menu in the current window.
1660   *
1661   * @syscap SystemCapability.ArkUI.ArkUI.Full
1662   * @crossplatform
1663   * @atomicservice
1664   * @since arkts {'1.1':'16','1.2':'20'}
1665   * @arkts 1.1&1.2
1666   */
1667  DEFAULT = 0,
1668
1669  /**
1670   * Prefer to display the text selection menu in a separate window
1671   * and continue to display it within the current window if a separate window is not supported
1672   *
1673   * @syscap SystemCapability.ArkUI.ArkUI.Full
1674   * @crossplatform
1675   * @atomicservice
1676   * @since arkts {'1.1':'16','1.2':'20'}
1677   * @arkts 1.1&1.2
1678   */
1679  PREFER_WINDOW = 1,
1680}
1681
1682 /**
1683  * Defines text menu options.
1684  *
1685  * @interface TextMenuOptions
1686  * @syscap SystemCapability.ArkUI.ArkUI.Full
1687  * @crossplatform
1688  * @atomicservice
1689  * @since arkts {'1.1':'16','1.2':'20'}
1690  * @arkts 1.1&1.2
1691  */
1692declare interface TextMenuOptions {
1693  /**
1694   * Text menu show mode.
1695   *
1696   * @type { ?TextMenuShowMode }
1697   * @syscap SystemCapability.ArkUI.ArkUI.Full
1698   * @crossplatform
1699   * @atomicservice
1700   * @since arkts {'1.1':'16','1.2':'20'}
1701   * @arkts 1.1&1.2
1702   */
1703  showMode?: TextMenuShowMode;
1704}
1705/**
1706 * Defines keyboard appearance.
1707 *
1708 * @enum { number }
1709 * @syscap SystemCapability.ArkUI.ArkUI.Full
1710 * @atomicservice
1711 * @since arkts {'1.1':'15','1.2':'20'}
1712 * @arkts 1.1&1.2
1713 */
1714declare enum KeyboardAppearance {
1715  /**
1716   * Default appearance mode, don't adopt immersive styles
1717   *
1718   * @syscap SystemCapability.ArkUI.ArkUI.Full
1719   * @atomicservice
1720   * @since arkts {'1.1':'15','1.2':'20'}
1721   * @arkts 1.1&1.2
1722   */
1723  NONE_IMMERSIVE = 0,
1724
1725  /**
1726   * Immersive mode
1727   *
1728   * @syscap SystemCapability.ArkUI.ArkUI.Full
1729   * @atomicservice
1730   * @since arkts {'1.1':'15','1.2':'20'}
1731   * @arkts 1.1&1.2
1732   */
1733  IMMERSIVE = 1,
1734
1735  /**
1736   * Light immersive style
1737   *
1738   * @syscap SystemCapability.ArkUI.ArkUI.Full
1739   * @atomicservice
1740   * @since arkts {'1.1':'15','1.2':'20'}
1741   * @arkts 1.1&1.2
1742   */
1743  LIGHT_IMMERSIVE = 2,
1744
1745  /**
1746   * Dark immersive style
1747   *
1748   * @syscap SystemCapability.ArkUI.ArkUI.Full
1749   * @atomicservice
1750   * @since arkts {'1.1':'15','1.2':'20'}
1751   * @arkts 1.1&1.2
1752   */
1753  DARK_IMMERSIVE = 3,
1754}
1755
1756/**
1757 * Defines shader style class.
1758 *
1759 * @syscap SystemCapability.ArkUI.ArkUI.Full
1760 * @crossplatform
1761 * @atomicservice
1762 * @since 20
1763 */
1764declare class ShaderStyle {
1765}
1766
1767/**
1768 * Defines linear gradient class.
1769 *
1770 * @extends ShaderStyle
1771 * @syscap SystemCapability.ArkUI.ArkUI.Full
1772 * @crossplatform
1773 * @atomicservice
1774 * @since 20
1775 */
1776declare class LinearGradientStyle extends ShaderStyle {
1777  /**
1778   * The constructor.
1779   *
1780   * @param { LinearGradientOptions } options - The options of the gradient.
1781   * @syscap SystemCapability.ArkUI.ArkUI.Full
1782   * @crossplatform
1783   * @atomicservice
1784   * @since 20
1785   */
1786  constructor(options: LinearGradientOptions);
1787
1788  /**
1789   * The options of the gradient.
1790   * angle: Angle of linear gradient.
1791   * direction: Direction of Linear Gradient.
1792   * colors: Color description for gradients.
1793   * repeating: if the gradient colors with repeated coloring.
1794   *
1795   * @type { LinearGradientOptions }
1796   * @syscap SystemCapability.ArkUI.ArkUI.Full
1797   * @crossplatform
1798   * @atomicservice
1799   * @since 20
1800   */
1801  options: LinearGradientOptions;
1802}
1803
1804/**
1805 * Defines radial gradient class.
1806 *
1807 * @extends ShaderStyle
1808 * @syscap SystemCapability.ArkUI.ArkUI.Full
1809 * @crossplatform
1810 * @atomicservice
1811 * @since 20
1812 */
1813declare class RadialGradientStyle extends ShaderStyle {
1814  /**
1815   * The constructor.
1816   *
1817   * @param { RadialGradientOptions } options - The options of the gradient.
1818   * @syscap SystemCapability.ArkUI.ArkUI.Full
1819   * @crossplatform
1820   * @atomicservice
1821   * @since 20
1822   */
1823  constructor(options: RadialGradientOptions);
1824
1825  /**
1826   * The options of the gradient.
1827   * center: Center point of radial gradient
1828   * radius: Radius of Radial Gradient. value range [0, +∞)
1829   * colors: Color description for gradients
1830   * repeating: Refill. The default value is false
1831   *
1832   * @type { RadialGradientOptions }
1833   * @syscap SystemCapability.ArkUI.ArkUI.Full
1834   * @crossplatform
1835   * @atomicservice
1836   * @since 20
1837   */
1838  options: RadialGradientOptions;
1839}
1840
1841/**
1842 * Defines a shader with single color.
1843 *
1844 * @syscap SystemCapability.ArkUI.ArkUI.Full
1845 * @crossplatform
1846 * @atomicservice
1847 * @since 20
1848 */
1849declare class ColorShaderStyle extends ShaderStyle {
1850  /**
1851   * The constructor.
1852   *
1853   * @param { ResourceColor } color - The color used by shader.
1854   * @syscap SystemCapability.ArkUI.ArkUI.Full
1855   * @crossplatform
1856   * @atomicservice
1857   * @since 20
1858   */
1859  constructor(color: ResourceColor);
1860
1861  /**
1862   * The color of the shader.
1863   *
1864   * @type { RadialGradientOptions }
1865   * @syscap SystemCapability.ArkUI.ArkUI.Full
1866   * @crossplatform
1867   * @atomicservice
1868   * @since 20
1869   */
1870  color: ResourceColor;
1871}
1872
1873/**
1874 * Defines the text content transition class.
1875 *
1876 * @syscap SystemCapability.ArkUI.ArkUI.Full
1877 * @atomicservice
1878 * @since 20
1879 */
1880declare class ContentTransition {}
1881
1882/**
1883 * Defines the numeric text content transition class.
1884 *
1885 * @extends ContentTransition
1886 * @syscap SystemCapability.ArkUI.ArkUI.Full
1887 * @atomicservice
1888 * @since 20
1889 */
1890declare class NumericTextTransition extends ContentTransition {
1891  /**
1892   * constructor.
1893   *
1894   * @param { NumericTextTransitionOptions } [options] -  The options of numeric text transition.
1895   * @syscap SystemCapability.ArkUI.ArkUI.Full
1896   * @atomicservice
1897   * @since 20
1898   */
1899  constructor(options?: NumericTextTransitionOptions);
1900
1901  /**
1902   * The flip direction of numeric text transition.
1903   *
1904   * @type { ?FlipDirection }
1905   * @syscap SystemCapability.ArkUI.ArkUI.Full
1906   * @atomicservice
1907   * @since 20
1908   */
1909  flipDirection?: FlipDirection;
1910
1911  /**
1912   * Define whether enable blur effect.
1913   *
1914   * @type { ?boolean }
1915   * @syscap SystemCapability.ArkUI.ArkUI.Full
1916   * @atomicservice
1917   * @since 20
1918   */
1919  enableBlur?: boolean;
1920}
1921
1922/**
1923 * The options of numeric text transition.
1924 *
1925 * @interface NumericTextTransitionOptions
1926 * @syscap SystemCapability.ArkUI.ArkUI.Full
1927 * @atomicservice
1928 * @since 20
1929 */
1930declare interface NumericTextTransitionOptions {
1931  /**
1932   * Define the flip direction of numeric text transition.
1933   *
1934   * @type { ?FlipDirection }
1935   * @syscap SystemCapability.ArkUI.ArkUI.Full
1936   * @atomicservice
1937   * @since 20
1938   */
1939  flipDirection?: FlipDirection;
1940
1941  /**
1942   * Define whether enable blur effect.
1943   *
1944   * @type { ?boolean }
1945   * @syscap SystemCapability.ArkUI.ArkUI.Full
1946   * @atomicservice
1947   * @since 20
1948   */
1949  enableBlur?: boolean;
1950}
1951
1952/**
1953 * Defines the flip direction of numeric text transition.
1954 *
1955 * @enum { number }
1956 * @syscap SystemCapability.ArkUI.ArkUI.Full
1957 * @atomicservice
1958 * @since 20
1959 */
1960declare enum FlipDirection {
1961  /**
1962   * The flip direction is down.
1963   *
1964   * @syscap SystemCapability.ArkUI.ArkUI.Full
1965   * @atomicservice
1966   * @since 20
1967   */
1968  DOWN = 0,
1969
1970  /**
1971   * The flip direction is up.
1972   *
1973   * @syscap SystemCapability.ArkUI.ArkUI.Full
1974   * @atomicservice
1975   * @since 20
1976   */
1977  UP = 1,
1978}
1979
1980/**
1981 * Defines the line spacing options.
1982 * @interface LineSpacingOptions
1983 * @syscap SystemCapability.ArkUI.ArkUI.Full
1984 * @crossplatform
1985 * @atomicservice
1986 * @since 20
1987 */
1988declare interface LineSpacingOptions {
1989  /**
1990   * Used to set whether it will only take effect between lines.
1991   *
1992   * @type { ?boolean }
1993   * @syscap SystemCapability.ArkUI.ArkUI.Full
1994   * @crossplatform
1995   * @atomicservice
1996   * @since 20
1997   */
1998  onlyBetweenLines?: boolean;
1999}
2000
2001/**
2002 * Defines the options of max lines.
2003 * @interface MaxLinesOptions
2004 * @syscap SystemCapability.ArkUI.ArkUI.Full
2005 * @crossplatform
2006 * @atomicservice
2007 * @since 20
2008 */
2009declare interface MaxLinesOptions {
2010  /**
2011   * The mode of max lines.
2012   *
2013   * @type { ?MaxLinesMode }
2014   * @syscap SystemCapability.ArkUI.ArkUI.Full
2015   * @crossplatform
2016   * @atomicservice
2017   * @since 20
2018   */
2019  overflowMode?: MaxLinesMode;
2020}
2021
2022/**
2023 * Defines maxlines mode.
2024 *
2025 * @enum { number }
2026 * @syscap SystemCapability.ArkUI.ArkUI.Full
2027 * @crossplatform
2028 * @atomicservice
2029 * @since 20
2030 */
2031declare enum MaxLinesMode {
2032  /**
2033   * Default maxlines mode
2034   *
2035   * @syscap SystemCapability.ArkUI.ArkUI.Full
2036   * @crossplatform
2037   * @atomicservice
2038   * @since 20
2039   */
2040  CLIP = 0,
2041
2042  /**
2043   * Scroll mode of max lines
2044   *
2045   * @syscap SystemCapability.ArkUI.ArkUI.Full
2046   * @crossplatform
2047   * @atomicservice
2048   * @since 20
2049   */
2050  SCROLL = 1,
2051}
2052
2053/**
2054 * Defines the reason for text changes.
2055 *
2056 * @enum { number }
2057 * @syscap SystemCapability.ArkUI.ArkUI.Full
2058 * @systemapi
2059 * @since 20
2060 */
2061declare enum TextChangeReason {
2062  /**
2063   * Default value.
2064   *
2065   * @syscap SystemCapability.ArkUI.ArkUI.Full
2066   * @systemapi
2067   * @since 20
2068   */
2069  UNKNOWN = 0,
2070
2071  /**
2072   * Reason for input from input method.
2073   *
2074   * @syscap SystemCapability.ArkUI.ArkUI.Full
2075   * @systemapi
2076   * @since 20
2077   */
2078  INPUT = 1,
2079
2080  /**
2081   * Reason for paste.
2082   *
2083   * @syscap SystemCapability.ArkUI.ArkUI.Full
2084   * @systemapi
2085   * @since 20
2086   */
2087  PASTE = 2,
2088
2089  /**
2090   * Reason for cut.
2091   *
2092   * @syscap SystemCapability.ArkUI.ArkUI.Full
2093   * @systemapi
2094   * @since 20
2095   */
2096  CUT = 3,
2097
2098  /**
2099   * Reason for drag.
2100   *
2101   * @syscap SystemCapability.ArkUI.ArkUI.Full
2102   * @systemapi
2103   * @since 20
2104   */
2105  DRAG = 4,
2106
2107  /**
2108   * Reason for auto fill.
2109   *
2110   * @syscap SystemCapability.ArkUI.ArkUI.Full
2111   * @systemapi
2112   * @since 20
2113   */
2114  AUTO_FILL = 5,
2115
2116  /**
2117   * Reason for ai write.
2118   *
2119   * @syscap SystemCapability.ArkUI.ArkUI.Full
2120   * @systemapi
2121   * @since 20
2122   */
2123  AI_WRITE = 6,
2124
2125  /**
2126   * Reason for redo.
2127   *
2128   * @syscap SystemCapability.ArkUI.ArkUI.Full
2129   * @systemapi
2130   * @since 20
2131   */
2132  REDO = 7,
2133
2134  /**
2135   * Reason for undo.
2136   *
2137   * @syscap SystemCapability.ArkUI.ArkUI.Full
2138   * @systemapi
2139   * @since 20
2140   */
2141  UNDO = 8,
2142
2143  /**
2144   * Reason for controller methods.
2145   *
2146   * @syscap SystemCapability.ArkUI.ArkUI.Full
2147   * @systemapi
2148   * @since 20
2149   */
2150  CONTROLLER = 9,
2151
2152  /**
2153   * Reason for accessibilty methods.
2154   *
2155   * @syscap SystemCapability.ArkUI.ArkUI.Full
2156   * @systemapi
2157   * @since 20
2158   */
2159  ACCESSIBILITY = 10,
2160
2161  /**
2162   * Reason for collarboration input.
2163   *
2164   * @syscap SystemCapability.ArkUI.ArkUI.Full
2165   * @systemapi
2166   * @since 20
2167   */
2168  COLLABORATION = 11,
2169
2170  /**
2171   * Reason for stylus input.
2172   *
2173   * @syscap SystemCapability.ArkUI.ArkUI.Full
2174   * @systemapi
2175   * @since 20
2176   */
2177  STYLUS = 12
2178}
2179
2180/**
2181 * Keyboard Gradient mode.
2182 *
2183 * @enum { number }
2184 * @syscap SystemCapability.ArkUI.ArkUI.Full
2185 * @systemapi
2186 * @since 20
2187 */
2188declare enum KeyboardGradientMode {
2189  /**
2190   * Disable gradient mode.
2191   *
2192   * @syscap SystemCapability.ArkUI.ArkUI.Full
2193   * @systemapi
2194   * @since 20
2195   */
2196  NONE = 0,
2197
2198  /**
2199   * Linear gradient mode.
2200   *
2201   * @syscap SystemCapability.ArkUI.ArkUI.Full
2202   * @systemapi
2203   * @since 20
2204   */
2205  LINEAR_GRADIENT = 1,
2206}
2207
2208/**
2209 * Keyboard fluid light mode.
2210 *
2211 * @enum { number }
2212 * @syscap SystemCapability.ArkUI.ArkUI.Full
2213 * @systemapi
2214 * @since 20
2215 */
2216declare enum KeyboardFluidLightMode {
2217  /**
2218   * Disable fluid light mode.
2219   *
2220   * @syscap SystemCapability.ArkUI.ArkUI.Full
2221   * @systemapi
2222   * @since 20
2223   */
2224  NONE = 0,
2225
2226  /**
2227   * Background fluid light mode.
2228   *
2229   * @syscap SystemCapability.ArkUI.ArkUI.Full
2230   * @systemapi
2231   * @since 20
2232   */
2233  BACKGROUND_FLUID_LIGHT = 1,
2234}
2235
2236/**
2237 * Defines the keyboard appearance config.
2238 *
2239 * @interface KeyboardAppearanceConfig
2240 * @syscap SystemCapability.ArkUI.ArkUI.Full
2241 * @systemapi
2242 * @since 20
2243 */
2244declare interface KeyboardAppearanceConfig {
2245  /**
2246   * Used to set keyboard gradient mode.
2247   *
2248   * @type { ?KeyboardGradientMode }
2249   * @syscap SystemCapability.ArkUI.ArkUI.Full
2250   * @systemapi
2251   * @since 20
2252   */
2253  gradientMode?: KeyboardGradientMode;
2254
2255  /**
2256   * Used to set keyboard fluid light mode..
2257   *
2258   * @type { ?KeyboardFluidLightMode }
2259   * @syscap SystemCapability.ArkUI.ArkUI.Full
2260   * @systemapi
2261   * @since 20
2262   */
2263  fluidLightMode?: KeyboardFluidLightMode;
2264}
2265
2266/**
2267 * Defines the input method client.
2268 *
2269 * @interface IMEClient
2270 * @syscap SystemCapability.ArkUI.ArkUI.Full
2271 * @crossplatform
2272 * @atomicservice
2273 * @since 20
2274 */
2275declare interface IMEClient {
2276  /**
2277   * The unique ID of this input component node.
2278   *
2279   * @type { number }
2280   * @syscap SystemCapability.ArkUI.ArkUI.Full
2281   * @crossplatform
2282   * @atomicservice
2283   * @since 20
2284   */
2285  nodeId: number;
2286}
2287
2288/**
2289 * Vertical Alignment of text.
2290 *
2291 * @enum { number }
2292 * @syscap SystemCapability.ArkUI.ArkUI.Full
2293 * @crossplatform
2294 * @atomicservice
2295 * @since 20
2296 */
2297declare enum TextVerticalAlign {
2298  /**
2299   * Baseline alignment, the default value.
2300   *
2301   * @syscap SystemCapability.ArkUI.ArkUI.Full
2302   * @crossplatform
2303   * @atomicservice
2304   * @since 20
2305   */
2306  BASELINE = 0,
2307
2308  /**
2309   * Bottom alignment.
2310   *
2311   * @syscap SystemCapability.ArkUI.ArkUI.Full
2312   * @crossplatform
2313   * @atomicservice
2314   * @since 20
2315   */
2316  BOTTOM = 1,
2317
2318  /**
2319   * Center alignment.
2320   *
2321   * @syscap SystemCapability.ArkUI.ArkUI.Full
2322   * @crossplatform
2323   * @atomicservice
2324   * @since 20
2325   */
2326  CENTER = 2,
2327
2328  /**
2329   * Top alignment.
2330   *
2331   * @syscap SystemCapability.ArkUI.ArkUI.Full
2332   * @crossplatform
2333   * @atomicservice
2334   * @since 20
2335   */
2336  TOP = 3,
2337}
2338
2339/**
2340 * Defines text layout options. Use this to set constraints for measure text.
2341 *
2342 * @interface TextLayoutOptions
2343 * @syscap SystemCapability.ArkUI.ArkUI.Full
2344 * @since 20
2345 */
2346declare interface TextLayoutOptions {
2347  /**
2348   * Text display area of width.
2349   *
2350   * @type { ?LengthMetrics } constraintWidth
2351   * @syscap SystemCapability.ArkUI.ArkUI.Full
2352   * @since 20
2353   */
2354  constraintWidth?: LengthMetrics;
2355}