diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-02-03 23:21:46 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-02-03 23:21:46 +0100 |
commit | 9665fe692681bc958e55d00cc0d0b238b7aee694 (patch) | |
tree | dd222dec725f64b8065a09311d9b034e9b9751b3 | |
parent | 180528f620e53e4a828d6f4d427ce83817572f44 (diff) | |
download | kvision-9665fe692681bc958e55d00cc0d0b238b7aee694.tar.gz kvision-9665fe692681bc958e55d00cc0d0b238b7aee694.tar.bz2 kvision-9665fe692681bc958e55d00cc0d0b238b7aee694.zip |
Refactoring for kdoc API documentation with dokka
107 files changed, 130 insertions, 4376 deletions
diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..b4f8e8b2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2017-2018 Robert Jaros + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Module.md b/Module.md new file mode 100644 index 00000000..753c7fbe --- /dev/null +++ b/Module.md @@ -0,0 +1,7 @@ +# Module KVision + +KVision - object oriented Web UI framework for Kotlin/JS. + +# Package pl.treksoft.kvision + +Base interfaces, classes and functions declarations necessary to develop KVision applications. diff --git a/build.gradle b/build.gradle index c714b81a..532af293 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,6 @@ buildscript { ext.kotlin_version = '1.2.21' + ext.dokka_version = '0.9.16-eap-3' ext.production = (findProperty('prod') ?: 'false') == 'true' ext.npmdeps = new File("npm.dependencies").getText() @@ -7,12 +8,14 @@ buildscript { jcenter() maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } maven { url "https://plugins.gradle.org/m2/" } + maven { url 'https://bintray.com/kotlin/kotlin-eap/dokka' } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.26" classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-2" + classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}" } } @@ -21,9 +24,14 @@ plugins { id "com.jfrog.bintray" version "1.7.3" } -apply plugin: 'kotlin2js' +if (!project.gradle.startParameter.taskNames.contains("dokka")) { + apply plugin: 'kotlin2js' +} else { + apply plugin: 'kotlin' +} apply plugin: 'org.jetbrains.kotlin.frontend' apply plugin: "io.gitlab.arturbosch.detekt" +apply plugin: 'org.jetbrains.dokka' group = 'pl.treksoft' version = '0.0.1' @@ -35,8 +43,13 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported + if (!project.gradle.startParameter.taskNames.contains("dokka")) { + compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported + } else { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" // for now only compile configuration is supported + } compile "com.github.snabbdom:snabbdom-kotlin:0.1.1" compile "pl.treksoft:navigo-kotlin:0.0.2" compile "pl.treksoft:jquery-kotlin:0.0.3" @@ -62,16 +75,16 @@ kotlinFrontend { } task cleanLibs(type: Delete) { - delete 'build/js', 'build/libs' + delete 'build/js', 'build/libs' } -if (project.gradle.startParameter.taskNames.contains("jar")){ +if (project.gradle.startParameter.taskNames.contains("jar")) { compileKotlin2Js.dependsOn 'cleanLibs' } jar { duplicatesStrategy = DuplicatesStrategy.EXCLUDE - excludes = [ "package.json" ] + excludes = ["package.json"] } task sourcesJar(type: Jar, dependsOn: classes) { @@ -88,18 +101,30 @@ detekt { } } -compileKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' +dokka { + includes = ['Module.md'] + classpath = [new File("dokka/kvision-dokka-helper.jar")] + outputFormat = 'html' + outputDirectory = "$buildDir/kdoc" + impliedPlatforms = ["JS"] } -compileTestKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' +if (!project.gradle.startParameter.taskNames.contains("dokka")) { + + compileKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'commonjs' + } + + compileTestKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'commonjs' + } + } task copyResources(type: Copy) { @@ -112,9 +137,11 @@ task copyResourcesForTests(type: Copy) { into file(buildDir.path + "/js-tests/") } -afterEvaluate { - tasks.getByName("webpack-bundle") { dependsOn(copyResources) } - tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } +if (!project.gradle.startParameter.taskNames.contains("dokka")) { + afterEvaluate { + tasks.getByName("webpack-bundle") { dependsOn(copyResources) } + tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } + } } publishing { @@ -148,7 +175,7 @@ bintray { vcsUrl = "https://github.com/rjaros/${project.name}.git" version { name = "${project.version}" - desc = 'Object oriented Web UI framework for Kotlin.' + desc = 'Object oriented Web UI framework for Kotlin/JS' released = new Date() } } diff --git a/dokka/kvision-dokka-helper.jar b/dokka/kvision-dokka-helper.jar Binary files differnew file mode 100644 index 00000000..752a1311 --- /dev/null +++ b/dokka/kvision-dokka-helper.jar diff --git a/examples/helloworld/.gitignore b/examples/helloworld/.gitignore deleted file mode 100644 index 631a8b87..00000000 --- a/examples/helloworld/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.*/ -build/ -out/ -*.iml -/refresh.sh diff --git a/examples/helloworld/build.gradle b/examples/helloworld/build.gradle deleted file mode 100644 index 8ffec081..00000000 --- a/examples/helloworld/build.gradle +++ /dev/null @@ -1,92 +0,0 @@ -buildscript { - ext.kotlin_version = '1.2.21' - ext.production = (findProperty('prod') ?: 'false') == 'true' - ext.npmdeps = new URL("file:///home/rjaros/git/kvision/npm.dependencies").getText() - - repositories { - jcenter() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } - maven { url "https://plugins.gradle.org/m2/" } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.26" - classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-2" - } -} - -apply plugin: 'kotlin2js' -apply plugin: 'org.jetbrains.kotlin.frontend' -apply plugin: "io.gitlab.arturbosch.detekt" - -repositories { - jcenter() - maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' } - maven { url = 'https://dl.bintray.com/rjaros/kotlin' } - maven { - url "file:///home/rjaros/kotlin/mvn/" - } -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported - compile "pl.treksoft:kvision:0.0.1" -} - -kotlinFrontend { - npm { - npmdeps.eachLine { line -> - def (name, version) = line.tokenize(" ") - dependency(name, version) - } - devDependency("karma") - } - - webpackBundle { - bundleName = "main" - contentPath = file('src/main/web') - } - - define "PRODUCTION", production - -} - -detekt { - version = "1.0.0.RC6-2" - profile("main") { - input = "$projectDir/src/main/kotlin" - config = "$projectDir/detekt.yml" - filters = ".*test.*,.*/resources/.*,.*/tmp/.*" - } -} - -compileKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -compileTestKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -task copyResources(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js") -} - -task copyResourcesForTests(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js-tests/") -} - -afterEvaluate { - tasks.getByName("webpack-bundle") { dependsOn(copyResources) } - tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } -} diff --git a/examples/helloworld/detekt.yml b/examples/helloworld/detekt.yml deleted file mode 100644 index a6fdea75..00000000 --- a/examples/helloworld/detekt.yml +++ /dev/null @@ -1,292 +0,0 @@ -autoCorrect: true -failFast: false - -build: - warningThreshold: 5 - failThreshold: 10 - weights: - complexity: 2 - formatting: 1 - LongParameterList: 1 - comments: 1 - -processors: - active: true - exclude: - # - 'FunctionCountProcessor' - # - 'PropertyCountProcessor' - # - 'ClassCountProcessor' - # - 'PackageCountProcessor' - # - 'KtFileCountProcessor' - -console-reports: - active: true - exclude: - # - 'ProjectStatisticsReport' - # - 'ComplexityReport' - # - 'NotificationReport' - # - 'FindingsReport' - # - 'BuildFailureReport' - -output-reports: - active: true - exclude: - # - 'PlainOutputReport' - # - 'XmlOutputReport' - -potential-bugs: - active: true - DuplicateCaseInWhenExpression: - active: true - EqualsAlwaysReturnsTrueOrFalse: - active: false - EqualsWithHashCodeExist: - active: true - WrongEqualsTypeParameter: - active: false - ExplicitGarbageCollectionCall: - active: true - UnreachableCode: - active: true - LateinitUsage: - active: false - UnsafeCallOnNullableType: - active: false - UnsafeCast: - active: false - UselessPostfixExpression: - active: false - -performance: - active: true - ForEachOnRange: - active: true - SpreadOperator: - active: true - UnnecessaryTemporaryInstantiation: - active: true - -exceptions: - active: true - TooGenericExceptionCatched: - active: true - exceptions: - - ArrayIndexOutOfBoundsException - - Error - - Exception - - IllegalMonitorStateException - - IndexOutOfBoundsException - - NullPointerException - - RuntimeException - TooGenericExceptionThrown: - active: true - exceptions: - - Throwable - - ThrowError - - ThrowException - - ThrowNullPointerException - - ThrowRuntimeException - - ThrowThrowable - -empty-blocks: - active: true - EmptyCatchBlock: - active: true - EmptyClassBlock: - active: true - EmptyDefaultConstructor: - active: true - EmptyDoWhileBlock: - active: true - EmptyElseBlock: - active: true - EmptyFinallyBlock: - active: true - EmptyForBlock: - active: true - EmptyFunctionBlock: - active: true - EmptyIfBlock: - active: true - EmptyInitBlock: - active: true - EmptySecondaryConstructor: - active: true - EmptyWhenBlock: - active: true - EmptyWhileBlock: - active: true - -complexity: - active: true - LongMethod: - threshold: 20 - LongParameterList: - threshold: 5 - LargeClass: - threshold: 150 - ComplexMethod: - threshold: 10 - TooManyFunctions: - threshold: 10 - ComplexCondition: - threshold: 3 - LabeledExpression: - active: false - StringLiteralDuplication: - active: false - threshold: 2 - ignoreAnnotation: true - excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' - -code-smell: - active: true - FeatureEnvy: - threshold: 0.5 - weight: 0.45 - base: 0.5 - -formatting: - active: true - useTabs: true - Indentation: - active: false - indentSize: 4 - ConsecutiveBlankLines: - active: true - autoCorrect: true - MultipleSpaces: - active: true - autoCorrect: true - SpacingAfterComma: - active: true - autoCorrect: true - SpacingAfterKeyword: - active: true - autoCorrect: true - SpacingAroundColon: - active: true - autoCorrect: true - SpacingAroundCurlyBraces: - active: true - autoCorrect: true - SpacingAroundOperator: - active: true - autoCorrect: true - TrailingSpaces: - active: true - autoCorrect: true - UnusedImports: - active: true - autoCorrect: true - OptionalSemicolon: - active: true - autoCorrect: true - OptionalUnit: - active: true - autoCorrect: true - ExpressionBodySyntax: - active: false - autoCorrect: false - ExpressionBodySyntaxLineBreaks: - active: false - autoCorrect: false - OptionalReturnKeyword: - active: true - autoCorrect: false - -style: - active: true - ReturnCount: - active: true - max: 2 - NewLineAtEndOfFile: - active: true - OptionalAbstractKeyword: - active: true - OptionalWhenBraces: - active: false - EqualsNullCall: - active: false - ForbiddenComment: - active: true - values: 'TODO:,FIXME:,STOPSHIP:' - ForbiddenImport: - active: false - imports: '' - ModifierOrder: - active: true - MagicNumber: - active: true - ignoreNumbers: '-1,0,1,2' - ignoreHashCodeFunction: false - ignorePropertyDeclaration: false - ignoreAnnotation: false - WildcardImport: - active: true - SafeCast: - active: true - MaxLineLength: - active: true - maxLineLength: 120 - excludePackageStatements: false - excludeImportStatements: false - PackageNaming: - active: true - packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' - ClassNaming: - active: true - classPattern: '[A-Z$][a-zA-Z$]*' - EnumNaming: - active: true - enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$' - FunctionNaming : - active: true - functionPattern: '^[a-z$][a-zA-Z$0-9]*$' - FunctionMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionMinLength: - active: false - minimumFunctionNameLength: 3 - VariableNaming : - active: true - variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$' - ConstantNaming : - active: true - constantPattern: '^([A-Z_]*|serialVersionUID)$' - VariableMaxLength: - active: false - maximumVariableNameLength: 30 - VariableMinLength: - active: false - minimumVariableNameLength: 3 - ProtectedMemberInFinalClass: - active: false - UnnecessaryParentheses: - active: false - -comments: - active: true - CommentOverPrivateMethod: - active: true - CommentOverPrivateProperty: - active: true - UndocumentedPublicClass: - active: false - searchInNestedClass: true - searchInInnerClass: true - searchInInnerObject: true - searchInInnerInterface: true - UndocumentedPublicFunction: - active: false - -# *experimental feature* -# Migration rules can be defined in the same config file or a new one -migration: - active: true - imports: - # your.package.Class: new.package.or.Class - # for example: - # io.gitlab.arturbosch.detekt.api.Rule: io.gitlab.arturbosch.detekt.rule.Rule diff --git a/examples/helloworld/gradle.properties b/examples/helloworld/gradle.properties deleted file mode 100644 index 4ac81290..00000000 --- a/examples/helloworld/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -#org.gradle.jvmargs=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -#org.gradle.debug=true diff --git a/examples/helloworld/gradle/wrapper/gradle-wrapper.jar b/examples/helloworld/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 09f1fecb..00000000 --- a/examples/helloworld/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/examples/helloworld/gradle/wrapper/gradle-wrapper.properties b/examples/helloworld/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 9f53b3e5..00000000 --- a/examples/helloworld/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Mon Jan 22 09:38:31 CET 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/examples/helloworld/gradlew b/examples/helloworld/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/examples/helloworld/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## 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="" - -# 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, switch paths to Windows format before running java -if $cygwin ; 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=$((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" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/examples/helloworld/gradlew.bat b/examples/helloworld/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/examples/helloworld/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@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 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= - -@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 init - -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 init - -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 - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -: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 %CMD_LINE_ARGS% - -: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/helloworld/package.json.d/project.info b/examples/helloworld/package.json.d/project.info deleted file mode 100644 index 805c8f43..00000000 --- a/examples/helloworld/package.json.d/project.info +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "KVision Helloworld" -} diff --git a/examples/helloworld/settings.gradle b/examples/helloworld/settings.gradle deleted file mode 100644 index 6a02f57e..00000000 --- a/examples/helloworld/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'helloworld' diff --git a/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt b/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt deleted file mode 100644 index 61e75482..00000000 --- a/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.panel.FLEXDIR -import pl.treksoft.kvision.panel.FLEXJUSTIFY -import pl.treksoft.kvision.panel.FlexPanel -import pl.treksoft.kvision.utils.px - -class Helloworld : ApplicationBase() { - - override fun start(state: Map<String, Any>) { - val root = Root("helloworld") - val panel = FlexPanel(FLEXDIR.ROW, justify = FLEXJUSTIFY.CENTER) - val hello = Tag(TAG.DIV, "Hello world!", classes = setOf("helloworld")).apply { - marginTop = 50.px() - - } - panel.add(hello) - root.add(panel) - } - - override fun dispose(): Map<String, Any> { - return mapOf() - } - - companion object { - val css = require("./css/style.css") - } -} diff --git a/examples/helloworld/src/main/kotlin/com/example/Main.kt b/examples/helloworld/src/main/kotlin/com/example/Main.kt deleted file mode 100644 index 53b6b0ae..00000000 --- a/examples/helloworld/src/main/kotlin/com/example/Main.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.module -import kotlin.browser.document - -external fun require(name: String): dynamic - -fun main(args: Array<String>) { - var application: ApplicationBase? = null - - val state: dynamic = module.hot?.let { hot -> - hot.accept() - - hot.dispose { data -> - data.appState = application?.dispose() - KVManager.shutdown() - application = null - } - - hot.data - } - - if (document.body != null) { - KVManager.start() - application = start(state) - } else { - KVManager.init() - application = null - document.addEventListener("DOMContentLoaded", { application = start(state) }) - } -} - -fun start(state: dynamic): ApplicationBase? { - if (document.getElementById("helloworld") == null) return null - val application = Helloworld() - @Suppress("UnsafeCastFromDynamic") - application.start(state?.appState ?: emptyMap()) - return application -} - diff --git a/examples/helloworld/src/main/resources/css/style.css b/examples/helloworld/src/main/resources/css/style.css deleted file mode 100644 index 76482c15..00000000 --- a/examples/helloworld/src/main/resources/css/style.css +++ /dev/null @@ -1,3 +0,0 @@ -.helloworld { - font-size: 30px; -} diff --git a/examples/helloworld/src/main/web/index.html b/examples/helloworld/src/main/web/index.html deleted file mode 100644 index a29727fe..00000000 --- a/examples/helloworld/src/main/web/index.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>KVision Helloworld</title> - <script type="text/javascript" src="main.bundle.js"></script> - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> - <!--[if lt IE 9]> - <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> - <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> - <![endif]--> -</head> -<body> -<div id="helloworld"></div> -</body> -</html> diff --git a/examples/helloworld/src/test/kotlin/test/com/example/HelloworldSpec.kt b/examples/helloworld/src/test/kotlin/test/com/example/HelloworldSpec.kt deleted file mode 100644 index 8054c000..00000000 --- a/examples/helloworld/src/test/kotlin/test/com/example/HelloworldSpec.kt +++ /dev/null @@ -1,21 +0,0 @@ -package test.com.example - -import com.example.Helloworld -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertTrue - -class HelloworldSpec : DomSpec { - - @Test - fun render() { - run { - Helloworld().start(mapOf()) - val element = document.getElementById("helloworld") - assertTrue( - element?.innerHTML?.contains("Hello world!") ?: false, - "Application should render Hello world! text" - ) - } - } -} diff --git a/examples/helloworld/src/test/kotlin/test/com/example/TestUtil.kt b/examples/helloworld/src/test/kotlin/test/com/example/TestUtil.kt deleted file mode 100644 index c5ec014f..00000000 --- a/examples/helloworld/src/test/kotlin/test/com/example/TestUtil.kt +++ /dev/null @@ -1,32 +0,0 @@ -package test.com.example - -import pl.treksoft.jquery.jQuery -import kotlin.browser.document - -interface TestSpec { - fun beforeTest() - - fun afterTest() - - fun run(code: () -> Unit) { - beforeTest() - code() - afterTest() - } -} - -interface DomSpec : TestSpec { - - override fun beforeTest() { - val fixture = "<div style=\"display: none\" id=\"pretest\">" + - "<div id=\"helloworld\"></div></div>" - document.body?.insertAdjacentHTML("afterbegin", fixture) - } - - override fun afterTest() { - val div = document.getElementById("pretest") - div?.remove() - jQuery(`object` = ".modal-backdrop").remove() - } - -} diff --git a/examples/helloworld/webpack.config.d/bootstrap.js b/examples/helloworld/webpack.config.d/bootstrap.js deleted file mode 100644 index 32a7c4d0..00000000 --- a/examples/helloworld/webpack.config.d/bootstrap.js +++ /dev/null @@ -1,4 +0,0 @@ -config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'}); -config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'}); -config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'}); -config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'}); diff --git a/examples/helloworld/webpack.config.d/css.js b/examples/helloworld/webpack.config.d/css.js deleted file mode 100644 index 5d710d35..00000000 --- a/examples/helloworld/webpack.config.d/css.js +++ /dev/null @@ -1,2 +0,0 @@ -config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); - diff --git a/examples/helloworld/webpack.config.d/dce.js b/examples/helloworld/webpack.config.d/dce.js deleted file mode 100644 index b536a6bf..00000000 --- a/examples/helloworld/webpack.config.d/dce.js +++ /dev/null @@ -1,2 +0,0 @@ -var path = require("path"); -config.resolve.modules.unshift(path.resolve("./js/min")); diff --git a/examples/helloworld/webpack.config.d/file.js b/examples/helloworld/webpack.config.d/file.js deleted file mode 100644 index 8b853e7e..00000000 --- a/examples/helloworld/webpack.config.d/file.js +++ /dev/null @@ -1,6 +0,0 @@ -config.module.rules.push( - { - test: /\.(jpe?g|png|gif|svg)$/i, - loader: 'file-loader' - } -);
\ No newline at end of file diff --git a/examples/helloworld/webpack.config.d/jquery.js b/examples/helloworld/webpack.config.d/jquery.js deleted file mode 100644 index 40522595..00000000 --- a/examples/helloworld/webpack.config.d/jquery.js +++ /dev/null @@ -1,4 +0,0 @@ -config.plugins.push(new webpack.ProvidePlugin({ - $: "jquery", - jQuery: "jquery" -})); diff --git a/examples/helloworld/webpack.config.d/minify.js b/examples/helloworld/webpack.config.d/minify.js deleted file mode 100644 index 34e706c9..00000000 --- a/examples/helloworld/webpack.config.d/minify.js +++ /dev/null @@ -1,4 +0,0 @@ -if (defined.PRODUCTION) { - config.plugins.push(new webpack.optimize.UglifyJsPlugin({ - })); -} diff --git a/examples/showcase/.gitignore b/examples/showcase/.gitignore deleted file mode 100644 index 631a8b87..00000000 --- a/examples/showcase/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.*/ -build/ -out/ -*.iml -/refresh.sh diff --git a/examples/showcase/build.gradle b/examples/showcase/build.gradle deleted file mode 100644 index 8ffec081..00000000 --- a/examples/showcase/build.gradle +++ /dev/null @@ -1,92 +0,0 @@ -buildscript { - ext.kotlin_version = '1.2.21' - ext.production = (findProperty('prod') ?: 'false') == 'true' - ext.npmdeps = new URL("file:///home/rjaros/git/kvision/npm.dependencies").getText() - - repositories { - jcenter() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } - maven { url "https://plugins.gradle.org/m2/" } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.26" - classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-2" - } -} - -apply plugin: 'kotlin2js' -apply plugin: 'org.jetbrains.kotlin.frontend' -apply plugin: "io.gitlab.arturbosch.detekt" - -repositories { - jcenter() - maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' } - maven { url = 'https://dl.bintray.com/rjaros/kotlin' } - maven { - url "file:///home/rjaros/kotlin/mvn/" - } -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported - compile "pl.treksoft:kvision:0.0.1" -} - -kotlinFrontend { - npm { - npmdeps.eachLine { line -> - def (name, version) = line.tokenize(" ") - dependency(name, version) - } - devDependency("karma") - } - - webpackBundle { - bundleName = "main" - contentPath = file('src/main/web') - } - - define "PRODUCTION", production - -} - -detekt { - version = "1.0.0.RC6-2" - profile("main") { - input = "$projectDir/src/main/kotlin" - config = "$projectDir/detekt.yml" - filters = ".*test.*,.*/resources/.*,.*/tmp/.*" - } -} - -compileKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -compileTestKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -task copyResources(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js") -} - -task copyResourcesForTests(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js-tests/") -} - -afterEvaluate { - tasks.getByName("webpack-bundle") { dependsOn(copyResources) } - tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } -} diff --git a/examples/showcase/detekt.yml b/examples/showcase/detekt.yml deleted file mode 100644 index a6fdea75..00000000 --- a/examples/showcase/detekt.yml +++ /dev/null @@ -1,292 +0,0 @@ -autoCorrect: true -failFast: false - -build: - warningThreshold: 5 - failThreshold: 10 - weights: - complexity: 2 - formatting: 1 - LongParameterList: 1 - comments: 1 - -processors: - active: true - exclude: - # - 'FunctionCountProcessor' - # - 'PropertyCountProcessor' - # - 'ClassCountProcessor' - # - 'PackageCountProcessor' - # - 'KtFileCountProcessor' - -console-reports: - active: true - exclude: - # - 'ProjectStatisticsReport' - # - 'ComplexityReport' - # - 'NotificationReport' - # - 'FindingsReport' - # - 'BuildFailureReport' - -output-reports: - active: true - exclude: - # - 'PlainOutputReport' - # - 'XmlOutputReport' - -potential-bugs: - active: true - DuplicateCaseInWhenExpression: - active: true - EqualsAlwaysReturnsTrueOrFalse: - active: false - EqualsWithHashCodeExist: - active: true - WrongEqualsTypeParameter: - active: false - ExplicitGarbageCollectionCall: - active: true - UnreachableCode: - active: true - LateinitUsage: - active: false - UnsafeCallOnNullableType: - active: false - UnsafeCast: - active: false - UselessPostfixExpression: - active: false - -performance: - active: true - ForEachOnRange: - active: true - SpreadOperator: - active: true - UnnecessaryTemporaryInstantiation: - active: true - -exceptions: - active: true - TooGenericExceptionCatched: - active: true - exceptions: - - ArrayIndexOutOfBoundsException - - Error - - Exception - - IllegalMonitorStateException - - IndexOutOfBoundsException - - NullPointerException - - RuntimeException - TooGenericExceptionThrown: - active: true - exceptions: - - Throwable - - ThrowError - - ThrowException - - ThrowNullPointerException - - ThrowRuntimeException - - ThrowThrowable - -empty-blocks: - active: true - EmptyCatchBlock: - active: true - EmptyClassBlock: - active: true - EmptyDefaultConstructor: - active: true - EmptyDoWhileBlock: - active: true - EmptyElseBlock: - active: true - EmptyFinallyBlock: - active: true - EmptyForBlock: - active: true - EmptyFunctionBlock: - active: true - EmptyIfBlock: - active: true - EmptyInitBlock: - active: true - EmptySecondaryConstructor: - active: true - EmptyWhenBlock: - active: true - EmptyWhileBlock: - active: true - -complexity: - active: true - LongMethod: - threshold: 20 - LongParameterList: - threshold: 5 - LargeClass: - threshold: 150 - ComplexMethod: - threshold: 10 - TooManyFunctions: - threshold: 10 - ComplexCondition: - threshold: 3 - LabeledExpression: - active: false - StringLiteralDuplication: - active: false - threshold: 2 - ignoreAnnotation: true - excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' - -code-smell: - active: true - FeatureEnvy: - threshold: 0.5 - weight: 0.45 - base: 0.5 - -formatting: - active: true - useTabs: true - Indentation: - active: false - indentSize: 4 - ConsecutiveBlankLines: - active: true - autoCorrect: true - MultipleSpaces: - active: true - autoCorrect: true - SpacingAfterComma: - active: true - autoCorrect: true - SpacingAfterKeyword: - active: true - autoCorrect: true - SpacingAroundColon: - active: true - autoCorrect: true - SpacingAroundCurlyBraces: - active: true - autoCorrect: true - SpacingAroundOperator: - active: true - autoCorrect: true - TrailingSpaces: - active: true - autoCorrect: true - UnusedImports: - active: true - autoCorrect: true - OptionalSemicolon: - active: true - autoCorrect: true - OptionalUnit: - active: true - autoCorrect: true - ExpressionBodySyntax: - active: false - autoCorrect: false - ExpressionBodySyntaxLineBreaks: - active: false - autoCorrect: false - OptionalReturnKeyword: - active: true - autoCorrect: false - -style: - active: true - ReturnCount: - active: true - max: 2 - NewLineAtEndOfFile: - active: true - OptionalAbstractKeyword: - active: true - OptionalWhenBraces: - active: false - EqualsNullCall: - active: false - ForbiddenComment: - active: true - values: 'TODO:,FIXME:,STOPSHIP:' - ForbiddenImport: - active: false - imports: '' - ModifierOrder: - active: true - MagicNumber: - active: true - ignoreNumbers: '-1,0,1,2' - ignoreHashCodeFunction: false - ignorePropertyDeclaration: false - ignoreAnnotation: false - WildcardImport: - active: true - SafeCast: - active: true - MaxLineLength: - active: true - maxLineLength: 120 - excludePackageStatements: false - excludeImportStatements: false - PackageNaming: - active: true - packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' - ClassNaming: - active: true - classPattern: '[A-Z$][a-zA-Z$]*' - EnumNaming: - active: true - enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$' - FunctionNaming : - active: true - functionPattern: '^[a-z$][a-zA-Z$0-9]*$' - FunctionMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionMinLength: - active: false - minimumFunctionNameLength: 3 - VariableNaming : - active: true - variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$' - ConstantNaming : - active: true - constantPattern: '^([A-Z_]*|serialVersionUID)$' - VariableMaxLength: - active: false - maximumVariableNameLength: 30 - VariableMinLength: - active: false - minimumVariableNameLength: 3 - ProtectedMemberInFinalClass: - active: false - UnnecessaryParentheses: - active: false - -comments: - active: true - CommentOverPrivateMethod: - active: true - CommentOverPrivateProperty: - active: true - UndocumentedPublicClass: - active: false - searchInNestedClass: true - searchInInnerClass: true - searchInInnerObject: true - searchInInnerInterface: true - UndocumentedPublicFunction: - active: false - -# *experimental feature* -# Migration rules can be defined in the same config file or a new one -migration: - active: true - imports: - # your.package.Class: new.package.or.Class - # for example: - # io.gitlab.arturbosch.detekt.api.Rule: io.gitlab.arturbosch.detekt.rule.Rule diff --git a/examples/showcase/gradle.properties b/examples/showcase/gradle.properties deleted file mode 100644 index 4ac81290..00000000 --- a/examples/showcase/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -#org.gradle.jvmargs=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -#org.gradle.debug=true diff --git a/examples/showcase/gradle/wrapper/gradle-wrapper.jar b/examples/showcase/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 09f1fecb..00000000 --- a/examples/showcase/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/examples/showcase/gradle/wrapper/gradle-wrapper.properties b/examples/showcase/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index ebc5a13a..00000000 --- a/examples/showcase/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Jan 24 11:39:21 CET 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip diff --git a/examples/showcase/gradlew b/examples/showcase/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/examples/showcase/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## 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="" - -# 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, switch paths to Windows format before running java -if $cygwin ; 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=$((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" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/examples/showcase/gradlew.bat b/examples/showcase/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/examples/showcase/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@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 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= - -@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 init - -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 init - -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 - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -: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 %CMD_LINE_ARGS% - -: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/showcase/package.json.d/project.info b/examples/showcase/package.json.d/project.info deleted file mode 100644 index a7749d63..00000000 --- a/examples/showcase/package.json.d/project.info +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "KVision Showcase" -} diff --git a/examples/showcase/settings.gradle b/examples/showcase/settings.gradle deleted file mode 100644 index d5254b37..00000000 --- a/examples/showcase/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'showcase' diff --git a/examples/showcase/src/main/kotlin/com/example/BasicTab.kt b/examples/showcase/src/main/kotlin/com/example/BasicTab.kt deleted file mode 100644 index 84e52b45..00000000 --- a/examples/showcase/src/main/kotlin/com/example/BasicTab.kt +++ /dev/null @@ -1,38 +0,0 @@ -package com.example - -import pl.treksoft.kvision.basic.Label -import pl.treksoft.kvision.html.IMAGESHAPE -import pl.treksoft.kvision.html.Image -import pl.treksoft.kvision.html.LIST -import pl.treksoft.kvision.html.Link -import pl.treksoft.kvision.html.ListTag -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.panel.FLEXALIGNITEMS -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class BasicTab : SimplePanel() { - init { - this.marginTop = 10.px() - this.minHeight = 400.px() - val panel = VPanel(spacing = 3) - panel.add(Label("A simple label")) - panel.add(Label("A list:")) - panel.add(ListTag(LIST.UL, listOf("First list element", "Second list element", "Third list element"))) - panel.add(Label("An image:")) - panel.add(Image(require("./img/dog.jpg"), shape = IMAGESHAPE.CIRCLE)) - panel.add(Tag(TAG.CODE, "Some text written in <code></code> HTML tag.")) - panel.add( - Tag( - TAG.DIV, - "Rich <b>text</b> <i>written</i> with <span style=\"font-family: Verdana; font-size: 14pt\">" + - "any <strong>forma</strong>tting</span>.", - rich = true - ) - ) - panel.add(Link("A link to Google", "http://www.google.com")) - this.add(panel) - } -}
\ No newline at end of file diff --git a/examples/showcase/src/main/kotlin/com/example/ButtonsTab.kt b/examples/showcase/src/main/kotlin/com/example/ButtonsTab.kt deleted file mode 100644 index 93f32694..00000000 --- a/examples/showcase/src/main/kotlin/com/example/ButtonsTab.kt +++ /dev/null @@ -1,48 +0,0 @@ -package com.example - -import pl.treksoft.kvision.form.check.CHECKBOXSTYLE -import pl.treksoft.kvision.form.check.CheckBox -import pl.treksoft.kvision.form.check.RADIOSTYLE -import pl.treksoft.kvision.form.check.Radio -import pl.treksoft.kvision.html.BUTTONSTYLE -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.panel.FLEXWRAP -import pl.treksoft.kvision.panel.HPanel -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class ButtonsTab : SimplePanel() { - init { - this.marginTop = 10.px() - val mainPanel = HPanel(wrap = FLEXWRAP.WRAP, spacing = 100) - val buttonsPanel = VPanel(spacing = 7) - buttonsPanel.add(Button("Default button", style = BUTTONSTYLE.DEFAULT).apply { width = 200.px() }) - buttonsPanel.add(Button("Primary button", style = BUTTONSTYLE.PRIMARY).apply { width = 200.px() }) - buttonsPanel.add(Button("Success button", style = BUTTONSTYLE.SUCCESS).apply { width = 200.px() }) - buttonsPanel.add(Button("Info button", style = BUTTONSTYLE.INFO).apply { width = 200.px() }) - buttonsPanel.add(Button("Warning button", style = BUTTONSTYLE.WARNING).apply { width = 200.px() }) - buttonsPanel.add(Button("Danger button", style = BUTTONSTYLE.DANGER).apply { width = 200.px() }) - buttonsPanel.add(Button("Link button", style = BUTTONSTYLE.LINK).apply { width = 200.px() }) - mainPanel.add(buttonsPanel) - val ckPanel = VPanel() - ckPanel.add(CheckBox(true, label = "Default checkbox").apply { style = CHECKBOXSTYLE.DEFAULT }) - ckPanel.add(CheckBox(true, label = "Primary checkbox").apply { style = CHECKBOXSTYLE.PRIMARY }) - ckPanel.add(CheckBox(true, label = "Success checkbox").apply { style = CHECKBOXSTYLE.SUCCESS }) - ckPanel.add(CheckBox(true, label = "Info checkbox").apply { style = CHECKBOXSTYLE.INFO }) - ckPanel.add(CheckBox(true, label = "Warning checkbox").apply { style = CHECKBOXSTYLE.WARNING }) - ckPanel.add(CheckBox(true, label = "Danger checkbox").apply { style = CHECKBOXSTYLE.DANGER }) - ckPanel.add(CheckBox(true, label = "Circled checkbox").apply { circled = true }) - mainPanel.add(ckPanel) - val radioPanel = VPanel() - radioPanel.add(Radio(name = "radio", label = "Default radiobutton").apply { style = RADIOSTYLE.DEFAULT }) - radioPanel.add(Radio(name = "radio", label = "Primary radiobutton").apply { style = RADIOSTYLE.PRIMARY }) - radioPanel.add(Radio(name = "radio", label = "Success radiobutton").apply { style = RADIOSTYLE.SUCCESS }) - radioPanel.add(Radio(name = "radio", label = "Info radiobutton").apply { style = RADIOSTYLE.INFO }) - radioPanel.add(Radio(name = "radio", label = "Warning radiobutton").apply { style = RADIOSTYLE.WARNING }) - radioPanel.add(Radio(name = "radio", label = "Danger radiobutton").apply { style = RADIOSTYLE.DANGER }) - radioPanel.add(Radio(name = "radio", label = "Squared radiobutton").apply { squared = true }) - mainPanel.add(radioPanel) - this.add(mainPanel) - } -}
\ No newline at end of file diff --git a/examples/showcase/src/main/kotlin/com/example/ContainersTab.kt b/examples/showcase/src/main/kotlin/com/example/ContainersTab.kt deleted file mode 100644 index 66a45c39..00000000 --- a/examples/showcase/src/main/kotlin/com/example/ContainersTab.kt +++ /dev/null @@ -1,95 +0,0 @@ -package com.example - -import pl.treksoft.kvision.core.Background -import pl.treksoft.kvision.core.COLOR -import pl.treksoft.kvision.core.Container -import pl.treksoft.kvision.dropdown.DropDown -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.panel.DIRECTION -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.SplitPanel -import pl.treksoft.kvision.panel.StackPanel -import pl.treksoft.kvision.panel.TabPanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class ContainersTab : SimplePanel() { - init { - this.marginTop = 10.px() - val panel = VPanel(spacing = 5) - addStackPanel(panel) - addTabPanel(panel) - addVerticalSplitPanel(panel) - addHorizontalSplitPanel(panel) - this.add(panel) - } - - private fun addStackPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Stack panel")) - - val stack = StackPanel() - stack.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.BLUE) - height = 40.px() - }, "/containers/blue") - stack.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.GREEN) - height = 40.px() - }, "/containers/green") - panel.add(stack) - - val ldd = DropDown( - "Activate panel from the stack", listOf( - "Blue panel" to "#!/containers/blue", - "Green panel" to "#!/containers/green" - ) - ) - panel.add(ldd) - } - - private fun addTabPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Tab panel")) - - val tabs = TabPanel() - tabs.addTab("Blue panel", Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.BLUE) - height = 40.px() - }) - tabs.addTab("Green panel", Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.GREEN) - height = 40.px() - }) - panel.add(tabs) - } - - private fun addVerticalSplitPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Vertical split panel")) - - val split = SplitPanel() - split.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.BLUE) - height = 200.px() - }) - split.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.GREEN) - height = 200.px() - }) - panel.add(split) - } - - private fun addHorizontalSplitPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Horizontal split panel")) - - val split = SplitPanel(direction = DIRECTION.HORIZONTAL).apply { height = 220.px() } - split.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.BLUE) - height = 100.px() - }) - split.add(Tag(TAG.DIV, " ", rich = true).apply { - background = Background(COLOR.GREEN) - height = 100.px() - }) - panel.add(split) - } -} diff --git a/examples/showcase/src/main/kotlin/com/example/DataTab.kt b/examples/showcase/src/main/kotlin/com/example/DataTab.kt deleted file mode 100644 index ed690340..00000000 --- a/examples/showcase/src/main/kotlin/com/example/DataTab.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.example - -import com.lightningkite.kotlin.observable.list.observableListOf -import pl.treksoft.kvision.data.BaseDataComponent -import pl.treksoft.kvision.data.DataContainer -import pl.treksoft.kvision.form.check.CHECKBOXSTYLE -import pl.treksoft.kvision.form.check.CheckBox -import pl.treksoft.kvision.html.BUTTONSTYLE -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.panel.FLEXWRAP -import pl.treksoft.kvision.panel.HPanel -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class DataTab : SimplePanel() { - init { - this.marginTop = 10.px() - this.minHeight = 400.px() - - val panel = VPanel(spacing = 5) - - class DataModel(checked: Boolean, text: String) : BaseDataComponent() { - var checked: Boolean by obs(checked) - var text: String by obs(text) - } - - val list = observableListOf( - DataModel(false, "January"), - DataModel(false, "February"), - DataModel(false, "March"), - DataModel(false, "April"), - DataModel(false, "May"), - DataModel(false, "June"), - DataModel(false, "July"), - DataModel(false, "August"), - DataModel(false, "September"), - DataModel(false, "October"), - DataModel(false, "November") - ) - val dataContainer = DataContainer(list, { index -> - CheckBox( - value = list[index].checked, - label = if (list[index].checked) "<b>${list[index].text}</b>" else "${list[index].text}" - ).apply { - rich = true - style = CHECKBOXSTYLE.PRIMARY - onClick { - list[index].checked = this.value - } - } - }, child = HPanel(spacing = 10, wrap = FLEXWRAP.WRAP)) - panel.add(dataContainer) - - val butPanel = HPanel(spacing = 10, wrap = FLEXWRAP.WRAP) - butPanel.add(Button("Add December", style = BUTTONSTYLE.SUCCESS).onClick { - list.add(DataModel(true, "December")) - }) - butPanel.add(Button("Check all", style = BUTTONSTYLE.INFO).onClick { - list.forEach { it.checked = true } - }) - butPanel.add(Button("Uncheck all", style = BUTTONSTYLE.INFO).onClick { - list.forEach { it.checked = false } - }) - butPanel.add(Button("Reverse list", style = BUTTONSTYLE.DANGER).onClick { - list.reverse() - }) - butPanel.add(Button("Remove checked", style = BUTTONSTYLE.DANGER).onClick { - list.filter { it.checked }.forEach { list.remove(it) } - }) - panel.add(butPanel) - this.add(panel) - } -} diff --git a/examples/showcase/src/main/kotlin/com/example/DropDownTab.kt b/examples/showcase/src/main/kotlin/com/example/DropDownTab.kt deleted file mode 100644 index b98815f0..00000000 --- a/examples/showcase/src/main/kotlin/com/example/DropDownTab.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.example - -import pl.treksoft.kvision.dropdown.DD -import pl.treksoft.kvision.dropdown.DropDown -import pl.treksoft.kvision.html.BUTTONSTYLE -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.html.Image -import pl.treksoft.kvision.panel.HPanel -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class DropDownTab : SimplePanel() { - init { - this.marginTop = 10.px() - this.minHeight = 400.px() - val panel = VPanel(spacing = 30) - val ndd = DropDown( - "Dropdown with navigation menu", listOf( - "Basic formatting" to "#!/basic", - "Forms" to "#!/forms", - "Buttons" to "#!/buttons", - "Dropdowns" to "#!/dropdowns", - "Containers" to "#!/containers" - ), "fa-arrow-right", style = BUTTONSTYLE.SUCCESS - ).apply { - width = 250.px() - } - panel.add(ndd) - - val idd = DropDown("Dropdown with custom list", icon = "fa-picture-o", style = BUTTONSTYLE.WARNING).apply { - width = 250.px() - } - idd.add(Image(require("./img/cat.jpg")).apply { margin = 10.px(); title = "Cat" }) - idd.add(Image(require("./img/dog.jpg")).apply { margin = 10.px(); title = "Dog" }) - panel.add(idd) - - val hpanel = HPanel(spacing = 5) - val fdd = DropDown( - "Dropdown with special options", listOf( - "Header" to DD.HEADER.type, - "Basic formatting" to "#!/basic", - "Forms" to "#!/forms", - "Buttons" to "#!/buttons", - "Separator" to DD.SEPARATOR.type, - "Dropdowns (disabled)" to DD.DISABLED.type, - "Separator" to DD.SEPARATOR.type, - "Containers" to "#!/containers" - ), "fa-asterisk", style = BUTTONSTYLE.PRIMARY - ).apply { - dropup = true - width = 250.px() - } - hpanel.add(fdd) - val ddbutton = Button("Toggle dropdown", style = BUTTONSTYLE.INFO).onClick { e -> - fdd.toggle() - e.stopPropagation() - } - hpanel.add(ddbutton) - panel.add(hpanel) - this.add(panel) - } -}
\ No newline at end of file diff --git a/examples/showcase/src/main/kotlin/com/example/FormTab.kt b/examples/showcase/src/main/kotlin/com/example/FormTab.kt deleted file mode 100644 index 49c1f6fe..00000000 --- a/examples/showcase/src/main/kotlin/com/example/FormTab.kt +++ /dev/null @@ -1,137 +0,0 @@ -package com.example - -import pl.treksoft.kvision.form.FormPanel -import pl.treksoft.kvision.form.check.CheckBox -import pl.treksoft.kvision.form.check.Radio -import pl.treksoft.kvision.form.check.RadioGroup -import pl.treksoft.kvision.form.select.AjaxOptions -import pl.treksoft.kvision.form.select.Select -import pl.treksoft.kvision.form.spinner.Spinner -import pl.treksoft.kvision.form.text.Password -import pl.treksoft.kvision.form.text.RichText -import pl.treksoft.kvision.form.text.Text -import pl.treksoft.kvision.form.text.TextArea -import pl.treksoft.kvision.form.time.DateTime -import pl.treksoft.kvision.html.BUTTONSTYLE -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.modal.Alert -import pl.treksoft.kvision.modal.Confirm -import pl.treksoft.kvision.panel.HPanel -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.snabbdom.obj -import pl.treksoft.kvision.utils.px -import kotlin.js.Date - -class Form(val map: Map<String, Any?>) { - val text: String? by map - val password: String? by map - val password2: String? by map - val textarea: String? by map - val richtext: String? by map - val date: Date? by map - val time: Date? by map - val checkbox: Boolean by map - val radio: Boolean by map - val select: String? by map - val spinner: Double? by map - val radiogroup: String? by map -} - - -class FormTab : SimplePanel() { - init { - this.marginTop = 10.px() - val formPanel = FormPanel { - Form(it) - }.apply { - add( - "text", - Text(label = "Required text field with regexp [0-9] validator").apply { - placeholder = "Enter your age" - }, - required = true, - validatorMessage = { "Only numbers are allowed" }) { - it.getValue()?.matches("^[0-9]+$") - } - add("password", Password(label = "Password field with minimum length validator"), - validatorMessage = { "Password too short" }) { - (it.getValue()?.length ?: 0) >= 8 - } - add("password2", Password(label = "Password confirmation"), - validatorMessage = { "Password too short" }) { - (it.getValue()?.length ?: 0) >= 8 - } - add("textarea", TextArea(label = "Text area field")) - add( - "richtext", - RichText(label = "Rich text field with a placeholder").apply { placeholder = "Add some info" }) - add( - "date", - DateTime(format = "YYYY-MM-DD", label = "Date field with a placeholder").apply { - placeholder = "Enter date" - }) - add( - "time", - DateTime(format = "HH:mm", label = "Time field") - ) - add("checkbox", CheckBox(label = "Required checkbox")) { it.getValue() } - add("radio", Radio(label = "Radio button")) - add( - "select", Select( - options = listOf("first" to "First option", "second" to "Second option"), - label = "Simple select" - ) - ) - - add("ajaxselect", Select(label = "Select with remote data source").apply { - emptyOption = true - ajaxOptions = AjaxOptions("https://api.github.com/search/repositories", processData = { - it.items.map { item -> - obj { - this.value = item.id - this.text = item.name - this.data = obj { - this.subtext = item.owner.login - } - } - } - }, processParams = obj { - q = "{{{q}}}" - }, minLength = 3, requestDelay = 1000) - }) - add("spinner", Spinner(label = "Spinner field 10 - 20", min = 10, max = 20)) - add( - "radiogroup", RadioGroup( - listOf("option1" to "First option", "option2" to "Second option"), - inline = true, label = "Radio button group" - ) - ) - validator = { - val result = it["password"] == it["password2"] - if (!result) { - it.getControl("password")?.validatorError = "Passwords are not the same" - it.getControl("password2")?.validatorError = "Passwords are not the same" - } - result - } - validatorMessage = { "The passwords are not the same." } - } - this.add(formPanel) - val buttonsPanel = HPanel(spacing = 10) - val validButton = Button("Validate", "fa-check", BUTTONSTYLE.INFO).onClick { - formPanel.validate() - } - buttonsPanel.add(validButton) - val dataButton = Button("Show data", "fa-info", BUTTONSTYLE.SUCCESS).onClick { - Alert.show("Form data in plain JSON", JSON.stringify(formPanel.getDataJson(), space = 1)) - } - buttonsPanel.add(dataButton) - val clearButton = Button("Clear data", "fa-times", BUTTONSTYLE.DANGER).onClick { - Confirm.show("Are you sure?", "Do you want to clear your data?") { - formPanel.clearData() - } - } - buttonsPanel.add(clearButton) - formPanel.add(buttonsPanel) - } -}
\ No newline at end of file diff --git a/examples/showcase/src/main/kotlin/com/example/LayoutsTab.kt b/examples/showcase/src/main/kotlin/com/example/LayoutsTab.kt deleted file mode 100644 index f25da4fe..00000000 --- a/examples/showcase/src/main/kotlin/com/example/LayoutsTab.kt +++ /dev/null @@ -1,160 +0,0 @@ -package com.example - -import pl.treksoft.kvision.core.Background -import pl.treksoft.kvision.core.COLOR -import pl.treksoft.kvision.core.Container -import pl.treksoft.kvision.core.CssSize -import pl.treksoft.kvision.html.ALIGN -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.panel.* -import pl.treksoft.kvision.utils.perc -import pl.treksoft.kvision.utils.px - -class LayoutsTab : SimplePanel() { - init { - this.marginTop = 10.px() - this.minHeight = 400.px() - val panel = VPanel(spacing = 5) - addHPanel(panel) - addVPanel(panel) - addFlexPanel1(panel) - addFlexPanel2(panel) - addFlexPanel3(panel) - addFlexPanel4(panel) - addFlexPanel5(panel) - addGridPanel1(panel) - addGridPanel2(panel) - addRespGridPanel(panel) - addDockPanel(panel) - this.add(panel) - } - - private fun addHPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Horizontal layout")) - val hpanel = HPanel(spacing = 5) - hpanel.add(getDiv("1", 100)) - hpanel.add(getDiv("2", 150)) - hpanel.add(getDiv("3", 200)) - panel.add(hpanel) - } - - private fun addVPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Vertical layout")) - val vpanel = VPanel(spacing = 5) - vpanel.add(getDiv("1", 100)) - vpanel.add(getDiv("2", 150)) - vpanel.add(getDiv("3", 200)) - panel.add(vpanel) - } - - private fun addFlexPanel1(panel: Container) { - panel.add(Tag(TAG.H4, "CSS flexbox layouts")) - val flexpanel = FlexPanel( - FLEXDIR.ROW, FLEXWRAP.WRAP, FLEXJUSTIFY.FLEXEND, FLEXALIGNITEMS.CENTER, - spacing = 5 - ) - flexpanel.add(getDiv("1", 100)) - flexpanel.add(getDiv("2", 150)) - flexpanel.add(getDiv("3", 200)) - panel.add(flexpanel) - } - - private fun addFlexPanel2(panel: Container) { - val flexpanel = FlexPanel( - FLEXDIR.ROW, FLEXWRAP.WRAP, FLEXJUSTIFY.SPACEBETWEEN, FLEXALIGNITEMS.CENTER, - spacing = 5 - ) - flexpanel.add(getDiv("1", 100)) - flexpanel.add(getDiv("2", 150)) - flexpanel.add(getDiv("3", 200)) - panel.add(flexpanel) - } - - private fun addFlexPanel3(panel: Container) { - val flexpanel = FlexPanel( - FLEXDIR.ROW, FLEXWRAP.WRAP, FLEXJUSTIFY.CENTER, FLEXALIGNITEMS.CENTER, - spacing = 5 - ) - flexpanel.add(getDiv("1", 100)) - flexpanel.add(getDiv("2", 150)) - flexpanel.add(getDiv("3", 200)) - panel.add(flexpanel) - } - - private fun addFlexPanel4(panel: Container) { - val flexpanel = FlexPanel( - FLEXDIR.ROW, FLEXWRAP.WRAP, FLEXJUSTIFY.FLEXSTART, FLEXALIGNITEMS.CENTER, - spacing = 5 - ) - flexpanel.add(getDiv("1", 100), order = 3) - flexpanel.add(getDiv("2", 150), order = 1) - flexpanel.add(getDiv("3", 200), order = 2) - panel.add(flexpanel) - } - - private fun addFlexPanel5(panel: Container) { - val flexpanel = FlexPanel( - FLEXDIR.COLUMN, FLEXWRAP.WRAP, FLEXJUSTIFY.FLEXSTART, FLEXALIGNITEMS.FLEXEND, - spacing = 5 - ) - flexpanel.add(getDiv("1", 100), order = 3) - flexpanel.add(getDiv("2", 150), order = 1) - flexpanel.add(getDiv("3", 200), order = 2) - panel.add(flexpanel) - } - - private fun addGridPanel1(panel: Container) { - panel.add(Tag(TAG.H4, "CSS grid layouts")) - val gridpanel = GridPanel(columnGap = 5, rowGap = 5, justifyItems = GRIDJUSTIFY.CENTER) - gridpanel.background = Background(COLOR.KHAKI) - gridpanel.add(getDiv("1,1", 100), 1, 1) - gridpanel.add(getDiv("1,2", 100), 1, 2) - gridpanel.add(getDiv("2,1", 100), 2, 1) - gridpanel.add(getDiv("2,2", 100), 2, 2) - panel.add(gridpanel) - } - - private fun addGridPanel2(panel: Container) { - val gridpanel = GridPanel(columnGap = 5, rowGap = 5, justifyItems = GRIDJUSTIFY.CENTER) - gridpanel.background = Background(COLOR.CORNFLOWERBLUE) - gridpanel.add(getDiv("1,1", 150), 1, 1) - gridpanel.add(getDiv("2,2", 150), 2, 2) - gridpanel.add(getDiv("3,3", 150), 3, 3) - panel.add(gridpanel) - } - - private fun addRespGridPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Responsive grid layout")) - val gridpanel = ResponsiveGridPanel() - gridpanel.background = Background(COLOR.SILVER) - gridpanel.add(getDiv("1,1", 150), 1, 1) - gridpanel.add(getDiv("3,1", 150), 3, 1) - gridpanel.add(getDiv("2,2", 150), 2, 2) - gridpanel.add(getDiv("3,3", 150), 3, 3) - panel.add(gridpanel) - } - - private fun addDockPanel(panel: Container) { - panel.add(Tag(TAG.H4, "Dock layout")) - val dockpanel = DockPanel() - dockpanel.background = Background(COLOR.YELLOW) - dockpanel.add(getDiv("CENTER", 150), SIDE.CENTER) - dockpanel.add(getDiv("LEFT", 150), SIDE.LEFT) - dockpanel.add(getDiv("RIGHT", 150), SIDE.RIGHT) - dockpanel.add(getDiv("UP", 150).apply { marginBottom = 10.px() }, SIDE.UP) - dockpanel.add(getDiv("DOWN", 150).apply { marginTop = 10.px() }, SIDE.DOWN) - panel.add(dockpanel) - } - - - private fun getDiv(value: String, size: Int): Tag { - return Tag(TAG.DIV, value).apply { - paddingTop = ((size / 2) - 10).px() - align = ALIGN.CENTER - background = Background(COLOR.GREEN) - width = size.px() - height = size.px() - } - } -} diff --git a/examples/showcase/src/main/kotlin/com/example/Main.kt b/examples/showcase/src/main/kotlin/com/example/Main.kt deleted file mode 100644 index a3891526..00000000 --- a/examples/showcase/src/main/kotlin/com/example/Main.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.module -import kotlin.browser.document - -external fun require(name: String): String - -fun main(args: Array<String>) { - var application: ApplicationBase? = null - - val state: dynamic = module.hot?.let { hot -> - hot.accept() - - hot.dispose { data -> - data.appState = application?.dispose() - KVManager.shutdown() - application = null - } - - hot.data - } - - if (document.body != null) { - KVManager.start() - application = start(state) - } else { - KVManager.init() - application = null - document.addEventListener("DOMContentLoaded", { application = start(state) }) - } -} - -fun start(state: dynamic): ApplicationBase? { - if (document.getElementById("showcase") == null) return null - val application = Showcase() - @Suppress("UnsafeCastFromDynamic") - application.start(state?.appState ?: emptyMap()) - return application -} - diff --git a/examples/showcase/src/main/kotlin/com/example/ModalsTab.kt b/examples/showcase/src/main/kotlin/com/example/ModalsTab.kt deleted file mode 100644 index 46da97f7..00000000 --- a/examples/showcase/src/main/kotlin/com/example/ModalsTab.kt +++ /dev/null @@ -1,78 +0,0 @@ -package com.example - -import pl.treksoft.kvision.html.ALIGN -import pl.treksoft.kvision.html.BUTTONSTYLE -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.html.Image -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.modal.Alert -import pl.treksoft.kvision.modal.Confirm -import pl.treksoft.kvision.modal.Modal -import pl.treksoft.kvision.panel.SimplePanel -import pl.treksoft.kvision.panel.VPanel -import pl.treksoft.kvision.utils.px - -class ModalsTab : SimplePanel() { - init { - this.marginTop = 10.px() - this.minHeight = 400.px() - val panel = VPanel(spacing = 30) - val alertButton = Button("Alert dialog", style = BUTTONSTYLE.DANGER).onClick { - Alert.show( - "Alert dialog", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor." - ) - } - panel.add(alertButton) - val confirmButton = Button("Confirm dialog", style = BUTTONSTYLE.WARNING).onClick { - Confirm.show( - "Confirm dialog", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.", - noCallback = { - Alert.show("Result", "You pressed NO button.") - }) { - Alert.show("Result", "You pressed YES button.") - } - } - panel.add(confirmButton) - val confirmButtonC = Button("Cancelable confirm dialog", style = BUTTONSTYLE.INFO).onClick { - Confirm.show( - "Cancelable confirm dialog", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.", - align = ALIGN.CENTER, - cancelVisible = true, - noCallback = { - Alert.show("Result", "You pressed NO button.") - }) { - Alert.show("Result", "You pressed YES button.") - } - } - panel.add(confirmButtonC) - - val modal = Modal("Custom modal dialog") - modal.add( - Tag( - TAG.H4, - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor." - ) - ) - modal.add(Image(require("./img/dog.jpg"))) - modal.addButton(Button("Close").onClick { - modal.hide() - }) - val modalButton = Button("Custom modal dialog", style = BUTTONSTYLE.SUCCESS).onClick { - modal.show() - } - panel.add(modalButton) - val fastAlertButton = Button("Alert dialog without animation", style = BUTTONSTYLE.PRIMARY).onClick { - Alert.show( - "Alert dialog without animation", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec fringilla turpis, vel molestie dolor. Vestibulum ut ex eget orci porta gravida eu sit amet tortor.", - animation = false - ) - } - panel.add(fastAlertButton) - this.add(panel) - } -} diff --git a/examples/showcase/src/main/kotlin/com/example/Showcase.kt b/examples/showcase/src/main/kotlin/com/example/Showcase.kt deleted file mode 100644 index 58367600..00000000 --- a/examples/showcase/src/main/kotlin/com/example/Showcase.kt +++ /dev/null @@ -1,43 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.BORDERSTYLE -import pl.treksoft.kvision.core.Border -import pl.treksoft.kvision.core.COLOR -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.panel.TabPanel -import pl.treksoft.kvision.utils.auto -import pl.treksoft.kvision.utils.perc -import pl.treksoft.kvision.utils.px - -class Showcase : ApplicationBase() { - - override fun start(state: Map<String, Any>) { - val root = Root("showcase") - val tabPanel = TabPanel().apply { - width = 80.perc() - margin = 20.px() - marginLeft = auto() - marginRight = auto() - padding = 20.px() - border = Border(2.px(), BORDERSTYLE.SOLID, COLOR.SILVER) - } - tabPanel.addTab("Basic formatting", BasicTab(), "fa-bars", route = "/basic") - tabPanel.addTab("Forms", FormTab(), "fa-edit", route = "/forms") - tabPanel.addTab("Buttons", ButtonsTab(), "fa-check-square-o", route = "/buttons") - tabPanel.addTab("Dropdowns", DropDownTab(), "fa-arrow-down", route = "/dropdowns") - tabPanel.addTab("Containers", ContainersTab(), "fa-database", route = "/containers") - tabPanel.addTab("Layouts", LayoutsTab(), "fa-th-list", route = "/layouts") - tabPanel.addTab("Modals", ModalsTab(), "fa-window-maximize", route = "/modals") - tabPanel.addTab("Data binding", DataTab(), "fa-retweet", route = "/data") - root.add(tabPanel) - } - - override fun dispose(): Map<String, Any> { - return mapOf() - } - - companion object { - val css = require("./css/style.css") - } -} diff --git a/examples/showcase/src/main/resources/css/style.css b/examples/showcase/src/main/resources/css/style.css deleted file mode 100644 index e69de29b..00000000 --- a/examples/showcase/src/main/resources/css/style.css +++ /dev/null diff --git a/examples/showcase/src/main/resources/img/cat.jpg b/examples/showcase/src/main/resources/img/cat.jpg Binary files differdeleted file mode 100644 index 235fd677..00000000 --- a/examples/showcase/src/main/resources/img/cat.jpg +++ /dev/null diff --git a/examples/showcase/src/main/resources/img/dog.jpg b/examples/showcase/src/main/resources/img/dog.jpg Binary files differdeleted file mode 100644 index 9c33275b..00000000 --- a/examples/showcase/src/main/resources/img/dog.jpg +++ /dev/null diff --git a/examples/showcase/src/main/web/index.html b/examples/showcase/src/main/web/index.html deleted file mode 100644 index 4dfaccf4..00000000 --- a/examples/showcase/src/main/web/index.html +++ /dev/null @@ -1,19 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>KVision Showcase</title> - <script type="text/javascript" src="main.bundle.js"></script> - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> - <!--[if lt IE 9]> - <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> - <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> - <![endif]--> -</head> -<body> -<div id="showcase"></div> -</body> -</html> diff --git a/examples/showcase/src/test/kotlin/test/com/example/ShowcaseSpec.kt b/examples/showcase/src/test/kotlin/test/com/example/ShowcaseSpec.kt deleted file mode 100644 index 64d46b18..00000000 --- a/examples/showcase/src/test/kotlin/test/com/example/ShowcaseSpec.kt +++ /dev/null @@ -1,19 +0,0 @@ -package test.com.example - -import com.example.Showcase -import kotlin.browser.document -import kotlin.test.Test -import kotlin.test.assertTrue - -class ShowcaseSpec : DomSpec { - - @Test - fun render() { - run { - Showcase().start(mapOf()) - val element = document.getElementById("showcase") - assertTrue(true, "True" - ) - } - } -} diff --git a/examples/showcase/src/test/kotlin/test/com/example/TestUtil.kt b/examples/showcase/src/test/kotlin/test/com/example/TestUtil.kt deleted file mode 100644 index 06d25a26..00000000 --- a/examples/showcase/src/test/kotlin/test/com/example/TestUtil.kt +++ /dev/null @@ -1,32 +0,0 @@ -package test.com.example - -import pl.treksoft.jquery.jQuery -import kotlin.browser.document - -interface TestSpec { - fun beforeTest() - - fun afterTest() - - fun run(code: () -> Unit) { - beforeTest() - code() - afterTest() - } -} - -interface DomSpec : TestSpec { - - override fun beforeTest() { - val fixture = "<div style=\"display: none\" id=\"pretest\">" + - "<div id=\"showcase\"></div></div>" - document.body?.insertAdjacentHTML("afterbegin", fixture) - } - - override fun afterTest() { - val div = document.getElementById("pretest") - div?.remove() - jQuery(`object` = ".modal-backdrop").remove() - } - -} diff --git a/examples/showcase/webpack.config.d/bootstrap.js b/examples/showcase/webpack.config.d/bootstrap.js deleted file mode 100644 index 32a7c4d0..00000000 --- a/examples/showcase/webpack.config.d/bootstrap.js +++ /dev/null @@ -1,4 +0,0 @@ -config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'}); -config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'}); -config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'}); -config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'}); diff --git a/examples/showcase/webpack.config.d/css.js b/examples/showcase/webpack.config.d/css.js deleted file mode 100644 index 5d710d35..00000000 --- a/examples/showcase/webpack.config.d/css.js +++ /dev/null @@ -1,2 +0,0 @@ -config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); - diff --git a/examples/showcase/webpack.config.d/dce.js b/examples/showcase/webpack.config.d/dce.js deleted file mode 100644 index b536a6bf..00000000 --- a/examples/showcase/webpack.config.d/dce.js +++ /dev/null @@ -1,2 +0,0 @@ -var path = require("path"); -config.resolve.modules.unshift(path.resolve("./js/min")); diff --git a/examples/showcase/webpack.config.d/file.js b/examples/showcase/webpack.config.d/file.js deleted file mode 100644 index 8b853e7e..00000000 --- a/examples/showcase/webpack.config.d/file.js +++ /dev/null @@ -1,6 +0,0 @@ -config.module.rules.push( - { - test: /\.(jpe?g|png|gif|svg)$/i, - loader: 'file-loader' - } -);
\ No newline at end of file diff --git a/examples/showcase/webpack.config.d/jquery.js b/examples/showcase/webpack.config.d/jquery.js deleted file mode 100644 index 40522595..00000000 --- a/examples/showcase/webpack.config.d/jquery.js +++ /dev/null @@ -1,4 +0,0 @@ -config.plugins.push(new webpack.ProvidePlugin({ - $: "jquery", - jQuery: "jquery" -})); diff --git a/examples/showcase/webpack.config.d/minify.js b/examples/showcase/webpack.config.d/minify.js deleted file mode 100644 index 34e706c9..00000000 --- a/examples/showcase/webpack.config.d/minify.js +++ /dev/null @@ -1,4 +0,0 @@ -if (defined.PRODUCTION) { - config.plugins.push(new webpack.optimize.UglifyJsPlugin({ - })); -} diff --git a/examples/todomvc/.gitignore b/examples/todomvc/.gitignore deleted file mode 100644 index 631a8b87..00000000 --- a/examples/todomvc/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.*/ -build/ -out/ -*.iml -/refresh.sh diff --git a/examples/todomvc/build.gradle b/examples/todomvc/build.gradle deleted file mode 100644 index f8e959d3..00000000 --- a/examples/todomvc/build.gradle +++ /dev/null @@ -1,100 +0,0 @@ -buildscript { - ext.kotlin_version = '1.2.21' - ext.serialization_version = '0.4' - ext.production = (findProperty('prod') ?: 'false') == 'true' - ext.npmdeps = new URL("file:///home/rjaros/git/kvision/npm.dependencies").getText() - - repositories { - jcenter() - maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } - maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://kotlin.bintray.com/kotlinx" } - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.26" - classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-2" - classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$serialization_version" - } -} - -apply plugin: 'kotlin2js' -apply plugin: 'kotlinx-serialization' -apply plugin: 'org.jetbrains.kotlin.frontend' -apply plugin: "io.gitlab.arturbosch.detekt" - -repositories { - jcenter() - maven { url 'https://kotlin.bintray.com/kotlinx' } - maven { url 'https://dl.bintray.com/gbaldeck/kotlin' } - maven { url 'https://dl.bintray.com/rjaros/kotlin' } - maven { - url "file:///home/rjaros/kotlin/mvn/" - } -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" - compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version" - compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported - compile "pl.treksoft:kvision:0.0.1" -} - -kotlinFrontend { - npm { - npmdeps.eachLine { line -> - def (name, version) = line.tokenize(" ") - dependency(name, version) - } - dependency("todomvc-app-css", "^2.0.0") - dependency("todomvc-common", "^1.0.0") - devDependency("karma") - } - - webpackBundle { - bundleName = "main" - contentPath = file('src/main/web') - } - - define "PRODUCTION", production - -} - -detekt { - version = "1.0.0.RC6-2" - profile("main") { - input = "$projectDir/src/main/kotlin" - config = "$projectDir/detekt.yml" - filters = ".*test.*,.*/resources/.*,.*/tmp/.*" - } -} - -compileKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -compileTestKotlin2Js { - kotlinOptions.metaInfo = true - kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" - kotlinOptions.sourceMap = !production - kotlinOptions.moduleKind = 'commonjs' -} - -task copyResources(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js") -} - -task copyResourcesForTests(type: Copy) { - from "src/main/resources" - into file(buildDir.path + "/js-tests/") -} - -afterEvaluate { - tasks.getByName("webpack-bundle") { dependsOn(copyResources) } - tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } -} diff --git a/examples/todomvc/detekt.yml b/examples/todomvc/detekt.yml deleted file mode 100644 index a6fdea75..00000000 --- a/examples/todomvc/detekt.yml +++ /dev/null @@ -1,292 +0,0 @@ -autoCorrect: true -failFast: false - -build: - warningThreshold: 5 - failThreshold: 10 - weights: - complexity: 2 - formatting: 1 - LongParameterList: 1 - comments: 1 - -processors: - active: true - exclude: - # - 'FunctionCountProcessor' - # - 'PropertyCountProcessor' - # - 'ClassCountProcessor' - # - 'PackageCountProcessor' - # - 'KtFileCountProcessor' - -console-reports: - active: true - exclude: - # - 'ProjectStatisticsReport' - # - 'ComplexityReport' - # - 'NotificationReport' - # - 'FindingsReport' - # - 'BuildFailureReport' - -output-reports: - active: true - exclude: - # - 'PlainOutputReport' - # - 'XmlOutputReport' - -potential-bugs: - active: true - DuplicateCaseInWhenExpression: - active: true - EqualsAlwaysReturnsTrueOrFalse: - active: false - EqualsWithHashCodeExist: - active: true - WrongEqualsTypeParameter: - active: false - ExplicitGarbageCollectionCall: - active: true - UnreachableCode: - active: true - LateinitUsage: - active: false - UnsafeCallOnNullableType: - active: false - UnsafeCast: - active: false - UselessPostfixExpression: - active: false - -performance: - active: true - ForEachOnRange: - active: true - SpreadOperator: - active: true - UnnecessaryTemporaryInstantiation: - active: true - -exceptions: - active: true - TooGenericExceptionCatched: - active: true - exceptions: - - ArrayIndexOutOfBoundsException - - Error - - Exception - - IllegalMonitorStateException - - IndexOutOfBoundsException - - NullPointerException - - RuntimeException - TooGenericExceptionThrown: - active: true - exceptions: - - Throwable - - ThrowError - - ThrowException - - ThrowNullPointerException - - ThrowRuntimeException - - ThrowThrowable - -empty-blocks: - active: true - EmptyCatchBlock: - active: true - EmptyClassBlock: - active: true - EmptyDefaultConstructor: - active: true - EmptyDoWhileBlock: - active: true - EmptyElseBlock: - active: true - EmptyFinallyBlock: - active: true - EmptyForBlock: - active: true - EmptyFunctionBlock: - active: true - EmptyIfBlock: - active: true - EmptyInitBlock: - active: true - EmptySecondaryConstructor: - active: true - EmptyWhenBlock: - active: true - EmptyWhileBlock: - active: true - -complexity: - active: true - LongMethod: - threshold: 20 - LongParameterList: - threshold: 5 - LargeClass: - threshold: 150 - ComplexMethod: - threshold: 10 - TooManyFunctions: - threshold: 10 - ComplexCondition: - threshold: 3 - LabeledExpression: - active: false - StringLiteralDuplication: - active: false - threshold: 2 - ignoreAnnotation: true - excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' - -code-smell: - active: true - FeatureEnvy: - threshold: 0.5 - weight: 0.45 - base: 0.5 - -formatting: - active: true - useTabs: true - Indentation: - active: false - indentSize: 4 - ConsecutiveBlankLines: - active: true - autoCorrect: true - MultipleSpaces: - active: true - autoCorrect: true - SpacingAfterComma: - active: true - autoCorrect: true - SpacingAfterKeyword: - active: true - autoCorrect: true - SpacingAroundColon: - active: true - autoCorrect: true - SpacingAroundCurlyBraces: - active: true - autoCorrect: true - SpacingAroundOperator: - active: true - autoCorrect: true - TrailingSpaces: - active: true - autoCorrect: true - UnusedImports: - active: true - autoCorrect: true - OptionalSemicolon: - active: true - autoCorrect: true - OptionalUnit: - active: true - autoCorrect: true - ExpressionBodySyntax: - active: false - autoCorrect: false - ExpressionBodySyntaxLineBreaks: - active: false - autoCorrect: false - OptionalReturnKeyword: - active: true - autoCorrect: false - -style: - active: true - ReturnCount: - active: true - max: 2 - NewLineAtEndOfFile: - active: true - OptionalAbstractKeyword: - active: true - OptionalWhenBraces: - active: false - EqualsNullCall: - active: false - ForbiddenComment: - active: true - values: 'TODO:,FIXME:,STOPSHIP:' - ForbiddenImport: - active: false - imports: '' - ModifierOrder: - active: true - MagicNumber: - active: true - ignoreNumbers: '-1,0,1,2' - ignoreHashCodeFunction: false - ignorePropertyDeclaration: false - ignoreAnnotation: false - WildcardImport: - active: true - SafeCast: - active: true - MaxLineLength: - active: true - maxLineLength: 120 - excludePackageStatements: false - excludeImportStatements: false - PackageNaming: - active: true - packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' - ClassNaming: - active: true - classPattern: '[A-Z$][a-zA-Z$]*' - EnumNaming: - active: true - enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$' - FunctionNaming : - active: true - functionPattern: '^[a-z$][a-zA-Z$0-9]*$' - FunctionMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionMinLength: - active: false - minimumFunctionNameLength: 3 - VariableNaming : - active: true - variablePattern: '^(_)?[a-z$][a-zA-Z$0-9]*$' - ConstantNaming : - active: true - constantPattern: '^([A-Z_]*|serialVersionUID)$' - VariableMaxLength: - active: false - maximumVariableNameLength: 30 - VariableMinLength: - active: false - minimumVariableNameLength: 3 - ProtectedMemberInFinalClass: - active: false - UnnecessaryParentheses: - active: false - -comments: - active: true - CommentOverPrivateMethod: - active: true - CommentOverPrivateProperty: - active: true - UndocumentedPublicClass: - active: false - searchInNestedClass: true - searchInInnerClass: true - searchInInnerObject: true - searchInInnerInterface: true - UndocumentedPublicFunction: - active: false - -# *experimental feature* -# Migration rules can be defined in the same config file or a new one -migration: - active: true - imports: - # your.package.Class: new.package.or.Class - # for example: - # io.gitlab.arturbosch.detekt.api.Rule: io.gitlab.arturbosch.detekt.rule.Rule diff --git a/examples/todomvc/gradle.properties b/examples/todomvc/gradle.properties deleted file mode 100644 index 4ac81290..00000000 --- a/examples/todomvc/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -#org.gradle.jvmargs=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder -#org.gradle.debug=true diff --git a/examples/todomvc/gradle/wrapper/gradle-wrapper.jar b/examples/todomvc/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 09f1fecb..00000000 --- a/examples/todomvc/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/examples/todomvc/gradle/wrapper/gradle-wrapper.properties b/examples/todomvc/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 6798e758..00000000 --- a/examples/todomvc/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Jan 31 23:15:29 CET 2018 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip diff --git a/examples/todomvc/gradlew b/examples/todomvc/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/examples/todomvc/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## 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="" - -# 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, switch paths to Windows format before running java -if $cygwin ; 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=$((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" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - -exec "$JAVACMD" "$@" diff --git a/examples/todomvc/gradlew.bat b/examples/todomvc/gradlew.bat deleted file mode 100644 index f9553162..00000000 --- a/examples/todomvc/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@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 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= - -@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 init - -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 init - -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 - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -: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 %CMD_LINE_ARGS% - -: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/todomvc/package.json.d/project.info b/examples/todomvc/package.json.d/project.info deleted file mode 100644 index 3c4d58fe..00000000 --- a/examples/todomvc/package.json.d/project.info +++ /dev/null @@ -1,3 +0,0 @@ -{ - "description": "KVision TodoMVC" -} diff --git a/examples/todomvc/settings.gradle b/examples/todomvc/settings.gradle deleted file mode 100644 index 00861ee1..00000000 --- a/examples/todomvc/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'todomvc' diff --git a/examples/todomvc/src/main/kotlin/com/example/Main.kt b/examples/todomvc/src/main/kotlin/com/example/Main.kt deleted file mode 100644 index d8894a4c..00000000 --- a/examples/todomvc/src/main/kotlin/com/example/Main.kt +++ /dev/null @@ -1,40 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.module -import kotlin.browser.document - -fun main(args: Array<String>) { - var application: ApplicationBase? = null - - val state: dynamic = module.hot?.let { hot -> - hot.accept() - - hot.dispose { data -> - data.appState = application?.dispose() - KVManager.shutdown() - application = null - } - - hot.data - } - - if (document.body != null) { - KVManager.start() - application = start(state) - } else { - KVManager.init() - application = null - document.addEventListener("DOMContentLoaded", { application = start(state) }) - } -} - -fun start(state: dynamic): ApplicationBase? { - if (document.getElementById("todomvc") == null) return null - val application = Todomvc() - @Suppress("UnsafeCastFromDynamic") - application.start(state?.appState ?: emptyMap()) - return application -} - diff --git a/examples/todomvc/src/main/kotlin/com/example/Todomvc.kt b/examples/todomvc/src/main/kotlin/com/example/Todomvc.kt deleted file mode 100644 index bbed337f..00000000 --- a/examples/todomvc/src/main/kotlin/com/example/Todomvc.kt +++ /dev/null @@ -1,245 +0,0 @@ -package com.example - -import com.lightningkite.kotlin.observable.list.observableListOf -import kotlinx.serialization.Serializable -import kotlinx.serialization.json.JSON -import kotlinx.serialization.list -import org.w3c.dom.get -import org.w3c.dom.set -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.data.BaseDataComponent -import pl.treksoft.kvision.data.DataContainer -import pl.treksoft.kvision.form.FieldLabel -import pl.treksoft.kvision.form.check.CHECKINPUTTYPE -import pl.treksoft.kvision.form.check.CheckInput -import pl.treksoft.kvision.form.text.TextInput -import pl.treksoft.kvision.html.Button -import pl.treksoft.kvision.html.LIST -import pl.treksoft.kvision.html.Link -import pl.treksoft.kvision.html.ListTag -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.routing.routing -import kotlin.browser.localStorage - -const val ENTER_KEY = 13 -const val ESCAPE_KEY = 27 - -@Serializable -open class BaseTodo(open var completed: Boolean, open var title: String) : BaseDataComponent() - -class Todo(completed: Boolean, title: String, hidden: Boolean) : BaseTodo(completed, title) { - constructor(base: BaseTodo) : this(base.completed, base.title, false) - - override var completed: Boolean by obs(completed) - override var title: String by obs(title) - var hidden: Boolean by obs(hidden) -} - -enum class TODOMODE { - ALL, - ACTIVE, - COMPLETED -} - -class Todomvc : ApplicationBase() { - - private val model = observableListOf<Todo>() - - private val checkAllInput = CheckInput(classes = setOf("toggle-all")).apply { - id = "toggle-all" - onClick { - val value = this.value - model.forEach { it.completed = value } - } - } - private val allLink = Link("All", "#!/", classes = setOf("selected")) - private val activeLink = Link("Active", "#!/active") - private val completedLink = Link("Completed", "#!/completed") - private val clearCompletedButton = Button("Clear completed", classes = setOf("clear-completed")).onClick { - model.filter { it.completed }.forEach { model.remove(it) } - } - - private val countTag = Tag(TAG.STRONG, "0") - private val itemsLeftTag = Tag(TAG.SPAN, " items left", classes = setOf("todo-count")).apply { - add(countTag) - } - private var mode: TODOMODE = TODOMODE.ALL - - private val header = genHeader() - private val main = genMain() - private val footer = genFooter() - - override fun start(state: Map<String, Any>) { - val root = Root("todomvc") - val section = Tag(TAG.SECTION, classes = setOf("todoapp")) - section.add(this.header) - section.add(this.main) - section.add(this.footer) - root.add(section) - loadModel() - checkModel() - routing.on("/", { _ -> all() }) - .on("/active", { _ -> active() }) - .on("/completed", { _ -> completed() }) - .resolve() - } - - private fun loadModel() { - localStorage.get("todos-kvision")?.let { - JSON.parse(BaseTodo.serializer().list, it).map { model.add(Todo(it)) } - } - } - - private fun saveModel() { - val jsonString = JSON.indented.stringify(BaseTodo.serializer().list, model.toList()) - localStorage.set("todos-kvision", jsonString) - } - - private fun checkModel() { - val countActive = model.filter { !it.completed }.size - val countCompleted = model.filter { it.completed }.size - this.main.visible = model.isNotEmpty() - this.footer.visible = model.isNotEmpty() - this.countTag.text = countActive.toString() - this.itemsLeftTag.text = when (countActive) { - 1 -> " item left" - else -> " items left" - } - this.checkAllInput.value = (countActive == 0) - this.clearCompletedButton.visible = countCompleted > 0 - saveModel() - } - - private fun all() { - this.mode = TODOMODE.ALL - this.allLink.addCssClass("selected") - this.activeLink.removeCssClass("selected") - this.completedLink.removeCssClass("selected") - this.model.forEach { it.hidden = false } - } - - private fun active() { - this.mode = TODOMODE.ACTIVE - this.allLink.removeCssClass("selected") - this.activeLink.addCssClass("selected") - this.completedLink.removeCssClass("selected") - this.model.forEach { it.hidden = it.completed } - } - - private fun completed() { - this.mode = TODOMODE.COMPLETED - this.allLink.removeCssClass("selected") - this.activeLink.removeCssClass("selected") - this.completedLink.addCssClass("selected") - this.model.forEach { it.hidden = !it.completed } - } - - private fun genHeader(): Tag { - return Tag(TAG.HEADER, classes = setOf("header")).apply { - add(Tag(TAG.H1, "todos")) - add(TextInput(classes = setOf("new-todo")).apply { - placeholder = "What needs to be done?" - autofocus = true - setEventListener<TextInput> { - keydown = { e -> - if (e.keyCode == ENTER_KEY) { - addTodo(self.value) - self.value = null - } - } - } - }) - } - } - - private fun addTodo(value: String?) { - val v = value?.trim() ?: "" - if (v.isNotEmpty()) { - model.add(Todo(false, v, mode == TODOMODE.COMPLETED)) - } - } - - private fun editTodo(index: Int, value: String?) { - val v = value?.trim() ?: "" - if (v.isNotEmpty()) { - model[index].title = v - } else { - model.removeAt(index) - } - } - - private fun genMain(): Tag { - return Tag(TAG.SECTION, classes = setOf("main")).apply { - add(checkAllInput) - add(FieldLabel("toggle-all", "Mark all as complete")) - add(DataContainer(model, { index -> - val li = Tag(TAG.LI) - li.apply { - if (model[index].completed) addCssClass("completed") - if (model[index].hidden) addCssClass("hidden") - val edit = TextInput(classes = setOf("edit")) - val view = Tag(TAG.DIV, classes = setOf("view")).apply { - add(CheckInput( - CHECKINPUTTYPE.CHECKBOX, model[index].completed, classes = setOf("toggle") - ).onClick { - model[index].completed = this.value - model[index].hidden = - mode == TODOMODE.ACTIVE && this.value || mode == TODOMODE.COMPLETED && !this.value - }) - add(Tag(TAG.LABEL, model[index].title).apply { - setEventListener<Tag> { - dblclick = { - li.getElementJQuery()?.addClass("editing") - edit.value = model[index].title - edit.getElementJQuery()?.focus() - } - } - }) - add(Button("", classes = setOf("destroy")).onClick { - model.removeAt(index) - }) - } - edit.setEventListener<TextInput> { - blur = { - if (li.getElementJQuery()?.hasClass("editing") == true) { - li.getElementJQuery()?.removeClass("editing") - editTodo(index, self.value) - } - } - keydown = { e -> - if (e.keyCode == ENTER_KEY) { - li.getElementJQuery()?.removeClass("editing") - editTodo(index, self.value) - } - if (e.keyCode == ESCAPE_KEY) { - li.getElementJQuery()?.removeClass("editing") - } - } - } - add(view) - add(edit) - } - }, Tag(TAG.UL, classes = setOf("todo-list"))).onUpdate { - checkModel() - }) - } - } - - private fun genFooter(): Tag { - return Tag(TAG.FOOTER, classes = setOf("footer")).apply { - add(itemsLeftTag) - add(ListTag(LIST.UL, classes = setOf("filters")).apply { - add(allLink) - add(activeLink) - add(completedLink) - }) - add(clearCompletedButton) - } - } - - override fun dispose(): Map<String, Any> { - return mapOf() - } -} diff --git a/examples/todomvc/src/main/web/index.html b/examples/todomvc/src/main/web/index.html deleted file mode 100644 index e5ba8812..00000000 --- a/examples/todomvc/src/main/web/index.html +++ /dev/null @@ -1,22 +0,0 @@ -<!doctype html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>KVision • TodoMVC</title> - <link rel="stylesheet" href="node_modules/todomvc-common/base.css"> - <link rel="stylesheet" href="node_modules/todomvc-app-css/index.css"> -</head> -<body> -<div id="todomvc"></div> -<footer class="info"> - <p>Double-click to edit a todo</p> - <p>Created by <a href="https://github.com/rjaros">Robert Jaros</a></p> - <p>Part of <a href="http://todomvc.com">TodoMVC</a></p> -</footer> -<!-- Scripts here. Don't remove ↓ --> -<script src="node_modules/todomvc-common/base.js"></script> -<script>var KV_NO_BOOTSTRAP_CSS = true;</script> -<script src="main.bundle.js"></script> -</body> -</html> diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/index.css b/examples/todomvc/src/main/web/node_modules/todomvc-app-css/index.css deleted file mode 100644 index d8be205a..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/index.css +++ /dev/null @@ -1,376 +0,0 @@ -html, -body { - margin: 0; - padding: 0; -} - -button { - margin: 0; - padding: 0; - border: 0; - background: none; - font-size: 100%; - vertical-align: baseline; - font-family: inherit; - font-weight: inherit; - color: inherit; - -webkit-appearance: none; - appearance: none; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -body { - font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; - line-height: 1.4em; - background: #f5f5f5; - color: #4d4d4d; - min-width: 230px; - max-width: 550px; - margin: 0 auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - font-weight: 300; -} - -:focus { - outline: 0; -} - -.hidden { - display: none; -} - -.todoapp { - background: #fff; - margin: 130px 0 40px 0; - position: relative; - box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), - 0 25px 50px 0 rgba(0, 0, 0, 0.1); -} - -.todoapp input::-webkit-input-placeholder { - font-style: italic; - font-weight: 300; - color: #e6e6e6; -} - -.todoapp input::-moz-placeholder { - font-style: italic; - font-weight: 300; - color: #e6e6e6; -} - -.todoapp input::input-placeholder { - font-style: italic; - font-weight: 300; - color: #e6e6e6; -} - -.todoapp h1 { - position: absolute; - top: -155px; - width: 100%; - font-size: 100px; - font-weight: 100; - text-align: center; - color: rgba(175, 47, 47, 0.15); - -webkit-text-rendering: optimizeLegibility; - -moz-text-rendering: optimizeLegibility; - text-rendering: optimizeLegibility; -} - -.new-todo, -.edit { - position: relative; - margin: 0; - width: 100%; - font-size: 24px; - font-family: inherit; - font-weight: inherit; - line-height: 1.4em; - border: 0; - color: inherit; - padding: 6px; - border: 1px solid #999; - box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); - box-sizing: border-box; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -.new-todo { - padding: 16px 16px 16px 60px; - border: none; - background: rgba(0, 0, 0, 0.003); - box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03); -} - -.main { - position: relative; - z-index: 2; - border-top: 1px solid #e6e6e6; -} - -.toggle-all { - text-align: center; - border: none; /* Mobile Safari */ - opacity: 0; - position: absolute; -} - -.toggle-all + label { - width: 60px; - height: 34px; - font-size: 0; - position: absolute; - top: -52px; - left: -13px; - -webkit-transform: rotate(90deg); - transform: rotate(90deg); -} - -.toggle-all + label:before { - content: '❯'; - font-size: 22px; - color: #e6e6e6; - padding: 10px 27px 10px 27px; -} - -.toggle-all:checked + label:before { - color: #737373; -} - -.todo-list { - margin: 0; - padding: 0; - list-style: none; -} - -.todo-list li { - position: relative; - font-size: 24px; - border-bottom: 1px solid #ededed; -} - -.todo-list li:last-child { - border-bottom: none; -} - -.todo-list li.editing { - border-bottom: none; - padding: 0; -} - -.todo-list li.editing .edit { - display: block; - width: 506px; - padding: 12px 16px; - margin: 0 0 0 43px; -} - -.todo-list li.editing .view { - display: none; -} - -.todo-list li .toggle { - text-align: center; - width: 40px; - /* auto, since non-WebKit browsers doesn't support input styling */ - height: auto; - position: absolute; - top: 0; - bottom: 0; - margin: auto 0; - border: none; /* Mobile Safari */ - -webkit-appearance: none; - appearance: none; -} - -.todo-list li .toggle { - opacity: 0; -} - -.todo-list li .toggle + label { - /* - Firefox requires `#` to be escaped - https://bugzilla.mozilla.org/show_bug.cgi?id=922433 - IE and Edge requires *everything* to be escaped to render, so we do that instead of just the `#` - https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/7157459/ - */ - background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23ededed%22%20stroke-width%3D%223%22/%3E%3C/svg%3E'); - background-repeat: no-repeat; - background-position: center left; -} - -.todo-list li .toggle:checked + label { - background-image: url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23bddad5%22%20stroke-width%3D%223%22/%3E%3Cpath%20fill%3D%22%235dc2af%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22/%3E%3C/svg%3E'); -} - -.todo-list li label { - word-break: break-all; - padding: 15px 15px 15px 60px; - display: block; - line-height: 1.2; - transition: color 0.4s; -} - -.todo-list li.completed label { - color: #d9d9d9; - text-decoration: line-through; -} - -.todo-list li .destroy { - display: none; - position: absolute; - top: 0; - right: 10px; - bottom: 0; - width: 40px; - height: 40px; - margin: auto 0; - font-size: 30px; - color: #cc9a9a; - margin-bottom: 11px; - transition: color 0.2s ease-out; -} - -.todo-list li .destroy:hover { - color: #af5b5e; -} - -.todo-list li .destroy:after { - content: '×'; -} - -.todo-list li:hover .destroy { - display: block; -} - -.todo-list li .edit { - display: none; -} - -.todo-list li.editing:last-child { - margin-bottom: -1px; -} - -.footer { - color: #777; - padding: 10px 15px; - height: 20px; - text-align: center; - border-top: 1px solid #e6e6e6; -} - -.footer:before { - content: ''; - position: absolute; - right: 0; - bottom: 0; - left: 0; - height: 50px; - overflow: hidden; - box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), - 0 8px 0 -3px #f6f6f6, - 0 9px 1px -3px rgba(0, 0, 0, 0.2), - 0 16px 0 -6px #f6f6f6, - 0 17px 2px -6px rgba(0, 0, 0, 0.2); -} - -.todo-count { - float: left; - text-align: left; -} - -.todo-count strong { - font-weight: 300; -} - -.filters { - margin: 0; - padding: 0; - list-style: none; - position: absolute; - right: 0; - left: 0; -} - -.filters li { - display: inline; -} - -.filters li a { - color: inherit; - margin: 3px; - padding: 3px 7px; - text-decoration: none; - border: 1px solid transparent; - border-radius: 3px; -} - -.filters li a:hover { - border-color: rgba(175, 47, 47, 0.1); -} - -.filters li a.selected { - border-color: rgba(175, 47, 47, 0.2); -} - -.clear-completed, -html .clear-completed:active { - float: right; - position: relative; - line-height: 20px; - text-decoration: none; - cursor: pointer; -} - -.clear-completed:hover { - text-decoration: underline; -} - -.info { - margin: 65px auto 0; - color: #bfbfbf; - font-size: 10px; - text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); - text-align: center; -} - -.info p { - line-height: 1; -} - -.info a { - color: inherit; - text-decoration: none; - font-weight: 400; -} - -.info a:hover { - text-decoration: underline; -} - -/* - Hack to remove background from Mobile Safari. - Can't use it globally since it destroys checkboxes in Firefox -*/ -@media screen and (-webkit-min-device-pixel-ratio:0) { - .toggle-all, - .todo-list li .toggle { - background: none; - } - - .todo-list li .toggle { - height: 40px; - } -} - -@media (max-width: 430px) { - .footer { - height: 50px; - } - - .filters { - bottom: 10px; - } -} diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/package.json b/examples/todomvc/src/main/web/node_modules/todomvc-app-css/package.json deleted file mode 100644 index da589f16..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "_args": [ - [ - "todomvc-app-css@2.1.0", - "/home/rjaros/git/kvision/examples/todomvc/src/main/web" - ] - ], - "_from": "todomvc-app-css@2.1.0", - "_id": "todomvc-app-css@2.1.0", - "_inBundle": false, - "_integrity": "sha1-tvJxbTOa+i5feZNH0qSLBTliQqU=", - "_location": "/todomvc-app-css", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "todomvc-app-css@2.1.0", - "name": "todomvc-app-css", - "escapedName": "todomvc-app-css", - "rawSpec": "2.1.0", - "saveSpec": null, - "fetchSpec": "2.1.0" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/todomvc-app-css/-/todomvc-app-css-2.1.0.tgz", - "_spec": "2.1.0", - "_where": "/home/rjaros/git/kvision/examples/todomvc/src/main/web", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "bugs": { - "url": "https://github.com/tastejs/todomvc-app-css/issues" - }, - "description": "CSS for TodoMVC apps", - "files": [ - "index.css" - ], - "homepage": "https://github.com/tastejs/todomvc-app-css#readme", - "keywords": [ - "todomvc", - "tastejs", - "app", - "todo", - "template", - "css", - "style", - "stylesheet" - ], - "license": "CC-BY-4.0", - "name": "todomvc-app-css", - "repository": { - "type": "git", - "url": "git+https://github.com/tastejs/todomvc-app-css.git" - }, - "style": "index.css", - "version": "2.1.0" -} diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/readme.md b/examples/todomvc/src/main/web/node_modules/todomvc-app-css/readme.md deleted file mode 100644 index 6ddbebf0..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-app-css/readme.md +++ /dev/null @@ -1,28 +0,0 @@ -# todomvc-app-css - -> CSS for TodoMVC apps - -![](screenshot.png) - - -## Install - - -``` -$ npm install --save todomvc-app-css -``` - - -## Getting started - -```html -<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css"> -``` - -See the [TodoMVC app template](https://github.com/tastejs/todomvc-app-template). - - - -## License - -<a rel="license" href="http://creativecommons.org/licenses/by/4.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/4.0/80x15.png" /></a><br />This <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" rel="dct:type">work</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://sindresorhus.com" property="cc:attributionName" rel="cc:attributionURL">Sindre Sorhus</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/deed.en_US">Creative Commons Attribution 4.0 International License</a>. diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-common/base.css b/examples/todomvc/src/main/web/node_modules/todomvc-common/base.css deleted file mode 100644 index da65968a..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-common/base.css +++ /dev/null @@ -1,141 +0,0 @@ -hr { - margin: 20px 0; - border: 0; - border-top: 1px dashed #c5c5c5; - border-bottom: 1px dashed #f7f7f7; -} - -.learn a { - font-weight: normal; - text-decoration: none; - color: #b83f45; -} - -.learn a:hover { - text-decoration: underline; - color: #787e7e; -} - -.learn h3, -.learn h4, -.learn h5 { - margin: 10px 0; - font-weight: 500; - line-height: 1.2; - color: #000; -} - -.learn h3 { - font-size: 24px; -} - -.learn h4 { - font-size: 18px; -} - -.learn h5 { - margin-bottom: 0; - font-size: 14px; -} - -.learn ul { - padding: 0; - margin: 0 0 30px 25px; -} - -.learn li { - line-height: 20px; -} - -.learn p { - font-size: 15px; - font-weight: 300; - line-height: 1.3; - margin-top: 0; - margin-bottom: 0; -} - -#issue-count { - display: none; -} - -.quote { - border: none; - margin: 20px 0 60px 0; -} - -.quote p { - font-style: italic; -} - -.quote p:before { - content: '“'; - font-size: 50px; - opacity: .15; - position: absolute; - top: -20px; - left: 3px; -} - -.quote p:after { - content: '”'; - font-size: 50px; - opacity: .15; - position: absolute; - bottom: -42px; - right: 3px; -} - -.quote footer { - position: absolute; - bottom: -40px; - right: 0; -} - -.quote footer img { - border-radius: 3px; -} - -.quote footer a { - margin-left: 5px; - vertical-align: middle; -} - -.speech-bubble { - position: relative; - padding: 10px; - background: rgba(0, 0, 0, .04); - border-radius: 5px; -} - -.speech-bubble:after { - content: ''; - position: absolute; - top: 100%; - right: 30px; - border: 13px solid transparent; - border-top-color: rgba(0, 0, 0, .04); -} - -.learn-bar > .learn { - position: absolute; - width: 272px; - top: 8px; - left: -300px; - padding: 10px; - border-radius: 5px; - background-color: rgba(255, 255, 255, .6); - transition-property: left; - transition-duration: 500ms; -} - -@media (min-width: 899px) { - .learn-bar { - width: auto; - padding-left: 300px; - } - - .learn-bar > .learn { - left: 8px; - } -} diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-common/base.js b/examples/todomvc/src/main/web/node_modules/todomvc-common/base.js deleted file mode 100644 index a56b5aac..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-common/base.js +++ /dev/null @@ -1,249 +0,0 @@ -/* global _ */ -(function () { - 'use strict'; - - /* jshint ignore:start */ - // Underscore's Template Module - // Courtesy of underscorejs.org - var _ = (function (_) { - _.defaults = function (object) { - if (!object) { - return object; - } - for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) { - var iterable = arguments[argsIndex]; - if (iterable) { - for (var key in iterable) { - if (object[key] == null) { - object[key] = iterable[key]; - } - } - } - } - return object; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - _.template = function(text, data, settings) { - var render; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = new RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset) - .replace(escaper, function(match) { return '\\' + escapes[match]; }); - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } - if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } - if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - index = offset + match.length; - return match; - }); - source += "';\n"; - - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; - - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + "return __p;\n"; - - try { - render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; - } - - if (data) return render(data, _); - var template = function(data) { - return render.call(this, data, _); - }; - - // Provide the compiled function source as a convenience for precompilation. - template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; - - return template; - }; - - return _; - })({}); - - if (location.hostname === 'todomvc.com') { - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-31081062-1', 'auto'); - ga('send', 'pageview'); - } - /* jshint ignore:end */ - - function redirect() { - if (location.hostname === 'tastejs.github.io') { - location.href = location.href.replace('tastejs.github.io/todomvc', 'todomvc.com'); - } - } - - function findRoot() { - var base = location.href.indexOf('examples/'); - return location.href.substr(0, base); - } - - function getFile(file, callback) { - if (!location.host) { - return console.info('Miss the info bar? Run TodoMVC from a server to avoid a cross-origin error.'); - } - - var xhr = new XMLHttpRequest(); - - xhr.open('GET', findRoot() + file, true); - xhr.send(); - - xhr.onload = function () { - if (xhr.status === 200 && callback) { - callback(xhr.responseText); - } - }; - } - - function Learn(learnJSON, config) { - if (!(this instanceof Learn)) { - return new Learn(learnJSON, config); - } - - var template, framework; - - if (typeof learnJSON !== 'object') { - try { - learnJSON = JSON.parse(learnJSON); - } catch (e) { - return; - } - } - - if (config) { - template = config.template; - framework = config.framework; - } - - if (!template && learnJSON.templates) { - template = learnJSON.templates.todomvc; - } - - if (!framework && document.querySelector('[data-framework]')) { - framework = document.querySelector('[data-framework]').dataset.framework; - } - - this.template = template; - - if (learnJSON.backend) { - this.frameworkJSON = learnJSON.backend; - this.frameworkJSON.issueLabel = framework; - this.append({ - backend: true - }); - } else if (learnJSON[framework]) { - this.frameworkJSON = learnJSON[framework]; - this.frameworkJSON.issueLabel = framework; - this.append(); - } - - this.fetchIssueCount(); - } - - Learn.prototype.append = function (opts) { - var aside = document.createElement('aside'); - aside.innerHTML = _.template(this.template, this.frameworkJSON); - aside.className = 'learn'; - - if (opts && opts.backend) { - // Remove demo link - var sourceLinks = aside.querySelector('.source-links'); - var heading = sourceLinks.firstElementChild; - var sourceLink = sourceLinks.lastElementChild; - // Correct link path - var href = sourceLink.getAttribute('href'); - sourceLink.setAttribute('href', href.substr(href.lastIndexOf('http'))); - sourceLinks.innerHTML = heading.outerHTML + sourceLink.outerHTML; - } else { - // Localize demo links - var demoLinks = aside.querySelectorAll('.demo-link'); - Array.prototype.forEach.call(demoLinks, function (demoLink) { - if (demoLink.getAttribute('href').substr(0, 4) !== 'http') { - demoLink.setAttribute('href', findRoot() + demoLink.getAttribute('href')); - } - }); - } - - document.body.className = (document.body.className + ' learn-bar').trim(); - document.body.insertAdjacentHTML('afterBegin', aside.outerHTML); - }; - - Learn.prototype.fetchIssueCount = function () { - var issueLink = document.getElementById('issue-count-link'); - if (issueLink) { - var url = issueLink.href.replace('https://github.com', 'https://api.github.com/repos'); - var xhr = new XMLHttpRequest(); - xhr.open('GET', url, true); - xhr.onload = function (e) { - var parsedResponse = JSON.parse(e.target.responseText); - if (parsedResponse instanceof Array) { - var count = parsedResponse.length; - if (count !== 0) { - issueLink.innerHTML = 'This app has ' + count + ' open issues'; - document.getElementById('issue-count').style.display = 'inline'; - } - } - }; - xhr.send(); - } - }; - - redirect(); - getFile('learn.json', Learn); -})(); diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-common/package.json b/examples/todomvc/src/main/web/node_modules/todomvc-common/package.json deleted file mode 100644 index 59ffd142..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-common/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "_args": [ - [ - "todomvc-common@1.0.4", - "/home/rjaros/git/kvision/examples/todomvc/src/main/web" - ] - ], - "_from": "todomvc-common@1.0.4", - "_id": "todomvc-common@1.0.4", - "_inBundle": false, - "_integrity": "sha512-AA0Z4exovEqubhbZCrzzn9roVT4zvOncS319p2zIc4CsNe5B9TLL7Sei1NIV6d+WrgR5rOi+y0I9Y6GE7xgNOw==", - "_location": "/todomvc-common", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "todomvc-common@1.0.4", - "name": "todomvc-common", - "escapedName": "todomvc-common", - "rawSpec": "1.0.4", - "saveSpec": null, - "fetchSpec": "1.0.4" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/todomvc-common/-/todomvc-common-1.0.4.tgz", - "_spec": "1.0.4", - "_where": "/home/rjaros/git/kvision/examples/todomvc/src/main/web", - "author": { - "name": "TasteJS" - }, - "bugs": { - "url": "https://github.com/tastejs/todomvc-common/issues" - }, - "description": "Common TodoMVC utilities used by our apps", - "files": [ - "base.js", - "base.css" - ], - "homepage": "https://github.com/tastejs/todomvc-common#readme", - "keywords": [ - "todomvc", - "tastejs", - "util", - "utilities" - ], - "license": "MIT", - "main": "base.js", - "name": "todomvc-common", - "repository": { - "type": "git", - "url": "git+https://github.com/tastejs/todomvc-common.git" - }, - "style": "base.css", - "version": "1.0.4" -} diff --git a/examples/todomvc/src/main/web/node_modules/todomvc-common/readme.md b/examples/todomvc/src/main/web/node_modules/todomvc-common/readme.md deleted file mode 100644 index 7a5de511..00000000 --- a/examples/todomvc/src/main/web/node_modules/todomvc-common/readme.md +++ /dev/null @@ -1,15 +0,0 @@ -# todomvc-common - -> Common TodoMVC utilities used by our apps - - -## Install - -``` -$ npm install --save todomvc-common -``` - - -## License - -MIT © [TasteJS](http://tastejs.com) diff --git a/examples/todomvc/src/main/web/package-lock.json b/examples/todomvc/src/main/web/package-lock.json deleted file mode 100644 index 244ffb88..00000000 --- a/examples/todomvc/src/main/web/package-lock.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "todomvc-app-css": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/todomvc-app-css/-/todomvc-app-css-2.1.0.tgz", - "integrity": "sha1-tvJxbTOa+i5feZNH0qSLBTliQqU=" - }, - "todomvc-common": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/todomvc-common/-/todomvc-common-1.0.4.tgz", - "integrity": "sha512-AA0Z4exovEqubhbZCrzzn9roVT4zvOncS319p2zIc4CsNe5B9TLL7Sei1NIV6d+WrgR5rOi+y0I9Y6GE7xgNOw==" - } - } -} diff --git a/examples/todomvc/src/main/web/package.json b/examples/todomvc/src/main/web/package.json deleted file mode 100644 index 67fbc7aa..00000000 --- a/examples/todomvc/src/main/web/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "private": true, - "dependencies": { - "todomvc-app-css": "2.1.0", - "todomvc-common": "1.0.4" - } -} diff --git a/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt b/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt deleted file mode 100644 index c5ec014f..00000000 --- a/examples/todomvc/src/test/kotlin/test/com/example/TestUtil.kt +++ /dev/null @@ -1,32 +0,0 @@ -package test.com.example - -import pl.treksoft.jquery.jQuery -import kotlin.browser.document - -interface TestSpec { - fun beforeTest() - - fun afterTest() - - fun run(code: () -> Unit) { - beforeTest() - code() - afterTest() - } -} - -interface DomSpec : TestSpec { - - override fun beforeTest() { - val fixture = "<div style=\"display: none\" id=\"pretest\">" + - "<div id=\"helloworld\"></div></div>" - document.body?.insertAdjacentHTML("afterbegin", fixture) - } - - override fun afterTest() { - val div = document.getElementById("pretest") - div?.remove() - jQuery(`object` = ".modal-backdrop").remove() - } - -} diff --git a/examples/todomvc/webpack.config.d/bootstrap.js b/examples/todomvc/webpack.config.d/bootstrap.js deleted file mode 100644 index 32a7c4d0..00000000 --- a/examples/todomvc/webpack.config.d/bootstrap.js +++ /dev/null @@ -1,4 +0,0 @@ -config.module.rules.push({test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff'}); -config.module.rules.push({test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream'}); -config.module.rules.push({test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader'}); -config.module.rules.push({test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml'}); diff --git a/examples/todomvc/webpack.config.d/css.js b/examples/todomvc/webpack.config.d/css.js deleted file mode 100644 index 5d710d35..00000000 --- a/examples/todomvc/webpack.config.d/css.js +++ /dev/null @@ -1,2 +0,0 @@ -config.module.rules.push({ test: /\.css$/, loader: "style-loader!css-loader" }); - diff --git a/examples/todomvc/webpack.config.d/dce.js b/examples/todomvc/webpack.config.d/dce.js deleted file mode 100644 index b536a6bf..00000000 --- a/examples/todomvc/webpack.config.d/dce.js +++ /dev/null @@ -1,2 +0,0 @@ -var path = require("path"); -config.resolve.modules.unshift(path.resolve("./js/min")); diff --git a/examples/todomvc/webpack.config.d/file.js b/examples/todomvc/webpack.config.d/file.js deleted file mode 100644 index 8b853e7e..00000000 --- a/examples/todomvc/webpack.config.d/file.js +++ /dev/null @@ -1,6 +0,0 @@ -config.module.rules.push( - { - test: /\.(jpe?g|png|gif|svg)$/i, - loader: 'file-loader' - } -);
\ No newline at end of file diff --git a/examples/todomvc/webpack.config.d/jquery.js b/examples/todomvc/webpack.config.d/jquery.js deleted file mode 100644 index 40522595..00000000 --- a/examples/todomvc/webpack.config.d/jquery.js +++ /dev/null @@ -1,4 +0,0 @@ -config.plugins.push(new webpack.ProvidePlugin({ - $: "jquery", - jQuery: "jquery" -})); diff --git a/examples/todomvc/webpack.config.d/minify.js b/examples/todomvc/webpack.config.d/minify.js deleted file mode 100644 index 34e706c9..00000000 --- a/examples/todomvc/webpack.config.d/minify.js +++ /dev/null @@ -1,4 +0,0 @@ -if (defined.PRODUCTION) { - config.plugins.push(new webpack.optimize.UglifyJsPlugin({ - })); -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differindex e65b7995..99340b4a 100644 --- a/gradle/wrapper/gradle-wrapper.jar +++ b/gradle/wrapper/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 82689ea8..610ad4c5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Wed Jan 24 11:39:03 CET 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip diff --git a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt index e9e99fc7..83ad69ca 100644 --- a/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/ApplicationBase.kt @@ -1,6 +1,23 @@ +/** + * @author Robert Jaros + */ package pl.treksoft.kvision +/** + * Base class for applications. + * + * Every application class should inherit from this abstract class. +*/ abstract class ApplicationBase { - abstract fun start(state: Map<String, Any>) - abstract fun dispose(): Map<String, Any> +/** + * Starting point for an application. + * @param state Initial state between Hot Module Replacement (HMR). +*/ +abstract fun start(state: Map<String, Any>) + +/** + * Ending point for an application. + * @return final state for Hot Module Replacement (HMR). +*/ +abstract fun dispose(): Map<String, Any> } diff --git a/src/main/kotlin/pl/treksoft/kvision/HMR.kt b/src/main/kotlin/pl/treksoft/kvision/HMR.kt index e657567a..6fb9dfed 100644 --- a/src/main/kotlin/pl/treksoft/kvision/HMR.kt +++ b/src/main/kotlin/pl/treksoft/kvision/HMR.kt @@ -1,11 +1,23 @@ +/** + * @author Robert Jaros + */ package pl.treksoft.kvision +/** + * Helper variable for Hot Module Replacement (HMR). + */ external val module: Module +/** + * Helper interface for Hot Module Replacement (HMR). + */ external interface Module { val hot: Hot? } +/** + * Helper interface for Hot Module Replacement (HMR). + */ external interface Hot { val data: dynamic @@ -16,4 +28,7 @@ external interface Hot { fun dispose(callback: (data: dynamic) -> Unit) } +/** + * External function for loading CommonJS modules. + */ external fun require(name: String): dynamic diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Component.kt b/src/main/kotlin/pl/treksoft/kvision/core/Component.kt index af5ac830..bdd254ba 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/Component.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/Component.kt @@ -8,8 +8,6 @@ import pl.treksoft.jquery.JQuery interface Component { var parent: Component? var visible: Boolean - var width: CssSize? - var height: CssSize? fun addCssClass(css: String): Widget fun removeCssClass(css: String): Widget diff --git a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt index f4bf6e09..b2676929 100644 --- a/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt +++ b/src/main/kotlin/pl/treksoft/kvision/core/StyledComponent.kt @@ -5,7 +5,7 @@ import pl.treksoft.kvision.utils.asString abstract class StyledComponent : Component { - override var width: CssSize? = null + open var width: CssSize? = null set(value) { field = value refresh() @@ -20,7 +20,7 @@ abstract class StyledComponent : Component { field = value refresh() } - override var height: CssSize? = null + var height: CssSize? = null set(value) { field = value refresh() diff --git a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt index 6f9dfaeb..af53807c 100644 --- a/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt +++ b/src/main/kotlin/pl/treksoft/kvision/data/DataContainer.kt @@ -58,7 +58,7 @@ class DataContainer<M : DataComponent, C : Widget>( return this.child.renderVNode() } - fun get(index: Int) = model[index] + fun get(index: Int): M = model[index] override fun update() { model.forEach { it.container = this } diff --git a/src/main/kotlin/pl/treksoft/kvision/basic/Label.kt b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt index a8d8bc16..3ce23639 100644 --- a/src/main/kotlin/pl/treksoft/kvision/basic/Label.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Label.kt @@ -1,4 +1,4 @@ -package pl.treksoft.kvision.basic +package pl.treksoft.kvision.html import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag diff --git a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt index 4f06a38f..722f60e6 100644 --- a/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt +++ b/src/main/kotlin/pl/treksoft/kvision/panel/SplitPanel.kt @@ -3,6 +3,7 @@ package pl.treksoft.kvision.panel import com.github.snabbdom.VNode import pl.treksoft.jquery.JQuery import pl.treksoft.jquery.JQueryEventObject +import pl.treksoft.kvision.core.StyledComponent import pl.treksoft.kvision.core.UNIT import pl.treksoft.kvision.html.TAG import pl.treksoft.kvision.html.Tag @@ -39,9 +40,9 @@ open class SplitPanel( } onDragEnd = { e: JQueryEventObject, el: JQuery, _: dynamic -> if (horizontal) { - children[0].height = el.height().toInt() to px + (children[0] as? StyledComponent)?.height = el.height().toInt() to px } else { - children[0].width = el.width().toInt() to px + (children[0] as? StyledComponent)?.width = el.width().toInt() to px } self.dispatchEvent("dragEndSplitPanel", obj { detail = e }) } diff --git a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt index e2fd7a0d..20a1e484 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/data/DataContainerSpec.kt @@ -1,7 +1,7 @@ package test.pl.treksoft.kvision.data import com.lightningkite.kotlin.observable.list.observableListOf -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.data.BaseDataComponent import pl.treksoft.kvision.data.DataContainer diff --git a/src/test/kotlin/test/pl/treksoft/kvision/basic/LabelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt index c3019cc9..9c6c4e6e 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/basic/LabelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/html/LabelSpec.kt @@ -1,7 +1,7 @@ -package test.pl.treksoft.kvision.basic +package test.pl.treksoft.kvision.html -import pl.treksoft.kvision.basic.Label import pl.treksoft.kvision.core.Root +import pl.treksoft.kvision.html.Label import test.pl.treksoft.kvision.DomSpec import kotlin.browser.document import kotlin.test.Test @@ -20,4 +20,4 @@ class LabelSpec : DomSpec { } } -}
\ No newline at end of file +} diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt index a83bbc6a..c748a45c 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/DockPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.DockPanel import pl.treksoft.kvision.panel.SIDE diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt index e1c3d160..d79b06f9 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/FlexPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.FLEXDIR import pl.treksoft.kvision.panel.FLEXJUSTIFY diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt index 571f13e9..6590e0b0 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/GridPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.GridPanel import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt index 589bd9df..a76c7eb0 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/HPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.FLEXJUSTIFY import pl.treksoft.kvision.panel.HPanel diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt index 2bbb3774..d52fb3d7 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/ResponsiveGridPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.ResponsiveGridPanel import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt index 0cce9bb5..4be7f441 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/SplitPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.DIRECTION import pl.treksoft.kvision.panel.SplitPanel diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt index f9f3f68a..51e4a3f2 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/StackPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.StackPanel import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt index d8c0f905..4d1803b1 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/TabPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.TabPanel import test.pl.treksoft.kvision.DomSpec diff --git a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt index 26fb2675..ad8ceaac 100644 --- a/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt +++ b/src/test/kotlin/test/pl/treksoft/kvision/panel/VPanelSpec.kt @@ -1,6 +1,6 @@ package test.pl.treksoft.kvision.panel -import pl.treksoft.kvision.basic.Label +import pl.treksoft.kvision.html.Label import pl.treksoft.kvision.core.Root import pl.treksoft.kvision.panel.FLEXJUSTIFY import pl.treksoft.kvision.panel.VPanel |