metonym / svelte-dark-mode

Support dark mode in your Svelte apps
https://metonym.github.io/svelte-dark-mode
MIT License
42 stars 3 forks source link

Convert project to TypeScript and use `svelte-kit package` to package library #12

Open metonym opened 2 years ago

metonym commented 2 years ago

With unit tests in place, we can more confidently refactor the code to TypeScript. In addition to greater type safety, this would conserve the manual effort of syncing type definitions.

SvelteKit package is probably the best option to do this.

MatousAc commented 1 year ago

I would also love to see this available in SvelteKit. Thanks!

metonym commented 1 year ago

@MatousAc Does this library not work for you in SvelteKit?

MatousAc commented 1 year ago

Hmm, I'm honestly kinda new to Svelte. But I guess maybe the problem wasn't that I was using sveltekit, but that I was trying your example in TypeScript rather than JavaScript. I'll try that out now that I have reconsidered the problem.

MatousAc commented 1 year ago

I'm pretty sure that the problem is that I am using a custom-typed (TS) svelte store for my theme variable. That just doesn't seem to be compatible with this library. Kinda makes sense. At this point, I'm doing most of it myself anyways, so I might as well detect the user's OS preferences too.