Browse Source

deprecate compose.web.web-widgets in source code and gradle plugin (#1453)

* deprecate compose.web.web-widgets in source code and gradle plugin (name alias)

* fix typo

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/1458/head
Oleksandr Karpovich 3 years ago committed by GitHub
parent
commit
e139fbb1e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt
  2. 3
      web/widgets/src/commonMain/kotlin/Alignment.kt
  3. 3
      web/widgets/src/commonMain/kotlin/Arrangement.kt
  4. 12
      web/widgets/src/commonMain/kotlin/Color.kt
  5. 4
      web/widgets/src/commonMain/kotlin/Modifier.kt
  6. 1
      web/widgets/src/commonMain/kotlin/layouts/box.kt
  7. 1
      web/widgets/src/commonMain/kotlin/layouts/button.kt
  8. 1
      web/widgets/src/commonMain/kotlin/layouts/column.kt
  9. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/BoxDefault.kt
  10. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/ButtonDefault.kt
  11. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/ColumnDefault.kt
  12. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/ModifierDefault.kt
  13. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/RowDefault.kt
  14. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/SliderDefault.kt
  15. 1
      web/widgets/src/commonMain/kotlin/layouts/defaults/TextDefault.kt
  16. 1
      web/widgets/src/commonMain/kotlin/layouts/row.kt
  17. 2
      web/widgets/src/commonMain/kotlin/layouts/shapes/shapes.kt
  18. 1
      web/widgets/src/commonMain/kotlin/layouts/slider.kt
  19. 1
      web/widgets/src/commonMain/kotlin/layouts/text.kt
  20. 1
      web/widgets/src/commonMain/kotlin/modifiers/border.kt
  21. 1
      web/widgets/src/commonMain/kotlin/modifiers/clickable.kt
  22. 1
      web/widgets/src/commonMain/kotlin/modifiers/clip.kt
  23. 1
      web/widgets/src/commonMain/kotlin/modifiers/fillMaxHeight.kt
  24. 1
      web/widgets/src/commonMain/kotlin/modifiers/fillMaxWidth.kt
  25. 1
      web/widgets/src/commonMain/kotlin/modifiers/offset.kt
  26. 1
      web/widgets/src/commonMain/kotlin/modifiers/onSizeChanged.kt
  27. 1
      web/widgets/src/commonMain/kotlin/modifiers/size.kt
  28. 1
      web/widgets/src/commonMain/kotlin/modifiers/width.kt
  29. 1
      web/widgets/src/commonMain/kotlin/units/Dp.kt
  30. 1
      web/widgets/src/commonMain/kotlin/units/IntSize.kt
  31. 3
      web/widgets/src/commonMain/kotlin/units/TextUnit.kt
  32. 5
      web/widgets/src/commonMain/kotlin/units/unitConversion.kt
  33. 3
      web/widgets/src/jsMain/kotlin/Modifier.kt
  34. 1
      web/widgets/src/jsMain/kotlin/Styles.kt
  35. 2
      web/widgets/src/jsMain/kotlin/internal/ActualModifier.kt
  36. 1
      web/widgets/src/jsMain/kotlin/layouts/box.kt
  37. 1
      web/widgets/src/jsMain/kotlin/layouts/button.kt
  38. 1
      web/widgets/src/jsMain/kotlin/layouts/column.kt
  39. 1
      web/widgets/src/jsMain/kotlin/layouts/row.kt
  40. 1
      web/widgets/src/jsMain/kotlin/layouts/slider.kt
  41. 1
      web/widgets/src/jsMain/kotlin/layouts/text.kt
  42. 1
      web/widgets/src/jsMain/kotlin/modifiers/border.kt
  43. 1
      web/widgets/src/jsMain/kotlin/modifiers/clickable.kt
  44. 1
      web/widgets/src/jsMain/kotlin/modifiers/clip.kt
  45. 1
      web/widgets/src/jsMain/kotlin/modifiers/fillMaxHeight.kt
  46. 1
      web/widgets/src/jsMain/kotlin/modifiers/fillMaxWidth.kt
  47. 1
      web/widgets/src/jsMain/kotlin/modifiers/offset.kt
  48. 1
      web/widgets/src/jsMain/kotlin/modifiers/onSizeChanged.kt
  49. 1
      web/widgets/src/jsMain/kotlin/modifiers/size.kt
  50. 1
      web/widgets/src/jsMain/kotlin/modifiers/width.kt
  51. 1
      web/widgets/src/jvmMain/kotlin/Alignment.kt
  52. 1
      web/widgets/src/jvmMain/kotlin/Arrangement.kt
  53. 1
      web/widgets/src/jvmMain/kotlin/Color.kt
  54. 3
      web/widgets/src/jvmMain/kotlin/Modifier.kt
  55. 3
      web/widgets/src/jvmMain/kotlin/internal/ActualModifier.kt
  56. 1
      web/widgets/src/jvmMain/kotlin/layouts/box.kt
  57. 1
      web/widgets/src/jvmMain/kotlin/layouts/button.kt
  58. 1
      web/widgets/src/jvmMain/kotlin/layouts/column.kt
  59. 1
      web/widgets/src/jvmMain/kotlin/layouts/row.kt
  60. 1
      web/widgets/src/jvmMain/kotlin/layouts/shapes/shapes.kt
  61. 1
      web/widgets/src/jvmMain/kotlin/layouts/slider.kt
  62. 1
      web/widgets/src/jvmMain/kotlin/layouts/text.kt
  63. 1
      web/widgets/src/jvmMain/kotlin/modifiers/border.kt
  64. 1
      web/widgets/src/jvmMain/kotlin/modifiers/clickable.kt
  65. 1
      web/widgets/src/jvmMain/kotlin/modifiers/clip.kt
  66. 1
      web/widgets/src/jvmMain/kotlin/modifiers/fillMaxHeight.kt
  67. 1
      web/widgets/src/jvmMain/kotlin/modifiers/fillMaxWidth.kt
  68. 1
      web/widgets/src/jvmMain/kotlin/modifiers/offset.kt
  69. 1
      web/widgets/src/jvmMain/kotlin/modifiers/onSizeChanged.kt
  70. 1
      web/widgets/src/jvmMain/kotlin/modifiers/size.kt
  71. 1
      web/widgets/src/jvmMain/kotlin/modifiers/width.kt
  72. 1
      web/widgets/src/jvmMain/kotlin/units/Dp.kt
  73. 1
      web/widgets/src/jvmMain/kotlin/units/TextUnit.kt

1
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt

@ -205,6 +205,7 @@ class ComposePlugin : Plugin<Project> {
composeDependency("org.jetbrains.compose.web:web-svg")
}
@Deprecated("compose.web.web-widgets API is deprecated")
val widgets by lazy {
composeDependency("org.jetbrains.compose.web:web-widgets")
}

3
web/widgets/src/commonMain/kotlin/Alignment.kt

@ -1,8 +1,11 @@
package org.jetbrains.compose.common.ui
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Alignment {
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Vertical : Alignment
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Horizontal : Alignment
companion object {

3
web/widgets/src/commonMain/kotlin/Arrangement.kt

@ -3,11 +3,14 @@ package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
object Arrangement {
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Horizontal
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Vertical
val End = object : Horizontal {}

12
web/widgets/src/commonMain/kotlin/Color.kt

@ -3,19 +3,31 @@ package org.jetbrains.compose.common.core.graphics
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
public data class Color(val red: Int, val green: Int, val blue: Int) {
companion object {
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Black = Color(0, 0, 0)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val DarkGray = Color(0x44, 0x44, 0x44)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Gray = Color(0x88, 0x88, 0x88)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val LightGray = Color(0xCC, 0xCC, 0xCC)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val White = Color(0xFF, 0xFF, 0xFF)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Red = Color(0xFF, 0, 0)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Green = Color(0, 0xFF, 0)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Blue = Color(0, 0, 0xFF)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Yellow = Color(0xFF, 0xFF, 0x00)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Cyan = Color(0, 0xFF, 0xFF)
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Magenta = Color(0xFF, 0, 0xFF)
}
}

4
web/widgets/src/commonMain/kotlin/Modifier.kt

@ -4,13 +4,17 @@ import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Modifier {
open class Element : Modifier
@Deprecated(message = "compose.web.web-widgets API is deprecated")
companion object : Element()
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.background(color: Color): Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.padding(all: Dp): Modifier

1
web/widgets/src/commonMain/kotlin/layouts/box.kt

@ -6,4 +6,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun BoxActual(modifier: Modifier, content: @Composable () -> Unit)

1
web/widgets/src/commonMain/kotlin/layouts/button.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,

1
web/widgets/src/commonMain/kotlin/layouts/column.kt

@ -6,4 +6,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit)

1
web/widgets/src/commonMain/kotlin/layouts/defaults/BoxDefault.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Box(
modifier: Modifier = Modifier.Companion,
content: @Composable () -> Unit

1
web/widgets/src/commonMain/kotlin/layouts/defaults/ButtonDefault.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Button(
modifier: Modifier = Modifier.Companion,
onClick: () -> Unit,

1
web/widgets/src/commonMain/kotlin/layouts/defaults/ColumnDefault.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Column(
modifier: Modifier = Modifier.Companion,
content: @Composable () -> Unit

1
web/widgets/src/commonMain/kotlin/layouts/defaults/ModifierDefault.kt

@ -3,6 +3,7 @@ package org.jetbrains.compose.common.ui
import org.jetbrains.compose.common.ui.unit.Dp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Modifier.size(size: Dp): Modifier {
return size(size, size)
}

1
web/widgets/src/commonMain/kotlin/layouts/defaults/RowDefault.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Row(
modifier: Modifier = Modifier.Companion,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,

1
web/widgets/src/commonMain/kotlin/layouts/defaults/SliderDefault.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.Modifier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Slider(
value: Float,
onValueChange: (Float) -> Unit = {},

1
web/widgets/src/commonMain/kotlin/layouts/defaults/TextDefault.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.unit.TextUnit
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Text(
text: String,
modifier: Modifier = Modifier.Companion,

1
web/widgets/src/commonMain/kotlin/layouts/row.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,

2
web/widgets/src/commonMain/kotlin/layouts/shapes/shapes.kt

@ -3,7 +3,9 @@ package jetbrains.compose.common.shapes
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
interface Shape
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
object CircleShape : Shape

1
web/widgets/src/commonMain/kotlin/layouts/slider.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.common.ui.Modifier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,

1
web/widgets/src/commonMain/kotlin/layouts/text.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.unit.TextUnit
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal expect fun TextActual(
text: String,
modifier: Modifier,

1
web/widgets/src/commonMain/kotlin/modifiers/border.kt

@ -6,4 +6,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.border(size: Dp, color: Color): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/clickable.kt

@ -4,4 +4,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.clickable(onClick: () -> Unit): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/clip.kt

@ -5,4 +5,5 @@ import jetbrains.compose.common.shapes.Shape
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.clip(shape: Shape): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/fillMaxHeight.kt

@ -4,4 +4,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.fillMaxHeight(fraction: Float): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/fillMaxWidth.kt

@ -4,4 +4,5 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.fillMaxWidth(): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/offset.kt

@ -5,4 +5,5 @@ import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.offset(x: Dp, y: Dp): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/onSizeChanged.kt

@ -5,6 +5,7 @@ import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.unit.IntSize
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/size.kt

@ -3,4 +3,5 @@ package org.jetbrains.compose.common.ui
import org.jetbrains.compose.common.ui.unit.Dp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.size(width: Dp, height: Dp): Modifier

1
web/widgets/src/commonMain/kotlin/modifiers/width.kt

@ -5,4 +5,5 @@ import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
expect fun Modifier.width(size: Dp): Modifier

1
web/widgets/src/commonMain/kotlin/units/Dp.kt

@ -3,4 +3,5 @@ package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
data class Dp(val value: Float)

1
web/widgets/src/commonMain/kotlin/units/IntSize.kt

@ -3,4 +3,5 @@ package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
data class IntSize(val width: Int, val height: Int)

3
web/widgets/src/commonMain/kotlin/units/TextUnit.kt

@ -3,6 +3,7 @@ package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
enum class TextUnitType {
Unspecified,
Em,
@ -10,8 +11,10 @@ enum class TextUnitType {
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
data class TextUnit(val value: Float, val unitType: TextUnitType) {
companion object {
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Unspecified = TextUnit(Float.NaN, TextUnitType.Unspecified)
}
}

5
web/widgets/src/commonMain/kotlin/units/unitConversion.kt

@ -4,21 +4,26 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
// TODO: this have to be in a separate package otherwise there's an error for in cross-module usage (for JVM target)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Int.dp: Dp
get() = Dp(this.toFloat())
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Int.em: TextUnit
get() = TextUnit(toFloat(), TextUnitType.Em)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Float.em: TextUnit
get() = TextUnit(this, TextUnitType.Em)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Int.sp: TextUnit
get() = TextUnit(toFloat(), TextUnitType.Sp)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Float.sp: TextUnit
get() = TextUnit(this, TextUnitType.Sp)

3
web/widgets/src/jsMain/kotlin/Modifier.kt

@ -10,6 +10,7 @@ import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.web.attributes.AttrsBuilder
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.background(color: Color): Modifier = castOrCreate().apply {
add {
backgroundColor(RGB(color.red, color.green, color.blue))
@ -17,6 +18,7 @@ actual fun Modifier.background(color: Color): Modifier = castOrCreate().apply {
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Modifier.asAttributeBuilderApplier(
passThroughHandler: (AttrsBuilder<*>.() -> Unit)? = null
): AttrsBuilder<*>.() -> Unit =
@ -35,6 +37,7 @@ fun Modifier.asAttributeBuilderApplier(
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.padding(all: Dp): Modifier = castOrCreate().apply {
// yes, it's not a typo, what Modifier.padding does is actually adding margin
add {

1
web/widgets/src/jsMain/kotlin/Styles.kt

@ -13,6 +13,7 @@ import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.StyleSheet
@Deprecated(message = "compose.web.web-widgets API is deprecated")
object Styles : StyleSheet() {
val columnClass = "compose-web-column"

2
web/widgets/src/jsMain/kotlin/internal/ActualModifier.kt

@ -6,6 +6,7 @@ import org.jetbrains.compose.web.css.StyleBuilder
import org.jetbrains.compose.web.attributes.AttrsBuilder
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
class ActualModifier : Modifier {
val styleHandlers = mutableListOf<StyleBuilder.() -> Unit>()
val attrHandlers = mutableListOf<AttrsBuilder<*>.() -> Unit>()
@ -20,4 +21,5 @@ class ActualModifier : Modifier {
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Modifier.castOrCreate(): ActualModifier = (this as? ActualModifier) ?: ActualModifier()

1
web/widgets/src/jsMain/kotlin/layouts/box.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.asAttributeBuilderApplier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun BoxActual(modifier: Modifier, content: @Composable () -> Unit) {
Div(
attrs = modifier.asAttributeBuilderApplier()

1
web/widgets/src/jsMain/kotlin/layouts/button.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.web.dom.Button
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,

1
web/widgets/src/jsMain/kotlin/layouts/column.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.web.ui.Styles
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit) {
Div(
attrs = {

1
web/widgets/src/jsMain/kotlin/layouts/row.kt

@ -22,6 +22,7 @@ private fun Alignment.Vertical.asClassName() = when (this) {
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,

1
web/widgets/src/jsMain/kotlin/layouts/slider.kt

@ -9,6 +9,7 @@ import org.jetbrains.compose.web.attributes.value
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,

1
web/widgets/src/jsMain/kotlin/layouts/text.kt

@ -18,6 +18,7 @@ import org.jetbrains.compose.web.css.px
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun TextActual(
text: String,
modifier: Modifier,

1
web/widgets/src/jsMain/kotlin/modifiers/border.kt

@ -11,6 +11,7 @@ import org.jetbrains.compose.web.css.border
import org.jetbrains.compose.web.css.Color.RGB
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.border(size: Dp, color: Color): Modifier = castOrCreate().apply {
add {
border(size.value.px, LineStyle.Solid, RGB(color.red, color.green, color.blue))

1
web/widgets/src/jsMain/kotlin/modifiers/clickable.kt

@ -5,6 +5,7 @@ import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.clickable(onClick: () -> Unit): Modifier = castOrCreate().apply {
addAttributeBuilder {
onClick { onClick() }

1
web/widgets/src/jsMain/kotlin/modifiers/clip.kt

@ -9,6 +9,7 @@ import org.jetbrains.compose.web.css.borderRadius
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.clip(shape: Shape): Modifier = castOrCreate().apply {
when (shape) {
CircleShape -> add {

1
web/widgets/src/jsMain/kotlin/modifiers/fillMaxHeight.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.web.css.height
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.fillMaxHeight(fraction: Float): Modifier = castOrCreate().apply {
add {
height((100 * fraction).percent)

1
web/widgets/src/jsMain/kotlin/modifiers/fillMaxWidth.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.web.css.width
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.fillMaxWidth(): Modifier = castOrCreate().apply {
add {
width(100.percent)

1
web/widgets/src/jsMain/kotlin/modifiers/offset.kt

@ -9,6 +9,7 @@ import org.jetbrains.compose.web.css.marginLeft
import org.jetbrains.compose.web.css.px
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.offset(x: Dp, y: Dp): Modifier = castOrCreate().apply {
add {
marginLeft(x.value.px)

1
web/widgets/src/jsMain/kotlin/modifiers/onSizeChanged.kt

@ -5,6 +5,7 @@ import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.unit.IntSize
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier {

1
web/widgets/src/jsMain/kotlin/modifiers/size.kt

@ -7,6 +7,7 @@ import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.common.internal.castOrCreate
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.size(width: Dp, height: Dp): Modifier = castOrCreate().apply {
add {
width(width.value.px)

1
web/widgets/src/jsMain/kotlin/modifiers/width.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.width
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.width(size: Dp): Modifier = castOrCreate().apply {
add {
width(size.value.px)

1
web/widgets/src/jvmMain/kotlin/Alignment.kt

@ -3,6 +3,7 @@ package org.jetbrains.compose.common.ui
import androidx.compose.ui.Alignment as JAlignment
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Alignment.Vertical.implementation: JAlignment.Vertical
get() = when (this) {
Alignment.Top -> JAlignment.Top

1
web/widgets/src/jvmMain/kotlin/Arrangement.kt

@ -4,6 +4,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.foundation.layout.Arrangement as JArrangement
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Arrangement.Horizontal.implementation: JArrangement.Horizontal
get() = when (this) {
Arrangement.End -> JArrangement.End

1
web/widgets/src/jvmMain/kotlin/Color.kt

@ -4,5 +4,6 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.graphics.Color as JColor
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Color.implementation
get() = JColor(red, green, blue)

3
web/widgets/src/jvmMain/kotlin/Modifier.kt

@ -9,15 +9,18 @@ import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.padding
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.background(color: Color): Modifier = castOrCreate().apply {
modifier = modifier.background(color.implementation)
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.padding(all: Dp): Modifier = castOrCreate().apply {
modifier = modifier.padding(all.implementation)
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Modifier.implementation
get() = castOrCreate().modifier

3
web/widgets/src/jvmMain/kotlin/internal/ActualModifier.kt

@ -4,12 +4,15 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.Modifier as JModifier
import org.jetbrains.compose.common.ui.Modifier
@Deprecated(message = "compose.web.web-widgets API is deprecated")
private class ModifierElement : JModifier.Element
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
class ActualModifier : Modifier {
var modifier: JModifier = ModifierElement()
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
fun Modifier.castOrCreate(): ActualModifier = (this as? ActualModifier) ?: ActualModifier()

1
web/widgets/src/jvmMain/kotlin/layouts/box.kt

@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Box as JBox
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun BoxActual(modifier: Modifier, content: @Composable () -> Unit) {
JBox(modifier.implementation) {
content.invoke()

1
web/widgets/src/jvmMain/kotlin/layouts/button.kt

@ -8,6 +8,7 @@ import androidx.compose.material.Button as JButton
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,

1
web/widgets/src/jvmMain/kotlin/layouts/column.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit) {
JColumn(modifier = modifier.implementation) {
content.invoke()

1
web/widgets/src/jvmMain/kotlin/layouts/row.kt

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Row as JRow
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,

1
web/widgets/src/jvmMain/kotlin/layouts/shapes/shapes.kt

@ -5,6 +5,7 @@ import androidx.compose.ui.graphics.Shape as JShape
import androidx.compose.foundation.shape.CircleShape as JCircleShape
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Shape.implementation: JShape
get() = when (this) {
CircleShape -> JCircleShape

1
web/widgets/src/jvmMain/kotlin/layouts/slider.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,

1
web/widgets/src/jvmMain/kotlin/layouts/text.kt

@ -12,6 +12,7 @@ import org.jetbrains.compose.common.ui.unit.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
internal actual fun TextActual(
text: String,
modifier: Modifier,

1
web/widgets/src/jvmMain/kotlin/modifiers/border.kt

@ -10,6 +10,7 @@ import androidx.compose.foundation.border
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.border(size: Dp, color: Color): Modifier = castOrCreate().apply {
modifier = modifier.border(size.implementation, color.implementation)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/clickable.kt

@ -6,6 +6,7 @@ import androidx.compose.foundation.clickable
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.clickable(onClick: () -> Unit): Modifier = castOrCreate().apply {
modifier = modifier.clickable(onClick = onClick)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/clip.kt

@ -8,6 +8,7 @@ import androidx.compose.ui.draw.clip
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.clip(shape: Shape): Modifier = castOrCreate().apply {
modifier = modifier.clip(shape.implementation)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/fillMaxHeight.kt

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxHeight
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.fillMaxHeight(fraction: Float): Modifier = castOrCreate().apply {
modifier = modifier.fillMaxHeight(fraction)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/fillMaxWidth.kt

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.fillMaxWidth(): Modifier = castOrCreate().apply {
modifier = modifier.fillMaxWidth()
}

1
web/widgets/src/jvmMain/kotlin/modifiers/offset.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.implementation
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.offset(x: Dp, y: Dp): Modifier = castOrCreate().apply {
modifier = modifier.offset(x.implementation, y.implementation)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/onSizeChanged.kt

@ -7,6 +7,7 @@ import androidx.compose.ui.layout.onSizeChanged
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier = castOrCreate().apply {

1
web/widgets/src/jvmMain/kotlin/modifiers/size.kt

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.size
import org.jetbrains.compose.common.internal.castOrCreate
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.size(width: Dp, height: Dp): Modifier = castOrCreate().apply {
modifier = modifier.size(width.implementation, height.implementation)
}

1
web/widgets/src/jvmMain/kotlin/modifiers/width.kt

@ -8,6 +8,7 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.implementation
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
actual fun Modifier.width(size: Dp): Modifier = castOrCreate().apply {
modifier = modifier.width(size.implementation)
}

1
web/widgets/src/jvmMain/kotlin/units/Dp.kt

@ -4,5 +4,6 @@ import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.unit.Dp as JDp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val Dp.implementation: JDp
get() = JDp(value)

1
web/widgets/src/jvmMain/kotlin/units/TextUnit.kt

@ -6,6 +6,7 @@ import androidx.compose.ui.unit.sp
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = "compose.web.web-widgets API is deprecated")
val TextUnit.implementation: JTextUnit
get() = when (unitType) {
TextUnitType.Em -> (value).em

Loading…
Cancel
Save