@vaneui/ui 0.2.1-alpha.20250812182914.4e44540 → 0.2.1-alpha.20250813170000.4050860
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/components/themeContext.d.ts +3 -1
- package/dist/index.esm.js +9 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4857,12 +4857,17 @@ function applyExtraClassesRecursively(themeObject, extraClassesObject) {
|
|
|
4857
4857
|
}
|
|
4858
4858
|
}
|
|
4859
4859
|
const ThemeContext = react.createContext(defaultTheme);
|
|
4860
|
-
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride }) {
|
|
4860
|
+
function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extraClasses, themeOverride, mergeStrategy = 'merge' }) {
|
|
4861
|
+
const parentTheme = react.useContext(ThemeContext);
|
|
4861
4862
|
const mergedTheme = react.useMemo(() => {
|
|
4863
|
+
// Determine the base theme based on merge strategy
|
|
4864
|
+
const baseTheme = mergeStrategy === 'replace'
|
|
4865
|
+
? defaultTheme
|
|
4866
|
+
: parentTheme;
|
|
4862
4867
|
// Always start with a deep clone to ensure isolation
|
|
4863
4868
|
let finalTheme = themeObject
|
|
4864
|
-
? deepMerge(deepClone(
|
|
4865
|
-
: deepClone(
|
|
4869
|
+
? deepMerge(deepClone(baseTheme), themeObject)
|
|
4870
|
+
: deepClone(baseTheme);
|
|
4866
4871
|
if (typeof themeOverride === 'function') {
|
|
4867
4872
|
const themeToModify = deepClone(finalTheme);
|
|
4868
4873
|
finalTheme = themeOverride(themeToModify);
|
|
@@ -4880,7 +4885,7 @@ function ThemeProvider({ children, theme: themeObject = {}, themeDefaults, extra
|
|
|
4880
4885
|
applyExtraClassesRecursively(finalTheme, extraClasses);
|
|
4881
4886
|
}
|
|
4882
4887
|
return finalTheme;
|
|
4883
|
-
}, [themeObject, themeDefaults, extraClasses, themeOverride]);
|
|
4888
|
+
}, [themeObject, themeDefaults, extraClasses, themeOverride, mergeStrategy, parentTheme]);
|
|
4884
4889
|
return (jsxRuntime.jsx(ThemeContext.Provider, { value: mergedTheme, children: children }));
|
|
4885
4890
|
}
|
|
4886
4891
|
function useTheme() {
|