@trops/dash-core 0.1.598 → 0.1.600

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",
@@ -47230,6 +47313,74 @@ var GeneralSection = function GeneralSection() {
47230
47313
  _useState2 = _slicedToArray(_useState, 2),
47231
47314
  dataDirectory = _useState2[0],
47232
47315
  setDataDirectory = _useState2[1];
47316
+
47317
+ // Export Everything (Phase 4A) — kind: "success" | "error"
47318
+ var _useState3 = useState(false),
47319
+ _useState4 = _slicedToArray(_useState3, 2),
47320
+ isExporting = _useState4[0],
47321
+ setIsExporting = _useState4[1];
47322
+ var _useState5 = useState(null),
47323
+ _useState6 = _slicedToArray(_useState5, 2),
47324
+ exportFeedback = _useState6[0],
47325
+ setExportFeedback = _useState6[1];
47326
+ function handleExportEverything() {
47327
+ return _handleExportEverything.apply(this, arguments);
47328
+ }
47329
+ function _handleExportEverything() {
47330
+ _handleExportEverything = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47331
+ var _window$mainApi, _window$mainApi$expor, result, _t;
47332
+ return _regeneratorRuntime.wrap(function (_context) {
47333
+ while (1) switch (_context.prev = _context.next) {
47334
+ case 0:
47335
+ if (credentials !== null && credentials !== void 0 && credentials.appId) {
47336
+ _context.next = 1;
47337
+ break;
47338
+ }
47339
+ setExportFeedback({
47340
+ kind: "error",
47341
+ message: "No application context."
47342
+ });
47343
+ return _context.abrupt("return");
47344
+ case 1:
47345
+ setIsExporting(true);
47346
+ setExportFeedback(null);
47347
+ _context.prev = 2;
47348
+ _context.next = 3;
47349
+ return (_window$mainApi = window.mainApi) === null || _window$mainApi === void 0 || (_window$mainApi = _window$mainApi["export"]) === null || _window$mainApi === void 0 || (_window$mainApi$expor = _window$mainApi.exportEverything) === null || _window$mainApi$expor === void 0 ? void 0 : _window$mainApi$expor.call(_window$mainApi, credentials.appId);
47350
+ case 3:
47351
+ result = _context.sent;
47352
+ if (result !== null && result !== void 0 && result.success) {
47353
+ setExportFeedback({
47354
+ kind: "success",
47355
+ message: "Saved to ".concat(result.filePath)
47356
+ });
47357
+ } else if (result !== null && result !== void 0 && result.canceled) ; else {
47358
+ setExportFeedback({
47359
+ kind: "error",
47360
+ message: (result === null || result === void 0 ? void 0 : result.error) || "Export failed."
47361
+ });
47362
+ }
47363
+ _context.next = 5;
47364
+ break;
47365
+ case 4:
47366
+ _context.prev = 4;
47367
+ _t = _context["catch"](2);
47368
+ setExportFeedback({
47369
+ kind: "error",
47370
+ message: (_t === null || _t === void 0 ? void 0 : _t.message) || "Export failed."
47371
+ });
47372
+ case 5:
47373
+ _context.prev = 5;
47374
+ setIsExporting(false);
47375
+ return _context.finish(5);
47376
+ case 6:
47377
+ case "end":
47378
+ return _context.stop();
47379
+ }
47380
+ }, _callee, null, [[2, 4, 5, 6]]);
47381
+ }));
47382
+ return _handleExportEverything.apply(this, arguments);
47383
+ }
47233
47384
  useEffect(function () {
47234
47385
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
47235
47386
  if (dashApi) {
@@ -47326,6 +47477,33 @@ var GeneralSection = function GeneralSection() {
47326
47477
  onClick: handleOpenDataDirectory
47327
47478
  })]
47328
47479
  })]
47480
+ }), /*#__PURE__*/jsxs("div", {
47481
+ className: "flex flex-col space-y-3",
47482
+ children: [/*#__PURE__*/jsx(SubHeading3, {
47483
+ title: "Backup",
47484
+ padding: false
47485
+ }), /*#__PURE__*/jsxs("div", {
47486
+ className: "flex flex-row items-center justify-between py-3",
47487
+ children: [/*#__PURE__*/jsxs("div", {
47488
+ className: "flex flex-col",
47489
+ children: [/*#__PURE__*/jsx("span", {
47490
+ className: "text-sm font-medium",
47491
+ children: "Export Everything"
47492
+ }), /*#__PURE__*/jsx("span", {
47493
+ className: "text-xs opacity-50",
47494
+ children: "Save a ZIP of your workspaces, themes, folders, and provider settings. Credentials are not included."
47495
+ }), exportFeedback && /*#__PURE__*/jsx("span", {
47496
+ className: "text-xs mt-1 ".concat(exportFeedback.kind === "success" ? "text-green-400" : "text-red-400"),
47497
+ "data-testid": "export-feedback",
47498
+ children: exportFeedback.message
47499
+ })]
47500
+ }), /*#__PURE__*/jsx(Button, {
47501
+ title: isExporting ? "Exporting…" : "Export Everything",
47502
+ onClick: handleExportEverything,
47503
+ disabled: isExporting,
47504
+ "data-testid": "export-everything-button"
47505
+ })]
47506
+ })]
47329
47507
  }), /*#__PURE__*/jsxs("div", {
47330
47508
  className: "flex flex-col space-y-3",
47331
47509
  children: [/*#__PURE__*/jsx(SubHeading3, {
@@ -49698,12 +49876,14 @@ var WidgetsSection = function WidgetsSection(_ref) {
49698
49876
  className: isSelected ? "bg-white/10 opacity-100" : "",
49699
49877
  children: /*#__PURE__*/jsxs("span", {
49700
49878
  className: "flex flex-col",
49879
+ "data-testid": "widget-row-".concat(widget.name),
49701
49880
  children: [/*#__PURE__*/jsxs("span", {
49702
49881
  className: "flex items-center gap-2",
49703
49882
  children: [widget.displayName || widget.name, widget.source === "builtin" && /*#__PURE__*/jsx(Tag3, {
49704
49883
  text: "Built-in"
49705
49884
  }), updates.has(widget.name) && /*#__PURE__*/jsx("span", {
49706
49885
  className: "text-[10px] text-blue-400 font-medium",
49886
+ "data-testid": "widget-update-badge-".concat(widget.name),
49707
49887
  children: "Update"
49708
49888
  })]
49709
49889
  }), (widget.scopedId || widget.name) && /*#__PURE__*/jsx("span", {
@@ -49733,7 +49913,23 @@ var WidgetsSection = function WidgetsSection(_ref) {
49733
49913
  }
49734
49914
  var listContent = /*#__PURE__*/jsxs("div", {
49735
49915
  className: "flex flex-col h-full",
49736
- children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
49916
+ children: [/*#__PURE__*/jsx("div", {
49917
+ className: "flex-shrink-0 px-3 pt-2 pb-1",
49918
+ children: /*#__PURE__*/jsxs("button", {
49919
+ type: "button",
49920
+ onClick: function onClick() {
49921
+ return window.dispatchEvent(new Event("dash:open-widget-builder"));
49922
+ },
49923
+ 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",
49924
+ "data-testid": "widgets-section-new-widget-button",
49925
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
49926
+ icon: "plus",
49927
+ className: "text-xs"
49928
+ }), /*#__PURE__*/jsx("span", {
49929
+ children: "New Widget"
49930
+ })]
49931
+ })
49932
+ }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
49737
49933
  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
49934
  "data-testid": "widgets-section-checking-updates",
49739
49935
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -58460,6 +58656,8 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58460
58656
  onSaveListeners = _ref.onSaveListeners,
58461
58657
  _ref$onSaveUserPrefs = _ref.onSaveUserPrefs,
58462
58658
  onSaveUserPrefs = _ref$onSaveUserPrefs === void 0 ? null : _ref$onSaveUserPrefs,
58659
+ _ref$onSkip = _ref.onSkip,
58660
+ onSkip = _ref$onSkip === void 0 ? null : _ref$onSkip,
58463
58661
  _ref$initialTab = _ref.initialTab,
58464
58662
  initialTab = _ref$initialTab === void 0 ? "providers" : _ref$initialTab;
58465
58663
  var _useContext = useContext(ThemeContext),
@@ -58973,6 +59171,23 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58973
59171
  setStagedPrefs({});
58974
59172
  setIsOpen(false);
58975
59173
  }
59174
+
59175
+ // "Skip for now" — closes the modal AND tells the parent to suppress
59176
+ // the unresolved-providers banner for the current session. Cancel
59177
+ // just closes; Skip means "I'm intentionally not dealing with this
59178
+ // right now." Without this affordance, new users who hit the
59179
+ // post-install state can feel cornered by the banner reappearing
59180
+ // every time they close the modal without resolving every provider.
59181
+ function handleSkip() {
59182
+ setStaged({});
59183
+ setStagedListeners({
59184
+ adds: [],
59185
+ removes: []
59186
+ });
59187
+ setStagedPrefs({});
59188
+ if (typeof onSkip === "function") onSkip();
59189
+ setIsOpen(false);
59190
+ }
58976
59191
  if (!isOpen) return null;
58977
59192
  return /*#__PURE__*/jsx(Modal, {
58978
59193
  isOpen: isOpen,
@@ -59084,7 +59299,10 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
59084
59299
  })]
59085
59300
  }), /*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsxs("div", {
59086
59301
  className: "flex-shrink-0 flex flex-row justify-end gap-2 p-4",
59087
- children: [/*#__PURE__*/jsx(Button3, {
59302
+ children: [typeof onSkip === "function" && /*#__PURE__*/jsx(Button3, {
59303
+ title: "Skip for now",
59304
+ onClick: handleSkip
59305
+ }), /*#__PURE__*/jsx(Button3, {
59088
59306
  title: "Cancel",
59089
59307
  onClick: handleCancel
59090
59308
  }), /*#__PURE__*/jsx(Button2, {
@@ -62783,6 +63001,18 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
62783
63001
  onSaveBindings: handleBulkProviderBindings,
62784
63002
  onSaveListeners: handleBulkListenerBindings,
62785
63003
  onSaveUserPrefs: handleBulkUserPrefs,
63004
+ onSkip: function onSkip() {
63005
+ // Suppress the unresolved-providers banner for this
63006
+ // workspace (session-scoped). Matches the banner's own
63007
+ // X-dismiss behavior so the user has parity between
63008
+ // "dismiss from the banner" and "dismiss from the
63009
+ // modal footer."
63010
+ if ((workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id) != null) {
63011
+ setDismissedUnresolvedForWorkspace(function (prev) {
63012
+ return new Set([].concat(_toConsumableArray(prev), [workspaceSelected.id]));
63013
+ });
63014
+ }
63015
+ },
62786
63016
  initialTab: "providers"
62787
63017
  }), /*#__PURE__*/jsx(OnboardingModal, {
62788
63018
  open: isOnboardingOpen === true,