From one CSS variable plugin generate derivatives

Created on 23 November 2023, about 1 year ago

Problem/Motivation

After discussion about πŸ“Œ Bootstrap 5: Do we need all those CSS variables? Postponed .

We need to provide a way to generate other CSS variables from one CSS variable plugin in order to reduce the number of CSS variables in some design systems. Even if it would be better that this would be fixed upstream.

For UI Suite Bootstrap, to avoid:
- the color and RGB color variables couple
- to have too many color variables and colors by componant.

Proposed resolution

my_variable:
  ...
  derivatives:
    other_variable:
      transformation_plugin_id:
        plugin_configuration

So we need to define a transformation plugin type.

Remaining tasks

User interface changes

Remove variables in UI Suite Bootstrap.

API changes

Data model changes

✨ Feature request
Status

Active

Version

1.0

Component

User interface

Created by

πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Grimreaper
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • First commit to issue fork.
  • Assigned to niber
  • Status changed to Needs work 5 months ago
  • Pipeline finished with Failed
    5 months ago
    Total: 6758s
    #233979
  • Pipeline finished with Success
    5 months ago
    Total: 159s
    #234063
  • Pipeline finished with Success
    5 months ago
    Total: 164s
    #234067
  • Pipeline finished with Success
    5 months ago
    Total: 159s
    #234072
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • Assigned to niber
  • Status changed to Active 5 months ago
  • Adding disabled informative fields for each derivative css variables in UI.

  • Pipeline finished with Success
    5 months ago
    Total: 153s
    #234769
  • For now, only support Hex to RGB and RGB to Hex transformation, the issue stays active.
    An example format for Yml configuration :

    bs_primary:
      category: "Colors"
      type: "color"
      label: "Primary"
      default_values:
        ":root": "#0d6efd"
      weight: 1
      derivatives:
        bs_primary_rgb:
          transformation_plugin_id: "hex_to_rgb"
        bs_secondary_bg_rgb:
          transformation_plugin_id: "hex_to_rgb"
    
  • Pipeline finished with Success
    5 months ago
    Total: 162s
    #237017
  • Pipeline finished with Success
    5 months ago
    Total: 158s
    #237030
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • πŸ‡«πŸ‡·France pdureau Paris

    Hello,

    Do we need to make the transformation visible from the UI ? It is an low-level API stuff, the site administrator doesn't care about the design system having "aliases" for CSS variables.Cordiale

  • Assigned to Grimreaper
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • πŸ‡ΊπŸ‡ΈUnited States bunthorne

    I don't know if this is helpful, but from a simplistic perspective of a site builder with minimal needs it would be great to be able to choose just the primary and secondary colors that would generate all of the relevant color choices, or even a third color if that is part of the set. Is that the goal of this issue?

  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Hi,

    @bunthorne, it is the goal of this issue.

  • Issue was unassigned.
  • Status changed to Needs work 5 months ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Thanks for your work, with MR, screenshot and code example.

    See my code review comment, which is aligned with comment 15.

    I opened an issue on UI Suite Boostrap ✨ POC CSS variables derivative Active to put the POC in parallel of the transformation plugins created here, so easier for people to test and have a concrete example.

  • Pipeline finished with Canceled
    4 months ago
    Total: 76s
    #245880
  • Pipeline finished with Success
    4 months ago
    #245881
  • Status changed to Active 4 months ago
  • Hello, thanks for the review !

    I removed the disabled fields showing derivatives, and changed a a bit the structure of the ui_skins.css_variables.yml :

    bs_primary:
      category: "Colors"
      type: "color"
      label: "Primary"
      default_values:
        ":root": "#0d6efd"
      weight: 1
      derivatives:
        bs_primary_rgb:
          "hex_to_rgb":
            - key1: 'value1'
            - key2: 'value2'
            - key3: 'value3'
        bs_secondary_rgb:
          "hex_to_rgb": {}
    

    We are now able to pass configuration options to our derivative variables.

  • Status changed to Needs review 4 months ago
  • Assigned to niber
  • Status changed to Active 4 months ago
  • Pipeline finished with Failed
    4 months ago
    Total: 159s
    #251445
  • Pipeline finished with Failed
    4 months ago
    Total: 166s
    #251472
  • Pipeline finished with Failed
    4 months ago
    #251484
  • Pipeline finished with Failed
    4 months ago
    #251526
  • Pipeline finished with Failed
    4 months ago
    Total: 263s
    #251619
  • Pipeline finished with Failed
    4 months ago
    Total: 162s
    #251627
  • Pipeline finished with Success
    4 months ago
    Total: 220s
    #251668
  • Pipeline finished with Success
    4 months ago
    #251675
  • Issue was unassigned.
  • Status changed to Needs review 4 months ago
  • Pipeline finished with Success
    4 months ago
    Total: 154s
    #251758
  • Assigned to Grimreaper
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·
  • Status changed to Needs work 4 months ago
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Updated MR to have it working as intended.

    Now needs work based on all the transformers needed for UI Suite Bootstrap. and Needs tests

  • Issue was unassigned.
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Currently not working on it.

    Finishing other issues of ui_suite_bootstrap and other more important issues before coming back here.

Production build 0.71.5 2024