Commit Graph

457 Commits

Author SHA1 Message Date
Sebastiano Poggi
28d0642e2d Be more specific in IDE sample run config (#456)
This somehow fixes the random java.lang.NoClassDefFoundError:
org/jetbrains/jewel/bridge/ToolWindowExtensionsKt that we've been seeing
on main when using JBR-21 as the project JDK.
GitOrigin-RevId: 2e93656dc77e625758573c3c9bc7d42cd0537e2d
2024-07-18 12:43:31 +02:00
Sebastiano Poggi
d5d59269db Implement proper Markdown link styling (#455)
We weren't using the TextLinkStyles provided by the LinkAnnotation API,
and as a result, our links weren't stateful. We were also not properly
setting a disabled colour — now we do.

Also changed, we force the Markdown text to not be focusable, even if it
is clickable, since we don't want it to get focused. Now only links are
focused while tabbing through Markdown.

This also removes some testing harness left around from #425, and that
we don't need anymore.

Note: links should have a border around them when they are focused, but
that's not possible with the Compose APIs. What we do instead is show
a subtle background color,
taken from the ActionButtons' hover and pressed states, for our focused
and pressed states, respectively.
GitOrigin-RevId: 8cd3eee5791dbdb5f4f96f4e569e1f28923d1619
2024-07-18 08:51:52 +00:00
Sebastiano Poggi
453467b456 Bump version to 0.20.0
GitOrigin-RevId: 819c9982c1b91507347db4449dee0e0cf33c6c15
2024-07-17 13:05:09 +02:00
Sebastiano Poggi
d0bc7b11d2 Fix menu border width in bridge (#452)
GitOrigin-RevId: dbe022326504f34a6898b096a247cc0f3a8c82a1
2024-07-17 13:03:21 +02:00
Sebastiano Poggi
c3e16da465 Remove ktlint IJ plugin from required plugins (#451)
While it's nice to get ktlint warnings in the IDE, the ktlint IJ plugin
shows an obnoxious editor banner when working on projects where it's not
used.

Since we all work on other projects, and because their maintainers are
not open to improving the UX, I don't recommend keeping this plugin
anymore.
GitOrigin-RevId: a96ab4b26228241b0e874659f7733c66ed8d04fe
2024-07-17 08:41:42 +00:00
Rivan Parmar
bd703f35e9 Add segmented controls (#387)
* Add segmented controls

* Fix colors and focus behaviour of segmented controls

* Modify focus behaviour and colors of segmented controls

* Add segmented controls

* Fix colors and focus behaviour of segmented controls

* Modify focus behaviour and colors of segmented controls

* Tweak implementation to match actual impl/behaviour

The one thing that is still TODO is avoid focusing the control when it's
clicked. I removed the previous "clear focus" behaviour because it
clears the focus on click even when it shouldn't. I'll come up with a
better solution as soon as I can.

* Change focus behaviour to match Swing's

We made the buttons not focusable anymore, to prevent unwanted focus
movement. There is a bit of focus dark magic, but it now works as we'd
expect.

* Update segmented controls api

---------

Co-authored-by: Sebastiano Poggi <sebp@google.com>
GitOrigin-RevId: 3e847ba84adc08a489518d73ecdc8bd9410b483b
2024-07-16 12:07:14 +00:00
Sebastiano Poggi
db50a0d315 Add ActionButton component (#450)
It's like IconActionButton, but it doesn't necessarily hold an icon. For
example, it can be used to implement an equivalent to Swing's
ActionButtonWithText component.

There is a standalone sample, too
GitOrigin-RevId: d26c03d42841d25535d861f0c67941270e16a6dd
2024-07-15 18:12:27 +02:00
Sebastiano Poggi
5cce14f302 Add Icon action button (#449)
* Implement IconActionButton

It's a thin wrapper around IconButton that is slightly easier to use and
can also render a tooltip.

Added sample, too (standalone only).

* Update API signatures
GitOrigin-RevId: 241e7841cc076e16aed42f1bab22e3cb2221397e
2024-07-15 16:57:17 +02:00
Sebastiano Poggi
1cbeeb112f Fix colour keys in bridge (#448)
We had some en-GB key name spelling (Grey) which wasn't found at runtime
since the actual palette uses en-US spelling (Gray). This PR fixes it.
GitOrigin-RevId: cfeec86b43bd99bde3c32a6a720e78e8c68f6180
2024-07-15 15:39:27 +02:00
Sebastiano Poggi
e8bc9ea3bd Minor updates to the build files (#442)
* Minor updates to the build files

* Remove javaToolchain, rely only on Kotlin's

* Remove one more javaToolchain
GitOrigin-RevId: fbd2b0301c515e607838fb2b0a242263b99e2f0a
2024-07-15 14:42:54 +02:00
Sebastiano Poggi
8ea4bf89d3 Improve icon buttons by making them optionally focusable (#447)
* Improve icon buttons by making them optionally focusable

While in the IJP ActionButtons aren't focusable by default when in
toolbars, we do want them to be, because 1) it's the right thing to do
to improve keyboard navigation, and b) Studio needs this.

* add missing trailing comma in Buttons

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

---------

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>
Co-authored-by: Ivan Morgillo <imorgillo@gmail.com>
GitOrigin-RevId: 7ab07123a49d54354e534afe6cac4cf71b634d12
2024-07-15 12:57:15 +02:00
Sebastiano Poggi
661bf5c930 Update 242 IJ Platform to beta 1 (#446)
* Bump IJP to 242.20224.38 (242 beta 1)

* Update icon keys generator to use IconPathProvider

This simplifies considerably our code since we do not need to parse the
json mappings anymore.

* Update AllIconsKeys with new icons

* Fix icon keys generator to handle weird partial paths
GitOrigin-RevId: b7d67302ee13e031efeaea7a500f6c310b4a8591
2024-07-15 10:59:52 +02:00
Ivan Morgillo
916e2796b0 Add JewelLogger (#443)
* add kotlin-logging to stand alone app

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in ChipsAndTree

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* iterate on the logger template

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logged in Views.kt

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* idea.log path has changed 🤷

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* add logger to IDE sample

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* move LoggerRt into Jewel

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* fix Compose lint warnings in ComponentShowcaseTab

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* rename logger to JewelLogger

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* migrate standalone to JewelLogger

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in JewelDemoAction

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in StandalonePainterHintsProvider

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in ResourcePainterProvider

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* add missing empty line at EOF in libs.versions.toml

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* add debug() for Java logger

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* add and test .trace() to Java logger

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* tune logger setup for IDE plugin scenario

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* fix logger category for Views.kt

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* fix logger category for ChipsAndTree

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* remove unused logback configuration

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in StandalonePainterHintsProvider

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* replace logger in ResourcePainterProvider

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* address PR comments

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* iterate on logger usage in ResourcePainterProvider

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* refactor JewelLogger instance factory creation

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* run apiDump

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* move log to info in ChipsAndTree

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

* address PR review feedback

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

---------

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>
GitOrigin-RevId: d6f89b000bb75b0eb4461867671f9d02d74daa20
2024-07-11 16:03:49 +02:00
Sebastiano Poggi
f1a6ac3478 Allow customizing the CommonMark Parser (#444)
This is required by one of our customers, and it allows them to
customize the handling of standard tags (e.g., remove images).

It is an opt-in behaviour and it does not impact existing Markdown
handling code or behaviour.
GitOrigin-RevId: 81cb5b7f45f84b1d5946eb5d9da4ba94e91f3fd1
2024-07-10 18:38:41 +02:00
Sebastiano Poggi
6df91718f0 Cleanup icons in samples (#441)
* Replace icon paths with keys

* Use icon keys everywhere in samples
GitOrigin-RevId: 1de2cf93f26189bcc5b7ef6cd0c4d1387420c50d
2024-07-10 16:12:17 +02:00
Sebastiano Poggi
9e40d39cfc Fix snapshot publishing version (#440)
GitOrigin-RevId: 5739680e5b9f931c5be2c019a3a281f8d30aa05f
2024-07-09 11:02:17 +00:00
Ivan Morgillo
d1aa1e7738 Migrate to the new LinkAnnotation API (#425)
* replace deprecated UrlAnnotation with LinkAnnotation

* extract determinePointerIcon()

* Replace deprecated UrlAnnotation with LinkAnnotation

* replace deprecated ClickableText

* Introduced LinkAnnotation.Clickable to drive the behaviour of links
* Replaced SimpleClickableText with the good ol' Text
* Successfully wired onUrlClick and onTextClick lambdas
and the enabled flag.



* update api files

* add disabled UI for links

When links are disabled, we show something that looks like a link,
but it's not clickable and has no 👆 pointer icon.

* add a checkbox to toggle links in the Markdown standalone showcase
GitOrigin-RevId: 1e9d914f6734223d39b8472dba08a89a69ab47ef
2024-07-09 12:49:52 +02:00
Ivan Morgillo
605a09ae38 Refresh Jewel Markdown README (#438)
* add a markdown string to README

* add a disclaimer comment to MarkdownPreview.kt

* refresh Markdown README

* fix a typo in README.md

* address PR comments

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>

---------

Signed-off-by: Ivan Morgillo <imorgillo@gmail.com>
GitOrigin-RevId: d90c92771574610b7a4d5d1e9f34731b767a3756
2024-07-09 12:15:42 +02:00
Sebastiano Poggi
323a39365b Replace icon paths with keys (#439)
* Replace icon paths with keys

* Clean up lint warnings
GitOrigin-RevId: bc7ccb8ef8d490dea692fa756b653004cfbaf2e8
2024-07-09 11:16:05 +02:00
Sebastiano Poggi
634df19d7b Fix publication issues (#435)
1. Allow bypassing signing (to test locally)
2. Fix task dependencies
3. Clean up build
GitOrigin-RevId: 1ec5ce4f6d06f41541c7ff877d63c33509340738
2024-07-06 13:03:19 +08:00
Sebastiano Poggi
9808509ea7 Fix MD code font in dark standalone theme (#436)
We were using the default by mistake
GitOrigin-RevId: d0e6b2e67fba5d12fe36404bf4636d78378462fc
2024-07-06 13:02:40 +08:00
Sebastiano Poggi
823b62a7b2 Add releases branch to CI checks on push
GitOrigin-RevId: 73fae3bd594b8eb604b1f5f8b85f58a00368fdce
2024-07-05 19:13:14 +01:00
Sebastiano Poggi
beec2163b3 Use editorTextStyle in MarkdownEditor
GitOrigin-RevId: 179bb345438bf04b95d88fa61135acd327d3d3f0
2024-07-05 19:12:17 +01:00
Sebastiano Poggi
fbaee0c443 Disable structural wrapping inspection
GitOrigin-RevId: cd5af68d49e8e87746a3640e634710f765dc3809
2024-07-05 19:06:31 +01:00
Sebastiano Poggi
ef1954ec56 Use IJ distributions for compilation of sample (#434)
Also improves the IJP version detection/validation
GitOrigin-RevId: 7f640703b6063cce392a484aad7fe8a2487cf730
2024-07-05 17:33:37 +00:00
Sebastiano Poggi
1a69f821d5 Bump ide sample heap size to 3 GB
242 uses more memory and we keep getting "low memory" warnings

GitOrigin-RevId: f4dfb3004888acc52f2063bcef6517c44bb277d1
2024-07-05 16:53:19 +01:00
Sebastiano Poggi
d17fbb5d0f Fix 242 icon loading by providing new key-based API (#430)
* Implement icon keys generator

This gradle task generates the icon keys for the platform icons that
we'll need to load icons from a key instead of a path.

* Define IconIdInterpreter and NewUiChecker

* Do icon key generation for AllIcons in ui module

* Implement proper key-based icon loading

* Remove old TODO and unused code

* Undo change to run config

* Rename AllIcons to PlatformIcon, move to its own file

* Remove unnecessary suppression

* Run apiDump

* Made icon generation more maintainable (#432)

* Made icon generation more maintainable

* Cleanup code

* Fix ktlint implicitly trying to check generated code

---------

Co-authored-by: Sebastiano Poggi <sebp@google.com>

---------

Co-authored-by: Lamberto Basti <basti.lamberto@gmail.com>
GitOrigin-RevId: bb5da85d239a72cc907c6edfe873f96629c6e9d2
2024-07-04 17:10:32 +00:00
Sebastiano Poggi
b412b503e2 Switch to IJP 242 EAP (#391)
This in turn requires:
1. Updating the IJP Gradle plugin to 2.0 (beta)
2. Reworking the IDE sample build.gradle.kts in the new 2.0 syntax
3. Bumping the JBR version to 21
4. Removing CodeQL (we're not using it, it's slow, and it won't pick up
   a JDK 21 no matter how much you want it to)
GitOrigin-RevId: 3b99a25f5c963fe1af42baea63fa43def3f85878
2024-07-02 18:49:38 +02:00
Sebastiano Poggi
5a8179bd48 Add releases/241 to CI
GitOrigin-RevId: c7afd7da6b472d5e780a575bc95255bc99abf4f9
2024-07-02 17:23:12 +02:00
Sebastiano Poggi
c33daccace Bump Jewel version to 0.19.7
GitOrigin-RevId: 7858c09df662ad37a6c870771db7b68c48c71cc5
2024-07-01 18:23:09 +02:00
Sebastiano Poggi
a9d1c3e26a Add documentation on releasing new Jewel versions
GitOrigin-RevId: dc7d65fe51cd1cdfcf862fdddee280c3a8fed755
2024-07-01 18:23:09 +02:00
Sebastiano Poggi
7e627029da Fix soft line breaks treated as hard line breaks (#423)
GitOrigin-RevId: 89c983cc9cd4fa4448431bc511dbdbf65263eeeb
2024-07-01 17:33:15 +02:00
Ivan Morgillo
ab3d8bd363 Upgrade to Compose 1.7.0-dev1703 (#421)
upgrade to Compose 1.7.0-dev1703
GitOrigin-RevId: 60667163a059122eb53ed14fe6ac439d46258edb
2024-07-01 16:43:01 +02:00
Sebastiano Poggi
0d60899bce Add Pre-push configuration
This configuration updates the API dumps and runs ktlint formatter,
making it easier to check everything is a-ok before pushing.

GitOrigin-RevId: 67c971ac0b6c61d27fd0ba971ef5edd4892fcaac
2024-07-01 16:06:57 +02:00
Sebastiano Poggi
c21185c281 Fix default button focus outline & chip colors (#420)
* The default button was missing spacing between its bg and the focus
  outline. Outlined buttons are unaffected.
* The chips were drawing a double-outline when focused and selected. Now
  they only draw the selected outline if they are both focused and
  selected.
* The chips didn't clearly signal the pressed and selected states. The
  background now reflects these states better (standalone only).
  There are no specs so we're going with a bit more freedom in the
  standalone version, as the Swing impl is quite lacking in polish still
GitOrigin-RevId: f57eba2a16493454cfd978f0a6dedc73e30848bb
2024-07-01 14:54:53 +02:00
Sebastiano Poggi
e4165b7c0a Add default values to retrieve* functions (#408)
Simple syntactic sugar to avoid elvis operators and other checks.
GitOrigin-RevId: 63abd7c069d7bb816ae72ce85765aa3fa756846e
2024-06-14 14:12:45 +02:00
Sebastiano Poggi
63c32ae1b5 Add simple FocusOutline API (#410)
Add an overload for Modifier.focusOutline that takes a simple Boolean
instead of a FocusableComponentState, allowing users to use the modifier
even for components that don't have a FocusableComponentState.
GitOrigin-RevId: 82533beb3507ae3553ec8b9db45acc3ac65dace7
2024-06-14 14:12:27 +02:00
Sebastiano Poggi
310f309890 Fix TextArea layout (#409)
* Content was vertically centred, but should top-aligned
* TextAreas didn't respect incoming min constraints
GitOrigin-RevId: c975f77cd14fa9043e690225fe04f04d70f50f7a
2024-06-14 20:11:32 +08:00
Lamberto Basti
915718f828 Fix for Snapshot publication is broken after adding PGP signing #405 (#407)
* Add PGP signing to publications

Introduce Pretty Good Privacy (PGP) signing to the publication workflows of the project. The signing setup is included in the gradle wiring along with the retrieval of the key details from environment variables. This change is applied in both the publish and hotfix workflows.

* Update key retrieval in build script and workflow file

* Add PGP keys to GitHub Actions workflow

The commit adds PGP_PASSWORD and PGP_PRIVATE_KEY to the environment variables in the publication workflow. These additions permit secure, authenticated signing of packages before publication.
GitOrigin-RevId: cdcb05ed8f159d3c880cc306bbb6605f0788f7d2
2024-06-13 18:09:13 +02:00
Lamberto Basti
39e66647c5 Add PGP signing to publications (#403)
* Add PGP signing to publications

Introduce Pretty Good Privacy (PGP) signing to the publication workflows of the project. The signing setup is included in the gradle wiring along with the retrieval of the key details from environment variables. This change is applied in both the publish and hotfix workflows.

* Update key retrieval in build script and workflow file

---------

Co-authored-by: Sebastiano Poggi <rock3r@users.noreply.github.com>
GitOrigin-RevId: df2e29049dfc5d5be47c5a78866afddf293f0da1
2024-06-13 14:42:05 +02:00
Lamberto Basti
c0edb964d0 Remove erroneous imports and update resourcesDirs convention (#402)
Generated accessors should not be imported. Use project accessors instead
GitOrigin-RevId: ecb0072df9048b8d7f6041b524e8961cd607a307
2024-06-13 10:58:59 +02:00
Sebastiano Poggi
dbcccf49a4 Update target IJP to 241.17890.1 (#400)
GitOrigin-RevId: 6710052ff932ab63a5966b116a44ac9bffcdcc8c
2024-06-12 10:09:24 +02:00
Sebastiano Poggi
a72d237300 Bump version to 0.19.6
GitOrigin-RevId: 5174f0efc94f348c2536d4c1e8ef537cf124550f
2024-06-10 17:38:05 +02:00
Sebastiano Poggi
f9003c88b8 Improve font setup in standalone demo
GitOrigin-RevId: 9ee58cf8ebeaa84c854e0eb7e43748c69074aacd
2024-06-10 17:37:49 +02:00
Sebastiano Poggi
539e856d1b Update Kotlin for 241, update all dependencies (#398)
* Update all dependencies yey

* Update API files after Kotlin update

* Update Kotlinter Gradle plugin

* Run ktlint -f (lotsa changes)

Looks like we've been on a pretty old ktlint version; new ones are much
stricter/more powerful and so a lot of changes ensued.

This also:
1. Downgrades sarif4k to 0.5.0 (see
   https://github.com/jeremymailen/kotlinter-gradle/issues/382)
2. Updates the IDE code style to match ktlint's

* Uncomment code in AndroidStudioReleases.kt
GitOrigin-RevId: 9d677ac1d10ee4fedf11a2bf5892dc9af21195b4
2024-06-10 17:20:31 +02:00
Sebastiano Poggi
2f4db53b8d Fix Markdown styling usage, and add semantics support (#397)
* Fix Markdown functions not using provided styling

* Add semantics support to Markdown, move to right package

Usage in tests:

```kotlin
fun SemanticsNodeInteraction.assertMarkdownEquals(
  expected: String
): SemanticsNodeInteraction =
  assert(hasMarkdownExactly(expected))

private fun hasMarkdownExactly(expected: String): SemanticsMatcher =
  SemanticsMatcher.expectValue(RawMarkdown, expected)
```

* Update API dump
GitOrigin-RevId: 924c43e227c99043a80400a9d13f168c4ed68819
2024-06-10 12:54:16 +02:00
Sebastiano Poggi
7aeed7c239 Bump version to 0.19.5
GitOrigin-RevId: 8a4185731165d292ee2588cf572c6f992e4f9202
2024-06-05 10:39:26 +02:00
Sebastiano Poggi
a94a188316 Minor fix — use the correct font for the console TextStyle
GitOrigin-RevId: 958de6e627aab7512ee575fcb712ed8c38c0f5ef
2024-06-05 10:39:11 +02:00
Sebastiano Poggi
7b443ac9b1 Add editor & console text styles, use them in Markdown (#393)
The IDE also has an editor and a console text style, which come from the
editor color scheme. We weren't using them until now, but we now fully
comply to it in the Markdown rendering, too.
GitOrigin-RevId: 6732d567e0a22155ac6b3b0a05c8ab5e371296a3
2024-06-05 08:35:55 +00:00
Sebastiano Poggi
d69ed045e6 Bump version to 0.19.4
GitOrigin-RevId: 64fff14533b5163b12fc9bea0a99c1fb0b5a18fc
2024-06-05 09:32:01 +02:00