@trops/dash-core 0.1.365 → 0.1.367

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
@@ -38836,8 +38836,29 @@ var BUMP_OPTIONS$1 = [{
38836
38836
  label: "Keep current version"
38837
38837
  }];
38838
38838
 
38839
+ // Parse "@scope/name" → { scope, packageName }. Returns empty strings
38840
+ // for unscoped names so callers can use the || fallback chain.
38841
+ function parseScopeAndName(sourcePackage) {
38842
+ if (!sourcePackage) return {
38843
+ scope: "",
38844
+ packageName: ""
38845
+ };
38846
+ var m = sourcePackage.match(/^@([^/]+)\/(.+)$/);
38847
+ if (m) return {
38848
+ scope: m[1],
38849
+ packageName: m[2]
38850
+ };
38851
+ return {
38852
+ scope: "",
38853
+ packageName: sourcePackage
38854
+ };
38855
+ }
38856
+
38839
38857
  // Pulled out as a small helper so the Dependencies loader and the
38840
- // dashboard publish call share the same shape.
38858
+ // dashboard publish call share the same shape. Widgets registered from
38859
+ // a package (via `_sourcePackage`) inherit scope + packageName from that
38860
+ // package ID — otherwise the main-process resolver has no way to map a
38861
+ // bare component name to its owning package.
38841
38862
  function collectComponentConfigs() {
38842
38863
  var configMap = ComponentManager.componentMap();
38843
38864
  var componentConfigs = {};
@@ -38845,13 +38866,15 @@ function collectComponentConfigs() {
38845
38866
  var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
38846
38867
  key = _Object$entries$_i[0],
38847
38868
  config = _Object$entries$_i[1];
38848
- if (config && (config.id || config.scope || config.packageName)) {
38849
- componentConfigs[config.name || key] = {
38850
- id: config.id || null,
38851
- scope: config.scope || "",
38852
- packageName: config.packageName || ""
38853
- };
38854
- }
38869
+ if (!config || config.type !== "widget") continue;
38870
+ var hasExplicit = config.id || config.scope || config.packageName || config._sourcePackage;
38871
+ if (!hasExplicit) continue;
38872
+ var parsed = parseScopeAndName(config._sourcePackage);
38873
+ componentConfigs[config.name || key] = {
38874
+ id: config.id || null,
38875
+ scope: config.scope || parsed.scope || "",
38876
+ packageName: config.packageName || parsed.packageName || ""
38877
+ };
38855
38878
  }
38856
38879
  return componentConfigs;
38857
38880
  }
@@ -39173,7 +39196,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39173
39196
  }
39174
39197
  function _handlePublish() {
39175
39198
  _handlePublish = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
39176
- var steps, _iterator2, _step2, w, _key2, _sel, key, sel, updateStep, i, _step3, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
39199
+ var steps, seenPackages, _iterator2, _step2, w, _key2, _sel, key, sel, updateStep, i, _step3, _res$manifest, bump, options, res, _res, _options, _res2, _t2, _t3;
39177
39200
  return _regeneratorRuntime.wrap(function (_context2) {
39178
39201
  while (1) switch (_context2.prev = _context2.next) {
39179
39202
  case 0:
@@ -39186,19 +39209,21 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39186
39209
  setIsPublishing(true);
39187
39210
  setResult(null);
39188
39211
 
39189
- // Build the ordered step list: each selected owned widget → theme → dashboard.
39190
- // Third-party deps aren't published (they're just referenced by the manifest).
39212
+ // Build the ordered step list: one step per unique widget package,
39213
+ // then theme, then the dashboard itself. Third-party deps aren't
39214
+ // published — they're just referenced by the manifest.
39191
39215
  steps = [];
39192
39216
  if (!plan) {
39193
- _context2.next = 11;
39217
+ _context2.next = 12;
39194
39218
  break;
39195
39219
  }
39220
+ seenPackages = new Set();
39196
39221
  _iterator2 = _createForOfIteratorHelper$9(plan.widgets || []);
39197
39222
  _context2.prev = 2;
39198
39223
  _iterator2.s();
39199
39224
  case 3:
39200
39225
  if ((_step2 = _iterator2.n()).done) {
39201
- _context2.next = 7;
39226
+ _context2.next = 8;
39202
39227
  break;
39203
39228
  }
39204
39229
  w = _step2.value;
@@ -39206,16 +39231,23 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39206
39231
  _context2.next = 4;
39207
39232
  break;
39208
39233
  }
39209
- return _context2.abrupt("continue", 6);
39234
+ return _context2.abrupt("continue", 7);
39210
39235
  case 4:
39211
39236
  _key2 = "".concat(w.scope, "/").concat(w.packageName);
39212
- _sel = depSelections[_key2];
39213
- if (!(!_sel || !_sel.owned || !_sel.include)) {
39237
+ if (!seenPackages.has(_key2)) {
39214
39238
  _context2.next = 5;
39215
39239
  break;
39216
39240
  }
39217
- return _context2.abrupt("continue", 6);
39241
+ return _context2.abrupt("continue", 7);
39218
39242
  case 5:
39243
+ _sel = depSelections[_key2];
39244
+ if (!(!_sel || !_sel.owned || !_sel.include)) {
39245
+ _context2.next = 6;
39246
+ break;
39247
+ }
39248
+ return _context2.abrupt("continue", 7);
39249
+ case 6:
39250
+ seenPackages.add(_key2);
39219
39251
  steps.push({
39220
39252
  kind: "widget",
39221
39253
  key: _key2,
@@ -39223,21 +39255,21 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39223
39255
  packageId: w.packageId || "".concat(w.scope, "/").concat(w.packageName),
39224
39256
  selection: _sel
39225
39257
  });
39226
- case 6:
39227
- _context2.next = 3;
39228
- break;
39229
39258
  case 7:
39230
- _context2.next = 9;
39259
+ _context2.next = 3;
39231
39260
  break;
39232
39261
  case 8:
39233
- _context2.prev = 8;
39234
- _t2 = _context2["catch"](2);
39235
- _iterator2.e(_t2);
39262
+ _context2.next = 10;
39263
+ break;
39236
39264
  case 9:
39237
39265
  _context2.prev = 9;
39238
- _iterator2.f();
39239
- return _context2.finish(9);
39266
+ _t2 = _context2["catch"](2);
39267
+ _iterator2.e(_t2);
39240
39268
  case 10:
39269
+ _context2.prev = 10;
39270
+ _iterator2.f();
39271
+ return _context2.finish(10);
39272
+ case 11:
39241
39273
  if (plan.theme && plan.theme.scope && plan.theme.name) {
39242
39274
  key = "".concat(plan.theme.scope, "/").concat(plan.theme.name);
39243
39275
  sel = depSelections[key];
@@ -39251,7 +39283,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39251
39283
  });
39252
39284
  }
39253
39285
  }
39254
- case 11:
39286
+ case 12:
39255
39287
  steps.push({
39256
39288
  kind: "dashboard",
39257
39289
  key: "dashboard",
@@ -39272,11 +39304,11 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39272
39304
  return next;
39273
39305
  });
39274
39306
  };
39275
- _context2.prev = 12;
39307
+ _context2.prev = 13;
39276
39308
  i = 0;
39277
- case 13:
39309
+ case 14:
39278
39310
  if (!(i < steps.length)) {
39279
- _context2.next = 23;
39311
+ _context2.next = 24;
39280
39312
  break;
39281
39313
  }
39282
39314
  _step3 = steps[i];
@@ -39284,7 +39316,7 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39284
39316
  status: "running"
39285
39317
  });
39286
39318
  if (!(_step3.kind === "widget")) {
39287
- _context2.next = 16;
39319
+ _context2.next = 17;
39288
39320
  break;
39289
39321
  }
39290
39322
  bump = _step3.selection.bump;
@@ -39293,12 +39325,12 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39293
39325
  } : {}), {}, {
39294
39326
  visibility: _step3.selection.visibility
39295
39327
  });
39296
- _context2.next = 14;
39328
+ _context2.next = 15;
39297
39329
  return window.mainApi.registry.publishWidget(appId, _step3.packageId, options);
39298
- case 14:
39330
+ case 15:
39299
39331
  res = _context2.sent;
39300
39332
  if (res !== null && res !== void 0 && res.success) {
39301
- _context2.next = 15;
39333
+ _context2.next = 16;
39302
39334
  break;
39303
39335
  }
39304
39336
  updateStep(i, {
@@ -39311,26 +39343,26 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39311
39343
  });
39312
39344
  setIsPublishing(false);
39313
39345
  return _context2.abrupt("return");
39314
- case 15:
39346
+ case 16:
39315
39347
  updateStep(i, {
39316
39348
  status: "complete",
39317
39349
  message: "v".concat(res.newVersion || ((_res$manifest = res.manifest) === null || _res$manifest === void 0 ? void 0 : _res$manifest.version))
39318
39350
  });
39319
- _context2.next = 22;
39351
+ _context2.next = 23;
39320
39352
  break;
39321
- case 16:
39353
+ case 17:
39322
39354
  if (!(_step3.kind === "theme")) {
39323
- _context2.next = 19;
39355
+ _context2.next = 20;
39324
39356
  break;
39325
39357
  }
39326
- _context2.next = 17;
39358
+ _context2.next = 18;
39327
39359
  return window.mainApi.themes.publishTheme(appId, _step3.themeKey, {
39328
39360
  visibility: _step3.selection.visibility
39329
39361
  });
39330
- case 17:
39362
+ case 18:
39331
39363
  _res = _context2.sent;
39332
39364
  if (_res !== null && _res !== void 0 && _res.success) {
39333
- _context2.next = 18;
39365
+ _context2.next = 19;
39334
39366
  break;
39335
39367
  }
39336
39368
  updateStep(i, {
@@ -39343,16 +39375,16 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39343
39375
  });
39344
39376
  setIsPublishing(false);
39345
39377
  return _context2.abrupt("return");
39346
- case 18:
39378
+ case 19:
39347
39379
  updateStep(i, {
39348
39380
  status: "complete",
39349
39381
  message: "published"
39350
39382
  });
39351
- _context2.next = 22;
39383
+ _context2.next = 23;
39352
39384
  break;
39353
- case 19:
39385
+ case 20:
39354
39386
  if (!(_step3.kind === "dashboard")) {
39355
- _context2.next = 22;
39387
+ _context2.next = 23;
39356
39388
  break;
39357
39389
  }
39358
39390
  _options = {
@@ -39363,12 +39395,12 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39363
39395
  visibility: visibility,
39364
39396
  componentConfigs: collectComponentConfigs()
39365
39397
  };
39366
- _context2.next = 20;
39398
+ _context2.next = 21;
39367
39399
  return window.mainApi.dashboardConfig.prepareDashboardForPublish(appId, workspaceId, _options);
39368
- case 20:
39400
+ case 21:
39369
39401
  _res2 = _context2.sent;
39370
39402
  if (_res2 !== null && _res2 !== void 0 && _res2.success) {
39371
- _context2.next = 21;
39403
+ _context2.next = 22;
39372
39404
  break;
39373
39405
  }
39374
39406
  updateStep(i, {
@@ -39381,35 +39413,35 @@ var PublishDashboardModal = function PublishDashboardModal(_ref) {
39381
39413
  });
39382
39414
  setIsPublishing(false);
39383
39415
  return _context2.abrupt("return");
39384
- case 21:
39416
+ case 22:
39385
39417
  updateStep(i, {
39386
39418
  status: "complete",
39387
39419
  message: "published"
39388
39420
  });
39389
39421
  setResult(_res2);
39390
- case 22:
39391
- i++;
39392
- _context2.next = 13;
39393
- break;
39394
39422
  case 23:
39395
- _context2.next = 25;
39423
+ i++;
39424
+ _context2.next = 14;
39396
39425
  break;
39397
39426
  case 24:
39398
- _context2.prev = 24;
39399
- _t3 = _context2["catch"](12);
39427
+ _context2.next = 26;
39428
+ break;
39429
+ case 25:
39430
+ _context2.prev = 25;
39431
+ _t3 = _context2["catch"](13);
39400
39432
  setResult({
39401
39433
  success: false,
39402
39434
  error: _t3.message || "Failed to prepare dashboard for publish."
39403
39435
  });
39404
- case 25:
39405
- _context2.prev = 25;
39406
- setIsPublishing(false);
39407
- return _context2.finish(25);
39408
39436
  case 26:
39437
+ _context2.prev = 26;
39438
+ setIsPublishing(false);
39439
+ return _context2.finish(26);
39440
+ case 27:
39409
39441
  case "end":
39410
39442
  return _context2.stop();
39411
39443
  }
39412
- }, _callee2, null, [[2, 8, 9, 10], [12, 24, 25, 26]]);
39444
+ }, _callee2, null, [[2, 9, 10, 11], [13, 25, 26, 27]]);
39413
39445
  }));
39414
39446
  return _handlePublish.apply(this, arguments);
39415
39447
  }
@@ -40047,7 +40079,10 @@ function DependencyTable(_ref4) {
40047
40079
  var plan = _ref4.plan,
40048
40080
  selections = _ref4.selections,
40049
40081
  _onChange = _ref4.onChange;
40050
- var rows = [];
40082
+ // Dedupe: multiple widgets from the same package collapse into a single
40083
+ // row. Each row shows the list of component widgets that live inside it
40084
+ // so the user knows what's getting published.
40085
+ var byKey = new Map();
40051
40086
  var _iterator3 = _createForOfIteratorHelper$9(plan.widgets || []),
40052
40087
  _step4;
40053
40088
  try {
@@ -40055,23 +40090,32 @@ function DependencyTable(_ref4) {
40055
40090
  var w = _step4.value;
40056
40091
  if (!w.scope || !w.packageName) continue;
40057
40092
  var _key3 = "".concat(w.scope, "/").concat(w.packageName);
40058
- rows.push({
40093
+ var entry = byKey.get(_key3) || {
40059
40094
  key: _key3,
40060
40095
  kind: "widget",
40061
- data: w
40062
- });
40096
+ data: w,
40097
+ widgetNames: new Set()
40098
+ };
40099
+ if (w.component) entry.widgetNames.add(w.component);
40100
+ byKey.set(_key3, entry);
40063
40101
  }
40064
40102
  } catch (err) {
40065
40103
  _iterator3.e(err);
40066
40104
  } finally {
40067
40105
  _iterator3.f();
40068
40106
  }
40107
+ var rows = Array.from(byKey.values()).map(function (e) {
40108
+ return _objectSpread$o(_objectSpread$o({}, e), {}, {
40109
+ widgetNames: Array.from(e.widgetNames).sort()
40110
+ });
40111
+ });
40069
40112
  if (plan.theme && plan.theme.scope && plan.theme.name) {
40070
40113
  var key = "".concat(plan.theme.scope, "/").concat(plan.theme.name);
40071
40114
  rows.push({
40072
40115
  key: key,
40073
40116
  kind: "theme",
40074
- data: plan.theme
40117
+ data: plan.theme,
40118
+ widgetNames: []
40075
40119
  });
40076
40120
  }
40077
40121
  if (rows.length === 0) {
@@ -40085,7 +40129,8 @@ function DependencyTable(_ref4) {
40085
40129
  children: rows.map(function (_ref5) {
40086
40130
  var key = _ref5.key,
40087
40131
  kind = _ref5.kind,
40088
- data = _ref5.data;
40132
+ data = _ref5.data,
40133
+ widgetNames = _ref5.widgetNames;
40089
40134
  var sel = selections[key];
40090
40135
  if (!sel) return null;
40091
40136
  var reg = data.registry;
@@ -40130,6 +40175,12 @@ function DependencyTable(_ref4) {
40130
40175
  }) : /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
40131
40176
  children: " \xB7 Not yet in registry"
40132
40177
  })]
40178
+ }), kind === "widget" && widgetNames && widgetNames.length > 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
40179
+ className: "text-[11px] opacity-60 mt-1",
40180
+ children: ["Bundles ", widgetNames.length, " widget", widgetNames.length === 1 ? "" : "s", ":", " ", /*#__PURE__*/jsxRuntime.jsx("span", {
40181
+ className: "opacity-80",
40182
+ children: widgetNames.join(", ")
40183
+ })]
40133
40184
  }), sel.owned && sel.include && /*#__PURE__*/jsxRuntime.jsxs("div", {
40134
40185
  className: "mt-2 flex items-center gap-3 flex-wrap",
40135
40186
  children: [/*#__PURE__*/jsxRuntime.jsxs("label", {