diff --git a/build.gradle.kts b/build.gradle.kts index 687969ab6..705a76a79 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("convention.root-project") + alias(libs.plugins.kotlin.jvm) apply false } allprojects { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6f531b925..fe9c58eaa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,8 +39,8 @@ glide = "4.16.0" koilVersion-compose = "2.2.0" -sdds-uikit = "0.14.0" -sdds-uikit-compose = "0.16.0" +sdds-uikit = "0.15.0" +sdds-uikit-compose = "0.17.0" sdds-icons = "0.8.0" plugin-androidCacheFix = "3.0.1" diff --git a/playground/sandbox-compose/gradle.properties b/playground/sandbox-compose/gradle.properties index d1efaadee..ae54f1953 100644 --- a/playground/sandbox-compose/gradle.properties +++ b/playground/sandbox-compose/gradle.properties @@ -1,3 +1,3 @@ versionMajor=0 -versionMinor=9 +versionMinor=10 versionPatch=0 diff --git a/sdds-core/config-codec/build.gradle.kts b/sdds-core/config-codec/build.gradle.kts new file mode 100644 index 000000000..de2b3979c --- /dev/null +++ b/sdds-core/config-codec/build.gradle.kts @@ -0,0 +1,11 @@ +plugins { + id("convention.kotlin-java-version-sync") + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.kotlin.serialization) +} + +dependencies { + implementation(libs.base.kotlin.serialization.json) + testImplementation(libs.base.test.unit.jUnit) + testImplementation(libs.base.test.unit.mockk) +} \ No newline at end of file diff --git a/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/App.kt b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/App.kt new file mode 100644 index 000000000..18680fcc0 --- /dev/null +++ b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/App.kt @@ -0,0 +1,51 @@ +package com.sdds.utils.config.codec + +import com.sdds.utils.config.codec.internal.CommonConfig +import com.sdds.utils.config.codec.internal.ConfigCodec +import com.sdds.utils.config.codec.internal.NativeConfig +import kotlinx.serialization.decodeFromString +import kotlinx.serialization.encodeToString +import kotlinx.serialization.json.Json +import java.io.File + +private val serializer = Json { + ignoreUnknownKeys = true +} + +fun main(args: Array) { + if (args.size != 3) { + println("Usage: ") + return + } + + val inputPath = args[0] + val outputPath = args[1] + val mode = args[2] + + val inputFile = File(inputPath) + val outputFile = File(outputPath) + + if (!inputFile.exists()) { + println("Input file does not exist: $inputPath") + return + } + + val inputJson = inputFile.readText() + + val outputJson = when (mode.lowercase()) { + "encode" -> ConfigCodec.encode(serializer.decodeFromString(inputJson)).let { + serializer.encodeToString(it) + } + "decode" -> ConfigCodec.decode(serializer.decodeFromString(inputJson)).let { + serializer.encodeToString(it) + } + else -> { + println("Invalid mode: $mode. Use 'encode' or 'decode'.") + return + } + } + + outputFile.parentFile.mkdirs() + outputFile.writeText(outputJson) + println("Operation '$mode' completed. Output written to $outputPath") +} diff --git a/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/CommonConfig.kt b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/CommonConfig.kt new file mode 100644 index 000000000..daa327075 --- /dev/null +++ b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/CommonConfig.kt @@ -0,0 +1,36 @@ +package com.sdds.utils.config.codec.internal + +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonObject + +@Serializable +internal data class CommonConfig( + val rootPropertyId: String = "", + val commonValues: JsonObject? = null, + val properties: List = emptyList(), +) + +@Serializable +internal data class ConfigProperty( + val id: String, + val name: String, + val values: Set +) + +@Serializable +internal data class ConfigPropertyValue( + val name: String, + val targets: Set? = null, + val props: JsonObject? = null, +) + +@Serializable +internal data class ConfigPropertyTarget( + val properties: Set +) + +@Serializable +internal data class ConfigPropertyTargetInfo( + val id: String, + val value: String, +) \ No newline at end of file diff --git a/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/ConfigCodec.kt b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/ConfigCodec.kt new file mode 100644 index 000000000..56dffc898 --- /dev/null +++ b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/ConfigCodec.kt @@ -0,0 +1,199 @@ +package com.sdds.utils.config.codec.internal + +internal object ConfigCodec { + + fun encode(config: CommonConfig): NativeConfig { + val nativeConfig = NativeConfig(props = config.commonValues) + + val viewProperty = config.properties.findLast { it.id == "view" } + val rootsViews = viewProperty?.values + ?.filter { it.targets == null } + ?.associate { it.name to NativeViewVariation(it.props) } + .orEmpty() + + val targetRegistry = config.properties.flatMap { prop -> + prop.values.map { value -> + ConfigPropertyTargetInfo(prop.id, value.name) + } + }.groupBy { it.id } + + val targetViewRegistry = viewProperty?.values + ?.filter { it.targets != null } + ?.flatMap { value -> + value.targets!!.map { value.copy(targets = setOf(it)) } + } + ?.groupBy { it.targets!!.first() } + ?.mapValues { entry -> + entry.value.associate { it.name to NativeViewVariation(it.props) } + } + ?.mapKeys { entry -> + entry.key.properties.joinToString(".") { it.value } + } + .orEmpty() + .also { println("target views $it") } + + val variations = config.properties.filter { it.id != "view" } + .flatMap { property -> + property.values + .flatMap { value -> + value.toNativeVariation( + property.id, + config.rootPropertyId, + targetRegistry, + targetViewRegistry + ) + } + }.filter { it.props != null } + + + return nativeConfig.copy(view = rootsViews, variations = variations) + } + + fun decode(config: NativeConfig): CommonConfig { + val variationRegistry = config.variations.associateBy { it.id } + + val viewPropertyValues = config.view.map { (name, view) -> + ConfigPropertyValue( + name = name, + props = view.props, + targets = null + ) + } + + val targetViews = config.variations + .flatMap { variation -> + variation.view.map { (name, view) -> + var targetId = "" + val targets = variation.id.split(".") + .map { id -> + ConfigPropertyTargetInfo( + id = variationRegistry["$targetId$id"]?.kind.orEmpty(), + value = id + ).also { + targetId = "$targetId$id." + } + } + .toSet() + .let { ConfigPropertyTarget(it) } + ConfigPropertyValue( + name = name, + props = view.props, + targets = setOf(targets) + ) + } + } + + val viewValues = (viewPropertyValues + targetViews).toSet() + val viewProperty = ConfigProperty( + id = "view", + name = "view", + values = viewValues + ) + .takeIf { viewValues.isNotEmpty() } + .let { listOfNotNull(it) } + .mergeConfigProperty() + + val variationPropertyValues = config.variations.map { variation -> + var targetId = "" + val targets = variation.id.split(".") + .dropLast(1) + .takeIf { it.isNotEmpty() } + ?.map { id -> + ConfigPropertyTargetInfo( + id = variationRegistry["$targetId$id"]?.kind.orEmpty(), + value = id + ).also { targetId = "$targetId$id." } + } + ?.toSet() + ?.let { setOf(ConfigPropertyTarget(it)) } + + val value = ConfigPropertyValue( + name = variation.id.removePrefix("${variation.parent}."), + props = variation.props, + targets = targets + ) + ConfigProperty( + id = variation.kind, + name = variation.kind, + values = setOf(value) + ) + }.mergeConfigProperty() + + return CommonConfig( + commonValues = config.props, + properties = viewProperty + variationPropertyValues, + rootPropertyId = "size" + ) + } +} + +private fun ConfigPropertyValue.toNativeVariation( + propertyId: String, + rootPropertyId: String, + targetRegistry: Map>, + targetViewRegistry: Map> = emptyMap(), +): List { + + if (targets != null) { + return targets.map { target -> + val parent = target.properties.joinToString(".") { it.value } + val id = "$parent.$name" + NativeVariation( + id = id, + kind = propertyId, + parent = parent, + props = props, + view = targetViewRegistry[id].orEmpty() + ) + } + } + return targetRegistry[rootPropertyId] + ?.takeIf { rootPropertyId != propertyId } + ?.map { info -> + val parent = info.value + val id = "$parent.$name" + NativeVariation( + id = id, + kind = propertyId, + parent = parent, + props = props, + view = targetViewRegistry[id].orEmpty() + ) + } + ?: listOf( + NativeVariation( + id = name, + kind = propertyId, + props = props, + view = targetViewRegistry[name].orEmpty() + ) + ) +} + +private fun List.mergeConfigProperty(): List { + return groupBy { it.id }.map { (id, group) -> + val name = group.first().name + + val mergedValues = group.flatMap { it.values } + .groupBy { it.name to it.props } + .map { (key, valuesGroup) -> + val mergedTargets = valuesGroup + .mapNotNull { it.targets } + .flatten() + .toSet() + .takeIf { it.isNotEmpty() } + + ConfigPropertyValue( + name = key.first, + props = key.second, + targets = mergedTargets + ) + }.toSet() + + ConfigProperty( + id = id, + name = name, + values = mergedValues + ) + } +} \ No newline at end of file diff --git a/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/NativeConfig.kt b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/NativeConfig.kt new file mode 100644 index 000000000..b6a0fc5e0 --- /dev/null +++ b/sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/NativeConfig.kt @@ -0,0 +1,25 @@ +package com.sdds.utils.config.codec.internal + +import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonObject + +@Serializable +internal data class NativeConfig( + var view: Map = emptyMap(), + var props: JsonObject? = null, + var variations: List = emptyList() +) + +@Serializable +internal data class NativeViewVariation( + val props: JsonObject? +) + +@Serializable +internal data class NativeVariation( + val id: String, + val kind: String, + val parent: String? = null, + val view: Map = emptyMap(), + val props: JsonObject? = null +) \ No newline at end of file diff --git a/sdds-core/config-codec/src/test/resources/icon_button_common.json b/sdds-core/config-codec/src/test/resources/icon_button_common.json new file mode 100644 index 000000000..6a1ab642a --- /dev/null +++ b/sdds-core/config-codec/src/test/resources/icon_button_common.json @@ -0,0 +1,402 @@ +{ + "rootPropertyId": "size", + "commonValues": { + "loadingAlpha": { + "type": "float", + "value": 0 + }, + "disableAlpha": { + "type": "float", + "value": 0.4 + } + }, + "defaults": [ + { "id": "size", "value": "m" }, + { "id": "view", "value": "default" } + ], + "properties": [ + { + "id": "size", + "name": "size", + "values": [ + { + "name": "xl", + "targets": null, + "props": { + "shape": { + "type": "shape", + "value": "round.l" + }, + "height": { + "type": "dimension", + "value": 64 + }, + "paddingStart": { + "type": "dimension", + "value": 20 + }, + "paddingEnd": { + "type": "dimension", + "value": 20 + }, + "minWidth": { + "type": "dimension", + "value": 64 + }, + "iconSize": { + "type": "dimension", + "value": 24 + }, + "spinnerSize": { + "type": "dimension", + "value": 24 + }, + "spinnerStrokeWidth": { + "type": "dimension", + "value": 2 + } + } + }, + { + "name": "l", + "targets": null, + "props": { + "shape": { + "type": "shape", + "value": "round.l", + "adjustment": -2 + }, + "height": { + "type": "dimension", + "value": 56 + }, + "paddingStart": { + "type": "dimension", + "value": 16 + }, + "paddingEnd": { + "type": "dimension", + "value": 16 + }, + "minWidth": { + "type": "dimension", + "value": 56 + }, + "iconSize": { + "type": "dimension", + "value": 24 + }, + "spinnerSize": { + "type": "dimension", + "value": 22 + }, + "spinnerStrokeWidth": { + "type": "dimension", + "value": 2 + } + } + }, + { + "name": "m", + "targets": null, + "props": { + "shape": { + "type": "shape", + "value": "round.m" + }, + "height": { + "type": "dimension", + "value": 48 + }, + "paddingStart": { + "type": "dimension", + "value": 12 + }, + "paddingEnd": { + "type": "dimension", + "value": 12 + }, + "minWidth": { + "type": "dimension", + "value": 48 + }, + "iconSize": { + "type": "dimension", + "value": 24 + }, + "spinnerSize": { + "type": "dimension", + "value": 22 + }, + "spinnerStrokeWidth": { + "type": "dimension", + "value": 2 + } + } + } + ] + }, + { + "id": "shape", + "name": "shape", + "values": [ + { + "name": "rounded", + "targets": null, + "props": null + }, + { + "name": "pilled", + "targets": null, + "props": { + "shape": { + "type": "shape", + "value": "round.circle" + } + } + } + ] + }, + { + "id": "view", + "name": "view", + "values": [ + { + "name": "default", + "targets": null, + "props": { + "iconColor": { + "type": "color", + "value": "text.inverse.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.inverse.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.inverse.primary-hover" + } + ] + }, + "spinnerColor": { + "type": "color", + "value": "text.inverse.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.inverse.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.inverse.primary-hover" + } + ] + }, + "backgroundColor": { + "type": "color", + "value": "surface.default.solid-default", + "states": [ + { + "state": [ + "pressed" + ], + "value": "surface.default.solid-default-active" + }, + { + "state": [ + "hovered" + ], + "value": "surface.default.solid-default-hover" + } + ] + } + } + }, + { + "name": "secondary", + "targets": null, + "props": { + "iconColor": { + "type": "color", + "value": "text.default.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.default.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.default.primary-hover" + } + ] + }, + "spinnerColor": { + "type": "color", + "value": "text.default.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.default.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.default.primary-hover" + } + ] + }, + "backgroundColor": { + "type": "color", + "value": "surface.default.transparent-secondary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "surface.default.transparent-secondary-active" + }, + { + "state": [ + "hovered" + ], + "value": "surface.default.transparent-secondary-hover" + } + ] + } + } + }, + { + "name": "accent", + "targets": null, + "props": { + "iconColor": { + "type": "color", + "value": "text.on-dark.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.on-dark.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.on-dark.primary-hover" + } + ] + }, + "spinnerColor": { + "type": "color", + "value": "text.on-dark.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.on-dark.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.on-dark.primary-hover" + } + ] + }, + "backgroundColor": { + "type": "color", + "value": "surface.default.accent", + "states": [ + { + "state": [ + "pressed" + ], + "value": "surface.default.accent-active" + }, + { + "state": [ + "hovered" + ], + "value": "surface.default.accent-hover" + } + ] + } + } + }, + { + "name": "accent", + "targets": [ + { + "properties": [ + { "id": "size", "value": "l" }, + { "id": "shape", "value": "pilled" } + ] + }, + { + "properties": [ + { "id": "size", "value": "m" }, + { "id": "shape", "value": "pilled" } + ] + } + ], + "props": { + "iconColor": { + "type": "color", + "value": "text.inverse.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.inverse.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.inverse.primary-hover" + } + ] + }, + "spinnerColor": { + "type": "color", + "value": "text.inverse.primary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.inverse.primary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.inverse.primary-hover" + } + ] + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/sdds-core/config-codec/src/test/resources/text_field_common.json b/sdds-core/config-codec/src/test/resources/text_field_common.json new file mode 100644 index 000000000..fb30fcbf1 --- /dev/null +++ b/sdds-core/config-codec/src/test/resources/text_field_common.json @@ -0,0 +1,504 @@ +{ + "rootPropertyId": "size", + "commonValues": { + "disableAlpha": { + "type": "float", + "value": 0.4 + }, + "prefixPadding": { + "type": "dimension", + "value": 6.0 + }, + "suffixPadding": { + "type": "dimension", + "value": 6.0 + }, + "captionPlacement": { + "type": "value", + "value": "outer" + }, + "counterPlacement": { + "type": "value", + "value": "outer" + }, + "captionStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "counterStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "optionalPadding": { + "type": "dimension", + "value": 4.0 + }, + "helperTextPadding": { + "type": "dimension", + "value": 4.0 + }, + "chipsPadding": { + "type": "dimension", + "value": 6.0 + }, + "valueColor": { + "type": "color", + "default": "text.default.primary" + }, + "startContentColor": { + "type": "color", + "default": "text.default.secondary" + }, + "endContentColor": { + "type": "color", + "default": "text.default.secondary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.default.secondary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.default.secondary-hover" + } + ] + }, + "endContentColorReadOnly": { + "type": "color", + "default": "text.default.secondary", + "alpha": 0.4 + }, + "optionalColor": { + "type": "color", + "default": "text.default.tertiary" + }, + "counterColor": { + "type": "color", + "default": "text.default.secondary" + }, + "placeholderColor": { + "type": "color", + "default": "text.default.secondary", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.tertiary" + } + ] + }, + "backgroundColorReadOnly": { + "type": "color", + "default": "surface.default.solid-primary", + "alpha": 0.4 + }, + "indicatorColor": { + "type": "color", + "default": "surface.default.negative" + }, + "cursorColor": { + "type": "color", + "default": "text.default.accent" + }, + "captionColorReadOnly": { + "type": "color", + "default": "text.default.secondary" + }, + "prefixColor": { + "type": "color", + "default": "text.default.tertiary" + }, + "suffixColor": { + "type": "color", + "default": "text.default.tertiary" + } + }, + "properties": [ + { + "id": "view", + "name": "view", + "values": [ + { + "name": "default", + "props": { + "captionColor": { + "type": "color", + "default": "text.default.secondary" + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-primary", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + { + "name": "success", + "props": { + "captionColor": { + "type": "color", + "default": "text.default.positive", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-positive", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + { + "name": "warning", + "props": { + "captionColor": { + "type": "color", + "default": "text.default.warning", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-warning", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + { + "name": "error", + "props": { + "captionColor": { + "type": "color", + "default": "text.default.negative", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-negative", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + } + ] + }, + { + "id": "size", + "name": "size", + "values": [ + { + "name": "xs", + "props": { + "labelPlacement": { + "type": "value", + "value": "none" + }, + "shape": { + "type": "shape", + "value": "round.s", + "adjustment": 0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.xs.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 + }, + "startContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "endContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 32.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 32.0 + }, + "startContentSize": { + "type": "dimension", + "value": 16.0 + }, + "endContentSize": { + "type": "dimension", + "value": 16.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "fieldType": { + "type": "value", + "value": "optional" + } + } + } + ] + }, + { + "id": "requirePlacement", + "name": "requirePlacement", + "values": [ + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xs" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "name": "required-end", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xs" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "labelPlacement", + "value": "outer-label" + }, + { + "id": "size", + "value": "xs" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "name": "required-end", + "targets": [ + { + "properties": [ + { + "id": "labelPlacement", + "value": "xs.outer-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 2.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + } + ] + }, + { + "id": "labelPlacement", + "name": "labelPlacement", + "values": [ + { + "name": "outer-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xs" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 6.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/sdds-core/config-codec/src/test/resources/text_field_native.json b/sdds-core/config-codec/src/test/resources/text_field_native.json new file mode 100644 index 000000000..8625fd9a2 --- /dev/null +++ b/sdds-core/config-codec/src/test/resources/text_field_native.json @@ -0,0 +1,435 @@ +{ + "view": { + "default": { + "props": { + "captionColor": { + "type": "color", + "default": "text.default.secondary" + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-primary", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + "success": { + "props": { + "captionColor": { + "type": "color", + "default": "text.default.positive", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-positive", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + "warning": { + "props": { + "captionColor": { + "type": "color", + "default": "text.default.warning", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-warning", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + }, + "error": { + "props": { + "captionColor": { + "type": "color", + "default": "text.default.negative", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.secondary" + } + ] + }, + "backgroundColor": { + "type": "color", + "default": "surface.default.transparent-negative", + "states": [ + { + "state": [ + "activated" + ], + "value": "surface.default.transparent-secondary" + } + ] + } + } + } + }, + "props": { + "disableAlpha": { + "type": "float", + "value": 0.4 + }, + "prefixPadding": { + "type": "dimension", + "value": 6.0 + }, + "suffixPadding": { + "type": "dimension", + "value": 6.0 + }, + "captionPlacement": { + "type": "value", + "value": "outer" + }, + "counterPlacement": { + "type": "value", + "value": "outer" + }, + "captionStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "counterStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "optionalPadding": { + "type": "dimension", + "value": 4.0 + }, + "helperTextPadding": { + "type": "dimension", + "value": 4.0 + }, + "chipsPadding": { + "type": "dimension", + "value": 6.0 + }, + "valueColor": { + "type": "color", + "default": "text.default.primary" + }, + "startContentColor": { + "type": "color", + "default": "text.default.secondary" + }, + "endContentColor": { + "type": "color", + "default": "text.default.secondary", + "states": [ + { + "state": [ + "pressed" + ], + "value": "text.default.secondary-active" + }, + { + "state": [ + "hovered" + ], + "value": "text.default.secondary-hover" + } + ] + }, + "endContentColorReadOnly": { + "type": "color", + "default": "text.default.secondary", + "alpha": 0.4 + }, + "optionalColor": { + "type": "color", + "default": "text.default.tertiary" + }, + "counterColor": { + "type": "color", + "default": "text.default.secondary" + }, + "placeholderColor": { + "type": "color", + "default": "text.default.secondary", + "states": [ + { + "state": [ + "activated" + ], + "value": "text.default.tertiary" + } + ] + }, + "backgroundColorReadOnly": { + "type": "color", + "default": "surface.default.solid-primary", + "alpha": 0.4 + }, + "indicatorColor": { + "type": "color", + "default": "surface.default.negative" + }, + "cursorColor": { + "type": "color", + "default": "text.default.accent" + }, + "captionColorReadOnly": { + "type": "color", + "default": "text.default.secondary" + }, + "prefixColor": { + "type": "color", + "default": "text.default.tertiary" + }, + "suffixColor": { + "type": "color", + "default": "text.default.tertiary" + } + }, + "variations": [ + { + "id": "xs", + "parent": null, + "kind": "size", + "props": { + "labelPlacement": { + "type": "value", + "value": "none" + }, + "shape": { + "type": "shape", + "value": "round.s", + "adjustment": 0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.xs.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 + }, + "startContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "endContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 32.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 32.0 + }, + "startContentSize": { + "type": "dimension", + "value": 16.0 + }, + "endContentSize": { + "type": "dimension", + "value": 16.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "fieldType": { + "type": "value", + "value": "optional" + } + } + }, + { + "id": "xs.required-start", + "parent": "xs", + "kind": "requirePlacement", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xs.required-end", + "parent": "xs", + "kind": "requirePlacement", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xs.outer-label", + "parent": "xs", + "kind": "labelPlacement", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 6.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "id": "xs.outer-label.required-start", + "parent": "xs.outer-label", + "kind": "requirePlacement", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "xs.outer-label.required-end", + "parent": "xs.outer-label", + "kind": "requirePlacement", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 2.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + } + ] +} \ No newline at end of file diff --git a/sdds-core/plugin_theme_builder/gradle.properties b/sdds-core/plugin_theme_builder/gradle.properties index 0058228c0..45c733f37 100644 --- a/sdds-core/plugin_theme_builder/gradle.properties +++ b/sdds-core/plugin_theme_builder/gradle.properties @@ -1,3 +1,3 @@ versionMajor=0 -versionMinor=13 +versionMinor=14 versionPatch=0 \ No newline at end of file diff --git a/sdds-core/settings.gradle.kts b/sdds-core/settings.gradle.kts index 4fb4e1d60..018c24c11 100644 --- a/sdds-core/settings.gradle.kts +++ b/sdds-core/settings.gradle.kts @@ -23,5 +23,6 @@ include( ":plugin_theme_builder", ":uikit", ":uikit-compose", - ":testing" + ":testing", + ":config-codec" ) diff --git a/sdds-core/uikit-compose/gradle.properties b/sdds-core/uikit-compose/gradle.properties index b1ec6fa44..9d65cc753 100644 --- a/sdds-core/uikit-compose/gradle.properties +++ b/sdds-core/uikit-compose/gradle.properties @@ -2,5 +2,5 @@ nexus.artifactId=sdds-uikit-compose nexus.snapshot=false nexus.description=SDDS UIKit library with base components for android jetpack compose versionMajor=0 -versionMinor=16 +versionMinor=17 versionPatch=0 diff --git a/sdds-core/uikit/gradle.properties b/sdds-core/uikit/gradle.properties index bed6033d7..a06849550 100644 --- a/sdds-core/uikit/gradle.properties +++ b/sdds-core/uikit/gradle.properties @@ -2,5 +2,5 @@ nexus.artifactId=sdds-uikit nexus.snapshot=false nexus.description=SDDS UIKit library with base components for android view system versionMajor=0 -versionMinor=14 +versionMinor=15 versionPatch=0 diff --git a/tokens/plasma-stards-compose/gradle.properties b/tokens/plasma-stards-compose/gradle.properties index 7545bf3d7..01edb68b7 100644 --- a/tokens/plasma-stards-compose/gradle.properties +++ b/tokens/plasma-stards-compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-star-ds-compose nexus.snapshot=false nexus.description=plasma-star-ds library for compose framework versionMajor=0 -versionMinor=4 +versionMinor=5 versionPatch=0 theme-url=https://github.com/salute-developers/theme-converter/raw/main/themes/plasma_stards/0.5.0.zip diff --git a/tokens/plasma-stards-view/gradle.properties b/tokens/plasma-stards-view/gradle.properties index 9ee64ecaf..7d90e3973 100644 --- a/tokens/plasma-stards-view/gradle.properties +++ b/tokens/plasma-stards-view/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-star-ds nexus.snapshot=false nexus.description=plasma-star-ds library for view framework versionMajor=2 -versionMinor=6 +versionMinor=7 versionPatch=0 theme-url=https://github.com/salute-developers/theme-converter/raw/main/themes/plasma_stards/0.5.0.zip diff --git a/tokens/plasma.giga.app.compose/gradle.properties b/tokens/plasma.giga.app.compose/gradle.properties index c32386ee8..3521b5368 100644 --- a/tokens/plasma.giga.app.compose/gradle.properties +++ b/tokens/plasma.giga.app.compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-giga-app-compose nexus.snapshot=false nexus.description=plasma-giga-app library for compose framework versionMajor=0 -versionMinor=3 +versionMinor=4 versionPatch=0 theme-version=0.5.0-alpha diff --git a/tokens/plasma.giga.compose/gradle.properties b/tokens/plasma.giga.compose/gradle.properties index 2c48e9871..f52d2c708 100644 --- a/tokens/plasma.giga.compose/gradle.properties +++ b/tokens/plasma.giga.compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-giga-compose nexus.snapshot=false nexus.description=plasma-giga library for compose framework versionMajor=0 -versionMinor=3 +versionMinor=4 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/plasma.sd.service.compose/gradle.properties b/tokens/plasma.sd.service.compose/gradle.properties index 10fcf97ee..37472c94b 100644 --- a/tokens/plasma.sd.service.compose/gradle.properties +++ b/tokens/plasma.sd.service.compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-sd-service-compose nexus.snapshot=false nexus.description=plasma-sd-service library for compose framework versionMajor=0 -versionMinor=10 +versionMinor=11 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/plasma.sd.service.view/gradle.properties b/tokens/plasma.sd.service.view/gradle.properties index 0cca524f2..f654d42c5 100644 --- a/tokens/plasma.sd.service.view/gradle.properties +++ b/tokens/plasma.sd.service.view/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=plasma-sd-service nexus.snapshot=false nexus.description=plasma-sd-service theme library for view framework versionMajor=0 -versionMinor=5 +versionMinor=6 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/sdds.serv.compose/gradle.properties b/tokens/sdds.serv.compose/gradle.properties index 45fc3a7ec..2e49b2dfc 100644 --- a/tokens/sdds.serv.compose/gradle.properties +++ b/tokens/sdds.serv.compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=sdds-serv-compose nexus.snapshot=false nexus.description=sdds-serv token library for compose framework versionMajor=0 -versionMinor=9 +versionMinor=10 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/sdds.serv.view/gradle.properties b/tokens/sdds.serv.view/gradle.properties index 38e245a84..7c4501ca2 100644 --- a/tokens/sdds.serv.view/gradle.properties +++ b/tokens/sdds.serv.view/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=sdds-serv nexus.snapshot=false nexus.description=sdds-serv token library for view framework versionMajor=0 -versionMinor=9 +versionMinor=10 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/stylessalute.compose/gradle.properties b/tokens/stylessalute.compose/gradle.properties index c451fbcdc..dfe6ded47 100644 --- a/tokens/stylessalute.compose/gradle.properties +++ b/tokens/stylessalute.compose/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=stylessalute-compose nexus.snapshot=false nexus.description=stylessalute token library for compose framework versionMajor=0 -versionMinor=4 +versionMinor=5 versionPatch=0 theme-version=0.5.0 diff --git a/tokens/stylessalute.view/gradle.properties b/tokens/stylessalute.view/gradle.properties index bc7ef3f72..bea3aa48d 100644 --- a/tokens/stylessalute.view/gradle.properties +++ b/tokens/stylessalute.view/gradle.properties @@ -2,7 +2,7 @@ nexus.artifactId=stylessalute nexus.snapshot=false nexus.description=stylessalute token library for view framework versionMajor=0 -versionMinor=4 +versionMinor=5 versionPatch=0 theme-version=0.5.0