@trops/dash-core 0.1.110 → 0.1.112

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
@@ -35783,12 +35783,6 @@ var ThemesSection = function ThemesSection(_ref) {
35783
35783
  saveAndSelectTheme(key, preset);
35784
35784
  setGenerateMode(GENERATE_MODES.NONE);
35785
35785
  }
35786
- function handleCreateFromRandom() {
35787
- if (!dashApi || !appId) return;
35788
- var theme = generateRandomTheme();
35789
- var key = theme.id;
35790
- saveAndSelectTheme(key, theme);
35791
- }
35792
35786
  function handleCreateFromHarmony(theme) {
35793
35787
  if (!dashApi || !appId) return;
35794
35788
  var key = theme.id;
@@ -35872,43 +35866,6 @@ var ThemesSection = function ThemesSection(_ref) {
35872
35866
  className: "text-xs opacity-50",
35873
35867
  children: themeVariant === "dark" ? "Dark" : "Light"
35874
35868
  })]
35875
- }), dashApi && appId && /*#__PURE__*/jsxs("div", {
35876
- className: "flex flex-col gap-1 px-2 py-3 border-b ".concat(rowStyles.borderColor || ""),
35877
- children: [/*#__PURE__*/jsx("span", {
35878
- className: "text-[10px] font-semibold opacity-30 uppercase tracking-wider px-2 pb-1",
35879
- children: "Generate"
35880
- }), /*#__PURE__*/jsx(Sidebar.Item, {
35881
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
35882
- icon: "swatchbook",
35883
- className: "h-3 w-3"
35884
- }),
35885
- active: generateMode === GENERATE_MODES.PRESETS,
35886
- onClick: function onClick() {
35887
- setGenerateMode(GENERATE_MODES.PRESETS);
35888
- setSelectedThemeKey(null);
35889
- },
35890
- className: generateMode === GENERATE_MODES.PRESETS ? "bg-white/10 opacity-100" : "",
35891
- children: "From Presets"
35892
- }), /*#__PURE__*/jsx(Sidebar.Item, {
35893
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
35894
- icon: "shuffle",
35895
- className: "h-3 w-3"
35896
- }),
35897
- onClick: handleCreateFromRandom,
35898
- children: "Random"
35899
- }), /*#__PURE__*/jsx(Sidebar.Item, {
35900
- icon: /*#__PURE__*/jsx(FontAwesomeIcon, {
35901
- icon: "droplet",
35902
- className: "h-3 w-3"
35903
- }),
35904
- active: generateMode === GENERATE_MODES.COLOR,
35905
- onClick: function onClick() {
35906
- setGenerateMode(GENERATE_MODES.COLOR);
35907
- setSelectedThemeKey(null);
35908
- },
35909
- className: generateMode === GENERATE_MODES.COLOR ? "bg-white/10 opacity-100" : "",
35910
- children: "From Color"
35911
- })]
35912
35869
  }), /*#__PURE__*/jsxs(Sidebar.Content, {
35913
35870
  children: [themeEntries.map(function (_ref4) {
35914
35871
  var _ref5 = _slicedToArray(_ref4, 2),
@@ -37961,6 +37918,13 @@ var AuthenticatedView = function AuthenticatedView(_ref3) {
37961
37918
  return p.name === updatedPkg.name && p.scope === updatedPkg.scope ? _objectSpread$2(_objectSpread$2({}, p), updatedPkg) : p;
37962
37919
  });
37963
37920
  });
37921
+ },
37922
+ onPackageDeleted: function onPackageDeleted(deletedPkg) {
37923
+ setPackages(function (prev) {
37924
+ return prev.filter(function (p) {
37925
+ return !(p.name === deletedPkg.name && p.scope === deletedPkg.scope);
37926
+ });
37927
+ });
37964
37928
  }
37965
37929
  })]
37966
37930
  });
@@ -38101,7 +38065,8 @@ var ProfileCard = function ProfileCard(_ref4) {
38101
38065
  var PackagesList = function PackagesList(_ref5) {
38102
38066
  var packages = _ref5.packages,
38103
38067
  loading = _ref5.loading,
38104
- onPackageUpdated = _ref5.onPackageUpdated;
38068
+ onPackageUpdated = _ref5.onPackageUpdated,
38069
+ onPackageDeleted = _ref5.onPackageDeleted;
38105
38070
  var _useState1 = useState(null),
38106
38071
  _useState10 = _slicedToArray(_useState1, 2),
38107
38072
  editingPkg = _useState10[0],
@@ -38141,6 +38106,10 @@ var PackagesList = function PackagesList(_ref5) {
38141
38106
  onSaved: function onSaved(updated) {
38142
38107
  setEditingPkg(null);
38143
38108
  onPackageUpdated(updated);
38109
+ },
38110
+ onDeleted: function onDeleted() {
38111
+ setEditingPkg(null);
38112
+ onPackageDeleted(pkg);
38144
38113
  }
38145
38114
  }, "".concat(pkg.scope, "/").concat(pkg.name));
38146
38115
  })
@@ -38152,7 +38121,8 @@ var PackageItem = function PackageItem(_ref6) {
38152
38121
  isEditing = _ref6.isEditing,
38153
38122
  onEdit = _ref6.onEdit,
38154
38123
  onCancel = _ref6.onCancel,
38155
- onSaved = _ref6.onSaved;
38124
+ onSaved = _ref6.onSaved,
38125
+ onDeleted = _ref6.onDeleted;
38156
38126
  var _useState11 = useState({
38157
38127
  displayName: pkg.displayName || "",
38158
38128
  description: pkg.description || "",
@@ -38167,6 +38137,14 @@ var PackageItem = function PackageItem(_ref6) {
38167
38137
  _useState14 = _slicedToArray(_useState13, 2),
38168
38138
  saving = _useState14[0],
38169
38139
  setSaving = _useState14[1];
38140
+ var _useState15 = useState(false),
38141
+ _useState16 = _slicedToArray(_useState15, 2),
38142
+ confirmingDelete = _useState16[0],
38143
+ setConfirmingDelete = _useState16[1];
38144
+ var _useState17 = useState(false),
38145
+ _useState18 = _slicedToArray(_useState17, 2),
38146
+ deleting = _useState18[0],
38147
+ setDeleting = _useState18[1];
38170
38148
  function handleSave() {
38171
38149
  return _handleSave2.apply(this, arguments);
38172
38150
  }
@@ -38211,6 +38189,42 @@ var PackageItem = function PackageItem(_ref6) {
38211
38189
  }));
38212
38190
  return _handleSave2.apply(this, arguments);
38213
38191
  }
38192
+ function handleDelete() {
38193
+ return _handleDelete.apply(this, arguments);
38194
+ }
38195
+ function _handleDelete() {
38196
+ _handleDelete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
38197
+ var _window$mainApi4, result;
38198
+ return _regeneratorRuntime.wrap(function (_context4) {
38199
+ while (1) switch (_context4.prev = _context4.next) {
38200
+ case 0:
38201
+ setDeleting(true);
38202
+ _context4.prev = 1;
38203
+ _context4.next = 2;
38204
+ return (_window$mainApi4 = window.mainApi) === null || _window$mainApi4 === void 0 || (_window$mainApi4 = _window$mainApi4.registryAuth) === null || _window$mainApi4 === void 0 ? void 0 : _window$mainApi4.deletePackage(pkg.scope, pkg.name);
38205
+ case 2:
38206
+ result = _context4.sent;
38207
+ if (result) {
38208
+ onDeleted === null || onDeleted === void 0 || onDeleted();
38209
+ }
38210
+ _context4.next = 4;
38211
+ break;
38212
+ case 3:
38213
+ _context4.prev = 3;
38214
+ _context4["catch"](1);
38215
+ case 4:
38216
+ _context4.prev = 4;
38217
+ setDeleting(false);
38218
+ setConfirmingDelete(false);
38219
+ return _context4.finish(4);
38220
+ case 5:
38221
+ case "end":
38222
+ return _context4.stop();
38223
+ }
38224
+ }, _callee4, null, [[1, 3, 4, 5]]);
38225
+ }));
38226
+ return _handleDelete.apply(this, arguments);
38227
+ }
38214
38228
  var updatedAt = pkg.updatedAt ? new Date(pkg.updatedAt).toLocaleDateString() : null;
38215
38229
  if (isEditing) {
38216
38230
  return /*#__PURE__*/jsxs("div", {
@@ -38272,24 +38286,53 @@ var PackageItem = function PackageItem(_ref6) {
38272
38286
  })]
38273
38287
  })]
38274
38288
  }), /*#__PURE__*/jsxs("div", {
38275
- className: "flex gap-2",
38276
- children: [/*#__PURE__*/jsx(Button, {
38277
- title: saving ? "Saving..." : "Save",
38278
- onClick: handleSave,
38279
- disabled: saving
38280
- }), /*#__PURE__*/jsx("button", {
38281
- type: "button",
38282
- onClick: onCancel,
38283
- className: "text-xs opacity-50 hover:opacity-80 cursor-pointer",
38284
- children: "Cancel"
38289
+ className: "flex items-center justify-between",
38290
+ children: [/*#__PURE__*/jsx("div", {
38291
+ children: confirmingDelete ? /*#__PURE__*/jsxs("div", {
38292
+ className: "flex items-center gap-2",
38293
+ children: [/*#__PURE__*/jsx("button", {
38294
+ type: "button",
38295
+ onClick: handleDelete,
38296
+ disabled: deleting,
38297
+ className: "text-xs text-red-400 hover:text-red-300 cursor-pointer font-medium",
38298
+ children: deleting ? "Deleting..." : "Confirm Delete"
38299
+ }), /*#__PURE__*/jsx("button", {
38300
+ type: "button",
38301
+ onClick: function onClick() {
38302
+ return setConfirmingDelete(false);
38303
+ },
38304
+ className: "text-xs opacity-50 hover:opacity-80 cursor-pointer",
38305
+ children: "Cancel"
38306
+ })]
38307
+ }) : /*#__PURE__*/jsx("button", {
38308
+ type: "button",
38309
+ onClick: function onClick() {
38310
+ return setConfirmingDelete(true);
38311
+ },
38312
+ className: "text-xs text-red-400/70 hover:text-red-400 cursor-pointer",
38313
+ children: "Delete"
38314
+ })
38315
+ }), /*#__PURE__*/jsxs("div", {
38316
+ className: "flex items-center gap-2",
38317
+ children: [/*#__PURE__*/jsx("button", {
38318
+ type: "button",
38319
+ onClick: onCancel,
38320
+ className: "text-xs opacity-50 hover:opacity-80 cursor-pointer",
38321
+ children: "Cancel"
38322
+ }), /*#__PURE__*/jsx(Button, {
38323
+ title: saving ? "Saving..." : "Save",
38324
+ onClick: handleSave,
38325
+ disabled: saving
38326
+ })]
38285
38327
  })]
38286
38328
  })]
38287
38329
  });
38288
38330
  }
38289
- return /*#__PURE__*/jsxs("div", {
38290
- className: "bg-white/5 rounded-lg p-3 flex items-start justify-between",
38291
- children: [/*#__PURE__*/jsxs("div", {
38292
- className: "flex-1 min-w-0 space-y-1",
38331
+ return /*#__PURE__*/jsx("div", {
38332
+ onClick: onEdit,
38333
+ className: "bg-white/5 rounded-lg p-3 cursor-pointer hover:bg-white/10 transition-colors",
38334
+ children: /*#__PURE__*/jsxs("div", {
38335
+ className: "space-y-1",
38293
38336
  children: [/*#__PURE__*/jsxs("div", {
38294
38337
  className: "flex items-center gap-2",
38295
38338
  children: [/*#__PURE__*/jsx("span", {
@@ -38309,12 +38352,7 @@ var PackageItem = function PackageItem(_ref6) {
38309
38352
  className: "text-[10px] opacity-40",
38310
38353
  children: ["Updated ", updatedAt]
38311
38354
  })]
38312
- }), /*#__PURE__*/jsx("button", {
38313
- type: "button",
38314
- onClick: onEdit,
38315
- className: "flex-shrink-0 ml-2 text-xs opacity-40 hover:opacity-80 cursor-pointer",
38316
- children: "Edit"
38317
- })]
38355
+ })
38318
38356
  });
38319
38357
  };
38320
38358
  var EditField = function EditField(_ref7) {