@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.esm.js CHANGED
@@ -45579,13 +45579,28 @@ function savedNoticeText(res) {
45579
45579
  return text;
45580
45580
  }
45581
45581
 
45582
- /** Items left out, said once the dialog has closed. */
45583
- function leftOutText(res) {
45584
- var list = res.leftOut || [];
45582
+ /**
45583
+ * What a save left out, in one sentence for the notice once the dialog has
45584
+ * closed, e.g. "5 widgets aren't in the profile — the other computer shows them as
45585
+ * missing." The names are listed under "Show which" (leftOutLines).
45586
+ */
45587
+ function leftOutSummary(res) {
45588
+ var list = res && res.leftOut || [];
45585
45589
  if (!list.length) return null;
45586
- return "Not in the profile: ".concat(list.map(function (l) {
45587
- return "".concat(l.name, " \u2014 ").concat(String(l.reason || "").replace(/\.$/, ""));
45588
- }).join("; "), ".");
45590
+ var one = list.length === 1;
45591
+ if (list.every(function (l) {
45592
+ return l.kind === "widget";
45593
+ })) {
45594
+ 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.");
45595
+ }
45596
+ return "".concat(plural$f(list.length, "item"), " ").concat(one ? "isn't" : "aren't", " in the profile.");
45597
+ }
45598
+
45599
+ /** One line per item left out: "@ai-built/x — Not in the registry — …". */
45600
+ function leftOutLines(res) {
45601
+ return (res && res.leftOut || []).map(function (l) {
45602
+ return [l.name, String(l.reason || "").replace(/\.$/, "")].filter(Boolean).join(" — ");
45603
+ });
45589
45604
  }
45590
45605
 
45591
45606
  /** A widget's short status in the list, e.g. "Not in the registry · used by Home". */
@@ -48064,11 +48079,21 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48064
48079
  _useState34 = _slicedToArray(_useState33, 2),
48065
48080
  notice = _useState34[0],
48066
48081
  setNotice = _useState34[1];
48067
- // What loading the picked file would do (the Load dialog is open).
48082
+ // What the last save left out, listed under "Show which" in that save's
48083
+ // notice (only while that notice shows).
48068
48084
  var _useState35 = useState(null),
48069
48085
  _useState36 = _slicedToArray(_useState35, 2),
48070
- loadPreview = _useState36[0],
48071
- setLoadPreview = _useState36[1];
48086
+ leftOut = _useState36[0],
48087
+ setLeftOut = _useState36[1];
48088
+ var _useState37 = useState(false),
48089
+ _useState38 = _slicedToArray(_useState37, 2),
48090
+ showLeftOut = _useState38[0],
48091
+ setShowLeftOut = _useState38[1];
48092
+ // What loading the picked file would do (the Load dialog is open).
48093
+ var _useState39 = useState(null),
48094
+ _useState40 = _slicedToArray(_useState39, 2),
48095
+ loadPreview = _useState40[0],
48096
+ setLoadPreview = _useState40[1];
48072
48097
  // A v2 profile (packages from the registry) has its own preview.
48073
48098
  var LoadModal = loadPreview && loadPreview.schemaVersion >= 2 ? LoadProfileV2Modal : LoadProfileModal;
48074
48099
  var loadProfiles = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -48787,7 +48812,27 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48787
48812
  message: notice,
48788
48813
  onClose: function onClose() {
48789
48814
  return setNotice(null);
48790
- }
48815
+ },
48816
+ children: leftOut && leftOut.notice === notice ? /*#__PURE__*/jsxs("div", {
48817
+ className: "flex flex-col gap-1",
48818
+ "data-testid": "profile-left-out",
48819
+ children: [/*#__PURE__*/jsx("div", {
48820
+ className: "flex flex-row",
48821
+ children: /*#__PURE__*/jsx(Button3, {
48822
+ title: showLeftOut ? "Hide" : "Show which",
48823
+ size: "sm",
48824
+ onClick: function onClick() {
48825
+ return setShowLeftOut(function (v) {
48826
+ return !v;
48827
+ });
48828
+ }
48829
+ })
48830
+ }), showLeftOut ? leftOut.lines.map(function (line, i) {
48831
+ return /*#__PURE__*/jsx("span", {
48832
+ children: "\u2022 ".concat(line)
48833
+ }, i);
48834
+ }) : null]
48835
+ }) : null
48791
48836
  }) : null, /*#__PURE__*/jsx(SectionLayout, {
48792
48837
  listContent: listContent,
48793
48838
  detailContent: detailContent,
@@ -48852,10 +48897,18 @@ var ProfilesSection = function ProfilesSection(_ref2) {
48852
48897
  },
48853
48898
  onSaved: function onSaved(res) {
48854
48899
  setSaving(null);
48855
- setNotice(savedNoticeText(res));
48856
- // What didn't go in, and why (left out of the profile).
48857
- var left = leftOutText(res);
48858
- if (left) setError(left);
48900
+ // An older error is over once a save goes through.
48901
+ setError(null);
48902
+ // What didn't go in: one sentence in the notice (the dialog
48903
+ // showed it already), the names under "Show which".
48904
+ var left = leftOutSummary(res);
48905
+ var text = left ? "".concat(savedNoticeText(res), " ").concat(left) : savedNoticeText(res);
48906
+ setNotice(text);
48907
+ setLeftOut(left ? {
48908
+ notice: text,
48909
+ lines: leftOutLines(res)
48910
+ } : null);
48911
+ setShowLeftOut(false);
48859
48912
  loadProfiles();
48860
48913
  }
48861
48914
  }) : null, (confirm === null || confirm === void 0 ? void 0 : confirm.type) === "delete" ? /*#__PURE__*/jsx(ConfirmationModal, {