@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.js CHANGED
@@ -10152,11 +10152,91 @@ function applyFilters(items, filters, mode) {
10152
10152
  });
10153
10153
  }
10154
10154
 
10155
+ var PREVIEW_TEMPLATE_SHAPE = {
10156
+ single: {
10157
+ rows: 1,
10158
+ cols: 1
10159
+ },
10160
+ "two-columns": {
10161
+ rows: 1,
10162
+ cols: 2
10163
+ },
10164
+ "two-rows": {
10165
+ rows: 2,
10166
+ cols: 1
10167
+ },
10168
+ "three-columns": {
10169
+ rows: 1,
10170
+ cols: 3
10171
+ },
10172
+ "two-by-two": {
10173
+ rows: 2,
10174
+ cols: 2
10175
+ },
10176
+ "two-by-three": {
10177
+ rows: 2,
10178
+ cols: 3
10179
+ },
10180
+ "three-by-three": {
10181
+ rows: 3,
10182
+ cols: 3
10183
+ }
10184
+ };
10185
+ function WizardThemePreview(_ref) {
10186
+ var theme = _ref.theme,
10187
+ templateKey = _ref.templateKey;
10188
+ if (!theme) return null;
10189
+ var shape = PREVIEW_TEMPLATE_SHAPE[templateKey] || {
10190
+ rows: 2,
10191
+ cols: 2
10192
+ };
10193
+ var familyOrder = [theme.primary, theme.secondary, theme.tertiary].filter(function (f) {
10194
+ return typeof f === "string" && f.length > 0;
10195
+ });
10196
+ if (familyOrder.length === 0) return null;
10197
+ var totalCells = shape.rows * shape.cols;
10198
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
10199
+ className: "rounded-lg border border-gray-700/50 bg-gray-900/30 p-3 flex flex-col gap-2",
10200
+ "data-testid": "wizard-theme-preview",
10201
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
10202
+ className: "flex items-center gap-2 text-xs text-gray-400",
10203
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
10204
+ icon: "eye",
10205
+ fixedWidth: true,
10206
+ className: "text-gray-500"
10207
+ }), /*#__PURE__*/jsxRuntime.jsxs("span", {
10208
+ children: ["Preview \xB7 ", theme.name || ""]
10209
+ }), templateKey && /*#__PURE__*/jsxRuntime.jsxs("span", {
10210
+ className: "text-gray-600",
10211
+ children: ["(", shape.rows, "\xD7", shape.cols, ")"]
10212
+ })]
10213
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
10214
+ className: "grid gap-1.5",
10215
+ style: {
10216
+ gridTemplateRows: "repeat(".concat(shape.rows, ", minmax(0, 1fr))"),
10217
+ gridTemplateColumns: "repeat(".concat(shape.cols, ", minmax(0, 1fr))"),
10218
+ minHeight: "5rem"
10219
+ },
10220
+ "data-testid": "wizard-theme-preview-grid",
10221
+ children: Array.from({
10222
+ length: totalCells
10223
+ }).map(function (_, i) {
10224
+ var family = familyOrder[i % familyOrder.length];
10225
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
10226
+ className: "rounded bg-".concat(family, "-500/70 border border-").concat(family, "-400/40"),
10227
+ "data-testid": "wizard-theme-preview-cell-".concat(i),
10228
+ "data-family": family
10229
+ }, i);
10230
+ })
10231
+ })]
10232
+ });
10233
+ }
10234
+
10155
10235
  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; } } }; }
10156
10236
  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; } }
10157
10237
  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; }
10158
10238
  var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
10159
- var _state$selectedDashbo, _state$selectedDashbo2;
10239
+ var _state$selectedDashbo, _state$selectedDashbo2, _state$layout;
10160
10240
  var state = _ref.state,
10161
10241
  dispatch = _ref.dispatch,
10162
10242
  _ref$menuItems = _ref.menuItems,
@@ -10928,6 +11008,9 @@ var WizardCustomizeStep = function WizardCustomizeStep(_ref) {
10928
11008
  })
10929
11009
  }, key);
10930
11010
  })
11011
+ }), state.customization.theme && /*#__PURE__*/jsxRuntime.jsx(WizardThemePreview, {
11012
+ theme: themes === null || themes === void 0 ? void 0 : themes[state.customization.theme],
11013
+ templateKey: (_state$layout = state.layout) === null || _state$layout === void 0 ? void 0 : _state$layout.templateKey
10931
11014
  })]
10932
11015
  }), selectedProviders.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
10933
11016
  className: "flex flex-col gap-2",
@@ -49751,7 +49834,23 @@ var WidgetsSection = function WidgetsSection(_ref) {
49751
49834
  }
49752
49835
  var listContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
49753
49836
  className: "flex flex-col h-full",
49754
- children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
49837
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49838
+ className: "flex-shrink-0 px-3 pt-2 pb-1",
49839
+ children: /*#__PURE__*/jsxRuntime.jsxs("button", {
49840
+ type: "button",
49841
+ onClick: function onClick() {
49842
+ return window.dispatchEvent(new Event("dash:open-widget-builder"));
49843
+ },
49844
+ 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",
49845
+ "data-testid": "widgets-section-new-widget-button",
49846
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49847
+ icon: "plus",
49848
+ className: "text-xs"
49849
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
49850
+ children: "New Widget"
49851
+ })]
49852
+ })
49853
+ }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
49755
49854
  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",
49756
49855
  "data-testid": "widgets-section-checking-updates",
49757
49856
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
@@ -58478,6 +58577,8 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58478
58577
  onSaveListeners = _ref.onSaveListeners,
58479
58578
  _ref$onSaveUserPrefs = _ref.onSaveUserPrefs,
58480
58579
  onSaveUserPrefs = _ref$onSaveUserPrefs === void 0 ? null : _ref$onSaveUserPrefs,
58580
+ _ref$onSkip = _ref.onSkip,
58581
+ onSkip = _ref$onSkip === void 0 ? null : _ref$onSkip,
58481
58582
  _ref$initialTab = _ref.initialTab,
58482
58583
  initialTab = _ref$initialTab === void 0 ? "providers" : _ref$initialTab;
58483
58584
  var _useContext = React.useContext(DashReact.ThemeContext),
@@ -58991,6 +59092,23 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58991
59092
  setStagedPrefs({});
58992
59093
  setIsOpen(false);
58993
59094
  }
59095
+
59096
+ // "Skip for now" — closes the modal AND tells the parent to suppress
59097
+ // the unresolved-providers banner for the current session. Cancel
59098
+ // just closes; Skip means "I'm intentionally not dealing with this
59099
+ // right now." Without this affordance, new users who hit the
59100
+ // post-install state can feel cornered by the banner reappearing
59101
+ // every time they close the modal without resolving every provider.
59102
+ function handleSkip() {
59103
+ setStaged({});
59104
+ setStagedListeners({
59105
+ adds: [],
59106
+ removes: []
59107
+ });
59108
+ setStagedPrefs({});
59109
+ if (typeof onSkip === "function") onSkip();
59110
+ setIsOpen(false);
59111
+ }
58994
59112
  if (!isOpen) return null;
58995
59113
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
58996
59114
  isOpen: isOpen,
@@ -59102,7 +59220,10 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
59102
59220
  })]
59103
59221
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Divider, {}), /*#__PURE__*/jsxRuntime.jsxs("div", {
59104
59222
  className: "flex-shrink-0 flex flex-row justify-end gap-2 p-4",
59105
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59223
+ children: [typeof onSkip === "function" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59224
+ title: "Skip for now",
59225
+ onClick: handleSkip
59226
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59106
59227
  title: "Cancel",
59107
59228
  onClick: handleCancel
59108
59229
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
@@ -62801,6 +62922,18 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
62801
62922
  onSaveBindings: handleBulkProviderBindings,
62802
62923
  onSaveListeners: handleBulkListenerBindings,
62803
62924
  onSaveUserPrefs: handleBulkUserPrefs,
62925
+ onSkip: function onSkip() {
62926
+ // Suppress the unresolved-providers banner for this
62927
+ // workspace (session-scoped). Matches the banner's own
62928
+ // X-dismiss behavior so the user has parity between
62929
+ // "dismiss from the banner" and "dismiss from the
62930
+ // modal footer."
62931
+ if ((workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id) != null) {
62932
+ setDismissedUnresolvedForWorkspace(function (prev) {
62933
+ return new Set([].concat(_toConsumableArray(prev), [workspaceSelected.id]));
62934
+ });
62935
+ }
62936
+ },
62804
62937
  initialTab: "providers"
62805
62938
  }), /*#__PURE__*/jsxRuntime.jsx(OnboardingModal, {
62806
62939
  open: isOnboardingOpen === true,