@justanarthur/modo-ui 2.3.0 → 2.5.0

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.
Files changed (129) hide show
  1. package/components/data-display/diff/index.tsx +19 -3
  2. package/components/inputs/choice-list/index.tsx +4 -3
  3. package/components/navigation/sidebar/index.tsx +48 -1
  4. package/components/navigation/sidebar/menu-scope.tsx +142 -53
  5. package/components/navigation/sidebar/sidebar-menu-actions.tsx +5 -5
  6. package/components/navigation/sidebar/sidebar-menu-button.tsx +4 -7
  7. package/components/navigation/sidebar/sidebar-menu-item.tsx +39 -36
  8. package/components/navigation/sidebar/sidebar-menu-sub.tsx +3 -2
  9. package/components/overlays/command/index.tsx +70 -12
  10. package/components/overlays/dropdown/menu-popup.tsx +11 -2
  11. package/components/overlays/tooltip/index.tsx +9 -1
  12. package/dist/blocks/desktop-shell/index.js +11 -11
  13. package/dist/blocks/sidebar-app/index.js +14 -14
  14. package/dist/components/actions/copy/index.js +3 -3
  15. package/dist/components/containers/accordion/index.js +5 -5
  16. package/dist/components/containers/card/index.js +4 -4
  17. package/dist/components/data-display/diff/index.d.ts +1 -1
  18. package/dist/components/data-display/diff/index.js +2 -2
  19. package/dist/components/data-display/markdown/index.js +7 -7
  20. package/dist/components/data-display/table/index.js +4 -4
  21. package/dist/components/inputs/checkbox/index.js +6 -6
  22. package/dist/components/inputs/choice-list/index.js +5 -5
  23. package/dist/components/inputs/color-picker/index.js +7 -7
  24. package/dist/components/inputs/combobox/index.js +7 -7
  25. package/dist/components/inputs/date-time/calendar/index.js +5 -5
  26. package/dist/components/inputs/date-time/date-picker/index.js +12 -12
  27. package/dist/components/inputs/date-time/date-range-picker/index.js +12 -12
  28. package/dist/components/inputs/date-time/duration-picker/index.js +11 -11
  29. package/dist/components/inputs/date-time/month-picker/index.js +10 -10
  30. package/dist/components/inputs/date-time/time-picker/index.js +11 -11
  31. package/dist/components/inputs/input/index.js +2 -2
  32. package/dist/components/inputs/key-value/index.js +3 -3
  33. package/dist/components/inputs/number-input/index.js +3 -3
  34. package/dist/components/inputs/radio/index.js +5 -5
  35. package/dist/components/inputs/search/index.js +8 -8
  36. package/dist/components/inputs/select/index.js +7 -7
  37. package/dist/components/inputs/switch/index.js +4 -4
  38. package/dist/components/navigation/breadcrumb/index.js +9 -9
  39. package/dist/components/navigation/navigation-menu/index.js +6 -6
  40. package/dist/components/navigation/pagination/index.js +5 -5
  41. package/dist/components/navigation/sidebar/index.js +10 -10
  42. package/dist/components/navigation/tabs/index.js +4 -4
  43. package/dist/components/navigation/tree/index.js +5 -5
  44. package/dist/components/overlays/alert-dialog/index.js +3 -3
  45. package/dist/components/overlays/command/index.d.ts +6 -3
  46. package/dist/components/overlays/command/index.js +7 -7
  47. package/dist/components/overlays/context-menu/index.js +9 -9
  48. package/dist/components/overlays/dialog/index.js +2 -2
  49. package/dist/components/overlays/dropdown/index.js +8 -8
  50. package/dist/components/overlays/popover/index.js +2 -2
  51. package/dist/components/overlays/preview-card/index.js +2 -2
  52. package/dist/components/overlays/sheet/index.js +3 -3
  53. package/dist/components/overlays/tooltip/index.js +2 -2
  54. package/dist/docs/index.js +11 -11
  55. package/dist/index.d.ts +12 -6
  56. package/dist/index.js +55 -55
  57. package/dist/lib/fluid-hover-highlight.js +3 -2
  58. package/dist/lib/focus-ring.d.ts +5 -2
  59. package/dist/lib/focus-ring.js +2 -1
  60. package/dist/lib/goo-indicator.d.ts +5 -2
  61. package/dist/lib/goo-indicator.js +2 -1
  62. package/dist/lib/overlay.d.ts +8 -1
  63. package/dist/lib/overlay.js +3 -1
  64. package/dist/lib/scroll-column.js +4 -4
  65. package/dist/lib/use-fluid-hover.d.ts +3 -1
  66. package/dist/lib/use-fluid-hover.js +3 -1
  67. package/dist/lib/use-merge-split.js +3 -2
  68. package/dist/primitives/content/code/index.js +2 -2
  69. package/dist/primitives/layout/scroll-area/index.js +1 -1
  70. package/dist/primitives/systems/fluid-hover/index.js +4 -4
  71. package/dist/shared/{components-7xc2dne4.js → components-0ep66sg9.js} +5 -5
  72. package/dist/shared/{components-agjpst9b.js → components-0v4jxw7z.js} +1 -1
  73. package/dist/shared/{components-a3brpprb.js → components-1qw8hqwq.js} +7 -7
  74. package/dist/shared/{components-7c4a0egq.js → components-21hcwp85.js} +78 -43
  75. package/dist/shared/{components-fjg4j430.js → components-2c22zpm2.js} +2 -2
  76. package/dist/shared/{components-kz6ak6kj.js → components-3qcgeay1.js} +2 -2
  77. package/dist/shared/{components-8ybvpebx.js → components-4d0v8nzm.js} +59 -19
  78. package/dist/shared/{components-e52xgvd9.js → components-4fay97sm.js} +7 -7
  79. package/dist/shared/{components-fxw1122w.js → components-4fhjk3jz.js} +2 -2
  80. package/dist/shared/{components-czvraaw9.js → components-4m9stj7d.js} +10 -10
  81. package/dist/shared/{components-y4gsk1jt.js → components-5w7hxa1n.js} +1 -1
  82. package/dist/shared/{components-c515d6xr.js → components-5wykqxph.js} +6 -1
  83. package/dist/shared/{components-7g2q2ccp.js → components-66aw235e.js} +6 -6
  84. package/dist/shared/{components-z87sanbc.js → components-766w1xcw.js} +4 -4
  85. package/dist/shared/{components-8e0fjgm9.js → components-7rn454aq.js} +11 -2
  86. package/dist/shared/{components-2tw25pk6.js → components-895m1f3s.js} +7 -7
  87. package/dist/shared/{components-h8v9nh5r.js → components-8dgrpegd.js} +16 -4
  88. package/dist/shared/{components-m7d7r3r8.js → components-8hzwz162.js} +2 -2
  89. package/dist/shared/{components-b7p1pjcm.js → components-8m5e493q.js} +1 -1
  90. package/dist/shared/{components-rzy6h7s4.js → components-8nnhzeb3.js} +5 -5
  91. package/dist/shared/{components-1hga6pkn.js → components-8xe4h118.js} +5 -5
  92. package/dist/shared/{components-83jn0raj.js → components-9am5511q.js} +3 -3
  93. package/dist/shared/{components-g35n8tzm.js → components-9b2m90st.js} +1 -1
  94. package/dist/shared/{components-2bq4ng4d.js → components-9yrajpy0.js} +1 -1
  95. package/dist/shared/{components-mvwf8ckh.js → components-ac0x7zpq.js} +2 -2
  96. package/dist/shared/{components-q7zk70tx.js → components-af44r4y9.js} +1 -1
  97. package/dist/shared/{components-2v4mmw1s.js → components-b2fag579.js} +212 -121
  98. package/dist/shared/{components-ex2xtqv7.js → components-br6t88cb.js} +1 -1
  99. package/dist/shared/{components-z0kz9rxj.js → components-bxqmbcz2.js} +6 -2
  100. package/dist/shared/{components-e7zxwja1.js → components-d4gkhy26.js} +1 -1
  101. package/dist/shared/{components-w1ysefg1.js → components-eawe4nxm.js} +1 -1
  102. package/dist/shared/{components-1sbnbq6a.js → components-fpgfs01m.js} +1 -1
  103. package/dist/shared/{components-tcm3k3wj.js → components-ft5dgjg6.js} +9 -2
  104. package/dist/shared/{components-6g8a5nrs.js → components-fymenepq.js} +7 -7
  105. package/dist/shared/{components-k2gg1agj.js → components-gzve0nkp.js} +4 -4
  106. package/dist/shared/{components-k25zw9g8.js → components-hjk6dwsp.js} +1 -1
  107. package/dist/shared/{components-6xtntksc.js → components-jnjw9j2z.js} +9 -9
  108. package/dist/shared/{components-9rebr89j.js → components-k8awpmbn.js} +2 -2
  109. package/dist/shared/{components-4fswe4kh.js → components-mb80a9wg.js} +1 -1
  110. package/dist/shared/{components-nh05qz8b.js → components-mzdbtgvz.js} +8 -8
  111. package/dist/shared/{components-x5v7e0fz.js → components-nmbcfwx8.js} +7 -7
  112. package/dist/shared/{components-01e24999.js → components-pfwjhxd8.js} +21 -11
  113. package/dist/shared/{components-nred2e6g.js → components-q28xct6t.js} +2 -2
  114. package/dist/shared/{components-etgpz4zk.js → components-qrtcc8aw.js} +3 -3
  115. package/dist/shared/{components-esy5nsvc.js → components-resqc2d2.js} +12 -0
  116. package/dist/shared/{components-gnsvnejm.js → components-rtwfh1gc.js} +2 -2
  117. package/dist/shared/{components-vykcfb5r.js → components-v1zzr668.js} +3 -3
  118. package/dist/shared/{components-5vezp3e5.js → components-vcmky8ns.js} +6 -6
  119. package/dist/shared/{components-27fatggq.js → components-y9se9mx5.js} +3 -3
  120. package/dist/shared/{components-9ca0c92a.js → components-yfx0skxc.js} +1 -1
  121. package/dist/shared/{components-eebf7f9c.js → components-z14s3avn.js} +9 -9
  122. package/dist/shared/{components-ta4e10mx.js → components-zckgawt6.js} +5 -5
  123. package/dist/styles.css +2 -1
  124. package/lib/focus-ring.tsx +15 -8
  125. package/lib/goo-indicator.tsx +20 -8
  126. package/lib/overlay.tsx +22 -1
  127. package/lib/use-fluid-hover.ts +96 -72
  128. package/package.json +1 -1
  129. package/primitives/layout/scroll-area/index.tsx +20 -0
@@ -5,6 +5,7 @@ interface ItemRect {
5
5
  width: number;
6
6
  }
7
7
  import { JSX as JSX_1kxb } from "react";
8
+ import { MemoExoticComponent as MemoExoticComponent_h78s4x } from "react";
8
9
  interface FocusRingProps {
9
10
  /** The focused row's box (from `useFluidHover`'s `itemRects`), or `null` for no ring. */
10
11
  rect: ItemRect | null;
@@ -14,11 +15,13 @@ interface FocusRingProps {
14
15
  className?: string;
15
16
  }
16
17
  type Element_12xgc = JSX_1kxb["Element"];
18
+ declare function FocusRingBase({ rect, instant, className }: FocusRingProps): Element_12xgc;
17
19
  /**
18
20
  * A 1px `focus-ring` border drawn 2px outside the focused row. It springs
19
21
  * between rows on `spring.fast` (jumps under reduced motion) and fades out
20
22
  * when focus leaves. Render it inside the rows' `relative` container, above
21
- * the hover highlight.
23
+ * the hover highlight. Skips the render while its box and props hold (rects
24
+ * are fresh objects on every list render).
22
25
  */
23
- declare function FocusRing({ rect, instant, className }: FocusRingProps): Element_12xgc;
26
+ declare const FocusRing: MemoExoticComponent_h78s4x<typeof FocusRingBase>;
24
27
  export { FocusRing };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  FocusRing2
3
- } from "../shared/components-c515d6xr.js";
3
+ } from "../shared/components-5wykqxph.js";
4
+ import"../shared/components-21hcwp85.js";
4
5
  import"../shared/components-45r18egt.js";
5
6
  import"../shared/components-tz0axc0f.js";
6
7
  import"../shared/components-kxpcj2ry.js";
@@ -7,6 +7,7 @@ interface ItemRect {
7
7
  width: number;
8
8
  }
9
9
  import { JSX as JSX_1kxb } from "react";
10
+ import { MemoExoticComponent as MemoExoticComponent_h78s4x } from "react";
10
11
  declare function union(a: ItemRect | null, b: ItemRect): ItemRect;
11
12
  interface GooLayerProps {
12
13
  /** Filter on: the shapes melt into one. Off at rest. */
@@ -37,10 +38,12 @@ interface GooIndicatorProps {
37
38
  /** Opacity of the whole indicator, faded on `spring.fast`. Defaults to `1`. */
38
39
  opacity?: number;
39
40
  }
41
+ declare function GooIndicatorBase({ rect, from, className, shadow, transition, opacity }: GooIndicatorProps): Element_12xgc;
40
42
  /**
41
43
  * An indicator that travels between items with a liquid neck. Render it in the
42
44
  * items' `relative` container, beneath them: the items' text stays above it,
43
- * unfiltered.
45
+ * unfiltered. Its list re-renders on every hover; an indicator whose box did
46
+ * not move skips the render (rects are fresh objects each time).
44
47
  */
45
- declare function GooIndicator({ rect, from, className, shadow, transition, opacity }: GooIndicatorProps): Element_12xgc;
48
+ declare const GooIndicator: MemoExoticComponent_h78s4x<typeof GooIndicatorBase>;
46
49
  export { GooIndicator, GooIndicatorProps, GooLayer, GooLayerProps, union };
@@ -2,7 +2,8 @@ import {
2
2
  union2,
3
3
  GooLayer2,
4
4
  GooIndicator2
5
- } from "../shared/components-z0kz9rxj.js";
5
+ } from "../shared/components-bxqmbcz2.js";
6
+ import"../shared/components-21hcwp85.js";
6
7
  import"../shared/components-8pnvkrbw.js";
7
8
  import"../shared/components-pva1wj1r.js";
8
9
  import"../shared/components-45r18egt.js";
@@ -96,6 +96,13 @@ declare function useOverlayRoot({ open: openProp, defaultOpen, onOpenChange: onC
96
96
  /** The nearest overlay root's state. `part` names the caller in the error thrown outside a root. */
97
97
  declare function useOverlay(part: string): OverlayState;
98
98
  /**
99
+ * False until `open` first turns true, then true for good. Content that
100
+ * mounts its machinery (the morph, a fluid hover, the portal) behind it costs
101
+ * nothing in a list of triggers until one opens, and stays mounted after, for
102
+ * its close and the next open.
103
+ */
104
+ declare function useOpenedOnce(open: boolean): boolean;
105
+ /**
99
106
  * Base UI `Positioner` props for an anchored overlay: the content's
100
107
  * anchoring props over the overlay's defaults, pulled back over the trigger
101
108
  * when the panel opens in place. Spread them on the `Positioner`.
@@ -117,4 +124,4 @@ declare function PortalContainer({ value, children }: {
117
124
  }): Element_12xgc;
118
125
  /** The portal target: the content's own `container`, else the nearest `PortalContainer`, else the body (`undefined`). */
119
126
  declare function usePortalContainer(container?: HTMLElement | null): HTMLElement | undefined;
120
- export { Align, AnchorProps, CollisionProps, OpenChangeDetails, OverlayContext, OverlayRootProps, OverlayState, PortalContainer, Side, positionerProps, useOverlay, useOverlayRoot, usePortalContainer };
127
+ export { Align, AnchorProps, CollisionProps, OpenChangeDetails, OverlayContext, OverlayRootProps, OverlayState, PortalContainer, Side, positionerProps, useOpenedOnce, useOverlay, useOverlayRoot, usePortalContainer };
@@ -2,10 +2,11 @@ import {
2
2
  OverlayContext2,
3
3
  useOverlayRoot2,
4
4
  useOverlay2,
5
+ useOpenedOnce2,
5
6
  positionerProps2,
6
7
  PortalContainer2,
7
8
  usePortalContainer2
8
- } from "../shared/components-tcm3k3wj.js";
9
+ } from "../shared/components-ft5dgjg6.js";
9
10
  import"../shared/components-8pnvkrbw.js";
10
11
  import"../shared/components-pva1wj1r.js";
11
12
  import"../shared/components-45r18egt.js";
@@ -16,6 +17,7 @@ export {
16
17
  OverlayContext2 as OverlayContext,
17
18
  PortalContainer2 as PortalContainer,
18
19
  positionerProps2 as positionerProps,
20
+ useOpenedOnce2 as useOpenedOnce,
19
21
  useOverlay2 as useOverlay,
20
22
  useOverlayRoot2 as useOverlayRoot,
21
23
  usePortalContainer2 as usePortalContainer
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  dividedColumns2,
3
3
  ScrollColumn2
4
- } from "../shared/components-ta4e10mx.js";
5
- import"../shared/components-g35n8tzm.js";
6
- import"../shared/components-z0kz9rxj.js";
7
- import"../shared/components-7c4a0egq.js";
4
+ } from "../shared/components-zckgawt6.js";
5
+ import"../shared/components-9b2m90st.js";
6
+ import"../shared/components-bxqmbcz2.js";
7
+ import"../shared/components-21hcwp85.js";
8
8
  import"../shared/components-8pnvkrbw.js";
9
9
  import"../shared/components-pva1wj1r.js";
10
10
  import"../shared/components-45r18egt.js";
@@ -5,6 +5,8 @@ interface ItemRect {
5
5
  left: number;
6
6
  width: number;
7
7
  }
8
+ /** Two rects with the same box (either may be missing). */
9
+ declare function sameRect(a: ItemRect | null | undefined, b: ItemRect | null | undefined): boolean;
8
10
  interface UseFluidHoverOptions {
9
11
  /**
10
12
  * Which direction to resolve the nearest item along.
@@ -87,4 +89,4 @@ declare function useFluidHover<T extends HTMLElement>(containerRef: RefObject<T
87
89
  * item that is not grouped); then nothing is registered.
88
90
  */
89
91
  declare function useRegisterFluidHoverItem(registerItem: ((index: number, element: HTMLElement | null) => void) | undefined, index: number | undefined, ref: RefObject<HTMLElement | null>): void;
90
- export { ItemRect, UseFluidHoverOptions, UseFluidHoverReturn, useFluidHover, useRegisterFluidHoverItem };
92
+ export { ItemRect, UseFluidHoverOptions, UseFluidHoverReturn, sameRect, useFluidHover, useRegisterFluidHoverItem };
@@ -1,8 +1,10 @@
1
1
  import {
2
+ sameRect2,
2
3
  useFluidHover2,
3
4
  useRegisterFluidHoverItem2
4
- } from "../shared/components-7c4a0egq.js";
5
+ } from "../shared/components-21hcwp85.js";
5
6
  export {
7
+ sameRect2 as sameRect,
6
8
  useFluidHover2 as useFluidHover,
7
9
  useRegisterFluidHoverItem2 as useRegisterFluidHoverItem
8
10
  };
@@ -2,8 +2,9 @@ import {
2
2
  useSelectionRuns2,
3
3
  useMergeSplitBlocks2,
4
4
  SelectionBackgrounds2
5
- } from "../shared/components-w1ysefg1.js";
6
- import"../shared/components-z0kz9rxj.js";
5
+ } from "../shared/components-eawe4nxm.js";
6
+ import"../shared/components-bxqmbcz2.js";
7
+ import"../shared/components-21hcwp85.js";
7
8
  import"../shared/components-8pnvkrbw.js";
8
9
  import"../shared/components-pva1wj1r.js";
9
10
  import"../shared/components-45r18egt.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Code2
3
- } from "../../../shared/components-y4gsk1jt.js";
3
+ } from "../../../shared/components-5w7hxa1n.js";
4
4
  import"../../../shared/components-ceyn28cf.js";
5
5
  import"../../../shared/components-nwa2a9tq.js";
6
- import"../../../shared/components-esy5nsvc.js";
6
+ import"../../../shared/components-resqc2d2.js";
7
7
  import"../../../shared/components-6f5pyzb2.js";
8
8
  import"../../../shared/components-kxpcj2ry.js";
9
9
  import"../../../shared/components-s217vq1n.js";
@@ -2,7 +2,7 @@ import {
2
2
  ScrollArea2,
3
3
  ScrollBar2,
4
4
  scroll_area_default
5
- } from "../../../shared/components-esy5nsvc.js";
5
+ } from "../../../shared/components-resqc2d2.js";
6
6
  import"../../../shared/components-6f5pyzb2.js";
7
7
  import"../../../shared/components-kxpcj2ry.js";
8
8
  import"../../../shared/components-s217vq1n.js";
@@ -2,16 +2,16 @@ import {
2
2
  FluidHoverItem2,
3
3
  FluidHover2,
4
4
  fluid_hover_default
5
- } from "../../../shared/components-rzy6h7s4.js";
5
+ } from "../../../shared/components-8nnhzeb3.js";
6
6
  import {
7
7
  FluidHoverHighlight2
8
- } from "../../../shared/components-g35n8tzm.js";
9
- import"../../../shared/components-z0kz9rxj.js";
8
+ } from "../../../shared/components-9b2m90st.js";
9
+ import"../../../shared/components-bxqmbcz2.js";
10
10
  import"../../../shared/components-j3q9kaps.js";
11
11
  import {
12
12
  useFluidHover2,
13
13
  useRegisterFluidHoverItem2
14
- } from "../../../shared/components-7c4a0egq.js";
14
+ } from "../../../shared/components-21hcwp85.js";
15
15
  import"../../../shared/components-8pnvkrbw.js";
16
16
  import"../../../shared/components-pva1wj1r.js";
17
17
  import"../../../shared/components-bkwjvvkh.js";
@@ -6,12 +6,16 @@ import {
6
6
  import {
7
7
  spring2
8
8
  } from "./components-45r18egt.js";
9
+ import {
10
+ useFluidHover2,
11
+ useRegisterFluidHoverItem2
12
+ } from "./components-21hcwp85.js";
9
13
  import {
10
14
  cn2
11
15
  } from "./components-xnp09586.js";
12
16
  import {
13
17
  FluidHoverHighlight2
14
- } from "./components-g35n8tzm.js";
18
+ } from "./components-9b2m90st.js";
15
19
  import {
16
20
  RowOrderContext2,
17
21
  useRowOrder2,
@@ -23,10 +27,6 @@ import {
23
27
  import {
24
28
  useControllableState2
25
29
  } from "./components-wwd093xg.js";
26
- import {
27
- useFluidHover2,
28
- useRegisterFluidHoverItem2
29
- } from "./components-7c4a0egq.js";
30
30
  import {
31
31
  SizeScope2
32
32
  } from "./components-nz14rwtd.js";
@@ -15,7 +15,7 @@ import {
15
15
  useOverlay2,
16
16
  positionerProps2,
17
17
  usePortalContainer2
18
- } from "./components-tcm3k3wj.js";
18
+ } from "./components-ft5dgjg6.js";
19
19
  import {
20
20
  PopupSurface2
21
21
  } from "./components-nxqrw789.js";
@@ -1,14 +1,18 @@
1
1
  "use client";
2
2
 
3
+ import {
4
+ useFluidHover2,
5
+ useRegisterFluidHoverItem2
6
+ } from "./components-21hcwp85.js";
3
7
  import {
4
8
  cn2
5
9
  } from "./components-xnp09586.js";
6
10
  import {
7
11
  GooIndicator2
8
- } from "./components-z0kz9rxj.js";
12
+ } from "./components-bxqmbcz2.js";
9
13
  import {
10
14
  FluidHoverHighlight2
11
- } from "./components-g35n8tzm.js";
15
+ } from "./components-9b2m90st.js";
12
16
  import {
13
17
  useIcon2
14
18
  } from "./components-jnhpgpfk.js";
@@ -21,10 +25,6 @@ import {
21
25
  import {
22
26
  useControllableState2
23
27
  } from "./components-wwd093xg.js";
24
- import {
25
- useFluidHover2,
26
- useRegisterFluidHoverItem2
27
- } from "./components-7c4a0egq.js";
28
28
  import {
29
29
  WeightLabel2
30
30
  } from "./components-y09nr7fe.js";
@@ -36,7 +36,7 @@ import {
36
36
  } from "./components-ycwhrqe1.js";
37
37
  import {
38
38
  Input2
39
- } from "./components-q7zk70tx.js";
39
+ } from "./components-af44r4y9.js";
40
40
 
41
41
  // components/navigation/pagination/index.tsx
42
42
  import { useEffect, useRef, useState } from "react";
@@ -14,6 +14,11 @@ import {
14
14
  * LICENSE.fluid-functionalism in this package.
15
15
  * Local changes: see PORTING.md.
16
16
  */
17
+ function sameRect2(a, b) {
18
+ if (!a || !b)
19
+ return a === b;
20
+ return a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;
21
+ }
17
22
  function pickNearest({
18
23
  axis,
19
24
  point,
@@ -75,7 +80,6 @@ function resolveActivator(element) {
75
80
  }
76
81
  return element.querySelector(ACTIVATOR_SELECTOR) ?? element;
77
82
  }
78
- var measurementAttempts = 3;
79
83
  function useFluidHover2(containerRef, options = {}) {
80
84
  const { axis = "y", isItemDisabled, gapClick = true } = options;
81
85
  const gapClickMaxDistance = typeof gapClick === "object" ? gapClick.maxDistance ?? Infinity : Infinity;
@@ -134,13 +138,8 @@ function useFluidHover2(containerRef, options = {}) {
134
138
  return false;
135
139
  const prev = itemRectsRef.current;
136
140
  let changed = prev.length !== rects.length;
137
- for (let i = 0;!changed && i < rects.length; i++) {
138
- const p = prev[i];
139
- const r = rects[i];
140
- if (p === r)
141
- continue;
142
- changed = !p || !r || p.top !== r.top || p.left !== r.left || p.width !== r.width || p.height !== r.height;
143
- }
141
+ for (let i = 0;!changed && i < rects.length; i++)
142
+ changed = !sameRect2(prev[i], rects[i]);
144
143
  if (changed) {
145
144
  itemRectsRef.current = rects;
146
145
  setItemRects(rects);
@@ -150,40 +149,72 @@ function useFluidHover2(containerRef, options = {}) {
150
149
  const measureItems = useCallback(() => {
151
150
  runMeasurement();
152
151
  }, [runMeasurement]);
153
- const scheduleMeasurement = useCallback((attemptsLeft) => {
154
- if (remeasureRafIdRef.current !== null) {
155
- cancelAnimationFrame(remeasureRafIdRef.current);
152
+ const onObserved = useCallback(() => {
153
+ if (runMeasurement())
154
+ setIsMeasured(true);
155
+ }, [runMeasurement]);
156
+ const roRef = useRef(null);
157
+ const observedContainerRef = useRef(null);
158
+ const getRo = useCallback(() => {
159
+ if (roRef.current === null && typeof ResizeObserver !== "undefined") {
160
+ roRef.current = new ResizeObserver(onObserved);
156
161
  }
157
- remeasureRafIdRef.current = requestAnimationFrame(() => {
158
- remeasureRafIdRef.current = null;
159
- if (runMeasurement()) {
160
- setIsMeasured(true);
161
- } else if (attemptsLeft > 1) {
162
- scheduleMeasurement(attemptsLeft - 1);
162
+ return roRef.current;
163
+ }, [onObserved]);
164
+ const queuedRef = useRef(false);
165
+ const scheduleMeasurement = useCallback(() => {
166
+ if (queuedRef.current)
167
+ return;
168
+ queuedRef.current = true;
169
+ queueMicrotask(() => {
170
+ queuedRef.current = false;
171
+ const ro = getRo();
172
+ const container = containerRef.current;
173
+ if (!ro || !container) {
174
+ if (remeasureRafIdRef.current !== null)
175
+ cancelAnimationFrame(remeasureRafIdRef.current);
176
+ remeasureRafIdRef.current = requestAnimationFrame(() => {
177
+ remeasureRafIdRef.current = null;
178
+ onObserved();
179
+ });
180
+ return;
163
181
  }
182
+ if (observedContainerRef.current && observedContainerRef.current !== container) {
183
+ ro.unobserve(observedContainerRef.current);
184
+ }
185
+ observedContainerRef.current = container;
186
+ ro.unobserve(container);
187
+ ro.observe(container, { box: "border-box" });
164
188
  });
165
- }, [runMeasurement]);
189
+ }, [containerRef, getRo, onObserved]);
166
190
  const remeasure = useCallback(() => {
167
191
  setIsMeasured(false);
168
- scheduleMeasurement(measurementAttempts);
169
- }, [scheduleMeasurement]);
170
- const itemRoRef = useRef(null);
171
- const getItemRo = useCallback(() => {
172
- if (itemRoRef.current === null && typeof ResizeObserver !== "undefined") {
173
- itemRoRef.current = new ResizeObserver(() => scheduleMeasurement(measurementAttempts));
174
- }
175
- return itemRoRef.current;
192
+ scheduleMeasurement();
176
193
  }, [scheduleMeasurement]);
194
+ const observedRef = useRef(new Map);
195
+ const track = useCallback((element, by) => {
196
+ const count = (observedRef.current.get(element) ?? 0) + by;
197
+ if (count > 0)
198
+ observedRef.current.set(element, count);
199
+ else
200
+ observedRef.current.delete(element);
201
+ if (by === 1 && count === 1)
202
+ getRo()?.observe(element, { box: "border-box" });
203
+ if (count === 0)
204
+ roRef.current?.unobserve(element);
205
+ }, [getRo]);
177
206
  const registerItem = useCallback((index, element) => {
207
+ const previous = itemsRef.current.get(index);
208
+ if (element && previous === element)
209
+ return;
210
+ if (previous)
211
+ track(previous, -1);
178
212
  if (element) {
179
213
  itemsRef.current.set(index, element);
180
- getItemRo()?.observe(element);
214
+ track(element, 1);
181
215
  if (index === activeIndexRef.current)
182
216
  element.setAttribute(ACTIVE_ATTR, "");
183
217
  } else {
184
- const previous = itemsRef.current.get(index);
185
- if (previous)
186
- itemRoRef.current?.unobserve(previous);
187
218
  previous?.removeAttribute(ACTIVE_ATTR);
188
219
  itemsRef.current.delete(index);
189
220
  if (index === activeIndexRef.current) {
@@ -191,7 +222,7 @@ function useFluidHover2(containerRef, options = {}) {
191
222
  }
192
223
  }
193
224
  remeasure();
194
- }, [remeasure, getItemRo]);
225
+ }, [remeasure, track]);
195
226
  const handleMouseMove = useCallback((e) => {
196
227
  const mouseX = e.clientX;
197
228
  const mouseY = e.clientY;
@@ -260,22 +291,26 @@ function useFluidHover2(containerRef, options = {}) {
260
291
  }, [isItemDisabled, gapClick, gapClickMaxDistance]);
261
292
  useEffect(() => {
262
293
  const container = containerRef.current;
263
- if (!container || typeof ResizeObserver === "undefined")
294
+ const ro = getRo();
295
+ if (!container || !ro)
264
296
  return;
265
- const ro = new ResizeObserver(() => scheduleMeasurement(measurementAttempts));
266
- ro.observe(container);
267
- return () => ro.disconnect();
268
- }, [containerRef, scheduleMeasurement]);
297
+ observedContainerRef.current = container;
298
+ ro.observe(container, { box: "border-box" });
299
+ return () => {
300
+ ro.unobserve(container);
301
+ if (observedContainerRef.current === container)
302
+ observedContainerRef.current = null;
303
+ };
304
+ }, [containerRef, getRo]);
269
305
  useEffect(() => {
270
306
  return () => {
271
- if (rafIdRef.current !== null) {
307
+ if (rafIdRef.current !== null)
272
308
  cancelAnimationFrame(rafIdRef.current);
273
- }
274
- if (remeasureRafIdRef.current !== null) {
309
+ if (remeasureRafIdRef.current !== null)
275
310
  cancelAnimationFrame(remeasureRafIdRef.current);
276
- }
277
- itemRoRef.current?.disconnect();
278
- itemRoRef.current = null;
311
+ roRef.current?.disconnect();
312
+ roRef.current = null;
313
+ observedRef.current.clear();
279
314
  };
280
315
  }, []);
281
316
  return {
@@ -304,4 +339,4 @@ function useRegisterFluidHoverItem2(registerItem, index, ref) {
304
339
  }, [index, registerItem, ref]);
305
340
  }
306
341
 
307
- export { useFluidHover2, useRegisterFluidHoverItem2 };
342
+ export { sameRect2, useFluidHover2, useRegisterFluidHoverItem2 };
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  OverlayContext2,
8
8
  useOverlayRoot2
9
- } from "./components-tcm3k3wj.js";
9
+ } from "./components-ft5dgjg6.js";
10
10
  import {
11
11
  SizeScope2
12
12
  } from "./components-nz14rwtd.js";
@@ -18,7 +18,7 @@ import {
18
18
  DropdownSubTrigger2,
19
19
  DropdownSubContent2,
20
20
  DropdownSeparator2
21
- } from "./components-01e24999.js";
21
+ } from "./components-pfwjhxd8.js";
22
22
 
23
23
  // components/overlays/context-menu/index.tsx
24
24
  import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu";
@@ -15,11 +15,11 @@ import {
15
15
  columnsPopupClass,
16
16
  ColumnsPanel,
17
17
  PickerInput
18
- } from "./components-k2gg1agj.js";
18
+ } from "./components-gzve0nkp.js";
19
19
  import {
20
20
  pad,
21
21
  TimeColumns
22
- } from "./components-e7zxwja1.js";
22
+ } from "./components-d4gkhy26.js";
23
23
 
24
24
  // components/inputs/date-time/time-picker/index.tsx
25
25
  import { set } from "date-fns";