diff --git a/examples/falling-balls-web/build.gradle.kts b/examples/falling-balls-web/build.gradle.kts deleted file mode 100644 index d471299de9..0000000000 --- a/examples/falling-balls-web/build.gradle.kts +++ /dev/null @@ -1,84 +0,0 @@ -import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension -import org.jetbrains.compose.compose -import org.jetbrains.compose.desktop.application.dsl.TargetFormat - -plugins { - kotlin("multiplatform") - id("org.jetbrains.compose") -} - -version = "1.0-SNAPSHOT" - -repositories { - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - google() -} - -kotlin { - jvm() - js(IR) { - browser() - binaries.executable() - } - - sourceSets { - val commonMain by getting { - dependencies { - implementation(kotlin("stdlib-common")) - implementation(compose.web.widgets) - implementation(compose.runtime) - } - } - - val jvmMain by getting { - dependencies { - implementation(compose.desktop.currentOs) - } - } - - - val commonTest by getting { - dependencies { - implementation(kotlin("test-common")) - implementation(kotlin("test-annotations-common")) - } - } - } -} - -compose.desktop { - application { - mainClass = "org.jetbrains.compose.common.demo.AppKt" - - nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) - packageName = "ImageViewer" - packageVersion = "1.0.0" - - modules("jdk.crypto.ec") - - val iconsRoot = project.file("../common/src/desktopMain/resources/images") - macOS { - iconFile.set(iconsRoot.resolve("icon-mac.icns")) - } - windows { - iconFile.set(iconsRoot.resolve("icon-windows.ico")) - menuGroup = "Compose Examples" - // see https://wixtoolset.org/documentation/manual/v3/howtos/general/generate_guids.html - upgradeUuid = "18159995-d967-4CD2-8885-77BFA97CFA9F" - } - linux { - iconFile.set(iconsRoot.resolve("icon-linux.png")) - } - } - } -} - -// a temporary workaround for a bug in jsRun invocation - see https://youtrack.jetbrains.com/issue/KT-48273 -afterEvaluate { - rootProject.extensions.configure { - versions.webpackDevServer.version = "4.0.0" - versions.webpackCli.version = "4.9.0" - } -} diff --git a/examples/falling-balls-web/gradle.properties b/examples/falling-balls-web/gradle.properties deleted file mode 100644 index 09a8915b34..0000000000 --- a/examples/falling-balls-web/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -kotlin.version=1.6.10 -compose.version=1.0.1-rc2 diff --git a/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.jar b/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c023..0000000000 Binary files a/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.properties b/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 05679dc3c1..0000000000 --- a/examples/falling-balls-web/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/examples/falling-balls-web/gradlew b/examples/falling-balls-web/gradlew deleted file mode 100755 index 4f906e0c81..0000000000 --- a/examples/falling-balls-web/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# 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 -# -# https://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. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/examples/falling-balls-web/gradlew.bat b/examples/falling-balls-web/gradlew.bat deleted file mode 100644 index 107acd32c4..0000000000 --- a/examples/falling-balls-web/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/examples/falling-balls-web/settings.gradle.kts b/examples/falling-balls-web/settings.gradle.kts deleted file mode 100644 index bbbb65a6ae..0000000000 --- a/examples/falling-balls-web/settings.gradle.kts +++ /dev/null @@ -1,15 +0,0 @@ -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } - - plugins { - kotlin("multiplatform").version(extra["kotlin.version"] as String) - id("org.jetbrains.compose").version(extra["compose.version"] as String) - } -} - -rootProject.name = "falling_balls_with_web" - diff --git a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Game.kt b/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Game.kt deleted file mode 100644 index d1d3e935c9..0000000000 --- a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Game.kt +++ /dev/null @@ -1,80 +0,0 @@ -package org.jetbrains.compose.demo.falling - -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateListOf -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import org.jetbrains.compose.common.ui.unit.IntSize -import org.jetbrains.compose.common.core.graphics.Color -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi -import kotlin.random.Random - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -private fun Color.Companion.random() = - Color((0..255).random(), (0..255).random(), (0..255).random()) - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -abstract class Game { - internal var previousTime: Long = Long.MAX_VALUE - private var startTime = 0L - - var size by mutableStateOf(IntSize(0, 0)) - - var width: Int - get() = size.width - set(newWidth: Int) { - size = IntSize(newWidth, height) - } - - var height: Int - get() = size.height - set(newHeight) { - size = IntSize(width, newHeight) - } - - var pieces = mutableStateListOf() - private set - - var elapsed by mutableStateOf(0L) - var score by mutableStateOf(0) - var clicked by mutableStateOf(0) - - var started by mutableStateOf(false) - var paused by mutableStateOf(false) - var finished by mutableStateOf(false) - - var numBlocks by mutableStateOf(5) - - fun isInBoundaries(pieceData: PieceData) = pieceData.position < size.height - - abstract fun now(): Long - - fun togglePause() { - paused = !paused - previousTime = Long.MAX_VALUE - } - - fun start() { - previousTime = now() - startTime = previousTime - clicked = 0 - started = true - finished = false - paused = false - pieces.clear() - repeat(numBlocks) { index -> - pieces.add( - PieceData(this, index * 1.5f + 5f, Color.random()).also { piece -> - piece.position = Random.nextDouble(0.0, 100.0).toFloat() - } - ) - } - } - - fun update(nanos: Long) { - val dt = (nanos - previousTime).coerceAtLeast(0) - previousTime = nanos - elapsed = nanos - startTime - pieces.forEach { it.update(dt) } - } -} diff --git a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Piece.kt b/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Piece.kt deleted file mode 100644 index feb1e6b767..0000000000 --- a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/Piece.kt +++ /dev/null @@ -1,31 +0,0 @@ -package org.jetbrains.compose.demo.falling.views - -import androidx.compose.runtime.Composable -import org.jetbrains.compose.demo.falling.PieceData -import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.foundation.layout.Box -import org.jetbrains.compose.common.ui.unit.dp -import org.jetbrains.compose.common.ui.unit.Dp -import org.jetbrains.compose.common.foundation.layout.offset -import org.jetbrains.compose.common.ui.background -import org.jetbrains.compose.common.ui.size -import org.jetbrains.compose.common.foundation.clickable -import org.jetbrains.compose.common.ui.draw.clip -import org.jetbrains.compose.common.core.graphics.Color -import jetbrains.compose.common.shapes.CircleShape -import org.jetbrains.compose.common.demo.position -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -@Composable -fun Piece(index: Int, piece: PieceData) { - val boxSize = 40.dp - Box( - Modifier - .position(Dp(boxSize.value * index * 5 / 3), Dp(piece.position)) - .size(boxSize, boxSize) - .background(if (piece.picked) Color.Gray else piece.color) - .clickable { piece.pick() } - .clip(CircleShape) - ) {} -} diff --git a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/PieceData.kt b/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/PieceData.kt deleted file mode 100644 index ce4e40e650..0000000000 --- a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/PieceData.kt +++ /dev/null @@ -1,34 +0,0 @@ -package org.jetbrains.compose.demo.falling - -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue -import androidx.compose.runtime.getValue -import org.jetbrains.compose.common.core.graphics.Color -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -data class PieceData constructor(val game: Game, val velocity: Float, val color: Color) { - var picked: Boolean by mutableStateOf(false) - var position: Float by mutableStateOf(0f) - - private fun Game.pickPiece(piece: PieceData) { - score += piece.velocity.toInt() - clicked++ - if (clicked == numBlocks) { - finished = true - } - } - - fun update(dt: Long) { - if (picked) return - val delta = (dt / 1E8 * velocity).toFloat() - position = if (game.isInBoundaries(this)) position + delta else 0f - } - - fun pick() { - if (!picked && !game.paused) { - picked = true - game.pickPiece(this) - } - } -} diff --git a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/fallingBalls.kt b/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/fallingBalls.kt deleted file mode 100644 index 41bc8e6e38..0000000000 --- a/examples/falling-balls-web/src/commonMain/kotlin/fallingBalls/fallingBalls.kt +++ /dev/null @@ -1,105 +0,0 @@ -package org.jetbrains.compose.demo.falling.views - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.withFrameNanos -import org.jetbrains.compose.demo.falling.Game -import org.jetbrains.compose.common.material.Text -import org.jetbrains.compose.common.foundation.layout.Column -import org.jetbrains.compose.common.material.Slider -import org.jetbrains.compose.common.foundation.layout.Row -import org.jetbrains.compose.common.foundation.layout.Box -import org.jetbrains.compose.common.material.Button -import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.ui.unit.em -import org.jetbrains.compose.common.ui.unit.dp -import org.jetbrains.compose.common.foundation.layout.offset -import org.jetbrains.compose.common.foundation.layout.width -import org.jetbrains.compose.common.ui.layout.onSizeChanged -import org.jetbrains.compose.common.ui.background -import org.jetbrains.compose.common.foundation.border -import org.jetbrains.compose.common.ui.size -import org.jetbrains.compose.common.core.graphics.Color -import org.jetbrains.compose.common.foundation.layout.fillMaxHeight -import org.jetbrains.compose.common.foundation.layout.fillMaxWidth -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -@Composable -fun fallingBalls(game: Game) { - Column(Modifier.fillMaxWidth().fillMaxHeight(1f)) { - Box() { - Text( - "Catch balls!${if (game.finished) " Game over!" else ""}", - size = 1.8f.em, - color = Color(218, 120, 91) - ) - } - Box() { - Text( - "Score: ${game.score} Time: ${game.elapsed / 1_000_000} Blocks: ${game.numBlocks}", - size = 1.8f.em - ) - } - Row() { - if (!game.started) { - Slider( - value = game.numBlocks / 20f, - onValueChange = { game.numBlocks = (it * 20f).toInt().coerceAtLeast(1) }, - modifier = Modifier.width(100.dp) - ) - } - Button( - Modifier - .border(2.dp, Color(255, 215, 0)) - .background(Color.Yellow), - onClick = { - game.started = !game.started - if (game.started) { - game.start() - } - } - ) { - Text(if (game.started) "Stop" else "Start", size = 2f.em) - } - if (game.started) { - Button( - Modifier - .offset(10.dp, 0.dp) - .border(2.dp, Color(255, 215, 0)) - .background(Color.Yellow), - onClick = { - game.togglePause() - } - ) { - Text(if (game.paused) "Resume" else "Pause", size = 2f.em) - } - } - } - - if (game.started) { - Box( - Modifier - .fillMaxWidth() - .fillMaxHeight(1f) - .size(game.width.dp, game.height.dp) - .onSizeChanged { - game.size = it - } - ) { - game.pieces.forEachIndexed { index, piece -> - Piece(index, piece) - } - } - } - - LaunchedEffect(Unit) { - while (true) { - withFrameNanos { - if (game.started && !game.paused && !game.finished) - game.update(it) - } - } - } - } -} diff --git a/examples/falling-balls-web/src/commonMain/kotlin/modifiers/position.kt b/examples/falling-balls-web/src/commonMain/kotlin/modifiers/position.kt deleted file mode 100644 index b532814f0c..0000000000 --- a/examples/falling-balls-web/src/commonMain/kotlin/modifiers/position.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.jetbrains.compose.common.demo - -import androidx.compose.runtime.Composable -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi -import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.ui.unit.Dp - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -@Composable -expect fun Modifier.position(width: Dp, height: Dp): Modifier \ No newline at end of file diff --git a/examples/falling-balls-web/src/jsMain/kotlin/androidx/compose/web/with-web/App.kt b/examples/falling-balls-web/src/jsMain/kotlin/androidx/compose/web/with-web/App.kt deleted file mode 100644 index 0490d7924b..0000000000 --- a/examples/falling-balls-web/src/jsMain/kotlin/androidx/compose/web/with-web/App.kt +++ /dev/null @@ -1,30 +0,0 @@ -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.demo.falling.views.fallingBalls -import org.jetbrains.compose.demo.falling.Game -import androidx.compose.runtime.remember -import kotlinx.browser.window -import org.jetbrains.compose.web.css.Style -import org.jetbrains.compose.web.ui.Styles - -class JsGame : Game() { - override fun now() = window.performance.now().toLong() -} - -fun main() { - val root = document.getElementById("root") as HTMLElement - - renderComposable(root = root) { - Style(Styles) - val game = remember { - JsGame().apply { - width = root.offsetWidth - height = root.offsetHeight - } - } - fallingBalls(game) - } -} diff --git a/examples/falling-balls-web/src/jsMain/kotlin/modifiers/position.kt b/examples/falling-balls-web/src/jsMain/kotlin/modifiers/position.kt deleted file mode 100644 index afd89fc911..0000000000 --- a/examples/falling-balls-web/src/jsMain/kotlin/modifiers/position.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.jetbrains.compose.common.demo - -import androidx.compose.runtime.Composable -import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.foundation.layout.offset -import org.jetbrains.compose.common.ui.unit.Dp -import org.jetbrains.compose.common.internal.castOrCreate -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi -import org.jetbrains.compose.web.css.top -import org.jetbrains.compose.web.css.left -import org.jetbrains.compose.web.css.px -import org.jetbrains.compose.web.css.position -import org.jetbrains.compose.web.css.Position - -@OptIn(ExperimentalComposeWebWidgetsApi::class) -@Composable -actual fun Modifier.position(width: Dp, height: Dp): Modifier = castOrCreate().apply { - add { - position(Position.Absolute) - top(height.value.px) - left(width.value.px) - } -} \ No newline at end of file diff --git a/examples/falling-balls-web/src/jsMain/resources/index.html b/examples/falling-balls-web/src/jsMain/resources/index.html deleted file mode 100644 index 5c5e954a1e..0000000000 --- a/examples/falling-balls-web/src/jsMain/resources/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - compose-browser-with-web-demo - - - -
- - - diff --git a/examples/falling-balls-web/src/jsMain/resources/styles.css b/examples/falling-balls-web/src/jsMain/resources/styles.css deleted file mode 100644 index e5b3293a7a..0000000000 --- a/examples/falling-balls-web/src/jsMain/resources/styles.css +++ /dev/null @@ -1,8 +0,0 @@ -#root { - width: 100%; - height: 100vh; -} - -#root > .compose-web-column > div { - position: relative; -} \ No newline at end of file diff --git a/examples/falling-balls-web/src/jvmMain/kotlin/App.kt b/examples/falling-balls-web/src/jvmMain/kotlin/App.kt deleted file mode 100644 index d2eed65ca9..0000000000 --- a/examples/falling-balls-web/src/jvmMain/kotlin/App.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.jetbrains.compose.common.demo - -import androidx.compose.runtime.remember -import androidx.compose.ui.window.singleWindowApplication -import org.jetbrains.compose.demo.falling.Game -import org.jetbrains.compose.demo.falling.views.fallingBalls - -class JvmGame : Game() { - override fun now() = System.nanoTime() -} - -fun main() { - singleWindowApplication(title = "Demo") { - fallingBalls( - remember { - JvmGame().apply { - width = 600 - height = 400 - } - } - ) - } -} diff --git a/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt b/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt deleted file mode 100644 index 050e54b9fc..0000000000 --- a/examples/falling-balls-web/src/jvmMain/kotlin/modifiers/position.kt +++ /dev/null @@ -1,15 +0,0 @@ -package org.jetbrains.compose.common.demo - -import androidx.compose.runtime.Composable -import org.jetbrains.compose.common.ui.Modifier -import org.jetbrains.compose.common.ui.unit.Dp -import org.jetbrains.compose.common.internal.castOrCreate -import org.jetbrains.compose.common.ui.unit.implementation -import androidx.compose.foundation.layout.offset -import org.jetbrains.compose.common.ui.ExperimentalComposeWebWidgetsApi - -@Composable -@OptIn(ExperimentalComposeWebWidgetsApi::class) -actual fun Modifier.position(width: Dp, height: Dp): Modifier = castOrCreate().apply { - modifier = modifier.offset(width.implementation, height.implementation) -} diff --git a/examples/validateExamples.sh b/examples/validateExamples.sh index 580a923fe9..0b9b9cab76 100755 --- a/examples/validateExamples.sh +++ b/examples/validateExamples.sh @@ -18,7 +18,7 @@ runGradle() { } runGradle codeviewer package -runGradle falling-balls-web build +runGradle falling-balls-mpp build runGradle imageviewer package runGradle issues package runGradle notepad package