@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.js CHANGED
@@ -2548,6 +2548,20 @@ var ThemeWrapper = function ThemeWrapper(_ref) {
2548
2548
  });
2549
2549
  };
2550
2550
 
2551
+ function AppContextBroadcast(_ref) {
2552
+ var ctx = _ref.ctx;
2553
+ React.useEffect(function () {
2554
+ if (ctx && typeof window !== "undefined") {
2555
+ window.__dashAppContext = ctx;
2556
+ window.dispatchEvent(new Event("dash:app-context-changed"));
2557
+ }
2558
+ }, [ctx]);
2559
+ return null;
2560
+ }
2561
+
2562
+ // TODO
2563
+ // make theme files or have a Theme context which we can populate with a plugin or config
2564
+ // color theme (coming soon)
2551
2565
  var debugStyles = {
2552
2566
  workspace: {
2553
2567
  classes: "bg-gray-800 border border-red-900 rounded p-4"
@@ -2565,11 +2579,11 @@ var debugStyles = {
2565
2579
  classes: "border border-blue-700 bg-gray-800 rounded p-4"
2566
2580
  }
2567
2581
  };
2568
- var AppWrapper = function AppWrapper(_ref) {
2569
- var children = _ref.children,
2570
- _ref$credentials = _ref.credentials,
2571
- credentials = _ref$credentials === void 0 ? null : _ref$credentials,
2572
- dashApi = _ref.dashApi;
2582
+ var AppWrapper = function AppWrapper(_ref2) {
2583
+ var children = _ref2.children,
2584
+ _ref2$credentials = _ref2.credentials,
2585
+ credentials = _ref2$credentials === void 0 ? null : _ref2$credentials,
2586
+ dashApi = _ref2.dashApi;
2573
2587
  var _useState = React.useState(credentials),
2574
2588
  _useState2 = _slicedToArray(_useState, 2),
2575
2589
  creds = _useState2[0],
@@ -2803,9 +2817,11 @@ var AppWrapper = function AppWrapper(_ref) {
2803
2817
  return null;
2804
2818
  }
2805
2819
  }, [debugMode, creds, credentials, searchClient, dashApi, settings, providers, isLoadingProviders, loadProviders, changeSearchClient, changeCreds, changeDebugMode, changeSettings, changeApplicationTheme, openDataDirectory]);
2806
- return /*#__PURE__*/jsxRuntime.jsx(AppContext.Provider, {
2820
+ return /*#__PURE__*/jsxRuntime.jsxs(AppContext.Provider, {
2807
2821
  value: contextValue,
2808
- children: children
2822
+ children: [/*#__PURE__*/jsxRuntime.jsx(AppContextBroadcast, {
2823
+ ctx: contextValue
2824
+ }), children]
2809
2825
  });
2810
2826
  };
2811
2827
 
@@ -2876,9 +2892,30 @@ var DashboardWrapper = function DashboardWrapper(_ref) {
2876
2892
 
2877
2893
  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
2894
  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;
2895
+ function ThemeBroadcast(_ref) {
2896
+ var ctx = _ref.ctx;
2897
+ React.useEffect(function () {
2898
+ if (ctx !== null && ctx !== void 0 && ctx.currentTheme && typeof window !== "undefined") {
2899
+ window.__dashThemeContext = ctx;
2900
+ window.dispatchEvent(new Event("dash:theme-changed"));
2901
+ }
2902
+ }, [ctx]);
2903
+ return null;
2904
+ }
2905
+
2906
+ /**
2907
+ * DashboardThemeProvider
2908
+ *
2909
+ * Wraps dashboard content with a nested ThemeContext.Provider when a
2910
+ * dashboard has its own themeKey. Components inside find the nearest
2911
+ * provider automatically — zero changes needed in dash-react.
2912
+ *
2913
+ * App chrome (navbar, tab bar, sidebar) stays OUTSIDE this wrapper
2914
+ * and keeps the app theme.
2915
+ */
2916
+ var DashboardThemeProvider = function DashboardThemeProvider(_ref2) {
2917
+ var themeKey = _ref2.themeKey,
2918
+ children = _ref2.children;
2882
2919
  var parentContext = React.useContext(DashReact.ThemeContext);
2883
2920
  var themes = parentContext.themes,
2884
2921
  themeVariant = parentContext.themeVariant;
@@ -2896,12 +2933,21 @@ var DashboardThemeProvider = function DashboardThemeProvider(_ref) {
2896
2933
  appThemeKey: parentContext.currentThemeKey
2897
2934
  });
2898
2935
  }, [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, {
2936
+
2937
+ // Broadcast the effective theme (dashboard override or parent)
2938
+ var effectiveCtx = contextValue || parentContext;
2939
+ if (!contextValue) {
2940
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2941
+ children: [/*#__PURE__*/jsxRuntime.jsx(ThemeBroadcast, {
2942
+ ctx: effectiveCtx
2943
+ }), children]
2944
+ });
2945
+ }
2946
+ return /*#__PURE__*/jsxRuntime.jsxs(DashReact.ThemeContext.Provider, {
2903
2947
  value: contextValue,
2904
- children: children
2948
+ children: [/*#__PURE__*/jsxRuntime.jsx(ThemeBroadcast, {
2949
+ ctx: contextValue
2950
+ }), children]
2905
2951
  });
2906
2952
  };
2907
2953
 
@@ -25658,6 +25704,7 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
25658
25704
  workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id,
25659
25705
  widgetComponentName: cellComponent.component,
25660
25706
  widgetId: cellComponent.id,
25707
+ selectedProviders: cellComponent.selectedProviders || null,
25661
25708
  sourcePackage: ((_ComponentManager$con = ComponentManager.config(cellComponent.component, cellComponent)) === null || _ComponentManager$con === void 0 ? void 0 : _ComponentManager$con._sourcePackage) || null
25662
25709
  }
25663
25710
  }));