Class Tokens

java.lang.Object
limn.components.Tokens

public final class Tokens extends Object
Pushes resolved SizeTokens spacing into the geometry-only containers, which hold plain floats and therefore cannot follow a size step on their own.

Flex.gap and Padding.insets are literals: a bare row.setControlSize(SMALL) compacts every child and leaves the gutters between them at whatever number the app typed, and an app that writes col.gap(theme.spacingMedium) bakes MEDIUM in permanently. The spacing ramp is the widest of the three (3.33x), so leaving it unreachable would discard most of the visible effect of changing step.

Two ways to use this. Prefer TokenRow / TokenColumn / TokenPadding, which push on every measure pass and therefore track a step change with no app code. Call the static forms directly only where a container is already owned by something else.

See Also:
  • Method Details

    • spacing

      public static float spacing(SizeTokens tokens, Tokens.Role role)
      Returns:
      the spacing value for role out of tokens
    • spacingFor

      public static float spacingFor(Widget widget, Tokens.Role role)
      Returns:
      the spacing for role at the step resolved on widget
    • applyGap

      public static void applyGap(Flex flex, Tokens.Role role)
      Sets flex's gap from the step resolved on it. Idempotent (Flex.gap carries an equality guard), so calling this from a measure path does not loop.
    • applyInsets

      public static void applyInsets(Padding padding, Tokens.Role role)
      Sets padding's insets, uniformly, from the step resolved on it.
    • toggleColumnGap

      public static float toggleColumnGap(Widget widget)
      The gap a column of Checkbox or RadioButton rows needs so that stacked toggles clear WCAG 2.2 SC 2.5.8's Spacing exception: a toggle row is 18pt at three steps, so the pitch row + gap must reach 24.

      Exposed as a call rather than pushed by a container, because a TokenColumn cannot know its children are toggles. An app stacking toggles applies it explicitly: col.gap(Tokens.toggleColumnGap(col)). Without it, stacked toggles keep a 21/22pt pitch at the dense steps, the same sub-24 admission the toggles themselves carry at MEDIUM today.