Skip to content

Aura utility classes API [2 days] #9347

@rolfsmeds

Description

@rolfsmeds

Describe your motivation

The Aura theme already has a set of classnames for applying its colors to elements, like aura-accent-color, aura-accent-red, aura-surface, aura-surface-solid, etc, but there is no Flow API for easy use of them in Java code.

More similar classes are likely to be added in the future.

Additionally, an alternative to Tailwind may become necessary, as it seems to be difficult to integrate successfully and completely into the framework. This would presumably be in the shape of something very similar to the LumoUtility classes/API for the Lumo theme.

Describe the solution you'd like

Mimicing LumoUtility would be the most obvious API shape:

  • AuraUtility.Background.ACCENT
  • AuraUtility.Background.SURFACE_SOLID...

However, it might make more sense to have these under the Aura class which already has constants like Aura.STYLESHEET, and use naming that is a clearer match for the addClassNames API, e.g.:

  • Aura.ClassNames.Background.ACCENT
  • Aura.ClassNames.Background.SURFACE_SOLID...

(While a bit more verbose, this helps by scoping everything Aura-specific under the Aura class, and puts these constants in the autocomplete list when the developer types addClassNames(classname.)

Or, we could forego the addClassNames API altogether and provide a reverse API for Aura classnames (with the benefit that it would provide a more natural fit for parameters like surface level):

  • Aura.Styles.Background.SURFACE.withLevel(-1).applyTo(div)

Although I suppose an API shape just as decent could be provided with a more traditional API shape, e.g. Aura.setSurfaceLevel(-1, someDiv, someSpan)

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions