Skip to content

Commit

Permalink
Stability
Browse files Browse the repository at this point in the history
  • Loading branch information
SalomonBrys committed Jul 4, 2024
1 parent 57a671a commit ddce225
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ private fun SourceCodePart(
}
}

val partOverStyles = overSpanStyles.toPersistentMap().builder().apply {
val partOverStyles = overSpanStyles.toPersistentMap().mutate {
forEachStyle { index, saStyle, fraction ->
put(index, saStyle.spanStyle() to fraction)
it[index] = saStyle.spanStyle() to fraction
}
}.build()
}

Box(
Modifier
Expand Down
2 changes: 2 additions & 0 deletions Compose-Ur-Pres/plugin/cup-laser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ kotlin {
implementation(kotlin.compose.materialIconsExtended)

implementation(projects.cup)

implementation(libs.kotlinx.collectionsImmutable)
}

all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.drawscope.clipPath
import androidx.compose.ui.input.pointer.*
import androidx.compose.ui.layout.onSizeChanged
import androidx.compose.ui.unit.toSize
import kotlinx.collections.immutable.*
import net.kodein.cup.PluginCupAPI


Expand All @@ -34,7 +35,7 @@ public sealed class Laser {
@PluginCupAPI
public data class Pointer(
override val drawing: Boolean = false,
val points: List<List<Offset>> = emptyList(),
val points: ImmutableList<ImmutableList<Offset>> = persistentListOf(),
val pointer: Offset? = null
) : Laser()
}
Expand Down Expand Up @@ -117,9 +118,8 @@ public fun LaserDraw(
is Laser.Pointer -> {
setLaser(
laser.copy(
points = buildList {
addAll(laser.points)
add(listOf(rp))
points = laser.points.toPersistentList().mutate {
it.add(persistentListOf(rp))
},
drawing = true
)
Expand Down Expand Up @@ -155,12 +155,12 @@ public fun LaserDraw(
}
}
is Laser.Pointer -> {
val points = if (laser.drawing) buildList {
addAll(laser.points.subList(0, laser.points.size - 1))
add(laser.points.last() + rp)
} else laser.points
setLaser(laser.copy(
points = points,
points = if (laser.drawing) {
laser.points.subList(0, laser.points.size - 1).toPersistentList().mutate {
it.add(laser.points.last().toPersistentList().plus(rp))
}
} else laser.points,
pointer = rp
))
}
Expand Down
2 changes: 2 additions & 0 deletions Compose-Ur-Pres/plugin/cup-speaker-window/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ kotlin {

implementation(projects.cup)
implementation(projects.plugin.cupLaser)

implementation(libs.kotlinx.collectionsImmutable)
}

jvmMain.dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package net.kodein.cup.speaker

import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import net.kodein.cup.config.CupConfigurationBuilder
import net.kodein.cup.config.CupConfigurationDsl
import net.kodein.cup.utils.DataMap
Expand All @@ -14,13 +17,16 @@ public sealed class ASpeakerNotes : DataMapElement<ASpeakerNotes>(Key) {
internal companion object Key : DataMap.Key<ASpeakerNotes>
}

@Stable
public class SpeakerNotes(
public val notes: List<Pair<IntRange, String>>
notes: List<Pair<IntRange, String>>
) : DataMapElement<SpeakerNotes>(Key) {
internal companion object Key : DataMap.Key<SpeakerNotes> {
private val allSteps = 0..Int.MAX_VALUE
}

public val notes: ImmutableList<Pair<IntRange, String>> = notes.toImmutableList()

public constructor(md: String): this(listOf(allSteps to md))

@Deprecated("Speaker notes are now forcibly in Markdown, please use SpeakerNotes(markdownText)")
Expand Down

0 comments on commit ddce225

Please sign in to comment.