@dheme/react 2.10.0 → 2.11.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.
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +6 -1
- package/dist/index.mjs +6 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -45,6 +45,14 @@ interface DhemeProviderProps {
|
|
|
45
45
|
onThemeChange?: (theme: GenerateThemeResponse) => void;
|
|
46
46
|
onModeChange?: (mode: ThemeMode) => void;
|
|
47
47
|
onError?: (error: Error) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Rendered instead of children while the initial theme is loading.
|
|
50
|
+
* Use this to prevent layout flash by showing a skeleton or spinner.
|
|
51
|
+
*
|
|
52
|
+
* Note: when using @dheme/next with DhemeScript, the theme is injected
|
|
53
|
+
* server-side — omit this prop in that case to avoid an unnecessary flash.
|
|
54
|
+
*/
|
|
55
|
+
fallback?: React.ReactNode;
|
|
48
56
|
children: React.ReactNode;
|
|
49
57
|
}
|
|
50
58
|
interface DhemeScriptProps {
|
|
@@ -52,7 +60,7 @@ interface DhemeScriptProps {
|
|
|
52
60
|
nonce?: string;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
declare function DhemeProvider({ apiKey, theme: primaryColor, themeParams, defaultMode, baseUrl, persist, autoApply, onGenerateTheme: customGenerateTheme, onThemeChange, onModeChange, onError, children, }: DhemeProviderProps): React__default.ReactElement;
|
|
63
|
+
declare function DhemeProvider({ apiKey, theme: primaryColor, themeParams, defaultMode, baseUrl, persist, autoApply, onGenerateTheme: customGenerateTheme, onThemeChange, onModeChange, onError, fallback, children, }: DhemeProviderProps): React__default.ReactElement;
|
|
56
64
|
|
|
57
65
|
declare function DhemeScript({ defaultMode, nonce, }: DhemeScriptProps): React__default.ReactElement;
|
|
58
66
|
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,14 @@ interface DhemeProviderProps {
|
|
|
45
45
|
onThemeChange?: (theme: GenerateThemeResponse) => void;
|
|
46
46
|
onModeChange?: (mode: ThemeMode) => void;
|
|
47
47
|
onError?: (error: Error) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Rendered instead of children while the initial theme is loading.
|
|
50
|
+
* Use this to prevent layout flash by showing a skeleton or spinner.
|
|
51
|
+
*
|
|
52
|
+
* Note: when using @dheme/next with DhemeScript, the theme is injected
|
|
53
|
+
* server-side — omit this prop in that case to avoid an unnecessary flash.
|
|
54
|
+
*/
|
|
55
|
+
fallback?: React.ReactNode;
|
|
48
56
|
children: React.ReactNode;
|
|
49
57
|
}
|
|
50
58
|
interface DhemeScriptProps {
|
|
@@ -52,7 +60,7 @@ interface DhemeScriptProps {
|
|
|
52
60
|
nonce?: string;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
declare function DhemeProvider({ apiKey, theme: primaryColor, themeParams, defaultMode, baseUrl, persist, autoApply, onGenerateTheme: customGenerateTheme, onThemeChange, onModeChange, onError, children, }: DhemeProviderProps): React__default.ReactElement;
|
|
63
|
+
declare function DhemeProvider({ apiKey, theme: primaryColor, themeParams, defaultMode, baseUrl, persist, autoApply, onGenerateTheme: customGenerateTheme, onThemeChange, onModeChange, onError, fallback, children, }: DhemeProviderProps): React__default.ReactElement;
|
|
56
64
|
|
|
57
65
|
declare function DhemeScript({ defaultMode, nonce, }: DhemeScriptProps): React__default.ReactElement;
|
|
58
66
|
|
package/dist/index.js
CHANGED
|
@@ -263,6 +263,7 @@ function DhemeProvider({
|
|
|
263
263
|
onThemeChange,
|
|
264
264
|
onModeChange,
|
|
265
265
|
onError,
|
|
266
|
+
fallback,
|
|
266
267
|
children
|
|
267
268
|
}) {
|
|
268
269
|
const client = (0, import_react3.useMemo)(() => new import_sdk.DhemeClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
|
|
@@ -403,7 +404,11 @@ function DhemeProvider({
|
|
|
403
404
|
return import_react3.default.createElement(
|
|
404
405
|
ThemeDataContext.Provider,
|
|
405
406
|
{ value: themeDataValue },
|
|
406
|
-
import_react3.default.createElement(
|
|
407
|
+
import_react3.default.createElement(
|
|
408
|
+
ThemeActionsContext.Provider,
|
|
409
|
+
{ value: themeActionsValue },
|
|
410
|
+
!isReady && fallback != null ? fallback : children
|
|
411
|
+
)
|
|
407
412
|
);
|
|
408
413
|
}
|
|
409
414
|
|
package/dist/index.mjs
CHANGED
|
@@ -213,6 +213,7 @@ function DhemeProvider({
|
|
|
213
213
|
onThemeChange,
|
|
214
214
|
onModeChange,
|
|
215
215
|
onError,
|
|
216
|
+
fallback,
|
|
216
217
|
children
|
|
217
218
|
}) {
|
|
218
219
|
const client = useMemo(() => new DhemeClient({ apiKey, baseUrl }), [apiKey, baseUrl]);
|
|
@@ -353,7 +354,11 @@ function DhemeProvider({
|
|
|
353
354
|
return React.createElement(
|
|
354
355
|
ThemeDataContext.Provider,
|
|
355
356
|
{ value: themeDataValue },
|
|
356
|
-
React.createElement(
|
|
357
|
+
React.createElement(
|
|
358
|
+
ThemeActionsContext.Provider,
|
|
359
|
+
{ value: themeActionsValue },
|
|
360
|
+
!isReady && fallback != null ? fallback : children
|
|
361
|
+
)
|
|
357
362
|
);
|
|
358
363
|
}
|
|
359
364
|
|