@ai-matrx/records-ui 0.115.65 → 0.115.66

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,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.115.66
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.115.65..npm/records-ui/v0.115.66 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.115.65
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -52819,6 +52819,13 @@ function phoneTableActions(actions) {
52819
52819
 
52820
52820
  // src/toolbarFit.ts
52821
52821
  var import_react310 = require("react");
52822
+ function widthAtFold(piece, fold) {
52823
+ for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
52824
+ const w = piece.byFold?.[f];
52825
+ if (w != null && w > 0) return w;
52826
+ }
52827
+ return piece.full ?? piece.now;
52828
+ }
52822
52829
  var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
52823
52830
  var SLOT_MIN = 36;
52824
52831
  function toolbarFold(input) {
@@ -52831,7 +52838,7 @@ function toolbarFold(input) {
52831
52838
  const widthAt = ({ piece, stage, guess }, fold) => {
52832
52839
  if (piece.now === 0 && piece.full === null) return 0;
52833
52840
  if (fold >= stage) return piece.folded ?? (folded >= stage ? piece.now : Math.min(guess, piece.full ?? piece.now));
52834
- return piece.full ?? piece.now;
52841
+ return widthAtFold(piece, fold);
52835
52842
  };
52836
52843
  const withGap = (width) => width > 0 ? width + gap : 0;
52837
52844
  const shareNow = input.share ? withGap(input.share.now) : 0;
@@ -52874,18 +52881,40 @@ function rowNeeds(row) {
52874
52881
  }
52875
52882
  return { needs: needs + gap * Math.max(0, pieces.length - 1), gap };
52876
52883
  }
52884
+ var STAGE_OF = { look: 1, chooser: 2, tools: 3, share: 4 };
52885
+ function createFitMemory() {
52886
+ const widths = {
52887
+ look: { full: null, folded: null, byFold: [] },
52888
+ chooser: { full: null, folded: null, byFold: [] },
52889
+ tools: { full: null, folded: null, byFold: [] },
52890
+ share: { full: null, folded: null, byFold: [] }
52891
+ };
52892
+ return {
52893
+ /** Record one piece's measured width (`now`; `present`: the piece is on the row) with the row at `current`. */
52894
+ piece(name, current, now, present) {
52895
+ const w = widths[name];
52896
+ const stage = STAGE_OF[name];
52897
+ if (present && now > 0) {
52898
+ if (current >= stage) w.folded = now;
52899
+ else {
52900
+ if (name === "tools") w.byFold[current] = now;
52901
+ if (name !== "tools" || current === 0 || w.full === null) w.full = now;
52902
+ }
52903
+ }
52904
+ if (!present && current < stage) {
52905
+ w.full = null;
52906
+ w.byFold = [];
52907
+ }
52908
+ return { now, full: w.full, folded: w.folded, byFold: w.byFold };
52909
+ }
52910
+ };
52911
+ }
52877
52912
  var useIsoLayoutEffect = typeof window === "undefined" ? import_react310.useEffect : import_react310.useLayoutEffect;
52878
52913
  function useToolbarFit(row) {
52879
52914
  const [fold, setFold] = (0, import_react310.useState)(0);
52880
52915
  useIsoLayoutEffect(() => {
52881
52916
  if (!row) return;
52882
- const widths = {
52883
- look: { full: null, folded: null },
52884
- chooser: { full: null, folded: null },
52885
- tools: { full: null, folded: null },
52886
- share: { full: null, folded: null }
52887
- };
52888
- const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
52917
+ const memory = createFitMemory();
52889
52918
  let current = 0;
52890
52919
  let pending = 0;
52891
52920
  let stopped = false;
@@ -52897,13 +52926,7 @@ function useToolbarFit(row) {
52897
52926
  const read = (name) => {
52898
52927
  const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : name === "share" ? row.querySelector('[data-toolbar-fit="share"]') : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
52899
52928
  const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
52900
- const w = widths[name];
52901
- if (el && now > 0) {
52902
- if (current >= stageOf[name]) w.folded = now;
52903
- else w.full = now;
52904
- }
52905
- if (!el && current < stageOf[name]) w.full = null;
52906
- return { now, full: w.full, folded: w.folded };
52929
+ return memory.piece(name, current, now, !!el);
52907
52930
  };
52908
52931
  const look = read("look");
52909
52932
  const chooser = read("chooser");