-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings changes #170
Comments
I think the main issue I see here is interaction between the type ThemeSetting = string | { light: string; dark: string }; In this case, a simple string would effectively disable the default What do you think? |
Trying to think this through. Ultimately the source of truth is the Last wins (if svelte-ux/packages/svelte-ux/src/lib/plugins/tailwind/theme.cjs Lines 117 to 119 in 0b67ce5
The themes should be registered in the tailwind config as... {
ux: {
themes: {
light: { ... }, // will be `:root` and `[data-theme=light]`
dark: { ... }, // will be `prefers-color-scheme: dark` and `[data-theme=dark]`
another: { ... }, // will be `[data-theme=another]`
more: { ... }, // will be `[data-theme=more]`
...
} I'm not sure if we're talking about exactly the same thing, but I think so :). The So I think there are a few things:
As I write this, I'm seeing the issue with Does that help any, or am I way off one what you are asking :). Worst case it helps me brain dump what is in my head some. |
What were you intending That is, the theming code would do the same resolution that it currently does, but instead of defaulting to "light" when it didn't have a better choice it would use "aqua" instead. That "default theme" behavior is also why I suggested the ability to provide different values for light and dark. |
OTOH if your intent was to always have "light" and "dark" be the default light and dark themes, then I think we don't need a |
My thought for Ultimately I think we just need to a Svelte store to do that kind of work, but then a context to be able to access it from within ThemeSelect, ThemeSwitch, etc to update I do intend for We could maybe break the tailwind config into separate by scheme: {
ux: {
themes: {
light: ['light', 'corporate', ...],
dark: ['dark', 'night', ...],
}
}
} we would still need a way to read these in JS to build the list in |
Yeah that's right. We do need a component (SsrThemeApplier or something) that can handle injecting the But everything else can be done with a store, and the application of the value to data-theme, localStorage, etc. can be done by subscribing to that store. The ThemeButton and so on would only interact with the "current theme" by reading and writing that store.
I think this could be done by just passing a store into any of the Theme controls, and have it use that store instead of the global theme store. Applying the value could just be done as So with all this in mind, if we aren't adding a new |
I think renaming to changing... const theme = getComponentTheme('Button'); const classes = getComponentClasses('Button'); would interfere with export let classes: {
root?: string;
icon?: string;
loading?: string;
} = {}; I'm not against pulling maybe:
I know we're pulling all settings in some Date components now, so maybe doing that at the top would be best... const settings = getSettings();
const settingClasses = settings.classes['Button']; or something. Just spit balling ATM. I'm sure you've done something in your PR already :). In short, yes, let's still rename |
This is what I was starting to do. Was going to check in with you before changing every single file but that sounds good to me :) |
I know that pain, and thanks :) |
@dimfeld side note, I just remembered that using
|
Yep, but those don't ever change so there's no issue there. |
In practice, I think only the top-level |
settings({ theme: {} })
tosettings({ classes: {} })
settings({ currentTheme: 'themeName' })
to set the theme (see Design tokens / Dark mode #66 / Design tokens / Theme support (with dark mode) #146), specificallyThemeButton
ATM<Settings>
component to use top-level object properties as props. So<Settings settings={{ theme: '...', classes: {...}, format: {...} }}>
becomes<Settings theme="..." classes={{ ... }} format={{ ... }}>
The text was updated successfully, but these errors were encountered: