@trops/dash-core 0.1.880 → 0.1.881

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
@@ -45597,13 +45597,28 @@ function savedNoticeText(res) {
45597
45597
  return text;
45598
45598
  }
45599
45599
 
45600
- /** Items left out, said once the dialog has closed. */
45601
- function leftOutText(res) {
45602
- var list = res.leftOut || [];
45600
+ /**
45601
+ * What a save left out, in one sentence for the notice once the dialog has
45602
+ * closed, e.g. "5 widgets aren't in the profile — the other computer shows them as
45603
+ * missing." The names are listed under "Show which" (leftOutLines).
45604
+ */
45605
+ function leftOutSummary(res) {
45606
+ var list = res && res.leftOut || [];
45603
45607
  if (!list.length) return null;
45604
- return "Not in the profile: ".concat(list.map(function (l) {
45605
- return "".concat(l.name, " \u2014 ").concat(String(l.reason || "").replace(/\.$/, ""));
45606
- }).join("; "), ".");
45608
+ var one = list.length === 1;
45609
+ if (list.every(function (l) {
45610
+ return l.kind === "widget";
45611
+ })) {
45612
+ return "".concat(plural$f(list.length, "widget"), " ").concat(one ? "isn't" : "aren't", " in the profile \u2014 the other computer shows ").concat(one ? "it" : "them", " as missing.");
45613
+ }
45614
+ return "".concat(plural$f(list.length, "item"), " ").concat(one ? "isn't" : "aren't", " in the profile.");
45615
+ }
45616
+
45617
+ /** One line per item left out: "@ai-built/x — Not in the registry — …". */
45618
+ function leftOutLines(res) {
45619
+ return (res && res.leftOut || []).map(function (l) {
45620
+ return [l.name, String(l.reason || "").replace(/\.$/, "")].filter(Boolean).join(" — ");
45621
+ });
45607
45622
  }
45608
45623
 
45609
45624
  /** A widget's short status in the list, e.g. "Not in the registry · used by Home". */
@@ -48082,11 +48097,21 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48082
48097
  _useState34 = _slicedToArray(_useState33, 2),
48083
48098
  notice = _useState34[0],
48084
48099
  setNotice = _useState34[1];
48085
- // What loading the picked file would do (the Load dialog is open).
48100
+ // What the last save left out, listed under "Show which" in that save's
48101
+ // notice (only while that notice shows).
48086
48102
  var _useState35 = React.useState(null),
48087
48103
  _useState36 = _slicedToArray(_useState35, 2),
48088
- loadPreview = _useState36[0],
48089
- setLoadPreview = _useState36[1];
48104
+ leftOut = _useState36[0],
48105
+ setLeftOut = _useState36[1];
48106
+ var _useState37 = React.useState(false),
48107
+ _useState38 = _slicedToArray(_useState37, 2),
48108
+ showLeftOut = _useState38[0],
48109
+ setShowLeftOut = _useState38[1];
48110
+ // What loading the picked file would do (the Load dialog is open).
48111
+ var _useState39 = React.useState(null),
48112
+ _useState40 = _slicedToArray(_useState39, 2),
48113
+ loadPreview = _useState40[0],
48114
+ setLoadPreview = _useState40[1];
48090
48115
  // A v2 profile (packages from the registry) has its own preview.
48091
48116
  var LoadModal = loadPreview && loadPreview.schemaVersion >= 2 ? LoadProfileV2Modal : LoadProfileModal;
48092
48117
  var loadProfiles = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -48805,7 +48830,27 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48805
48830
  message: notice,
48806
48831
  onClose: function onClose() {
48807
48832
  return setNotice(null);
48808
- }
48833
+ },
48834
+ children: leftOut && leftOut.notice === notice ? /*#__PURE__*/jsxRuntime.jsxs("div", {
48835
+ className: "flex flex-col gap-1",
48836
+ "data-testid": "profile-left-out",
48837
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
48838
+ className: "flex flex-row",
48839
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
48840
+ title: showLeftOut ? "Hide" : "Show which",
48841
+ size: "sm",
48842
+ onClick: function onClick() {
48843
+ return setShowLeftOut(function (v) {
48844
+ return !v;
48845
+ });
48846
+ }
48847
+ })
48848
+ }), showLeftOut ? leftOut.lines.map(function (line, i) {
48849
+ return /*#__PURE__*/jsxRuntime.jsx("span", {
48850
+ children: "\u2022 ".concat(line)
48851
+ }, i);
48852
+ }) : null]
48853
+ }) : null
48809
48854
  }) : null, /*#__PURE__*/jsxRuntime.jsx(SectionLayout, {
48810
48855
  listContent: listContent,
48811
48856
  detailContent: detailContent,
@@ -48870,10 +48915,18 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48870
48915
  },
48871
48916
  onSaved: function onSaved(res) {
48872
48917
  setSaving(null);
48873
- setNotice(savedNoticeText(res));
48874
- // What didn't go in, and why (left out of the profile).
48875
- var left = leftOutText(res);
48876
- if (left) setError(left);
48918
+ // An older error is over once a save goes through.
48919
+ setError(null);
48920
+ // What didn't go in: one sentence in the notice (the dialog
48921
+ // showed it already), the names under "Show which".
48922
+ var left = leftOutSummary(res);
48923
+ var text = left ? "".concat(savedNoticeText(res), " ").concat(left) : savedNoticeText(res);
48924
+ setNotice(text);
48925
+ setLeftOut(left ? {
48926
+ notice: text,
48927
+ lines: leftOutLines(res)
48928
+ } : null);
48929
+ setShowLeftOut(false);
48877
48930
  loadProfiles();
48878
48931
  }
48879
48932
  }) : null, (confirm === null || confirm === void 0 ? void 0 : confirm.type) === "delete" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ConfirmationModal, {