@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.
- package/components/data-display/diff/index.tsx +19 -3
- package/components/inputs/choice-list/index.tsx +4 -3
- package/components/navigation/sidebar/index.tsx +48 -1
- package/components/navigation/sidebar/menu-scope.tsx +142 -53
- package/components/navigation/sidebar/sidebar-menu-actions.tsx +5 -5
- package/components/navigation/sidebar/sidebar-menu-button.tsx +4 -7
- package/components/navigation/sidebar/sidebar-menu-item.tsx +39 -36
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +3 -2
- package/components/overlays/command/index.tsx +70 -12
- package/components/overlays/dropdown/menu-popup.tsx +11 -2
- package/components/overlays/tooltip/index.tsx +9 -1
- package/dist/blocks/desktop-shell/index.js +11 -11
- package/dist/blocks/sidebar-app/index.js +14 -14
- package/dist/components/actions/copy/index.js +3 -3
- package/dist/components/containers/accordion/index.js +5 -5
- package/dist/components/containers/card/index.js +4 -4
- package/dist/components/data-display/diff/index.d.ts +1 -1
- package/dist/components/data-display/diff/index.js +2 -2
- package/dist/components/data-display/markdown/index.js +7 -7
- package/dist/components/data-display/table/index.js +4 -4
- package/dist/components/inputs/checkbox/index.js +6 -6
- package/dist/components/inputs/choice-list/index.js +5 -5
- package/dist/components/inputs/color-picker/index.js +7 -7
- package/dist/components/inputs/combobox/index.js +7 -7
- package/dist/components/inputs/date-time/calendar/index.js +5 -5
- package/dist/components/inputs/date-time/date-picker/index.js +12 -12
- package/dist/components/inputs/date-time/date-range-picker/index.js +12 -12
- package/dist/components/inputs/date-time/duration-picker/index.js +11 -11
- package/dist/components/inputs/date-time/month-picker/index.js +10 -10
- package/dist/components/inputs/date-time/time-picker/index.js +11 -11
- package/dist/components/inputs/input/index.js +2 -2
- package/dist/components/inputs/key-value/index.js +3 -3
- package/dist/components/inputs/number-input/index.js +3 -3
- package/dist/components/inputs/radio/index.js +5 -5
- package/dist/components/inputs/search/index.js +8 -8
- package/dist/components/inputs/select/index.js +7 -7
- package/dist/components/inputs/switch/index.js +4 -4
- package/dist/components/navigation/breadcrumb/index.js +9 -9
- package/dist/components/navigation/navigation-menu/index.js +6 -6
- package/dist/components/navigation/pagination/index.js +5 -5
- package/dist/components/navigation/sidebar/index.js +10 -10
- package/dist/components/navigation/tabs/index.js +4 -4
- package/dist/components/navigation/tree/index.js +5 -5
- package/dist/components/overlays/alert-dialog/index.js +3 -3
- package/dist/components/overlays/command/index.d.ts +6 -3
- package/dist/components/overlays/command/index.js +7 -7
- package/dist/components/overlays/context-menu/index.js +9 -9
- package/dist/components/overlays/dialog/index.js +2 -2
- package/dist/components/overlays/dropdown/index.js +8 -8
- package/dist/components/overlays/popover/index.js +2 -2
- package/dist/components/overlays/preview-card/index.js +2 -2
- package/dist/components/overlays/sheet/index.js +3 -3
- package/dist/components/overlays/tooltip/index.js +2 -2
- package/dist/docs/index.js +11 -11
- package/dist/index.d.ts +12 -6
- package/dist/index.js +55 -55
- package/dist/lib/fluid-hover-highlight.js +3 -2
- package/dist/lib/focus-ring.d.ts +5 -2
- package/dist/lib/focus-ring.js +2 -1
- package/dist/lib/goo-indicator.d.ts +5 -2
- package/dist/lib/goo-indicator.js +2 -1
- package/dist/lib/overlay.d.ts +8 -1
- package/dist/lib/overlay.js +3 -1
- package/dist/lib/scroll-column.js +4 -4
- package/dist/lib/use-fluid-hover.d.ts +3 -1
- package/dist/lib/use-fluid-hover.js +3 -1
- package/dist/lib/use-merge-split.js +3 -2
- package/dist/primitives/content/code/index.js +2 -2
- package/dist/primitives/layout/scroll-area/index.js +1 -1
- package/dist/primitives/systems/fluid-hover/index.js +4 -4
- package/dist/shared/{components-7xc2dne4.js → components-0ep66sg9.js} +5 -5
- package/dist/shared/{components-agjpst9b.js → components-0v4jxw7z.js} +1 -1
- package/dist/shared/{components-a3brpprb.js → components-1qw8hqwq.js} +7 -7
- package/dist/shared/{components-7c4a0egq.js → components-21hcwp85.js} +78 -43
- package/dist/shared/{components-fjg4j430.js → components-2c22zpm2.js} +2 -2
- package/dist/shared/{components-kz6ak6kj.js → components-3qcgeay1.js} +2 -2
- package/dist/shared/{components-8ybvpebx.js → components-4d0v8nzm.js} +59 -19
- package/dist/shared/{components-e52xgvd9.js → components-4fay97sm.js} +7 -7
- package/dist/shared/{components-fxw1122w.js → components-4fhjk3jz.js} +2 -2
- package/dist/shared/{components-czvraaw9.js → components-4m9stj7d.js} +10 -10
- package/dist/shared/{components-y4gsk1jt.js → components-5w7hxa1n.js} +1 -1
- package/dist/shared/{components-c515d6xr.js → components-5wykqxph.js} +6 -1
- package/dist/shared/{components-7g2q2ccp.js → components-66aw235e.js} +6 -6
- package/dist/shared/{components-z87sanbc.js → components-766w1xcw.js} +4 -4
- package/dist/shared/{components-8e0fjgm9.js → components-7rn454aq.js} +11 -2
- package/dist/shared/{components-2tw25pk6.js → components-895m1f3s.js} +7 -7
- package/dist/shared/{components-h8v9nh5r.js → components-8dgrpegd.js} +16 -4
- package/dist/shared/{components-m7d7r3r8.js → components-8hzwz162.js} +2 -2
- package/dist/shared/{components-b7p1pjcm.js → components-8m5e493q.js} +1 -1
- package/dist/shared/{components-rzy6h7s4.js → components-8nnhzeb3.js} +5 -5
- package/dist/shared/{components-1hga6pkn.js → components-8xe4h118.js} +5 -5
- package/dist/shared/{components-83jn0raj.js → components-9am5511q.js} +3 -3
- package/dist/shared/{components-g35n8tzm.js → components-9b2m90st.js} +1 -1
- package/dist/shared/{components-2bq4ng4d.js → components-9yrajpy0.js} +1 -1
- package/dist/shared/{components-mvwf8ckh.js → components-ac0x7zpq.js} +2 -2
- package/dist/shared/{components-q7zk70tx.js → components-af44r4y9.js} +1 -1
- package/dist/shared/{components-2v4mmw1s.js → components-b2fag579.js} +212 -121
- package/dist/shared/{components-ex2xtqv7.js → components-br6t88cb.js} +1 -1
- package/dist/shared/{components-z0kz9rxj.js → components-bxqmbcz2.js} +6 -2
- package/dist/shared/{components-e7zxwja1.js → components-d4gkhy26.js} +1 -1
- package/dist/shared/{components-w1ysefg1.js → components-eawe4nxm.js} +1 -1
- package/dist/shared/{components-1sbnbq6a.js → components-fpgfs01m.js} +1 -1
- package/dist/shared/{components-tcm3k3wj.js → components-ft5dgjg6.js} +9 -2
- package/dist/shared/{components-6g8a5nrs.js → components-fymenepq.js} +7 -7
- package/dist/shared/{components-k2gg1agj.js → components-gzve0nkp.js} +4 -4
- package/dist/shared/{components-k25zw9g8.js → components-hjk6dwsp.js} +1 -1
- package/dist/shared/{components-6xtntksc.js → components-jnjw9j2z.js} +9 -9
- package/dist/shared/{components-9rebr89j.js → components-k8awpmbn.js} +2 -2
- package/dist/shared/{components-4fswe4kh.js → components-mb80a9wg.js} +1 -1
- package/dist/shared/{components-nh05qz8b.js → components-mzdbtgvz.js} +8 -8
- package/dist/shared/{components-x5v7e0fz.js → components-nmbcfwx8.js} +7 -7
- package/dist/shared/{components-01e24999.js → components-pfwjhxd8.js} +21 -11
- package/dist/shared/{components-nred2e6g.js → components-q28xct6t.js} +2 -2
- package/dist/shared/{components-etgpz4zk.js → components-qrtcc8aw.js} +3 -3
- package/dist/shared/{components-esy5nsvc.js → components-resqc2d2.js} +12 -0
- package/dist/shared/{components-gnsvnejm.js → components-rtwfh1gc.js} +2 -2
- package/dist/shared/{components-vykcfb5r.js → components-v1zzr668.js} +3 -3
- package/dist/shared/{components-5vezp3e5.js → components-vcmky8ns.js} +6 -6
- package/dist/shared/{components-27fatggq.js → components-y9se9mx5.js} +3 -3
- package/dist/shared/{components-9ca0c92a.js → components-yfx0skxc.js} +1 -1
- package/dist/shared/{components-eebf7f9c.js → components-z14s3avn.js} +9 -9
- package/dist/shared/{components-ta4e10mx.js → components-zckgawt6.js} +5 -5
- package/dist/styles.css +2 -1
- package/lib/focus-ring.tsx +15 -8
- package/lib/goo-indicator.tsx +20 -8
- package/lib/overlay.tsx +22 -1
- package/lib/use-fluid-hover.ts +96 -72
- package/package.json +1 -1
- package/primitives/layout/scroll-area/index.tsx +20 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import {
|
|
4
|
+
mergeRefs2,
|
|
5
|
+
useMergeRefs2
|
|
6
|
+
} from "./components-bkwjvvkh.js";
|
|
3
7
|
import {
|
|
4
8
|
useControllableState2
|
|
5
9
|
} from "./components-wwd093xg.js";
|
|
@@ -11,11 +15,7 @@ import {
|
|
|
11
15
|
} from "./components-kxpcj2ry.js";
|
|
12
16
|
import {
|
|
13
17
|
ScrollArea2
|
|
14
|
-
} from "./components-
|
|
15
|
-
import {
|
|
16
|
-
mergeRefs2,
|
|
17
|
-
useMergeRefs2
|
|
18
|
-
} from "./components-bkwjvvkh.js";
|
|
18
|
+
} from "./components-resqc2d2.js";
|
|
19
19
|
import {
|
|
20
20
|
useReduceMotion2
|
|
21
21
|
} from "./components-tz0axc0f.js";
|
|
@@ -46,19 +46,20 @@ import {
|
|
|
46
46
|
} from "./components-ycwhrqe1.js";
|
|
47
47
|
import {
|
|
48
48
|
Sheet2
|
|
49
|
-
} from "./components-
|
|
49
|
+
} from "./components-ac0x7zpq.js";
|
|
50
|
+
import {
|
|
51
|
+
sameRect2,
|
|
52
|
+
useFluidHover2
|
|
53
|
+
} from "./components-21hcwp85.js";
|
|
50
54
|
import {
|
|
51
55
|
GooIndicator2
|
|
52
|
-
} from "./components-
|
|
56
|
+
} from "./components-bxqmbcz2.js";
|
|
53
57
|
import {
|
|
54
58
|
FluidHoverHighlight2
|
|
55
|
-
} from "./components-
|
|
59
|
+
} from "./components-9b2m90st.js";
|
|
56
60
|
import {
|
|
57
61
|
FocusRing2
|
|
58
|
-
} from "./components-
|
|
59
|
-
import {
|
|
60
|
-
useFluidHover2
|
|
61
|
-
} from "./components-7c4a0egq.js";
|
|
62
|
+
} from "./components-5wykqxph.js";
|
|
62
63
|
import {
|
|
63
64
|
useIsoLayoutEffect2
|
|
64
65
|
} from "./components-v2j3jx89.js";
|
|
@@ -79,23 +80,27 @@ import {
|
|
|
79
80
|
} from "./components-8wp8d8q1.js";
|
|
80
81
|
import {
|
|
81
82
|
Tooltip2
|
|
82
|
-
} from "./components-
|
|
83
|
+
} from "./components-7rn454aq.js";
|
|
83
84
|
|
|
84
85
|
// components/navigation/sidebar/index.tsx
|
|
85
86
|
import {
|
|
86
87
|
forwardRef as forwardRef10,
|
|
87
88
|
useEffect as useEffect6,
|
|
88
|
-
useMemo as useMemo5
|
|
89
|
+
useMemo as useMemo5,
|
|
90
|
+
useRef as useRef10
|
|
89
91
|
} from "react";
|
|
90
92
|
|
|
91
93
|
// components/navigation/sidebar/menu-scope.tsx
|
|
92
94
|
import { AnimatePresence, motion } from "motion/react";
|
|
93
95
|
import {
|
|
94
96
|
createContext,
|
|
97
|
+
memo,
|
|
95
98
|
useCallback,
|
|
99
|
+
useContext,
|
|
96
100
|
useMemo,
|
|
97
101
|
useRef,
|
|
98
|
-
useState
|
|
102
|
+
useState,
|
|
103
|
+
useSyncExternalStore
|
|
99
104
|
} from "react";
|
|
100
105
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
101
106
|
/*!
|
|
@@ -107,7 +112,29 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
107
112
|
var MenuScopeContext = createContext(null);
|
|
108
113
|
var SidebarSelection2 = createContext(null);
|
|
109
114
|
var MenuItemContext = createContext(null);
|
|
115
|
+
var MenuRowContext = createContext(null);
|
|
110
116
|
var MenuActionsClusterContext = createContext(false);
|
|
117
|
+
var NO_SUBSCRIPTION = () => () => {};
|
|
118
|
+
var HOVERED = 1;
|
|
119
|
+
var ACTIVE = 2;
|
|
120
|
+
var TAB_STOP = 4;
|
|
121
|
+
function useRowState(rowRef) {
|
|
122
|
+
const scope = useContext(MenuScopeContext);
|
|
123
|
+
const flags = useSyncExternalStore(scope?.subscribe ?? NO_SUBSCRIPTION, () => {
|
|
124
|
+
const row = rowRef?.current;
|
|
125
|
+
if (!scope || !row)
|
|
126
|
+
return 0;
|
|
127
|
+
const { hovered, active, first } = scope.getSnapshot();
|
|
128
|
+
const isActive = active.includes(row);
|
|
129
|
+
const tabStop = active.length > 0 ? isActive : row === first;
|
|
130
|
+
return (row === hovered ? HOVERED : 0) | (isActive ? ACTIVE : 0) | (tabStop ? TAB_STOP : 0);
|
|
131
|
+
}, () => 0);
|
|
132
|
+
return {
|
|
133
|
+
isHovered: (flags & HOVERED) !== 0,
|
|
134
|
+
isActiveRow: (flags & ACTIVE) !== 0,
|
|
135
|
+
isTabStop: (flags & TAB_STOP) !== 0
|
|
136
|
+
};
|
|
137
|
+
}
|
|
111
138
|
function rowHidden(el) {
|
|
112
139
|
return el.closest('[data-sidebar="menu-sub"][data-state="closed"]') !== null;
|
|
113
140
|
}
|
|
@@ -152,6 +179,24 @@ function gutterVars(item) {
|
|
|
152
179
|
const rest = item?.actionsShowOnHover ? rowGutter(0, item.hasBadge) : hover;
|
|
153
180
|
return { "--row-gutter": `${rest}px`, "--row-gutter-hover": `${hover}px` };
|
|
154
181
|
}
|
|
182
|
+
function sameBackgrounds(a, b) {
|
|
183
|
+
return a.length === b.length && a.every((x, i) => x.key === b[i]?.key && x.rowChanged === b[i]?.rowChanged && sameRect2(x.rect, b[i]?.rect));
|
|
184
|
+
}
|
|
185
|
+
var ActiveBackgrounds = memo(function ActiveBackgrounds({ items, className }) {
|
|
186
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
187
|
+
children: items.map(({ key, rect, rowChanged }) => /* @__PURE__ */ jsx(motion.div, {
|
|
188
|
+
className: "pointer-events-none absolute top-0 left-0",
|
|
189
|
+
initial: false,
|
|
190
|
+
animate: { opacity: 1 },
|
|
191
|
+
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
192
|
+
children: /* @__PURE__ */ jsx(GooIndicator2, {
|
|
193
|
+
rect,
|
|
194
|
+
className,
|
|
195
|
+
transition: rowChanged ? spring2.moderate : false
|
|
196
|
+
})
|
|
197
|
+
}, key))
|
|
198
|
+
});
|
|
199
|
+
}, (a, b) => a.className === b.className && sameBackgrounds(a.items, b.items));
|
|
155
200
|
function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
156
201
|
const { activeIndex, setActiveIndex, itemRects, isMeasured, sessionRef, handlers, registerItem } = useFluidHover2(containerRef, { isItemDisabled: rowSkipped });
|
|
157
202
|
const rowsRef = useRef(new Set);
|
|
@@ -159,54 +204,72 @@ function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
|
159
204
|
const activeMapRef = useRef(new Map);
|
|
160
205
|
const [orderedRows, setOrderedRows] = useState([]);
|
|
161
206
|
const orderedRowsRef = useRef(orderedRows);
|
|
162
|
-
orderedRowsRef.current = orderedRows;
|
|
163
207
|
const registeredCountRef = useRef(0);
|
|
164
208
|
const [activeRows, setActiveRows] = useState([]);
|
|
165
209
|
const [focusedRowEl, setFocusedRowEl] = useState(null);
|
|
166
|
-
const recomputeActive = useCallback(() => {
|
|
167
|
-
const next = orderedRowsRef.current.filter((el) => activeMapRef.current.get(el) && !rowSkipped(el));
|
|
168
|
-
setActiveRows((prev) => sameElements(prev, next) ? prev : next);
|
|
169
|
-
}, []);
|
|
170
210
|
const rowButton = useCallback((row) => rowButtonsRef.current.get(row) ?? row.querySelector(':scope > [data-sidebar="menu-button"], :scope > [data-sidebar="menu-sub-button"]'), []);
|
|
211
|
+
const staleRef = useRef(false);
|
|
171
212
|
const syncRows = useCallback(() => {
|
|
213
|
+
staleRef.current = false;
|
|
172
214
|
const sorted = [...rowsRef.current].sort(byDomOrder);
|
|
173
|
-
orderedRowsRef.current
|
|
174
|
-
|
|
215
|
+
if (!sameElements(orderedRowsRef.current, sorted)) {
|
|
216
|
+
orderedRowsRef.current = sorted;
|
|
217
|
+
setOrderedRows(sorted);
|
|
218
|
+
}
|
|
175
219
|
for (const [i, el] of sorted.entries())
|
|
176
220
|
registerItem(i, rowButton(el) ?? el);
|
|
177
221
|
for (let i = sorted.length;i < registeredCountRef.current; i++)
|
|
178
222
|
registerItem(i, null);
|
|
179
223
|
registeredCountRef.current = sorted.length;
|
|
180
|
-
|
|
181
|
-
|
|
224
|
+
const active = sorted.filter((el) => activeMapRef.current.get(el) && !rowSkipped(el));
|
|
225
|
+
setActiveRows((prev) => sameElements(prev, active) ? prev : active);
|
|
226
|
+
}, [registerItem, rowButton]);
|
|
227
|
+
const rows = useCallback(() => {
|
|
228
|
+
if (staleRef.current)
|
|
229
|
+
syncRows();
|
|
230
|
+
return orderedRowsRef.current;
|
|
231
|
+
}, [syncRows]);
|
|
232
|
+
const invalidate = useCallback(() => {
|
|
233
|
+
if (staleRef.current)
|
|
234
|
+
return;
|
|
235
|
+
staleRef.current = true;
|
|
236
|
+
queueMicrotask(() => {
|
|
237
|
+
if (staleRef.current)
|
|
238
|
+
syncRows();
|
|
239
|
+
});
|
|
240
|
+
}, [syncRows]);
|
|
182
241
|
const registerRow = useCallback((el) => {
|
|
183
242
|
rowsRef.current.add(el);
|
|
184
|
-
|
|
243
|
+
invalidate();
|
|
185
244
|
return () => {
|
|
186
245
|
rowsRef.current.delete(el);
|
|
187
246
|
rowButtonsRef.current.delete(el);
|
|
188
247
|
activeMapRef.current.delete(el);
|
|
189
|
-
|
|
248
|
+
invalidate();
|
|
190
249
|
};
|
|
191
|
-
}, [
|
|
250
|
+
}, [invalidate]);
|
|
192
251
|
const setRowButton = useCallback((row, button) => {
|
|
193
252
|
if (button)
|
|
194
253
|
rowButtonsRef.current.set(row, button);
|
|
195
254
|
else
|
|
196
255
|
rowButtonsRef.current.delete(row);
|
|
197
|
-
|
|
198
|
-
}, [
|
|
256
|
+
invalidate();
|
|
257
|
+
}, [invalidate]);
|
|
199
258
|
const setRowActive = useCallback((row, active) => {
|
|
259
|
+
if (activeMapRef.current.get(row) === active)
|
|
260
|
+
return;
|
|
200
261
|
activeMapRef.current.set(row, active);
|
|
201
|
-
|
|
202
|
-
}, [
|
|
262
|
+
invalidate();
|
|
263
|
+
}, [invalidate]);
|
|
203
264
|
const refreshVisibility = useCallback(() => {
|
|
204
|
-
|
|
265
|
+
const ordered = rows();
|
|
266
|
+
const active = ordered.filter((el) => activeMapRef.current.get(el) && !rowSkipped(el));
|
|
267
|
+
setActiveRows((prev) => sameElements(prev, active) ? prev : active);
|
|
205
268
|
setActiveIndex((prev) => {
|
|
206
|
-
const row = prev !== null ?
|
|
269
|
+
const row = prev !== null ? ordered[prev] : undefined;
|
|
207
270
|
return row && rowSkipped(row) ? null : prev;
|
|
208
271
|
});
|
|
209
|
-
}, [
|
|
272
|
+
}, [rows, setActiveIndex]);
|
|
210
273
|
const overlayRect = useCallback((row) => {
|
|
211
274
|
if (!row)
|
|
212
275
|
return null;
|
|
@@ -235,12 +298,12 @@ function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
|
235
298
|
const row = target.closest('[data-sidebar="menu-item"],[data-sidebar="menu-sub-item"]');
|
|
236
299
|
if (!row)
|
|
237
300
|
return;
|
|
238
|
-
const idx =
|
|
301
|
+
const idx = rows().indexOf(row);
|
|
239
302
|
if (idx === -1)
|
|
240
303
|
return;
|
|
241
304
|
setActiveIndex(idx);
|
|
242
305
|
setFocusedRowEl(target.matches(":focus-visible") ? row : null);
|
|
243
|
-
}, [setActiveIndex]);
|
|
306
|
+
}, [rows, setActiveIndex]);
|
|
244
307
|
const onBlur = useCallback((e) => {
|
|
245
308
|
if (containerRef.current?.contains(e.relatedTarget))
|
|
246
309
|
return;
|
|
@@ -269,16 +332,28 @@ function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
|
269
332
|
}
|
|
270
333
|
}, [containerRef]);
|
|
271
334
|
const hoveredRowEl = activeIndex !== null ? orderedRows[activeIndex] ?? null : null;
|
|
335
|
+
const snapshotRef = useRef({ hovered: null, active: [], first: null });
|
|
336
|
+
const listenersRef = useRef(new Set);
|
|
337
|
+
const firstRowEl = orderedRows[0] ?? null;
|
|
338
|
+
useIsoLayoutEffect2(() => {
|
|
339
|
+
const prev = snapshotRef.current;
|
|
340
|
+
if (prev.hovered === hoveredRowEl && prev.active === activeRows && prev.first === firstRowEl)
|
|
341
|
+
return;
|
|
342
|
+
snapshotRef.current = { hovered: hoveredRowEl, active: activeRows, first: firstRowEl };
|
|
343
|
+
for (const listener of listenersRef.current)
|
|
344
|
+
listener();
|
|
345
|
+
}, [hoveredRowEl, activeRows, firstRowEl]);
|
|
272
346
|
const value = useMemo(() => ({
|
|
273
347
|
registerRow,
|
|
274
348
|
setRowButton,
|
|
275
349
|
setRowActive,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
350
|
+
refreshVisibility,
|
|
351
|
+
subscribe: (listener) => {
|
|
352
|
+
listenersRef.current.add(listener);
|
|
353
|
+
return () => listenersRef.current.delete(listener);
|
|
354
|
+
},
|
|
355
|
+
getSnapshot: () => snapshotRef.current
|
|
356
|
+
}), [registerRow, setRowButton, setRowActive, refreshVisibility]);
|
|
282
357
|
const shape = useShape2();
|
|
283
358
|
const rowLevel = useCallback((row) => row.closest('[data-sidebar="menu-sub"]') ?? containerRef.current, [containerRef]);
|
|
284
359
|
const prevTargetsRef = useRef({ hover: null, focus: null, actives: new Map });
|
|
@@ -315,18 +390,9 @@ function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
|
315
390
|
const hoverAnchorRect = hoverAnchorRow ? overlayRect(hoverAnchorRow) : null;
|
|
316
391
|
const overlays = isMeasured ? /* @__PURE__ */ jsxs(Fragment, {
|
|
317
392
|
children: [
|
|
318
|
-
/* @__PURE__ */ jsx(
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
initial: false,
|
|
322
|
-
animate: { opacity: 1 },
|
|
323
|
-
exit: { opacity: 0, transition: spring2.moderate.exit },
|
|
324
|
-
children: /* @__PURE__ */ jsx(GooIndicator2, {
|
|
325
|
-
rect,
|
|
326
|
-
className: cn2("bg-active", shape.bg),
|
|
327
|
-
transition: rowChanged ? spring2.moderate : false
|
|
328
|
-
})
|
|
329
|
-
}, key))
|
|
393
|
+
/* @__PURE__ */ jsx(ActiveBackgrounds, {
|
|
394
|
+
items: activeRects,
|
|
395
|
+
className: cn2("bg-active", shape.bg)
|
|
330
396
|
}),
|
|
331
397
|
/* @__PURE__ */ jsx(FluidHoverHighlight2, {
|
|
332
398
|
rect: hoverRect,
|
|
@@ -358,7 +424,7 @@ function useMenuScope(containerRef, { focusRing = true } = {}) {
|
|
|
358
424
|
}
|
|
359
425
|
|
|
360
426
|
// components/navigation/sidebar/sidebar-context.tsx
|
|
361
|
-
import { createContext as createContext2, useContext } from "react";
|
|
427
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
362
428
|
/*!
|
|
363
429
|
* Ported from Fluid Functionalism — github.com/mickadesign/fluid-functionalism
|
|
364
430
|
* `registry/default/sidebar-core.tsx` @ b3587bdbd83fc66c2a6aae3817ffb856cb09260b
|
|
@@ -375,7 +441,7 @@ var SIDEBAR_MIN_WIDTH2 = 160;
|
|
|
375
441
|
var SIDEBAR_MAX_WIDTH2 = 360;
|
|
376
442
|
var SidebarContext = createContext2(null);
|
|
377
443
|
function useSidebar2() {
|
|
378
|
-
const ctx =
|
|
444
|
+
const ctx = useContext2(SidebarContext);
|
|
379
445
|
if (!ctx)
|
|
380
446
|
throw new Error("useSidebar must be used within a SidebarProvider");
|
|
381
447
|
return ctx;
|
|
@@ -391,7 +457,7 @@ import {
|
|
|
391
457
|
createContext as createContext3,
|
|
392
458
|
forwardRef,
|
|
393
459
|
isValidElement,
|
|
394
|
-
useContext as
|
|
460
|
+
useContext as useContext3,
|
|
395
461
|
useEffect,
|
|
396
462
|
useId,
|
|
397
463
|
useMemo as useMemo2,
|
|
@@ -559,7 +625,7 @@ var SidebarGroup2 = forwardRef(({ className, collapsible = false, open: openProp
|
|
|
559
625
|
SidebarGroup2.displayName = "SidebarGroup";
|
|
560
626
|
var SidebarGroupLabel2 = forwardRef(({ className, render, asChild, children, ...props }, ref) => {
|
|
561
627
|
const size = useSize2();
|
|
562
|
-
const group =
|
|
628
|
+
const group = useContext3(SidebarGroupContext);
|
|
563
629
|
const shape = useShape2();
|
|
564
630
|
const ChevronRightIcon = useIcon2("chevron-right");
|
|
565
631
|
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
@@ -616,7 +682,7 @@ var GroupActionsContext = createContext3(false);
|
|
|
616
682
|
var SidebarGroupAction2 = forwardRef(({ className, render, asChild, children, style, ...props }, ref) => {
|
|
617
683
|
const shape = useShape2();
|
|
618
684
|
const size = useSize2();
|
|
619
|
-
const inCluster =
|
|
685
|
+
const inCluster = useContext3(GroupActionsContext);
|
|
620
686
|
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
621
687
|
return slotElement2(template, "button", {
|
|
622
688
|
ref,
|
|
@@ -651,7 +717,7 @@ SidebarGroupContent2.displayName = "SidebarGroupContent";
|
|
|
651
717
|
import {
|
|
652
718
|
Children as Children3,
|
|
653
719
|
forwardRef as forwardRef2,
|
|
654
|
-
useContext as
|
|
720
|
+
useContext as useContext4,
|
|
655
721
|
useId as useId2
|
|
656
722
|
} from "react";
|
|
657
723
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -664,8 +730,8 @@ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
|
664
730
|
var SidebarMenuAction2 = forwardRef2(({ className, showOnHover = false, render, asChild, children, onClick, style, ...props }, ref) => {
|
|
665
731
|
const shape = useShape2();
|
|
666
732
|
const size = useSize2();
|
|
667
|
-
const item =
|
|
668
|
-
const inCluster =
|
|
733
|
+
const item = useContext4(MenuRowContext);
|
|
734
|
+
const inCluster = useContext4(MenuActionsClusterContext);
|
|
669
735
|
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
670
736
|
const setActions = item?.setActions;
|
|
671
737
|
useIsoLayoutEffect2(() => {
|
|
@@ -690,7 +756,7 @@ var SidebarMenuAction2 = forwardRef2(({ className, showOnHover = false, render,
|
|
|
690
756
|
});
|
|
691
757
|
SidebarMenuAction2.displayName = "SidebarMenuAction";
|
|
692
758
|
var SidebarMenuActions2 = forwardRef2(({ className, showOnHover = false, children, ...props }, ref) => {
|
|
693
|
-
const item =
|
|
759
|
+
const item = useContext4(MenuRowContext);
|
|
694
760
|
const size = useSize2();
|
|
695
761
|
const count = Children3.count(children);
|
|
696
762
|
const setActions = item?.setActions;
|
|
@@ -711,9 +777,9 @@ var SidebarMenuActions2 = forwardRef2(({ className, showOnHover = false, childre
|
|
|
711
777
|
});
|
|
712
778
|
SidebarMenuActions2.displayName = "SidebarMenuActions";
|
|
713
779
|
var SidebarMenuBadge2 = forwardRef2(({ className, ...props }, ref) => {
|
|
714
|
-
const item =
|
|
780
|
+
const item = useContext4(MenuRowContext);
|
|
715
781
|
const size = useSize2();
|
|
716
|
-
const lit = item?.isActiveRow
|
|
782
|
+
const lit = useRowState(item?.rowRef).isActiveRow;
|
|
717
783
|
const setHasBadge = item?.setHasBadge;
|
|
718
784
|
useIsoLayoutEffect2(() => {
|
|
719
785
|
setHasBadge?.(true);
|
|
@@ -759,7 +825,7 @@ import { cva } from "class-variance-authority";
|
|
|
759
825
|
import { motion as motion3 } from "motion/react";
|
|
760
826
|
import {
|
|
761
827
|
forwardRef as forwardRef3,
|
|
762
|
-
useContext as
|
|
828
|
+
useContext as useContext5,
|
|
763
829
|
useRef as useRef3
|
|
764
830
|
} from "react";
|
|
765
831
|
import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
@@ -794,9 +860,8 @@ var SidebarMenuButton2 = forwardRef3(({
|
|
|
794
860
|
children,
|
|
795
861
|
...props
|
|
796
862
|
}, ref) => {
|
|
797
|
-
const
|
|
798
|
-
const
|
|
799
|
-
const selection = useContext4(SidebarSelection2);
|
|
863
|
+
const item = useContext5(MenuItemContext);
|
|
864
|
+
const selection = useContext5(SidebarSelection2);
|
|
800
865
|
const shape = useShape2();
|
|
801
866
|
const sizeClasses = useSize2(size);
|
|
802
867
|
const buttonRef = useRef3(null);
|
|
@@ -815,9 +880,9 @@ var SidebarMenuButton2 = forwardRef3(({
|
|
|
815
880
|
return () => setButtonEl?.(null);
|
|
816
881
|
}, [setButtonEl]);
|
|
817
882
|
const resolvedDot = dot ?? (status ? status === "idle" ? "ring" : "filled" : undefined);
|
|
818
|
-
const
|
|
819
|
-
const
|
|
820
|
-
const tabIdx = effectiveActive
|
|
883
|
+
const row = useRowState(item?.rowRef);
|
|
884
|
+
const lit = effectiveActive || row.isHovered;
|
|
885
|
+
const tabIdx = effectiveActive || row.isTabStop ? 0 : -1;
|
|
821
886
|
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
822
887
|
const inner = /* @__PURE__ */ jsxs5(Fragment4, {
|
|
823
888
|
children: [
|
|
@@ -890,7 +955,7 @@ SidebarMenuButton2.displayName = "SidebarMenuButton";
|
|
|
890
955
|
import {
|
|
891
956
|
forwardRef as forwardRef4,
|
|
892
957
|
useCallback as useCallback2,
|
|
893
|
-
useContext as
|
|
958
|
+
useContext as useContext6,
|
|
894
959
|
useMemo as useMemo3,
|
|
895
960
|
useRef as useRef4,
|
|
896
961
|
useState as useState4
|
|
@@ -926,7 +991,7 @@ var SidebarMenu2 = forwardRef4(({ className, size, focusRing, children, ...props
|
|
|
926
991
|
});
|
|
927
992
|
SidebarMenu2.displayName = "SidebarMenu";
|
|
928
993
|
function useMenuRow(rowRef, isSubRow, sub) {
|
|
929
|
-
const scope =
|
|
994
|
+
const scope = useContext6(MenuScopeContext);
|
|
930
995
|
const registerRow = scope?.registerRow;
|
|
931
996
|
const setRowButton = scope?.setRowButton;
|
|
932
997
|
const setRowActive = scope?.setRowActive;
|
|
@@ -951,19 +1016,16 @@ function useMenuRow(rowRef, isSubRow, sub) {
|
|
|
951
1016
|
if (rowRef.current && setRowButton)
|
|
952
1017
|
setRowButton(rowRef.current, el);
|
|
953
1018
|
}, [setRowButton, rowRef]);
|
|
954
|
-
const isHovered = rowRef.current !== null && scope?.hoveredRowEl === rowRef.current;
|
|
955
|
-
const isActiveRow = rowRef.current !== null && (scope?.activeRows.includes(rowRef.current) ?? false);
|
|
956
1019
|
const [trailing, setTrailing] = useState4({ actionCount: 0, actionsShowOnHover: false, hasBadge: false });
|
|
957
1020
|
const setActions = useCallback2((count, showOnHover) => setTrailing((prev) => prev.actionCount === count && prev.actionsShowOnHover === showOnHover ? prev : { ...prev, actionCount: count, actionsShowOnHover: showOnHover }), []);
|
|
958
1021
|
const setHasBadge = useCallback2((hasBadge) => setTrailing((prev) => prev.hasBadge === hasBadge ? prev : { ...prev, hasBadge }), []);
|
|
959
1022
|
const [open, setOpen] = useControllableState2(sub?.open, sub?.defaultOpen ?? false, sub?.onOpenChange);
|
|
960
1023
|
const subOpen = sub?.collapsible ? open : undefined;
|
|
961
1024
|
const toggleSub = useCallback2(() => setOpen((prev) => !prev), [setOpen]);
|
|
962
|
-
|
|
1025
|
+
const row = useMemo3(() => ({ rowRef, isSubRow, setActions, setHasBadge }), [rowRef, isSubRow, setActions, setHasBadge]);
|
|
1026
|
+
const item = useMemo3(() => ({
|
|
963
1027
|
rowRef,
|
|
964
1028
|
attachRow,
|
|
965
|
-
isHovered,
|
|
966
|
-
isActiveRow,
|
|
967
1029
|
isSubRow,
|
|
968
1030
|
setActive,
|
|
969
1031
|
setButtonEl,
|
|
@@ -972,49 +1034,43 @@ function useMenuRow(rowRef, isSubRow, sub) {
|
|
|
972
1034
|
setHasBadge,
|
|
973
1035
|
subOpen,
|
|
974
1036
|
toggleSub
|
|
975
|
-
}), [
|
|
976
|
-
|
|
977
|
-
attachRow,
|
|
978
|
-
isHovered,
|
|
979
|
-
isActiveRow,
|
|
980
|
-
isSubRow,
|
|
981
|
-
setActive,
|
|
982
|
-
setButtonEl,
|
|
983
|
-
trailing,
|
|
984
|
-
setActions,
|
|
985
|
-
setHasBadge,
|
|
986
|
-
subOpen,
|
|
987
|
-
toggleSub
|
|
988
|
-
]);
|
|
1037
|
+
}), [rowRef, attachRow, isSubRow, setActive, setButtonEl, trailing, setActions, setHasBadge, subOpen, toggleSub]);
|
|
1038
|
+
return { item, row };
|
|
989
1039
|
}
|
|
990
1040
|
var SidebarMenuItem2 = forwardRef4(({ collapsible, open, defaultOpen, onOpenChange, className, children, ...props }, ref) => {
|
|
991
1041
|
const rowRef = useRef4(null);
|
|
992
|
-
const item = useMenuRow(rowRef, false, { collapsible, open, defaultOpen, onOpenChange });
|
|
993
|
-
const
|
|
994
|
-
return /* @__PURE__ */ jsx6(
|
|
995
|
-
value:
|
|
996
|
-
children: /* @__PURE__ */ jsx6(
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1042
|
+
const { item, row } = useMenuRow(rowRef, false, { collapsible, open, defaultOpen, onOpenChange });
|
|
1043
|
+
const attach = useMergeRefs2(item.attachRow, ref);
|
|
1044
|
+
return /* @__PURE__ */ jsx6(MenuRowContext.Provider, {
|
|
1045
|
+
value: row,
|
|
1046
|
+
children: /* @__PURE__ */ jsx6(MenuItemContext.Provider, {
|
|
1047
|
+
value: item,
|
|
1048
|
+
children: /* @__PURE__ */ jsx6("li", {
|
|
1049
|
+
ref: attach,
|
|
1050
|
+
"data-sidebar": "menu-item",
|
|
1051
|
+
className: cn2("group/menu-item relative", className),
|
|
1052
|
+
...props,
|
|
1053
|
+
children
|
|
1054
|
+
})
|
|
1002
1055
|
})
|
|
1003
1056
|
});
|
|
1004
1057
|
});
|
|
1005
1058
|
SidebarMenuItem2.displayName = "SidebarMenuItem";
|
|
1006
1059
|
var SidebarMenuSubItem2 = forwardRef4(({ className, children, ...props }, ref) => {
|
|
1007
1060
|
const rowRef = useRef4(null);
|
|
1008
|
-
const item = useMenuRow(rowRef, true);
|
|
1009
|
-
const
|
|
1010
|
-
return /* @__PURE__ */ jsx6(
|
|
1011
|
-
value:
|
|
1012
|
-
children: /* @__PURE__ */ jsx6(
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1061
|
+
const { item, row } = useMenuRow(rowRef, true);
|
|
1062
|
+
const attach = useMergeRefs2(item.attachRow, ref);
|
|
1063
|
+
return /* @__PURE__ */ jsx6(MenuRowContext.Provider, {
|
|
1064
|
+
value: row,
|
|
1065
|
+
children: /* @__PURE__ */ jsx6(MenuItemContext.Provider, {
|
|
1066
|
+
value: item,
|
|
1067
|
+
children: /* @__PURE__ */ jsx6("li", {
|
|
1068
|
+
ref: attach,
|
|
1069
|
+
"data-sidebar": "menu-sub-item",
|
|
1070
|
+
className: cn2("group/menu-sub-item relative", className),
|
|
1071
|
+
...props,
|
|
1072
|
+
children
|
|
1073
|
+
})
|
|
1018
1074
|
})
|
|
1019
1075
|
});
|
|
1020
1076
|
});
|
|
@@ -1024,7 +1080,7 @@ SidebarMenuSubItem2.displayName = "SidebarMenuSubItem";
|
|
|
1024
1080
|
import { motion as motion4 } from "motion/react";
|
|
1025
1081
|
import {
|
|
1026
1082
|
forwardRef as forwardRef5,
|
|
1027
|
-
useContext as
|
|
1083
|
+
useContext as useContext7,
|
|
1028
1084
|
useRef as useRef5
|
|
1029
1085
|
} from "react";
|
|
1030
1086
|
import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
@@ -1035,9 +1091,9 @@ import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment5 } from "react/jsx-run
|
|
|
1035
1091
|
* Local changes: see PORTING.md.
|
|
1036
1092
|
*/
|
|
1037
1093
|
var SidebarMenuSub2 = forwardRef5(({ className, open: openProp, children, ...props }, ref) => {
|
|
1038
|
-
const row =
|
|
1094
|
+
const row = useContext7(MenuItemContext);
|
|
1039
1095
|
const open = openProp ?? row?.subOpen ?? true;
|
|
1040
|
-
const refreshVisibility =
|
|
1096
|
+
const refreshVisibility = useContext7(MenuScopeContext)?.refreshVisibility;
|
|
1041
1097
|
useIsoLayoutEffect2(() => {
|
|
1042
1098
|
refreshVisibility?.();
|
|
1043
1099
|
}, [open, refreshVisibility]);
|
|
@@ -1073,8 +1129,8 @@ var SidebarMenuSubButton2 = forwardRef5(({
|
|
|
1073
1129
|
children,
|
|
1074
1130
|
...props
|
|
1075
1131
|
}, ref) => {
|
|
1076
|
-
const item =
|
|
1077
|
-
const selection =
|
|
1132
|
+
const item = useContext7(MenuItemContext);
|
|
1133
|
+
const selection = useContext7(SidebarSelection2);
|
|
1078
1134
|
const isActive = isActiveProp || value !== undefined && selection?.value === value;
|
|
1079
1135
|
const shape = useShape2();
|
|
1080
1136
|
const sizeClasses = useSize2(size);
|
|
@@ -1089,7 +1145,8 @@ var SidebarMenuSubButton2 = forwardRef5(({
|
|
|
1089
1145
|
setButtonEl?.(buttonRef.current);
|
|
1090
1146
|
return () => setButtonEl?.(null);
|
|
1091
1147
|
}, [setButtonEl]);
|
|
1092
|
-
const
|
|
1148
|
+
const { isHovered } = useRowState(item?.rowRef);
|
|
1149
|
+
const lit = isActive || isHovered;
|
|
1093
1150
|
const { template, content } = resolveSlotTemplate2(render, asChild, children);
|
|
1094
1151
|
const asButton = !template && value !== undefined && props.href === undefined;
|
|
1095
1152
|
return slotElement2(template, asButton ? "button" : "a", {
|
|
@@ -1770,8 +1827,42 @@ var Sidebar2 = forwardRef10(({
|
|
|
1770
1827
|
});
|
|
1771
1828
|
});
|
|
1772
1829
|
Sidebar2.displayName = "Sidebar";
|
|
1830
|
+
function usePauseHoverWhileScrolling(ref, enabled) {
|
|
1831
|
+
useEffect6(() => {
|
|
1832
|
+
const content = enabled ? ref.current : null;
|
|
1833
|
+
const scroller = content?.closest('[data-slot="scroll-area-viewport"]');
|
|
1834
|
+
if (!content || !scroller)
|
|
1835
|
+
return;
|
|
1836
|
+
let timer;
|
|
1837
|
+
const resume = () => {
|
|
1838
|
+
clearTimeout(timer);
|
|
1839
|
+
content.removeAttribute("data-scrolling");
|
|
1840
|
+
};
|
|
1841
|
+
const onScroll = () => {
|
|
1842
|
+
if (!content.hasAttribute("data-scrolling"))
|
|
1843
|
+
content.setAttribute("data-scrolling", "");
|
|
1844
|
+
clearTimeout(timer);
|
|
1845
|
+
timer = setTimeout(resume, 150);
|
|
1846
|
+
};
|
|
1847
|
+
const onPointerMove = (e) => {
|
|
1848
|
+
const { movementX, movementY } = e;
|
|
1849
|
+
if ((movementX || movementY) && content.hasAttribute("data-scrolling"))
|
|
1850
|
+
resume();
|
|
1851
|
+
};
|
|
1852
|
+
scroller.addEventListener("scroll", onScroll, { passive: true });
|
|
1853
|
+
scroller.addEventListener("pointermove", onPointerMove, { passive: true });
|
|
1854
|
+
return () => {
|
|
1855
|
+
resume();
|
|
1856
|
+
scroller.removeEventListener("scroll", onScroll);
|
|
1857
|
+
scroller.removeEventListener("pointermove", onPointerMove);
|
|
1858
|
+
};
|
|
1859
|
+
}, [ref, enabled]);
|
|
1860
|
+
}
|
|
1773
1861
|
var SidebarContent2 = forwardRef10(({ className, viewportClassName, children, ...props }, ref) => {
|
|
1774
1862
|
const { isMobile } = useSidebar2();
|
|
1863
|
+
const contentRef = useRef10(null);
|
|
1864
|
+
const mergedRef = useMergeRefs2(ref, contentRef);
|
|
1865
|
+
usePauseHoverWhileScrolling(contentRef, !isMobile);
|
|
1775
1866
|
if (isMobile) {
|
|
1776
1867
|
return /* @__PURE__ */ jsx13("div", {
|
|
1777
1868
|
className: "scroll-divider [--scroll-divider-inset:8px] flex min-h-0 w-full flex-1 flex-col",
|
|
@@ -1788,9 +1879,9 @@ var SidebarContent2 = forwardRef10(({ className, viewportClassName, children, ..
|
|
|
1788
1879
|
className: cn2("scroll-divider min-h-0 w-full flex-1", className),
|
|
1789
1880
|
viewportClassName: cn2("scroll-fade [&>div]:!block [&>div]:!min-w-0", viewportClassName),
|
|
1790
1881
|
children: /* @__PURE__ */ jsx13("div", {
|
|
1791
|
-
ref,
|
|
1882
|
+
ref: mergedRef,
|
|
1792
1883
|
"data-sidebar": "content",
|
|
1793
|
-
className: "flex w-full min-w-0 flex-col",
|
|
1884
|
+
className: "flex w-full min-w-0 flex-col data-[scrolling]:pointer-events-none",
|
|
1794
1885
|
...props,
|
|
1795
1886
|
children
|
|
1796
1887
|
})
|
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
spring2
|
|
8
8
|
} from "./components-45r18egt.js";
|
|
9
|
+
import {
|
|
10
|
+
sameRect2
|
|
11
|
+
} from "./components-21hcwp85.js";
|
|
9
12
|
import {
|
|
10
13
|
GOO_MATRIX2,
|
|
11
14
|
GOO_BLUR_RATIO2
|
|
@@ -16,7 +19,7 @@ import {
|
|
|
16
19
|
|
|
17
20
|
// lib/goo-indicator.tsx
|
|
18
21
|
import { animate, motion, useMotionValue } from "motion/react";
|
|
19
|
-
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
22
|
+
import { memo, useId, useLayoutEffect, useRef, useState } from "react";
|
|
20
23
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
21
24
|
var COVERAGE = "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0";
|
|
22
25
|
var NECK = 0.5;
|
|
@@ -123,7 +126,7 @@ function GooLayer2({ active, blur, box, fill, children }) {
|
|
|
123
126
|
]
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
|
-
function
|
|
129
|
+
function GooIndicatorBase({
|
|
127
130
|
rect,
|
|
128
131
|
from,
|
|
129
132
|
className,
|
|
@@ -214,4 +217,5 @@ function GooIndicator2({
|
|
|
214
217
|
]
|
|
215
218
|
});
|
|
216
219
|
}
|
|
220
|
+
var GooIndicator2 = memo(GooIndicatorBase, (a, b) => sameRect2(a.rect, b.rect) && sameRect2(a.from, b.from) && a.className === b.className && a.shadow === b.shadow && a.transition === b.transition && a.opacity === b.opacity);
|
|
217
221
|
export { union2, GooLayer2, GooIndicator2 };
|