diff --git a/README.md b/README.md index beedaa9..27d4503 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,12 @@ Kotlin Multiplatform Compose JSON viewer and editor component for Android, iOS, - **Multiple Themes** — Dark, Light, Monokai, Dracula, Solarized Dark (+ custom themes) - **KMP** — Android, iOS, and JVM Desktop support via Compose Multiplatform +

+ JSON Viewer +    + JSON Editor +

+ ## Installation Add `mavenCentral()` to your repositories in `settings.gradle.kts`: @@ -82,6 +88,10 @@ fun MyEditor() { ## Themes +| Dark | Light | Monokai | Dracula | Solarized Dark | +|:---:|:---:|:---:|:---:|:---:| +| Dark | Light | Monokai | Dracula | Solarized Dark | + ```kotlin JsonViewerCMP( state = state, diff --git a/docs/features/editor.md b/docs/features/editor.md index c277c00..b45f4e9 100644 --- a/docs/features/editor.md +++ b/docs/features/editor.md @@ -2,6 +2,11 @@ `JsonEditorCMP` provides inline text editing with real-time validation, formatting, and sorting. +
+ ![JSON Editor](../screenshots/editor/editor-hero.png){ width="350" } +
Editor with toolbar controls for formatting, sorting, and folding
+
+ ## Size Limit The editor enforces a **50 KB write limit**. Content exceeding 50 KB is truncated — both for `initialJson` passed to `rememberJsonEditorState` and for user input during editing. @@ -38,6 +43,11 @@ When the JSON is invalid, an error banner appears below the toolbar showing: - Error message - Line and column position of the error +
+ ![Error Banner](../screenshots/editor/editor-error.png){ width="350" } +
Error banner showing parse error with position details
+
+ ## Real-time Validation Observe changes reactively via Compose state properties on `JsonEditorState`: diff --git a/docs/features/themes.md b/docs/features/themes.md index a4777e3..c89fdd6 100644 --- a/docs/features/themes.md +++ b/docs/features/themes.md @@ -4,13 +4,35 @@ JsonCMP ships with five built-in color themes and supports custom themes via `Js ## Built-in Themes -| Theme | Constant | Style | -|-------|----------|-------| -| VS Code Dark+ | `JsonTheme.Dark` | Dark background, blue keys, orange strings | -| VS Code Light+ | `JsonTheme.Light` | White background, blue keys, red strings | -| Monokai | `JsonTheme.Monokai` | Dark green background, pink keys, yellow strings | -| Dracula | `JsonTheme.Dracula` | Dark purple background, cyan keys, yellow strings | -| Solarized Dark | `JsonTheme.SolarizedDark` | Dark blue-green background, blue keys, teal strings | +=== "Dark" + + ![Dark Theme](../screenshots/viewer/theme/dark.png){ width="350" } + + `JsonTheme.Dark` — Dark background, blue keys, orange strings (VS Code Dark+) + +=== "Light" + + ![Light Theme](../screenshots/viewer/theme/light.png){ width="350" } + + `JsonTheme.Light` — White background, blue keys, red strings (VS Code Light+) + +=== "Monokai" + + ![Monokai Theme](../screenshots/viewer/theme/monokai.png){ width="350" } + + `JsonTheme.Monokai` — Dark green background, pink keys, yellow strings + +=== "Dracula" + + ![Dracula Theme](../screenshots/viewer/theme/dracula.png){ width="350" } + + `JsonTheme.Dracula` — Dark purple background, cyan keys, yellow strings + +=== "Solarized Dark" + + ![Solarized Dark Theme](../screenshots/viewer/theme/solarized.png){ width="350" } + + `JsonTheme.SolarizedDark` — Dark blue-green background, blue keys, teal strings ## Usage diff --git a/docs/features/viewer.md b/docs/features/viewer.md index bcb6035..ff09d00 100644 --- a/docs/features/viewer.md +++ b/docs/features/viewer.md @@ -2,6 +2,11 @@ `JsonViewerCMP` renders JSON as a read-only, syntax-highlighted tree with line numbers, code folding, and virtualized rendering. +
+ ![JSON Viewer](../screenshots/viewer/viewer-hero.png){ width="350" } +
Viewer with syntax highlighting, line numbers, and code folding
+
+ ## Size Limits - **Valid JSON** — Virtually no size limit. The viewer uses virtualized rendering to handle large documents efficiently. @@ -22,6 +27,11 @@ Each JSON token type is rendered in a distinct color: Objects and arrays can be collapsed by clicking the fold indicator in the gutter. Collapsed sections show an ellipsis with the element count. +
+ ![Code Folding](../screenshots/viewer/viewer-hero.png){ width="350" } +
Collapsed "zip" object showing ellipsis with element count
+
+ ## Line Numbers Line numbers are displayed in a gutter column with a subtle border separator. @@ -40,6 +50,11 @@ JsonViewerCMP( Matches are highlighted with the `highlight` and `highlightFg` colors from the active theme. +
+ ![Search Highlighting](../screenshots/viewer/viewer-search.png){ width="350" } +
Search results highlighted with match counter and navigation
+
+ ## Nested Scrolling `JsonViewerCMP` uses `LazyColumn` internally for virtualized rendering. If you place it inside a vertically scrollable parent (e.g. `Column` with `verticalScroll`, or another `LazyColumn`), you must give `JsonViewerCMP` a bounded height (e.g. `Modifier.height(400.dp)` or `Modifier.weight(1f)`) and handle nested scroll coordination on the client side using Compose's `nestedScroll` modifier. diff --git a/docs/index.md b/docs/index.md index 82f2e68..88e33a4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,6 +15,11 @@ Kotlin Multiplatform Compose JSON viewer and editor component. Two separate comp ## JSON Viewer +
+ ![JSON Viewer](screenshots/viewer/viewer-hero.png){ width="350" } +
Syntax-highlighted viewer with code folding and line numbers
+
+ Drop-in read-only JSON renderer with virtualized rendering: - Syntax highlighting (keys, strings, numbers, booleans, null, punctuation) @@ -38,6 +43,11 @@ fun MyScreen() { ## JSON Editor +
+ ![JSON Editor](screenshots/editor/editor-hero.png){ width="350" } +
Editable JSON with toolbar and real-time validation
+
+ Full editing mode with real-time validation: - Inline text editing with live parse feedback diff --git a/docs/screenshots/editor/editor-error.png b/docs/screenshots/editor/editor-error.png new file mode 100644 index 0000000..711cd8b Binary files /dev/null and b/docs/screenshots/editor/editor-error.png differ diff --git a/docs/screenshots/editor/editor-hero.png b/docs/screenshots/editor/editor-hero.png new file mode 100644 index 0000000..9a7288d Binary files /dev/null and b/docs/screenshots/editor/editor-hero.png differ diff --git a/docs/screenshots/viewer/theme/dark.png b/docs/screenshots/viewer/theme/dark.png new file mode 100644 index 0000000..a28c5ec Binary files /dev/null and b/docs/screenshots/viewer/theme/dark.png differ diff --git a/docs/screenshots/viewer/theme/dracula.png b/docs/screenshots/viewer/theme/dracula.png new file mode 100644 index 0000000..4ee1905 Binary files /dev/null and b/docs/screenshots/viewer/theme/dracula.png differ diff --git a/docs/screenshots/viewer/theme/light.png b/docs/screenshots/viewer/theme/light.png new file mode 100644 index 0000000..e5f3028 Binary files /dev/null and b/docs/screenshots/viewer/theme/light.png differ diff --git a/docs/screenshots/viewer/theme/monokai.png b/docs/screenshots/viewer/theme/monokai.png new file mode 100644 index 0000000..7ef876e Binary files /dev/null and b/docs/screenshots/viewer/theme/monokai.png differ diff --git a/docs/screenshots/viewer/theme/solarized.png b/docs/screenshots/viewer/theme/solarized.png new file mode 100644 index 0000000..eac2b4a Binary files /dev/null and b/docs/screenshots/viewer/theme/solarized.png differ diff --git a/docs/screenshots/viewer/viewer-hero.png b/docs/screenshots/viewer/viewer-hero.png new file mode 100644 index 0000000..e7a628c Binary files /dev/null and b/docs/screenshots/viewer/viewer-hero.png differ diff --git a/docs/screenshots/viewer/viewer-search.png b/docs/screenshots/viewer/viewer-search.png new file mode 100644 index 0000000..35ef56e Binary files /dev/null and b/docs/screenshots/viewer/viewer-search.png differ diff --git a/gradle.properties b/gradle.properties index d05deb7..8342f30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,4 +17,4 @@ android.r8.strictFullModeForKeepRules=false #Publishing jsoncmp.group=dev.skymansandy -jsoncmp.version=1.0.0-RC1 +jsoncmp.version=1.0.0-RC2 diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/ExperimentalJsonCmpApi.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/ExperimentalJsonCmpApi.kt index 0a899f8..f834e67 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/ExperimentalJsonCmpApi.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/ExperimentalJsonCmpApi.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain /** diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/Token.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/Token.kt index 675bef2..5bf04e0 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/Token.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/Token.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.highlighter /** A highlighted span within the raw JSON text. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/TokenType.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/TokenType.kt index 49369cd..60f7369 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/TokenType.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/highlighter/TokenType.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.highlighter /** Classification of a JSON syntax token for highlighting. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLine.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLine.kt index b4bac96..279753a 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLine.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLine.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.line import dev.skymansandy.jsoncmp.domain.model.FoldType diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLineBuilder.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLineBuilder.kt index 6e9edd5..c63623d 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLineBuilder.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonLineBuilder.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.line import dev.skymansandy.jsoncmp.domain.model.FoldType diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonPart.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonPart.kt index c77f1a7..4844923 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonPart.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/line/JsonPart.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.line /** A typed segment of text within a [JsonLine], used for syntax colouring. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/FoldType.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/FoldType.kt index 93985fb..70f032e 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/FoldType.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/FoldType.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.model /** Whether a foldable line opens a JSON object or array. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonNode.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonNode.kt index 5ed6e26..68b7f35 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonNode.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonNode.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.model /** Parsed JSON abstract syntax tree. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonPath.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonPath.kt index d3d8941..b745bf3 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonPath.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/model/JsonPath.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.model /** diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/JsonError.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/JsonError.kt index 439efbd..a260cd5 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/JsonError.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/JsonError.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.parser /** Describes a JSON parse failure with an optional character position. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseJsonResult.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseJsonResult.kt index e7a03c8..4321c35 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseJsonResult.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseJsonResult.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.parser import dev.skymansandy.jsoncmp.domain.line.buildDisplayLines diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseResult.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseResult.kt index 4f95481..3f8309a 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseResult.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/parser/ParseResult.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.parser import dev.skymansandy.jsoncmp.domain.line.JsonLine diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/serializer/JsonSerializer.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/serializer/JsonSerializer.kt index 7ddb576..ff53453 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/serializer/JsonSerializer.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/serializer/JsonSerializer.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.serializer import dev.skymansandy.jsoncmp.domain.model.JsonNode diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonAction.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonAction.kt index c4b7141..0a3acd7 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonAction.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonAction.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.store /** User-driven actions dispatched to [JsonHolder]. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolder.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolder.kt index 2bdc0e0..a3fb197 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolder.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolder.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.store import androidx.compose.runtime.Stable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderImpl.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderImpl.kt index 04fcc04..20752b9 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderImpl.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderImpl.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.store import androidx.compose.runtime.Stable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderState.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderState.kt index 7f89471..1a7f805 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderState.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/domain/store/JsonHolderState.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.domain.store import dev.skymansandy.jsoncmp.domain.line.JsonLine diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/mocks/MockData.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/mocks/MockData.kt index 9f7cde0..edc4203 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/mocks/MockData.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/mocks/MockData.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.helper.mocks import dev.skymansandy.jsoncmp.domain.line.JsonLine diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/util/Constants.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/util/Constants.kt index b5b0fb1..b48ac74 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/util/Constants.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/helper/util/Constants.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.helper.util import androidx.compose.ui.unit.dp diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonCmpColors.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonCmpColors.kt index c02be7c..b841c83 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonCmpColors.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonCmpColors.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.theme import androidx.compose.runtime.compositionLocalOf diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonTheme.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonTheme.kt index 4967c8f..85a7d2d 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonTheme.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/JsonTheme.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.theme /** Named theme wrapping a [JsonCmpColors] palette. Use [Custom] for user-defined colors. */ diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/MonoStyle.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/MonoStyle.kt index 4715891..ed9636a 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/MonoStyle.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/theme/MonoStyle.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.theme import androidx.compose.ui.text.TextStyle diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/GutterCell.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/GutterCell.kt index 0a8dbd0..c2b021f 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/GutterCell.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/GutterCell.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.common import androidx.compose.foundation.gestures.detectTapGestures diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonHighlighter.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonHighlighter.kt index 7c16a5b..18d24fb 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonHighlighter.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonHighlighter.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.common import androidx.compose.ui.text.AnnotatedString diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonLineView.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonLineView.kt index 3cd1236..d038213 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonLineView.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/JsonLineView.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.common import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/PlainText.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/PlainText.kt index 0395a31..3178e3f 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/PlainText.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/common/PlainText.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.common import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditor.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditor.kt index 725870f..c09d3bf 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditor.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditor.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorCMP.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorCMP.kt index 9c058df..66d2f0d 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorCMP.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorCMP.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor import androidx.compose.runtime.Composable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorState.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorState.kt index b435414..9d1c469 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorState.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/JsonEditorState.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor import androidx.compose.runtime.Composable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/EditorToolbar.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/EditorToolbar.kt index aea6bbe..a55f7a7 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/EditorToolbar.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/EditorToolbar.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ErrorBanner.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ErrorBanner.kt index 860510f..e908845 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ErrorBanner.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ErrorBanner.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/LineGutterEditMode.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/LineGutterEditMode.kt index 13801c9..232e744 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/LineGutterEditMode.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/LineGutterEditMode.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/SortOption.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/SortOption.kt index 781c5d6..148bf08 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/SortOption.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/SortOption.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ToolbarDivider.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ToolbarDivider.kt index 6696465..7d226ef 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ToolbarDivider.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/editor/component/ToolbarDivider.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.editor.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewer.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewer.kt index f5ee82d..6aefa48 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewer.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewer.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer import androidx.compose.material3.MaterialTheme diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerCMP.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerCMP.kt index b072199..62c13a5 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerCMP.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerCMP.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer import androidx.compose.runtime.Composable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerState.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerState.kt index 53debb6..587d5b3 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerState.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/JsonViewerState.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer import androidx.compose.runtime.Composable diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerContent.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerContent.kt index 44756cc..aabfa04 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerContent.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerContent.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerEmptyState.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerEmptyState.kt index 811ab54..aa4bf6e 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerEmptyState.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerEmptyState.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerLineList.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerLineList.kt index 2f72c9b..1382152 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerLineList.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/JsonViewerLineList.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.component import androidx.compose.foundation.ScrollState @@ -17,6 +21,7 @@ import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.items import androidx.compose.foundation.text.selection.DisableSelection +import androidx.compose.foundation.text.selection.SelectionContainer import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind @@ -128,16 +133,18 @@ internal fun JsonViewerLineList( } } - LazyColumn( - state = listState, - modifier = Modifier - .fillMaxSize() - .horizontalScroll(horizontalScrollState), - ) { - items( - items = visibleLines, - key = { it.lineNumber }, - ) { line -> lineContent(line) } + SelectionContainer { + LazyColumn( + state = listState, + modifier = Modifier + .fillMaxSize() + .horizontalScroll(horizontalScrollState), + ) { + items( + items = visibleLines, + key = { it.lineNumber }, + ) { line -> lineContent(line) } + } } } } diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/LineGutterViewMode.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/LineGutterViewMode.kt index 7e406dc..d8f1bbf 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/LineGutterViewMode.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/LineGutterViewMode.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/SearchResultsBar.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/SearchResultsBar.kt index 5c4bee3..07fe446 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/SearchResultsBar.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/component/SearchResultsBar.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.component import androidx.compose.foundation.background diff --git a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/model/SearchMatch.kt b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/model/SearchMatch.kt index 7699449..a69d766 100644 --- a/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/model/SearchMatch.kt +++ b/json-cmp/src/commonMain/kotlin/dev/skymansandy/jsoncmp/ui/viewer/model/SearchMatch.kt @@ -1,3 +1,7 @@ +/* + * Copyright (c) 2026 skymansandy. All rights reserved. + */ + package dev.skymansandy.jsoncmp.ui.viewer.model /** A single search hit: visible line index and character offset within that line. */