@trops/dash-core 0.1.376 → 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.esm.js CHANGED
@@ -2858,9 +2858,30 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2858
2858
 
2859
2859
  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; }
2860
2860
  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; }
2861
- var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2862
- var themeKey = _ref.themeKey,
2863
- children = _ref.children;
2861
+ function ThemeBroadcast(_ref) {
2862
+ var ctx = _ref.ctx;
2863
+ useEffect(function () {
2864
+ if (ctx !== null && ctx !== void 0 && ctx.currentTheme && typeof window !== "undefined") {
2865
+ window.__dashThemeContext = ctx;
2866
+ window.dispatchEvent(new Event("dash:theme-changed"));
2867
+ }
2868
+ }, [ctx]);
2869
+ return null;
2870
+ }
2871
+
2872
+ /**
2873
+ * DashboardThemeProvider
2874
+ *
2875
+ * Wraps dashboard content with a nested ThemeContext.Provider when a
2876
+ * dashboard has its own themeKey. Components inside find the nearest
2877
+ * provider automatically — zero changes needed in dash-react.
2878
+ *
2879
+ * App chrome (navbar, tab bar, sidebar) stays OUTSIDE this wrapper
2880
+ * and keeps the app theme.
2881
+ */
2882
+ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2883
+ var themeKey = _ref2.themeKey,
2884
+ children = _ref2.children;
2864
2885
  var parentContext = useContext(ThemeContext);
2865
2886
  var themes = parentContext.themes,
2866
2887
  themeVariant = parentContext.themeVariant;
@@ -2878,12 +2899,21 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2878
2899
  appThemeKey: parentContext.currentThemeKey
2879
2900
  });
2880
2901
  }, [themeKey, themes, themeVariant, parentContext]);
2881
- if (!contextValue) return /*#__PURE__*/jsx(Fragment, {
2882
- children: children
2883
- });
2884
- return /*#__PURE__*/jsx(ThemeContext.Provider, {
2902
+
2903
+ // Broadcast the effective theme (dashboard override or parent)
2904
+ var effectiveCtx = contextValue || parentContext;
2905
+ if (!contextValue) {
2906
+ return /*#__PURE__*/jsxs(Fragment, {
2907
+ children: [/*#__PURE__*/jsx(ThemeBroadcast, {
2908
+ ctx: effectiveCtx
2909
+ }), children]
2910
+ });
2911
+ }
2912
+ return /*#__PURE__*/jsxs(ThemeContext.Provider, {
2885
2913
  value: contextValue,
2886
- children: children
2914
+ children: [/*#__PURE__*/jsx(ThemeBroadcast, {
2915
+ ctx: contextValue
2916
+ }), children]
2887
2917
  });
2888
2918
  };
2889
2919