@trops/dash-core 0.1.364 → 0.1.366

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
@@ -46119,6 +46119,10 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46119
46119
  _useState12 = _slicedToArray(_useState11, 2),
46120
46120
  result = _useState12[0],
46121
46121
  setResult = _useState12[1];
46122
+ var _useState13 = useState(null),
46123
+ _useState14 = _slicedToArray(_useState13, 2),
46124
+ packageInfo = _useState14[0],
46125
+ setPackageInfo = _useState14[1];
46122
46126
 
46123
46127
  // Reset modal state on open
46124
46128
  useEffect(function () {
@@ -46128,8 +46132,26 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46128
46132
  setVisibility("public");
46129
46133
  setIsPublishing(false);
46130
46134
  setResult(null);
46135
+ setPackageInfo(null);
46131
46136
  }, [isOpen]);
46132
46137
 
46138
+ // Inspect the package to get its metadata + component list
46139
+ useEffect(function () {
46140
+ if (!isOpen || !widget) return;
46141
+ var cancelled = false;
46142
+ var packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || (widget === null || widget === void 0 ? void 0 : widget.name);
46143
+ if (!packageId) return;
46144
+ window.mainApi.registry.inspectWidgetPackage(packageId).then(function (res) {
46145
+ if (cancelled) return;
46146
+ if (res !== null && res !== void 0 && res.success) setPackageInfo(res);
46147
+ })["catch"](function () {
46148
+ /* ignore */
46149
+ });
46150
+ return function () {
46151
+ cancelled = true;
46152
+ };
46153
+ }, [isOpen, widget]);
46154
+
46133
46155
  // Check auth status + fetch username for the "publishing as" preview
46134
46156
  useEffect(function () {
46135
46157
  if (!isOpen) return;
@@ -46337,7 +46359,10 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46337
46359
  className: "flex-shrink-0 flex flex-row items-center justify-between p-4 border-b border-white/10",
46338
46360
  children: [/*#__PURE__*/jsxs("span", {
46339
46361
  className: "text-lg font-semibold truncate",
46340
- children: ["Publish \"", widget.displayName || widget.name, "\""]
46362
+ children: ["Publish", " ", /*#__PURE__*/jsx("span", {
46363
+ className: "font-mono text-base",
46364
+ children: packageInfo !== null && packageInfo !== void 0 && packageInfo.localScope ? "@".concat(packageInfo.localScope, "/").concat(packageInfo.name) : widget.packageId || widget.name
46365
+ })]
46341
46366
  }), /*#__PURE__*/jsx("button", {
46342
46367
  type: "button",
46343
46368
  onClick: handleClose,
@@ -46372,9 +46397,9 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46372
46397
  children: [/*#__PURE__*/jsx("span", {
46373
46398
  className: "opacity-50 w-28 flex-shrink-0",
46374
46399
  children: "Local"
46375
- }), /*#__PURE__*/jsxs("span", {
46400
+ }), /*#__PURE__*/jsx("span", {
46376
46401
  className: "font-mono text-xs opacity-80",
46377
- children: [widget.scope ? "@".concat(widget.scope, "/") : "", (widget.name || "").replace(/^@[^/]+\//, "")]
46402
+ children: packageInfo !== null && packageInfo !== void 0 && packageInfo.localScope ? "@".concat(packageInfo.localScope, "/").concat(packageInfo.name) : widget.packageId || widget.name
46378
46403
  })]
46379
46404
  }), /*#__PURE__*/jsxs("div", {
46380
46405
  className: "flex gap-2 mt-1",
@@ -46383,7 +46408,7 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46383
46408
  children: "Publishing as"
46384
46409
  }), /*#__PURE__*/jsxs("span", {
46385
46410
  className: "font-mono text-xs text-indigo-300",
46386
- children: [username ? "@".concat(username, "/") : "", (widget.name || "").replace(/^@[^/]+\//, ""), /*#__PURE__*/jsxs("span", {
46411
+ children: [username ? "@".concat(username, "/") : "", (packageInfo === null || packageInfo === void 0 ? void 0 : packageInfo.name) || (widget.name || "").replace(/^@[^/]+\//, ""), /*#__PURE__*/jsxs("span", {
46387
46412
  className: "text-gray-400",
46388
46413
  children: [" v", newVersion]
46389
46414
  })]
@@ -46397,6 +46422,31 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46397
46422
  children: ["v", currentVersion]
46398
46423
  })]
46399
46424
  })]
46425
+ }), (packageInfo === null || packageInfo === void 0 ? void 0 : packageInfo.components) && packageInfo.components.length > 0 && /*#__PURE__*/jsxs("div", {
46426
+ children: [/*#__PURE__*/jsxs("label", {
46427
+ className: "block text-sm font-medium opacity-70 mb-2",
46428
+ children: ["Widgets in this package (", packageInfo.components.length, ")"]
46429
+ }), /*#__PURE__*/jsx("div", {
46430
+ className: "bg-white/5 border border-white/10 rounded-lg divide-y divide-white/10 max-h-48 overflow-y-auto",
46431
+ children: packageInfo.components.map(function (c) {
46432
+ return /*#__PURE__*/jsxs("div", {
46433
+ className: "flex items-center gap-2 px-3 py-2 text-sm",
46434
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46435
+ icon: c.icon || "square",
46436
+ className: "h-3.5 w-3.5 opacity-60 flex-shrink-0"
46437
+ }), /*#__PURE__*/jsxs("div", {
46438
+ className: "flex-1 min-w-0",
46439
+ children: [/*#__PURE__*/jsx("div", {
46440
+ className: "font-medium truncate",
46441
+ children: c.displayName || c.name
46442
+ }), c.description && /*#__PURE__*/jsx("div", {
46443
+ className: "text-xs opacity-60 truncate",
46444
+ children: c.description
46445
+ })]
46446
+ })]
46447
+ }, c.name);
46448
+ })
46449
+ })]
46400
46450
  }), /*#__PURE__*/jsxs("div", {
46401
46451
  children: [/*#__PURE__*/jsx("label", {
46402
46452
  className: "block text-sm font-medium opacity-70 mb-2",