@alveole/theme 0.32.1 → 0.33.0

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.
@@ -1,8 +1,10 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  import { CustomBuilder } from './helpers/useThemeBuilder';
3
3
  import type { Theme } from './type';
4
- export declare const ThemeProvider: (props: PropsWithChildren<CustomBuilder & {
4
+ export type ThemeProviderProps = PropsWithChildren<CustomBuilder & {
5
5
  loader?: boolean;
6
- }>) => import("react/jsx-runtime").JSX.Element;
6
+ onReady?: () => void;
7
+ }>;
8
+ export declare const ThemeProvider: (props: ThemeProviderProps) => import("react/jsx-runtime").JSX.Element;
7
9
  export declare const useTheme: () => Theme;
8
10
  //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAc,EAA6B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAmB,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAKpC,eAAO,MAAM,aAAa,GAAI,OAAO,iBAAiB,CAAC,aAAa,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,4CAkB3F,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,KAI3B,CAAC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../src/ThemeProvider.tsx"],"names":[],"mappings":"AACA,OAAc,EAA6B,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAmB,MAAM,2BAA2B,CAAC;AAE3E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAKpC,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAChD,aAAa,GAAG;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CACF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,4CAsBtD,CAAC;AAEF,eAAO,MAAM,QAAQ,QAAO,KAI3B,CAAC"}
@@ -8,7 +8,7 @@ import { ThemeProviderLoader } from './ThemeProviderLoader';
8
8
  const ThemeContext = createContext(null);
9
9
  const MIN_LOADING_DELAY = 0;
10
10
  export const ThemeProvider = (props) => {
11
- const { loader = true, ...builder } = props;
11
+ const { loader = true, onReady, ...builder } = props;
12
12
  const theme = useThemeBuilder(builder);
13
13
  const [showLoader, setShowLoader] = React.useState(true);
14
14
  React.useEffect(() => {
@@ -20,6 +20,10 @@ export const ThemeProvider = (props) => {
20
20
  if (Platform.OS === 'web')
21
21
  injectVariableCSS(theme);
22
22
  }, []);
23
+ React.useEffect(() => {
24
+ if (onReady && theme.isReady)
25
+ onReady();
26
+ }, [onReady, theme.isReady]);
23
27
  if ((!theme.isReady || showLoader) && loader !== false)
24
28
  return _jsx(ThemeProviderLoader, {});
25
29
  return _jsx(ThemeContext.Provider, { value: theme, children: props.children });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alveole/theme",
3
- "version": "0.32.1",
3
+ "version": "0.33.0",
4
4
  "description": "Shared theme tokens and utilities.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",