Browse Source

remove deprecated compose.web.web-widgets from the source code (#2294)

Co-authored-by: Oleksandr Karpovich <oleksandr.karpovich@jetbrains.com>
pull/2297/head
Oleksandr Karpovich 2 years ago committed by GitHub
parent
commit
91a60dc014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/ComposePlugin.kt
  2. 3
      web/build.gradle.kts
  3. 2
      web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt
  4. 45
      web/integration-widgets/build.gradle.kts
  5. 128
      web/integration-widgets/src/commonMain/kotlin/App.kt
  6. 33
      web/integration-widgets/src/jsMain/kotlin/androidx/compose/web/with-web/demo.kt
  7. 49
      web/integration-widgets/src/jsMain/resources/index.html
  8. 49
      web/integration-widgets/src/jsMain/resources/styles.css
  9. 25
      web/integration-widgets/src/jvmMain/kotlin/demo.kt
  10. 668
      web/kotlin-js-store/yarn.lock
  11. 2
      web/settings.gradle.kts
  12. 47
      web/widgets/build.gradle.kts
  13. 32
      web/widgets/src/commonMain/kotlin/Alignment.kt
  14. 21
      web/widgets/src/commonMain/kotlin/Arrangement.kt
  15. 34
      web/widgets/src/commonMain/kotlin/Color.kt
  16. 4
      web/widgets/src/commonMain/kotlin/ExperimentalComposeWebWidgetsApi.kt
  17. 21
      web/widgets/src/commonMain/kotlin/Modifier.kt
  18. 8
      web/widgets/src/commonMain/kotlin/annotations/webWidgetsDeprecationMessage.kt
  19. 11
      web/widgets/src/commonMain/kotlin/layouts/box.kt
  20. 15
      web/widgets/src/commonMain/kotlin/layouts/button.kt
  21. 11
      web/widgets/src/commonMain/kotlin/layouts/column.kt
  22. 14
      web/widgets/src/commonMain/kotlin/layouts/defaults/BoxDefault.kt
  23. 17
      web/widgets/src/commonMain/kotlin/layouts/defaults/ButtonDefault.kt
  24. 14
      web/widgets/src/commonMain/kotlin/layouts/defaults/ColumnDefault.kt
  25. 10
      web/widgets/src/commonMain/kotlin/layouts/defaults/ModifierDefault.kt
  26. 17
      web/widgets/src/commonMain/kotlin/layouts/defaults/RowDefault.kt
  27. 25
      web/widgets/src/commonMain/kotlin/layouts/defaults/SliderDefault.kt
  28. 20
      web/widgets/src/commonMain/kotlin/layouts/defaults/TextDefault.kt
  29. 17
      web/widgets/src/commonMain/kotlin/layouts/row.kt
  30. 12
      web/widgets/src/commonMain/kotlin/layouts/shapes/shapes.kt
  31. 17
      web/widgets/src/commonMain/kotlin/layouts/slider.kt
  32. 18
      web/widgets/src/commonMain/kotlin/layouts/text.kt
  33. 11
      web/widgets/src/commonMain/kotlin/modifiers/border.kt
  34. 9
      web/widgets/src/commonMain/kotlin/modifiers/clickable.kt
  35. 10
      web/widgets/src/commonMain/kotlin/modifiers/clip.kt
  36. 9
      web/widgets/src/commonMain/kotlin/modifiers/fillMaxHeight.kt
  37. 9
      web/widgets/src/commonMain/kotlin/modifiers/fillMaxWidth.kt
  38. 10
      web/widgets/src/commonMain/kotlin/modifiers/offset.kt
  39. 12
      web/widgets/src/commonMain/kotlin/modifiers/onSizeChanged.kt
  40. 8
      web/widgets/src/commonMain/kotlin/modifiers/size.kt
  41. 10
      web/widgets/src/commonMain/kotlin/modifiers/width.kt
  42. 8
      web/widgets/src/commonMain/kotlin/units/Dp.kt
  43. 8
      web/widgets/src/commonMain/kotlin/units/IntSize.kt
  44. 21
      web/widgets/src/commonMain/kotlin/units/TextUnit.kt
  45. 30
      web/widgets/src/commonMain/kotlin/units/unitConversion.kt
  46. 47
      web/widgets/src/jsMain/kotlin/Modifier.kt
  47. 50
      web/widgets/src/jsMain/kotlin/Styles.kt
  48. 26
      web/widgets/src/jsMain/kotlin/internal/ActualModifier.kt
  49. 19
      web/widgets/src/jsMain/kotlin/layouts/box.kt
  50. 24
      web/widgets/src/jsMain/kotlin/layouts/button.kt
  51. 21
      web/widgets/src/jsMain/kotlin/layouts/column.kt
  52. 46
      web/widgets/src/jsMain/kotlin/layouts/row.kt
  53. 35
      web/widgets/src/jsMain/kotlin/layouts/slider.kt
  54. 45
      web/widgets/src/jsMain/kotlin/layouts/text.kt
  55. 20
      web/widgets/src/jsMain/kotlin/modifiers/border.kt
  56. 14
      web/widgets/src/jsMain/kotlin/modifiers/clickable.kt
  57. 20
      web/widgets/src/jsMain/kotlin/modifiers/clip.kt
  58. 16
      web/widgets/src/jsMain/kotlin/modifiers/fillMaxHeight.kt
  59. 16
      web/widgets/src/jsMain/kotlin/modifiers/fillMaxWidth.kt
  60. 19
      web/widgets/src/jsMain/kotlin/modifiers/offset.kt
  61. 14
      web/widgets/src/jsMain/kotlin/modifiers/onSizeChanged.kt
  62. 17
      web/widgets/src/jsMain/kotlin/modifiers/size.kt
  63. 17
      web/widgets/src/jsMain/kotlin/modifiers/width.kt
  64. 35
      web/widgets/src/jsTest/ModifierTests.kt
  65. 13
      web/widgets/src/jvmMain/kotlin/Alignment.kt
  66. 13
      web/widgets/src/jvmMain/kotlin/Arrangement.kt
  67. 10
      web/widgets/src/jvmMain/kotlin/Color.kt
  68. 27
      web/widgets/src/jvmMain/kotlin/Modifier.kt
  69. 19
      web/widgets/src/jvmMain/kotlin/internal/ActualModifier.kt
  70. 17
      web/widgets/src/jvmMain/kotlin/layouts/box.kt
  71. 21
      web/widgets/src/jvmMain/kotlin/layouts/button.kt
  72. 17
      web/widgets/src/jvmMain/kotlin/layouts/column.kt
  73. 24
      web/widgets/src/jvmMain/kotlin/layouts/row.kt
  74. 14
      web/widgets/src/jvmMain/kotlin/layouts/shapes/shapes.kt
  75. 27
      web/widgets/src/jvmMain/kotlin/layouts/slider.kt
  76. 29
      web/widgets/src/jvmMain/kotlin/layouts/text.kt
  77. 17
      web/widgets/src/jvmMain/kotlin/modifiers/border.kt
  78. 13
      web/widgets/src/jvmMain/kotlin/modifiers/clickable.kt
  79. 15
      web/widgets/src/jvmMain/kotlin/modifiers/clip.kt
  80. 13
      web/widgets/src/jvmMain/kotlin/modifiers/fillMaxHeight.kt
  81. 13
      web/widgets/src/jvmMain/kotlin/modifiers/fillMaxWidth.kt
  82. 15
      web/widgets/src/jvmMain/kotlin/modifiers/offset.kt
  83. 18
      web/widgets/src/jvmMain/kotlin/modifiers/onSizeChanged.kt
  84. 13
      web/widgets/src/jvmMain/kotlin/modifiers/size.kt
  85. 15
      web/widgets/src/jvmMain/kotlin/modifiers/width.kt
  86. 10
      web/widgets/src/jvmMain/kotlin/units/Dp.kt
  87. 16
      web/widgets/src/jvmMain/kotlin/units/TextUnit.kt

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

@ -213,11 +213,6 @@ 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")
}
val testUtils by lazy {
composeDependency("org.jetbrains.compose.web:test-utils")
}

3
web/build.gradle.kts

@ -112,9 +112,6 @@ subprojects {
println("substituting published artifacts with projects ones in project $name")
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("org.jetbrains.compose.web:web-widgets")).apply {
with(project(":web-widgets"))
}
substitute(module("org.jetbrains.compose.web:web-core")).apply {
with(project(":web-core"))
}

2
web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt

@ -4,7 +4,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import java.io.File
import java.net.URL
private val CHROME_DRIVER_VERSION = "102.0.5005.61"
private val CHROME_DRIVER_VERSION = "104.0.5112.79"
private val GECKO_DRIVER_VERSION = "0.31.0"
private fun download(url: String, file: File) {

45
web/integration-widgets/build.gradle.kts

@ -1,45 +0,0 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
kotlin {
js(IR) {
browser() {
testTask {
useKarma {
standardConf()
}
}
}
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
implementation(kotlin("stdlib-common"))
implementation(project(":web-core"))
implementation(project(":web-widgets"))
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
implementation(npm("highlight.js", "10.7.2"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}

128
web/integration-widgets/src/commonMain/kotlin/App.kt

@ -1,128 +0,0 @@
package org.jetbrainsc.compose.common.demo
import androidx.compose.runtime.Composable
import org.jetbrains.compose.common.foundation.layout.Box
import org.jetbrains.compose.common.ui.unit.dp
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.foundation.layout.Row
import org.jetbrains.compose.common.foundation.layout.Column
import org.jetbrains.compose.common.foundation.layout.Arrangement
import org.jetbrains.compose.common.foundation.border
import org.jetbrains.compose.common.material.Text
import org.jetbrains.compose.common.ui.unit.em
import org.jetbrains.compose.common.material.Slider
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import org.jetbrains.compose.common.material.Button
import org.jetbrains.compose.common.foundation.layout.width
import org.jetbrains.compose.common.foundation.clickable
import org.jetbrains.compose.common.ui.draw.clip
import jetbrains.compose.common.shapes.CircleShape
import org.jetbrains.compose.common.ui.*
@OptIn(ExperimentalComposeWebWidgetsApi::class)
object LayoutSamples {
@Composable
fun TwoTexts() {
Text("Alfred Sisley")
Text("3 minutes ago")
}
@Composable
fun TwoTextsInColumn() {
val defaultFontSize = 0.79f
val fontSize = remember { mutableStateOf(defaultFontSize) }
val subtitleColor = remember { mutableStateOf(Color(0, 0, 200)) }
Column {
Text("Alfred Sisley")
Text(
"3 minutes ago",
color = subtitleColor.value,
size = fontSize.value.em,
modifier = Modifier.clickable {
subtitleColor.value = Color.Yellow
}
)
Slider(
fontSize.value,
onValueChange = { value ->
fontSize.value = value
},
valueRange = 0.1f..1.2f,
steps = 80,
modifier = Modifier.width(200.dp)
)
Button(
onClick = {
fontSize.value = defaultFontSize
}
) {
Text("reset view")
}
}
}
@Composable
fun TwoTextsInRow() {
Text("Alfred Sisley")
Text("3 minutes ago")
}
@Composable
fun Layouts() {
val horizontalArrangements = listOf(Arrangement.Start, Arrangement.End)
val verticalAlignments = listOf(Alignment.Top, Alignment.CenterVertically, Alignment.Bottom)
Column() {
horizontalArrangements.forEach { horizontalArrangement ->
verticalAlignments.forEach { verticalAlignment ->
Row(
modifier = Modifier
.size(150.dp)
.padding(4.dp)
.border(1.dp, Color(0, 0, 200))
.background(Color.Yellow),
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment
) {
Box(Modifier.size(50.dp).background(Color.Red)) { }
Box(Modifier.size(30.dp).background(Color.Blue)) { }
}
}
}
}
}
@Composable
fun LayoutsClipped() {
val horizontalArrangements = listOf(Arrangement.Start, Arrangement.End)
val verticalAlignments = listOf(Alignment.Top, Alignment.CenterVertically, Alignment.Bottom)
Column() {
horizontalArrangements.forEach { horizontalArrangement ->
verticalAlignments.forEach { verticalAlignment ->
Row(
modifier = Modifier
.size(150.dp)
.padding(4.dp)
.border(1.dp, Color(0, 0, 200))
.background(Color.Yellow),
horizontalArrangement = horizontalArrangement,
verticalAlignment = verticalAlignment
) {
Box(Modifier.size(50.dp).background(Color.Red)) { }
Box(
Modifier
.clip(CircleShape)
.size(30.dp)
.background(Color.Blue)
) { }
}
}
}
}
}
}
@Composable
fun App() {
LayoutSamples.TwoTextsInColumn()
}

33
web/integration-widgets/src/jsMain/kotlin/androidx/compose/web/with-web/demo.kt

@ -1,33 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrainsc.compose.common.demo
import org.jetbrains.compose.web.renderComposable
import kotlinx.browser.document
import org.w3c.dom.HTMLElement
import org.jetbrains.compose.web.css.Style
import org.jetbrains.compose.web.ui.Styles
fun main() {
val root = document.getElementById("root") as HTMLElement
renderComposable(
root = root
) {
Style(Styles)
App()
}
}

49
web/integration-widgets/src/jsMain/resources/index.html

@ -1,49 +0,0 @@
<!--
~ Copyright 2021 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>compose-browser-with-web-demo</title>
<link type="text/css" rel="stylesheet" href="styles.css">
</head>
<body>
<h1>with web demo</h1>
<div id="container">
<div id = "rootParent">
<div id="root"></div>
</div>
<div id= "raw">
<div>
<span>
Alfred Sisley
</span>
<span>
3 minutes ago
</span>
<div class="row">
<div class="box-a box"></div>
<div class="box-b box"></div>
</div>
</div>
</div>
</div>
<script src="web-integration-widgets.js">
</script>
</body>
</html>

49
web/integration-widgets/src/jsMain/resources/styles.css

@ -1,49 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#container {
display: flex;
}
#rootParent {
background: lemonchiffon;
flex: 1 1 0px;
}
#raw {
background: powderblue;
flex: 1 1 0px;
}
.row {
width: 150px;
height: 150px;
background: yellow;
display: flex;
align-items: end;
}
.box-a {
background: red;
width: 50px;
height: 50px;
}
.box-b {
background: blue;
width: 30px;
height: 30px;
}

25
web/integration-widgets/src/jvmMain/kotlin/demo.kt

@ -1,25 +0,0 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrainsc.compose.common.demo
import androidx.compose.desktop.Window
import androidx.compose.ui.unit.IntSize
fun main() {
Window(title = "Demo", size = IntSize(800, 800)) {
App()
}
}

668
web/kotlin-js-store/yarn.lock

File diff suppressed because it is too large Load Diff

2
web/settings.gradle.kts

@ -60,9 +60,7 @@ fun module(name: String, path: String) {
module(":web-core", "core")
module(":web-svg", "svg")
module(":web-widgets", "widgets")
module(":web-integration-core", "integration-core")
module(":web-integration-widgets", "integration-widgets")
module(":compose-compiler-integration", "compose-compiler-integration")
module(":internal-web-core-runtime", "internal-web-core-runtime")
module(":test-utils", "test-utils")

47
web/widgets/build.gradle.kts

@ -1,47 +0,0 @@
import org.jetbrains.compose.gradle.standardConf
plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
}
kotlin {
jvm()
js(IR) {
browser() {
testTask {
useKarma {
standardConf()
}
}
}
binaries.executable()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(compose.runtime)
}
}
val jsMain by getting {
dependencies {
implementation(project(":web-core"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
}
}
}
}

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

@ -1,32 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
interface Alignment {
@Deprecated(message = webWidgetsDeprecationMessage)
interface Vertical : Alignment
@Deprecated(message = webWidgetsDeprecationMessage)
interface Horizontal : Alignment
companion object {
val TopStart = object : Alignment {}
val TopCenter = object : Alignment {}
val TopEnd = object : Alignment {}
val CenterStart = object : Alignment {}
val Center = object : Alignment {}
val CenterEnd = object : Alignment {}
val BottomStart = object : Alignment {}
val BottomCenter = object : Alignment {}
val BottomEnd = object : Alignment {}
val Top = object : Alignment.Vertical {}
val CenterVertically = object : Alignment.Vertical {}
val Bottom = object : Alignment.Vertical {}
val Start = object : Alignment.Horizontal {}
val CenterHorizontally = object : Alignment.Horizontal {}
val End = object : Alignment.Horizontal {}
}
}

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

@ -1,21 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
object Arrangement {
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
interface Horizontal
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
interface Vertical
val End = object : Horizontal {}
val Start = object : Horizontal {}
val Top = object : Vertical {}
val Bottom = object : Vertical {}
}

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

@ -1,34 +0,0 @@
package org.jetbrains.compose.common.core.graphics
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
public data class Color(val red: Int, val green: Int, val blue: Int) {
companion object {
@Deprecated(message = webWidgetsDeprecationMessage)
val Black = Color(0, 0, 0)
@Deprecated(message = webWidgetsDeprecationMessage)
val DarkGray = Color(0x44, 0x44, 0x44)
@Deprecated(message = webWidgetsDeprecationMessage)
val Gray = Color(0x88, 0x88, 0x88)
@Deprecated(message = webWidgetsDeprecationMessage)
val LightGray = Color(0xCC, 0xCC, 0xCC)
@Deprecated(message = webWidgetsDeprecationMessage)
val White = Color(0xFF, 0xFF, 0xFF)
@Deprecated(message = webWidgetsDeprecationMessage)
val Red = Color(0xFF, 0, 0)
@Deprecated(message = webWidgetsDeprecationMessage)
val Green = Color(0, 0xFF, 0)
@Deprecated(message = webWidgetsDeprecationMessage)
val Blue = Color(0, 0, 0xFF)
@Deprecated(message = webWidgetsDeprecationMessage)
val Yellow = Color(0xFF, 0xFF, 0x00)
@Deprecated(message = webWidgetsDeprecationMessage)
val Cyan = Color(0, 0xFF, 0xFF)
@Deprecated(message = webWidgetsDeprecationMessage)
val Magenta = Color(0xFF, 0, 0xFF)
}
}

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

@ -1,4 +0,0 @@
package org.jetbrains.compose.common.ui
@RequiresOptIn("This API is experimental and is likely to change in the future.")
annotation class ExperimentalComposeWebWidgetsApi()

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

@ -1,21 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
interface Modifier {
open class Element : Modifier
@Deprecated(message = webWidgetsDeprecationMessage)
companion object : Element()
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.background(color: Color): Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.padding(all: Dp): Modifier

8
web/widgets/src/commonMain/kotlin/annotations/webWidgetsDeprecationMessage.kt

@ -1,8 +0,0 @@
/*
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers.
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file.
*/
package org.jetbrains.compose.annotations
const val webWidgetsDeprecationMessage = "compose.web.web-widgets API is deprecated"

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

@ -1,11 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun BoxActual(modifier: Modifier, content: @Composable () -> Unit)

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

@ -1,15 +0,0 @@
package org.jetbrains.compose.common.material
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,
content: @Composable () -> Unit
)

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

@ -1,11 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit)

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

@ -1,14 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Box(
modifier: Modifier = Modifier.Companion,
content: @Composable () -> Unit
) { BoxActual(modifier, content) }

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.material
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Button(
modifier: Modifier = Modifier.Companion,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
ButtonActual(modifier, onClick, content)
}

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

@ -1,14 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Column(
modifier: Modifier = Modifier.Companion,
content: @Composable () -> Unit
) { ColumnActual(modifier, content) }

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Modifier.size(size: Dp): Modifier {
return size(size, size)
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Alignment
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Row(
modifier: Modifier = Modifier.Companion,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
verticalAlignment: Alignment.Vertical = Alignment.Top,
content: @Composable () -> Unit
) { RowActual(modifier, horizontalArrangement, verticalAlignment, content) }

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

@ -1,25 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Slider(
value: Float,
onValueChange: (Float) -> Unit = {},
valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
steps: Int = 0,
modifier: Modifier = Modifier.Companion
) {
SliderActual(
value,
onValueChange,
valueRange,
steps,
modifier
)
}

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

@ -1,20 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.TextUnit
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Text(
text: String,
modifier: Modifier = Modifier.Companion,
color: Color = Color.Black,
size: TextUnit = TextUnit.Unspecified
) {
TextActual(text, modifier, color, size)
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Alignment
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,
verticalAlignment: Alignment.Vertical,
content: @Composable () -> Unit
)

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

@ -1,12 +0,0 @@
package jetbrains.compose.common.shapes
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
interface Shape
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
object CircleShape : Shape

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,
valueRange: ClosedFloatingPointRange<Float>,
steps: Int,
modifier: Modifier,
)

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

@ -1,18 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.TextUnit
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal expect fun TextActual(
text: String,
modifier: Modifier,
color: Color,
size: TextUnit
)

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

@ -1,11 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.border(size: Dp, color: Color): Modifier

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

@ -1,9 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.clickable(onClick: () -> Unit): Modifier

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.ui.draw
import org.jetbrains.compose.common.ui.Modifier
import jetbrains.compose.common.shapes.Shape
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.clip(shape: Shape): Modifier

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

@ -1,9 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.fillMaxHeight(fraction: Float): Modifier

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

@ -1,9 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.fillMaxWidth(): Modifier

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.offset(x: Dp, y: Dp): Modifier

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

@ -1,12 +0,0 @@
package org.jetbrains.compose.common.ui.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.unit.IntSize
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier

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

@ -1,8 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.size(width: Dp, height: Dp): Modifier

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
expect fun Modifier.width(size: Dp): Modifier

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

@ -1,8 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
data class Dp(val value: Float)

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

@ -1,8 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
data class IntSize(val width: Int, val height: Int)

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

@ -1,21 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
enum class TextUnitType {
Unspecified,
Em,
Sp
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
data class TextUnit(val value: Float, val unitType: TextUnitType) {
companion object {
@Deprecated(message = webWidgetsDeprecationMessage)
val Unspecified = TextUnit(Float.NaN, TextUnitType.Unspecified)
}
}

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

@ -1,30 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
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 = webWidgetsDeprecationMessage)
val Int.dp: Dp
get() = Dp(this.toFloat())
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Int.em: TextUnit
get() = TextUnit(toFloat(), TextUnitType.Em)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Float.em: TextUnit
get() = TextUnit(this, TextUnitType.Em)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Int.sp: TextUnit
get() = TextUnit(toFloat(), TextUnitType.Sp)
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Float.sp: TextUnit
get() = TextUnit(this, TextUnitType.Sp)

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

@ -1,47 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.web.css.backgroundColor
import org.jetbrains.compose.web.css.margin
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.Color.RGB
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.web.attributes.AttrsScope
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.background(color: Color): Modifier = castOrCreate().apply {
add {
backgroundColor(RGB(color.red, color.green, color.blue))
}
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Modifier.asAttributeBuilderApplier(
passThroughHandler: (AttrsScope<*>.() -> Unit)? = null
): AttrsScope<*>.() -> Unit =
castOrCreate().let { modifier ->
val st: AttrsScope<*>.() -> Unit = {
modifier.attrHandlers.forEach { it.invoke(this) }
style {
modifier.styleHandlers.forEach { it.invoke(this) }
}
passThroughHandler?.invoke(this)
}
st
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.padding(all: Dp): Modifier = castOrCreate().apply {
// yes, it's not a typo, what Modifier.padding does is actually adding margin
add {
margin(all.value.px)
}
}

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

@ -1,50 +0,0 @@
package org.jetbrains.compose.web.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.web.css.justifyContent
import org.jetbrains.compose.web.css.JustifyContent
import org.jetbrains.compose.web.css.alignItems
import org.jetbrains.compose.web.css.AlignItems
import org.jetbrains.compose.web.css.flexDirection
import org.jetbrains.compose.web.css.FlexDirection
import org.jetbrains.compose.web.css.display
import org.jetbrains.compose.web.css.DisplayStyle
import org.jetbrains.compose.web.css.left
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.StyleSheet
@Deprecated(message = webWidgetsDeprecationMessage)
object Styles : StyleSheet() {
val columnClass = "compose-web-column"
val textClass by style {
display(DisplayStyle.Block)
left(0.px)
}
val rowClass by style {
display(DisplayStyle.Flex)
flexDirection(FlexDirection.Row)
}
val composeWebArrangementHorizontalStart by style {
justifyContent(JustifyContent.FlexStart)
}
val composeWebArrangementHorizontalEnd by style {
justifyContent(JustifyContent.FlexEnd)
}
val composeWebAlignmentVerticalTop by style {
alignItems(AlignItems.FlexStart)
}
val composeWebAlignmentVerticalCenter by style {
alignItems(AlignItems.Center)
}
val composeWebAlignmentVerticalBottom by style {
alignItems(AlignItems.FlexEnd)
}
}

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

@ -1,26 +0,0 @@
package org.jetbrains.compose.common.internal
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.web.css.StyleBuilder
import org.jetbrains.compose.web.attributes.AttrsScope
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
class ActualModifier : Modifier {
val styleHandlers = mutableListOf<StyleBuilder.() -> Unit>()
val attrHandlers = mutableListOf<AttrsScope<*>.() -> Unit>()
fun add(builder: StyleBuilder.() -> Unit) {
styleHandlers.add(builder)
}
fun addAttributeBuilder(builder: AttrsScope<*>.() -> Unit) {
attrHandlers.add(builder)
}
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Modifier.castOrCreate(): ActualModifier = (this as? ActualModifier) ?: ActualModifier()

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

@ -1,19 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.common.ui.asAttributeBuilderApplier
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun BoxActual(modifier: Modifier, content: @Composable () -> Unit) {
Div(
attrs = modifier.asAttributeBuilderApplier()
) {
content()
}
}

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

@ -1,24 +0,0 @@
package org.jetbrains.compose.common.material
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.dom.Button
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
Button(
attrs = {
onClick { onClick() }
}
) {
content()
}
}

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

@ -1,21 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.ui.Styles
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit) {
Div(
attrs = {
classes(Styles.columnClass)
}
) {
content()
}
}

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

@ -1,46 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.common.ui.Alignment
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.ui.Styles
@OptIn(ExperimentalComposeWebWidgetsApi::class)
private fun Arrangement.Horizontal.asClassName() = when (this) {
Arrangement.End -> Styles.composeWebArrangementHorizontalEnd
else -> Styles.composeWebArrangementHorizontalStart
}
@OptIn(ExperimentalComposeWebWidgetsApi::class)
private fun Alignment.Vertical.asClassName() = when (this) {
Alignment.Top -> Styles.composeWebAlignmentVerticalTop
Alignment.CenterVertically -> Styles.composeWebAlignmentVerticalCenter
else -> Styles.composeWebAlignmentVerticalBottom
}
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,
verticalAlignment: Alignment.Vertical,
content: @Composable () -> Unit
) {
Div(
attrs = {
classes(
*arrayOf(
Styles.rowClass,
horizontalArrangement.asClassName(),
verticalAlignment.asClassName()
)
)
}
) {
content()
}
}

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

@ -1,35 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.web.dom.Input
import org.jetbrains.compose.web.attributes.InputType
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,
valueRange: ClosedFloatingPointRange<Float>,
steps: Int,
modifier: Modifier,
) {
val stepCount = if (steps == 0) 100 else steps
val step = (valueRange.endInclusive - valueRange.start) / stepCount
Input(
type = InputType.Range,
attrs = {
value(value.toString())
attr("min", valueRange.start.toString())
attr("max", valueRange.endInclusive.toString())
attr("step", step.toString())
onInput {
onValueChange(it.value?.toFloat() ?: 0f)
}
}
)
}

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

@ -1,45 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.web.dom.Text as TextNode
import org.jetbrains.compose.web.dom.Span
import org.jetbrains.compose.web.ui.Styles
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.asAttributeBuilderApplier
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.color
import org.jetbrains.compose.web.css.fontSize
import org.jetbrains.compose.web.css.Color.RGB
import org.jetbrains.compose.common.ui.unit.TextUnit
import org.jetbrains.compose.common.ui.unit.TextUnitType
import org.jetbrains.compose.web.css.em
import org.jetbrains.compose.web.css.px
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun TextActual(
text: String,
modifier: Modifier,
color: Color,
size: TextUnit
) {
Span(
modifier.asAttributeBuilderApplier {
style {
color(RGB(color.red, color.green, color.blue))
when (size.unitType) {
TextUnitType.Em -> fontSize(size.value.em)
TextUnitType.Sp -> fontSize(size.value.px)
else -> fontSize(size.value.px)
}
}
classes(Styles.textClass)
}
) {
TextNode(text)
}
}

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

@ -1,20 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.LineStyle
import org.jetbrains.compose.web.css.border
import org.jetbrains.compose.web.css.Color.RGB
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
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))
}
}

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

@ -1,14 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.clickable(onClick: () -> Unit): Modifier = castOrCreate().apply {
addAttributeBuilder {
onClick { onClick() }
}
}

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

@ -1,20 +0,0 @@
package org.jetbrains.compose.common.ui.draw
import org.jetbrains.compose.common.ui.Modifier
import jetbrains.compose.common.shapes.Shape
import jetbrains.compose.common.shapes.CircleShape
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.borderRadius
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.clip(shape: Shape): Modifier = castOrCreate().apply {
when (shape) {
CircleShape -> add {
borderRadius(50.percent)
}
}
}

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

@ -1,16 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.height
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.fillMaxHeight(fraction: Float): Modifier = castOrCreate().apply {
add {
height((100 * fraction).percent)
}
}

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

@ -1,16 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.width
import org.jetbrains.compose.web.css.percent
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.fillMaxWidth(): Modifier = castOrCreate().apply {
add {
width(100.percent)
}
}

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

@ -1,19 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.marginTop
import org.jetbrains.compose.web.css.marginLeft
import org.jetbrains.compose.web.css.px
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.offset(x: Dp, y: Dp): Modifier = castOrCreate().apply {
add {
marginLeft(x.value.px)
marginTop(y.value.px)
}
}

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

@ -1,14 +0,0 @@
package org.jetbrains.compose.common.ui.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.unit.IntSize
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier {
return this
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.web.css.width
import org.jetbrains.compose.web.css.height
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.common.internal.castOrCreate
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.size(width: Dp, height: Dp): Modifier = castOrCreate().apply {
add {
width(width.value.px)
height(height.value.px)
}
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.web.css.px
import org.jetbrains.compose.web.css.width
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.width(size: Dp): Modifier = castOrCreate().apply {
add {
width(size.value.px)
}
}

35
web/widgets/src/jsTest/ModifierTests.kt

@ -1,35 +0,0 @@
import org.jetbrains.compose.web.renderComposable
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.foundation.layout.Box
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.background
import org.jetbrains.compose.common.ui.size
import org.jetbrains.compose.common.ui.unit.dp
import org.w3c.dom.HTMLElement
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class ModifierTests {
@Test
fun backgroundModifier() = runTest {
{
Box(
Modifier.background(Color(255, 0, 0))
) { }
}
assertEquals("background-color: rgb(255, 0, 0);", nextChild().style.cssText)
}
@Test
fun size() = runTest {
composition {
Box(
Modifier.size(40.dp)
) { }
}
assertEquals("width: 40px; height: 40px;", nextChild().style.cssText)
}
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import androidx.compose.ui.Alignment as JAlignment
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Alignment.Vertical.implementation: JAlignment.Vertical
get() = when (this) {
Alignment.Top -> JAlignment.Top
Alignment.CenterVertically -> JAlignment.CenterVertically
else -> JAlignment.Bottom
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.foundation.layout.Arrangement as JArrangement
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Arrangement.Horizontal.implementation: JArrangement.Horizontal
get() = when (this) {
Arrangement.End -> JArrangement.End
else -> JArrangement.Start
}

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.core.graphics
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.graphics.Color as JColor
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Color.implementation
get() = JColor(red, green, blue)

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

@ -1,27 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.unit.implementation
import androidx.compose.foundation.background
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.core.graphics.implementation
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.padding
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.background(color: Color): Modifier = castOrCreate().apply {
modifier = modifier.background(color.implementation)
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.padding(all: Dp): Modifier = castOrCreate().apply {
modifier = modifier.padding(all.implementation)
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Modifier.implementation
get() = castOrCreate().modifier

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

@ -1,19 +0,0 @@
package org.jetbrains.compose.common.internal
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.Modifier as JModifier
import org.jetbrains.compose.common.ui.Modifier
@Deprecated(message = webWidgetsDeprecationMessage)
private class ModifierElement : JModifier.Element
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
class ActualModifier : Modifier {
var modifier: JModifier = ModifierElement()
}
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
fun Modifier.castOrCreate(): ActualModifier = (this as? ActualModifier) ?: ActualModifier()

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.implementation
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.foundation.layout.Box as JBox
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun BoxActual(modifier: Modifier, content: @Composable () -> Unit) {
JBox(modifier.implementation) {
content.invoke()
}
}

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

@ -1,21 +0,0 @@
package org.jetbrains.compose.common.material
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.implementation
import androidx.compose.material.Button as JButton
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun ButtonActual(
modifier: Modifier,
onClick: () -> Unit,
content: @Composable () -> Unit
) {
JButton(onClick, modifier.implementation) {
content()
}
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.foundation.layout.Column as JColumn
import org.jetbrains.compose.common.ui.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun ColumnActual(modifier: Modifier, content: @Composable () -> Unit) {
JColumn(modifier = modifier.implementation) {
content.invoke()
}
}

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

@ -1,24 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.*
import androidx.compose.foundation.layout.Row as JRow
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun RowActual(
modifier: Modifier,
horizontalArrangement: Arrangement.Horizontal,
verticalAlignment: Alignment.Vertical,
content: @Composable () -> Unit
) {
JRow(
modifier.implementation,
horizontalArrangement.implementation,
verticalAlignment.implementation
) {
content.invoke()
}
}

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

@ -1,14 +0,0 @@
package jetbrains.compose.common.shapes
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.graphics.Shape as JShape
import androidx.compose.foundation.shape.CircleShape as JCircleShape
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Shape.implementation: JShape
get() = when (this) {
CircleShape -> JCircleShape
else -> throw ClassCastException("Currently supporting only circle shape")
}

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

@ -1,27 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.Modifier
import androidx.compose.material.Slider as JSlider
import org.jetbrains.compose.common.ui.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun SliderActual(
value: Float,
onValueChange: (Float) -> Unit,
valueRange: ClosedFloatingPointRange<Float>,
steps: Int,
modifier: Modifier
) {
JSlider(
value,
onValueChange = onValueChange,
modifier = modifier.implementation,
valueRange = valueRange,
steps = steps
)
}

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

@ -1,29 +0,0 @@
package org.jetbrains.compose.common.material
import androidx.compose.runtime.Composable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import androidx.compose.material.Text as JText
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.implementation
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.core.graphics.implementation
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.TextUnit
import org.jetbrains.compose.common.ui.unit.implementation
@Composable
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
internal actual fun TextActual(
text: String,
modifier: Modifier,
color: Color,
size: TextUnit
) {
JText(
text,
modifier = modifier.implementation,
color = color.implementation,
fontSize = size.implementation
)
}

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

@ -1,17 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.core.graphics.Color
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import org.jetbrains.compose.common.core.graphics.implementation
import org.jetbrains.compose.common.ui.unit.implementation
import androidx.compose.foundation.border
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.border(size: Dp, color: Color): Modifier = castOrCreate().apply {
modifier = modifier.border(size.implementation, color.implementation)
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.foundation
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.clickable
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.clickable(onClick: () -> Unit): Modifier = castOrCreate().apply {
modifier = modifier.clickable(onClick = onClick)
}

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

@ -1,15 +0,0 @@
package org.jetbrains.compose.common.ui.draw
import org.jetbrains.compose.common.ui.Modifier
import jetbrains.compose.common.shapes.Shape
import jetbrains.compose.common.shapes.implementation
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.ui.draw.clip
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.clip(shape: Shape): Modifier = castOrCreate().apply {
modifier = modifier.clip(shape.implementation)
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.fillMaxHeight
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.fillMaxHeight(fraction: Float): Modifier = castOrCreate().apply {
modifier = modifier.fillMaxHeight(fraction)
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.fillMaxWidth
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.fillMaxWidth(): Modifier = castOrCreate().apply {
modifier = modifier.fillMaxWidth()
}

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

@ -1,15 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.offset
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.implementation
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.offset(x: Dp, y: Dp): Modifier = castOrCreate().apply {
modifier = modifier.offset(x.implementation, y.implementation)
}

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

@ -1,18 +0,0 @@
package org.jetbrains.compose.common.ui.layout
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.ui.unit.IntSize
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.ui.layout.onSizeChanged
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.onSizeChanged(
onSizeChanged: (IntSize) -> Unit
): Modifier = castOrCreate().apply {
modifier = modifier.onSizeChanged {
onSizeChanged(IntSize(it.width, it.height))
}
}

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

@ -1,13 +0,0 @@
package org.jetbrains.compose.common.ui
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.unit.implementation
import androidx.compose.foundation.layout.size
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.internal.castOrCreate
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.size(width: Dp, height: Dp): Modifier = castOrCreate().apply {
modifier = modifier.size(width.implementation, height.implementation)
}

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

@ -1,15 +0,0 @@
package org.jetbrains.compose.common.foundation.layout
import org.jetbrains.compose.common.ui.unit.Dp
import org.jetbrains.compose.common.ui.Modifier
import org.jetbrains.compose.common.internal.castOrCreate
import androidx.compose.foundation.layout.width
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import org.jetbrains.compose.common.ui.unit.implementation
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
actual fun Modifier.width(size: Dp): Modifier = castOrCreate().apply {
modifier = modifier.width(size.implementation)
}

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

@ -1,10 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
import androidx.compose.ui.unit.Dp as JDp
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val Dp.implementation: JDp
get() = JDp(value)

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

@ -1,16 +0,0 @@
package org.jetbrains.compose.common.ui.unit
import androidx.compose.ui.unit.TextUnit as JTextUnit
import androidx.compose.ui.unit.em
import androidx.compose.ui.unit.sp
import org.jetbrains.compose.annotations.webWidgetsDeprecationMessage
import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi
@ExperimentalComposeWebWidgetsApi
@Deprecated(message = webWidgetsDeprecationMessage)
val TextUnit.implementation: JTextUnit
get() = when (unitType) {
TextUnitType.Em -> (value).em
TextUnitType.Sp -> (value).sp
else -> JTextUnit.Unspecified
}
Loading…
Cancel
Save