lume / lume/element

functional CSS

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
TypeScript
Stars
187
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Make a simple abstraction that can take a piece of CSS, generate a stylesheet from it, and provide the end developer a function that can be called in order to pass values for CSS variables/properties.

Initial description of the idea is in https://github.com/postcss/postcss/issues/476#issuecomment-633678669.

Basically given the following CSS,

```css
.foo {
--some-prop: 1px;
/* ... styles that use var(--some-prop) ... */
}
```

we can implement some a tool on the JS side that automatically gives you a simple abstraction:

```js
css = css`
.foo {
--some-prop: 1px;
/* ... styles that use var(--some-prop) ... */
}
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.css.update({someProp: '10px'})
```

This will help pave the way towards using reactive variables within CSS styles in a performant way.

Another ideas is we can abstract it so that the `css` template tag can automatically perform the property update internally:

```js
css = css`
.foo {
--some-prop: ${this.foo};
/* ... styles that use var(--some-prop) ... */
}
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.foo = '10px'
```

where `this.foo` is a reactive property.

Or maybe we just auto-create reactive accessors:

```js
css = css`
.foo {
--some-prop: 1px;
/* ... styles that use var(--some-prop) ... */
}
`

// ... call this any time later to update the style's `--some-prop` variable ...
this.css.someProp = '10px'
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked PostCSS issue comment and then inspect the repository for existing styling, template-tag, or custom-element entry points; no files or tests are named here. Before implementation, choose and document one of the proposed APIs and define how CSS variables, generated stylesheets, and reactive updates should behave. Done means the selected abstraction is implemented with tests covering its stated update behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript, typescript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.