-
Notifications
You must be signed in to change notification settings - Fork 9
/
typography.kt
678 lines (650 loc) · 22.9 KB
/
typography.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
/*
* Designed and developed by 2022 SungbinLand, Team Duckie
*
* Licensed under the MIT.
* Please see full license: https://github.com/duckie-team/quack-quack-android/blob/master/LICENSE
*/
@file:Suppress("unused", "NewLineArgument")
package team.duckie.quackquack.ui.component
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.NonRestartableComposable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.toPersistentList
import team.duckie.quackquack.ui.color.QuackColor
import team.duckie.quackquack.ui.component.internal.QuackClickableText
import team.duckie.quackquack.ui.component.internal.QuackText
import team.duckie.quackquack.ui.modifier.quackClickable
import team.duckie.quackquack.ui.textstyle.QuackTextStyle
// [Note] @NonRestartableComposable 안한 이유: 인자로 받은 Text 는 동적으로 바뀔 수 있음
/**
* [QuackText] 에 [QuackTextStyle.HeadLine1] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
@NonRestartableComposable
public fun QuackHeadLine1(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
onClick: (() -> Unit)? = null,
overflow: TextOverflow = TextOverflow.Clip,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.HeadLine1.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.HeadLine2] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트가 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackHeadLine2(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
onClick: (() -> Unit)? = null,
overflow: TextOverflow = TextOverflow.Clip,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.HeadLine2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Title1] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackTitle1(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Title1.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Title2] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackTitle2(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Title2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Subtitle] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackSubtitle(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Subtitle.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Subtitle2] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackSubtitle2(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Subtitle2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Body1] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackBody1(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Body1.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Body2] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackBody2(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Body2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackText] 에 [QuackTextStyle.Body3] 스타일을 적용하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄만 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
public fun QuackBody3(
modifier: Modifier = Modifier,
text: String,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
): Unit = QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
text = text,
style = QuackTextStyle.Body3.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
/**
* [QuackHeadLine2] 에 원하는 부분에 원하는 색깔과 밑줄로 강조하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param underlineText 강조할 텍스트 리스트
* @param underlineTextColor 강조할 Text 의 색깔
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param singleLine 텍스트를 한 줄로 사용할지 여부
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
*/
@Composable
@NonRestartableComposable
public fun QuackUnderlineHeadLine2(
modifier: Modifier = Modifier,
text: String,
underlineText: PersistentList<String>,
underlineTextColor: QuackColor = QuackColor.DuckieOrange,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
singleLine: Boolean = false,
rippleEnabled: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
) {
QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
annotatedText = buildAnnotatedString {
append(text)
underlineText.forEach { highlightText ->
val highlightStartIndex = text.indexOf(
string = highlightText
)
if (highlightStartIndex != -1) {
addStyle(
style = SpanStyle(
color = underlineTextColor.composeColor,
textDecoration = TextDecoration.Underline,
),
start = highlightStartIndex,
end = highlightStartIndex + highlightText.length,
)
}
}
},
style = QuackTextStyle.HeadLine2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
}
/**
* [QuackUnderlineBody3] 에 원하는 부분에 원하는 색깔과 밑줄로 강조하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param underlineText 강조할 텍스트 리스트들
* @param undelineTextColor 강조할 Text 의 색깔
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
* @param singleLine 텍스트를 한 줄로 사용할지 여부
*/
@Composable
@NonRestartableComposable
public fun QuackUnderlineBody3(
modifier: Modifier = Modifier,
text: String,
underlineText: PersistentList<String>,
undelineTextColor: QuackColor = QuackColor.DuckieOrange,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
) {
QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
annotatedText = buildAnnotatedString {
append(text)
underlineText.forEach { highlightText ->
val highlightStartIndex = text.indexOf(
string = highlightText
)
if (highlightStartIndex != -1) {
addStyle(
style = SpanStyle(
color = undelineTextColor.composeColor,
textDecoration = TextDecoration.Underline,
),
start = highlightStartIndex,
end = highlightStartIndex + highlightText.length,
)
}
}
},
style = QuackTextStyle.Body3.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
}
/**
* [QuackUnderlineBody3] 에 원하는 부분에 원하는 색깔과 밑줄로 강조하여
* 주어진 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param highlightText 강조할 텍스트 리스트들
* @param color 텍스트의 색상
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
* @param singleLine 텍스트를 한 줄로 사용할지 여부
*/
@Composable
@NonRestartableComposable
public fun QuackHighlightBody1(
modifier: Modifier = Modifier,
text: String,
highlightText: PersistentList<String>,
color: QuackColor = QuackColor.Black,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
) {
QuackText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
annotatedText = buildAnnotatedString {
append(text)
highlightText.forEach { highlightText ->
val highlightStartIndex = text.indexOf(
string = highlightText
)
if (highlightStartIndex != -1) {
addStyle(
style = SpanStyle(
fontWeight = FontWeight.SemiBold,
letterSpacing = 0.sp,
),
start = highlightStartIndex,
end = highlightStartIndex + highlightText.length,
)
}
}
},
style = QuackTextStyle.Body1.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
)
}
/**
* [QuackBody2] 에 원하는 부분에 원하는 색깔, 밑줄, 굵기 처리, 해당 영역 이벤트 클릭
* 등이 들어간 텍스트를 표시합니다.
*
* @param modifier 컴포넌트의 Modifier => align과 padding등을 위하여 열어놨습니다.
* @param text 표시할 텍스트
* @param highlightTextPairs (강조할 텍스트 및 그에 대응하는 클릭 이벤트) Pair 리스트
* @param color 텍스트의 색상
* @param highlightColor 강조할 Text 의 색깔
* @param underlineEnabled 밑줄 처리 활성화할것인지 flag
* @param highlightFontWeight 강조 처리하는 글자의 굵기
* @param align 텍스트 정렬
* @param rippleEnabled 텍스트 클릭시 ripple 발생 여부
* @param singleLine 텍스트를 한 줄로 사용할지 여부
* @param onClick 텍스트이 클릭됐을 때 실행할 람다식
* @param overflow 텍스트 overflow 될 시 처리 방법
* @param onClick 클릭 이벤트
*/
@Composable
@NonRestartableComposable
public fun QuackAnnotatedBody2(
modifier: Modifier = Modifier,
text: String,
highlightTextPairs: PersistentList<Pair<String, (() -> Unit)?>>,
color: QuackColor = QuackColor.Black,
highlightColor: QuackColor = QuackColor.Black,
underlineEnabled: Boolean = false,
highlightFontWeight: FontWeight = FontWeight.SemiBold,
align: TextAlign = TextAlign.Start,
rippleEnabled: Boolean = false,
singleLine: Boolean = false,
overflow: TextOverflow = TextOverflow.Clip,
onClick: (() -> Unit)? = null,
) {
// QuackClickableText 에서 활용할 하이라이트 텍스트 목록
// 계산을 먼저 완료한 상태에서 컴포저블 작업에 들어가므로
// SnapshotStateList 로 만들 필요가 없음
val highlightTextInfo = remember(
key1 = highlightTextPairs,
) {
buildList {
// 전체 문자열 내에서, 검색 시작 index offset
var startIndexOffset = 0
highlightTextPairs.forEach { (targetText, targetTextClickEvent) ->
val subStringStartIndex = text
.substring(
startIndex = startIndexOffset,
).indexOf(
string = targetText,
)
if (subStringStartIndex != -1) {
val realStartIndex = startIndexOffset + subStringStartIndex
val realEndIndex = realStartIndex + targetText.length
// 텍스트 클릭 이벤트 처리
targetTextClickEvent?.let {
// ClickEventTextInfo 데이터 추가
add(
element = HighlightTextInfo(
text = targetText,
startIndex = realStartIndex,
endIndex = realEndIndex,
onClick = targetTextClickEvent,
),
)
}
startIndexOffset = realEndIndex
}
}
}
}
QuackClickableText(
modifier = modifier.quackClickable(
rippleEnabled = rippleEnabled,
onClick = onClick,
),
clickEventTextInfo = highlightTextInfo.toPersistentList(),
text = buildAnnotatedString {
append(
text = text,
)
highlightTextInfo.forEach { (text, startIndex, endIndex, onClick) ->
// 텍스트 클릭 이벤트 처리
onClick?.let {
// StringAnnotation 데이터 추가
addStringAnnotation(
tag = text,
annotation = "",
start = startIndex,
end = endIndex,
)
}
// 스타일링 처리
val textDecoration = TextDecoration.Underline.takeIf {
underlineEnabled
}
addStyle(
style = SpanStyle(
color = highlightColor.composeColor,
fontWeight = highlightFontWeight,
letterSpacing = 0.sp,
textDecoration = textDecoration,
),
start = startIndex,
end = endIndex,
)
}
},
style = QuackTextStyle.Body2.change(
color = color,
textAlign = align,
),
singleLine = singleLine,
overflow = overflow,
defaultOnClick = onClick,
)
}
/**
* 하이라이트 텍스트 처리를 위해 필요한 텍스트 정보
*
* @param text 텍스트 내용
* @param startIndex 전체 텍스트 내에서 onClick 이벤트가 실행되는 시작 index
* @param endIndex 전체 텍스트 내에서 onClick 이벤트가 실행되는 마지막 index
* @param onClick 실행할 클릭 이벤트 (null 일 시 이벤트 없음)
*/
@Immutable
internal data class HighlightTextInfo(
val text: String,
val startIndex: Int,
val endIndex: Int,
val onClick: (() -> Unit)? = null,
)