@ai-matrx/records-ui 0.93.85 → 0.93.86

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.93.86
4
+ ### Unreleased
5
+
6
+ - **Share folds into the table's menu only when the row's own buttons do not fit** (merged-grid leftovers, 2026-09-30): fold 4 (0.93.85) also fired whenever the layout's slot held more than it could show, so a 736 px chat artifact lost Share from its row for nothing — the slot scrolls and keeps its pinned controls whole. Fold 4 now asks only about the fixed pieces (everything outside the slot, plus the slot at its least). Proof: `toolbarFit.test.tsx` ("a slot that holds more than fits is not a reason to move Share"), red on 0.93.85. Consumer action: none.
7
+
3
8
  ## 0.93.85
4
9
  ### Unreleased
5
10
 
package/dist/index.cjs CHANGED
@@ -31579,14 +31579,14 @@ function ViewFilter({ tableId, view, onApply, className }) {
31579
31579
 
31580
31580
  // src/toolbarFit.ts
31581
31581
  var import_react188 = require("react");
31582
- var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120, share: 0 };
31582
+ var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
31583
+ var SLOT_MIN = 36;
31583
31584
  function toolbarFold(input) {
31584
31585
  const { available, needsNow, gap, folded } = input;
31585
31586
  const pieces = [
31586
31587
  { piece: input.look, stage: 1, guess: FOLDED_GUESS.look },
31587
31588
  { piece: input.chooser, stage: 2, guess: FOLDED_GUESS.chooser },
31588
- ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : [],
31589
- ...input.tools && input.share ? [{ piece: input.share, stage: 4, guess: FOLDED_GUESS.share }] : []
31589
+ ...input.tools ? [{ piece: input.tools, stage: 3, guess: FOLDED_GUESS.tools }] : []
31590
31590
  ];
31591
31591
  const widthAt = ({ piece, stage, guess }, fold) => {
31592
31592
  if (piece.now === 0 && piece.full === null) return 0;
@@ -31594,13 +31594,18 @@ function toolbarFold(input) {
31594
31594
  return piece.full ?? piece.now;
31595
31595
  };
31596
31596
  const withGap = (width) => width > 0 ? width + gap : 0;
31597
- const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow);
31598
- const stages = input.tools ? input.share ? [0, 1, 2, 3, 4] : [0, 1, 2, 3] : [0, 1, 2];
31599
- const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base));
31597
+ const shareNow = input.share ? withGap(input.share.now) : 0;
31598
+ const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow - shareNow);
31599
+ const stages = input.tools ? [0, 1, 2, 3] : [0, 1, 2];
31600
+ const shareOn = input.share ? withGap(input.share.full ?? input.share.now) : 0;
31601
+ const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base + shareOn));
31600
31602
  const fits = needs.findIndex((need) => need <= available + 0.5);
31601
31603
  if (fits >= 0) return stages[fits];
31602
31604
  const least = Math.min(...needs);
31603
- return stages[needs.findIndex((need) => need <= least + 0.5)];
31605
+ const most = stages[needs.findIndex((need) => need <= least + 0.5)];
31606
+ if (most < 3 || !input.tools || !input.share) return most;
31607
+ const fixed = pieces.reduce((sum, p) => sum + withGap(p.stage === 3 ? SLOT_MIN : widthAt(p, 3)), base + shareOn);
31608
+ return fixed > available + 0.5 ? 4 : 3;
31604
31609
  }
31605
31610
  function naturalWidth(el) {
31606
31611
  const html = el;