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