Skip to content

Commit

Permalink
Move core components to core.component package
Browse files Browse the repository at this point in the history
Includes moving their styling to a subpackage
  • Loading branch information
rock3r committed Oct 21, 2023
1 parent 3f9a32c commit 223ab02
Show file tree
Hide file tree
Showing 106 changed files with 1,156 additions and 1,066 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/MergeSarifTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ open class MergeSarifTask : SourceTask() {
.values
.asSequence()
.filter { it.isNotEmpty() }
.map { it.first().copy(results = it.flatMap { it.results ?: emptyList() }) }
.map { run -> run.first().copy(results = run.flatMap { it.results ?: emptyList() }) }
.toList()
)
logger.lifecycle("Merged SARIF file contains ${merged.runs.size} run(s)")
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/jewel.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ detekt {
buildUponDefaultConfig = true
}

val sarifReport = layout.buildDirectory.file("reports/ktlint-${project.name}.sarif")
val sarifReport: Provider<RegularFile> = layout.buildDirectory
.file("reports/ktlint-${project.name}.sarif")

tasks {
detektMain {
Expand Down
1,030 changes: 515 additions & 515 deletions core/api/core.api

Large diffs are not rendered by default.

118 changes: 43 additions & 75 deletions core/src/main/kotlin/org/jetbrains/jewel/ComponentStyling.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,67 @@ import androidx.compose.foundation.LocalContextMenuRepresentation
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ProvidedValue
import androidx.compose.runtime.Stable
import org.jetbrains.jewel.styling.ButtonStyle
import org.jetbrains.jewel.styling.CheckboxStyle
import org.jetbrains.jewel.styling.ChipStyle
import org.jetbrains.jewel.styling.CircularProgressStyle
import org.jetbrains.jewel.styling.DividerStyle
import org.jetbrains.jewel.styling.DropdownStyle
import org.jetbrains.jewel.styling.GroupHeaderStyle
import org.jetbrains.jewel.styling.HorizontalProgressBarStyle
import org.jetbrains.jewel.styling.IconButtonStyle
import org.jetbrains.jewel.styling.LabelledTextFieldStyle
import org.jetbrains.jewel.styling.LazyTreeStyle
import org.jetbrains.jewel.styling.LinkStyle
import org.jetbrains.jewel.styling.LocalCheckboxStyle
import org.jetbrains.jewel.styling.LocalChipStyle
import org.jetbrains.jewel.styling.LocalCircularProgressStyle
import org.jetbrains.jewel.styling.LocalDefaultButtonStyle
import org.jetbrains.jewel.styling.LocalDefaultDropdownStyle
import org.jetbrains.jewel.styling.LocalDefaultTabStyle
import org.jetbrains.jewel.styling.LocalDividerStyle
import org.jetbrains.jewel.styling.LocalEditorTabStyle
import org.jetbrains.jewel.styling.LocalGroupHeaderStyle
import org.jetbrains.jewel.styling.LocalHorizontalProgressBarStyle
import org.jetbrains.jewel.styling.LocalIconButtonStyle
import org.jetbrains.jewel.styling.LocalLabelledTextFieldStyle
import org.jetbrains.jewel.styling.LocalLazyTreeStyle
import org.jetbrains.jewel.styling.LocalLinkStyle
import org.jetbrains.jewel.styling.LocalMenuStyle
import org.jetbrains.jewel.styling.LocalOutlinedButtonStyle
import org.jetbrains.jewel.styling.LocalRadioButtonStyle
import org.jetbrains.jewel.styling.LocalScrollbarStyle
import org.jetbrains.jewel.styling.LocalTextAreaStyle
import org.jetbrains.jewel.styling.LocalTextFieldStyle
import org.jetbrains.jewel.styling.LocalTooltipStyle
import org.jetbrains.jewel.styling.LocalUndecoratedDropdownStyle
import org.jetbrains.jewel.styling.MenuStyle
import org.jetbrains.jewel.styling.RadioButtonStyle
import org.jetbrains.jewel.styling.ScrollbarStyle
import org.jetbrains.jewel.styling.TabStyle
import org.jetbrains.jewel.styling.TextAreaStyle
import org.jetbrains.jewel.styling.TextFieldStyle
import org.jetbrains.jewel.styling.TooltipStyle
import org.jetbrains.jewel.core.component.styling.LocalDefaultTabStyle
import org.jetbrains.jewel.core.component.styling.LocalEditorTabStyle
import org.jetbrains.jewel.core.component.styling.LocalTextAreaStyle
import org.jetbrains.jewel.core.component.styling.LocalTextFieldStyle
import org.jetbrains.jewel.core.component.styling.LocalTooltipStyle
import org.jetbrains.jewel.core.component.styling.TabStyle
import org.jetbrains.jewel.core.component.styling.TextAreaStyle
import org.jetbrains.jewel.core.component.styling.TextFieldStyle
import org.jetbrains.jewel.core.component.styling.TooltipStyle

@Stable
@GenerateDataFunctions
class ComponentStyling(
val checkboxStyle: CheckboxStyle,
val chipStyle: ChipStyle,
val circularProgressStyle: CircularProgressStyle,
val defaultButtonStyle: ButtonStyle,
val defaultDropdownStyle: DropdownStyle,
val checkboxStyle: org.jetbrains.jewel.core.component.styling.CheckboxStyle,
val chipStyle: org.jetbrains.jewel.core.component.styling.ChipStyle,
val circularProgressStyle: org.jetbrains.jewel.core.component.styling.CircularProgressStyle,
val defaultButtonStyle: org.jetbrains.jewel.core.component.styling.ButtonStyle,
val defaultDropdownStyle: org.jetbrains.jewel.core.component.styling.DropdownStyle,
val defaultTabStyle: TabStyle,
val dividerStyle: DividerStyle,
val dividerStyle: org.jetbrains.jewel.core.component.styling.DividerStyle,
val editorTabStyle: TabStyle,
val groupHeaderStyle: GroupHeaderStyle,
val horizontalProgressBarStyle: HorizontalProgressBarStyle,
val iconButtonStyle: IconButtonStyle,
val labelledTextFieldStyle: LabelledTextFieldStyle,
val lazyTreeStyle: LazyTreeStyle,
val linkStyle: LinkStyle,
val menuStyle: MenuStyle,
val outlinedButtonStyle: ButtonStyle,
val radioButtonStyle: RadioButtonStyle,
val scrollbarStyle: ScrollbarStyle,
val groupHeaderStyle: org.jetbrains.jewel.core.component.styling.GroupHeaderStyle,
val horizontalProgressBarStyle: org.jetbrains.jewel.core.component.styling.HorizontalProgressBarStyle,
val iconButtonStyle: org.jetbrains.jewel.core.component.styling.IconButtonStyle,
val labelledTextFieldStyle: org.jetbrains.jewel.core.component.styling.LabelledTextFieldStyle,
val lazyTreeStyle: org.jetbrains.jewel.core.component.styling.LazyTreeStyle,
val linkStyle: org.jetbrains.jewel.core.component.styling.LinkStyle,
val menuStyle: org.jetbrains.jewel.core.component.styling.MenuStyle,
val outlinedButtonStyle: org.jetbrains.jewel.core.component.styling.ButtonStyle,
val radioButtonStyle: org.jetbrains.jewel.core.component.styling.RadioButtonStyle,
val scrollbarStyle: org.jetbrains.jewel.core.component.styling.ScrollbarStyle,
val textAreaStyle: TextAreaStyle,
val textFieldStyle: TextFieldStyle,
val tooltipStyle: TooltipStyle,
val undecoratedDropdownStyle: DropdownStyle,
val undecoratedDropdownStyle: org.jetbrains.jewel.core.component.styling.DropdownStyle,
) {

@Composable
fun providedStyles(): Array<ProvidedValue<*>> = arrayOf(
LocalCheckboxStyle provides checkboxStyle,
LocalChipStyle provides chipStyle,
LocalCircularProgressStyle provides circularProgressStyle,
org.jetbrains.jewel.core.component.styling.LocalCheckboxStyle provides checkboxStyle,
org.jetbrains.jewel.core.component.styling.LocalChipStyle provides chipStyle,
org.jetbrains.jewel.core.component.styling.LocalCircularProgressStyle provides circularProgressStyle,
LocalContextMenuRepresentation provides ContextMenuRepresentation,
LocalDefaultButtonStyle provides defaultButtonStyle,
LocalDefaultDropdownStyle provides defaultDropdownStyle,
org.jetbrains.jewel.core.component.styling.LocalDefaultButtonStyle provides defaultButtonStyle,
org.jetbrains.jewel.core.component.styling.LocalDefaultDropdownStyle provides defaultDropdownStyle,
LocalDefaultTabStyle provides defaultTabStyle,
LocalDividerStyle provides dividerStyle,
org.jetbrains.jewel.core.component.styling.LocalDividerStyle provides dividerStyle,
LocalEditorTabStyle provides editorTabStyle,
LocalGroupHeaderStyle provides groupHeaderStyle,
LocalHorizontalProgressBarStyle provides horizontalProgressBarStyle,
LocalIconButtonStyle provides iconButtonStyle,
LocalLabelledTextFieldStyle provides labelledTextFieldStyle,
LocalLazyTreeStyle provides lazyTreeStyle,
LocalLinkStyle provides linkStyle,
LocalMenuStyle provides menuStyle,
LocalOutlinedButtonStyle provides outlinedButtonStyle,
LocalRadioButtonStyle provides radioButtonStyle,
LocalScrollbarStyle provides scrollbarStyle,
org.jetbrains.jewel.core.component.styling.LocalGroupHeaderStyle provides groupHeaderStyle,
org.jetbrains.jewel.core.component.styling.LocalHorizontalProgressBarStyle provides horizontalProgressBarStyle,
org.jetbrains.jewel.core.component.styling.LocalIconButtonStyle provides iconButtonStyle,
org.jetbrains.jewel.core.component.styling.LocalLabelledTextFieldStyle provides labelledTextFieldStyle,
org.jetbrains.jewel.core.component.styling.LocalLazyTreeStyle provides lazyTreeStyle,
org.jetbrains.jewel.core.component.styling.LocalLinkStyle provides linkStyle,
org.jetbrains.jewel.core.component.styling.LocalMenuStyle provides menuStyle,
org.jetbrains.jewel.core.component.styling.LocalOutlinedButtonStyle provides outlinedButtonStyle,
org.jetbrains.jewel.core.component.styling.LocalRadioButtonStyle provides radioButtonStyle,
org.jetbrains.jewel.core.component.styling.LocalScrollbarStyle provides scrollbarStyle,
LocalTextAreaStyle provides textAreaStyle,
LocalTextFieldStyle provides textFieldStyle,
LocalTooltipStyle provides tooltipStyle,
LocalUndecoratedDropdownStyle provides undecoratedDropdownStyle,
org.jetbrains.jewel.core.component.styling.LocalUndecoratedDropdownStyle provides undecoratedDropdownStyle,
)
}
7 changes: 6 additions & 1 deletion core/src/main/kotlin/org/jetbrains/jewel/ContextMenu.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import androidx.compose.ui.platform.LocalInputModeManager
import androidx.compose.ui.window.Popup
import androidx.compose.ui.window.PopupProperties
import androidx.compose.ui.window.rememberCursorPositionProvider
import org.jetbrains.jewel.styling.MenuStyle
import org.jetbrains.jewel.core.component.MenuContent
import org.jetbrains.jewel.core.component.MenuScope
import org.jetbrains.jewel.core.component.Text
import org.jetbrains.jewel.core.component.handlePopupMenuOnKeyEvent
import org.jetbrains.jewel.core.component.separator
import org.jetbrains.jewel.core.component.styling.MenuStyle

object ContextMenuRepresentation : ContextMenuRepresentation {

Expand Down
6 changes: 4 additions & 2 deletions core/src/main/kotlin/org/jetbrains/jewel/GroupHeader.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import org.jetbrains.jewel.styling.GroupHeaderStyle
import org.jetbrains.jewel.styling.LocalGroupHeaderStyle
import org.jetbrains.jewel.core.component.Divider
import org.jetbrains.jewel.core.component.Text
import org.jetbrains.jewel.core.component.styling.GroupHeaderStyle
import org.jetbrains.jewel.core.component.styling.LocalGroupHeaderStyle

@Composable
fun GroupHeader(
Expand Down
86 changes: 44 additions & 42 deletions core/src/main/kotlin/org/jetbrains/jewel/JewelTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,48 @@ import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import org.jetbrains.jewel.styling.ButtonStyle
import org.jetbrains.jewel.styling.CheckboxStyle
import org.jetbrains.jewel.styling.ChipStyle
import org.jetbrains.jewel.styling.CircularProgressStyle
import org.jetbrains.jewel.styling.DividerStyle
import org.jetbrains.jewel.styling.DropdownStyle
import org.jetbrains.jewel.styling.GroupHeaderStyle
import org.jetbrains.jewel.styling.HorizontalProgressBarStyle
import org.jetbrains.jewel.styling.IconButtonStyle
import org.jetbrains.jewel.styling.LabelledTextFieldStyle
import org.jetbrains.jewel.styling.LazyTreeStyle
import org.jetbrains.jewel.styling.LinkStyle
import org.jetbrains.jewel.styling.LocalCheckboxStyle
import org.jetbrains.jewel.styling.LocalChipStyle
import org.jetbrains.jewel.styling.LocalCircularProgressStyle
import org.jetbrains.jewel.styling.LocalDefaultButtonStyle
import org.jetbrains.jewel.styling.LocalDefaultDropdownStyle
import org.jetbrains.jewel.styling.LocalDefaultTabStyle
import org.jetbrains.jewel.styling.LocalDividerStyle
import org.jetbrains.jewel.styling.LocalEditorTabStyle
import org.jetbrains.jewel.styling.LocalGroupHeaderStyle
import org.jetbrains.jewel.styling.LocalHorizontalProgressBarStyle
import org.jetbrains.jewel.styling.LocalIconButtonStyle
import org.jetbrains.jewel.styling.LocalLabelledTextFieldStyle
import org.jetbrains.jewel.styling.LocalLazyTreeStyle
import org.jetbrains.jewel.styling.LocalLinkStyle
import org.jetbrains.jewel.styling.LocalMenuStyle
import org.jetbrains.jewel.styling.LocalOutlinedButtonStyle
import org.jetbrains.jewel.styling.LocalRadioButtonStyle
import org.jetbrains.jewel.styling.LocalScrollbarStyle
import org.jetbrains.jewel.styling.LocalTextAreaStyle
import org.jetbrains.jewel.styling.LocalTextFieldStyle
import org.jetbrains.jewel.styling.LocalTooltipStyle
import org.jetbrains.jewel.styling.MenuStyle
import org.jetbrains.jewel.styling.RadioButtonStyle
import org.jetbrains.jewel.styling.ScrollbarStyle
import org.jetbrains.jewel.styling.TabStyle
import org.jetbrains.jewel.styling.TextAreaStyle
import org.jetbrains.jewel.styling.TextFieldStyle
import org.jetbrains.jewel.styling.TooltipStyle
import org.jetbrains.jewel.core.component.LocalContentColor
import org.jetbrains.jewel.core.component.LocalTextStyle
import org.jetbrains.jewel.core.component.styling.ButtonStyle
import org.jetbrains.jewel.core.component.styling.CheckboxStyle
import org.jetbrains.jewel.core.component.styling.ChipStyle
import org.jetbrains.jewel.core.component.styling.CircularProgressStyle
import org.jetbrains.jewel.core.component.styling.DividerStyle
import org.jetbrains.jewel.core.component.styling.DropdownStyle
import org.jetbrains.jewel.core.component.styling.GroupHeaderStyle
import org.jetbrains.jewel.core.component.styling.HorizontalProgressBarStyle
import org.jetbrains.jewel.core.component.styling.IconButtonStyle
import org.jetbrains.jewel.core.component.styling.LabelledTextFieldStyle
import org.jetbrains.jewel.core.component.styling.LazyTreeStyle
import org.jetbrains.jewel.core.component.styling.LinkStyle
import org.jetbrains.jewel.core.component.styling.LocalCheckboxStyle
import org.jetbrains.jewel.core.component.styling.LocalChipStyle
import org.jetbrains.jewel.core.component.styling.LocalCircularProgressStyle
import org.jetbrains.jewel.core.component.styling.LocalDefaultButtonStyle
import org.jetbrains.jewel.core.component.styling.LocalDefaultDropdownStyle
import org.jetbrains.jewel.core.component.styling.LocalDefaultTabStyle
import org.jetbrains.jewel.core.component.styling.LocalDividerStyle
import org.jetbrains.jewel.core.component.styling.LocalEditorTabStyle
import org.jetbrains.jewel.core.component.styling.LocalGroupHeaderStyle
import org.jetbrains.jewel.core.component.styling.LocalHorizontalProgressBarStyle
import org.jetbrains.jewel.core.component.styling.LocalIconButtonStyle
import org.jetbrains.jewel.core.component.styling.LocalLabelledTextFieldStyle
import org.jetbrains.jewel.core.component.styling.LocalLazyTreeStyle
import org.jetbrains.jewel.core.component.styling.LocalLinkStyle
import org.jetbrains.jewel.core.component.styling.LocalMenuStyle
import org.jetbrains.jewel.core.component.styling.LocalOutlinedButtonStyle
import org.jetbrains.jewel.core.component.styling.LocalRadioButtonStyle
import org.jetbrains.jewel.core.component.styling.LocalScrollbarStyle
import org.jetbrains.jewel.core.component.styling.LocalTextAreaStyle
import org.jetbrains.jewel.core.component.styling.LocalTextFieldStyle
import org.jetbrains.jewel.core.component.styling.LocalTooltipStyle
import org.jetbrains.jewel.core.component.styling.MenuStyle
import org.jetbrains.jewel.core.component.styling.RadioButtonStyle
import org.jetbrains.jewel.core.component.styling.ScrollbarStyle
import org.jetbrains.jewel.core.component.styling.TabStyle
import org.jetbrains.jewel.core.component.styling.TextAreaStyle
import org.jetbrains.jewel.core.component.styling.TextFieldStyle
import org.jetbrains.jewel.core.component.styling.TooltipStyle

interface JewelTheme {

Expand Down Expand Up @@ -238,11 +240,11 @@ internal val LocalSwingCompatMode = staticCompositionLocalOf {
false
}

val LocalColorPalette = staticCompositionLocalOf<ThemeColorPalette> {
val LocalColorPalette = staticCompositionLocalOf {
ThemeColorPalette.Empty
}

val LocalIconData = staticCompositionLocalOf<ThemeIconData> {
val LocalIconData = staticCompositionLocalOf {
ThemeIconData.Empty
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jetbrains.jewel
package org.jetbrains.jewel.core.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -32,9 +32,12 @@ import org.jetbrains.jewel.CommonStateBitMask.Enabled
import org.jetbrains.jewel.CommonStateBitMask.Focused
import org.jetbrains.jewel.CommonStateBitMask.Hovered
import org.jetbrains.jewel.CommonStateBitMask.Pressed
import org.jetbrains.jewel.FocusableComponentState
import org.jetbrains.jewel.JewelTheme
import org.jetbrains.jewel.core.component.styling.ButtonStyle
import org.jetbrains.jewel.focusOutline
import org.jetbrains.jewel.foundation.Stroke
import org.jetbrains.jewel.foundation.border
import org.jetbrains.jewel.styling.ButtonStyle

@Composable
fun DefaultButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jetbrains.jewel
package org.jetbrains.jewel.core.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.interaction.FocusInteraction
Expand All @@ -23,7 +23,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.takeOrElse
Expand All @@ -37,16 +36,21 @@ import org.jetbrains.jewel.CommonStateBitMask.Hovered
import org.jetbrains.jewel.CommonStateBitMask.Indeterminate
import org.jetbrains.jewel.CommonStateBitMask.Pressed
import org.jetbrains.jewel.CommonStateBitMask.Selected
import org.jetbrains.jewel.JewelTheme
import org.jetbrains.jewel.LocalSwingCompatMode
import org.jetbrains.jewel.Outline
import org.jetbrains.jewel.ToggleableComponentState
import org.jetbrains.jewel.ToggleableComponentState.Companion.readToggleableState
import org.jetbrains.jewel.core.component.styling.CheckboxColors
import org.jetbrains.jewel.core.component.styling.CheckboxIcons
import org.jetbrains.jewel.core.component.styling.CheckboxMetrics
import org.jetbrains.jewel.core.component.styling.LocalCheckboxStyle
import org.jetbrains.jewel.foundation.Stroke
import org.jetbrains.jewel.outline
import org.jetbrains.jewel.painter.PainterHint
import org.jetbrains.jewel.painter.PainterSuffixHint
import org.jetbrains.jewel.painter.hints.Selected
import org.jetbrains.jewel.painter.hints.Stateful
import org.jetbrains.jewel.styling.CheckboxColors
import org.jetbrains.jewel.styling.CheckboxIcons
import org.jetbrains.jewel.styling.CheckboxMetrics
import org.jetbrains.jewel.styling.LocalCheckboxStyle

@Composable
fun Checkbox(
Expand Down Expand Up @@ -227,7 +231,6 @@ fun TriStateCheckboxRow(
)
}

@OptIn(ExperimentalComposeUiApi::class)
@Composable
private fun CheckboxImpl(
state: ToggleableState,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.jetbrains.jewel
package org.jetbrains.jewel.core.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
Expand Down Expand Up @@ -31,9 +31,13 @@ import org.jetbrains.jewel.CommonStateBitMask.Focused
import org.jetbrains.jewel.CommonStateBitMask.Hovered
import org.jetbrains.jewel.CommonStateBitMask.Pressed
import org.jetbrains.jewel.CommonStateBitMask.Selected
import org.jetbrains.jewel.FocusableComponentState
import org.jetbrains.jewel.JewelTheme
import org.jetbrains.jewel.SelectableComponentState
import org.jetbrains.jewel.core.component.styling.ChipStyle
import org.jetbrains.jewel.focusOutline
import org.jetbrains.jewel.foundation.Stroke
import org.jetbrains.jewel.foundation.border
import org.jetbrains.jewel.styling.ChipStyle

@Composable
fun Chip(
Expand Down
Loading

0 comments on commit 223ab02

Please sign in to comment.