Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space shorthands #39

Open
robb-j opened this issue Jan 17, 2023 · 0 comments
Open

Space shorthands #39

robb-j opened this issue Jan 17, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@robb-j
Copy link
Member

robb-j commented Jan 17, 2023

Alembic could have global shorthands that any element could use if it wanted, the first example would be to make "scale" variables easier to use in layouts.

e.g. space="s1" rather than space="var(--s1)".

A human-friendly convention here makes sense, though it should be properly thought-out. Some ideas that come to mind:

  • Just numbers for spacing — 1
  • Prefixed with "s" — s4
  • Function style — space(1)
  • Variable style — --s1

These mappings could be held in a central place so they can be accessed by any custom element and promote consistency, so each component doesn't have to implement the logic itself.

const shorthands = {
  's-5': 'var(--s-5)',
  // ...
  's0': 'var(--s)',
  // ...
  's4': 'var(--s4)',
  's5': 'var(--s5)'
}

It might be interesting to open these up to alembic consumers so they can add their own shorthands or replace them?

An offshoot of this idea is a set of flags to pass to alembic, like feature flags:

const flags = {
  experimental: {
    spaceShorthands: true
  }
}
@robb-j robb-j added the enhancement New feature or request label Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant