Giter Club home page Giter Club logo

Comments (26)

nandorojo avatar nandorojo commented on September 23, 2024 2

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.

nandorojo avatar nandorojo commented on September 23, 2024 2

Screen Shot 2021-09-28 at 6 08 16 PM

Props now narrow down to the specific themeKey for a given style 😎

from dripsy.

rafaelrinaldi avatar rafaelrinaldi commented on September 23, 2024 2

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.

nandorojo avatar nandorojo commented on September 23, 2024 1

Alright, let's make this happen.

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024 1

I published the first version of this at 3.0.0, would love help testing:

yarn add dripsy@canary

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

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.

nandorojo avatar nandorojo commented on September 23, 2024

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.

nandorojo avatar nandorojo commented on September 23, 2024

Relevant: https://material-ui.com/components/about-the-lab/#typescript

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

#72

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

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.

nandorojo avatar nandorojo commented on September 23, 2024

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.

cmaycumber avatar cmaycumber commented on September 23, 2024

@nandorojo Have you seen react-native-styled-variants: https://styled-variants.vercel.app/

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

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.

nandorojo avatar nandorojo commented on September 23, 2024

Looks like TS performance has improved for this, which is good news microsoft/TypeScript#45711

from dripsy.

cmaycumber avatar cmaycumber commented on September 23, 2024

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.

nandorojo avatar nandorojo commented on September 23, 2024

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.

cmaycumber avatar cmaycumber commented on September 23, 2024

I think that's definitely a good UX imo. Let me reread #72. I'm super pumped to get this started

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Starting at #124

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Screen Shot 2021-09-27 at 5 12 04 PM

Omg. still work to do here but...

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Adding variant support too...

Screen Shot 2021-09-27 at 6 17 55 PM

Theme here (just to mock)

Screen Shot 2021-09-27 at 6 18 13 PM

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Screen Shot 2021-09-27 at 6 47 19 PM

Screen Shot 2021-09-27 at 6 47 11 PM

Gradient support working...

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Screen Shot 2021-09-27 at 7 10 32 PM

Added sx prop as a function support (not sure why tbh, but why not)

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

2 things left:

  1. Make sure that the Tokenizer is actually performant
  2. Maybe add per-scale styles? As in, bg only sees scales from the theme.colors. It's just a lot of time / effort.

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Screen Shot 2021-09-28 at 6 01 33 PM

Shorthand support working...

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Thanks, glad you think so! You can see more details at #124

from dripsy.

nandorojo avatar nandorojo commented on September 23, 2024

Will be closed with the release of v3.

from dripsy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.