@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.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",
@@ -47248,6 +47331,74 @@ var GeneralSection = function GeneralSection() {
47248
47331
  _useState2 = _slicedToArray(_useState, 2),
47249
47332
  dataDirectory = _useState2[0],
47250
47333
  setDataDirectory = _useState2[1];
47334
+
47335
+ // Export Everything (Phase 4A) — kind: "success" | "error"
47336
+ var _useState3 = React.useState(false),
47337
+ _useState4 = _slicedToArray(_useState3, 2),
47338
+ isExporting = _useState4[0],
47339
+ setIsExporting = _useState4[1];
47340
+ var _useState5 = React.useState(null),
47341
+ _useState6 = _slicedToArray(_useState5, 2),
47342
+ exportFeedback = _useState6[0],
47343
+ setExportFeedback = _useState6[1];
47344
+ function handleExportEverything() {
47345
+ return _handleExportEverything.apply(this, arguments);
47346
+ }
47347
+ function _handleExportEverything() {
47348
+ _handleExportEverything = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47349
+ var _window$mainApi, _window$mainApi$expor, result, _t;
47350
+ return _regeneratorRuntime.wrap(function (_context) {
47351
+ while (1) switch (_context.prev = _context.next) {
47352
+ case 0:
47353
+ if (credentials !== null && credentials !== void 0 && credentials.appId) {
47354
+ _context.next = 1;
47355
+ break;
47356
+ }
47357
+ setExportFeedback({
47358
+ kind: "error",
47359
+ message: "No application context."
47360
+ });
47361
+ return _context.abrupt("return");
47362
+ case 1:
47363
+ setIsExporting(true);
47364
+ setExportFeedback(null);
47365
+ _context.prev = 2;
47366
+ _context.next = 3;
47367
+ 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);
47368
+ case 3:
47369
+ result = _context.sent;
47370
+ if (result !== null && result !== void 0 && result.success) {
47371
+ setExportFeedback({
47372
+ kind: "success",
47373
+ message: "Saved to ".concat(result.filePath)
47374
+ });
47375
+ } else if (result !== null && result !== void 0 && result.canceled) ; else {
47376
+ setExportFeedback({
47377
+ kind: "error",
47378
+ message: (result === null || result === void 0 ? void 0 : result.error) || "Export failed."
47379
+ });
47380
+ }
47381
+ _context.next = 5;
47382
+ break;
47383
+ case 4:
47384
+ _context.prev = 4;
47385
+ _t = _context["catch"](2);
47386
+ setExportFeedback({
47387
+ kind: "error",
47388
+ message: (_t === null || _t === void 0 ? void 0 : _t.message) || "Export failed."
47389
+ });
47390
+ case 5:
47391
+ _context.prev = 5;
47392
+ setIsExporting(false);
47393
+ return _context.finish(5);
47394
+ case 6:
47395
+ case "end":
47396
+ return _context.stop();
47397
+ }
47398
+ }, _callee, null, [[2, 4, 5, 6]]);
47399
+ }));
47400
+ return _handleExportEverything.apply(this, arguments);
47401
+ }
47251
47402
  React.useEffect(function () {
47252
47403
  var dashApi = appContext === null || appContext === void 0 ? void 0 : appContext.dashApi;
47253
47404
  if (dashApi) {
@@ -47344,6 +47495,33 @@ var GeneralSection = function GeneralSection() {
47344
47495
  onClick: handleOpenDataDirectory
47345
47496
  })]
47346
47497
  })]
47498
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47499
+ className: "flex flex-col space-y-3",
47500
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading3, {
47501
+ title: "Backup",
47502
+ padding: false
47503
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47504
+ className: "flex flex-row items-center justify-between py-3",
47505
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
47506
+ className: "flex flex-col",
47507
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
47508
+ className: "text-sm font-medium",
47509
+ children: "Export Everything"
47510
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
47511
+ className: "text-xs opacity-50",
47512
+ children: "Save a ZIP of your workspaces, themes, folders, and provider settings. Credentials are not included."
47513
+ }), exportFeedback && /*#__PURE__*/jsxRuntime.jsx("span", {
47514
+ className: "text-xs mt-1 ".concat(exportFeedback.kind === "success" ? "text-green-400" : "text-red-400"),
47515
+ "data-testid": "export-feedback",
47516
+ children: exportFeedback.message
47517
+ })]
47518
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
47519
+ title: isExporting ? "Exporting…" : "Export Everything",
47520
+ onClick: handleExportEverything,
47521
+ disabled: isExporting,
47522
+ "data-testid": "export-everything-button"
47523
+ })]
47524
+ })]
47347
47525
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47348
47526
  className: "flex flex-col space-y-3",
47349
47527
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SubHeading3, {
@@ -49716,12 +49894,14 @@ var WidgetsSection = function WidgetsSection(_ref) {
49716
49894
  className: isSelected ? "bg-white/10 opacity-100" : "",
49717
49895
  children: /*#__PURE__*/jsxRuntime.jsxs("span", {
49718
49896
  className: "flex flex-col",
49897
+ "data-testid": "widget-row-".concat(widget.name),
49719
49898
  children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
49720
49899
  className: "flex items-center gap-2",
49721
49900
  children: [widget.displayName || widget.name, widget.source === "builtin" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Tag3, {
49722
49901
  text: "Built-in"
49723
49902
  }), updates.has(widget.name) && /*#__PURE__*/jsxRuntime.jsx("span", {
49724
49903
  className: "text-[10px] text-blue-400 font-medium",
49904
+ "data-testid": "widget-update-badge-".concat(widget.name),
49725
49905
  children: "Update"
49726
49906
  })]
49727
49907
  }), (widget.scopedId || widget.name) && /*#__PURE__*/jsxRuntime.jsx("span", {
@@ -49751,7 +49931,23 @@ var WidgetsSection = function WidgetsSection(_ref) {
49751
49931
  }
49752
49932
  var listContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
49753
49933
  className: "flex flex-col h-full",
49754
- children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
49934
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49935
+ className: "flex-shrink-0 px-3 pt-2 pb-1",
49936
+ children: /*#__PURE__*/jsxRuntime.jsxs("button", {
49937
+ type: "button",
49938
+ onClick: function onClick() {
49939
+ return window.dispatchEvent(new Event("dash:open-widget-builder"));
49940
+ },
49941
+ 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",
49942
+ "data-testid": "widgets-section-new-widget-button",
49943
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49944
+ icon: "plus",
49945
+ className: "text-xs"
49946
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
49947
+ children: "New Widget"
49948
+ })]
49949
+ })
49950
+ }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
49755
49951
  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
49952
  "data-testid": "widgets-section-checking-updates",
49757
49953
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
@@ -58478,6 +58674,8 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58478
58674
  onSaveListeners = _ref.onSaveListeners,
58479
58675
  _ref$onSaveUserPrefs = _ref.onSaveUserPrefs,
58480
58676
  onSaveUserPrefs = _ref$onSaveUserPrefs === void 0 ? null : _ref$onSaveUserPrefs,
58677
+ _ref$onSkip = _ref.onSkip,
58678
+ onSkip = _ref$onSkip === void 0 ? null : _ref$onSkip,
58481
58679
  _ref$initialTab = _ref.initialTab,
58482
58680
  initialTab = _ref$initialTab === void 0 ? "providers" : _ref$initialTab;
58483
58681
  var _useContext = React.useContext(DashReact.ThemeContext),
@@ -58991,6 +59189,23 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
58991
59189
  setStagedPrefs({});
58992
59190
  setIsOpen(false);
58993
59191
  }
59192
+
59193
+ // "Skip for now" — closes the modal AND tells the parent to suppress
59194
+ // the unresolved-providers banner for the current session. Cancel
59195
+ // just closes; Skip means "I'm intentionally not dealing with this
59196
+ // right now." Without this affordance, new users who hit the
59197
+ // post-install state can feel cornered by the banner reappearing
59198
+ // every time they close the modal without resolving every provider.
59199
+ function handleSkip() {
59200
+ setStaged({});
59201
+ setStagedListeners({
59202
+ adds: [],
59203
+ removes: []
59204
+ });
59205
+ setStagedPrefs({});
59206
+ if (typeof onSkip === "function") onSkip();
59207
+ setIsOpen(false);
59208
+ }
58994
59209
  if (!isOpen) return null;
58995
59210
  return /*#__PURE__*/jsxRuntime.jsx(DashReact.Modal, {
58996
59211
  isOpen: isOpen,
@@ -59102,7 +59317,10 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
59102
59317
  })]
59103
59318
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Divider, {}), /*#__PURE__*/jsxRuntime.jsxs("div", {
59104
59319
  className: "flex-shrink-0 flex flex-row justify-end gap-2 p-4",
59105
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59320
+ children: [typeof onSkip === "function" && /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59321
+ title: "Skip for now",
59322
+ onClick: handleSkip
59323
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
59106
59324
  title: "Cancel",
59107
59325
  onClick: handleCancel
59108
59326
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
@@ -62801,6 +63019,18 @@ var DashboardStageInner = function DashboardStageInner(_ref3) {
62801
63019
  onSaveBindings: handleBulkProviderBindings,
62802
63020
  onSaveListeners: handleBulkListenerBindings,
62803
63021
  onSaveUserPrefs: handleBulkUserPrefs,
63022
+ onSkip: function onSkip() {
63023
+ // Suppress the unresolved-providers banner for this
63024
+ // workspace (session-scoped). Matches the banner's own
63025
+ // X-dismiss behavior so the user has parity between
63026
+ // "dismiss from the banner" and "dismiss from the
63027
+ // modal footer."
63028
+ if ((workspaceSelected === null || workspaceSelected === void 0 ? void 0 : workspaceSelected.id) != null) {
63029
+ setDismissedUnresolvedForWorkspace(function (prev) {
63030
+ return new Set([].concat(_toConsumableArray(prev), [workspaceSelected.id]));
63031
+ });
63032
+ }
63033
+ },
62804
63034
  initialTab: "providers"
62805
63035
  }), /*#__PURE__*/jsxRuntime.jsx(OnboardingModal, {
62806
63036
  open: isOnboardingOpen === true,