From 8f0e2ee876c444ecd7b6fff5b2bb8c24c68c5ac8 Mon Sep 17 00:00:00 2001 From: malilex Date: Mon, 21 Apr 2025 14:04:36 +0300 Subject: [PATCH 1/2] feat: Add Config Codec. --- sdds-core/config-codec/build.gradle.kts | 11 + .../kotlin/com/sdds/utils/config/codec/App.kt | 51 ++ .../config/codec/internal/CommonConfig.kt | 36 ++ .../config/codec/internal/ConfigCodec.kt | 199 +++++++ .../config/codec/internal/NativeConfig.kt | 25 + .../test/resources/icon_button_common.json | 402 ++++++++++++++ .../src/test/resources/text_field_common.json | 504 ++++++++++++++++++ .../src/test/resources/text_field_native.json | 435 +++++++++++++++ sdds-core/settings.gradle.kts | 1 + 9 files changed, 1664 insertions(+) create mode 100644 sdds-core/config-codec/build.gradle.kts create mode 100644 sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/App.kt create mode 100644 sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/CommonConfig.kt create mode 100644 sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/ConfigCodec.kt create mode 100644 sdds-core/config-codec/src/main/kotlin/com/sdds/utils/config/codec/internal/NativeConfig.kt create mode 100644 sdds-core/config-codec/src/test/resources/icon_button_common.json create mode 100644 sdds-core/config-codec/src/test/resources/text_field_common.json create mode 100644 sdds-core/config-codec/src/test/resources/text_field_native.json diff --git a/sdds-core/config-codec/build.gradle.kts b/sdds-core/config-codec/build.gradle.kts new file mode 100644 index 0000000000..de2b3979c8 --- /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 0000000000..18680fcc0f --- /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 0000000000..daa327075c --- /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 0000000000..56dffc8988 --- /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 0000000000..b6a0fc5e06 --- /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 0000000000..6a1ab642a0 --- /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 0000000000..fb30fcbf13 --- /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 0000000000..8625fd9a23 --- /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/settings.gradle.kts b/sdds-core/settings.gradle.kts index 8ac1c3a3ed..bb439e5a4b 100644 --- a/sdds-core/settings.gradle.kts +++ b/sdds-core/settings.gradle.kts @@ -32,4 +32,5 @@ include( ":docs-views", ":docs-compose", ":docs-ksp", + ":config-codec" ) From 112b46dbe7577edfce11f2adeeef1327030d4aac Mon Sep 17 00:00:00 2001 From: raininforest Date: Wed, 8 Apr 2026 17:21:56 +0300 Subject: [PATCH 2/2] configCodec rework --- sdds-core/config-codec/build.gradle.kts | 15 +- .../config/codec/internal/CommonConfig.kt | 28 +- .../config/codec/internal/ConfigCodec.kt | 65 +- .../src/test/resources/text_field_common.json | 1268 +++++++++++++++-- .../src/test/resources/text_field_native.json | 1185 ++++++++++++++- 5 files changed, 2339 insertions(+), 222 deletions(-) diff --git a/sdds-core/config-codec/build.gradle.kts b/sdds-core/config-codec/build.gradle.kts index de2b3979c8..90d03ff31d 100644 --- a/sdds-core/config-codec/build.gradle.kts +++ b/sdds-core/config-codec/build.gradle.kts @@ -8,4 +8,17 @@ 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 +} + +tasks.register("runConfigCodec") { + group = "application" + description = "Run Config Codec with parameters" + classpath = sourceSets.main.get().runtimeClasspath + mainClass.set("com.sdds.utils.config.codec.AppKt") + + args = listOf( + "/Users/21934234/data/plasma-android/sdds-core/config-codec/src/test/resources/text_field_common.json", + "/Users/21934234/data/plasma-android/sdds-core/config-codec/src/test/resources/text_field_native.json", + "encode" + ) +} 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 index daa327075c..b628ad689c 100644 --- 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 @@ -5,32 +5,40 @@ import kotlinx.serialization.json.JsonObject @Serializable internal data class CommonConfig( - val rootPropertyId: String = "", - val commonValues: JsonObject? = null, - val properties: List = emptyList(), + val rootVariationId: String = "", + val colorSchemeVariationId: String = "", + val invariants: JsonObject? = null, + val variations: List = emptyList(), + val defaults: Set = emptySet(), ) @Serializable -internal data class ConfigProperty( +internal data class Variation( val id: String, val name: String, - val values: Set + val values: Set ) @Serializable -internal data class ConfigPropertyValue( +internal data class VariationValue( val name: String, - val targets: Set? = null, + val targets: Set? = null, val props: JsonObject? = null, ) @Serializable -internal data class ConfigPropertyTarget( - val properties: Set +internal data class VariationValueTarget( + val properties: Set ) @Serializable -internal data class ConfigPropertyTargetInfo( +internal data class TargetInfo( + val id: String, + val value: String, +) + +@Serializable +internal data class DefaultVariationValue( 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 index 56dffc8988..325c51c3f4 100644 --- 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 @@ -3,28 +3,29 @@ package com.sdds.utils.config.codec.internal internal object ConfigCodec { fun encode(config: CommonConfig): NativeConfig { - val nativeConfig = NativeConfig(props = config.commonValues) + val nativeConfig = NativeConfig(props = config.invariants) - val viewProperty = config.properties.findLast { it.id == "view" } - val rootsViews = viewProperty?.values + val viewVariationId = config.colorSchemeVariationId + val viewVariation = config.variations.findLast { it.id == viewVariationId } + val rootsViews = viewVariation?.values ?.filter { it.targets == null } ?.associate { it.name to NativeViewVariation(it.props) } .orEmpty() - val targetRegistry = config.properties.flatMap { prop -> + val targetRegistry = config.variations.flatMap { prop -> prop.values.map { value -> - ConfigPropertyTargetInfo(prop.id, value.name) + TargetInfo(prop.id, value.name) } }.groupBy { it.id } - val targetViewRegistry = viewProperty?.values + val targetViewRegistry = viewVariation?.values ?.filter { it.targets != null } - ?.flatMap { value -> - value.targets!!.map { value.copy(targets = setOf(it)) } + ?.flatMap { viewValue -> + viewValue.targets!!.map { target -> viewValue.copy(targets = setOf(target)) } } ?.groupBy { it.targets!!.first() } ?.mapValues { entry -> - entry.value.associate { it.name to NativeViewVariation(it.props) } + entry.value.associate { viewValue -> viewValue.name to NativeViewVariation(viewValue.props) } } ?.mapKeys { entry -> entry.key.properties.joinToString(".") { it.value } @@ -32,13 +33,14 @@ internal object ConfigCodec { .orEmpty() .also { println("target views $it") } - val variations = config.properties.filter { it.id != "view" } + val variations = config.variations + .filter { it.id != viewVariationId } .flatMap { property -> property.values .flatMap { value -> value.toNativeVariation( property.id, - config.rootPropertyId, + config.rootVariationId, targetRegistry, targetViewRegistry ) @@ -53,7 +55,7 @@ internal object ConfigCodec { val variationRegistry = config.variations.associateBy { it.id } val viewPropertyValues = config.view.map { (name, view) -> - ConfigPropertyValue( + VariationValue( name = name, props = view.props, targets = null @@ -66,7 +68,7 @@ internal object ConfigCodec { var targetId = "" val targets = variation.id.split(".") .map { id -> - ConfigPropertyTargetInfo( + TargetInfo( id = variationRegistry["$targetId$id"]?.kind.orEmpty(), value = id ).also { @@ -74,8 +76,8 @@ internal object ConfigCodec { } } .toSet() - .let { ConfigPropertyTarget(it) } - ConfigPropertyValue( + .let { VariationValueTarget(it) } + VariationValue( name = name, props = view.props, targets = setOf(targets) @@ -84,9 +86,9 @@ internal object ConfigCodec { } val viewValues = (viewPropertyValues + targetViews).toSet() - val viewProperty = ConfigProperty( - id = "view", - name = "view", + val viewProperty = Variation( + id = NATIVE_VIEW_VARIATION_NAME, + name = NATIVE_VIEW_VARIATION_NAME, values = viewValues ) .takeIf { viewValues.isNotEmpty() } @@ -99,20 +101,20 @@ internal object ConfigCodec { .dropLast(1) .takeIf { it.isNotEmpty() } ?.map { id -> - ConfigPropertyTargetInfo( + TargetInfo( id = variationRegistry["$targetId$id"]?.kind.orEmpty(), value = id ).also { targetId = "$targetId$id." } } ?.toSet() - ?.let { setOf(ConfigPropertyTarget(it)) } + ?.let { setOf(VariationValueTarget(it)) } - val value = ConfigPropertyValue( + val value = VariationValue( name = variation.id.removePrefix("${variation.parent}."), props = variation.props, targets = targets ) - ConfigProperty( + Variation( id = variation.kind, name = variation.kind, values = setOf(value) @@ -120,17 +122,20 @@ internal object ConfigCodec { }.mergeConfigProperty() return CommonConfig( - commonValues = config.props, - properties = viewProperty + variationPropertyValues, - rootPropertyId = "size" + invariants = config.props, + variations = viewProperty + variationPropertyValues, + rootVariationId = NATIVE_SIZE_VARIATION_NAME, + colorSchemeVariationId = NATIVE_VIEW_VARIATION_NAME, ) } + private const val NATIVE_VIEW_VARIATION_NAME = "view" + private const val NATIVE_SIZE_VARIATION_NAME = "size" } -private fun ConfigPropertyValue.toNativeVariation( +private fun VariationValue.toNativeVariation( propertyId: String, rootPropertyId: String, - targetRegistry: Map>, + targetRegistry: Map>, targetViewRegistry: Map> = emptyMap(), ): List { @@ -170,7 +175,7 @@ private fun ConfigPropertyValue.toNativeVariation( ) } -private fun List.mergeConfigProperty(): List { +private fun List.mergeConfigProperty(): List { return groupBy { it.id }.map { (id, group) -> val name = group.first().name @@ -183,14 +188,14 @@ private fun List.mergeConfigProperty(): List { .toSet() .takeIf { it.isNotEmpty() } - ConfigPropertyValue( + VariationValue( name = key.first, props = key.second, targets = mergedTargets ) }.toSet() - ConfigProperty( + Variation( id = id, name = name, values = mergedValues 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 index fb30fcbf13..7e11851c0f 100644 --- a/sdds-core/config-codec/src/test/resources/text_field_common.json +++ b/sdds-core/config-codec/src/test/resources/text_field_common.json @@ -1,6 +1,7 @@ { - "rootPropertyId": "size", - "commonValues": { + "rootVariationId": "size", + "colorSchemeVariationId": "view", + "invariants": { "disableAlpha": { "type": "float", "value": 0.4 @@ -92,6 +93,10 @@ } ] }, + "placeholderColorReadOnly": { + "type": "color", + "default": "text.default.secondary" + }, "backgroundColorReadOnly": { "type": "color", "default": "surface.default.solid-primary", @@ -118,7 +123,7 @@ "default": "text.default.tertiary" } }, - "properties": [ + "variations": [ { "id": "view", "name": "view", @@ -314,184 +319,1185 @@ "value": "optional" } } - } - ] - }, - { - "id": "requirePlacement", - "name": "requirePlacement", - "values": [ + }, { - "name": "required-start", - "targets": [ - { - "properties": [ - { - "id": "size", - "value": "xs" - } - ] - } - ], + "name": "s", "props": { - "fieldType": { + "labelPlacement": { "type": "value", - "value": "requiredStart" + "value": "none" }, - "indicatorSize": { + "shape": { + "type": "shape", + "value": "round.m", + "adjustment": -2.0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.s.secondary" + }, + "boxPaddingStart": { "type": "dimension", - "value": 6.0 + "value": 12.0 }, - "indicatorAlignmentMode": { - "type": "value", - "value": "inside" - } - } - }, - { - "name": "required-end", - "targets": [ - { - "properties": [ - { - "id": "size", - "value": "xs" - } - ] - } - ], - "props": { - "fieldType": { - "type": "value", - "value": "requiredEnd" + "boxPaddingEnd": { + "type": "dimension", + "value": 12.0 }, - "indicatorSize": { + "boxPaddingTop": { "type": "dimension", - "value": 6.0 + "value": 8.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" + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 }, - "indicatorSize": { + "startContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "endContentPadding": { "type": "dimension", "value": 6.0 }, - "indicatorOffsetX": { + "boxMinHeight": { "type": "dimension", - "value": 4.0 + "value": 40.0 }, - "indicatorOffsetY": { + "alignmentMinHeight": { "type": "dimension", - "value": 4.0 + "value": 40.0 }, - "indicatorAlignmentMode": { + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "fieldType": { "type": "value", - "value": "outside" + "value": "optional" } } }, { - "name": "required-end", - "targets": [ - { - "properties": [ - { - "id": "labelPlacement", - "value": "xs.outer-label" - } - ] - } - ], + "name": "m", "props": { - "fieldType": { + "labelPlacement": { "type": "value", - "value": "requiredEnd" + "value": "none" }, - "indicatorSize": { + "shape": { + "type": "shape", + "value": "round.m" + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.m.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 14.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 14.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 12.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 12.0 + }, + "startContentPadding": { "type": "dimension", "value": 6.0 }, - "indicatorOffsetX": { + "endContentPadding": { "type": "dimension", - "value": 4.0 + "value": 8.0 }, - "indicatorOffsetY": { + "boxMinHeight": { "type": "dimension", - "value": 2.0 + "value": 48.0 }, - "indicatorAlignmentMode": { + "alignmentMinHeight": { + "type": "dimension", + "value": 48.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "fieldType": { "type": "value", - "value": "outside" + "value": "optional" } } - } - ] - }, - { - "id": "labelPlacement", - "name": "labelPlacement", - "values": [ + }, { - "name": "outer-label", - "targets": [ - { - "properties": [ - { - "id": "size", - "value": "xs" - } - ] - } - ], + "name": "l", "props": { - "labelColor": { - "type": "color", - "default": "text.default.primary" - }, "labelPlacement": { "type": "value", - "value": "outer" + "value": "none" }, - "labelPadding": { + "shape": { + "type": "shape", + "value": "round.m", + "adjustment": 2.0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.l.secondary" + }, + "boxPaddingStart": { "type": "dimension", - "value": 6.0 + "value": 16.0 }, - "labelStyle": { - "type": "typography", - "value": "body.xs.normal" + "boxPaddingEnd": { + "type": "dimension", + "value": 16.0 }, "boxPaddingTop": { "type": "dimension", - "value": 8.0 + "value": 16.0 }, "boxPaddingBottom": { + "type": "dimension", + "value": 16.0 + }, + "startContentPadding": { "type": "dimension", "value": 8.0 }, + "endContentPadding": { + "type": "dimension", + "value": 10.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 56.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 56.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "fieldType": { + "type": "value", + "value": "optional" + } + } + }, + { + "name": "xl", + "props": { + "labelPlacement": { + "type": "value", + "value": "none" + }, + "shape": { + "type": "shape", + "value": "round.l" + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.xl.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 18.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 18.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 20.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 20.0 + }, + "startContentPadding": { + "type": "dimension", + "value": 8.0 + }, + "endContentPadding": { + "type": "dimension", + "value": 10.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 64.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 64.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "fieldType": { + "type": "value", + "value": "optional" + } + } + } + ] + }, + { + "id": "requirePlacement", + "name": "requirePlacement", + "values": [ + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xs" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "s" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "s" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + } + ], + "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" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "s" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "s" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xs" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + } + ], + "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": "size", + "value": "xs" + }, + { + "id": "labelPlacement", + "value": "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" + } + } + }, + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "s" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "name": "required-end", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "s" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "m" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "l" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "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-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "m" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "m" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "l" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "l" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "name": "required-end", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "m" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "m" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "l" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "l" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + }, + { + "id": "labelPlacement", + "value": "inner-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "m" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 7.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "name": "required-start", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "l" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + }, + { + "id": "labelPlacement", + "value": "outer-label" + } + ] + } + ], + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 8.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" + } + } + }, + { + "name": "outer-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "s" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 8.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.s.normal" + } + } + }, + { + "name": "inner-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "s" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 0.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 4.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 4.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "name": "outer-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "m" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 10.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.m.normal" + } + } + }, + { + "name": "inner-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "m" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 6.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 6.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "name": "outer-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "l" + } + ] + }, + { + "properties": [ + { + "id": "size", + "value": "xl" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 12.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.l.normal" + } + } + }, + { + "name": "inner-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "l" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 9.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 9.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "name": "inner-label", + "targets": [ + { + "properties": [ + { + "id": "size", + "value": "xl" + } + ] + } + ], + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 13.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 13.0 + }, "optionalStyle": { "type": "typography", "value": "body.xs.normal" 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 index 8625fd9a23..6568e3ef11 100644 --- a/sdds-core/config-codec/src/test/resources/text_field_native.json +++ b/sdds-core/config-codec/src/test/resources/text_field_native.json @@ -197,6 +197,10 @@ } ] }, + "placeholderColorReadOnly": { + "type": "color", + "default": "text.default.secondary" + }, "backgroundColorReadOnly": { "type": "color", "default": "surface.default.solid-primary", @@ -226,7 +230,6 @@ "variations": [ { "id": "xs", - "parent": null, "kind": "size", "props": { "labelPlacement": { @@ -305,119 +308,474 @@ } }, { - "id": "xs.required-start", - "parent": "xs", - "kind": "requirePlacement", + "id": "s", + "kind": "size", "props": { - "fieldType": { + "labelPlacement": { "type": "value", - "value": "requiredStart" + "value": "none" }, - "indicatorSize": { + "shape": { + "type": "shape", + "value": "round.m", + "adjustment": -2.0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.s.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 12.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 12.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 8.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 8.0 + }, + "startContentPadding": { + "type": "dimension", + "value": 4.0 + }, + "endContentPadding": { "type": "dimension", "value": 6.0 }, - "indicatorAlignmentMode": { + "boxMinHeight": { + "type": "dimension", + "value": 40.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 40.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "fieldType": { "type": "value", - "value": "inside" + "value": "optional" } } }, { - "id": "xs.required-end", - "parent": "xs", - "kind": "requirePlacement", + "id": "m", + "kind": "size", "props": { - "fieldType": { + "labelPlacement": { "type": "value", - "value": "requiredEnd" + "value": "none" }, - "indicatorSize": { + "shape": { + "type": "shape", + "value": "round.m" + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.m.secondary" + }, + "boxPaddingStart": { + "type": "dimension", + "value": 14.0 + }, + "boxPaddingEnd": { + "type": "dimension", + "value": 14.0 + }, + "boxPaddingTop": { + "type": "dimension", + "value": 12.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 12.0 + }, + "startContentPadding": { "type": "dimension", "value": 6.0 }, - "indicatorAlignmentMode": { + "endContentPadding": { + "type": "dimension", + "value": 8.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 48.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 48.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "fieldType": { "type": "value", - "value": "inside" + "value": "optional" } } }, { - "id": "xs.outer-label", - "parent": "xs", - "kind": "labelPlacement", + "id": "l", + "kind": "size", "props": { - "labelColor": { - "type": "color", - "default": "text.default.primary" - }, "labelPlacement": { "type": "value", - "value": "outer" + "value": "none" }, - "labelPadding": { + "shape": { + "type": "shape", + "value": "round.m", + "adjustment": 2.0 + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.l.secondary" + }, + "boxPaddingStart": { "type": "dimension", - "value": 6.0 + "value": 16.0 }, - "labelStyle": { - "type": "typography", - "value": "body.xs.normal" + "boxPaddingEnd": { + "type": "dimension", + "value": 16.0 }, "boxPaddingTop": { "type": "dimension", - "value": 8.0 + "value": 16.0 }, "boxPaddingBottom": { + "type": "dimension", + "value": 16.0 + }, + "startContentPadding": { "type": "dimension", "value": 8.0 }, - "optionalStyle": { + "endContentPadding": { + "type": "dimension", + "value": 10.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 56.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 56.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { "type": "typography", - "value": "body.xs.normal" + "value": "body.l.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "fieldType": { + "type": "value", + "value": "optional" } } }, { - "id": "xs.outer-label.required-start", - "parent": "xs.outer-label", - "kind": "requirePlacement", + "id": "xl", + "kind": "size", "props": { - "fieldType": { + "labelPlacement": { "type": "value", - "value": "requiredStart" + "value": "none" }, - "indicatorSize": { + "shape": { + "type": "shape", + "value": "round.l" + }, + "chipGroupStyle": { + "type": "component_style", + "value": "embedded-chip-group-dense.xl.secondary" + }, + "boxPaddingStart": { "type": "dimension", - "value": 6.0 + "value": 18.0 }, - "indicatorOffsetX": { + "boxPaddingEnd": { "type": "dimension", - "value": 4.0 + "value": 18.0 }, - "indicatorOffsetY": { + "boxPaddingTop": { "type": "dimension", - "value": 4.0 + "value": 20.0 }, - "indicatorAlignmentMode": { + "boxPaddingBottom": { + "type": "dimension", + "value": 20.0 + }, + "startContentPadding": { + "type": "dimension", + "value": 8.0 + }, + "endContentPadding": { + "type": "dimension", + "value": 10.0 + }, + "boxMinHeight": { + "type": "dimension", + "value": 64.0 + }, + "alignmentMinHeight": { + "type": "dimension", + "value": 64.0 + }, + "startContentSize": { + "type": "dimension", + "value": 24.0 + }, + "endContentSize": { + "type": "dimension", + "value": 24.0 + }, + "valueStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "placeholderStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "prefixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "suffixStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "fieldType": { "type": "value", - "value": "outside" + "value": "optional" } } }, { - "id": "xs.outer-label.required-end", - "parent": "xs.outer-label", + "id": "xs.required-start", "kind": "requirePlacement", + "parent": "xs", "props": { "fieldType": { "type": "value", - "value": "requiredEnd" + "value": "requiredStart" }, "indicatorSize": { "type": "dimension", "value": 6.0 }, - "indicatorOffsetX": { + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "s.required-start", + "kind": "requirePlacement", + "parent": "s", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "s.inner-label.required-start", + "kind": "requirePlacement", + "parent": "s.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xs.required-end", + "kind": "requirePlacement", + "parent": "xs", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "s.required-end", + "kind": "requirePlacement", + "parent": "s", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "s.inner-label.required-end", + "kind": "requirePlacement", + "parent": "s.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xs.outer-label.required-start", + "kind": "requirePlacement", + "parent": "xs.outer-label", + "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", + "kind": "requirePlacement", + "parent": "xs.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { "type": "dimension", "value": 4.0 }, @@ -430,6 +788,733 @@ "value": "outside" } } + }, + { + "id": "s.outer-label.required-start", + "kind": "requirePlacement", + "parent": "s.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 6.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "s.outer-label.required-end", + "kind": "requirePlacement", + "parent": "s.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "m.outer-label.required-end", + "kind": "requirePlacement", + "parent": "m.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "l.outer-label.required-end", + "kind": "requirePlacement", + "parent": "l.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "xl.outer-label.required-end", + "kind": "requirePlacement", + "parent": "xl.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 4.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 4.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "m.required-start", + "kind": "requirePlacement", + "parent": "m", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "m.inner-label.required-start", + "kind": "requirePlacement", + "parent": "m.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "l.required-start", + "kind": "requirePlacement", + "parent": "l", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "l.inner-label.required-start", + "kind": "requirePlacement", + "parent": "l.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xl.required-start", + "kind": "requirePlacement", + "parent": "xl", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xl.inner-label.required-start", + "kind": "requirePlacement", + "parent": "xl.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "m.required-end", + "kind": "requirePlacement", + "parent": "m", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "m.inner-label.required-end", + "kind": "requirePlacement", + "parent": "m.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "l.required-end", + "kind": "requirePlacement", + "parent": "l", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "l.inner-label.required-end", + "kind": "requirePlacement", + "parent": "l.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xl.required-end", + "kind": "requirePlacement", + "parent": "xl", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "xl.inner-label.required-end", + "kind": "requirePlacement", + "parent": "xl.inner-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredEnd" + }, + "indicatorSize": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "inside" + } + } + }, + { + "id": "m.outer-label.required-start", + "kind": "requirePlacement", + "parent": "m.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 7.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "l.outer-label.required-start", + "kind": "requirePlacement", + "parent": "l.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "xl.outer-label.required-start", + "kind": "requirePlacement", + "parent": "xl.outer-label", + "props": { + "fieldType": { + "type": "value", + "value": "requiredStart" + }, + "indicatorSize": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetX": { + "type": "dimension", + "value": 6.0 + }, + "indicatorOffsetY": { + "type": "dimension", + "value": 8.0 + }, + "indicatorAlignmentMode": { + "type": "value", + "value": "outside" + } + } + }, + { + "id": "xs.outer-label", + "kind": "labelPlacement", + "parent": "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" + } + } + }, + { + "id": "s.outer-label", + "kind": "labelPlacement", + "parent": "s", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 8.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.s.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.s.normal" + } + } + }, + { + "id": "s.inner-label", + "kind": "labelPlacement", + "parent": "s", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 0.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 4.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 4.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "id": "m.outer-label", + "kind": "labelPlacement", + "parent": "m", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 10.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.m.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.m.normal" + } + } + }, + { + "id": "m.inner-label", + "kind": "labelPlacement", + "parent": "m", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 6.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 6.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "id": "l.outer-label", + "kind": "labelPlacement", + "parent": "l", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 12.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.l.normal" + } + } + }, + { + "id": "xl.outer-label", + "kind": "labelPlacement", + "parent": "xl", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.primary" + }, + "labelPlacement": { + "type": "value", + "value": "outer" + }, + "labelPadding": { + "type": "dimension", + "value": 12.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.l.normal" + }, + "optionalStyle": { + "type": "typography", + "value": "body.l.normal" + } + } + }, + { + "id": "l.inner-label", + "kind": "labelPlacement", + "parent": "l", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 9.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 9.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } + }, + { + "id": "xl.inner-label", + "kind": "labelPlacement", + "parent": "xl", + "props": { + "labelColor": { + "type": "color", + "default": "text.default.secondary" + }, + "labelPlacement": { + "type": "value", + "value": "inner" + }, + "labelPadding": { + "type": "dimension", + "value": 2.0 + }, + "labelStyle": { + "type": "typography", + "value": "body.xs.normal" + }, + "boxPaddingTop": { + "type": "dimension", + "value": 13.0 + }, + "boxPaddingBottom": { + "type": "dimension", + "value": 13.0 + }, + "optionalStyle": { + "type": "typography", + "value": "body.xs.normal" + } + } } ] } \ No newline at end of file