mirror of
https://github.com/JakeWharton/mosaic.git
synced 2025-10-29 09:39:13 +08:00
Bring back Kitty underlines! (#806)
The difference in UnderlineStyle as opposed to Color and TextStyle was that it had a private constructor. Changing that to internal like the others avoids the compiler bug.
This commit is contained in:
@ -6,6 +6,7 @@
|
||||
New:
|
||||
- Add `focused` and `darkTheme` booleans to `Terminal` (available through `LocalTerminal`). These default to true and false, respectively, but will be updated if the terminal supports sending change notifications.
|
||||
- Bind `Terminal.focused` to a `Lifecycle` and expose into the composition as `LocalLifecycleOwner`. This allows using Compose lifecycle helpers such as `LifecycleResumeEffect` and others.
|
||||
- Underline styles (single, double, dashed, dotted, curved) and colors can now be specified for text and annotated string spans.
|
||||
- `LocalStaticLogger` composition local provides access to `StaticLogger` which allows logging plain strings at arbitrary points for inclusion in the next frame. This can be used from effects, callback, state classes, etc.
|
||||
|
||||
Changed:
|
||||
|
||||
@ -601,8 +601,8 @@ public final class com/jakewharton/mosaic/ui/SpacerKt {
|
||||
}
|
||||
|
||||
public final class com/jakewharton/mosaic/ui/Text {
|
||||
public static final fun Text-GddN7rU (Lcom/jakewharton/mosaic/text/AnnotatedString;Lcom/jakewharton/mosaic/modifier/Modifier;IIILandroidx/compose/runtime/Composer;II)V
|
||||
public static final fun Text-GddN7rU (Ljava/lang/String;Lcom/jakewharton/mosaic/modifier/Modifier;IIILandroidx/compose/runtime/Composer;II)V
|
||||
public static final fun Text-cbmis8g (Lcom/jakewharton/mosaic/text/AnnotatedString;Lcom/jakewharton/mosaic/modifier/Modifier;IIIIILandroidx/compose/runtime/Composer;II)V
|
||||
public static final fun Text-cbmis8g (Ljava/lang/String;Lcom/jakewharton/mosaic/modifier/Modifier;IIIIILandroidx/compose/runtime/Composer;II)V
|
||||
}
|
||||
|
||||
public final class com/jakewharton/mosaic/ui/TextStyle {
|
||||
|
||||
@ -809,8 +809,8 @@ final fun com.jakewharton.mosaic.ui/Filler(kotlin/Int, com.jakewharton.mosaic.mo
|
||||
final fun com.jakewharton.mosaic.ui/Layout(kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, com.jakewharton.mosaic.modifier/Modifier?, kotlin/Function0<kotlin/String>?, com.jakewharton.mosaic.layout/MeasurePolicy, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Layout|Layout(kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;com.jakewharton.mosaic.modifier.Modifier?;kotlin.Function0<kotlin.String>?;com.jakewharton.mosaic.layout.MeasurePolicy;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Row(com.jakewharton.mosaic.modifier/Modifier?, com.jakewharton.mosaic.ui/Arrangement.Horizontal?, com.jakewharton.mosaic.ui/Alignment.Vertical?, kotlin/Function3<com.jakewharton.mosaic.ui/RowScope, androidx.compose.runtime/Composer, kotlin/Int, kotlin/Unit>, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Row|Row(com.jakewharton.mosaic.modifier.Modifier?;com.jakewharton.mosaic.ui.Arrangement.Horizontal?;com.jakewharton.mosaic.ui.Alignment.Vertical?;kotlin.Function3<com.jakewharton.mosaic.ui.RowScope,androidx.compose.runtime.Composer,kotlin.Int,kotlin.Unit>;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Spacer(com.jakewharton.mosaic.modifier/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Spacer|Spacer(com.jakewharton.mosaic.modifier.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Text(com.jakewharton.mosaic.text/AnnotatedString, com.jakewharton.mosaic.modifier/Modifier?, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/TextStyle, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Text|Text(com.jakewharton.mosaic.text.AnnotatedString;com.jakewharton.mosaic.modifier.Modifier?;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.TextStyle;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Text(kotlin/String, com.jakewharton.mosaic.modifier/Modifier?, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/TextStyle, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Text|Text(kotlin.String;com.jakewharton.mosaic.modifier.Modifier?;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.TextStyle;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Text(com.jakewharton.mosaic.text/AnnotatedString, com.jakewharton.mosaic.modifier/Modifier?, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/TextStyle, com.jakewharton.mosaic.ui/UnderlineStyle, com.jakewharton.mosaic.ui/Color, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Text|Text(com.jakewharton.mosaic.text.AnnotatedString;com.jakewharton.mosaic.modifier.Modifier?;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.TextStyle;com.jakewharton.mosaic.ui.UnderlineStyle;com.jakewharton.mosaic.ui.Color;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/Text(kotlin/String, com.jakewharton.mosaic.modifier/Modifier?, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/Color, com.jakewharton.mosaic.ui/TextStyle, com.jakewharton.mosaic.ui/UnderlineStyle, com.jakewharton.mosaic.ui/Color, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // com.jakewharton.mosaic.ui/Text|Text(kotlin.String;com.jakewharton.mosaic.modifier.Modifier?;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.Color;com.jakewharton.mosaic.ui.TextStyle;com.jakewharton.mosaic.ui.UnderlineStyle;com.jakewharton.mosaic.ui.Color;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement$stableprop_getter(): kotlin/Int // com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement$stableprop_getter|com_jakewharton_mosaic_ui_Arrangement$stableprop_getter(){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement_Absolute$stableprop_getter(): kotlin/Int // com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement_Absolute$stableprop_getter|com_jakewharton_mosaic_ui_Arrangement_Absolute$stableprop_getter(){}[0]
|
||||
final fun com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement_SpacedAligned$stableprop_getter(): kotlin/Int // com.jakewharton.mosaic.ui/com_jakewharton_mosaic_ui_Arrangement_SpacedAligned$stableprop_getter|com_jakewharton_mosaic_ui_Arrangement_SpacedAligned$stableprop_getter(){}[0]
|
||||
|
||||
@ -19,9 +19,8 @@ public fun Text(
|
||||
color: Color = Color.Unspecified,
|
||||
background: Color = Color.Unspecified,
|
||||
textStyle: TextStyle = TextStyle.Unspecified,
|
||||
// TODO https://github.com/JakeWharton/mosaic/issues/802
|
||||
// underlineStyle: UnderlineStyle = UnderlineStyle.Unspecified,
|
||||
// underlineColor: Color = Color.Unspecified,
|
||||
underlineStyle: UnderlineStyle = UnderlineStyle.Unspecified,
|
||||
underlineColor: Color = Color.Unspecified,
|
||||
) {
|
||||
val layout = remember { StringTextLayout() }
|
||||
layout.value = value
|
||||
@ -36,9 +35,7 @@ public fun Text(
|
||||
},
|
||||
modifier = modifier.drawBehind {
|
||||
layout.lines.forEachIndexed { row, line ->
|
||||
drawText(row, 0, line, color, background, textStyle, UnderlineStyle.Unspecified, Color.Unspecified)
|
||||
// TODO https://github.com/JakeWharton/mosaic/issues/802
|
||||
// drawText(row, 0, line, color, background, textStyle, underlineStyle, underlineColor)
|
||||
drawText(row, 0, line, color, background, textStyle, underlineStyle, underlineColor)
|
||||
}
|
||||
},
|
||||
)
|
||||
@ -52,9 +49,8 @@ public fun Text(
|
||||
color: Color = Color.Unspecified,
|
||||
background: Color = Color.Unspecified,
|
||||
textStyle: TextStyle = TextStyle.Unspecified,
|
||||
// TODO https://github.com/JakeWharton/mosaic/issues/802
|
||||
// underlineStyle: UnderlineStyle = UnderlineStyle.Unspecified,
|
||||
// underlineColor: Color = Color.Unspecified,
|
||||
underlineStyle: UnderlineStyle = UnderlineStyle.Unspecified,
|
||||
underlineColor: Color = Color.Unspecified,
|
||||
) {
|
||||
val layout = remember { AnnotatedStringTextLayout() }
|
||||
layout.value = value
|
||||
@ -69,9 +65,7 @@ public fun Text(
|
||||
},
|
||||
modifier = modifier.drawBehind {
|
||||
layout.lines.forEachIndexed { row, line ->
|
||||
// TODO https://github.com/JakeWharton/mosaic/issues/802
|
||||
// drawText(row, 0, line, color, background, textStyle, underlineStyle, underlineColor)
|
||||
drawText(row, 0, line, color, background, textStyle, UnderlineStyle.Unspecified, Color.Unspecified)
|
||||
drawText(row, 0, line, color, background, textStyle, underlineStyle, underlineColor)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
@ -9,6 +9,7 @@ import kotlin.jvm.JvmInline
|
||||
|
||||
@Immutable
|
||||
@JvmInline
|
||||
// TODO private constructor once https://issuetracker.google.com/issues/404479708 is fixed.
|
||||
public value class TextStyle internal constructor(
|
||||
@PublishedApi
|
||||
internal val bits: Int,
|
||||
|
||||
@ -8,7 +8,8 @@ import kotlin.jvm.JvmInline
|
||||
|
||||
@Immutable
|
||||
@JvmInline
|
||||
public value class UnderlineStyle private constructor(
|
||||
// TODO private constructor once https://issuetracker.google.com/issues/404479708 is fixed.
|
||||
public value class UnderlineStyle internal constructor(
|
||||
@PublishedApi
|
||||
internal val value: Int,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user