Comments (5)
Experimented a bit.
This could be a implementation for the new IStyle:
Playground Link
And this for the new IStyle, using fela-plugin-fallback-value:
Playground Link
from fela.
And as you can see here: Playground Link
This change shouldn't break anything, because the legacy nested prop would still be possible.
from fela.
Thought about it a little bit more, there is a downside, called declaration merging, see here (typescript docs).
The problem with that is, that plugins can't extend the IStyle type anymore.
Didn't happened yet, but would be nice for the legacy fela-plugin-typescript types and neccessary when using fela-plugin-fallback-value.
Came up with a workaround, seems to be working fine: Playground Link
from fela.
Using these changes in my project I've discovered a weird behavior using the declaration merging for the plugins.
Guess it's because an empty interface is equivalent to {}
, which is equivalent to "any non-nullish value"
.
That lead to the following behaviour:
const _test: IStyle = []; // ok, but should throw an error
This can be fixed by providing an optional 'brand' property, so the empty Extension interface won't be equal to {}
.
See Playground Link
Edit: Updating the PR now.
from fela.
Found another small bug, demonstrated here:
Edit:
And another related bug: Playground Link
Got this as a workaround: Playground Link
Im just exposing IStylePrimitiveExtension
as a mergable type. So plugins could hook into that, to extend the primitive type.
For example the following case: Playground Link
from fela.
Related Issues (20)
- fela-plugin-responsive-value doesn’t handle nested objects
- Fela doesn’t hydrate CSS custom properties HOT 1
- fela-plugin-multiple-selectors doesn’t extend styles
- renderStatic doesn’t handle nested objects
- Document targetDocument
- renderToNodeList not exported in react-fela/index.d.ts HOT 1
- Typescript plugin doesn't extend style definition HOT 5
- Native ESM support HOT 5
- renderStatic not applying some plugins HOT 6
- Missing changelog for 11.5.x & 11.6.x HOT 2
- Rehydration of `&` selectors HOT 10
- Rules are mixing between components when we switch between pages. HOT 1
- Typescript interface for renderer configuration (IConfig) misses some options HOT 2
- Transform key as array ignored HOT 5
- [Feature] Add bindings for solid-js HOT 1
- Fail to set backgroundImage fallback value HOT 3
- Bug: no fela styles on saved page HOT 1
- react-native: no style export in useFela hook HOT 2
- Debugging HOT 2
- Empty `style` tag when using fela-dom render method for runtime rendering with Sveltekit HOT 1
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 fela.