@trops/dash-core 0.1.414 → 0.1.416

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
@@ -50479,6 +50479,13 @@ var PackageItem = function PackageItem(_ref6) {
50479
50479
  _useState18 = _slicedToArray(_useState17, 2),
50480
50480
  deleting = _useState18[0],
50481
50481
  setDeleting = _useState18[1];
50482
+ // Last delete-attempt error. Rendered inline next to the delete
50483
+ // button so a failed attempt surfaces its cause (auth expired, 404,
50484
+ // server 500, network) instead of silently resetting.
50485
+ var _useState19 = useState(null),
50486
+ _useState20 = _slicedToArray(_useState19, 2),
50487
+ deleteError = _useState20[0],
50488
+ setDeleteError = _useState20[1];
50482
50489
  function handleSave() {
50483
50490
  return _handleSave2.apply(this, arguments);
50484
50491
  }
@@ -50528,34 +50535,44 @@ var PackageItem = function PackageItem(_ref6) {
50528
50535
  }
50529
50536
  function _handleDelete() {
50530
50537
  _handleDelete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
50531
- var _window$mainApi5, result;
50538
+ var _window$mainApi5, result, _t4;
50532
50539
  return _regeneratorRuntime.wrap(function (_context4) {
50533
50540
  while (1) switch (_context4.prev = _context4.next) {
50534
50541
  case 0:
50535
50542
  setDeleting(true);
50543
+ setDeleteError(null);
50536
50544
  _context4.prev = 1;
50537
50545
  _context4.next = 2;
50538
50546
  return (_window$mainApi5 = window.mainApi) === null || _window$mainApi5 === void 0 || (_window$mainApi5 = _window$mainApi5.registryAuth) === null || _window$mainApi5 === void 0 ? void 0 : _window$mainApi5.deletePackage(pkg.scope, pkg.name);
50539
50547
  case 2:
50540
50548
  result = _context4.sent;
50541
- if (result) {
50542
- onDeleted === null || onDeleted === void 0 || onDeleted();
50549
+ if (!(result !== null && result !== void 0 && result.success)) {
50550
+ _context4.next = 3;
50551
+ break;
50543
50552
  }
50544
- _context4.next = 4;
50545
- break;
50553
+ onDeleted === null || onDeleted === void 0 || onDeleted();
50554
+ return _context4.abrupt("return");
50546
50555
  case 3:
50547
- _context4.prev = 3;
50548
- _context4["catch"](1);
50556
+ // New error-surface format: `{ success, error, status }`. Show
50557
+ // the server-reported reason so the user (or the next bug
50558
+ // reporter) knows exactly why the delete failed.
50559
+ setDeleteError((result === null || result === void 0 ? void 0 : result.error) || (result !== null && result !== void 0 && result.status ? "Delete failed (".concat(result.status, ")") : "Delete failed — no response from registry."));
50560
+ _context4.next = 5;
50561
+ break;
50549
50562
  case 4:
50550
50563
  _context4.prev = 4;
50564
+ _t4 = _context4["catch"](1);
50565
+ setDeleteError("Unexpected error: ".concat((_t4 === null || _t4 === void 0 ? void 0 : _t4.message) || String(_t4)));
50566
+ case 5:
50567
+ _context4.prev = 5;
50551
50568
  setDeleting(false);
50552
50569
  setConfirmingDelete(false);
50553
- return _context4.finish(4);
50554
- case 5:
50570
+ return _context4.finish(5);
50571
+ case 6:
50555
50572
  case "end":
50556
50573
  return _context4.stop();
50557
50574
  }
50558
- }, _callee4, null, [[1, 3, 4, 5]]);
50575
+ }, _callee4, null, [[1, 4, 5, 6]]);
50559
50576
  }));
50560
50577
  return _handleDelete.apply(this, arguments);
50561
50578
  }
@@ -50621,8 +50638,9 @@ var PackageItem = function PackageItem(_ref6) {
50621
50638
  })]
50622
50639
  }), /*#__PURE__*/jsxs("div", {
50623
50640
  className: "flex items-center justify-between",
50624
- children: [/*#__PURE__*/jsx("div", {
50625
- children: confirmingDelete ? /*#__PURE__*/jsxs("div", {
50641
+ children: [/*#__PURE__*/jsxs("div", {
50642
+ className: "flex items-center gap-3",
50643
+ children: [confirmingDelete ? /*#__PURE__*/jsxs("div", {
50626
50644
  className: "flex items-center gap-2",
50627
50645
  children: [/*#__PURE__*/jsx("button", {
50628
50646
  type: "button",
@@ -50633,7 +50651,8 @@ var PackageItem = function PackageItem(_ref6) {
50633
50651
  }), /*#__PURE__*/jsx("button", {
50634
50652
  type: "button",
50635
50653
  onClick: function onClick() {
50636
- return setConfirmingDelete(false);
50654
+ setConfirmingDelete(false);
50655
+ setDeleteError(null);
50637
50656
  },
50638
50657
  className: "text-xs opacity-50 hover:opacity-80 cursor-pointer",
50639
50658
  children: "Cancel"
@@ -50641,11 +50660,16 @@ var PackageItem = function PackageItem(_ref6) {
50641
50660
  }) : /*#__PURE__*/jsx("button", {
50642
50661
  type: "button",
50643
50662
  onClick: function onClick() {
50644
- return setConfirmingDelete(true);
50663
+ setConfirmingDelete(true);
50664
+ setDeleteError(null);
50645
50665
  },
50646
50666
  className: "text-xs text-red-400/70 hover:text-red-400 cursor-pointer",
50647
50667
  children: "Delete"
50648
- })
50668
+ }), deleteError && /*#__PURE__*/jsx("span", {
50669
+ className: "text-[11px] text-red-400 max-w-sm truncate",
50670
+ title: deleteError,
50671
+ children: deleteError
50672
+ })]
50649
50673
  }), /*#__PURE__*/jsxs("div", {
50650
50674
  className: "flex items-center gap-2",
50651
50675
  children: [/*#__PURE__*/jsx("button", {
@@ -54342,6 +54366,24 @@ function _unsupportedIterableToArray$5(r, a) { if (r) { if ("string" == typeof r
54342
54366
  function _arrayLikeToArray$5(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; }
54343
54367
  var ALL_WIDGETS_ID = "__ALL__";
54344
54368
 
54369
+ /**
54370
+ * Build the scoped registry identifier for a widget. Surfaces the
54371
+ * `scope.packageName.component` triple in the settings UI so users
54372
+ * can verify what a widget's registry identity is — useful when
54373
+ * diagnosing dashboard-install warnings ("why didn't this widget
54374
+ * install?" → scoped id in the warning vs scoped id shown here).
54375
+ * Returns just the component name when scope/package metadata is
54376
+ * unavailable (e.g. bare built-ins).
54377
+ */
54378
+ function buildScopedId(widget) {
54379
+ if (!(widget !== null && widget !== void 0 && widget.component)) return null;
54380
+ var scope = widget.scope ? String(widget.scope).replace(/^@/, "") : null;
54381
+ var pkg = widget.packageName ? scope ? String(widget.packageName).replace(new RegExp("^@?".concat(scope, "/")), "") : String(widget.packageName).replace(/^@/, "") : null;
54382
+ if (scope && pkg) return "".concat(scope, ".").concat(pkg, ".").concat(widget.component);
54383
+ if (pkg) return "".concat(pkg, ".").concat(widget.component);
54384
+ return widget.component;
54385
+ }
54386
+
54345
54387
  /**
54346
54388
  * WidgetsTab
54347
54389
  *
@@ -54389,7 +54431,12 @@ var WidgetsTab = function WidgetsTab(_ref) {
54389
54431
  displayName: item.name || cfg.name || cfg.displayName || item.component,
54390
54432
  section: section,
54391
54433
  userConfig: cfg.userConfig || {},
54392
- userPrefs: item.userPrefs || {}
54434
+ userPrefs: item.userPrefs || {},
54435
+ // Identity fields for the registry-identifier label. Prefer
54436
+ // values from the widget's component manager entry since the
54437
+ // layout item itself often doesn't carry scope/packageName.
54438
+ scope: cfg.scope || item.scope || null,
54439
+ packageName: cfg.packageName || cfg.name || item.packageName || null
54393
54440
  });
54394
54441
  };
54395
54442
  };
@@ -54557,6 +54604,7 @@ function SingleWidgetPane(_ref4) {
54557
54604
  effectivePrefs = _ref4.effectivePrefs,
54558
54605
  onFieldChange = _ref4.onFieldChange;
54559
54606
  var hasFields = Object.keys(widget.userConfig).length > 0;
54607
+ var scopedId = buildScopedId(widget);
54560
54608
  return /*#__PURE__*/jsxs("div", {
54561
54609
  children: [/*#__PURE__*/jsxs("div", {
54562
54610
  className: "mb-3",
@@ -54566,6 +54614,10 @@ function SingleWidgetPane(_ref4) {
54566
54614
  }), /*#__PURE__*/jsxs("div", {
54567
54615
  className: "text-xs text-gray-500",
54568
54616
  children: [widget.component, " \xB7 ", widget.section]
54617
+ }), scopedId && scopedId !== widget.component && /*#__PURE__*/jsx("code", {
54618
+ className: "block mt-1 text-[11px] text-gray-500 font-mono truncate",
54619
+ title: scopedId,
54620
+ children: scopedId
54569
54621
  })]
54570
54622
  }), hasFields ? /*#__PURE__*/jsx(PanelEditForm, {
54571
54623
  userConfig: widget.userConfig,