• 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 * Provides an interface for writing texts.
18 *
19 * @interface TextInterface
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 7
22 */
23/**
24 * Provides an interface for writing texts.
25 *
26 * @interface TextInterface
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @since 9
29 * @form
30 */
31/**
32 * Provides an interface for writing texts.
33 *
34 * @interface TextInterface
35 * @syscap SystemCapability.ArkUI.ArkUI.Full
36 * @crossplatform
37 * @since 10
38 * @form
39 */
40interface TextInterface {
41  /**
42   * Called when writing text.
43   *
44   * @param { string | Resource } content
45   * @returns { TextAttribute }
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @since 7
48   */
49  /**
50   * Called when writing text.
51   *
52   * @param { string | Resource } content
53   * @returns { TextAttribute }
54   * @syscap SystemCapability.ArkUI.ArkUI.Full
55   * @since 9
56   * @form
57   */
58  /**
59   * Called when writing text.
60   *
61   * @param { string | Resource } content
62   * @returns { TextAttribute }
63   * @syscap SystemCapability.ArkUI.ArkUI.Full
64   * @crossplatform
65   * @since 10
66   * @form
67   */
68  (content?: string | Resource): TextAttribute;
69}
70
71/**
72 * @extends CommonMethod
73 * @syscap SystemCapability.ArkUI.ArkUI.Full
74 * @since 7
75 */
76/**
77 * @extends CommonMethod
78 * @syscap SystemCapability.ArkUI.ArkUI.Full
79 * @since 9
80 * @form
81 */
82/**
83 * @extends CommonMethod
84 * @syscap SystemCapability.ArkUI.ArkUI.Full
85 * @crossplatform
86 * @since 10
87 * @form
88 */
89declare class TextAttribute extends CommonMethod<TextAttribute> {
90  /**
91   * Called when the font is set.
92   *
93   * @param { Font } value - the text font size and weight and family and style.
94   * @returns { TextAttribute } The attribute of the text.
95   * @syscap SystemCapability.ArkUI.ArkUI.Full
96   * @since 10
97   */
98  font(value: Font): TextAttribute;
99
100  /**
101   * Called when the font color is set.
102   *
103   * @param { ResourceColor } value
104   * @returns { TextAttribute }
105   * @syscap SystemCapability.ArkUI.ArkUI.Full
106   * @since 7
107   */
108  /**
109   * Called when the font color is set.
110   *
111   * @param { ResourceColor } value
112   * @returns { TextAttribute }
113   * @syscap SystemCapability.ArkUI.ArkUI.Full
114   * @since 9
115   * @form
116   */
117  /**
118   * Called when the font color is set.
119   *
120   * @param { ResourceColor } value
121   * @returns { TextAttribute }
122   * @syscap SystemCapability.ArkUI.ArkUI.Full
123   * @crossplatform
124   * @since 10
125   * @form
126   */
127  fontColor(value: ResourceColor): TextAttribute;
128
129  /**
130   * Called when the font size is set.
131   *
132   * @param { number | string | Resource } value
133   * @returns { TextAttribute }
134   * @syscap SystemCapability.ArkUI.ArkUI.Full
135   * @since 7
136   */
137  /**
138   * Called when the font size is set.
139   *
140   * @param { number | string | Resource } value
141   * @returns { TextAttribute }
142   * @syscap SystemCapability.ArkUI.ArkUI.Full
143   * @since 9
144   * @form
145   */
146  /**
147   * Called when the font size is set.
148   *
149   * @param { number | string | Resource } value
150   * @returns { TextAttribute }
151   * @syscap SystemCapability.ArkUI.ArkUI.Full
152   * @crossplatform
153   * @since 10
154   * @form
155   */
156  fontSize(value: number | string | Resource): TextAttribute;
157
158  /**
159   * Called when the minimum font size of the font is set.
160   *
161   * @param { number | string | Resource } value
162   * @returns { TextAttribute }
163   * @syscap SystemCapability.ArkUI.ArkUI.Full
164   * @since 7
165   */
166  /**
167   * Called when the minimum font size of the font is set.
168   *
169   * @param { number | string | Resource } value
170   * @returns { TextAttribute }
171   * @syscap SystemCapability.ArkUI.ArkUI.Full
172   * @since 9
173   * @form
174   */
175  /**
176   * Called when the minimum font size of the font is set.
177   *
178   * @param { number | string | Resource } value
179   * @returns { TextAttribute }
180   * @syscap SystemCapability.ArkUI.ArkUI.Full
181   * @crossplatform
182   * @since 10
183   * @form
184   */
185  minFontSize(value: number | string | Resource): TextAttribute;
186
187  /**
188   * Called when the maximum font size of the font is set.
189   *
190   * @param { number | string | Resource } value
191   * @returns { TextAttribute }
192   * @syscap SystemCapability.ArkUI.ArkUI.Full
193   * @since 7
194   */
195  /**
196   * Called when the maximum font size of the font is set.
197   *
198   * @param { number | string | Resource } value
199   * @returns { TextAttribute }
200   * @syscap SystemCapability.ArkUI.ArkUI.Full
201   * @since 9
202   * @form
203   */
204  /**
205   * Called when the maximum font size of the font is set.
206   *
207   * @param { number | string | Resource } value
208   * @returns { TextAttribute }
209   * @syscap SystemCapability.ArkUI.ArkUI.Full
210   * @crossplatform
211   * @since 10
212   * @form
213   */
214  maxFontSize(value: number | string | Resource): TextAttribute;
215
216  /**
217   * Called when the font style of a font is set.
218   *
219   * @param { FontStyle } value
220   * @returns { TextAttribute }
221   * @syscap SystemCapability.ArkUI.ArkUI.Full
222   * @since 7
223   */
224  /**
225   * Called when the font style of a font is set.
226   *
227   * @param { FontStyle } value
228   * @returns { TextAttribute }
229   * @syscap SystemCapability.ArkUI.ArkUI.Full
230   * @since 9
231   * @form
232   */
233  /**
234   * Called when the font style of a font is set.
235   *
236   * @param { FontStyle } value
237   * @returns { TextAttribute }
238   * @syscap SystemCapability.ArkUI.ArkUI.Full
239   * @crossplatform
240   * @since 10
241   * @form
242   */
243  fontStyle(value: FontStyle): TextAttribute;
244
245  /**
246   * Called when the font weight is set.
247   *
248   * @param { number | FontWeight | string } value
249   * @returns { TextAttribute }
250   * @syscap SystemCapability.ArkUI.ArkUI.Full
251   * @since 7
252   */
253  /**
254   * Called when the font weight is set.
255   *
256   * @param { number | FontWeight | string } value
257   * @returns { TextAttribute }
258   * @syscap SystemCapability.ArkUI.ArkUI.Full
259   * @since 9
260   * @form
261   */
262  /**
263   * Called when the font weight is set.
264   *
265   * @param { number | FontWeight | string } value
266   * @returns { TextAttribute }
267   * @syscap SystemCapability.ArkUI.ArkUI.Full
268   * @crossplatform
269   * @since 10
270   * @form
271   */
272  fontWeight(value: number | FontWeight | string): TextAttribute;
273
274  /**
275   * Called when the horizontal center mode of the font is set.
276   *
277   * @param { TextAlign } value
278   * @returns { TextAttribute }
279   * @syscap SystemCapability.ArkUI.ArkUI.Full
280   * @since 7
281   */
282  /**
283   * Called when the horizontal center mode of the font is set.
284   *
285   * @param { TextAlign } value
286   * @returns { TextAttribute }
287   * @syscap SystemCapability.ArkUI.ArkUI.Full
288   * @since 9
289   * @form
290   */
291  /**
292   * Called when the horizontal center mode of the font is set.
293   *
294   * @param { TextAlign } value
295   * @returns { TextAttribute }
296   * @syscap SystemCapability.ArkUI.ArkUI.Full
297   * @crossplatform
298   * @since 10
299   * @form
300   */
301  textAlign(value: TextAlign): TextAttribute;
302
303  /**
304   * Called when the vertical center mode of the font is set.
305   *
306   * @param { number | string | Resource } value
307   * @returns { TextAttribute }
308   * @syscap SystemCapability.ArkUI.ArkUI.Full
309   * @since 7
310   */
311  /**
312   * Called when the vertical center mode of the font is set.
313   *
314   * @param { number | string | Resource } value
315   * @returns { TextAttribute }
316   * @syscap SystemCapability.ArkUI.ArkUI.Full
317   * @since 9
318   * @form
319   */
320  /**
321   * Called when the vertical center mode of the font is set.
322   *
323   * @param { number | string | Resource } value
324   * @returns { TextAttribute }
325   * @syscap SystemCapability.ArkUI.ArkUI.Full
326   * @crossplatform
327   * @since 10
328   * @form
329   */
330  lineHeight(value: number | string | Resource): TextAttribute;
331
332  /**
333   * Called when the overflow mode of the font is set.
334   *
335   * @param { object } value
336   * @returns { TextAttribute }
337   * @syscap SystemCapability.ArkUI.ArkUI.Full
338   * @since 7
339   */
340  /**
341   * Called when the overflow mode of the font is set.
342   *
343   * @param { object } value
344   * @returns { TextAttribute }
345   * @syscap SystemCapability.ArkUI.ArkUI.Full
346   * @since 9
347   * @form
348   */
349  /**
350   * Called when the overflow mode of the font is set.
351   *
352   * @param { object } value
353   * @returns { TextAttribute }
354   * @syscap SystemCapability.ArkUI.ArkUI.Full
355   * @crossplatform
356   * @since 10
357   * @form
358   */
359  textOverflow(value: { overflow: TextOverflow }): TextAttribute;
360
361  /**
362   * Called when the font list of text is set.
363   *
364   * @param { string | Resource } value
365   * @returns { TextAttribute }
366   * @syscap SystemCapability.ArkUI.ArkUI.Full
367   * @since 7
368   */
369  /**
370   * Called when the font list of text is set.
371   *
372   * @param { string | Resource } value
373   * @returns { TextAttribute }
374   * @syscap SystemCapability.ArkUI.ArkUI.Full
375   * @since 9
376   * @form
377   */
378  /**
379   * Called when the font list of text is set.
380   *
381   * @param { string | Resource } value
382   * @returns { TextAttribute }
383   * @syscap SystemCapability.ArkUI.ArkUI.Full
384   * @crossplatform
385   * @since 10
386   * @form
387   */
388  fontFamily(value: string | Resource): TextAttribute;
389
390  /**
391   * Called when the maximum number of lines of text is set.
392   *
393   * @param { number } value
394   * @returns { TextAttribute }
395   * @syscap SystemCapability.ArkUI.ArkUI.Full
396   * @since 7
397   */
398  /**
399   * Called when the maximum number of lines of text is set.
400   *
401   * @param { number } value
402   * @returns { TextAttribute }
403   * @syscap SystemCapability.ArkUI.ArkUI.Full
404   * @since 9
405   * @form
406   */
407  /**
408   * Called when the maximum number of lines of text is set.
409   *
410   * @param { number } value
411   * @returns { TextAttribute }
412   * @syscap SystemCapability.ArkUI.ArkUI.Full
413   * @crossplatform
414   * @since 10
415   * @form
416   */
417  maxLines(value: number): TextAttribute;
418
419  /**
420   * Called when the text decoration of the text is set.
421   *
422   * @param { object } value
423   * @returns { TextAttribute }
424   * @syscap SystemCapability.ArkUI.ArkUI.Full
425   * @since 7
426   */
427  /**
428   * Called when the text decoration of the text is set.
429   *
430   * @param { object } value
431   * @returns { TextAttribute }
432   * @syscap SystemCapability.ArkUI.ArkUI.Full
433   * @since 9
434   * @form
435   */
436  /**
437   * Called when the text decoration of the text is set.
438   *
439   * @param { object } value
440   * @returns { TextAttribute }
441   * @syscap SystemCapability.ArkUI.ArkUI.Full
442   * @crossplatform
443   * @since 10
444   * @form
445   */
446  decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;
447
448  /**
449   * Called when the distance between text fonts is set.
450   *
451   * @param { number | string } value
452   * @returns { TextAttribute }
453   * @syscap SystemCapability.ArkUI.ArkUI.Full
454   * @since 7
455   */
456  /**
457   * Called when the distance between text fonts is set.
458   *
459   * @param { number | string } value
460   * @returns { TextAttribute }
461   * @syscap SystemCapability.ArkUI.ArkUI.Full
462   * @since 9
463   * @form
464   */
465  /**
466   * Called when the distance between text fonts is set.
467   *
468   * @param { number | string } value
469   * @returns { TextAttribute }
470   * @syscap SystemCapability.ArkUI.ArkUI.Full
471   * @crossplatform
472   * @since 10
473   * @form
474   */
475  letterSpacing(value: number | string): TextAttribute;
476
477  /**
478   * Called when the type of letter in the text font is set.
479   *
480   * @param { TextCase } value
481   * @returns { TextAttribute }
482   * @syscap SystemCapability.ArkUI.ArkUI.Full
483   * @since 7
484   */
485  /**
486   * Called when the type of letter in the text font is set.
487   *
488   * @param { TextCase } value
489   * @returns { TextAttribute }
490   * @syscap SystemCapability.ArkUI.ArkUI.Full
491   * @since 9
492   * @form
493   */
494  /**
495   * Called when the type of letter in the text font is set.
496   *
497   * @param { TextCase } value
498   * @returns { TextAttribute }
499   * @syscap SystemCapability.ArkUI.ArkUI.Full
500   * @crossplatform
501   * @since 10
502   * @form
503   */
504  textCase(value: TextCase): TextAttribute;
505
506  /**
507   * Called when the baseline offset is set.
508   *
509   * @param { number | string } value
510   * @returns { TextAttribute }
511   * @syscap SystemCapability.ArkUI.ArkUI.Full
512   * @since 7
513   */
514  /**
515   * Called when the baseline offset is set.
516   *
517   * @param { number | string } value
518   * @returns { TextAttribute }
519   * @syscap SystemCapability.ArkUI.ArkUI.Full
520   * @since 9
521   * @form
522   */
523  /**
524   * Called when the baseline offset is set.
525   *
526   * @param { number | string } value
527   * @returns { TextAttribute }
528   * @syscap SystemCapability.ArkUI.ArkUI.Full
529   * @crossplatform
530   * @since 10
531   * @form
532   */
533  baselineOffset(value: number | string): TextAttribute;
534
535  /**
536   * Allow replication.
537   *
538   * @param { CopyOptions } value
539   * @returns { TextAttribute }
540   * @syscap SystemCapability.ArkUI.ArkUI.Full
541   * @since 9
542   * @form
543   */
544  /**
545   * Allow replication.
546   *
547   * @param { CopyOptions } value
548   * @returns { TextAttribute }
549   * @syscap SystemCapability.ArkUI.ArkUI.Full
550   * @crossplatform
551   * @since 10
552   * @form
553   */
554  copyOption(value: CopyOptions): TextAttribute;
555
556  /**
557   * Enable the selectable area can be dragged.
558   *
559   * @param { boolean } value
560   * @returns { TextAttribute }
561   * @syscap SystemCapability.ArkUI.ArkUI.Full
562   * @since 9
563   */
564  draggable(value: boolean): TextAttribute;
565
566  /**
567   * Called when the text shadow is set.
568   *
569   * @param { ShadowOptions } value - The shadow options.
570   * @returns { TextAttribute }
571   * @syscap SystemCapability.ArkUI.ArkUI.Full
572   * @crossplatform
573   * @since 10
574   * @form
575   */
576  textShadow(value: ShadowOptions): TextAttribute;
577
578  /**
579   * Called when the height adaptive policy is set.
580   *
581   * @param { TextHeightAdaptivePolicy } value - The height adaptive policy.
582   * @returns { TextAttribute }
583   * @syscap SystemCapability.ArkUI.ArkUI.Full
584   * @crossplatform
585   * @since 10
586   */
587  heightAdaptivePolicy(value: TextHeightAdaptivePolicy): TextAttribute;
588
589  /**
590   * Specify the indentation of the first line in a text-block.
591   *
592   * @param { Length } value - The length of text indent.
593   * @returns { TextAttribute } The attribute of the text.
594   * @syscap SystemCapability.ArkUI.ArkUI.Full
595   * @crossplatform
596   * @since 10
597   */
598  textIndent(value: Length): TextAttribute;
599}
600
601/**
602 * Defines Text Component instance.
603 *
604 * @syscap SystemCapability.ArkUI.ArkUI.Full
605 * @since 7
606 */
607/**
608 * Defines Text Component instance.
609 *
610 * @syscap SystemCapability.ArkUI.ArkUI.Full
611 * @since 9
612 * @form
613 */
614/**
615 * Defines Text Component instance.
616 *
617 * @syscap SystemCapability.ArkUI.ArkUI.Full
618 * @crossplatform
619 * @since 10
620 * @form
621 */
622declare const TextInstance: TextAttribute;
623
624/**
625 * Defines Text Component.
626 *
627 * @syscap SystemCapability.ArkUI.ArkUI.Full
628 * @since 7
629 */
630/**
631 * Defines Text Component.
632 *
633 * @syscap SystemCapability.ArkUI.ArkUI.Full
634 * @since 9
635 * @form
636 */
637/**
638 * Defines Text Component.
639 *
640 * @syscap SystemCapability.ArkUI.ArkUI.Full
641 * @crossplatform
642 * @since 10
643 * @form
644 */
645declare const Text: TextInterface;
646