Browse Source
* web: mark internal and experimental api in web-widgets * web: mark internal and experimental api in web-widgets Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>pull/1083/head
Oleksandr Karpovich
3 years ago
committed by
GitHub
73 changed files with 182 additions and 26 deletions
@ -0,0 +1,4 @@
|
||||
package org.jetbrains.compose.common.ui |
||||
|
||||
@RequiresOptIn("This API is experimental and is likely to change in the future.") |
||||
annotation class ExperimentalComposeWebWidgetsApi() |
@ -1,5 +1,9 @@
|
||||
package jetbrains.compose.common.shapes |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
interface Shape |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
object CircleShape : Shape |
||||
|
@ -1,5 +1,7 @@
|
||||
package org.jetbrains.compose.common.foundation |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.clickable(onClick: () -> Unit): Modifier |
||||
|
@ -1,5 +1,7 @@
|
||||
package org.jetbrains.compose.common.foundation.layout |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.fillMaxHeight(fraction: Float): Modifier |
||||
|
@ -1,5 +1,7 @@
|
||||
package org.jetbrains.compose.common.foundation.layout |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.fillMaxWidth(): Modifier |
||||
|
@ -1,6 +1,8 @@
|
||||
package org.jetbrains.compose.common.foundation.layout |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.unit.Dp |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.offset(x: Dp, y: Dp): Modifier |
||||
|
@ -1,8 +1,10 @@
|
||||
package org.jetbrains.compose.common.ui.layout |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
import org.jetbrains.compose.common.ui.unit.IntSize |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.onSizeChanged( |
||||
onSizeChanged: (IntSize) -> Unit |
||||
): Modifier |
||||
|
@ -1,6 +1,8 @@
|
||||
package org.jetbrains.compose.common.foundation.layout |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import org.jetbrains.compose.common.ui.unit.Dp |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
expect fun Modifier.width(size: Dp): Modifier |
||||
|
@ -1,3 +1,6 @@
|
||||
package org.jetbrains.compose.common.ui.unit |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
data class Dp(val value: Float) |
||||
|
@ -1,3 +1,6 @@
|
||||
package org.jetbrains.compose.common.ui.unit |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
data class IntSize(val width: Int, val height: Int) |
||||
|
@ -1,17 +1,24 @@
|
||||
package org.jetbrains.compose.common.ui.unit |
||||
|
||||
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 |
||||
val Int.dp: Dp |
||||
get() = Dp(this.toFloat()) |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Int.em: TextUnit |
||||
get() = TextUnit(toFloat(), TextUnitType.Em) |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Float.em: TextUnit |
||||
get() = TextUnit(this, TextUnitType.Em) |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Int.sp: TextUnit |
||||
get() = TextUnit(toFloat(), TextUnitType.Sp) |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Float.sp: TextUnit |
||||
get() = TextUnit(this, TextUnitType.Sp) |
||||
|
@ -1,6 +1,8 @@
|
||||
package org.jetbrains.compose.common.core.graphics |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import androidx.compose.ui.graphics.Color as JColor |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Color.implementation |
||||
get() = JColor(red, green, blue) |
||||
|
@ -1,12 +1,15 @@
|
||||
package org.jetbrains.compose.common.internal |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import androidx.compose.ui.Modifier as JModifier |
||||
import org.jetbrains.compose.common.ui.Modifier |
||||
|
||||
private class ModifierElement : JModifier.Element |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
class ActualModifier : Modifier { |
||||
var modifier: JModifier = ModifierElement() |
||||
} |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
fun Modifier.castOrCreate(): ActualModifier = (this as? ActualModifier) ?: ActualModifier() |
||||
|
@ -1,6 +1,8 @@
|
||||
package org.jetbrains.compose.common.ui.unit |
||||
|
||||
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi |
||||
import androidx.compose.ui.unit.Dp as JDp |
||||
|
||||
@ExperimentalComposeWebWidgetsApi |
||||
val Dp.implementation: JDp |
||||
get() = JDp(value) |
Loading…
Reference in new issue