@trops/dash-core 0.1.364 → 0.1.365

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
@@ -46137,6 +46137,10 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46137
46137
  _useState12 = _slicedToArray(_useState11, 2),
46138
46138
  result = _useState12[0],
46139
46139
  setResult = _useState12[1];
46140
+ var _useState13 = React.useState(null),
46141
+ _useState14 = _slicedToArray(_useState13, 2),
46142
+ packageInfo = _useState14[0],
46143
+ setPackageInfo = _useState14[1];
46140
46144
 
46141
46145
  // Reset modal state on open
46142
46146
  React.useEffect(function () {
@@ -46146,8 +46150,26 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46146
46150
  setVisibility("public");
46147
46151
  setIsPublishing(false);
46148
46152
  setResult(null);
46153
+ setPackageInfo(null);
46149
46154
  }, [isOpen]);
46150
46155
 
46156
+ // Inspect the package to get its metadata + component list
46157
+ React.useEffect(function () {
46158
+ if (!isOpen || !widget) return;
46159
+ var cancelled = false;
46160
+ var packageId = (widget === null || widget === void 0 ? void 0 : widget.packageId) || (widget === null || widget === void 0 ? void 0 : widget.name);
46161
+ if (!packageId) return;
46162
+ window.mainApi.registry.inspectWidgetPackage(packageId).then(function (res) {
46163
+ if (cancelled) return;
46164
+ if (res !== null && res !== void 0 && res.success) setPackageInfo(res);
46165
+ })["catch"](function () {
46166
+ /* ignore */
46167
+ });
46168
+ return function () {
46169
+ cancelled = true;
46170
+ };
46171
+ }, [isOpen, widget]);
46172
+
46151
46173
  // Check auth status + fetch username for the "publishing as" preview
46152
46174
  React.useEffect(function () {
46153
46175
  if (!isOpen) return;
@@ -46355,7 +46377,10 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46355
46377
  className: "flex-shrink-0 flex flex-row items-center justify-between p-4 border-b border-white/10",
46356
46378
  children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
46357
46379
  className: "text-lg font-semibold truncate",
46358
- children: ["Publish \"", widget.displayName || widget.name, "\""]
46380
+ children: ["Publish", " ", /*#__PURE__*/jsxRuntime.jsx("span", {
46381
+ className: "font-mono text-base",
46382
+ children: packageInfo !== null && packageInfo !== void 0 && packageInfo.localScope ? "@".concat(packageInfo.localScope, "/").concat(packageInfo.name) : widget.packageId || widget.name
46383
+ })]
46359
46384
  }), /*#__PURE__*/jsxRuntime.jsx("button", {
46360
46385
  type: "button",
46361
46386
  onClick: handleClose,
@@ -46390,9 +46415,9 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46390
46415
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
46391
46416
  className: "opacity-50 w-28 flex-shrink-0",
46392
46417
  children: "Local"
46393
- }), /*#__PURE__*/jsxRuntime.jsxs("span", {
46418
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
46394
46419
  className: "font-mono text-xs opacity-80",
46395
- children: [widget.scope ? "@".concat(widget.scope, "/") : "", (widget.name || "").replace(/^@[^/]+\//, "")]
46420
+ children: packageInfo !== null && packageInfo !== void 0 && packageInfo.localScope ? "@".concat(packageInfo.localScope, "/").concat(packageInfo.name) : widget.packageId || widget.name
46396
46421
  })]
46397
46422
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
46398
46423
  className: "flex gap-2 mt-1",
@@ -46401,7 +46426,7 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46401
46426
  children: "Publishing as"
46402
46427
  }), /*#__PURE__*/jsxRuntime.jsxs("span", {
46403
46428
  className: "font-mono text-xs text-indigo-300",
46404
- children: [username ? "@".concat(username, "/") : "", (widget.name || "").replace(/^@[^/]+\//, ""), /*#__PURE__*/jsxRuntime.jsxs("span", {
46429
+ children: [username ? "@".concat(username, "/") : "", (packageInfo === null || packageInfo === void 0 ? void 0 : packageInfo.name) || (widget.name || "").replace(/^@[^/]+\//, ""), /*#__PURE__*/jsxRuntime.jsxs("span", {
46405
46430
  className: "text-gray-400",
46406
46431
  children: [" v", newVersion]
46407
46432
  })]
@@ -46415,6 +46440,31 @@ var PublishWidgetModal = function PublishWidgetModal(_ref) {
46415
46440
  children: ["v", currentVersion]
46416
46441
  })]
46417
46442
  })]
46443
+ }), (packageInfo === null || packageInfo === void 0 ? void 0 : packageInfo.components) && packageInfo.components.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
46444
+ children: [/*#__PURE__*/jsxRuntime.jsxs("label", {
46445
+ className: "block text-sm font-medium opacity-70 mb-2",
46446
+ children: ["Widgets in this package (", packageInfo.components.length, ")"]
46447
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
46448
+ className: "bg-white/5 border border-white/10 rounded-lg divide-y divide-white/10 max-h-48 overflow-y-auto",
46449
+ children: packageInfo.components.map(function (c) {
46450
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
46451
+ className: "flex items-center gap-2 px-3 py-2 text-sm",
46452
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
46453
+ icon: c.icon || "square",
46454
+ className: "h-3.5 w-3.5 opacity-60 flex-shrink-0"
46455
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
46456
+ className: "flex-1 min-w-0",
46457
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
46458
+ className: "font-medium truncate",
46459
+ children: c.displayName || c.name
46460
+ }), c.description && /*#__PURE__*/jsxRuntime.jsx("div", {
46461
+ className: "text-xs opacity-60 truncate",
46462
+ children: c.description
46463
+ })]
46464
+ })]
46465
+ }, c.name);
46466
+ })
46467
+ })]
46418
46468
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
46419
46469
  children: [/*#__PURE__*/jsxRuntime.jsx("label", {
46420
46470
  className: "block text-sm font-medium opacity-70 mb-2",