Skip to content

Commit

Permalink
Remove compose stable markers
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Jul 24, 2024
1 parent 14aa6b6 commit a1efd84
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 61 deletions.
1 change: 0 additions & 1 deletion syntakts-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ kotlin {
sourceSets {
commonMain {
dependencies {
compileOnly(libs.compose.stable.marker)
implementation(libs.kotlin.coroutines.core)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.node.Node
import xyz.wingio.syntakts.node.node
import xyz.wingio.syntakts.parser.ParseRule
Expand All @@ -19,7 +18,6 @@ import kotlin.time.measureTime
*
* @param C The context passed to a [Node] when its getting rendered, can be any class
*/
@Stable
public class Syntakts<C> internal constructor(
private val rules: List<Rule<C>>,
@Deprecated("Use debugOptions instead")
Expand All @@ -34,7 +32,6 @@ public class Syntakts<C> internal constructor(
* @param logger Used to log rule matches and parsing time
* @param storeMetadata Whether to store some metadata in each node
*/
@Stable
public data class DebugOptions(
var enableLogging: Boolean = false,
var logger: Logger? = null,
Expand All @@ -46,7 +43,6 @@ public class Syntakts<C> internal constructor(
*
* @param C The context passed to a [Node] when its getting rendered, can be any class
*/
@Stable
public class Builder<C> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package xyz.wingio.syntakts.markdown
import xyz.wingio.syntakts.Syntakts
import xyz.wingio.syntakts.node.Node
import xyz.wingio.syntakts.node.styleNode
import xyz.wingio.syntakts.node.textNode
import xyz.wingio.syntakts.parser.ParseSpec
import xyz.wingio.syntakts.style.FontStyle
import xyz.wingio.syntakts.style.FontWeight
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.node

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.parser.ParseSpec
import xyz.wingio.syntakts.style.StyledTextBuilder

Expand All @@ -10,7 +9,6 @@ import xyz.wingio.syntakts.style.StyledTextBuilder
* @param onClick Callback for when the child nodes are clicked
* @param onLongClick Callback for when the child nodes are long clicked
*/
@Stable
public class ClickableNode<C>(
public val onClick: () -> Unit,
public val onLongClick: (() -> Unit)? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.node

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.style.StyledTextBuilder

/**
Expand All @@ -10,7 +9,6 @@ import xyz.wingio.syntakts.style.StyledTextBuilder
* @param _metadata Metadata associated with this node, only present when the storeMetadata [debug option][xyz.wingio.syntakts.Syntakts.DebugOptions] is enabled
* @param C (Context) Extra information to be used when rendering
*/
@Stable
public open class Node<C>(
private var _children: MutableCollection<Node<C>>? = null,
private var _metadata: MetaData? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.node

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.parser.ParseSpec
import xyz.wingio.syntakts.style.Style
import xyz.wingio.syntakts.style.StyledTextBuilder
Expand All @@ -10,7 +9,6 @@ import xyz.wingio.syntakts.style.StyledTextBuilder
*
* @param style The style to apply
*/
@Stable
public open class StyleNode<C>(
public val style: Style
): Node.Parent<C>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.node

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.parser.ParseSpec
import xyz.wingio.syntakts.style.StyledTextBuilder

Expand All @@ -9,7 +8,6 @@ import xyz.wingio.syntakts.style.StyledTextBuilder
*
* @param content The text to append
*/
@Stable
public open class TextNode<C>(
public val content: CharSequence
): Node<C>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.parser

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.node.Node

/**
Expand All @@ -16,7 +15,6 @@ import xyz.wingio.syntakts.node.Node
*
* @param C The context used to pass additional information to a [Node] when rendering
*/
@Stable
public class ParseSpec<C> {

public val root: Node<C>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package xyz.wingio.syntakts.parser

import androidx.compose.runtime.Stable
import xyz.wingio.syntakts.Syntakts
import xyz.wingio.syntakts.node.node
import xyz.wingio.syntakts.node.textNode

@Stable
public open class Rule<C>(
public val regex: Regex,
public val name: String,
Expand All @@ -23,7 +21,6 @@ public open class Rule<C>(
/**
* Uses the result of the match to generate a [ParseSpec], usually done using [node]
*/
@Stable
public fun interface ParseRule<C> {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import kotlin.math.roundToInt

/**
Expand All @@ -13,8 +11,6 @@ import kotlin.math.roundToInt
* @param alpha Number representing how much opacity this color has (0-255)
* @param ignore Whether or not to ignore this color
*/
@Stable
@Immutable
public data class Color(
/* @IntRange(0, 255) */
val red: Int,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable

/**
* Multiplatform representation of font weight
*
* @param weight Thickness of the glyphs, between 1 and 1000
*/
@Stable
@Immutable
public data class FontWeight(
public val weight: Int
) {
Expand All @@ -18,112 +13,94 @@ public data class FontWeight(
/**
* [Thin]
*/
@Stable
public val W100: FontWeight = FontWeight(100)

/**
* [ExtraLight]
*/
@Stable
public val W200: FontWeight = FontWeight(200)

/**
* [Light]
*/
@Stable
public val W300: FontWeight = FontWeight(300)

/**
* [Normal], regular, default
*/
@Stable
public val W400: FontWeight = FontWeight(400)

/**
* [Medium]
*/
@Stable
public val W500: FontWeight = FontWeight(500)

/**
* [SemiBold]
*/
@Stable
public val W600: FontWeight = FontWeight(600)

/**
* [Bold]
*/
@Stable
public val W700: FontWeight = FontWeight(700)

/**
* [ExtraBold]
*/
@Stable
public val W800: FontWeight = FontWeight(800)

/**
* [Black]
*/
@Stable
public val W900: FontWeight = FontWeight(900)

/**
* Alias for [W100]
*/
@Stable
public val Thin: FontWeight = W100

/**
* Alias for [W200]
*/
@Stable
public val ExtraLight: FontWeight = W200

/**
* Alias for [W300]
*/
@Stable
public val Light: FontWeight = W300

/**
* Alias for [W400]
*/
@Stable
public val Normal: FontWeight = W400

/**
* Alias for [W500]
*/
@Stable
public val Medium: FontWeight = W500

/**
* Alias for [W600]
*/
@Stable
public val SemiBold: FontWeight = W600

/**
* Alias for [W700]
*/
@Stable
public val Bold: FontWeight = W700

/**
* Alias for [W800]
*/
@Stable
public val ExtraBold: FontWeight = W800

/**
* Alias for [W900]
*/
@Stable
public val Black: FontWeight = W900

@Stable

public val values: List<FontWeight> = listOf(W100, W200, W300, W400, W500, W600, W700, W800, W900)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Stable

/**
* Collection of properties that can be used to style text
Expand All @@ -14,7 +13,6 @@ import androidx.compose.runtime.Stable
* @param paragraphStyle Set of styles for blocks of text, applying could separate the text as if a line feed was added
* @param font The font or font family for the text, see [Fonts] for default values
*/
@Stable
public data class Style(
var color: Color? = null,
var background: Color? = null,
Expand Down Expand Up @@ -44,7 +42,6 @@ public data class Style(
*
* @param lineHeight Line height for a paragraph in either [sp][Sp] or [em][Em]
*/
@Stable
public data class ParagraphStyle(
var lineHeight: TextUnit = TextUnit.Unspecified
)
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Stable

/**
* Used to build styled text across various UI frameworks
*
* @param S The type that this builder uses when building, usually framework dependant
*/
@Stable
public interface StyledTextBuilder<S> {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Immutable

/**
* Defines a line to be drawn through the text
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
package xyz.wingio.syntakts.style

import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable

/**
* Framework independent representation of a text unit (sp and em)
* @see sp
* @see em
*/
@Immutable
public open class TextUnit(public open val value: Float, public val unit: String) {
/**
* Represents an unspecified text unit, typically used to pass through to a fallback
*/
@Immutable
public object Unspecified : TextUnit(0f, "")
}

@Immutable
public class Sp(value: Float): TextUnit(value, "sp")

@Immutable
public class Em(value: Float): TextUnit(value, "em")

public val Int.sp: Sp
Expand Down

0 comments on commit a1efd84

Please sign in to comment.