@ai-matrx/records-ui 0.115.64 → 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/dist/index.js CHANGED
@@ -41178,7 +41178,8 @@ function ActionInbox({
41178
41178
  release();
41179
41179
  void commit();
41180
41180
  };
41181
- const entry = { timer: setTimeout(fire, seconds * 1e3), ids, commit: fire };
41181
+ const arm = () => setTimeout(() => Date.now() >= until ? fire() : entry.timer = arm(), Math.min(Math.max(0, until - Date.now()), 2147483647));
41182
+ const entry = { timer: arm(), ids, commit: fire };
41182
41183
  holds2.current.set(hold, entry);
41183
41184
  lastHold.current = hold;
41184
41185
  setHeld((h) => {
@@ -52808,6 +52809,13 @@ function phoneTableActions(actions) {
52808
52809
 
52809
52810
  // src/toolbarFit.ts
52810
52811
  import { useEffect as useEffect123, useLayoutEffect as useLayoutEffect6, useState as useState149 } from "react";
52812
+ function widthAtFold(piece, fold) {
52813
+ for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
52814
+ const w = piece.byFold?.[f];
52815
+ if (w != null && w > 0) return w;
52816
+ }
52817
+ return piece.full ?? piece.now;
52818
+ }
52811
52819
  var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
52812
52820
  var SLOT_MIN = 36;
52813
52821
  function toolbarFold(input) {
@@ -52820,7 +52828,7 @@ function toolbarFold(input) {
52820
52828
  const widthAt = ({ piece, stage, guess }, fold) => {
52821
52829
  if (piece.now === 0 && piece.full === null) return 0;
52822
52830
  if (fold >= stage) return piece.folded ?? (folded >= stage ? piece.now : Math.min(guess, piece.full ?? piece.now));
52823
- return piece.full ?? piece.now;
52831
+ return widthAtFold(piece, fold);
52824
52832
  };
52825
52833
  const withGap = (width) => width > 0 ? width + gap : 0;
52826
52834
  const shareNow = input.share ? withGap(input.share.now) : 0;
@@ -52863,18 +52871,40 @@ function rowNeeds(row) {
52863
52871
  }
52864
52872
  return { needs: needs + gap * Math.max(0, pieces.length - 1), gap };
52865
52873
  }
52874
+ var STAGE_OF = { look: 1, chooser: 2, tools: 3, share: 4 };
52875
+ function createFitMemory() {
52876
+ const widths = {
52877
+ look: { full: null, folded: null, byFold: [] },
52878
+ chooser: { full: null, folded: null, byFold: [] },
52879
+ tools: { full: null, folded: null, byFold: [] },
52880
+ share: { full: null, folded: null, byFold: [] }
52881
+ };
52882
+ return {
52883
+ /** Record one piece's measured width (`now`; `present`: the piece is on the row) with the row at `current`. */
52884
+ piece(name, current, now, present) {
52885
+ const w = widths[name];
52886
+ const stage = STAGE_OF[name];
52887
+ if (present && now > 0) {
52888
+ if (current >= stage) w.folded = now;
52889
+ else {
52890
+ if (name === "tools") w.byFold[current] = now;
52891
+ if (name !== "tools" || current === 0 || w.full === null) w.full = now;
52892
+ }
52893
+ }
52894
+ if (!present && current < stage) {
52895
+ w.full = null;
52896
+ w.byFold = [];
52897
+ }
52898
+ return { now, full: w.full, folded: w.folded, byFold: w.byFold };
52899
+ }
52900
+ };
52901
+ }
52866
52902
  var useIsoLayoutEffect = typeof window === "undefined" ? useEffect123 : useLayoutEffect6;
52867
52903
  function useToolbarFit(row) {
52868
52904
  const [fold, setFold] = useState149(0);
52869
52905
  useIsoLayoutEffect(() => {
52870
52906
  if (!row) return;
52871
- const widths = {
52872
- look: { full: null, folded: null },
52873
- chooser: { full: null, folded: null },
52874
- tools: { full: null, folded: null },
52875
- share: { full: null, folded: null }
52876
- };
52877
- const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
52907
+ const memory = createFitMemory();
52878
52908
  let current = 0;
52879
52909
  let pending = 0;
52880
52910
  let stopped = false;
@@ -52886,13 +52916,7 @@ function useToolbarFit(row) {
52886
52916
  const read = (name) => {
52887
52917
  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}"]`);
52888
52918
  const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
52889
- const w = widths[name];
52890
- if (el && now > 0) {
52891
- if (current >= stageOf[name]) w.folded = now;
52892
- else w.full = now;
52893
- }
52894
- if (!el && current < stageOf[name]) w.full = null;
52895
- return { now, full: w.full, folded: w.folded };
52919
+ return memory.piece(name, current, now, !!el);
52896
52920
  };
52897
52921
  const look = read("look");
52898
52922
  const chooser = read("chooser");