Comments (5)
That is also something I'm considering, but I currently think that limiting computed styles to single attributes is also really good in terms of how it make you shape your components.
Handing big blocks of styling to computed styles would also mean these would rely on runtime styling, and this is not the state of mind Pinceau is trying to promote.
Yet, this is definitely something I could be implementing.
from pinceau.
Maybe we can design an enhanced property. Say $computed to render multiple css properties
Developers will choose them according to their actual situation, which may be a better experience for component library developers or some client pages facing the c side
css({
',text': {
$computed: (props) => {
return {
color: `{color.${props.color}.600}`,
fontSize: `{size.${props.size}}`
}
}
}
})
from pinceau.
I would prefer this syntax:
css({
'.text': (props) => ({
color: `{color.${props.color}.600`,
fontSize: `{size.${props.size}}}`
})
})
I think I can implement that, but I'm just afraid of potential side-effects right now.
Also, I'm afraid it'll be misunderstood as a great way to apply style on groups of styles, while this ain't the case, variants are made for that. 😬
from pinceau.
What are the potential side effects?
I think we could suggest in the documentation a difference between variants and $computed. Like vue https://vuejs.org/guide/essentials/computed.html#computed-caching-vs-methods passages in the document
There are several computed properties which I think give a good dx experience in css pseudo-class states like hover and active focus
from pinceau.
I also think this approach can be a bit confusing,
css({
'.text': (props) => ({
color: `{color.${props.color}.600`,
fontSize: `{size.${props.size}}}`
})
})
With $comouted, developers may be able to visually display which css styles are dynamic and which are static
css({
'.test': {
display: 'flex',
$computed(props) {
return {
'color': 'color.{props.color.600}',
'width': 'size.${props.size}'
}
}
}
})
because there are usually some fixed css styles such as display white-sapce common css properties.
from pinceau.
Related Issues (20)
- cssProp doesn't seems to work HOT 1
- Can we support multiple variants of this form?
- Typescript does not distribute media keys into ComputedStyleProp in TS 5.x
- responsive value under css property HOT 1
- Broken with latest version of Nuxt HOT 5
- How to inspect the source of css? HOT 1
- Switching to monorepo HOT 1
- Sourcemap is likely to be incorrect: a plugin (pinceau-transforms)
- css function properties autocompletion not working HOT 2
- Formatting in `<style lang="ts">` blocks
- Tokens are not working for me (Vite + Vue 3 ) HOT 1
- When importing version 1.0 of Pinceau, TypeScript is giving some issues.
- After installing @pinceau/vue, I encountered a strange error.
- The declaration file for @pinceau/vue/plugin cannot be found.
- Default $dt() to return value
- Where to apply basic styles (Nuxt 3) HOT 3
- pinceau/dist/index.mjs does not provide an export named 'PinceauTheme'
- Some examples broken under windows
- Not working with nuxt HOT 2
- Compound variants support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pinceau.