Skip to content

Commit 37fcc33

Browse files
authored
fix: theme reactivity, update ThemeProvider, themeUtils.ts (#1883)
* fix: theme reactivity * fix: lib/context.ts, docs: pages/theme-provider * fix: coderabbitai fix * fix: coderabbitai fix
1 parent 8912ed8 commit 37fcc33

File tree

157 files changed

+336
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+336
-165
lines changed

src/lib/accordion/Accordion.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
let { children, flush, activeClass, inactiveClass, multiple = false, class: className, transitionType, ...restProps }: AccordionProps = $props();
1111
12-
const theme = getTheme("accordion");
12+
const theme = $derived(getTheme("accordion"));
1313
1414
// Simple reactive state object
1515
const reactiveCtx: AccordionContextType = {

src/lib/accordion/AccordionItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
const useTransition = $derived(transitionType === "none" ? false : ctxTransitionType === "none" ? false : true);
5151
5252
// Theme context
53-
const theme = getTheme("accordionItem");
53+
const theme = $derived(getTheme("accordionItem"));
5454
5555
// single selection
5656
const self = Symbol("accordion-item");

src/lib/alert/Alert.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}: AlertProps = $props();
2424
2525
// Theme context
26-
const theme = getTheme("alert");
26+
const theme = $derived(getTheme("alert"));
2727
2828
let divCls = $derived(
2929
alert({

src/lib/avatar/Avatar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
let { children, indicator, src, href, target, cornerStyle = "circular", border = false, stacked = false, dot, class: className, alt, size = "md", onclick, ...restProps }: AvatarProps = $props();
99
1010
// Theme context
11-
const theme = getTheme("avatar");
11+
const theme = $derived(getTheme("avatar"));
1212
1313
let dotProps = $derived(dot ? { placement: "top-right" as const, color: "gray" as const, size: "lg" as const, ...dot } : undefined);
1414

src/lib/badge/Badge.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
const styling = $derived(classes ?? { linkClass: aClass });
3737
3838
// Theme context
39-
const theme = getTheme("badge");
39+
const theme = $derived(getTheme("badge"));
4040
4141
const { base, linkClass } = $derived(badge({ color, size: large ? "large" : "small", rounded, border }));
4242

src/lib/banner/Banner.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
const styling = $derived(classes ?? { insideDiv: innerClass, dismissable: closeClass });
3535
3636
// Theme context
37-
const theme = getTheme("banner");
37+
const theme = $derived(getTheme("banner"));
3838
3939
const { base, insideDiv, dismissable: dismissableClass } = $derived(banner({ type, color }));
4040

src/lib/bottom-navigation/BottomNav.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
const styling = $derived(classes ?? { inner: innerClass });
1919
2020
// Theme context
21-
const theme = getTheme("bottomNav");
21+
const theme = $derived(getTheme("bottomNav"));
2222
2323
const activeCls = $derived(cn("text-primary-700 dark:text-primary-700 hover:text-primary-900 dark:hover:text-primary-900", activeClass));
2424

src/lib/bottom-navigation/BottomNavHeader.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
const styling = $derived(classes ?? { innerDiv: innerClass });
1717
1818
// Theme context
19-
const theme = getTheme("bottomNavHeader");
19+
const theme = $derived(getTheme("bottomNavHeader"));
2020
2121
const { innerDiv, base } = $derived(bottomNavHeader());
2222
</script>

src/lib/bottom-navigation/BottomNavHeaderItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let { itemName, active, class: className, ...restProps }: BottomNavHeaderItemProps = $props();
88
99
// Theme context
10-
const theme = getTheme("bottomNavHeaderItem");
10+
const theme = $derived(getTheme("bottomNavHeaderItem"));
1111
1212
let base = $derived(bottomNavHeaderItem({ active, class: clsx(theme, className) }));
1313
</script>

src/lib/bottom-navigation/BottomNavItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
const styling = $derived(classes ?? { span: spanClass });
1919
2020
// Theme context
21-
const theme = getTheme("bottomNavItem");
21+
const theme = $derived(getTheme("bottomNavItem"));
2222
2323
const context = getBottomNavContext();
2424

0 commit comments

Comments
 (0)