@trops/dash-core 0.1.377 → 0.1.378

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.js CHANGED
@@ -2876,9 +2876,30 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2876
2876
 
2877
2877
  function ownKeys$T(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2878
2878
  function _objectSpread$T(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$T(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$T(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2879
- var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2880
- var themeKey = _ref.themeKey,
2881
- children = _ref.children;
2879
+ function ThemeBroadcast(_ref) {
2880
+ var ctx = _ref.ctx;
2881
+ React.useEffect(function () {
2882
+ if (ctx !== null && ctx !== void 0 && ctx.currentTheme && typeof window !== "undefined") {
2883
+ window.__dashThemeContext = ctx;
2884
+ window.dispatchEvent(new Event("dash:theme-changed"));
2885
+ }
2886
+ }, [ctx]);
2887
+ return null;
2888
+ }
2889
+
2890
+ /**
2891
+ * DashboardThemeProvider
2892
+ *
2893
+ * Wraps dashboard content with a nested ThemeContext.Provider when a
2894
+ * dashboard has its own themeKey. Components inside find the nearest
2895
+ * provider automatically — zero changes needed in dash-react.
2896
+ *
2897
+ * App chrome (navbar, tab bar, sidebar) stays OUTSIDE this wrapper
2898
+ * and keeps the app theme.
2899
+ */
2900
+ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2901
+ var themeKey = _ref2.themeKey,
2902
+ children = _ref2.children;
2882
2903
  var parentContext = React.useContext(DashReact.ThemeContext);
2883
2904
  var themes = parentContext.themes,
2884
2905
  themeVariant = parentContext.themeVariant;
@@ -2896,12 +2917,21 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2896
2917
  appThemeKey: parentContext.currentThemeKey
2897
2918
  });
2898
2919
  }, [themeKey, themes, themeVariant, parentContext]);
2899
- if (!contextValue) return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
2900
- children: children
2901
- });
2902
- return /*#__PURE__*/jsxRuntime.jsx(DashReact.ThemeContext.Provider, {
2920
+
2921
+ // Broadcast the effective theme (dashboard override or parent)
2922
+ var effectiveCtx = contextValue || parentContext;
2923
+ if (!contextValue) {
2924
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2925
+ children: [/*#__PURE__*/jsxRuntime.jsx(ThemeBroadcast, {
2926
+ ctx: effectiveCtx
2927
+ }), children]
2928
+ });
2929
+ }
2930
+ return /*#__PURE__*/jsxRuntime.jsxs(DashReact.ThemeContext.Provider, {
2903
2931
  value: contextValue,
2904
- children: children
2932
+ children: [/*#__PURE__*/jsxRuntime.jsx(ThemeBroadcast, {
2933
+ ctx: contextValue
2934
+ }), children]
2905
2935
  });
2906
2936
  };
2907
2937