@trops/dash-core 0.1.377 → 0.1.379

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
@@ -2530,6 +2530,20 @@ var ThemeWrapper = function ThemeWrapper(_ref) {
2530
2530
  });
2531
2531
  };
2532
2532
 
2533
+ function AppContextBroadcast(_ref) {
2534
+ var ctx = _ref.ctx;
2535
+ useEffect(function () {
2536
+ if (ctx && typeof window !== "undefined") {
2537
+ window.__dashAppContext = ctx;
2538
+ window.dispatchEvent(new Event("dash:app-context-changed"));
2539
+ }
2540
+ }, [ctx]);
2541
+ return null;
2542
+ }
2543
+
2544
+ // TODO
2545
+ // make theme files or have a Theme context which we can populate with a plugin or config
2546
+ // color theme (coming soon)
2533
2547
  var debugStyles = {
2534
2548
  workspace: {
2535
2549
  classes: "bg-gray-800 border border-red-900 rounded p-4"
@@ -2547,11 +2561,11 @@ var debugStyles = {
2547
2561
  classes: "border border-blue-700 bg-gray-800 rounded p-4"
2548
2562
  }
2549
2563
  };
2550
- var AppWrapper = function AppWrapper(_ref) {
2551
- var children = _ref.children,
2552
- _ref$credentials = _ref.credentials,
2553
- credentials = _ref$credentials === void 0 ? null : _ref$credentials,
2554
- dashApi = _ref.dashApi;
2564
+ var AppWrapper = function AppWrapper(_ref2) {
2565
+ var children = _ref2.children,
2566
+ _ref2$credentials = _ref2.credentials,
2567
+ credentials = _ref2$credentials === void 0 ? null : _ref2$credentials,
2568
+ dashApi = _ref2.dashApi;
2555
2569
  var _useState = useState(credentials),
2556
2570
  _useState2 = _slicedToArray(_useState, 2),
2557
2571
  creds = _useState2[0],
@@ -2785,9 +2799,11 @@ var AppWrapper = function AppWrapper(_ref) {
2785
2799
  return null;
2786
2800
  }
2787
2801
  }, [debugMode, creds, credentials, searchClient, dashApi, settings, providers, isLoadingProviders, loadProviders, changeSearchClient, changeCreds, changeDebugMode, changeSettings, changeApplicationTheme, openDataDirectory]);
2788
- return /*#__PURE__*/jsx(AppContext.Provider, {
2802
+ return /*#__PURE__*/jsxs(AppContext.Provider, {
2789
2803
  value: contextValue,
2790
- children: children
2804
+ children: [/*#__PURE__*/jsx(AppContextBroadcast, {
2805
+ ctx: contextValue
2806
+ }), children]
2791
2807
  });
2792
2808
  };
2793
2809
 
@@ -2858,9 +2874,30 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2858
2874
 
2859
2875
  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
2876
  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;
2877
+ function ThemeBroadcast(_ref) {
2878
+ var ctx = _ref.ctx;
2879
+ useEffect(function () {
2880
+ if (ctx !== null && ctx !== void 0 && ctx.currentTheme && typeof window !== "undefined") {
2881
+ window.__dashThemeContext = ctx;
2882
+ window.dispatchEvent(new Event("dash:theme-changed"));
2883
+ }
2884
+ }, [ctx]);
2885
+ return null;
2886
+ }
2887
+
2888
+ /**
2889
+ * DashboardThemeProvider
2890
+ *
2891
+ * Wraps dashboard content with a nested ThemeContext.Provider when a
2892
+ * dashboard has its own themeKey. Components inside find the nearest
2893
+ * provider automatically — zero changes needed in dash-react.
2894
+ *
2895
+ * App chrome (navbar, tab bar, sidebar) stays OUTSIDE this wrapper
2896
+ * and keeps the app theme.
2897
+ */
2898
+ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2899
+ var themeKey = _ref2.themeKey,
2900
+ children = _ref2.children;
2864
2901
  var parentContext = useContext(ThemeContext);
2865
2902
  var themes = parentContext.themes,
2866
2903
  themeVariant = parentContext.themeVariant;
@@ -2878,12 +2915,21 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2878
2915
  appThemeKey: parentContext.currentThemeKey
2879
2916
  });
2880
2917
  }, [themeKey, themes, themeVariant, parentContext]);
2881
- if (!contextValue) return /*#__PURE__*/jsx(Fragment, {
2882
- children: children
2883
- });
2884
- return /*#__PURE__*/jsx(ThemeContext.Provider, {
2918
+
2919
+ // Broadcast the effective theme (dashboard override or parent)
2920
+ var effectiveCtx = contextValue || parentContext;
2921
+ if (!contextValue) {
2922
+ return /*#__PURE__*/jsxs(Fragment, {
2923
+ children: [/*#__PURE__*/jsx(ThemeBroadcast, {
2924
+ ctx: effectiveCtx
2925
+ }), children]
2926
+ });
2927
+ }
2928
+ return /*#__PURE__*/jsxs(ThemeContext.Provider, {
2885
2929
  value: contextValue,
2886
- children: children
2930
+ children: [/*#__PURE__*/jsx(ThemeBroadcast, {
2931
+ ctx: contextValue
2932
+ }), children]
2887
2933
  });
2888
2934
  };
2889
2935
 
@@ -25640,6 +25686,7 @@ var LayoutGridContainer = /*#__PURE__*/memo(function (_ref3) {
25640
25686
  workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id,
25641
25687
  widgetComponentName: cellComponent.component,
25642
25688
  widgetId: cellComponent.id,
25689
+ selectedProviders: cellComponent.selectedProviders || null,
25643
25690
  sourcePackage: ((_ComponentManager$con = ComponentManager.config(cellComponent.component, cellComponent)) === null || _ComponentManager$con === void 0 ? void 0 : _ComponentManager$con._sourcePackage) || null
25644
25691
  }
25645
25692
  }));