Comments (26)
After many months, I'm excited to say that this feature is close to landing. @hasparus has been hard at work with many great additions to theme-ui
, and one of them will address this issue. This means our sx
prop will get strict types based on our theme.
To follow: system-ui/theme-ui#1090
from dripsy.
Props now narrow down to the specific themeKey
for a given style 😎
from dripsy.
Popping in to say I thoroughly appreciate all the work being put into this. It will be such a great addition to Dripsy!
from dripsy.
Alright, let's make this happen.
from dripsy.
I published the first version of this at 3.0.0
, would love help testing:
yarn add dripsy@canary
from dripsy.
This requires some TypeScript codegen wizardry that I just don't have. I'll probably close this until some TS genius stumbles upon it and can solve it.
from dripsy.
There's an exciting theme UI PR which seems like it could solve this system-ui/theme-ui#1090. Still have to look more into it, but I've re-opened this issue.
from dripsy.
Relevant: https://material-ui.com/components/about-the-lab/#typescript
from dripsy.
from dripsy.
Gosh, this is sooo hard with all of theme-ui's complex types in the way rn.
@cmaycumber I think this is the start of v3 of Dripsy. Remove theme-ui
altogether, copy over the types ourselves, and have great type safety.
(I accidentally wrote this on the other thread first)
from dripsy.
This cool new project by @intergalacticspacehighway has good custom types: https://github.com/intergalacticspacehighway/react-native-styled-variants/blob/9d6a801683b5ffbc8641b5937b62f24425e504de/src/types.ts#L32
from dripsy.
@nandorojo Have you seen react-native-styled-variants
: https://styled-variants.vercel.app/
from dripsy.
Haha yeah good timing. I'd want to make sure that the type creator there from the custom theme is performant. For massive TS objects, you can get into slow performance if you recurse too much (see millsp/ts-toolbelt#154)
from dripsy.
Looks like TS performance has improved for this, which is good news microsoft/TypeScript#45711
from dripsy.
Haha yeah good timing. I'd want to make sure that the type creator there from the custom theme is performant. For massive TS objects, you can get into slow performance if you recurse too much (see millsp/ts-toolbelt#154)
That makes a lot of sense. We should definitely make sure that's the case. I wonder if we can build off of some of the work from react-native-styled-variants
.
from dripsy.
Yeah, I wrote more about my vision for how this could work at #72 a while ago
I feel like a good UX is
const theme = createTheme({
...
})
type MyTheme = typeof theme
declare module 'dripsy' {
interface UserTheme extends MyTheme {}
}
But I'm open to anything, also could make it like the styled variants for sure. The one missing piece is adding all of the custom scales p
, px
, etc)
from dripsy.
I think that's definitely a good UX imo. Let me reread #72. I'm super pumped to get this started
from dripsy.
Starting at #124
from dripsy.
Omg. still work to do here but...
from dripsy.
Adding variant support too...
Theme here (just to mock)
from dripsy.
Gradient support working...
from dripsy.
Added sx
prop as a function support (not sure why tbh, but why not)
from dripsy.
2 things left:
- Make sure that the
Tokenizer
is actually performant - Maybe add per-scale styles? As in,
bg
only sees scales from thetheme.colors
. It's just a lot of time / effort.
from dripsy.
Shorthand support working...
from dripsy.
Thanks, glad you think so! You can see more details at #124
from dripsy.
Will be closed with the release of v3.
from dripsy.
Related Issues (20)
- ☂️ TypeScript 5 + Intellisense HOT 3
- can use Dripsy with expo-router ? HOT 1
- Styled function Autocomplete don't work HOT 8
- Basic usage of variants broken? HOT 31
- drispy/gradient path doesn't match entrypoint HOT 9
- Nested color path not working linearGradient theme HOT 4
- Fatal error on app launch in 4.1.0 HOT 9
- Missing property shadowOffset HOT 7
- `4.3.4` is not released
- Wrong type for `variant` on `TextInput` HOT 3
- Incompatibility with `[email protected]` HOT 18
- Unable to resolve "stable-hash" from "node_modules\dripsy\build\core\use-sx.js" HOT 5
- [$250 bounty] Types breaking with TS 5.1+ ✅ HOT 16
- example with expo router? HOT 2
- Default Style Replacing Custom `sx` Style Props HOT 7
- Nested texts don't seem to inherit parent styles HOT 6
- how to run with jest HOT 2
- [Typescript] how to type a strict color value ? HOT 2
- autocomplete not working HOT 15
- How performant is Dripsy? HOT 3
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 dripsy.