@meetreeve/ui 0.30.0 → 0.33.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/README.md +17 -2
- package/dist/index.d.mts +51 -13
- package/dist/index.d.ts +51 -13
- package/dist/index.js +357 -225
- package/dist/index.mjs +262 -130
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -596,9 +596,38 @@ function useResponsivePlaceholder(desktop, mobile) {
|
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// src/how-to-clip.tsx
|
|
599
|
-
var
|
|
599
|
+
var import_react6 = require("react");
|
|
600
600
|
var import_lucide_react2 = require("lucide-react");
|
|
601
601
|
|
|
602
|
+
// src/lib/use-in-view.ts
|
|
603
|
+
var import_react5 = require("react");
|
|
604
|
+
function useInView(el, { enabled = true, threshold = 0 } = {}) {
|
|
605
|
+
const [seen, setSeen] = (0, import_react5.useState)(null);
|
|
606
|
+
(0, import_react5.useEffect)(() => {
|
|
607
|
+
if (!enabled || !el) return;
|
|
608
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
609
|
+
setSeen({ el, threshold });
|
|
610
|
+
return () => setSeen(null);
|
|
611
|
+
}
|
|
612
|
+
let active = true;
|
|
613
|
+
const io = new IntersectionObserver(
|
|
614
|
+
(entries) => {
|
|
615
|
+
if (!active) return;
|
|
616
|
+
const entry = entries[entries.length - 1];
|
|
617
|
+
if (entry) setSeen(entry.isIntersecting && entry.intersectionRatio >= threshold ? { el, threshold } : null);
|
|
618
|
+
},
|
|
619
|
+
{ threshold }
|
|
620
|
+
);
|
|
621
|
+
io.observe(el);
|
|
622
|
+
return () => {
|
|
623
|
+
active = false;
|
|
624
|
+
io.disconnect();
|
|
625
|
+
setSeen(null);
|
|
626
|
+
};
|
|
627
|
+
}, [el, enabled, threshold]);
|
|
628
|
+
return enabled && el !== null && seen?.el === el && seen.threshold === threshold;
|
|
629
|
+
}
|
|
630
|
+
|
|
602
631
|
// src/use-prefers-reduced-motion.ts
|
|
603
632
|
var REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
|
|
604
633
|
function usePrefersReducedMotion() {
|
|
@@ -611,23 +640,47 @@ function prefersReducedMotionNow() {
|
|
|
611
640
|
// src/how-to-clip.tsx
|
|
612
641
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
613
642
|
var SAFE_SLUG = /^[a-z0-9-]{1,64}$/;
|
|
614
|
-
|
|
643
|
+
var VISIBLE_THRESHOLD = 0.25;
|
|
644
|
+
function HowToClip({
|
|
645
|
+
slug,
|
|
646
|
+
label,
|
|
647
|
+
clipBaseUrl,
|
|
648
|
+
fit = "contain",
|
|
649
|
+
playWhenVisible = false,
|
|
650
|
+
overlay,
|
|
651
|
+
posterOnly = false,
|
|
652
|
+
className
|
|
653
|
+
}) {
|
|
615
654
|
const reduceMotion = usePrefersReducedMotion();
|
|
616
|
-
const [autoplayRefused, setAutoplayRefused] = (0,
|
|
617
|
-
const [paused, setPaused] = (0,
|
|
618
|
-
const userPausedStem = (0,
|
|
619
|
-
const attempt = (0,
|
|
620
|
-
const ref = (0,
|
|
655
|
+
const [autoplayRefused, setAutoplayRefused] = (0, import_react6.useState)(false);
|
|
656
|
+
const [paused, setPaused] = (0, import_react6.useState)(true);
|
|
657
|
+
const userPausedStem = (0, import_react6.useRef)(null);
|
|
658
|
+
const attempt = (0, import_react6.useRef)(0);
|
|
659
|
+
const ref = (0, import_react6.useRef)(null);
|
|
660
|
+
const [frame, setFrame] = (0, import_react6.useState)(null);
|
|
621
661
|
const base = clipBaseUrl?.trim();
|
|
622
662
|
const stem = base && SAFE_SLUG.test(slug) ? `${base.replace(/\/+$/, "")}/${slug}` : null;
|
|
623
|
-
|
|
663
|
+
const gated = playWhenVisible && !posterOnly && !!stem;
|
|
664
|
+
const inView = useInView(frame, { enabled: gated, threshold: VISIBLE_THRESHOLD });
|
|
665
|
+
const [attachedStem, setAttachedStem] = (0, import_react6.useState)(null);
|
|
666
|
+
if (gated && inView && attachedStem !== stem) setAttachedStem(stem);
|
|
667
|
+
const attached = !gated || attachedStem === stem;
|
|
668
|
+
const live = !gated || inView;
|
|
669
|
+
const videoKey = posterOnly ? null : stem;
|
|
670
|
+
const [pausedFor, setPausedFor] = (0, import_react6.useState)(videoKey);
|
|
671
|
+
if (pausedFor !== videoKey) {
|
|
672
|
+
setPausedFor(videoKey);
|
|
673
|
+
setPaused(true);
|
|
674
|
+
}
|
|
675
|
+
(0, import_react6.useEffect)(() => {
|
|
624
676
|
if (userPausedStem.current !== stem) userPausedStem.current = null;
|
|
625
|
-
if (!stem ||
|
|
677
|
+
if (!stem || posterOnly || !live) return;
|
|
626
678
|
const video = ref.current;
|
|
627
679
|
if (!video) return;
|
|
628
680
|
const id = ++attempt.current;
|
|
629
681
|
const latest = () => attempt.current === id;
|
|
630
|
-
|
|
682
|
+
const motionOk = !reduceMotion && !prefersReducedMotionNow();
|
|
683
|
+
if (motionOk && userPausedStem.current === null) {
|
|
631
684
|
const playing = typeof video.play === "function" ? video.play() : void 0;
|
|
632
685
|
if (playing) {
|
|
633
686
|
playing.then(
|
|
@@ -645,9 +698,19 @@ function HowToClip({ slug, label, clipBaseUrl, className }) {
|
|
|
645
698
|
attempt.current += 1;
|
|
646
699
|
video.pause();
|
|
647
700
|
};
|
|
648
|
-
}, [reduceMotion, stem]);
|
|
701
|
+
}, [reduceMotion, stem, live, posterOnly]);
|
|
649
702
|
if (!stem) return null;
|
|
650
|
-
const
|
|
703
|
+
const fitClass = fit === "cover" ? "object-cover" : "object-contain";
|
|
704
|
+
const frameClass = "aspect-video w-full rounded-lg border border-border bg-muted";
|
|
705
|
+
const overlayLayer = overlay == null ? null : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { "data-how-to-clip-overlay": "", className: "pointer-events-none absolute inset-0 overflow-hidden rounded-lg", children: overlay });
|
|
706
|
+
if (posterOnly) {
|
|
707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative", children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("img", { src: `${stem}-poster.jpg`, alt: label, className: cn(frameClass, fitClass, className) }),
|
|
709
|
+
overlayLayer
|
|
710
|
+
] });
|
|
711
|
+
}
|
|
712
|
+
const controls = autoplayRefused && live;
|
|
713
|
+
const showToggle = !autoplayRefused && live;
|
|
651
714
|
const toggle = () => {
|
|
652
715
|
const video = ref.current;
|
|
653
716
|
if (!video) return;
|
|
@@ -657,14 +720,14 @@ function HowToClip({ slug, label, clipBaseUrl, className }) {
|
|
|
657
720
|
else if (typeof video.play === "function") void video.play()?.catch(() => {
|
|
658
721
|
});
|
|
659
722
|
};
|
|
660
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative", children: [
|
|
661
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.
|
|
723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref: setFrame, className: "relative", children: [
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
662
725
|
"video",
|
|
663
726
|
{
|
|
664
727
|
ref,
|
|
665
728
|
"aria-label": label,
|
|
666
729
|
poster: `${stem}-poster.jpg`,
|
|
667
|
-
className: cn(
|
|
730
|
+
className: cn(frameClass, fitClass, className),
|
|
668
731
|
loop: true,
|
|
669
732
|
muted: true,
|
|
670
733
|
playsInline: true,
|
|
@@ -672,20 +735,21 @@ function HowToClip({ slug, label, clipBaseUrl, className }) {
|
|
|
672
735
|
controls,
|
|
673
736
|
onPlay: () => setPaused(false),
|
|
674
737
|
onPause: () => setPaused(true),
|
|
675
|
-
children: [
|
|
738
|
+
children: attached && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
676
739
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("source", { src: `${stem}.webm`, type: "video/webm" }),
|
|
677
740
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("source", { src: `${stem}.mp4`, type: "video/mp4" })
|
|
678
|
-
]
|
|
741
|
+
] })
|
|
679
742
|
},
|
|
680
743
|
stem
|
|
681
744
|
),
|
|
682
|
-
|
|
745
|
+
overlayLayer,
|
|
746
|
+
showToggle && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
683
747
|
"button",
|
|
684
748
|
{
|
|
685
749
|
type: "button",
|
|
686
750
|
onClick: toggle,
|
|
687
751
|
"aria-label": `${paused ? "Play" : "Pause"} clip: ${label}`,
|
|
688
|
-
className: "absolute right-2 bottom-2 inline-flex size-11 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-ring
|
|
752
|
+
className: "absolute right-2 bottom-2 inline-flex size-11 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
689
753
|
children: paused ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.Play, { "aria-hidden": true, className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react2.Pause, { "aria-hidden": true, className: "size-4" })
|
|
690
754
|
}
|
|
691
755
|
)
|
|
@@ -807,8 +871,8 @@ function InfoTip({ children, label = "More information", side = "top", align = "
|
|
|
807
871
|
}
|
|
808
872
|
|
|
809
873
|
// src/app-sidebar.tsx
|
|
810
|
-
var
|
|
811
|
-
var
|
|
874
|
+
var import_react11 = require("react");
|
|
875
|
+
var import_lucide_react4 = require("lucide-react");
|
|
812
876
|
|
|
813
877
|
// src/lib/resolve-icon.ts
|
|
814
878
|
var LucideIcons = __toESM(require("lucide-react"));
|
|
@@ -828,7 +892,7 @@ function resolveIcon(name) {
|
|
|
828
892
|
}
|
|
829
893
|
|
|
830
894
|
// src/lib/use-dismissable-disclosure.ts
|
|
831
|
-
var
|
|
895
|
+
var import_react7 = require("react");
|
|
832
896
|
function useDismissableDisclosure({
|
|
833
897
|
open,
|
|
834
898
|
onClose,
|
|
@@ -836,10 +900,10 @@ function useDismissableDisclosure({
|
|
|
836
900
|
triggerRef,
|
|
837
901
|
initialFocusRef
|
|
838
902
|
}) {
|
|
839
|
-
(0,
|
|
903
|
+
(0, import_react7.useEffect)(() => {
|
|
840
904
|
if (open) initialFocusRef?.current?.focus();
|
|
841
905
|
}, [open]);
|
|
842
|
-
(0,
|
|
906
|
+
(0, import_react7.useEffect)(() => {
|
|
843
907
|
if (!open) return;
|
|
844
908
|
const onKey = (e) => {
|
|
845
909
|
if (e.key === "Escape") {
|
|
@@ -873,7 +937,11 @@ var zGroupRungItem = import_zod.z.object({
|
|
|
873
937
|
id: import_zod.z.string().min(1),
|
|
874
938
|
label: import_zod.z.string().min(1),
|
|
875
939
|
icon: import_zod.z.string().min(1),
|
|
876
|
-
children: import_zod.z.array(import_zod.z.string().min(1)).min(1)
|
|
940
|
+
children: import_zod.z.array(import_zod.z.string().min(1)).min(1),
|
|
941
|
+
// An app path only: agent-authored JSON must not point a sidebar row at
|
|
942
|
+
// another origin. Browsers read a backslash as "/" and drop tabs and
|
|
943
|
+
// newlines, so "/\x" and "/<tab>/x" would both become "//x".
|
|
944
|
+
href: import_zod.z.string().regex(/^\/(?!\/)[^\s\\\u0000-\u001f\u007f]*$/, 'group href must be an app path: one leading "/", no backslash, whitespace or control characters').optional()
|
|
877
945
|
});
|
|
878
946
|
var zRungItem = import_zod.z.discriminatedUnion("type", [zAppRungItem, zGroupRungItem]);
|
|
879
947
|
var zSidebarRungShape = import_zod.z.object({
|
|
@@ -1042,16 +1110,16 @@ function resolveLadder(raw, registry, groupOrder) {
|
|
|
1042
1110
|
}
|
|
1043
1111
|
|
|
1044
1112
|
// src/ladder/use-ladder-rung.ts
|
|
1045
|
-
var
|
|
1113
|
+
var import_react8 = require("react");
|
|
1046
1114
|
var DEFAULT_ROW_HEIGHT = 36;
|
|
1047
1115
|
var DEFAULT_HYSTERESIS_ROWS = 1;
|
|
1048
1116
|
function useLadderRung(ladder, containerRef, options = {}) {
|
|
1049
1117
|
const rowHeight = options.rowHeight ?? DEFAULT_ROW_HEIGHT;
|
|
1050
1118
|
const hysteresisRows = options.hysteresisRows ?? DEFAULT_HYSTERESIS_ROWS;
|
|
1051
|
-
const [rungIndex, setRungIndex] = (0,
|
|
1052
|
-
const rungIndexRef = (0,
|
|
1119
|
+
const [rungIndex, setRungIndex] = (0, import_react8.useState)(0);
|
|
1120
|
+
const rungIndexRef = (0, import_react8.useRef)(0);
|
|
1053
1121
|
const ladderSignature = `${ladder.version}:${ladder.rungs.map((r2) => r2.rows).join(",")}`;
|
|
1054
|
-
(0,
|
|
1122
|
+
(0, import_react8.useLayoutEffect)(() => {
|
|
1055
1123
|
rungIndexRef.current = 0;
|
|
1056
1124
|
setRungIndex(0);
|
|
1057
1125
|
const node = containerRef.current;
|
|
@@ -1087,7 +1155,7 @@ function useLadderRung(ladder, containerRef, options = {}) {
|
|
|
1087
1155
|
}
|
|
1088
1156
|
|
|
1089
1157
|
// src/app-sidebar-recent-fit.ts
|
|
1090
|
-
var
|
|
1158
|
+
var import_react9 = require("react");
|
|
1091
1159
|
function fitRecentRows(m, count, showsMore) {
|
|
1092
1160
|
const budget = m.shared - m.navReserve;
|
|
1093
1161
|
for (let n = count; n > 1; n--) {
|
|
@@ -1097,10 +1165,10 @@ function fitRecentRows(m, count, showsMore) {
|
|
|
1097
1165
|
return Math.min(1, count);
|
|
1098
1166
|
}
|
|
1099
1167
|
function useRecentFit(sectionRef, navRef, { active, count, total, moreLink, hasMore, navReserveRows, rowHeight }) {
|
|
1100
|
-
const [fit, setFit] = (0,
|
|
1101
|
-
const moreHeightRef = (0,
|
|
1102
|
-
const gapRef = (0,
|
|
1103
|
-
(0,
|
|
1168
|
+
const [fit, setFit] = (0, import_react9.useState)(null);
|
|
1169
|
+
const moreHeightRef = (0, import_react9.useRef)(null);
|
|
1170
|
+
const gapRef = (0, import_react9.useRef)(null);
|
|
1171
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
1104
1172
|
const section = sectionRef.current;
|
|
1105
1173
|
const nav = navRef.current;
|
|
1106
1174
|
if (!active || !section || !nav) return;
|
|
@@ -1144,17 +1212,21 @@ function useRecentFit(sectionRef, navRef, { active, count, total, moreLink, hasM
|
|
|
1144
1212
|
}
|
|
1145
1213
|
|
|
1146
1214
|
// src/ladder/flyout.tsx
|
|
1147
|
-
var
|
|
1215
|
+
var import_react10 = require("react");
|
|
1216
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1148
1217
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1149
1218
|
var PANEL_GAP = 4;
|
|
1150
1219
|
var HOVER_CLOSE_DELAY_MS = 300;
|
|
1151
1220
|
var HOVER_SLOP = 16;
|
|
1152
1221
|
var HOVER_SWITCH_DELAY_MS = 150;
|
|
1222
|
+
var GROUP_LINK_KEY = "\0group-href";
|
|
1153
1223
|
function Flyout({
|
|
1154
1224
|
label,
|
|
1155
1225
|
icon,
|
|
1156
1226
|
active,
|
|
1157
1227
|
children,
|
|
1228
|
+
href,
|
|
1229
|
+
hrefActive = false,
|
|
1158
1230
|
linkComponent,
|
|
1159
1231
|
collapsed = false,
|
|
1160
1232
|
onOpenChange,
|
|
@@ -1162,25 +1234,25 @@ function Flyout({
|
|
|
1162
1234
|
hoverOpenDelayMs = 0,
|
|
1163
1235
|
className
|
|
1164
1236
|
}) {
|
|
1165
|
-
const [hoverOpen, setHoverOpen] = (0,
|
|
1166
|
-
const [clickOpen, setClickOpen] = (0,
|
|
1167
|
-
const [panelPosition, setPanelPosition] = (0,
|
|
1237
|
+
const [hoverOpen, setHoverOpen] = (0, import_react10.useState)(false);
|
|
1238
|
+
const [clickOpen, setClickOpen] = (0, import_react10.useState)(false);
|
|
1239
|
+
const [panelPosition, setPanelPosition] = (0, import_react10.useState)(null);
|
|
1168
1240
|
const wantsOpen = hoverOpen || clickOpen;
|
|
1169
1241
|
const open = wantsOpen && !forceClosed;
|
|
1170
|
-
const panelId = (0,
|
|
1171
|
-
const triggerRef = (0,
|
|
1172
|
-
const panelRef = (0,
|
|
1173
|
-
const firstItemRef = (0,
|
|
1174
|
-
const closeTimer = (0,
|
|
1175
|
-
const openTimer = (0,
|
|
1242
|
+
const panelId = (0, import_react10.useId)();
|
|
1243
|
+
const triggerRef = (0, import_react10.useRef)(null);
|
|
1244
|
+
const panelRef = (0, import_react10.useRef)(null);
|
|
1245
|
+
const firstItemRef = (0, import_react10.useRef)(null);
|
|
1246
|
+
const closeTimer = (0, import_react10.useRef)(null);
|
|
1247
|
+
const openTimer = (0, import_react10.useRef)(null);
|
|
1176
1248
|
const prefersReducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
1177
1249
|
const Icon = resolveIcon(icon);
|
|
1178
1250
|
const LinkEl = linkComponent ?? "a";
|
|
1179
|
-
const cancelOpen = (0,
|
|
1251
|
+
const cancelOpen = (0, import_react10.useCallback)(() => {
|
|
1180
1252
|
if (openTimer.current) clearTimeout(openTimer.current);
|
|
1181
1253
|
openTimer.current = null;
|
|
1182
1254
|
}, []);
|
|
1183
|
-
const cancelClose = (0,
|
|
1255
|
+
const cancelClose = (0, import_react10.useCallback)(() => {
|
|
1184
1256
|
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
1185
1257
|
closeTimer.current = null;
|
|
1186
1258
|
cancelOpen();
|
|
@@ -1203,27 +1275,27 @@ function Flyout({
|
|
|
1203
1275
|
setHoverOpen(false);
|
|
1204
1276
|
}, HOVER_CLOSE_DELAY_MS);
|
|
1205
1277
|
};
|
|
1206
|
-
(0,
|
|
1207
|
-
const reposition = (0,
|
|
1278
|
+
(0, import_react10.useEffect)(() => cancelClose, [cancelClose]);
|
|
1279
|
+
const reposition = (0, import_react10.useCallback)(() => {
|
|
1208
1280
|
const rect = triggerRef.current?.getBoundingClientRect();
|
|
1209
1281
|
if (rect) setPanelPosition({ top: rect.top, left: rect.right + PANEL_GAP });
|
|
1210
1282
|
}, []);
|
|
1211
|
-
const onOpenChangeRef = (0,
|
|
1283
|
+
const onOpenChangeRef = (0, import_react10.useRef)(onOpenChange);
|
|
1212
1284
|
onOpenChangeRef.current = onOpenChange;
|
|
1213
|
-
(0,
|
|
1285
|
+
(0, import_react10.useEffect)(() => {
|
|
1214
1286
|
onOpenChangeRef.current?.(wantsOpen);
|
|
1215
1287
|
}, [wantsOpen]);
|
|
1216
|
-
(0,
|
|
1288
|
+
(0, import_react10.useEffect)(() => {
|
|
1217
1289
|
if (forceClosed) {
|
|
1218
1290
|
cancelClose();
|
|
1219
1291
|
setHoverOpen(false);
|
|
1220
1292
|
setClickOpen(false);
|
|
1221
1293
|
}
|
|
1222
1294
|
}, [forceClosed, cancelClose]);
|
|
1223
|
-
(0,
|
|
1295
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
1224
1296
|
if (open) reposition();
|
|
1225
1297
|
}, [open, reposition]);
|
|
1226
|
-
(0,
|
|
1298
|
+
(0, import_react10.useEffect)(() => {
|
|
1227
1299
|
if (!open) return;
|
|
1228
1300
|
window.addEventListener("resize", reposition);
|
|
1229
1301
|
window.addEventListener("scroll", reposition, true);
|
|
@@ -1242,9 +1314,32 @@ function Flyout({
|
|
|
1242
1314
|
panelRef,
|
|
1243
1315
|
triggerRef
|
|
1244
1316
|
});
|
|
1245
|
-
(0,
|
|
1317
|
+
(0, import_react10.useEffect)(() => {
|
|
1246
1318
|
if (clickOpen && panelPosition) firstItemRef.current?.focus();
|
|
1247
1319
|
}, [clickOpen, panelPosition]);
|
|
1320
|
+
const toggleClickOpen = () => {
|
|
1321
|
+
cancelOpen();
|
|
1322
|
+
setClickOpen((v) => !v);
|
|
1323
|
+
};
|
|
1324
|
+
const closeOnNavigate = () => {
|
|
1325
|
+
cancelClose();
|
|
1326
|
+
setHoverOpen(false);
|
|
1327
|
+
setClickOpen(false);
|
|
1328
|
+
};
|
|
1329
|
+
const splitRow = href !== void 0 && !collapsed;
|
|
1330
|
+
const panelRows = href !== void 0 && collapsed ? [{ moduleId: GROUP_LINK_KEY, label, href, active: hrefActive }, ...children] : children;
|
|
1331
|
+
const rowStateClass2 = active ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-foreground/70 hover:bg-sidebar-foreground/5 hover:text-sidebar-foreground";
|
|
1332
|
+
const iconAndLabel = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1333
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1334
|
+
Icon,
|
|
1335
|
+
{
|
|
1336
|
+
className: cn("size-4 shrink-0", active ? "text-sidebar-accent-foreground" : "text-sidebar-foreground/70"),
|
|
1337
|
+
strokeWidth: 1.5,
|
|
1338
|
+
"aria-hidden": "true"
|
|
1339
|
+
}
|
|
1340
|
+
),
|
|
1341
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("truncate", collapsed && "sr-only"), children: label })
|
|
1342
|
+
] });
|
|
1248
1343
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1249
1344
|
"div",
|
|
1250
1345
|
{
|
|
@@ -1253,7 +1348,7 @@ function Flyout({
|
|
|
1253
1348
|
onMouseEnter: hoverEnter,
|
|
1254
1349
|
onMouseLeave: hoverLeave,
|
|
1255
1350
|
children: [
|
|
1256
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.
|
|
1351
|
+
!splitRow ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1257
1352
|
"button",
|
|
1258
1353
|
{
|
|
1259
1354
|
ref: triggerRef,
|
|
@@ -1262,37 +1357,52 @@ function Flyout({
|
|
|
1262
1357
|
"aria-expanded": open,
|
|
1263
1358
|
"aria-controls": panelId,
|
|
1264
1359
|
title: collapsed ? label : void 0,
|
|
1265
|
-
onClick:
|
|
1266
|
-
cancelOpen();
|
|
1267
|
-
setClickOpen((v) => !v);
|
|
1268
|
-
},
|
|
1360
|
+
onClick: toggleClickOpen,
|
|
1269
1361
|
className: cn(
|
|
1270
1362
|
"group flex w-full items-center gap-2.5 rounded-md px-3 py-1.5 text-sm transition-colors",
|
|
1271
1363
|
collapsed && "justify-center px-0",
|
|
1272
|
-
|
|
1273
|
-
// `<nav>` (a `bg-sidebar` surface that stays dark navy in both
|
|
1274
|
-
// themes) — same fix as NavLink, same measured ratios (default
|
|
1275
|
-
// 8.05:1, hover 13.65:1, active 10.95:1). The flyout PANEL below
|
|
1276
|
-
// is intentionally left on document tokens: it renders via
|
|
1277
|
-
// `position: fixed`, floating over the main content area on
|
|
1278
|
-
// `bg-background`, not over the sidebar.
|
|
1279
|
-
active ? "bg-sidebar-accent text-sidebar-accent-foreground" : "text-sidebar-foreground/70 hover:bg-sidebar-foreground/5 hover:text-sidebar-foreground"
|
|
1364
|
+
rowStateClass2
|
|
1280
1365
|
),
|
|
1281
|
-
children:
|
|
1282
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1283
|
-
Icon,
|
|
1284
|
-
{
|
|
1285
|
-
className: cn(
|
|
1286
|
-
"size-4 shrink-0",
|
|
1287
|
-
active ? "text-sidebar-accent-foreground" : "text-sidebar-foreground/70"
|
|
1288
|
-
),
|
|
1289
|
-
strokeWidth: 1.5,
|
|
1290
|
-
"aria-hidden": "true"
|
|
1291
|
-
}
|
|
1292
|
-
),
|
|
1293
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: cn("truncate", collapsed && "sr-only"), children: label })
|
|
1294
|
-
]
|
|
1366
|
+
children: iconAndLabel
|
|
1295
1367
|
}
|
|
1368
|
+
) : (
|
|
1369
|
+
// DEV-19583: one row, two controls. The link navigates; the chevron
|
|
1370
|
+
// is the disclosure, and stays `triggerRef` so Esc returns focus to
|
|
1371
|
+
// it and the panel anchors to the row's right edge as before.
|
|
1372
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1373
|
+
"div",
|
|
1374
|
+
{
|
|
1375
|
+
"data-testid": "ladder-flyout-row",
|
|
1376
|
+
className: cn("group flex w-full items-stretch rounded-md text-sm transition-colors", rowStateClass2),
|
|
1377
|
+
children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1379
|
+
LinkEl,
|
|
1380
|
+
{
|
|
1381
|
+
href,
|
|
1382
|
+
"data-testid": "ladder-flyout-link",
|
|
1383
|
+
"aria-current": hrefActive ? "page" : void 0,
|
|
1384
|
+
onClick: closeOnNavigate,
|
|
1385
|
+
className: "flex min-w-0 flex-1 items-center gap-2.5 rounded-md px-3 py-1.5",
|
|
1386
|
+
children: iconAndLabel
|
|
1387
|
+
}
|
|
1388
|
+
),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1390
|
+
"button",
|
|
1391
|
+
{
|
|
1392
|
+
ref: triggerRef,
|
|
1393
|
+
type: "button",
|
|
1394
|
+
"data-testid": "ladder-flyout-trigger",
|
|
1395
|
+
"aria-expanded": open,
|
|
1396
|
+
"aria-controls": panelId,
|
|
1397
|
+
"aria-label": `${label} pages`,
|
|
1398
|
+
onClick: toggleClickOpen,
|
|
1399
|
+
className: "flex shrink-0 items-center justify-center rounded-md px-2",
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.ChevronRight, { className: "size-3.5", strokeWidth: 1.5, "aria-hidden": "true" })
|
|
1401
|
+
}
|
|
1402
|
+
)
|
|
1403
|
+
]
|
|
1404
|
+
}
|
|
1405
|
+
)
|
|
1296
1406
|
),
|
|
1297
1407
|
open && panelPosition && // DEV-13848 hit area: a DOM child of the wrapper above, so the pointer
|
|
1298
1408
|
// moving through it never fires the wrapper's mouseleave. Starts at
|
|
@@ -1320,7 +1430,7 @@ function Flyout({
|
|
|
1320
1430
|
"flex min-w-[12rem] flex-col gap-0.5 rounded-md border border-border bg-background p-2 shadow-lg",
|
|
1321
1431
|
!prefersReducedMotion && "transition-all duration-150 ease-out"
|
|
1322
1432
|
),
|
|
1323
|
-
children:
|
|
1433
|
+
children: panelRows.map((child, i) => (
|
|
1324
1434
|
// `ref` on the first row (DEV-4391): the "focus moves into the
|
|
1325
1435
|
// panel on click open" behavior above needs a real
|
|
1326
1436
|
// HTMLAnchorElement here. A custom `linkComponent` must forward
|
|
@@ -1337,6 +1447,7 @@ function Flyout({
|
|
|
1337
1447
|
ref: i === 0 ? firstItemRef : void 0,
|
|
1338
1448
|
href: child.href,
|
|
1339
1449
|
"aria-current": child.active ? "page" : void 0,
|
|
1450
|
+
onClick: child.moduleId === GROUP_LINK_KEY ? closeOnNavigate : void 0,
|
|
1340
1451
|
style: TOUCH_TARGET_STYLE,
|
|
1341
1452
|
className: cn(
|
|
1342
1453
|
"flex items-center truncate rounded-md px-3 py-1.5 text-sm transition-colors",
|
|
@@ -1434,21 +1545,21 @@ function AppSidebar({
|
|
|
1434
1545
|
const isActiveFn = isActive ?? isHrefActive;
|
|
1435
1546
|
const isDesktop = useMediaQuery(`(min-width: ${BREAKPOINTS.md}px)`);
|
|
1436
1547
|
const prefersReducedMotion = useMediaQuery("(prefers-reduced-motion: reduce)");
|
|
1437
|
-
const [mobileOpen, setMobileOpen] = (0,
|
|
1438
|
-
const containerRef = (0,
|
|
1439
|
-
const drawerId = (0,
|
|
1440
|
-
const recentHeadingId = (0,
|
|
1441
|
-
const mobileTriggerRef = (0,
|
|
1442
|
-
const mobileDrawerRef = (0,
|
|
1443
|
-
const mobileCloseRef = (0,
|
|
1444
|
-
const [collapsed, setCollapsed] = (0,
|
|
1445
|
-
const [collapseHydrated, setCollapseHydrated] = (0,
|
|
1446
|
-
const collapsedRef = (0,
|
|
1548
|
+
const [mobileOpen, setMobileOpen] = (0, import_react11.useState)(false);
|
|
1549
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
1550
|
+
const drawerId = (0, import_react11.useId)();
|
|
1551
|
+
const recentHeadingId = (0, import_react11.useId)();
|
|
1552
|
+
const mobileTriggerRef = (0, import_react11.useRef)(null);
|
|
1553
|
+
const mobileDrawerRef = (0, import_react11.useRef)(null);
|
|
1554
|
+
const mobileCloseRef = (0, import_react11.useRef)(null);
|
|
1555
|
+
const [collapsed, setCollapsed] = (0, import_react11.useState)(defaultCollapsed);
|
|
1556
|
+
const [collapseHydrated, setCollapseHydrated] = (0, import_react11.useState)(false);
|
|
1557
|
+
const collapsedRef = (0, import_react11.useRef)(defaultCollapsed);
|
|
1447
1558
|
function applyCollapsed(next) {
|
|
1448
1559
|
collapsedRef.current = next;
|
|
1449
1560
|
setCollapsed(next);
|
|
1450
1561
|
}
|
|
1451
|
-
(0,
|
|
1562
|
+
(0, import_react11.useEffect)(() => {
|
|
1452
1563
|
if (!collapsible) return;
|
|
1453
1564
|
try {
|
|
1454
1565
|
const stored = localStorage.getItem(storageKey);
|
|
@@ -1458,7 +1569,7 @@ function AppSidebar({
|
|
|
1458
1569
|
}
|
|
1459
1570
|
setCollapseHydrated(true);
|
|
1460
1571
|
}, []);
|
|
1461
|
-
(0,
|
|
1572
|
+
(0, import_react11.useEffect)(() => {
|
|
1462
1573
|
if (!collapsible || !collapseHydrated) return;
|
|
1463
1574
|
try {
|
|
1464
1575
|
localStorage.setItem(storageKey, String(collapsed));
|
|
@@ -1470,25 +1581,25 @@ function AppSidebar({
|
|
|
1470
1581
|
applyCollapsed(next);
|
|
1471
1582
|
onCollapsedChange?.(next);
|
|
1472
1583
|
}
|
|
1473
|
-
const [openFlyoutId, setOpenFlyoutId] = (0,
|
|
1474
|
-
const handleFlyoutOpenChange = (0,
|
|
1584
|
+
const [openFlyoutId, setOpenFlyoutId] = (0, import_react11.useState)(null);
|
|
1585
|
+
const handleFlyoutOpenChange = (0, import_react11.useCallback)((id, isOpen) => {
|
|
1475
1586
|
setOpenFlyoutId((current) => {
|
|
1476
1587
|
if (isOpen) return id;
|
|
1477
1588
|
return current === id ? null : current;
|
|
1478
1589
|
});
|
|
1479
1590
|
}, []);
|
|
1480
|
-
const moduleMap = (0,
|
|
1481
|
-
const registryForLadder = (0,
|
|
1591
|
+
const moduleMap = (0, import_react11.useMemo)(() => new Map(modules.map((m) => [m.moduleId, m])), [modules]);
|
|
1592
|
+
const registryForLadder = (0, import_react11.useMemo)(
|
|
1482
1593
|
() => modules.map((m) => ({ moduleId: m.moduleId, group: m.group })),
|
|
1483
1594
|
[modules]
|
|
1484
1595
|
);
|
|
1485
|
-
const resolvedLadder = (0,
|
|
1596
|
+
const resolvedLadder = (0, import_react11.useMemo)(
|
|
1486
1597
|
() => resolveLadder(ladder, registryForLadder, groupOrder),
|
|
1487
1598
|
[ladder, registryForLadder, groupOrder]
|
|
1488
1599
|
);
|
|
1489
1600
|
const rung = useLadderRung(resolvedLadder, containerRef, ladderOptions);
|
|
1490
1601
|
const rung0 = resolvedLadder.rungs[0];
|
|
1491
|
-
const recentRef = (0,
|
|
1602
|
+
const recentRef = (0, import_react11.useRef)(null);
|
|
1492
1603
|
const recentNavReserveRows = (resolvedLadder.rungs.find((r2) => r2.rows <= RECENT_NAV_RESERVE_MAX_ROWS) ?? resolvedLadder.rungs[resolvedLadder.rungs.length - 1]).rows;
|
|
1493
1604
|
const ladderFolded = rung.rows < recentNavReserveRows;
|
|
1494
1605
|
const recentFit = useRecentFit(recentRef, containerRef, {
|
|
@@ -1500,8 +1611,8 @@ function AppSidebar({
|
|
|
1500
1611
|
navReserveRows: recentNavReserveRows + (ladderFolded ? ladderOptions?.hysteresisRows ?? DEFAULT_HYSTERESIS_ROWS : 0),
|
|
1501
1612
|
rowHeight: ladderOptions?.rowHeight ?? DEFAULT_ROW_HEIGHT
|
|
1502
1613
|
});
|
|
1503
|
-
const recentFocusIdRef = (0,
|
|
1504
|
-
(0,
|
|
1614
|
+
const recentFocusIdRef = (0, import_react11.useRef)(null);
|
|
1615
|
+
(0, import_react11.useEffect)(() => {
|
|
1505
1616
|
const id = recentFocusIdRef.current;
|
|
1506
1617
|
if (id === null) return;
|
|
1507
1618
|
const root = recentRef.current;
|
|
@@ -1514,7 +1625,7 @@ function AppSidebar({
|
|
|
1514
1625
|
const target = id === RECENT_MORE_TEST_ID ? rows[rows.length - 1] : root.querySelector(`[data-testid="${RECENT_MORE_TEST_ID}"]`);
|
|
1515
1626
|
target?.focus();
|
|
1516
1627
|
}, [recentFit, recent]);
|
|
1517
|
-
(0,
|
|
1628
|
+
(0, import_react11.useEffect)(() => {
|
|
1518
1629
|
if (isDesktop) setMobileOpen(false);
|
|
1519
1630
|
}, [isDesktop]);
|
|
1520
1631
|
useDismissableDisclosure({
|
|
@@ -1552,12 +1663,17 @@ function AppSidebar({
|
|
|
1552
1663
|
active: isActiveFn(href, activePath)
|
|
1553
1664
|
};
|
|
1554
1665
|
});
|
|
1555
|
-
const
|
|
1666
|
+
const groupPath = item.href?.split(/[?#]/)[0];
|
|
1667
|
+
const groupHrefActive = groupPath !== void 0 && isActiveFn(groupPath, activePath);
|
|
1668
|
+
const active = groupHrefActive || children.some((c) => c.active);
|
|
1669
|
+
const hrefActive = groupHrefActive && activePath === groupPath;
|
|
1556
1670
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1557
1671
|
Flyout,
|
|
1558
1672
|
{
|
|
1559
1673
|
label: item.label,
|
|
1560
1674
|
icon: item.icon,
|
|
1675
|
+
href: item.href,
|
|
1676
|
+
hrefActive,
|
|
1561
1677
|
active,
|
|
1562
1678
|
linkComponent,
|
|
1563
1679
|
collapsed: collapsedRow,
|
|
@@ -1648,7 +1764,23 @@ function AppSidebar({
|
|
|
1648
1764
|
"aria-labelledby": headingId,
|
|
1649
1765
|
className: "flex shrink-0 flex-col px-3 pt-4",
|
|
1650
1766
|
children: [
|
|
1651
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: headingId, className: "shrink-0 px-3 pb-1 text-xs font-medium text-sidebar-foreground/60", children: recent.label ?? "Recent" })
|
|
1767
|
+
recent.href === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { id: headingId, className: "shrink-0 px-3 pb-1 text-xs font-medium text-sidebar-foreground/60", children: recent.label ?? "Recent" }) : (
|
|
1768
|
+
// DEV-19583: same box as the <p> (block, same padding), so the
|
|
1769
|
+
// recent-fit row measurement doesn't move; the drawer, which is
|
|
1770
|
+
// not measured, gives it the touch floor like its rows.
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1772
|
+
LinkEl,
|
|
1773
|
+
{
|
|
1774
|
+
id: headingId,
|
|
1775
|
+
href: recent.href,
|
|
1776
|
+
"data-testid": `${testId}-heading`,
|
|
1777
|
+
style: rowStyle,
|
|
1778
|
+
onClick: onPicked,
|
|
1779
|
+
className: "block shrink-0 rounded-md px-3 pb-1 text-xs font-medium text-sidebar-foreground/60 transition-colors hover:text-sidebar-foreground",
|
|
1780
|
+
children: recent.label ?? "Recent"
|
|
1781
|
+
}
|
|
1782
|
+
)
|
|
1783
|
+
),
|
|
1652
1784
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1653
1785
|
"ul",
|
|
1654
1786
|
{
|
|
@@ -1703,7 +1835,7 @@ function AppSidebar({
|
|
|
1703
1835
|
onClick: () => setMobileOpen((v) => !v),
|
|
1704
1836
|
style: TOUCH_TARGET_STYLE,
|
|
1705
1837
|
className: "flex items-center justify-center rounded-md border border-border p-2 text-foreground",
|
|
1706
|
-
children: mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1838
|
+
children: mobileOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.X, { className: "h-5 w-5", "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.Menu, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
1707
1839
|
}
|
|
1708
1840
|
),
|
|
1709
1841
|
!isDesktop && mobileOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "fixed inset-0 z-50", children: [
|
|
@@ -1737,7 +1869,7 @@ function AppSidebar({
|
|
|
1737
1869
|
onClick: () => setMobileOpen(false),
|
|
1738
1870
|
style: TOUCH_TARGET_STYLE,
|
|
1739
1871
|
className: "flex items-center justify-center rounded-md p-2 text-sidebar-foreground/70 hover:bg-sidebar-foreground/5 hover:text-sidebar-foreground",
|
|
1740
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1872
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.X, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
1741
1873
|
}
|
|
1742
1874
|
) }),
|
|
1743
1875
|
brandBlockFor(false),
|
|
@@ -1791,7 +1923,7 @@ function AppSidebar({
|
|
|
1791
1923
|
collapsed && "justify-center px-0"
|
|
1792
1924
|
),
|
|
1793
1925
|
children: [
|
|
1794
|
-
collapsed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1926
|
+
collapsed ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.PanelLeftOpen, { className: "size-4 shrink-0", strokeWidth: 1.5, "aria-hidden": "true" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.PanelLeftClose, { className: "size-4 shrink-0", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
1795
1927
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("truncate", collapsed && "sr-only"), children: collapsed ? "Expand sidebar" : "Collapse sidebar" })
|
|
1796
1928
|
]
|
|
1797
1929
|
}
|
|
@@ -1803,7 +1935,7 @@ function AppSidebar({
|
|
|
1803
1935
|
}
|
|
1804
1936
|
|
|
1805
1937
|
// src/context-switcher.tsx
|
|
1806
|
-
var
|
|
1938
|
+
var import_lucide_react6 = require("lucide-react");
|
|
1807
1939
|
|
|
1808
1940
|
// src/lib/group-by-org.ts
|
|
1809
1941
|
function groupItemsByOrg(rows, get) {
|
|
@@ -1837,7 +1969,7 @@ function groupItemsByOrg(rows, get) {
|
|
|
1837
1969
|
var React = __toESM(require("react"));
|
|
1838
1970
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
1839
1971
|
var import_react_slot = require("@radix-ui/react-slot");
|
|
1840
|
-
var
|
|
1972
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1841
1973
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1842
1974
|
function DropdownMenu(props) {
|
|
1843
1975
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
@@ -1910,7 +2042,7 @@ var DropdownMenuSubTrigger = React.forwardRef(function DropdownMenuSubTrigger2({
|
|
|
1910
2042
|
...props,
|
|
1911
2043
|
children: [
|
|
1912
2044
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_slot.Slottable, { children }),
|
|
1913
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.ChevronRight, { className: "ml-auto size-4 text-muted-foreground", "aria-hidden": "true" })
|
|
1914
2046
|
]
|
|
1915
2047
|
}
|
|
1916
2048
|
);
|
|
@@ -2061,7 +2193,7 @@ function ContextSwitcher({
|
|
|
2061
2193
|
children: active?.name || placeholder2
|
|
2062
2194
|
}
|
|
2063
2195
|
),
|
|
2064
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.ChevronDown, { className: "h-3.5 w-3.5 shrink-0 text-sidebar-foreground/70 transition-transform group-data-[state=open]:rotate-180" })
|
|
2065
2197
|
]
|
|
2066
2198
|
}
|
|
2067
2199
|
) }),
|
|
@@ -2133,7 +2265,7 @@ function ContextSwitcher({
|
|
|
2133
2265
|
}
|
|
2134
2266
|
)
|
|
2135
2267
|
] }),
|
|
2136
|
-
isActive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2268
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.Check, { className: "size-3.5 text-emerald-500" })
|
|
2137
2269
|
]
|
|
2138
2270
|
},
|
|
2139
2271
|
item.refId
|
|
@@ -2148,7 +2280,7 @@ function ContextSwitcher({
|
|
|
2148
2280
|
}
|
|
2149
2281
|
|
|
2150
2282
|
// src/connector-picker.tsx
|
|
2151
|
-
var
|
|
2283
|
+
var import_react12 = require("react");
|
|
2152
2284
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2153
2285
|
function accessLabel(access) {
|
|
2154
2286
|
return access === "read" ? "Read" : "Read + write";
|
|
@@ -2212,24 +2344,24 @@ function ConnectorPicker({
|
|
|
2212
2344
|
clipBaseUrl
|
|
2213
2345
|
}) {
|
|
2214
2346
|
const gated = lens !== "owner";
|
|
2215
|
-
const [entries, setEntries] = (0,
|
|
2216
|
-
const [loadError, setLoadError] = (0,
|
|
2217
|
-
const [uiState, setUiState] = (0,
|
|
2218
|
-
const reconnectingRef = (0,
|
|
2219
|
-
const reconnectChecksRef = (0,
|
|
2220
|
-
const refreshInFlightRef = (0,
|
|
2347
|
+
const [entries, setEntries] = (0, import_react12.useState)(null);
|
|
2348
|
+
const [loadError, setLoadError] = (0, import_react12.useState)(null);
|
|
2349
|
+
const [uiState, setUiState] = (0, import_react12.useState)({});
|
|
2350
|
+
const reconnectingRef = (0, import_react12.useRef)(/* @__PURE__ */ new Set());
|
|
2351
|
+
const reconnectChecksRef = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
2352
|
+
const refreshInFlightRef = (0, import_react12.useRef)(false);
|
|
2221
2353
|
const grantsSupported = typeof client.listGrants === "function" && typeof client.grant === "function" && typeof client.revokeGrant === "function";
|
|
2222
2354
|
const credentialsSupported = typeof client.submitCredentials === "function";
|
|
2223
2355
|
const credentialTestSupported = typeof client.testCredentials === "function";
|
|
2224
|
-
const clientRef = (0,
|
|
2356
|
+
const clientRef = (0, import_react12.useRef)(client);
|
|
2225
2357
|
clientRef.current = client;
|
|
2226
|
-
const purposeRef = (0,
|
|
2358
|
+
const purposeRef = (0, import_react12.useRef)(purpose);
|
|
2227
2359
|
purposeRef.current = purpose;
|
|
2228
|
-
const onConnectedRef = (0,
|
|
2360
|
+
const onConnectedRef = (0, import_react12.useRef)(onConnected);
|
|
2229
2361
|
onConnectedRef.current = onConnected;
|
|
2230
|
-
const uiStateRef = (0,
|
|
2362
|
+
const uiStateRef = (0, import_react12.useRef)(uiState);
|
|
2231
2363
|
uiStateRef.current = uiState;
|
|
2232
|
-
const load = (0,
|
|
2364
|
+
const load = (0, import_react12.useCallback)(async () => {
|
|
2233
2365
|
if (gated) return null;
|
|
2234
2366
|
try {
|
|
2235
2367
|
const list = await clientRef.current.listConnectable({ purpose: purposeRef.current });
|
|
@@ -2241,11 +2373,11 @@ function ConnectorPicker({
|
|
|
2241
2373
|
return null;
|
|
2242
2374
|
}
|
|
2243
2375
|
}, [gated]);
|
|
2244
|
-
(0,
|
|
2376
|
+
(0, import_react12.useEffect)(() => {
|
|
2245
2377
|
if (gated) return;
|
|
2246
2378
|
void load();
|
|
2247
2379
|
}, [gated, load, purpose]);
|
|
2248
|
-
const refreshAfterReturn = (0,
|
|
2380
|
+
const refreshAfterReturn = (0, import_react12.useCallback)(async () => {
|
|
2249
2381
|
if (refreshInFlightRef.current) return;
|
|
2250
2382
|
refreshInFlightRef.current = true;
|
|
2251
2383
|
try {
|
|
@@ -2286,7 +2418,7 @@ function ConnectorPicker({
|
|
|
2286
2418
|
refreshInFlightRef.current = false;
|
|
2287
2419
|
}
|
|
2288
2420
|
}, [load]);
|
|
2289
|
-
(0,
|
|
2421
|
+
(0, import_react12.useEffect)(() => {
|
|
2290
2422
|
if (gated) return;
|
|
2291
2423
|
function handleReturn() {
|
|
2292
2424
|
if (document.visibilityState === "hidden") return;
|
|
@@ -2303,7 +2435,7 @@ function ConnectorPicker({
|
|
|
2303
2435
|
document.removeEventListener("visibilitychange", handleReturn);
|
|
2304
2436
|
};
|
|
2305
2437
|
}, [gated, refreshAfterReturn]);
|
|
2306
|
-
const handleConnect = (0,
|
|
2438
|
+
const handleConnect = (0, import_react12.useCallback)(
|
|
2307
2439
|
async (entry, kind, access) => {
|
|
2308
2440
|
if (isUnhealthy(entry)) {
|
|
2309
2441
|
reconnectingRef.current.add(entry.slug);
|
|
@@ -2342,7 +2474,7 @@ function ConnectorPicker({
|
|
|
2342
2474
|
},
|
|
2343
2475
|
[load]
|
|
2344
2476
|
);
|
|
2345
|
-
const handleSubmitCredentials = (0,
|
|
2477
|
+
const handleSubmitCredentials = (0, import_react12.useCallback)(
|
|
2346
2478
|
async (entry, values, kind) => {
|
|
2347
2479
|
setUiState((prev) => ({ ...prev, [entry.slug]: { kind: "connecting" } }));
|
|
2348
2480
|
try {
|
|
@@ -2370,11 +2502,11 @@ function ConnectorPicker({
|
|
|
2370
2502
|
},
|
|
2371
2503
|
[load]
|
|
2372
2504
|
);
|
|
2373
|
-
const testCredentials = (0,
|
|
2505
|
+
const testCredentials = (0, import_react12.useCallback)(
|
|
2374
2506
|
(entry, values) => clientRef.current.testCredentials?.(entry, values) ?? Promise.resolve({ valid: null }),
|
|
2375
2507
|
[]
|
|
2376
2508
|
);
|
|
2377
|
-
const handleDisconnect = (0,
|
|
2509
|
+
const handleDisconnect = (0, import_react12.useCallback)(
|
|
2378
2510
|
async (entry) => {
|
|
2379
2511
|
setUiState((prev) => ({ ...prev, [entry.slug]: { kind: "disconnecting" } }));
|
|
2380
2512
|
try {
|
|
@@ -2392,15 +2524,15 @@ function ConnectorPicker({
|
|
|
2392
2524
|
},
|
|
2393
2525
|
[load]
|
|
2394
2526
|
);
|
|
2395
|
-
const listGrants = (0,
|
|
2527
|
+
const listGrants = (0, import_react12.useCallback)(
|
|
2396
2528
|
(entry) => clientRef.current.listGrants?.(entry) ?? Promise.resolve([]),
|
|
2397
2529
|
[]
|
|
2398
2530
|
);
|
|
2399
|
-
const addGrant = (0,
|
|
2531
|
+
const addGrant = (0, import_react12.useCallback)(
|
|
2400
2532
|
(entry, input) => clientRef.current.grant?.(entry, input) ?? Promise.resolve(),
|
|
2401
2533
|
[]
|
|
2402
2534
|
);
|
|
2403
|
-
const revokeGrant = (0,
|
|
2535
|
+
const revokeGrant = (0, import_react12.useCallback)(
|
|
2404
2536
|
(entry, grantId) => clientRef.current.revokeGrant?.(entry, grantId) ?? Promise.resolve(),
|
|
2405
2537
|
[]
|
|
2406
2538
|
);
|
|
@@ -2508,12 +2640,12 @@ function ConnectorTile({
|
|
|
2508
2640
|
const isDisconnecting = ui?.kind === "disconnecting";
|
|
2509
2641
|
const errorMessage = ui?.kind === "error" ? ui.message : null;
|
|
2510
2642
|
const unhealthy = isUnhealthy(entry);
|
|
2511
|
-
const [kind, setKind] = (0,
|
|
2643
|
+
const [kind, setKind] = (0, import_react12.useState)("personal");
|
|
2512
2644
|
const choices = accessChoices(entry);
|
|
2513
|
-
const [access, setAccess] = (0,
|
|
2645
|
+
const [access, setAccess] = (0, import_react12.useState)(null);
|
|
2514
2646
|
const connectAccess = choices.length ? access && choices.includes(access) ? access : choices[choices.length - 1] : void 0;
|
|
2515
|
-
const [sharingOpen, setSharingOpen] = (0,
|
|
2516
|
-
const [setupOpen, setSetupOpen] = (0,
|
|
2647
|
+
const [sharingOpen, setSharingOpen] = (0, import_react12.useState)(false);
|
|
2648
|
+
const [setupOpen, setSetupOpen] = (0, import_react12.useState)(false);
|
|
2517
2649
|
const credentialFields = entry.credential_fields ?? [];
|
|
2518
2650
|
const pasteSupported = credentialsSupported && credentialFields.length > 0;
|
|
2519
2651
|
const guide = entry.guide ?? null;
|
|
@@ -2796,15 +2928,15 @@ function groundGuide(guide) {
|
|
|
2796
2928
|
return { prerequisites, steps, scopeNote, verify, ungrounded };
|
|
2797
2929
|
}
|
|
2798
2930
|
function CopyableValue({ value, testId }) {
|
|
2799
|
-
const [copied, setCopied] = (0,
|
|
2800
|
-
const timer = (0,
|
|
2801
|
-
(0,
|
|
2931
|
+
const [copied, setCopied] = (0, import_react12.useState)(false);
|
|
2932
|
+
const timer = (0, import_react12.useRef)(null);
|
|
2933
|
+
(0, import_react12.useEffect)(
|
|
2802
2934
|
() => () => {
|
|
2803
2935
|
if (timer.current) clearTimeout(timer.current);
|
|
2804
2936
|
},
|
|
2805
2937
|
[]
|
|
2806
2938
|
);
|
|
2807
|
-
const copy = (0,
|
|
2939
|
+
const copy = (0, import_react12.useCallback)(async () => {
|
|
2808
2940
|
try {
|
|
2809
2941
|
if (typeof navigator.clipboard?.writeText !== "function") {
|
|
2810
2942
|
throw new Error("clipboard unavailable");
|
|
@@ -2846,7 +2978,7 @@ function SetupGuidePanel({
|
|
|
2846
2978
|
}) {
|
|
2847
2979
|
const { prerequisites, steps, scopeNote, verify, ungrounded } = groundGuide(guide);
|
|
2848
2980
|
const leaked = ungrounded.length > 0;
|
|
2849
|
-
(0,
|
|
2981
|
+
(0, import_react12.useEffect)(() => {
|
|
2850
2982
|
if (!leaked) return;
|
|
2851
2983
|
console.error(
|
|
2852
2984
|
`[ConnectorPicker] setup guide for "${entry.slug}" arrived with ungrounded placeholders:`,
|
|
@@ -2930,20 +3062,20 @@ function CredentialForm({
|
|
|
2930
3062
|
onSubmitCredentials,
|
|
2931
3063
|
onTestCredentials
|
|
2932
3064
|
}) {
|
|
2933
|
-
const [values, setValues] = (0,
|
|
3065
|
+
const [values, setValues] = (0, import_react12.useState)(() => {
|
|
2934
3066
|
const initial = {};
|
|
2935
3067
|
for (const field of fields) {
|
|
2936
3068
|
if (field.defaultValue) initial[field.key] = field.defaultValue;
|
|
2937
3069
|
}
|
|
2938
3070
|
return initial;
|
|
2939
3071
|
});
|
|
2940
|
-
const [busy, setBusy] = (0,
|
|
2941
|
-
const [testing, setTesting] = (0,
|
|
2942
|
-
const [error, setError] = (0,
|
|
2943
|
-
const [result, setResult] = (0,
|
|
2944
|
-
const entryRef = (0,
|
|
3072
|
+
const [busy, setBusy] = (0, import_react12.useState)(false);
|
|
3073
|
+
const [testing, setTesting] = (0, import_react12.useState)(false);
|
|
3074
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
3075
|
+
const [result, setResult] = (0, import_react12.useState)(null);
|
|
3076
|
+
const entryRef = (0, import_react12.useRef)(entry);
|
|
2945
3077
|
entryRef.current = entry;
|
|
2946
|
-
const updateField = (0,
|
|
3078
|
+
const updateField = (0, import_react12.useCallback)((key, value) => {
|
|
2947
3079
|
setValues((prev) => ({ ...prev, [key]: value }));
|
|
2948
3080
|
setError(null);
|
|
2949
3081
|
setResult(null);
|
|
@@ -2952,7 +3084,7 @@ function CredentialForm({
|
|
|
2952
3084
|
const failedTest = result?.valid === false;
|
|
2953
3085
|
const untested = testSupported && result === null;
|
|
2954
3086
|
const fieldErrors = result?.field_errors ?? null;
|
|
2955
|
-
const handleTest = (0,
|
|
3087
|
+
const handleTest = (0, import_react12.useCallback)(async () => {
|
|
2956
3088
|
setTesting(true);
|
|
2957
3089
|
setError(null);
|
|
2958
3090
|
setResult(null);
|
|
@@ -2964,7 +3096,7 @@ function CredentialForm({
|
|
|
2964
3096
|
setTesting(false);
|
|
2965
3097
|
}
|
|
2966
3098
|
}, [onTestCredentials, values]);
|
|
2967
|
-
const handleSubmit = (0,
|
|
3099
|
+
const handleSubmit = (0, import_react12.useCallback)(async () => {
|
|
2968
3100
|
setBusy(true);
|
|
2969
3101
|
setError(null);
|
|
2970
3102
|
try {
|
|
@@ -3123,15 +3255,15 @@ function ManageSharing({
|
|
|
3123
3255
|
addGrant,
|
|
3124
3256
|
revokeGrant
|
|
3125
3257
|
}) {
|
|
3126
|
-
const [grants, setGrants] = (0,
|
|
3127
|
-
const [error, setError] = (0,
|
|
3128
|
-
const [busy, setBusy] = (0,
|
|
3129
|
-
const [granteeType, setGranteeType] = (0,
|
|
3130
|
-
const [granteeId, setGranteeId] = (0,
|
|
3258
|
+
const [grants, setGrants] = (0, import_react12.useState)(null);
|
|
3259
|
+
const [error, setError] = (0, import_react12.useState)(null);
|
|
3260
|
+
const [busy, setBusy] = (0, import_react12.useState)(false);
|
|
3261
|
+
const [granteeType, setGranteeType] = (0, import_react12.useState)("user");
|
|
3262
|
+
const [granteeId, setGranteeId] = (0, import_react12.useState)("");
|
|
3131
3263
|
const roleOptions = entry.org_connect?.role_options ?? [];
|
|
3132
|
-
const entryRef = (0,
|
|
3264
|
+
const entryRef = (0, import_react12.useRef)(entry);
|
|
3133
3265
|
entryRef.current = entry;
|
|
3134
|
-
const load = (0,
|
|
3266
|
+
const load = (0, import_react12.useCallback)(async () => {
|
|
3135
3267
|
try {
|
|
3136
3268
|
setGrants(await listGrants(entryRef.current));
|
|
3137
3269
|
setError(null);
|
|
@@ -3139,10 +3271,10 @@ function ManageSharing({
|
|
|
3139
3271
|
setError(errorMessageFrom(err, DEFAULT_GRANTS_LOAD_ERROR));
|
|
3140
3272
|
}
|
|
3141
3273
|
}, [listGrants]);
|
|
3142
|
-
(0,
|
|
3274
|
+
(0, import_react12.useEffect)(() => {
|
|
3143
3275
|
void load();
|
|
3144
3276
|
}, [load]);
|
|
3145
|
-
const handleAdd = (0,
|
|
3277
|
+
const handleAdd = (0, import_react12.useCallback)(async () => {
|
|
3146
3278
|
const id = granteeId.trim();
|
|
3147
3279
|
if (!id) return;
|
|
3148
3280
|
setBusy(true);
|
|
@@ -3156,7 +3288,7 @@ function ManageSharing({
|
|
|
3156
3288
|
setBusy(false);
|
|
3157
3289
|
}
|
|
3158
3290
|
}, [addGrant, granteeId, granteeType, load]);
|
|
3159
|
-
const handleRevoke = (0,
|
|
3291
|
+
const handleRevoke = (0, import_react12.useCallback)(
|
|
3160
3292
|
async (grantId) => {
|
|
3161
3293
|
setBusy(true);
|
|
3162
3294
|
try {
|
|
@@ -3293,7 +3425,7 @@ function ManageSharing({
|
|
|
3293
3425
|
}
|
|
3294
3426
|
|
|
3295
3427
|
// src/locked/locked-value.tsx
|
|
3296
|
-
var
|
|
3428
|
+
var import_lucide_react7 = require("lucide-react");
|
|
3297
3429
|
|
|
3298
3430
|
// src/locked/placeholder.ts
|
|
3299
3431
|
function hash(seed) {
|
|
@@ -3337,18 +3469,18 @@ var LOCKED_BLUR_STYLE = {
|
|
|
3337
3469
|
function LockedValue({ mask, seed, label, hideIcon = false, className }) {
|
|
3338
3470
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { role: "img", "aria-label": `${label} \u2014 locked`, className: cn("inline-flex items-center gap-1 whitespace-nowrap", className), children: [
|
|
3339
3471
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", style: LOCKED_BLUR_STYLE, children: placeholder(mask, seed) }),
|
|
3340
|
-
hideIcon ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3472
|
+
hideIcon ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Lock, { "aria-hidden": "true", className: "shrink-0 text-muted-foreground", style: { width: "0.85em", height: "0.85em" }, strokeWidth: 2 })
|
|
3341
3473
|
] });
|
|
3342
3474
|
}
|
|
3343
3475
|
|
|
3344
3476
|
// src/locked/locked-block.tsx
|
|
3345
|
-
var
|
|
3477
|
+
var import_react13 = require("react");
|
|
3346
3478
|
var import_jsx_runtime12 = (
|
|
3347
3479
|
// With a CTA, the block is at least as tall as the card, so a one-row
|
|
3348
3480
|
// section can't clip it.
|
|
3349
3481
|
require("react/jsx-runtime")
|
|
3350
3482
|
);
|
|
3351
|
-
var INERT = Number.parseInt(
|
|
3483
|
+
var INERT = Number.parseInt(import_react13.version, 10) >= 19 ? { inert: true } : { inert: "" };
|
|
3352
3484
|
function LockedBlock({ children, label, cta, className }) {
|
|
3353
3485
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3354
3486
|
"div",
|
|
@@ -3366,7 +3498,7 @@ function LockedBlock({ children, label, cta, className }) {
|
|
|
3366
3498
|
}
|
|
3367
3499
|
|
|
3368
3500
|
// src/locked/unlock-cta.tsx
|
|
3369
|
-
var
|
|
3501
|
+
var import_lucide_react8 = require("lucide-react");
|
|
3370
3502
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3371
3503
|
function UnlockCta({
|
|
3372
3504
|
href,
|
|
@@ -3390,7 +3522,7 @@ function UnlockCta({
|
|
|
3390
3522
|
className
|
|
3391
3523
|
),
|
|
3392
3524
|
children: [
|
|
3393
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.Lock, { "aria-hidden": "true", className: "size-3.5 text-primary", strokeWidth: 2 }),
|
|
3394
3526
|
title
|
|
3395
3527
|
]
|
|
3396
3528
|
}
|
|
@@ -3406,23 +3538,23 @@ function UnlockCta({
|
|
|
3406
3538
|
className
|
|
3407
3539
|
),
|
|
3408
3540
|
children: [
|
|
3409
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.Lock, { "aria-hidden": "true", className: "size-4", strokeWidth: 2 }) }),
|
|
3410
3542
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
3411
3543
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-sm font-semibold", children: title }),
|
|
3412
3544
|
sub ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "text-xs text-muted-foreground", children: sub }) : null
|
|
3413
3545
|
] }),
|
|
3414
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react8.ArrowRight, { "aria-hidden": "true", className: "size-4 shrink-0 transition-transform group-hover:translate-x-0.5", strokeWidth: 1.75 })
|
|
3415
3547
|
]
|
|
3416
3548
|
}
|
|
3417
3549
|
);
|
|
3418
3550
|
}
|
|
3419
3551
|
|
|
3420
3552
|
// src/chat-canvas-shell/chat-canvas-shell.tsx
|
|
3421
|
-
var
|
|
3553
|
+
var import_react18 = require("react");
|
|
3422
3554
|
|
|
3423
3555
|
// src/lib/use-isomorphic-layout-effect.ts
|
|
3424
|
-
var
|
|
3425
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ?
|
|
3556
|
+
var import_react14 = require("react");
|
|
3557
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? import_react14.useEffect : import_react14.useLayoutEffect;
|
|
3426
3558
|
|
|
3427
3559
|
// src/page-surface.tsx
|
|
3428
3560
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -3492,19 +3624,19 @@ function rawPctFromPointer(clientX, box) {
|
|
|
3492
3624
|
}
|
|
3493
3625
|
|
|
3494
3626
|
// src/chat-canvas-shell/layout-context.ts
|
|
3495
|
-
var
|
|
3496
|
-
var CanvasLayoutContext = (0,
|
|
3627
|
+
var import_react15 = require("react");
|
|
3628
|
+
var CanvasLayoutContext = (0, import_react15.createContext)(null);
|
|
3497
3629
|
function useCanvasLayout() {
|
|
3498
|
-
const ctx = (0,
|
|
3630
|
+
const ctx = (0, import_react15.useContext)(CanvasLayoutContext);
|
|
3499
3631
|
if (!ctx) throw new Error("useCanvasLayout must be used inside <ChatCanvasShell>");
|
|
3500
3632
|
return ctx;
|
|
3501
3633
|
}
|
|
3502
3634
|
function useCanvasLayoutOptional() {
|
|
3503
|
-
return (0,
|
|
3635
|
+
return (0, import_react15.useContext)(CanvasLayoutContext);
|
|
3504
3636
|
}
|
|
3505
3637
|
|
|
3506
3638
|
// src/chat-canvas-shell/canvas-page.tsx
|
|
3507
|
-
var
|
|
3639
|
+
var import_react16 = require("react");
|
|
3508
3640
|
var SLOT_KEYS = ["title", "info", "tabs", "actions", "dateControls"];
|
|
3509
3641
|
var EMPTY = Object.freeze({ owners: Object.freeze({}) });
|
|
3510
3642
|
function createCanvasPageStore() {
|
|
@@ -3550,14 +3682,14 @@ function createCanvasPageStore() {
|
|
|
3550
3682
|
getSnapshot: () => snapshot
|
|
3551
3683
|
};
|
|
3552
3684
|
}
|
|
3553
|
-
var CanvasPageStoreContext = (0,
|
|
3685
|
+
var CanvasPageStoreContext = (0, import_react16.createContext)(null);
|
|
3554
3686
|
var serverSnapshot = () => EMPTY;
|
|
3555
3687
|
var noopSubscribe = () => () => {
|
|
3556
3688
|
};
|
|
3557
3689
|
function useCanvasPage(slot) {
|
|
3558
|
-
const store = (0,
|
|
3559
|
-
const id = (0,
|
|
3560
|
-
const [seq] = (0,
|
|
3690
|
+
const store = (0, import_react16.useContext)(CanvasPageStoreContext);
|
|
3691
|
+
const id = (0, import_react16.useId)();
|
|
3692
|
+
const [seq] = (0, import_react16.useState)(() => store?.nextSeq() ?? 0);
|
|
3561
3693
|
useIsomorphicLayoutEffect(() => {
|
|
3562
3694
|
store?.set(id, seq, slot);
|
|
3563
3695
|
});
|
|
@@ -3572,8 +3704,8 @@ function CanvasPage(props) {
|
|
|
3572
3704
|
return null;
|
|
3573
3705
|
}
|
|
3574
3706
|
function useCanvasPageSnapshot() {
|
|
3575
|
-
const store = (0,
|
|
3576
|
-
return (0,
|
|
3707
|
+
const store = (0, import_react16.useContext)(CanvasPageStoreContext);
|
|
3708
|
+
return (0, import_react16.useSyncExternalStore)(
|
|
3577
3709
|
store ? store.subscribe : noopSubscribe,
|
|
3578
3710
|
store ? store.getSnapshot : serverSnapshot,
|
|
3579
3711
|
serverSnapshot
|
|
@@ -3581,8 +3713,8 @@ function useCanvasPageSnapshot() {
|
|
|
3581
3713
|
}
|
|
3582
3714
|
|
|
3583
3715
|
// src/chat-canvas-shell/canvas-header.tsx
|
|
3584
|
-
var
|
|
3585
|
-
var
|
|
3716
|
+
var import_react17 = require("react");
|
|
3717
|
+
var import_lucide_react9 = require("lucide-react");
|
|
3586
3718
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3587
3719
|
var MODE_LABELS = {
|
|
3588
3720
|
chat: "Chat",
|
|
@@ -3601,11 +3733,11 @@ function layoutShortcut(e) {
|
|
|
3601
3733
|
return digit ? SHORTCUT_MODES[digit] : null;
|
|
3602
3734
|
}
|
|
3603
3735
|
function useLayoutShortcuts(layout, enabled) {
|
|
3604
|
-
const latest = (0,
|
|
3736
|
+
const latest = (0, import_react17.useRef)(layout);
|
|
3605
3737
|
useIsomorphicLayoutEffect(() => {
|
|
3606
3738
|
latest.current = layout;
|
|
3607
3739
|
});
|
|
3608
|
-
(0,
|
|
3740
|
+
(0, import_react17.useEffect)(() => {
|
|
3609
3741
|
if (!enabled) return;
|
|
3610
3742
|
const onKeyDown = (e) => {
|
|
3611
3743
|
if (e.defaultPrevented || e.isComposing) return;
|
|
@@ -3620,8 +3752,8 @@ function useLayoutShortcuts(layout, enabled) {
|
|
|
3620
3752
|
}, [enabled]);
|
|
3621
3753
|
}
|
|
3622
3754
|
function useIsMac() {
|
|
3623
|
-
const [mac, setMac] = (0,
|
|
3624
|
-
(0,
|
|
3755
|
+
const [mac, setMac] = (0, import_react17.useState)(false);
|
|
3756
|
+
(0, import_react17.useEffect)(() => {
|
|
3625
3757
|
setMac(/Mac|iPhone|iPad|iPod/.test(navigator.platform || navigator.userAgent));
|
|
3626
3758
|
}, []);
|
|
3627
3759
|
return mac;
|
|
@@ -3654,7 +3786,7 @@ function CanvasLayoutSwitch({ className, chatPane = false }) {
|
|
|
3654
3786
|
}) });
|
|
3655
3787
|
}
|
|
3656
3788
|
function HeaderTabs({ tabs, titleId }) {
|
|
3657
|
-
const refs = (0,
|
|
3789
|
+
const refs = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
3658
3790
|
const ids = tabs.items.map((t) => t.id);
|
|
3659
3791
|
const domId = (kind, id) => tabs.idPrefix ? `${tabs.idPrefix}-${kind}-${id}` : void 0;
|
|
3660
3792
|
const focusId = ids.includes(tabs.value) ? tabs.value : ids[0];
|
|
@@ -3707,7 +3839,7 @@ function HeaderTabs({ tabs, titleId }) {
|
|
|
3707
3839
|
}
|
|
3708
3840
|
function CanvasHeader({ className }) {
|
|
3709
3841
|
const layout = useCanvasLayoutOptional();
|
|
3710
|
-
const titleId = (0,
|
|
3842
|
+
const titleId = (0, import_react17.useId)();
|
|
3711
3843
|
const { title, info, tabs, actions, dateControls, owners } = useCanvasPageSnapshot();
|
|
3712
3844
|
const activeTab = tabs?.items.find((t) => t.id === tabs.value);
|
|
3713
3845
|
const dates = activeTab?.dateControls ?? dateControls;
|
|
@@ -3732,8 +3864,8 @@ function CanvasHeader({ className }) {
|
|
|
3732
3864
|
"data-canvas-header-controls": "",
|
|
3733
3865
|
className: "order-3 flex w-full flex-wrap items-center gap-2 pb-2 @5xl:ml-auto @5xl:w-auto @5xl:min-w-0 @5xl:justify-end @5xl:py-1.5",
|
|
3734
3866
|
children: [
|
|
3735
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3736
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3867
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react17.Fragment, { children: dates }, `dates:${datesKey}`),
|
|
3868
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react17.Fragment, { children: actions }, `actions:${owners.actions ?? ""}`)
|
|
3737
3869
|
]
|
|
3738
3870
|
}
|
|
3739
3871
|
) : null,
|
|
@@ -3754,7 +3886,7 @@ function AskAboutThisPageBar() {
|
|
|
3754
3886
|
onClick: () => layout.setMode("split"),
|
|
3755
3887
|
className: "flex min-h-11 w-full items-center gap-2 rounded-md border border-border px-3 text-left text-sm text-muted-foreground transition-colors motion-reduce:transition-none hover:border-foreground/30 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
3756
3888
|
children: [
|
|
3757
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3889
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.MessageSquare, { size: 16, "aria-hidden": "true", className: "shrink-0" }),
|
|
3758
3890
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "min-w-0 flex-1 truncate", children: "Ask about this page" })
|
|
3759
3891
|
]
|
|
3760
3892
|
}
|
|
@@ -3786,9 +3918,9 @@ function composerCandidates(pane) {
|
|
|
3786
3918
|
return [.../* @__PURE__ */ new Set([marked, ...fields])].filter((el) => el !== null && usable(el));
|
|
3787
3919
|
}
|
|
3788
3920
|
function useKeepFocusVisible(mode, requestedMode, chatPane, canvasPane) {
|
|
3789
|
-
const prev = (0,
|
|
3790
|
-
const asked = (0,
|
|
3791
|
-
const requested = (0,
|
|
3921
|
+
const prev = (0, import_react18.useRef)(mode);
|
|
3922
|
+
const asked = (0, import_react18.useRef)(null);
|
|
3923
|
+
const requested = (0, import_react18.useRef)(requestedMode);
|
|
3792
3924
|
useIsomorphicLayoutEffect(() => {
|
|
3793
3925
|
requested.current = requestedMode;
|
|
3794
3926
|
}, [requestedMode]);
|
|
@@ -3812,7 +3944,7 @@ function useKeepFocusVisible(mode, requestedMode, chatPane, canvasPane) {
|
|
|
3812
3944
|
});
|
|
3813
3945
|
if (!focused) pane.focus();
|
|
3814
3946
|
});
|
|
3815
|
-
return (0,
|
|
3947
|
+
return (0, import_react18.useCallback)((next) => {
|
|
3816
3948
|
asked.current = next === requested.current ? null : next;
|
|
3817
3949
|
}, []);
|
|
3818
3950
|
}
|
|
@@ -3832,29 +3964,29 @@ function ChatCanvasShell({
|
|
|
3832
3964
|
const pctKey = `${storageKey}:split-pct:v2`;
|
|
3833
3965
|
const lastPageKey = `${storageKey}:last-page`;
|
|
3834
3966
|
const hasChat = chat !== void 0 && chat !== null && chat !== false;
|
|
3835
|
-
const [requestedMode, setRequestedMode] = (0,
|
|
3967
|
+
const [requestedMode, setRequestedMode] = (0, import_react18.useState)(
|
|
3836
3968
|
() => initialMode(pathname, homePath)
|
|
3837
3969
|
);
|
|
3838
|
-
const [splitPct, setSplitPctState] = (0,
|
|
3839
|
-
const [livePct, setLivePct] = (0,
|
|
3840
|
-
const [panesWidth, setPanesWidth] = (0,
|
|
3970
|
+
const [splitPct, setSplitPctState] = (0, import_react18.useState)(DEFAULT_SPLIT_PCT);
|
|
3971
|
+
const [livePct, setLivePct] = (0, import_react18.useState)(null);
|
|
3972
|
+
const [panesWidth, setPanesWidth] = (0, import_react18.useState)(0);
|
|
3841
3973
|
const reduceMotion = usePrefersReducedMotion();
|
|
3842
|
-
const panesRef = (0,
|
|
3843
|
-
const chatPaneRef = (0,
|
|
3844
|
-
const canvasPaneRef = (0,
|
|
3845
|
-
const drag = (0,
|
|
3846
|
-
const lastPage = (0,
|
|
3847
|
-
const [pageStore] = (0,
|
|
3848
|
-
const [seenPathname, setSeenPathname] = (0,
|
|
3849
|
-
const [seenStorageKey, setSeenStorageKey] = (0,
|
|
3974
|
+
const panesRef = (0, import_react18.useRef)(null);
|
|
3975
|
+
const chatPaneRef = (0, import_react18.useRef)(null);
|
|
3976
|
+
const canvasPaneRef = (0, import_react18.useRef)(null);
|
|
3977
|
+
const drag = (0, import_react18.useRef)(null);
|
|
3978
|
+
const lastPage = (0, import_react18.useRef)(null);
|
|
3979
|
+
const [pageStore] = (0, import_react18.useState)(createCanvasPageStore);
|
|
3980
|
+
const [seenPathname, setSeenPathname] = (0, import_react18.useState)(pathname);
|
|
3981
|
+
const [seenStorageKey, setSeenStorageKey] = (0, import_react18.useState)(storageKey);
|
|
3850
3982
|
useIsomorphicLayoutEffect(() => {
|
|
3851
3983
|
setSplitPctState(parseStoredSplitPct(readStorage(pctKey)));
|
|
3852
3984
|
const stored = readStorage(lastPageKey);
|
|
3853
3985
|
lastPage.current = isAppPath(stored) ? stored : null;
|
|
3854
3986
|
drag.current = null;
|
|
3855
3987
|
}, [pctKey, lastPageKey]);
|
|
3856
|
-
const savedPathname = (0,
|
|
3857
|
-
(0,
|
|
3988
|
+
const savedPathname = (0, import_react18.useRef)(null);
|
|
3989
|
+
(0, import_react18.useEffect)(() => {
|
|
3858
3990
|
if (savedPathname.current === pathname) return;
|
|
3859
3991
|
savedPathname.current = pathname;
|
|
3860
3992
|
if (!pathname || pathname === homePath) return;
|
|
@@ -3883,10 +4015,10 @@ function ChatCanvasShell({
|
|
|
3883
4015
|
const canSplit = !(panesWidth > 0) || panesWidth >= SPLIT_MIN_PANES_PX;
|
|
3884
4016
|
const mode = !hasChat ? "dashboard" : requestedMode === "split" && !canSplit ? "chat" : requestedMode;
|
|
3885
4017
|
if (mode !== "split" && livePct !== null) setLivePct(null);
|
|
3886
|
-
(0,
|
|
4018
|
+
(0, import_react18.useEffect)(() => {
|
|
3887
4019
|
if (mode !== "split") drag.current = null;
|
|
3888
4020
|
}, [mode]);
|
|
3889
|
-
const setSplitPct = (0,
|
|
4021
|
+
const setSplitPct = (0, import_react18.useCallback)(
|
|
3890
4022
|
(pct) => {
|
|
3891
4023
|
const next = clampSplitPct(pct);
|
|
3892
4024
|
setSplitPctState(next);
|
|
@@ -3895,7 +4027,7 @@ function ChatCanvasShell({
|
|
|
3895
4027
|
[pctKey]
|
|
3896
4028
|
);
|
|
3897
4029
|
const askFocus = useKeepFocusVisible(mode, requestedMode, chatPaneRef, canvasPaneRef);
|
|
3898
|
-
const setMode = (0,
|
|
4030
|
+
const setMode = (0, import_react18.useCallback)(
|
|
3899
4031
|
(next) => {
|
|
3900
4032
|
askFocus(next);
|
|
3901
4033
|
if (next !== "chat" && pathname === homePath) {
|
|
@@ -3905,7 +4037,7 @@ function ChatCanvasShell({
|
|
|
3905
4037
|
},
|
|
3906
4038
|
[askFocus, pathname, homePath, onNavigate, defaultPage]
|
|
3907
4039
|
);
|
|
3908
|
-
const openPage = (0,
|
|
4040
|
+
const openPage = (0, import_react18.useCallback)(
|
|
3909
4041
|
(href) => {
|
|
3910
4042
|
if (href === homePath) askFocus("chat");
|
|
3911
4043
|
onNavigate(href);
|
|
@@ -3913,12 +4045,12 @@ function ChatCanvasShell({
|
|
|
3913
4045
|
},
|
|
3914
4046
|
[askFocus, onNavigate, homePath]
|
|
3915
4047
|
);
|
|
3916
|
-
const revealChat = (0,
|
|
4048
|
+
const revealChat = (0, import_react18.useCallback)(() => {
|
|
3917
4049
|
if (mode !== "dashboard") return;
|
|
3918
4050
|
askFocus("split");
|
|
3919
4051
|
setRequestedMode("split");
|
|
3920
4052
|
}, [askFocus, mode]);
|
|
3921
|
-
const layout = (0,
|
|
4053
|
+
const layout = (0, import_react18.useMemo)(
|
|
3922
4054
|
() => ({ mode, splitPct, canSplit, hasChat, setMode, setSplitPct, openPage, revealChat }),
|
|
3923
4055
|
[mode, splitPct, canSplit, hasChat, setMode, setSplitPct, openPage, revealChat]
|
|
3924
4056
|
);
|
|
@@ -4068,7 +4200,7 @@ function ChatCanvasShell({
|
|
|
4068
4200
|
|
|
4069
4201
|
// src/controls/page-actions.tsx
|
|
4070
4202
|
var React5 = __toESM(require("react"));
|
|
4071
|
-
var
|
|
4203
|
+
var import_lucide_react10 = require("lucide-react");
|
|
4072
4204
|
|
|
4073
4205
|
// src/button.tsx
|
|
4074
4206
|
var React2 = __toESM(require("react"));
|
|
@@ -7669,7 +7801,7 @@ function PageActions({ primary, more = [], moreLabel = "More actions", className
|
|
|
7669
7801
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuTrigger, { asChild: true, disabled: primary.disabled, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Button, { ref: primaryRef, variant: primaryVariant, children: [
|
|
7670
7802
|
primary.icon,
|
|
7671
7803
|
primary.label,
|
|
7672
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7804
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.ChevronDown, { "aria-hidden": "true" })
|
|
7673
7805
|
] }) }),
|
|
7674
7806
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionMenuItems, { actions: optionsOf(primary), onRun: (a) => run(a, primaryRef) }) })
|
|
7675
7807
|
] }) : primary ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
@@ -7687,7 +7819,7 @@ function PageActions({ primary, more = [], moreLabel = "More actions", className
|
|
|
7687
7819
|
}
|
|
7688
7820
|
) : null,
|
|
7689
7821
|
more.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenu, { children: [
|
|
7690
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { ref: moreRef, variant: "ghost", size: "icon", "aria-label": moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
7822
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { ref: moreRef, variant: "ghost", size: "icon", "aria-label": moreLabel, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.MoreHorizontal, { "aria-hidden": "true" }) }) }),
|
|
7691
7823
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ActionMenuItems, { actions: more, onRun: (a) => run(a, moreRef) }) })
|
|
7692
7824
|
] }) : null,
|
|
7693
7825
|
dialog
|
|
@@ -7696,7 +7828,7 @@ function PageActions({ primary, more = [], moreLabel = "More actions", className
|
|
|
7696
7828
|
|
|
7697
7829
|
// src/controls/row-actions.tsx
|
|
7698
7830
|
var React6 = __toESM(require("react"));
|
|
7699
|
-
var
|
|
7831
|
+
var import_lucide_react11 = require("lucide-react");
|
|
7700
7832
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
7701
7833
|
var stop = (event) => event.stopPropagation();
|
|
7702
7834
|
function RowActions({ items, label = "Row actions", className }) {
|
|
@@ -7709,7 +7841,7 @@ function RowActions({ items, label = "Row actions", className }) {
|
|
|
7709
7841
|
if (empty) return null;
|
|
7710
7842
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { "data-slot": "row-actions", className: "contents", onClick: stop, onKeyDown: stop, onKeyUp: stop, children: [
|
|
7711
7843
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { children: [
|
|
7712
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { ref: triggerRef, variant: "ghost", size: "icon", "aria-label": label, className, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
7844
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button, { ref: triggerRef, variant: "ghost", size: "icon", "aria-label": label, className, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react11.MoreHorizontal, { "aria-hidden": "true" }) }) }),
|
|
7713
7845
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionMenuItems, { actions: items, onRun: (a) => run(a, triggerRef) }) })
|
|
7714
7846
|
] }),
|
|
7715
7847
|
dialog
|