-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Project Gen to Skate #744
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e31084d
copy project over, extend new dialog wrapper to display project gen w…
linhpha ddb4ec0
delete old terminal code
linhpha 0c54b6e
use jetbrain util to get dark mode
linhpha 8940807
create projectgenlock and delete when finish with projectgen
linhpha a6366a8
add error dialog
linhpha 85ce28d
update version in catalog & delete fake
linhpha cfa9552
move dialog to a separate class
linhpha 6bdf744
nit
linhpha 7695960
indent and sort
linhpha 74f39a2
spotless
linhpha 476b604
nit
linhpha 200bd3b
make projectgenwindow extends dialogwrapper directly
linhpha d89d280
update copyright year
linhpha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
skate-plugin/src/main/kotlin/com/slack/sgp/intellij/projectgen/DesktopColors.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
/* | ||
* Copyright (C) 2024 Slack Technologies, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
@file:Suppress("MagicNumber") | ||
|
||
package com.slack.sgp.intellij.projectgen | ||
|
||
import androidx.compose.material3.darkColorScheme | ||
import androidx.compose.material3.lightColorScheme | ||
import androidx.compose.ui.graphics.Color | ||
|
||
/** Borrowed from `MaterialColors` in SKColors.kt. */ | ||
internal object DesktopColors { | ||
private val mdThemeLightPrimary = Color(0xFF1264A3) | ||
private val mdThemeLightOnPrimary = Color(0xFFFFFFFF) | ||
private val mdThemeLightInversePrimary = mdThemeLightOnPrimary | ||
private val mdThemeLightPrimaryContainer = Color(0xFF9ED6FA) // On Inverse Highlight 1 | ||
private val mdThemeLightOnPrimaryContainer = Color(0xFF1D1C1D) // On Inverse Highlight 1 | ||
private val mdThemeLightSecondary = Color(0xFF1264A3) | ||
private val mdThemeLightOnSecondary = Color(0xFFFFFFFF) | ||
private val mdThemeLightSecondaryContainer = Color(0xFF9ED6FA) // Highlight 3, Jade 0 | ||
private val mdThemeLightOnSecondaryContainer = Color(0xFF1D1C1D) // Highlight 3, Jade 0 | ||
private val mdThemeLightTertiary = Color(0xFF007A5A) | ||
private val mdThemeLightOnTertiary = Color(0xFFFFFFFF) | ||
private val mdThemeLightTertiaryContainer = Color(0xFFE3FFF3) // Highlight 3, Jade 0 | ||
private val mdThemeLightOnTertiaryContainer = Color(0xFF1D1C1D) // Highlight 3, Jade 0 | ||
private val mdThemeLightError = Color(0xFFE01E5A) | ||
private val mdThemeLightOnError = Color(0xFFFFFFFF) | ||
private val mdThemeLightErrorContainer = Color(0xFFFFE8EF) // Destructive, Flamingo 0 | ||
private val mdThemeLightOnErrorContainer = Color(0xFF1D1C1D) // Destructive, Flamingo 0 | ||
private val mdThemeLightBackground = Color(0xFFFFFFFF) | ||
private val mdThemeLightOnBackground = Color(0xFF1D1C1D) | ||
private val mdThemeLightSurface = Color(0xFFFFFFFF) | ||
private val mdThemeLightOnSurface = Color(0xFF1D1C1D) | ||
private val mdThemeLightInverseSurface = Color(0xFF1D1C1D) // Inverse of surface | ||
private val mdThemeLightInverseOnSurface = Color(0xFFFFFFFF) // Inverse of onSurface | ||
private val mdThemeLightSurfaceVariant = Color(0xFFEAEAEA) // On Inverse Variant 1 | ||
private val mdThemeLightOnSurfaceVariant = Color(0xFF1D1C1D) // On Inverse Variant 1 | ||
// We don't want m3's tonal tinting for this so we just reuse the surface value | ||
private val mdThemeLightSurfaceTint = mdThemeLightSurface | ||
private val mdThemeLightOutline = Color(0xFF5E5D60) // Outline Primary | ||
private val mdThemeLightShadow = Color(0xB31D1C1D) // Background / Modal | ||
|
||
// We reuse the same values for primary/secondary/tertiary in both light and dark | ||
private val mdThemeDarkPrimary = mdThemeLightPrimary | ||
private val mdThemeDarkOnPrimary = mdThemeLightOnPrimary | ||
private val mdThemeDarkInversePrimary = mdThemeDarkOnPrimary | ||
private val mdThemeDarkPrimaryContainer = mdThemeLightPrimaryContainer | ||
private val mdThemeDarkOnPrimaryContainer = mdThemeLightOnPrimaryContainer | ||
private val mdThemeDarkSecondary = mdThemeLightSecondary | ||
private val mdThemeDarkOnSecondary = mdThemeLightOnSecondary | ||
private val mdThemeDarkSecondaryContainer = mdThemeLightSecondaryContainer | ||
private val mdThemeDarkOnSecondaryContainer = mdThemeLightOnSecondaryContainer | ||
private val mdThemeDarkTertiary = mdThemeLightTertiary | ||
private val mdThemeDarkOnTertiary = mdThemeLightOnTertiary | ||
private val mdThemeDarkTertiaryContainer = mdThemeLightTertiaryContainer | ||
private val mdThemeDarkOnTertiaryContainer = mdThemeLightOnTertiaryContainer | ||
private val mdThemeDarkError = mdThemeLightError | ||
private val mdThemeDarkOnError = mdThemeLightOnError | ||
private val mdThemeDarkErrorContainer = Color(0xFF93000A) // Destructive, Flamingo 0 | ||
private val mdThemeDarkOnErrorContainer = Color(0xFFFFDAD6) // Destructive, Flamingo 0 | ||
private val mdThemeDarkBackground = Color(0xFF1A1D21) | ||
private val mdThemeDarkOnBackground = Color(0xFFD1D2D3) | ||
private val mdThemeDarkSurface = Color(0xFF1A1D21) | ||
private val mdThemeDarkOnSurface = Color(0xFFD1D2D3) | ||
private val mdThemeDarkInverseSurface = Color(0xFFE4E2E6) // Inverse of surface | ||
private val mdThemeDarkInverseOnSurface = Color(0xFF1B1B1F) // Inverse of onSurface | ||
private val mdThemeDarkSurfaceVariant = Color(0xFF252425) // Container Gray 10 | ||
private val mdThemeDarkOnSurfaceVariant = Color(0xFFC5C6D0) // On Inverse Variant 1 | ||
/** | ||
* We don't want tonal tinting but we _do_ want to lighten the surface color when elevated. The | ||
* metaphor is that it's closer to the light source, so we just lighten with white. | ||
*/ | ||
private val mdThemeDarkSurfaceTint = Color(0xFFFFFFFF) | ||
private val mdThemeDarkOutline = Color(0xFF8F9099) // Outline Primary | ||
private val mdThemeDarkShadow = Color(0xFF000000) // Background / Modal | ||
|
||
val LightTheme = | ||
lightColorScheme( | ||
primary = mdThemeLightPrimary, | ||
onPrimary = mdThemeLightOnPrimary, | ||
primaryContainer = mdThemeLightPrimaryContainer, | ||
onPrimaryContainer = mdThemeLightOnPrimaryContainer, | ||
secondary = mdThemeLightSecondary, | ||
onSecondary = mdThemeLightOnSecondary, | ||
secondaryContainer = mdThemeLightSecondaryContainer, | ||
onSecondaryContainer = mdThemeLightOnSecondaryContainer, | ||
tertiary = mdThemeLightTertiary, | ||
onTertiary = mdThemeLightOnTertiary, | ||
tertiaryContainer = mdThemeLightTertiaryContainer, | ||
onTertiaryContainer = mdThemeLightOnTertiaryContainer, | ||
error = mdThemeLightError, | ||
errorContainer = mdThemeLightErrorContainer, | ||
onError = mdThemeLightOnError, | ||
onErrorContainer = mdThemeLightOnErrorContainer, | ||
background = mdThemeLightBackground, | ||
onBackground = mdThemeLightOnBackground, | ||
surface = mdThemeLightSurface, | ||
onSurface = mdThemeLightOnSurface, | ||
surfaceVariant = mdThemeLightSurfaceVariant, | ||
onSurfaceVariant = mdThemeLightOnSurfaceVariant, | ||
outline = mdThemeLightOutline, | ||
inverseOnSurface = mdThemeLightInverseOnSurface, | ||
inverseSurface = mdThemeLightInverseSurface, | ||
inversePrimary = mdThemeLightInversePrimary, | ||
surfaceTint = mdThemeLightSurfaceTint, | ||
scrim = mdThemeLightShadow, | ||
) | ||
|
||
val DarkTheme = | ||
darkColorScheme( | ||
primary = mdThemeDarkPrimary, | ||
onPrimary = mdThemeDarkOnPrimary, | ||
primaryContainer = mdThemeDarkPrimaryContainer, | ||
onPrimaryContainer = mdThemeDarkOnPrimaryContainer, | ||
secondary = mdThemeDarkSecondary, | ||
onSecondary = mdThemeDarkOnSecondary, | ||
secondaryContainer = mdThemeDarkSecondaryContainer, | ||
onSecondaryContainer = mdThemeDarkOnSecondaryContainer, | ||
tertiary = mdThemeDarkTertiary, | ||
onTertiary = mdThemeDarkOnTertiary, | ||
tertiaryContainer = mdThemeDarkTertiaryContainer, | ||
onTertiaryContainer = mdThemeDarkOnTertiaryContainer, | ||
error = mdThemeDarkError, | ||
errorContainer = mdThemeDarkErrorContainer, | ||
onError = mdThemeDarkOnError, | ||
onErrorContainer = mdThemeDarkOnErrorContainer, | ||
background = mdThemeDarkBackground, | ||
onBackground = mdThemeDarkOnBackground, | ||
surface = mdThemeDarkSurface, | ||
onSurface = mdThemeDarkOnSurface, | ||
surfaceVariant = mdThemeDarkSurfaceVariant, | ||
onSurfaceVariant = mdThemeDarkOnSurfaceVariant, | ||
outline = mdThemeDarkOutline, | ||
inverseOnSurface = mdThemeDarkInverseOnSurface, | ||
inverseSurface = mdThemeDarkInverseSurface, | ||
inversePrimary = mdThemeDarkInversePrimary, | ||
surfaceTint = mdThemeDarkSurfaceTint, | ||
scrim = mdThemeDarkShadow, | ||
) | ||
} |
47 changes: 47 additions & 0 deletions
47
skate-plugin/src/main/kotlin/com/slack/sgp/intellij/projectgen/PrefixTransformation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2024 Slack Technologies, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.slack.sgp.intellij.projectgen | ||
|
||
import androidx.compose.ui.text.AnnotatedString | ||
import androidx.compose.ui.text.input.OffsetMapping | ||
import androidx.compose.ui.text.input.TransformedText | ||
import androidx.compose.ui.text.input.VisualTransformation | ||
|
||
class PrefixTransformation(val prefix: String) : VisualTransformation { | ||
override fun filter(text: AnnotatedString): TransformedText { | ||
return prefixFilter(text, prefix) | ||
} | ||
} | ||
|
||
private fun prefixFilter(number: AnnotatedString, prefix: String): TransformedText { | ||
|
||
val out = prefix + number.text | ||
val prefixOffset = prefix.length | ||
|
||
val numberOffsetTranslator = | ||
object : OffsetMapping { | ||
override fun originalToTransformed(offset: Int): Int { | ||
return offset + prefixOffset | ||
} | ||
|
||
override fun transformedToOriginal(offset: Int): Int { | ||
if (offset <= prefixOffset - 1) return prefixOffset | ||
return offset - prefixOffset | ||
} | ||
} | ||
|
||
return TransformedText(AnnotatedString(out), numberOffsetTranslator) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may also need the kotlin.multiplatform plugin here in place of kotlin.jvm but not sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking since Skate is Intellij plugin, having kotlin.jvm should be enough. Does having kotlin.multiplatform mean we'll extend to other platforms like iOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily, it just sets up the KMP structure. If you look at the build file in the original repo, it does the same thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see. I can try moving the KMP structure over