@trops/dash-core 0.1.598 → 0.1.599

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
@@ -10134,11 +10134,91 @@ function applyFilters(items, filters, mode) {
10134
10134
  });
10135
10135
  }
10136
10136
 
10137
+ var PREVIEW_TEMPLATE_SHAPE = {
10138
+ single: {
10139
+ rows: 1,
10140
+ cols: 1
10141
+ },
10142
+ "two-columns": {
10143
+ rows: 1,
10144
+ cols: 2
10145
+ },
10146
+ "two-rows": {
10147
+ rows: 2,
10148
+ cols: 1
10149
+ },
10150
+ "three-columns": {
10151
+ rows: 1,
10152
+ cols: 3
10153
+ },
10154
+ "two-by-two": {
10155
+ rows: 2,
10156
+ cols: 2
10157
+ },
10158
+ "two-by-three": {
10159
+ rows: 2,
10160
+ cols: 3
10161
+ },
10162
+ "three-by-three": {
10163
+ rows: 3,
10164
+ cols: 3
10165
+ }
10166
+ };
10167
+ function WizardThemePreview(_ref) {
10168
+ var theme = _ref.theme,
10169
+ templateKey = _ref.templateKey;
10170
+ if (!theme) return null;
10171
+ var shape = PREVIEW_TEMPLATE_SHAPE[templateKey] || {
10172
+ rows: 2,
10173
+ cols: 2
10174
+ };
10175
+ var familyOrder = [theme.primary, theme.secondary, theme.tertiary].filter(function (f) {
10176
+ return typeof f === "string" && f.length > 0;
10177
+ });
10178
+ if (familyOrder.length === 0) return null;
10179
+ var totalCells = shape.rows * shape.cols;
10180
+ return /*#__PURE__*/jsxs("div", {
10181
+ className: "rounded-lg border border-gray-700/50 bg-gray-900/30 p-3 flex flex-col gap-2",
10182
+ "data-testid": "wizard-theme-preview",
10183
+ children: [/*#__PURE__*/jsxs("div", {
10184
+ className: "flex items-center gap-2 text-xs text-gray-400",
10185
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
10186
+ icon: "eye",
10187
+ fixedWidth: true,
10188
+ className: "text-gray-500"
10189
+ }), /*#__PURE__*/jsxs("span", {
10190
+ children: ["Preview \xB7 ", theme.name || ""]
10191
+ }), templateKey && /*#__PURE__*/jsxs("span", {
10192
+ className: "text-gray-600",
10193
+ children: ["(", shape.rows, "\xD7", shape.cols, ")"]
10194
+ })]
10195
+ }), /*#__PURE__*/jsx("div", {
10196
+ className: "grid gap-1.5",
10197
+ style: {
10198
+ gridTemplateRows: "repeat(".concat(shape.rows, ", minmax(0, 1fr))"),
10199
+ gridTemplateColumns: "repeat(".concat(shape.cols, ", minmax(0, 1fr))"),
10200
+ minHeight: "5rem"
10201
+ },
10202
+ "data-testid": "wizard-theme-preview-grid",
10203
+ children: Array.from({
10204
+ length: totalCells
10205
+ }).map(function (_, i) {
10206
+ var family = familyOrder[i % familyOrder.length];
10207
+ return /*#__PURE__*/jsx("div", {
10208
+ className: "rounded bg-".concat(family, "-500/70 border border-").concat(family, "-400/40"),
10209
+ "data-testid": "wizard-theme-preview-cell-".concat(i),
10210
+ "data-family": family
10211
+ }, i);
10212
+ })
10213
+ })]
10214
+ });
10215
+ }
10216
+
10137
10217
  function _createForOfIteratorHelper$G(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$G(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
10138
10218
  function _unsupportedIterableToArray$G(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$G(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$G(r, a) : void 0; } }
10139
10219
  function _arrayLikeToArray$G(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
10140
10220
  var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
10141
- var _state$selectedDashbo, _state$selectedDashbo2;
10221
+ var _state$selectedDashbo, _state$selectedDashbo2, _state$layout;
10142
10222
  var state = _ref.state,
10143
10223
  dispatch = _ref.dispatch,
10144
10224
  _ref$menuItems = _ref.menuItems,
@@ -10910,6 +10990,9 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
10910
10990
  })
10911
10991
  }, key);
10912
10992
  })
10993
+ }), state.customization.theme && /*#__PURE__*/jsx(WizardThemePreview, {
10994
+ theme: themes === null || themes === void 0 ? void 0 : themes[state.customization.theme],
10995
+ templateKey: (_state$layout = state.layout) === null || _state$layout === void 0 ? void 0 : _state$layout.templateKey
10913
10996
  })]
10914
10997
  }), selectedProviders.length > 0 && /*#__PURE__*/jsxs("div", {
10915
10998
  className: "flex flex-col gap-2",
@@ -49733,7 +49816,23 @@ var WidgetsSection = function WidgetsSection(_ref) {
49733
49816
  }
49734
49817
  var listContent = /*#__PURE__*/jsxs("div", {
49735
49818
  className: "flex flex-col h-full",
49736
- children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
49819
+ children: [/*#__PURE__*/jsx("div", {
49820
+ className: "flex-shrink-0 px-3 pt-2 pb-1",
49821
+ children: /*#__PURE__*/jsxs("button", {
49822
+ type: "button",
49823
+ onClick: function onClick() {
49824
+ return window.dispatchEvent(new Event("dash:open-widget-builder"));
49825
+ },
49826
+ className: "w-full flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium rounded bg-indigo-600 hover:bg-indigo-500 text-white",
49827
+ "data-testid": "widgets-section-new-widget-button",
49828
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
49829
+ icon: "plus",
49830
+ className: "text-xs"
49831
+ }), /*#__PURE__*/jsx("span", {
49832
+ children: "New Widget"
49833
+ })]
49834
+ })
49835
+ }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
49737
49836
  className: "flex-shrink-0 px-3 py-2 border-b border-white/10 bg-gray-800/60 flex items-center gap-2 text-xs text-gray-400",
49738
49837
  "data-testid": "widgets-section-checking-updates",
49739
49838
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -58460,6 +58559,8 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58460
58559
  onSaveListeners = _ref.onSaveListeners,
58461
58560
  _ref$onSaveUserPrefs = _ref.onSaveUserPrefs,
58462
58561
  onSaveUserPrefs = _ref$onSaveUserPrefs === void 0 ? null : _ref$onSaveUserPrefs,
58562
+ _ref$onSkip = _ref.onSkip,
58563
+ onSkip = _ref$onSkip === void 0 ? null : _ref$onSkip,
58463
58564
  _ref$initialTab = _ref.initialTab,
58464
58565
  initialTab = _ref$initialTab === void 0 ? "providers" : _ref$initialTab;
58465
58566
  var _useContext = useContext(ThemeContext),
@@ -58973,6 +59074,23 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58973
59074
  setStagedPrefs({});
58974
59075
  setIsOpen(false);
58975
59076
  }
59077
+
59078
+ // "Skip for now" — closes the modal AND tells the parent to suppress
59079
+ // the unresolved-providers banner for the current session. Cancel
59080
+ // just closes; Skip means "I'm intentionally not dealing with this
59081
+ // right now." Without this affordance, new users who hit the
59082
+ // post-install state can feel cornered by the banner reappearing
59083
+ // every time they close the modal without resolving every provider.
59084
+ function handleSkip() {
59085
+ setStaged({});
59086
+ setStagedListeners({
59087
+ adds: [],
59088
+ removes: []
59089
+ });
59090
+ setStagedPrefs({});
59091
+ if (typeof onSkip === "function") onSkip();
59092
+ setIsOpen(false);
59093
+ }
58976
59094
  if (!isOpen) return null;
58977
59095
  return /*#__PURE__*/jsx(Modal, {
58978
59096
  isOpen: isOpen,
@@ -59084,7 +59202,10 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
59084
59202
  })]
59085
59203
  }), /*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsxs("div", {
59086
59204
  className: "flex-shrink-0 flex flex-row justify-end gap-2 p-4",
59087
- children: [/*#__PURE__*/jsx(Button3, {
59205
+ children: [typeof onSkip === "function" && /*#__PURE__*/jsx(Button3, {
59206
+ title: "Skip for now",
59207
+ onClick: handleSkip
59208
+ }), /*#__PURE__*/jsx(Button3, {
59088
59209
  title: "Cancel",
59089
59210
  onClick: handleCancel
59090
59211
  }), /*#__PURE__*/jsx(Button2, {
@@ -62783,6 +62904,18 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
62783
62904
  onSaveBindings: handleBulkProviderBindings,
62784
62905
  onSaveListeners: handleBulkListenerBindings,
62785
62906
  onSaveUserPrefs: handleBulkUserPrefs,
62907
+ onSkip: function onSkip() {
62908
+ // Suppress the unresolved-providers banner for this
62909
+ // workspace (session-scoped). Matches the banner's own
62910
+ // X-dismiss behavior so the user has parity between
62911
+ // "dismiss from the banner" and "dismiss from the
62912
+ // modal footer."
62913
+ if ((workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id) != null) {
62914
+ setDismissedUnresolvedForWorkspace(function (prev) {
62915
+ return new Set([].concat(_toConsumableArray(prev), [workspaceSelected.id]));
62916
+ });
62917
+ }
62918
+ },
62786
62919
  initialTab: "providers"
62787
62920
  }), /*#__PURE__*/jsx(OnboardingModal, {
62788
62921
  open: isOnboardingOpen === true,