@trops/dash-core 0.1.301 → 0.1.303

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
@@ -17695,7 +17695,7 @@ var EnhancedWidgetDropdown = function EnhancedWidgetDropdown(_ref) {
17695
17695
  className: "px-2 py-1 rounded text-xs bg-transparent border ".concat(currentTheme["border-primary-medium"] || "border-gray-700", " ").concat(currentTheme["text-primary-light"] || "text-gray-300", " focus:outline-none appearance-none cursor-pointer"),
17696
17696
  children: [/*#__PURE__*/jsx("option", {
17697
17697
  value: "all",
17698
- children: "All Authors"
17698
+ children: "All Packages"
17699
17699
  }), getUniqueAuthors().map(function (author) {
17700
17700
  return /*#__PURE__*/jsx("option", {
17701
17701
  value: author,
@@ -44492,7 +44492,9 @@ var InstalledWidgetDetail = function InstalledWidgetDetail(_ref) {
44492
44492
  updateInfo = _ref$updateInfo === void 0 ? null : _ref$updateInfo,
44493
44493
  onUpdate = _ref.onUpdate,
44494
44494
  _ref$isUpdating = _ref.isUpdating,
44495
- isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating;
44495
+ isUpdating = _ref$isUpdating === void 0 ? false : _ref$isUpdating,
44496
+ _ref$updateError = _ref.updateError,
44497
+ updateError = _ref$updateError === void 0 ? null : _ref$updateError;
44496
44498
  var _useContext = useContext(ThemeContext),
44497
44499
  currentTheme = _useContext.currentTheme;
44498
44500
  var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
@@ -44603,6 +44605,12 @@ var InstalledWidgetDetail = function InstalledWidgetDetail(_ref) {
44603
44605
  children: widget.path
44604
44606
  })]
44605
44607
  })]
44608
+ }), updateError && /*#__PURE__*/jsx("div", {
44609
+ className: "flex-shrink-0 px-6 py-2",
44610
+ children: /*#__PURE__*/jsx("div", {
44611
+ className: "p-2 rounded bg-red-900/30 border border-red-700 text-xs text-red-400",
44612
+ children: updateError
44613
+ })
44606
44614
  }), widget.source !== "builtin" && /*#__PURE__*/jsxs("div", {
44607
44615
  className: "flex-shrink-0 flex flex-row justify-end gap-2 px-6 py-4 border-t ".concat(currentTheme["border-primary-medium"] || "border-white/10"),
44608
44616
  children: [updateInfo && /*#__PURE__*/jsx(Button, {
@@ -45566,17 +45574,25 @@ function useWidgetUpdates() {
45566
45574
  // Update a single widget by downloading the latest version
45567
45575
  var updateWidget = useCallback(/*#__PURE__*/function () {
45568
45576
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name) {
45569
- var info, widget, packageId, _window$mainApi2, status, resolvedUrl, _t;
45577
+ var info, widget, packageId, _window$mainApi2, profile, resolvedUrl, _t;
45570
45578
  return _regeneratorRuntime.wrap(function (_context) {
45571
45579
  while (1) switch (_context.prev = _context.next) {
45572
45580
  case 0:
45573
45581
  info = updates.get(name);
45574
- if (!(!info || !info.downloadUrl)) {
45582
+ if (info) {
45575
45583
  _context.next = 1;
45576
45584
  break;
45577
45585
  }
45586
+ setUpdateError("No update info found for \"".concat(name, "\"."));
45578
45587
  return _context.abrupt("return");
45579
45588
  case 1:
45589
+ if (info.downloadUrl) {
45590
+ _context.next = 2;
45591
+ break;
45592
+ }
45593
+ setUpdateError("Update for \"".concat(name, "\" has no download URL. The registry entry may be incomplete."));
45594
+ return _context.abrupt("return");
45595
+ case 2:
45580
45596
  // Use packageId for install — name may be a CM key (widget-level)
45581
45597
  widget = installedWidgets.find(function (w) {
45582
45598
  return w.name === name;
@@ -45584,22 +45600,23 @@ function useWidgetUpdates() {
45584
45600
  packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || info.name || name;
45585
45601
  setIsUpdating(name);
45586
45602
  setUpdateError(null);
45587
- _context.prev = 2;
45588
- _context.next = 3;
45589
- return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.registryAuth) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.getStatus();
45590
- case 3:
45591
- status = _context.sent;
45592
- if (status !== null && status !== void 0 && status.authenticated) {
45593
- _context.next = 4;
45603
+ _context.prev = 3;
45604
+ _context.next = 4;
45605
+ return (_window$mainApi2 = window.mainApi) === null || _window$mainApi2 === void 0 || (_window$mainApi2 = _window$mainApi2.registryAuth) === null || _window$mainApi2 === void 0 ? void 0 : _window$mainApi2.getProfile();
45606
+ case 4:
45607
+ profile = _context.sent;
45608
+ if (profile) {
45609
+ _context.next = 5;
45594
45610
  break;
45595
45611
  }
45596
45612
  setNeedsAuth(true);
45597
45613
  return _context.abrupt("return");
45598
- case 4:
45614
+ case 5:
45599
45615
  resolvedUrl = info.downloadUrl.replace(/\{version\}/g, info.latestVersion).replace(/\{name\}/g, packageId);
45600
- _context.next = 5;
45616
+ _context.next = 6;
45601
45617
  return window.mainApi.widgets.install(packageId, resolvedUrl);
45602
- case 5:
45618
+ case 6:
45619
+
45603
45620
  // Remove ALL widgets in this package from updates map
45604
45621
  // (install replaces the entire package, not just one widget)
45605
45622
  setUpdates(function (prev) {
@@ -45621,21 +45638,21 @@ function useWidgetUpdates() {
45621
45638
  return next;
45622
45639
  });
45623
45640
  if (onUpdated) onUpdated();
45624
- _context.next = 7;
45641
+ _context.next = 8;
45625
45642
  break;
45626
- case 6:
45627
- _context.prev = 6;
45628
- _t = _context["catch"](2);
45629
- setUpdateError(_t.message || "Update failed");
45630
45643
  case 7:
45631
45644
  _context.prev = 7;
45632
- setIsUpdating(null);
45633
- return _context.finish(7);
45645
+ _t = _context["catch"](3);
45646
+ setUpdateError(_t.message || "Update failed");
45634
45647
  case 8:
45648
+ _context.prev = 8;
45649
+ setIsUpdating(null);
45650
+ return _context.finish(8);
45651
+ case 9:
45635
45652
  case "end":
45636
45653
  return _context.stop();
45637
45654
  }
45638
- }, _callee, null, [[2, 6, 7, 8]]);
45655
+ }, _callee, null, [[3, 7, 8, 9]]);
45639
45656
  }));
45640
45657
  return function (_x) {
45641
45658
  return _ref.apply(this, arguments);
@@ -45681,7 +45698,8 @@ var WidgetsSection = function WidgetsSection(_ref) {
45681
45698
  updateWidget = _useWidgetUpdates.updateWidget,
45682
45699
  isUpdating = _useWidgetUpdates.isUpdating,
45683
45700
  needsAuth = _useWidgetUpdates.needsAuth,
45684
- clearNeedsAuth = _useWidgetUpdates.clearNeedsAuth;
45701
+ clearNeedsAuth = _useWidgetUpdates.clearNeedsAuth,
45702
+ updateError = _useWidgetUpdates.updateError;
45685
45703
  var _useState = useState(null),
45686
45704
  _useState2 = _slicedToArray(_useState, 2),
45687
45705
  selectedWidgetName = _useState2[0],
@@ -46330,7 +46348,8 @@ var WidgetsSection = function WidgetsSection(_ref) {
46330
46348
  },
46331
46349
  updateInfo: updates.get(selectedWidget === null || selectedWidget === void 0 ? void 0 : selectedWidget.name) || null,
46332
46350
  onUpdate: updateWidget,
46333
- isUpdating: isUpdating === (selectedWidget === null || selectedWidget === void 0 ? void 0 : selectedWidget.name)
46351
+ isUpdating: isUpdating === (selectedWidget === null || selectedWidget === void 0 ? void 0 : selectedWidget.name),
46352
+ updateError: updateError
46334
46353
  });
46335
46354
  }
46336
46355
 
@@ -49238,7 +49257,7 @@ var WidgetSidebar = function WidgetSidebar(_ref4) {
49238
49257
  className: selectClassName,
49239
49258
  children: [/*#__PURE__*/jsx("option", {
49240
49259
  value: "all",
49241
- children: "All Authors"
49260
+ children: "All Packages"
49242
49261
  }), uniqueAuthors.map(function (a) {
49243
49262
  return /*#__PURE__*/jsx("option", {
49244
49263
  value: a,