Commit Graph

6 Commits

Author SHA1 Message Date
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
5039d186ad Improve Markdown styling (#392)
* Fix wrong block content colour on bridge MD style

* Allow specifying default text style in standalone

* Update API dumps
GitOrigin-RevId: e0bfcce3cb378713801fc851e4b01e4d52ed999e
2024-06-04 21:51:03 +02:00
Sebastiano Poggi
bc526d2baa Move Markdown actual styling to bridge/standalone packages (#379)
Having them all in the same package caused problems when trying to apply
the style in the code; in particular, when your prod code uses bridge
but the tests use standalone, you'd end up with both variants on the
classpath, and it would be impossible to choose which one to use when.

This moves all bridge theming to .bridge, and all standalone theming in
.standalone, to clearly distinguish them. I also renamed the various
theming files to fit the common naming pattern we use elsewhere in the
library.
GitOrigin-RevId: e0132f8a5250819d1a9f9b4b91131dd97ce3b97f
2024-05-09 14:13:06 +02:00
Sebastiano Poggi
bbd908d56d Add Markdown styling to theme (#367)
Add Markdown styling to theme, add simple components

We were lacking a good, easy way to render Markdown, requiring a lot of
ceremony. Now it's much easier, you just need to provide the styling,
renderer, and processor as composition locals (with the defaults
coming from ProvideMarkdownStyling). Then use either Markdown(), or
LazyMarkdown(), and your content is displayed. Better!

I have updated the samples to show how it works.
GitOrigin-RevId: 640332b12241a0f3d938075cd13b56367c6a8a75
2024-04-26 09:25:37 +00:00
Sebastiano Poggi
bf7086af15 Add onTextClick to MarkdownBlockRenderer (#366)
* Fix text colour in Markdown (bridge)

We were not setting the right text colour when creating the bridge
Markdown Styling. Now we make sure we do respect the colour
set in the various InlinesStyle's TextStyles when rendering inlines.

In addition, I've added a simple API to be able to initialize a
MarkdownStyling in the bridge based only on a base TextStyle. This is
useful, e.g., when you want to make smaller text such as comments.

* Add onTextClick to MarkdownBlockRenderer

This is a workaround to the fact that ClickableText swallows all clicks,
since its onClick lambda has no way of saying if it did handle a click.

Hopefully this won't be needed anymore when we move to Compose 1.7,
which brings in a proper LinkAnnotation.
GitOrigin-RevId: 007b5d1c0def14d9888b631620058fdac5ea0b88
2024-04-26 09:18:49 +00:00
Sebastiano Poggi
caee40fe5f Reorganize and expand the Markdown modules
* Split out theming from Core (except for jewel.ui deps)
 * Implement both bridge and standalone Int UI themes
 * Reorganize modules to make adding extensions easier
 * Add Markdown rendering to IDE plugin sample

> [!NOTE]
> The leaf modules are named `*Styling` because Gradle doesn't allow you
> to have modules with the same name and that depend on each other. It
> says it's a circular dependency, even if it's not (the modules have
> different paths). Since the Standalone Markdown module depends on the
> Int UI Standalone, and the Bridge Markdown depends on the Bridge
> theme, this would break the build. We are, however, going to try and
> figure this out so that we can remove the suffix.

GitOrigin-RevId: b09149173a5adfd2215ca9d49db7df0af705d845
2024-03-26 18:11:56 +00:00