@thorprovider/create-thor-app 4.1.6 → 4.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Application Providers — Composites all context providers.
|
|
5
5
|
*
|
|
6
6
|
* Provider Hierarchy (ordered by dependencies — FROZEN, do not reorder):
|
|
7
|
-
* 1.
|
|
8
|
-
* 2.
|
|
9
|
-
* 3.
|
|
7
|
+
* 1. ThemeProvider — Dark/light mode via .dark class (no dependencies)
|
|
8
|
+
* 2. CommerceProvider — Commerce backend access (no dependencies)
|
|
9
|
+
* 3. RegionProvider — Region/currency context (depends on commerce)
|
|
10
|
+
* 4. CartProvider — Shopping cart (depends on commerce)
|
|
10
11
|
*
|
|
11
12
|
* Receives `commerceConfig` from the async RSC layout (app/layout.tsx).
|
|
12
13
|
* The config is read from process.env server-side and forwarded here as
|
|
@@ -14,6 +15,7 @@
|
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import React from 'react'
|
|
18
|
+
import { ThemeProvider } from './theme-provider'
|
|
17
19
|
import { CommerceProvider } from './commerce-provider'
|
|
18
20
|
import { RegionProvider } from './region-provider'
|
|
19
21
|
import { CartProvider } from './cart-provider'
|
|
@@ -27,12 +29,15 @@ interface AppProvidersProps {
|
|
|
27
29
|
|
|
28
30
|
export function AppProviders({ children, commerceConfig }: AppProvidersProps) {
|
|
29
31
|
return (
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
<ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
|
|
33
|
+
<CommerceProvider config={commerceConfig}>
|
|
34
|
+
<RegionProvider>
|
|
35
|
+
<CartProvider>
|
|
36
|
+
{children}
|
|
37
|
+
</CartProvider>
|
|
38
|
+
</RegionProvider>
|
|
39
|
+
</CommerceProvider>
|
|
40
|
+
</ThemeProvider>
|
|
37
41
|
)
|
|
38
42
|
}
|
|
43
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { ThemeProvider as NextThemesProvider } from 'next-themes'
|
|
5
|
+
import type { ThemeProviderProps } from 'next-themes'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ThemeProvider — thin wrapper over next-themes.
|
|
9
|
+
*
|
|
10
|
+
* FROZEN — do not modify.
|
|
11
|
+
* Already wired in app-providers.tsx with attribute="class" defaultTheme="system".
|
|
12
|
+
* Dark mode tokens are in styles/tokens.css under .dark { ... }.
|
|
13
|
+
*
|
|
14
|
+
* To toggle theme in a component:
|
|
15
|
+
* import { useTheme } from 'next-themes'
|
|
16
|
+
* const { theme, setTheme } = useTheme()
|
|
17
|
+
* setTheme('dark') | setTheme('light') | setTheme('system')
|
|
18
|
+
*/
|
|
19
|
+
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
|
20
|
+
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
|
|
21
|
+
}
|