File tree Expand file tree Collapse file tree
skeleton-react/src/components/locale-provider
skeleton-svelte/src/components/locale-provider Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { LocaleProviderRootContext } from '../modules/root-context.js' ;
2+ import { type ContextType , type ReactNode , use } from 'react' ;
3+
4+ export interface LocaleProviderRootContextProps {
5+ children : ( locale : ContextType < typeof LocaleProviderRootContext > ) => ReactNode ;
6+ }
7+
8+ export default function RootContext ( props : LocaleProviderRootContextProps ) {
9+ const locale = use ( LocaleProviderRootContext ) ;
10+
11+ const { children } = props ;
12+
13+ return children ( locale ) ;
14+ }
Original file line number Diff line number Diff line change 11import Root from '../anatomy/root.jsx' ;
2+ import RootContext from '../anatomy/root-context.jsx' ;
23
3- export const LocaleProvider = Root ;
4+ export const LocaleProvider = Object . assign ( Root , {
5+ Context : RootContext ,
6+ } ) ;
Original file line number Diff line number Diff line change 1+ <script lang =" ts" module >
2+ import type { Snippet } from ' svelte' ;
3+
4+ export interface LocaleProviderRootContextProps {
5+ children: Snippet <[ReturnType <typeof LocaleProviderRootContext .consume >]>;
6+ }
7+ </script >
8+
9+ <script lang =" ts" >
10+ import { LocaleProviderRootContext } from ' ../modules/root-context.js' ;
11+
12+ const props: LocaleProviderRootContextProps = $props ();
13+
14+ const locale = LocaleProviderRootContext .consume ();
15+
16+ const { children } = $derived (props );
17+ </script >
18+
19+ {@render children (locale )}
Original file line number Diff line number Diff line change 11import Root from '../anatomy/root.svelte' ;
2+ import RootContext from '../anatomy/root-context.svelte' ;
23
3- export const LocaleProvider = Root ;
4+ export const LocaleProvider = Object . assign ( Root , {
5+ Context : RootContext ,
6+ } ) ;
You can’t perform that action at this time.
0 commit comments