@flytedan/flytebot-design-system 0.51.2 → 0.51.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +518 -459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +516 -459
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +28 -24
package/dist/index.cjs
CHANGED
|
@@ -70,6 +70,7 @@ __export(index_exports, {
|
|
|
70
70
|
CodeEditor: () => CodeEditor,
|
|
71
71
|
Collapsible: () => Collapsible,
|
|
72
72
|
ComingSoon: () => ComingSoon,
|
|
73
|
+
CornerStackPortal: () => CornerStackPortal,
|
|
73
74
|
CsiBadge: () => CsiBadge,
|
|
74
75
|
CsiHero: () => CsiHero,
|
|
75
76
|
CsiMeter: () => CsiMeter,
|
|
@@ -238,6 +239,7 @@ __export(index_exports, {
|
|
|
238
239
|
useAppearancePrefs: () => useAppearancePrefs,
|
|
239
240
|
useChatEngine: () => useChatEngine,
|
|
240
241
|
useCopyToClipboard: () => useCopyToClipboard,
|
|
242
|
+
useCornerStackSlot: () => useCornerStackSlot,
|
|
241
243
|
useDocumentTitle: () => useDocumentTitle,
|
|
242
244
|
useFeatureStatus: () => useFeatureStatus,
|
|
243
245
|
useLayerZIndex: () => useLayerZIndex,
|
|
@@ -1379,7 +1381,60 @@ function LoadingRegion({
|
|
|
1379
1381
|
}
|
|
1380
1382
|
|
|
1381
1383
|
// src/components/loading/JobTray.tsx
|
|
1384
|
+
var React10 = __toESM(require("react"), 1);
|
|
1385
|
+
|
|
1386
|
+
// src/kits/cornerStack.tsx
|
|
1382
1387
|
var React9 = __toESM(require("react"), 1);
|
|
1388
|
+
var import_react_dom5 = require("react-dom");
|
|
1389
|
+
var SLOTS = ["jobs", "toasts"];
|
|
1390
|
+
var references = /* @__PURE__ */ new Map();
|
|
1391
|
+
var host = null;
|
|
1392
|
+
var slotElements = /* @__PURE__ */ new Map();
|
|
1393
|
+
function createHost() {
|
|
1394
|
+
const stack = document.createElement("div");
|
|
1395
|
+
stack.className = "fd-corner-stack";
|
|
1396
|
+
stack.style.zIndex = String(OVERLAY_CEILING);
|
|
1397
|
+
for (const slot of SLOTS) {
|
|
1398
|
+
const element = document.createElement("div");
|
|
1399
|
+
element.className = "fd-corner-stack-slot";
|
|
1400
|
+
element.dataset.cornerStackSlot = slot;
|
|
1401
|
+
stack.appendChild(element);
|
|
1402
|
+
slotElements.set(slot, element);
|
|
1403
|
+
}
|
|
1404
|
+
document.body.appendChild(stack);
|
|
1405
|
+
return stack;
|
|
1406
|
+
}
|
|
1407
|
+
function acquire(slot) {
|
|
1408
|
+
host ??= createHost();
|
|
1409
|
+
references.set(slot, (references.get(slot) ?? 0) + 1);
|
|
1410
|
+
return slotElements.get(slot);
|
|
1411
|
+
}
|
|
1412
|
+
function release(slot) {
|
|
1413
|
+
const remaining = (references.get(slot) ?? 1) - 1;
|
|
1414
|
+
if (remaining > 0) references.set(slot, remaining);
|
|
1415
|
+
else references.delete(slot);
|
|
1416
|
+
if (references.size === 0 && host) {
|
|
1417
|
+
host.remove();
|
|
1418
|
+
host = null;
|
|
1419
|
+
slotElements.clear();
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
var useSlotEffect = typeof document === "undefined" ? React9.useEffect : React9.useLayoutEffect;
|
|
1423
|
+
function useCornerStackSlot(slot) {
|
|
1424
|
+
const [element, setElement] = React9.useState(null);
|
|
1425
|
+
useSlotEffect(() => {
|
|
1426
|
+
setElement(acquire(slot));
|
|
1427
|
+
return () => {
|
|
1428
|
+
release(slot);
|
|
1429
|
+
setElement(null);
|
|
1430
|
+
};
|
|
1431
|
+
}, [slot]);
|
|
1432
|
+
return element;
|
|
1433
|
+
}
|
|
1434
|
+
function CornerStackPortal({ slot, children }) {
|
|
1435
|
+
const element = useCornerStackSlot(slot);
|
|
1436
|
+
return element ? (0, import_react_dom5.createPortal)(children, element) : null;
|
|
1437
|
+
}
|
|
1383
1438
|
|
|
1384
1439
|
// src/components/loading/ProgressBar.tsx
|
|
1385
1440
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -1423,9 +1478,9 @@ function announcementFor(job) {
|
|
|
1423
1478
|
return title + ": in progress";
|
|
1424
1479
|
}
|
|
1425
1480
|
function JobTray({ jobs: jobs2, onDismiss, className = "" }) {
|
|
1426
|
-
const [announcement, setAnnouncement] =
|
|
1427
|
-
const prevStatuses =
|
|
1428
|
-
|
|
1481
|
+
const [announcement, setAnnouncement] = React10.useState("");
|
|
1482
|
+
const prevStatuses = React10.useRef({});
|
|
1483
|
+
React10.useEffect(() => {
|
|
1429
1484
|
let next = "";
|
|
1430
1485
|
for (const job of jobs2) {
|
|
1431
1486
|
if (prevStatuses.current[job.id] !== job.status) {
|
|
@@ -1438,10 +1493,10 @@ function JobTray({ jobs: jobs2, onDismiss, className = "" }) {
|
|
|
1438
1493
|
if (next) setAnnouncement(next);
|
|
1439
1494
|
}, [jobs2]);
|
|
1440
1495
|
if (jobs2.length === 0) return null;
|
|
1441
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["fd-job-tray", className].filter(Boolean).join(" "), children: [
|
|
1496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CornerStackPortal, { slot: "jobs", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: ["fd-job-tray", className].filter(Boolean).join(" "), children: [
|
|
1442
1497
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "fd-sr", role: "status", "aria-live": "polite", children: announcement }),
|
|
1443
1498
|
jobs2.map((job) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(JobCard, { job, onDismiss }, job.id))
|
|
1444
|
-
] });
|
|
1499
|
+
] }) });
|
|
1445
1500
|
}
|
|
1446
1501
|
function JobCard({ job, onDismiss }) {
|
|
1447
1502
|
const title = textOf(job.title) || "Job";
|
|
@@ -1476,7 +1531,7 @@ function JobCard({ job, onDismiss }) {
|
|
|
1476
1531
|
}
|
|
1477
1532
|
|
|
1478
1533
|
// src/components/loading/PhasedProgress.tsx
|
|
1479
|
-
var
|
|
1534
|
+
var React11 = __toESM(require("react"), 1);
|
|
1480
1535
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1481
1536
|
var ICON = {
|
|
1482
1537
|
pending: "ph-circle",
|
|
@@ -1489,9 +1544,9 @@ function textOf2(node) {
|
|
|
1489
1544
|
return "";
|
|
1490
1545
|
}
|
|
1491
1546
|
function PhasedProgress({ phases, summary, className = "" }) {
|
|
1492
|
-
const [announcement, setAnnouncement] =
|
|
1493
|
-
const prevStatuses =
|
|
1494
|
-
|
|
1547
|
+
const [announcement, setAnnouncement] = React11.useState("");
|
|
1548
|
+
const prevStatuses = React11.useRef({});
|
|
1549
|
+
React11.useEffect(() => {
|
|
1495
1550
|
let next = "";
|
|
1496
1551
|
for (const phase of phases) {
|
|
1497
1552
|
if (prevStatuses.current[phase.id] !== phase.status) {
|
|
@@ -1561,12 +1616,12 @@ function Spinner({ size = "md", label = "Loading", className = "", style, ...res
|
|
|
1561
1616
|
}
|
|
1562
1617
|
|
|
1563
1618
|
// src/components/navigation/SidebarNav.tsx
|
|
1564
|
-
var
|
|
1619
|
+
var React12 = __toESM(require("react"), 1);
|
|
1565
1620
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1566
1621
|
function Tip({ label, children }) {
|
|
1567
1622
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { title: label, style: { display: "inline-flex", flex: "none" }, children });
|
|
1568
1623
|
}
|
|
1569
|
-
var SidebarNav =
|
|
1624
|
+
var SidebarNav = React12.forwardRef(function SidebarNav2({ brand, groups = [], current: current2, onNavigate, footer, open: open2 = false, className = "", ...rest }, ref) {
|
|
1570
1625
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1571
1626
|
"nav",
|
|
1572
1627
|
{
|
|
@@ -1605,13 +1660,13 @@ var SidebarNav = React11.forwardRef(function SidebarNav2({ brand, groups = [], c
|
|
|
1605
1660
|
});
|
|
1606
1661
|
|
|
1607
1662
|
// src/components/navigation/Topbar.tsx
|
|
1608
|
-
var
|
|
1663
|
+
var React13 = __toESM(require("react"), 1);
|
|
1609
1664
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1610
1665
|
function useIsNarrow(breakpoint) {
|
|
1611
|
-
const [narrow, setNarrow] =
|
|
1666
|
+
const [narrow, setNarrow] = React13.useState(
|
|
1612
1667
|
() => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
|
|
1613
1668
|
);
|
|
1614
|
-
|
|
1669
|
+
React13.useEffect(() => {
|
|
1615
1670
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1616
1671
|
const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);
|
|
1617
1672
|
const apply = () => setNarrow(mq.matches);
|
|
@@ -1632,11 +1687,11 @@ function Topbar({
|
|
|
1632
1687
|
...rest
|
|
1633
1688
|
}) {
|
|
1634
1689
|
const narrow = useIsNarrow(overflowBreakpoint);
|
|
1635
|
-
const [moreOpen, setMoreOpen] =
|
|
1636
|
-
const moreRef =
|
|
1690
|
+
const [moreOpen, setMoreOpen] = React13.useState(false);
|
|
1691
|
+
const moreRef = React13.useRef(null);
|
|
1637
1692
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("header", { className: ["fd-topbar", narrow ? "is-narrow" : "", className].filter(Boolean).join(" "), ...rest, children: [
|
|
1638
1693
|
onMenu ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("button", { type: "button", className: "fd-btn-icon", "aria-label": "Menu", onClick: onMenu, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("i", { className: "ph ph-list" }) }) : null,
|
|
1639
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("nav", { className: "fd-crumb", "aria-label": "Breadcrumb", children: crumbs.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(React13.Fragment, { children: [
|
|
1640
1695
|
i > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("i", { className: "ph ph-caret-right", style: { fontSize: 11, opacity: 0.6 }, "aria-hidden": "true" }) : null,
|
|
1641
1696
|
i === crumbs.length - 1 ? (
|
|
1642
1697
|
// MP-141: the current crumb mixes a static route label with (usually) a
|
|
@@ -1689,25 +1744,25 @@ function Topbar({
|
|
|
1689
1744
|
}
|
|
1690
1745
|
|
|
1691
1746
|
// src/kits/useResponsiveRail.ts
|
|
1692
|
-
var
|
|
1747
|
+
var React14 = __toESM(require("react"), 1);
|
|
1693
1748
|
function matchesBreakpoint(breakpoint) {
|
|
1694
1749
|
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches;
|
|
1695
1750
|
}
|
|
1696
1751
|
function useResponsiveRail(options = {}) {
|
|
1697
1752
|
const { breakpoint = 1024, initialOpen = true, onPersist } = options;
|
|
1698
|
-
const navRef =
|
|
1699
|
-
const [overlay, setOverlay] =
|
|
1700
|
-
const [open2, setOpenRaw] =
|
|
1701
|
-
const setOpen =
|
|
1753
|
+
const navRef = React14.useRef(null);
|
|
1754
|
+
const [overlay, setOverlay] = React14.useState(() => matchesBreakpoint(breakpoint));
|
|
1755
|
+
const [open2, setOpenRaw] = React14.useState(() => matchesBreakpoint(breakpoint) ? false : initialOpen);
|
|
1756
|
+
const setOpen = React14.useCallback(
|
|
1702
1757
|
(value) => {
|
|
1703
1758
|
setOpenRaw(value);
|
|
1704
1759
|
if (!matchesBreakpoint(breakpoint)) onPersist?.(value);
|
|
1705
1760
|
},
|
|
1706
1761
|
[breakpoint, onPersist]
|
|
1707
1762
|
);
|
|
1708
|
-
const toggle =
|
|
1709
|
-
const close2 =
|
|
1710
|
-
|
|
1763
|
+
const toggle = React14.useCallback(() => setOpen(!open2), [open2, setOpen]);
|
|
1764
|
+
const close2 = React14.useCallback(() => setOpenRaw(false), []);
|
|
1765
|
+
React14.useEffect(() => {
|
|
1711
1766
|
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
1712
1767
|
const mq = window.matchMedia(`(max-width: ${breakpoint}px)`);
|
|
1713
1768
|
const handler = (e) => {
|
|
@@ -1718,7 +1773,7 @@ function useResponsiveRail(options = {}) {
|
|
|
1718
1773
|
return () => mq.removeEventListener("change", handler);
|
|
1719
1774
|
}, [breakpoint]);
|
|
1720
1775
|
const layer = useStackedLayer({ active: overlay && open2, containerRef: navRef, trap: true, onEscape: close2 });
|
|
1721
|
-
|
|
1776
|
+
React14.useEffect(() => {
|
|
1722
1777
|
if (!overlay || !open2) return;
|
|
1723
1778
|
const previousOverflow = document.body.style.overflow;
|
|
1724
1779
|
document.body.style.overflow = "hidden";
|
|
@@ -2076,15 +2131,15 @@ function Toast({ title, children, tone = "success", onUndo, onDismiss, className
|
|
|
2076
2131
|
}
|
|
2077
2132
|
|
|
2078
2133
|
// src/components/feedback/ToastProvider.tsx
|
|
2079
|
-
var
|
|
2134
|
+
var React15 = __toESM(require("react"), 1);
|
|
2080
2135
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2081
2136
|
var DEFAULT_TOAST_DURATION_MS = 5e3;
|
|
2082
|
-
var ToastContext =
|
|
2137
|
+
var ToastContext = React15.createContext(null);
|
|
2083
2138
|
function ToastProvider({ children }) {
|
|
2084
|
-
const [items, setItems] =
|
|
2085
|
-
const timers =
|
|
2086
|
-
const nextId =
|
|
2087
|
-
const dismiss =
|
|
2139
|
+
const [items, setItems] = React15.useState([]);
|
|
2140
|
+
const timers = React15.useRef(/* @__PURE__ */ new Map());
|
|
2141
|
+
const nextId = React15.useRef(1);
|
|
2142
|
+
const dismiss = React15.useCallback((id) => {
|
|
2088
2143
|
setItems((current2) => current2.filter((item) => item.id !== id));
|
|
2089
2144
|
const timer = timers.current.get(id);
|
|
2090
2145
|
if (timer !== void 0) {
|
|
@@ -2092,7 +2147,7 @@ function ToastProvider({ children }) {
|
|
|
2092
2147
|
timers.current.delete(id);
|
|
2093
2148
|
}
|
|
2094
2149
|
}, []);
|
|
2095
|
-
const show =
|
|
2150
|
+
const show = React15.useCallback(
|
|
2096
2151
|
(title, options = {}) => {
|
|
2097
2152
|
const { tone = "success", duration = DEFAULT_TOAST_DURATION_MS } = options;
|
|
2098
2153
|
const id = nextId.current++;
|
|
@@ -2101,38 +2156,38 @@ function ToastProvider({ children }) {
|
|
|
2101
2156
|
},
|
|
2102
2157
|
[dismiss]
|
|
2103
2158
|
);
|
|
2104
|
-
|
|
2159
|
+
React15.useEffect(() => {
|
|
2105
2160
|
const pending = timers.current;
|
|
2106
2161
|
return () => {
|
|
2107
2162
|
pending.forEach(clearTimeout);
|
|
2108
2163
|
pending.clear();
|
|
2109
2164
|
};
|
|
2110
2165
|
}, []);
|
|
2111
|
-
const api =
|
|
2166
|
+
const api = React15.useMemo(() => ({ show }), [show]);
|
|
2112
2167
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(ToastContext.Provider, { value: api, children: [
|
|
2113
2168
|
children,
|
|
2114
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "fd-toast-region", "aria-live": "polite",
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CornerStackPortal, { slot: "toasts", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "fd-toast-region", "aria-live": "polite", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Toast, { title: item.title, tone: item.tone, onDismiss: () => dismiss(item.id) }, item.id)) }) })
|
|
2115
2170
|
] });
|
|
2116
2171
|
}
|
|
2117
2172
|
function useToast() {
|
|
2118
|
-
const api =
|
|
2173
|
+
const api = React15.useContext(ToastContext);
|
|
2119
2174
|
if (!api) throw new Error("useToast must be used inside a <ToastProvider>");
|
|
2120
2175
|
return api;
|
|
2121
2176
|
}
|
|
2122
2177
|
|
|
2123
2178
|
// src/components/feedback/Tooltip.tsx
|
|
2124
|
-
var
|
|
2179
|
+
var React16 = __toESM(require("react"), 1);
|
|
2125
2180
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2126
2181
|
var CLOSE_DELAY_MS = 120;
|
|
2127
2182
|
function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
2128
|
-
const anchorRef =
|
|
2129
|
-
const bubbleRef =
|
|
2130
|
-
const [reason, setReason] =
|
|
2131
|
-
const closeTimer =
|
|
2132
|
-
const id =
|
|
2183
|
+
const anchorRef = React16.useRef(null);
|
|
2184
|
+
const bubbleRef = React16.useRef(null);
|
|
2185
|
+
const [reason, setReason] = React16.useState(null);
|
|
2186
|
+
const closeTimer = React16.useRef(null);
|
|
2187
|
+
const id = React16.useId();
|
|
2133
2188
|
const descId = id + "-desc";
|
|
2134
2189
|
const open2 = reason != null;
|
|
2135
|
-
const cancelClose =
|
|
2190
|
+
const cancelClose = React16.useCallback(() => {
|
|
2136
2191
|
if (closeTimer.current) {
|
|
2137
2192
|
clearTimeout(closeTimer.current);
|
|
2138
2193
|
closeTimer.current = null;
|
|
@@ -2142,7 +2197,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2142
2197
|
cancelClose();
|
|
2143
2198
|
setReason(why);
|
|
2144
2199
|
};
|
|
2145
|
-
const hide =
|
|
2200
|
+
const hide = React16.useCallback(() => {
|
|
2146
2201
|
cancelClose();
|
|
2147
2202
|
setReason(null);
|
|
2148
2203
|
}, [cancelClose]);
|
|
@@ -2157,7 +2212,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2157
2212
|
setReason((r) => r === "hover" ? null : r);
|
|
2158
2213
|
}, CLOSE_DELAY_MS);
|
|
2159
2214
|
};
|
|
2160
|
-
|
|
2215
|
+
React16.useEffect(() => cancelClose, [cancelClose]);
|
|
2161
2216
|
const pos = usePopoverPosition(open2, anchorRef, {
|
|
2162
2217
|
placement: placement === "bottom" ? "bottom-center" : "top-center",
|
|
2163
2218
|
offset: 8,
|
|
@@ -2168,7 +2223,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2168
2223
|
});
|
|
2169
2224
|
const layer = useStackedLayer({ active: open2, containerRef: bubbleRef, onEscape: hide, returnFocus: false });
|
|
2170
2225
|
const zIndex = useLayerZIndex(layer);
|
|
2171
|
-
|
|
2226
|
+
React16.useEffect(() => {
|
|
2172
2227
|
if (!open2) return;
|
|
2173
2228
|
const away = (e) => {
|
|
2174
2229
|
const t = e.target;
|
|
@@ -2189,7 +2244,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2189
2244
|
}
|
|
2190
2245
|
if (keyboard) show("focus");
|
|
2191
2246
|
};
|
|
2192
|
-
const described =
|
|
2247
|
+
const described = React16.isValidElement(children) ? React16.cloneElement(children, {
|
|
2193
2248
|
"aria-describedby": [children.props["aria-describedby"], descId].filter(Boolean).join(" ")
|
|
2194
2249
|
}) : children;
|
|
2195
2250
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
@@ -2197,7 +2252,7 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2197
2252
|
{
|
|
2198
2253
|
ref: anchorRef,
|
|
2199
2254
|
className: "fd-tooltip-anchor",
|
|
2200
|
-
"aria-describedby":
|
|
2255
|
+
"aria-describedby": React16.isValidElement(children) ? void 0 : descId,
|
|
2201
2256
|
onPointerEnter: (e) => {
|
|
2202
2257
|
if (isMouse(e)) hover();
|
|
2203
2258
|
},
|
|
@@ -2241,16 +2296,16 @@ function Tooltip({ label, placement = "top", children, className = "" }) {
|
|
|
2241
2296
|
}
|
|
2242
2297
|
|
|
2243
2298
|
// src/components/data/AnimNum.tsx
|
|
2244
|
-
var
|
|
2299
|
+
var React17 = __toESM(require("react"), 1);
|
|
2245
2300
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2246
2301
|
function shouldSkipEasing() {
|
|
2247
2302
|
if (typeof document !== "undefined" && document.hidden) return true;
|
|
2248
2303
|
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
2249
2304
|
}
|
|
2250
2305
|
function AnimNum({ value, format, duration = 550 }) {
|
|
2251
|
-
const [display, setDisplay] =
|
|
2252
|
-
const prev =
|
|
2253
|
-
|
|
2306
|
+
const [display, setDisplay] = React17.useState(value);
|
|
2307
|
+
const prev = React17.useRef(value);
|
|
2308
|
+
React17.useEffect(() => {
|
|
2254
2309
|
const from = prev.current;
|
|
2255
2310
|
const to = value;
|
|
2256
2311
|
prev.current = to;
|
|
@@ -2278,14 +2333,14 @@ function AnimNum({ value, format, duration = 550 }) {
|
|
|
2278
2333
|
}
|
|
2279
2334
|
|
|
2280
2335
|
// src/components/data/TrendChart.tsx
|
|
2281
|
-
var
|
|
2336
|
+
var React20 = __toESM(require("react"), 1);
|
|
2282
2337
|
|
|
2283
2338
|
// src/components/useMeasuredWidth.ts
|
|
2284
|
-
var
|
|
2339
|
+
var React18 = __toESM(require("react"), 1);
|
|
2285
2340
|
function useMeasuredWidth(fallback) {
|
|
2286
|
-
const [element, setElement] =
|
|
2287
|
-
const [width, setWidth] =
|
|
2288
|
-
|
|
2341
|
+
const [element, setElement] = React18.useState(null);
|
|
2342
|
+
const [width, setWidth] = React18.useState(fallback);
|
|
2343
|
+
React18.useLayoutEffect(() => {
|
|
2289
2344
|
if (!element || typeof ResizeObserver === "undefined") return;
|
|
2290
2345
|
const measure = () => {
|
|
2291
2346
|
const measured = Math.round(element.getBoundingClientRect().width);
|
|
@@ -2300,7 +2355,7 @@ function useMeasuredWidth(fallback) {
|
|
|
2300
2355
|
}
|
|
2301
2356
|
|
|
2302
2357
|
// src/components/data/SegmentedMeter.tsx
|
|
2303
|
-
var
|
|
2358
|
+
var React19 = __toESM(require("react"), 1);
|
|
2304
2359
|
|
|
2305
2360
|
// src/kits/files.ts
|
|
2306
2361
|
function formatBytes(n) {
|
|
@@ -2505,7 +2560,7 @@ function SegmentedMeter({
|
|
|
2505
2560
|
const pct = safeTotal ? Math.min(100, Math.round(used / safeTotal * 100)) : 0;
|
|
2506
2561
|
const w = (v) => safeTotal ? Math.max(0, Math.min(100, Number(v) / safeTotal * 100)) : 0;
|
|
2507
2562
|
const fill = (s, i) => s.color || (s.variant ? VARIANT_FILL[s.variant] : void 0) || CHART[i % CHART.length];
|
|
2508
|
-
const generatedId =
|
|
2563
|
+
const generatedId = React19.useId();
|
|
2509
2564
|
const uid2 = id || generatedId;
|
|
2510
2565
|
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: ["fd-segmeter", className].filter(Boolean).join(" "), onClick, children: [
|
|
2511
2566
|
label || showTotal ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "fd-segmeter-head", children: [
|
|
@@ -2656,8 +2711,8 @@ function TrendChart({
|
|
|
2656
2711
|
onRetry,
|
|
2657
2712
|
className = ""
|
|
2658
2713
|
}) {
|
|
2659
|
-
const [activeId, setActiveId] =
|
|
2660
|
-
const [pointTip, setPointTip] =
|
|
2714
|
+
const [activeId, setActiveId] = React20.useState(null);
|
|
2715
|
+
const [pointTip, setPointTip] = React20.useState(null);
|
|
2661
2716
|
const isEmpty = state === "ready" && (!categories.length || !series.length || series.every((s) => !s.values.length));
|
|
2662
2717
|
const effectiveState = isEmpty ? "empty" : state;
|
|
2663
2718
|
const [plotRef, VBW] = useMeasuredWidth(INITIAL_WIDTH);
|
|
@@ -2771,7 +2826,7 @@ function TrendChart({
|
|
|
2771
2826
|
}
|
|
2772
2827
|
|
|
2773
2828
|
// src/components/data/DonutChart.tsx
|
|
2774
|
-
var
|
|
2829
|
+
var React21 = __toESM(require("react"), 1);
|
|
2775
2830
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2776
2831
|
function DonutChart({
|
|
2777
2832
|
segments,
|
|
@@ -2786,7 +2841,7 @@ function DonutChart({
|
|
|
2786
2841
|
onRetry,
|
|
2787
2842
|
className = ""
|
|
2788
2843
|
}) {
|
|
2789
|
-
const [activeId, setActiveId] =
|
|
2844
|
+
const [activeId, setActiveId] = React21.useState(null);
|
|
2790
2845
|
const items = segments.filter((s) => Number(s.value) > 0);
|
|
2791
2846
|
const total = items.reduce((n, s) => n + Number(s.value), 0);
|
|
2792
2847
|
const isEmpty = state === "ready" && (!items.length || total <= 0);
|
|
@@ -2878,7 +2933,7 @@ function DonutChart({
|
|
|
2878
2933
|
}
|
|
2879
2934
|
|
|
2880
2935
|
// src/components/data/BarList.tsx
|
|
2881
|
-
var
|
|
2936
|
+
var React22 = __toESM(require("react"), 1);
|
|
2882
2937
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2883
2938
|
function BarList({
|
|
2884
2939
|
rows,
|
|
@@ -2893,7 +2948,7 @@ function BarList({
|
|
|
2893
2948
|
onRetry,
|
|
2894
2949
|
className = ""
|
|
2895
2950
|
}) {
|
|
2896
|
-
const ordered =
|
|
2951
|
+
const ordered = React22.useMemo(() => {
|
|
2897
2952
|
const list = sort ? [...rows].sort((a, b) => Number(b.value) - Number(a.value)) : rows;
|
|
2898
2953
|
return maxRows ? list.slice(0, maxRows) : list;
|
|
2899
2954
|
}, [rows, sort, maxRows]);
|
|
@@ -3035,7 +3090,7 @@ function FunnelChart({
|
|
|
3035
3090
|
}
|
|
3036
3091
|
|
|
3037
3092
|
// src/components/data/Clamp.tsx
|
|
3038
|
-
var
|
|
3093
|
+
var React23 = __toESM(require("react"), 1);
|
|
3039
3094
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3040
3095
|
function Clamp({
|
|
3041
3096
|
children,
|
|
@@ -3047,16 +3102,16 @@ function Clamp({
|
|
|
3047
3102
|
onToggle,
|
|
3048
3103
|
className = ""
|
|
3049
3104
|
}) {
|
|
3050
|
-
const [open2, setOpen] =
|
|
3051
|
-
const [overflows, setOverflows] =
|
|
3052
|
-
const bodyRef =
|
|
3053
|
-
const charClamped =
|
|
3105
|
+
const [open2, setOpen] = React23.useState(false);
|
|
3106
|
+
const [overflows, setOverflows] = React23.useState(false);
|
|
3107
|
+
const bodyRef = React23.useRef(null);
|
|
3108
|
+
const charClamped = React23.useMemo(() => {
|
|
3054
3109
|
if (open2 || !maxChars || typeof text !== "string" || text.length <= maxChars) return null;
|
|
3055
3110
|
const cut = text.slice(0, maxChars);
|
|
3056
3111
|
const at = cut.lastIndexOf(" ");
|
|
3057
3112
|
return (at > maxChars * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
|
|
3058
3113
|
}, [text, maxChars, open2]);
|
|
3059
|
-
|
|
3114
|
+
React23.useLayoutEffect(() => {
|
|
3060
3115
|
const node = bodyRef.current;
|
|
3061
3116
|
if (maxChars || !node || !maxHeight) return;
|
|
3062
3117
|
const measure = () => {
|
|
@@ -3195,16 +3250,16 @@ function DataTable({
|
|
|
3195
3250
|
}
|
|
3196
3251
|
|
|
3197
3252
|
// src/components/data/FilterBar.tsx
|
|
3198
|
-
var
|
|
3253
|
+
var React29 = __toESM(require("react"), 1);
|
|
3199
3254
|
|
|
3200
3255
|
// src/components/forms/NumberInput.tsx
|
|
3201
|
-
var
|
|
3256
|
+
var React26 = __toESM(require("react"), 1);
|
|
3202
3257
|
|
|
3203
3258
|
// src/components/forms/field.tsx
|
|
3204
|
-
var
|
|
3259
|
+
var React24 = __toESM(require("react"), 1);
|
|
3205
3260
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3206
3261
|
function useFieldId(id) {
|
|
3207
|
-
const generated =
|
|
3262
|
+
const generated = React24.useId();
|
|
3208
3263
|
return id || generated;
|
|
3209
3264
|
}
|
|
3210
3265
|
function FieldLabel({ htmlFor, id, required = false, onClick, children }) {
|
|
@@ -3223,10 +3278,10 @@ function HiddenFieldLabel({ id, children }) {
|
|
|
3223
3278
|
}
|
|
3224
3279
|
|
|
3225
3280
|
// src/components/useLatest.ts
|
|
3226
|
-
var
|
|
3281
|
+
var React25 = __toESM(require("react"), 1);
|
|
3227
3282
|
function useLatest(value) {
|
|
3228
|
-
const ref =
|
|
3229
|
-
|
|
3283
|
+
const ref = React25.useRef(value);
|
|
3284
|
+
React25.useInsertionEffect(() => {
|
|
3230
3285
|
ref.current = value;
|
|
3231
3286
|
});
|
|
3232
3287
|
return ref;
|
|
@@ -3309,20 +3364,20 @@ function NumberInput({
|
|
|
3309
3364
|
const n = typeof v === "number" ? v : parseNumberText(v);
|
|
3310
3365
|
return n == null || Number.isNaN(n) ? null : n;
|
|
3311
3366
|
};
|
|
3312
|
-
const [text, setText] =
|
|
3313
|
-
const [editing, setEditing] =
|
|
3367
|
+
const [text, setText] = React26.useState(() => toText(value));
|
|
3368
|
+
const [editing, setEditing] = React26.useState(false);
|
|
3314
3369
|
const parsed = parseNumberText(text);
|
|
3315
3370
|
const invalidMessage = parsed == null ? null : Number.isNaN(parsed) ? "Enter a number" : integer && !Number.isInteger(parsed) ? "Enter a whole number" : parsed < lo ? "Must be \u2265 " + lo : parsed > hi ? "Must be \u2264 " + hi : null;
|
|
3316
3371
|
const valid = invalidMessage == null;
|
|
3317
|
-
const committedRef =
|
|
3372
|
+
const committedRef = React26.useRef(toNumber(value));
|
|
3318
3373
|
const onChangeRef = useLatest(onChange);
|
|
3319
3374
|
const onValidityChangeRef = useLatest(onValidityChange);
|
|
3320
|
-
const focusedRef =
|
|
3321
|
-
|
|
3375
|
+
const focusedRef = React26.useRef(false);
|
|
3376
|
+
React26.useEffect(() => {
|
|
3322
3377
|
committedRef.current = toNumber(value);
|
|
3323
3378
|
if (!focusedRef.current) setText(toText(value));
|
|
3324
3379
|
}, [value]);
|
|
3325
|
-
|
|
3380
|
+
React26.useLayoutEffect(() => {
|
|
3326
3381
|
onValidityChangeRef.current?.(valid);
|
|
3327
3382
|
}, [valid, onValidityChangeRef]);
|
|
3328
3383
|
const fire = (n) => {
|
|
@@ -3338,26 +3393,26 @@ function NumberInput({
|
|
|
3338
3393
|
return true;
|
|
3339
3394
|
};
|
|
3340
3395
|
const bumpRef = useLatest(bump);
|
|
3341
|
-
const holdTimer =
|
|
3342
|
-
const
|
|
3396
|
+
const holdTimer = React26.useRef(null);
|
|
3397
|
+
const release2 = () => {
|
|
3343
3398
|
if (holdTimer.current) clearTimeout(holdTimer.current);
|
|
3344
3399
|
holdTimer.current = null;
|
|
3345
3400
|
};
|
|
3346
3401
|
const hold = (direction) => {
|
|
3347
|
-
|
|
3402
|
+
release2();
|
|
3348
3403
|
bump(direction, step);
|
|
3349
3404
|
let repeats = 0;
|
|
3350
3405
|
const tick = () => {
|
|
3351
3406
|
repeats++;
|
|
3352
3407
|
if (!bumpRef.current(direction, repeats > HOLD_BIG_AFTER ? big : step)) {
|
|
3353
|
-
|
|
3408
|
+
release2();
|
|
3354
3409
|
return;
|
|
3355
3410
|
}
|
|
3356
3411
|
holdTimer.current = setTimeout(tick, holdInterval(repeats));
|
|
3357
3412
|
};
|
|
3358
3413
|
holdTimer.current = setTimeout(tick, HOLD_DELAY_MS);
|
|
3359
3414
|
};
|
|
3360
|
-
|
|
3415
|
+
React26.useEffect(() => () => {
|
|
3361
3416
|
if (holdTimer.current) clearTimeout(holdTimer.current);
|
|
3362
3417
|
}, []);
|
|
3363
3418
|
const current2 = committedRef.current;
|
|
@@ -3423,9 +3478,9 @@ function NumberInput({
|
|
|
3423
3478
|
"aria-label": stepperName("Decrease"),
|
|
3424
3479
|
disabled: disabled || noRange || current2 != null && current2 <= lo,
|
|
3425
3480
|
onPointerDown: () => hold(-1),
|
|
3426
|
-
onPointerUp:
|
|
3427
|
-
onPointerLeave:
|
|
3428
|
-
onPointerCancel:
|
|
3481
|
+
onPointerUp: release2,
|
|
3482
|
+
onPointerLeave: release2,
|
|
3483
|
+
onPointerCancel: release2,
|
|
3429
3484
|
onClick: (e) => {
|
|
3430
3485
|
if (e.detail === 0) bump(-1, step);
|
|
3431
3486
|
},
|
|
@@ -3440,9 +3495,9 @@ function NumberInput({
|
|
|
3440
3495
|
"aria-label": stepperName("Increase"),
|
|
3441
3496
|
disabled: disabled || noRange || current2 != null && current2 >= hi,
|
|
3442
3497
|
onPointerDown: () => hold(1),
|
|
3443
|
-
onPointerUp:
|
|
3444
|
-
onPointerLeave:
|
|
3445
|
-
onPointerCancel:
|
|
3498
|
+
onPointerUp: release2,
|
|
3499
|
+
onPointerLeave: release2,
|
|
3500
|
+
onPointerCancel: release2,
|
|
3446
3501
|
onClick: (e) => {
|
|
3447
3502
|
if (e.detail === 0) bump(1, step);
|
|
3448
3503
|
},
|
|
@@ -3460,7 +3515,7 @@ function NumberInput({
|
|
|
3460
3515
|
}
|
|
3461
3516
|
|
|
3462
3517
|
// src/components/forms/DatePicker.tsx
|
|
3463
|
-
var
|
|
3518
|
+
var React27 = __toESM(require("react"), 1);
|
|
3464
3519
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3465
3520
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
3466
3521
|
var DOW = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
@@ -3493,10 +3548,10 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
3493
3548
|
const today = /* @__PURE__ */ new Date();
|
|
3494
3549
|
const sel = range ? value || {} : { start: value, end: value };
|
|
3495
3550
|
const anchor = parse(sel.start) || parse(initialMonth) || today;
|
|
3496
|
-
const [vy, setVy] =
|
|
3497
|
-
const [vm, setVm] =
|
|
3498
|
-
const [mode2, setMode] =
|
|
3499
|
-
const [hover, setHover] =
|
|
3551
|
+
const [vy, setVy] = React27.useState(anchor.getFullYear());
|
|
3552
|
+
const [vm, setVm] = React27.useState(anchor.getMonth());
|
|
3553
|
+
const [mode2, setMode] = React27.useState("days");
|
|
3554
|
+
const [hover, setHover] = React27.useState(null);
|
|
3500
3555
|
const s = parse(sel.start), e = parse(sel.end);
|
|
3501
3556
|
const hoverEnd = range && s && !e && hover ? parse(hover) : null;
|
|
3502
3557
|
const inRange = (d) => {
|
|
@@ -3507,12 +3562,12 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
3507
3562
|
const isEnd = (d) => !!e && iso(d) === iso(e);
|
|
3508
3563
|
const isEdge = (d) => isStart(d) || isEnd(d);
|
|
3509
3564
|
const nextY = vm === 11 ? vy + 1 : vy, nextM = (vm + 1) % 12;
|
|
3510
|
-
const [activeDate, setActiveDate] =
|
|
3565
|
+
const [activeDate, setActiveDate] = React27.useState(() => {
|
|
3511
3566
|
if (s) return s;
|
|
3512
3567
|
if (sameMonth(today, anchor.getFullYear(), anchor.getMonth())) return today;
|
|
3513
3568
|
return new Date(anchor.getFullYear(), anchor.getMonth(), 1);
|
|
3514
3569
|
});
|
|
3515
|
-
const calRef =
|
|
3570
|
+
const calRef = React27.useRef(null);
|
|
3516
3571
|
const pageToShow = (y, m) => {
|
|
3517
3572
|
const idx = y * 12 + m, firstIdx = vy * 12 + vm, secondIdx = firstIdx + 1;
|
|
3518
3573
|
if (idx === firstIdx || months > 1 && idx === secondIdx) return;
|
|
@@ -3529,7 +3584,7 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
3529
3584
|
setActiveDate(next);
|
|
3530
3585
|
pageToShow(next.getFullYear(), next.getMonth());
|
|
3531
3586
|
};
|
|
3532
|
-
|
|
3587
|
+
React27.useEffect(() => {
|
|
3533
3588
|
const el = calRef.current?.querySelector('[data-iso="' + iso(activeDate) + '"]');
|
|
3534
3589
|
if (el) el.focus({ preventScroll: true });
|
|
3535
3590
|
}, [activeDate, vy, vm]);
|
|
@@ -3722,9 +3777,9 @@ function Calendar({ value, range = false, onPick, initialMonth, months = 1 }) {
|
|
|
3722
3777
|
}
|
|
3723
3778
|
function DatePicker({ label, help, error, required = false, disabled = false, range = false, value, onChange, placeholder, id, className = "", style, "aria-label": hiddenLabel, ...rest }) {
|
|
3724
3779
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
|
|
3725
|
-
const [open2, setOpen] =
|
|
3726
|
-
const rootRef =
|
|
3727
|
-
const boxRef =
|
|
3780
|
+
const [open2, setOpen] = React27.useState(false);
|
|
3781
|
+
const rootRef = React27.useRef(null);
|
|
3782
|
+
const boxRef = React27.useRef(null);
|
|
3728
3783
|
const display = range ? value && value.start ? fmt(value.start) + (value.end ? " \u2192 " + fmt(value.end) : " \u2192 \u2026") : "" : fmt(value);
|
|
3729
3784
|
const toggle = () => {
|
|
3730
3785
|
if (!disabled) setOpen(!open2);
|
|
@@ -3813,9 +3868,9 @@ function Textarea({ label, help, error, required = false, rows = 4, disabled = f
|
|
|
3813
3868
|
}
|
|
3814
3869
|
|
|
3815
3870
|
// src/components/forms/listbox.ts
|
|
3816
|
-
var
|
|
3871
|
+
var React28 = __toESM(require("react"), 1);
|
|
3817
3872
|
function useListboxNav({ count, onSelect }) {
|
|
3818
|
-
const [active, setActive] =
|
|
3873
|
+
const [active, setActive] = React28.useState(-1);
|
|
3819
3874
|
return {
|
|
3820
3875
|
active,
|
|
3821
3876
|
setActive,
|
|
@@ -3828,7 +3883,7 @@ function useListboxNav({ count, onSelect }) {
|
|
|
3828
3883
|
};
|
|
3829
3884
|
}
|
|
3830
3885
|
function useListboxScrollIntoView(active, listRef, enabled) {
|
|
3831
|
-
|
|
3886
|
+
React28.useEffect(() => {
|
|
3832
3887
|
if (!enabled || active < 0 || !listRef.current) return;
|
|
3833
3888
|
const list = listRef.current;
|
|
3834
3889
|
const el = list.querySelector('[data-i="' + active + '"]');
|
|
@@ -4041,13 +4096,13 @@ function MultiSelectPanel({
|
|
|
4041
4096
|
onClose
|
|
4042
4097
|
}) {
|
|
4043
4098
|
const allowedOps = operatorsFor(field);
|
|
4044
|
-
const [draftOperator, setDraftOperator] =
|
|
4099
|
+
const [draftOperator, setDraftOperator] = React29.useState(value?.operator ?? allowedOps[0]);
|
|
4045
4100
|
const operator = allowedOps.length === 1 ? allowedOps[0] : value?.operator ?? draftOperator;
|
|
4046
4101
|
const selected = value?.values ?? [];
|
|
4047
4102
|
const selectedRef = useLatest(selected);
|
|
4048
4103
|
const operatorRef = useLatest(operator);
|
|
4049
|
-
const mountedRef =
|
|
4050
|
-
|
|
4104
|
+
const mountedRef = React29.useRef(true);
|
|
4105
|
+
React29.useEffect(() => {
|
|
4051
4106
|
mountedRef.current = true;
|
|
4052
4107
|
return () => {
|
|
4053
4108
|
mountedRef.current = false;
|
|
@@ -4061,20 +4116,20 @@ function MultiSelectPanel({
|
|
|
4061
4116
|
if (selectedRef.current.length > 0) commit(selectedRef.current, op);
|
|
4062
4117
|
else setDraftOperator(op);
|
|
4063
4118
|
};
|
|
4064
|
-
const [mode2, setMode] =
|
|
4065
|
-
const [query, setQuery] =
|
|
4066
|
-
const [asyncState, setAsyncState] =
|
|
4119
|
+
const [mode2, setMode] = React29.useState("search");
|
|
4120
|
+
const [query, setQuery] = React29.useState("");
|
|
4121
|
+
const [asyncState, setAsyncState] = React29.useState(
|
|
4067
4122
|
{ options: null, loading: !!field.loadOptions, error: false }
|
|
4068
4123
|
);
|
|
4069
|
-
const [retryTick, setRetryTick] =
|
|
4070
|
-
const inputRef =
|
|
4071
|
-
const listRef =
|
|
4072
|
-
const listId =
|
|
4124
|
+
const [retryTick, setRetryTick] = React29.useState(0);
|
|
4125
|
+
const inputRef = React29.useRef(null);
|
|
4126
|
+
const listRef = React29.useRef(null);
|
|
4127
|
+
const listId = React29.useId();
|
|
4073
4128
|
const loadOptionsRef = useLatest(field.loadOptions);
|
|
4074
|
-
|
|
4129
|
+
React29.useEffect(() => {
|
|
4075
4130
|
inputRef.current?.focus();
|
|
4076
4131
|
}, []);
|
|
4077
|
-
|
|
4132
|
+
React29.useEffect(() => {
|
|
4078
4133
|
const load = loadOptionsRef.current;
|
|
4079
4134
|
if (!load) return;
|
|
4080
4135
|
const controller = new AbortController();
|
|
@@ -4107,17 +4162,17 @@ function MultiSelectPanel({
|
|
|
4107
4162
|
};
|
|
4108
4163
|
const nav = useListboxNav({ count: options.length, onSelect: (i) => toggle(options[i]) });
|
|
4109
4164
|
useListboxScrollIntoView(nav.active, listRef, hasListbox);
|
|
4110
|
-
|
|
4165
|
+
React29.useEffect(() => {
|
|
4111
4166
|
nav.setActive(0);
|
|
4112
4167
|
}, [query, options.length]);
|
|
4113
4168
|
const activeId = hasListbox && options[nav.active] ? listId + "-opt-" + nav.active : void 0;
|
|
4114
4169
|
const liveMessage = showLoading ? "Loading\u2026" : showError ? "Couldn't load options." : options.length === 0 ? "No matches" : atLimit ? "Limit reached: at most " + field.maxValues + " values" : "";
|
|
4115
|
-
const [pasteText, setPasteText] =
|
|
4116
|
-
const [pasteLoading, setPasteLoading] =
|
|
4117
|
-
const [unmatchedTokens, setUnmatchedTokens] =
|
|
4118
|
-
const [pasteError, setPasteError] =
|
|
4119
|
-
const pasteWrapRef =
|
|
4120
|
-
|
|
4170
|
+
const [pasteText, setPasteText] = React29.useState("");
|
|
4171
|
+
const [pasteLoading, setPasteLoading] = React29.useState(false);
|
|
4172
|
+
const [unmatchedTokens, setUnmatchedTokens] = React29.useState([]);
|
|
4173
|
+
const [pasteError, setPasteError] = React29.useState(null);
|
|
4174
|
+
const pasteWrapRef = React29.useRef(null);
|
|
4175
|
+
React29.useEffect(() => {
|
|
4121
4176
|
if (mode2 === "paste") pasteWrapRef.current?.querySelector("textarea")?.focus();
|
|
4122
4177
|
}, [mode2]);
|
|
4123
4178
|
const doResolve = () => {
|
|
@@ -4290,8 +4345,8 @@ function MultiSelectPanel({
|
|
|
4290
4345
|
);
|
|
4291
4346
|
}
|
|
4292
4347
|
function useTextValidity(onFlip) {
|
|
4293
|
-
const invalidRef =
|
|
4294
|
-
const [, rerender] =
|
|
4348
|
+
const invalidRef = React29.useRef(/* @__PURE__ */ new Set());
|
|
4349
|
+
const [, rerender] = React29.useReducer((n) => n + 1, 0);
|
|
4295
4350
|
const onFlipRef = useLatest(onFlip);
|
|
4296
4351
|
const record = (name, valid) => {
|
|
4297
4352
|
const invalid = invalidRef.current;
|
|
@@ -4334,15 +4389,15 @@ function sameValue(a, b) {
|
|
|
4334
4389
|
return true;
|
|
4335
4390
|
}
|
|
4336
4391
|
function useReseedFromProps(value, applies, reseed) {
|
|
4337
|
-
const seen =
|
|
4338
|
-
|
|
4392
|
+
const seen = React29.useRef(value);
|
|
4393
|
+
React29.useLayoutEffect(() => {
|
|
4339
4394
|
if (seen.current === value) return;
|
|
4340
4395
|
seen.current = value;
|
|
4341
4396
|
if (!sameValue(value, applies())) reseed(value);
|
|
4342
4397
|
}, [value, applies, reseed]);
|
|
4343
4398
|
}
|
|
4344
4399
|
function usePreserveFocusAcrossRemount(seed, fields) {
|
|
4345
|
-
const pendingName =
|
|
4400
|
+
const pendingName = React29.useRef(null);
|
|
4346
4401
|
const fieldsRef = useLatest(fields);
|
|
4347
4402
|
const capture = () => {
|
|
4348
4403
|
const active = document.activeElement;
|
|
@@ -4355,7 +4410,7 @@ function usePreserveFocusAcrossRemount(seed, fields) {
|
|
|
4355
4410
|
}
|
|
4356
4411
|
}
|
|
4357
4412
|
};
|
|
4358
|
-
|
|
4413
|
+
React29.useLayoutEffect(() => {
|
|
4359
4414
|
const name = pendingName.current;
|
|
4360
4415
|
if (!name) return;
|
|
4361
4416
|
pendingName.current = null;
|
|
@@ -4371,14 +4426,14 @@ function RangePanel({
|
|
|
4371
4426
|
onCommit,
|
|
4372
4427
|
onClose
|
|
4373
4428
|
}) {
|
|
4374
|
-
const [draft, setDraft] =
|
|
4375
|
-
const [seed, setSeed] =
|
|
4376
|
-
const minId =
|
|
4377
|
-
const maxId =
|
|
4378
|
-
const minWrapRef =
|
|
4379
|
-
const maxWrapRef =
|
|
4429
|
+
const [draft, setDraft] = React29.useState(() => rangeDraft(value));
|
|
4430
|
+
const [seed, setSeed] = React29.useState(0);
|
|
4431
|
+
const minId = React29.useId();
|
|
4432
|
+
const maxId = React29.useId();
|
|
4433
|
+
const minWrapRef = React29.useRef(null);
|
|
4434
|
+
const maxWrapRef = React29.useRef(null);
|
|
4380
4435
|
const preserveFocus = usePreserveFocusAcrossRemount(seed, { min: minWrapRef, max: maxWrapRef });
|
|
4381
|
-
const draftRef =
|
|
4436
|
+
const draftRef = React29.useRef(draft);
|
|
4382
4437
|
const shown = () => {
|
|
4383
4438
|
const { min, max } = draftRef.current;
|
|
4384
4439
|
return applicable(field, min == null && max == null ? void 0 : { min, max }, validity.allValid());
|
|
@@ -4470,15 +4525,15 @@ function DatePanel({
|
|
|
4470
4525
|
onClose
|
|
4471
4526
|
}) {
|
|
4472
4527
|
const maxDays = effectiveMaxDays(field);
|
|
4473
|
-
const [initial] =
|
|
4474
|
-
const [kind, setKind] =
|
|
4475
|
-
const [daysDraft, setDaysDraft] =
|
|
4476
|
-
const daysRef =
|
|
4477
|
-
const daysConfirmed =
|
|
4478
|
-
const [between, setBetween] =
|
|
4479
|
-
const [seed, setSeed] =
|
|
4480
|
-
const daysId =
|
|
4481
|
-
const daysWrapRef =
|
|
4528
|
+
const [initial] = React29.useState(() => dateDraft(field, value));
|
|
4529
|
+
const [kind, setKind] = React29.useState(initial.kind);
|
|
4530
|
+
const [daysDraft, setDaysDraft] = React29.useState(initial.days);
|
|
4531
|
+
const daysRef = React29.useRef(daysDraft);
|
|
4532
|
+
const daysConfirmed = React29.useRef(value?.kind === "withinDays");
|
|
4533
|
+
const [between, setBetween] = React29.useState(initial.between);
|
|
4534
|
+
const [seed, setSeed] = React29.useState(0);
|
|
4535
|
+
const daysId = React29.useId();
|
|
4536
|
+
const daysWrapRef = React29.useRef(null);
|
|
4482
4537
|
const preserveFocus = usePreserveFocusAcrossRemount(seed, { days: daysWrapRef });
|
|
4483
4538
|
const shownWithinDays = () => {
|
|
4484
4539
|
const days = daysRef.current;
|
|
@@ -4590,11 +4645,11 @@ function DatePanel({
|
|
|
4590
4645
|
);
|
|
4591
4646
|
}
|
|
4592
4647
|
function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align = "left", actions, onClearAll, showActiveCount = false, className = "", ...rest }) {
|
|
4593
|
-
const [panel, setPanel] =
|
|
4594
|
-
const editAnchorRef =
|
|
4595
|
-
const addAnchorRef =
|
|
4596
|
-
const textInputRef =
|
|
4597
|
-
const optionsRef =
|
|
4648
|
+
const [panel, setPanel] = React29.useState(null);
|
|
4649
|
+
const editAnchorRef = React29.useRef(null);
|
|
4650
|
+
const addAnchorRef = React29.useRef(null);
|
|
4651
|
+
const textInputRef = React29.useRef(null);
|
|
4652
|
+
const optionsRef = React29.useRef(null);
|
|
4598
4653
|
if (process.env.NODE_ENV !== "production") {
|
|
4599
4654
|
for (const f of fields) assertValidFieldDefinition(f);
|
|
4600
4655
|
}
|
|
@@ -4617,7 +4672,7 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
|
|
|
4617
4672
|
const editingField = panel && panel.kind === "edit" ? fields.find((f) => f.key === panel.key) : void 0;
|
|
4618
4673
|
const startEditing = (key) => setPanel({ kind: "edit", key });
|
|
4619
4674
|
const closeEditing = () => setPanel(null);
|
|
4620
|
-
|
|
4675
|
+
React29.useEffect(() => {
|
|
4621
4676
|
if (!panel || panel.kind !== "edit") return;
|
|
4622
4677
|
if (editingField?.type === "text") {
|
|
4623
4678
|
textInputRef.current?.focus();
|
|
@@ -4726,8 +4781,10 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
|
|
|
4726
4781
|
removeField(field);
|
|
4727
4782
|
closeEditing();
|
|
4728
4783
|
};
|
|
4729
|
-
const
|
|
4730
|
-
const
|
|
4784
|
+
const valueText = set ? chipLabel(field, value) : "";
|
|
4785
|
+
const chipText = set ? field.label + ": " + valueText : field.label;
|
|
4786
|
+
const paintedText = field.icon && set ? valueText : chipText;
|
|
4787
|
+
const chip = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Tag, { icon: field.icon, selected: true, onClick: toggleOrClose, onRemove: remove, title: chipText, "aria-label": chipText, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(MiddleEllipsis, { text: paintedText }) });
|
|
4731
4788
|
if (field.type === "text") {
|
|
4732
4789
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "fd-filterbar-chip", children: chip }, field.key);
|
|
4733
4790
|
}
|
|
@@ -4845,10 +4902,10 @@ function StatTile({ label, value, sub, delta, invert = false, loading = false, c
|
|
|
4845
4902
|
}
|
|
4846
4903
|
|
|
4847
4904
|
// src/components/data/CodeBlock.tsx
|
|
4848
|
-
var
|
|
4905
|
+
var React31 = __toESM(require("react"), 1);
|
|
4849
4906
|
|
|
4850
4907
|
// src/kits/clipboard.ts
|
|
4851
|
-
var
|
|
4908
|
+
var React30 = __toESM(require("react"), 1);
|
|
4852
4909
|
var COPIED_FEEDBACK_MS = 1600;
|
|
4853
4910
|
function copyThroughSelection(text) {
|
|
4854
4911
|
const previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
@@ -4878,17 +4935,17 @@ async function copyToClipboard(text) {
|
|
|
4878
4935
|
return copyThroughSelection(text);
|
|
4879
4936
|
}
|
|
4880
4937
|
function useCopyToClipboard() {
|
|
4881
|
-
const [copied, setCopied] =
|
|
4882
|
-
const timer =
|
|
4883
|
-
const mounted =
|
|
4884
|
-
|
|
4938
|
+
const [copied, setCopied] = React30.useState(false);
|
|
4939
|
+
const timer = React30.useRef(null);
|
|
4940
|
+
const mounted = React30.useRef(true);
|
|
4941
|
+
React30.useEffect(() => {
|
|
4885
4942
|
mounted.current = true;
|
|
4886
4943
|
return () => {
|
|
4887
4944
|
mounted.current = false;
|
|
4888
4945
|
if (timer.current) clearTimeout(timer.current);
|
|
4889
4946
|
};
|
|
4890
4947
|
}, []);
|
|
4891
|
-
const copy =
|
|
4948
|
+
const copy = React30.useCallback(async (text) => {
|
|
4892
4949
|
const ok = await copyToClipboard(text);
|
|
4893
4950
|
if (ok && mounted.current) {
|
|
4894
4951
|
setCopied(true);
|
|
@@ -5056,7 +5113,7 @@ function tokenize(src, lang) {
|
|
|
5056
5113
|
return out;
|
|
5057
5114
|
}
|
|
5058
5115
|
function Highlighted({ code, lang }) {
|
|
5059
|
-
const toks =
|
|
5116
|
+
const toks = React31.useMemo(() => tokenize(code, lang), [code, lang]);
|
|
5060
5117
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: toks.map((tk, i) => tk.c ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "tok-" + tk.c, children: tk.t }, i) : tk.t) });
|
|
5061
5118
|
}
|
|
5062
5119
|
function CodeBlock({
|
|
@@ -5070,8 +5127,8 @@ function CodeBlock({
|
|
|
5070
5127
|
actions,
|
|
5071
5128
|
className = ""
|
|
5072
5129
|
}) {
|
|
5073
|
-
const [wrap, setWrap] =
|
|
5074
|
-
const [open2, setOpen] =
|
|
5130
|
+
const [wrap, setWrap] = React31.useState(!!wrapDefault);
|
|
5131
|
+
const [open2, setOpen] = React31.useState(false);
|
|
5075
5132
|
const [copied, copy] = useCopyToClipboard();
|
|
5076
5133
|
const body = String(code).replace(/\n$/, "");
|
|
5077
5134
|
const lines = body.split("\n");
|
|
@@ -5100,7 +5157,7 @@ function CodeBlock({
|
|
|
5100
5157
|
] });
|
|
5101
5158
|
}
|
|
5102
5159
|
function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" }) {
|
|
5103
|
-
const [open2, setOpen] =
|
|
5160
|
+
const [open2, setOpen] = React31.useState(false);
|
|
5104
5161
|
const [copied, copy] = useCopyToClipboard();
|
|
5105
5162
|
const raw = String(diff).replace(/\n$/, "");
|
|
5106
5163
|
const all = raw.split("\n").map((line) => {
|
|
@@ -5146,7 +5203,7 @@ function DiffBlock({ diff = "", filename, collapseAfter = 34, className = "" })
|
|
|
5146
5203
|
}
|
|
5147
5204
|
|
|
5148
5205
|
// src/components/data/Markdown.tsx
|
|
5149
|
-
var
|
|
5206
|
+
var React32 = __toESM(require("react"), 1);
|
|
5150
5207
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5151
5208
|
var SAFE = /^(?:https?:|mailto:|tel:|#|\/|\.{1,2}\/)/i;
|
|
5152
5209
|
var safeHref = (h) => SAFE.test(String(h || "").trim()) ? String(h).trim() : null;
|
|
@@ -5185,7 +5242,7 @@ function inlineNodes(src, ctx, keyBase) {
|
|
|
5185
5242
|
const href = safeHref(g(2));
|
|
5186
5243
|
out.push(href ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("a", { href, title: g(3) || void 0, target: /^https?:/i.test(href) ? "_blank" : void 0, rel: "noopener noreferrer", onClick: ctx.onLinkClick, children: inlineNodes(g(1), ctx, key()) }, key()) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { children: g(1) }, key()));
|
|
5187
5244
|
} else if (kind === "cite") {
|
|
5188
|
-
out.push(ctx.renderCitation ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5245
|
+
out.push(ctx.renderCitation ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(React32.Fragment, { children: ctx.renderCitation(g(1)) }, key()) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("sup", { className: "fd-md-cite", children: g(1) }, key()));
|
|
5189
5246
|
} else if (kind === "strongem") out.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("strong", { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("em", { children: inlineNodes(g(1), ctx, key()) }) }, key()));
|
|
5190
5247
|
else if (kind === "strong") out.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("strong", { children: inlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
5191
5248
|
else if (kind === "em") out.push(/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("em", { children: inlineNodes(g(1) || g(2), ctx, key()) }, key()));
|
|
@@ -5350,7 +5407,7 @@ function Markdown({
|
|
|
5350
5407
|
onLinkClick
|
|
5351
5408
|
}) {
|
|
5352
5409
|
const ctx = { allowImages, headingOffset, renderCitation, onLinkClick, codeProps };
|
|
5353
|
-
const blocks =
|
|
5410
|
+
const blocks = React32.useMemo(() => parseBlocks(source), [source]);
|
|
5354
5411
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: ["fd-md", className].filter(Boolean).join(" "), children: renderBlocks(blocks, ctx, "b") });
|
|
5355
5412
|
}
|
|
5356
5413
|
function MarkdownInline({ source = "", className = "", onLinkClick }) {
|
|
@@ -5464,7 +5521,7 @@ function Pagination({
|
|
|
5464
5521
|
}
|
|
5465
5522
|
|
|
5466
5523
|
// src/components/data/RelativeTime.tsx
|
|
5467
|
-
var
|
|
5524
|
+
var React33 = __toESM(require("react"), 1);
|
|
5468
5525
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5469
5526
|
var MIN = 6e4;
|
|
5470
5527
|
var HOUR = 36e5;
|
|
@@ -5516,9 +5573,9 @@ function formatDuration(ms) {
|
|
|
5516
5573
|
return h + "h" + (m % 60 ? " " + m % 60 + "m" : "");
|
|
5517
5574
|
}
|
|
5518
5575
|
function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true, ...rest }) {
|
|
5519
|
-
const [, force] =
|
|
5576
|
+
const [, force] = React33.useState(0);
|
|
5520
5577
|
const t = value instanceof Date ? value.getTime() : Date.parse(value);
|
|
5521
|
-
|
|
5578
|
+
React33.useEffect(() => {
|
|
5522
5579
|
if (!refresh2 || !t || isNaN(t)) return;
|
|
5523
5580
|
const abs = Math.abs(t - Date.now());
|
|
5524
5581
|
if (abs > DAY) return;
|
|
@@ -5534,7 +5591,7 @@ function RelativeTime({ value, prefix, className = "", refresh: refresh2 = true,
|
|
|
5534
5591
|
}
|
|
5535
5592
|
|
|
5536
5593
|
// src/components/data/ScoreMeter.tsx
|
|
5537
|
-
var
|
|
5594
|
+
var React34 = __toESM(require("react"), 1);
|
|
5538
5595
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5539
5596
|
function ScoreMeter({
|
|
5540
5597
|
score,
|
|
@@ -5549,10 +5606,10 @@ function ScoreMeter({
|
|
|
5549
5606
|
breakdownWidth = 280,
|
|
5550
5607
|
className = ""
|
|
5551
5608
|
}) {
|
|
5552
|
-
const [open2, setOpen] =
|
|
5553
|
-
const ref =
|
|
5609
|
+
const [open2, setOpen] = React34.useState(false);
|
|
5610
|
+
const ref = React34.useRef(null);
|
|
5554
5611
|
const value = Math.max(0, Math.min(100, Math.round(Number(score) || 0)));
|
|
5555
|
-
const body = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5612
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(React34.Fragment, { children: [
|
|
5556
5613
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-scoremeter-rail", style: { width }, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SegmentedMeter, { total: 100, segments, height, showTotal: false, showPercent: false, legend: false }) }),
|
|
5557
5614
|
showScore ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "fd-scoremeter-value fd-tabular", "aria-hidden": "true", children: value }) : null
|
|
5558
5615
|
] });
|
|
@@ -5571,7 +5628,7 @@ function ScoreMeter({
|
|
|
5571
5628
|
}
|
|
5572
5629
|
);
|
|
5573
5630
|
}
|
|
5574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(React34.Fragment, { children: [
|
|
5575
5632
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5576
5633
|
"button",
|
|
5577
5634
|
{
|
|
@@ -5602,14 +5659,14 @@ function ScoreMeter({
|
|
|
5602
5659
|
}
|
|
5603
5660
|
|
|
5604
5661
|
// src/components/actions/inlinePanel.tsx
|
|
5605
|
-
var
|
|
5662
|
+
var React35 = __toESM(require("react"), 1);
|
|
5606
5663
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5607
5664
|
function useInlinePanel() {
|
|
5608
|
-
const [open2, setOpen] =
|
|
5609
|
-
const ref =
|
|
5665
|
+
const [open2, setOpen] = React35.useState(false);
|
|
5666
|
+
const ref = React35.useRef(null);
|
|
5610
5667
|
const layer = useStackedLayer({ active: open2, containerRef: ref, onEscape: () => setOpen(false) });
|
|
5611
5668
|
const zIndex = useLayerZIndex(layer);
|
|
5612
|
-
|
|
5669
|
+
React35.useEffect(() => {
|
|
5613
5670
|
if (!open2) return;
|
|
5614
5671
|
const away = (e) => {
|
|
5615
5672
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
@@ -5675,7 +5732,7 @@ function SortMenu({ fields = [], sort, onSort, align = "right", size = "md", cla
|
|
|
5675
5732
|
}
|
|
5676
5733
|
|
|
5677
5734
|
// src/components/data/StepList.tsx
|
|
5678
|
-
var
|
|
5735
|
+
var React36 = __toESM(require("react"), 1);
|
|
5679
5736
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5680
5737
|
var KIND_ICON = { tool: "wrench", search: "magnifying-glass", read: "file-text", write: "pencil-simple", reasoning: "brain", run: "terminal", fetch: "cloud-arrow-down" };
|
|
5681
5738
|
function StepList({
|
|
@@ -5688,9 +5745,9 @@ function StepList({
|
|
|
5688
5745
|
dense = false,
|
|
5689
5746
|
className = ""
|
|
5690
5747
|
}) {
|
|
5691
|
-
const [openState, setOpenState] =
|
|
5748
|
+
const [openState, setOpenState] = React36.useState(defaultOpen);
|
|
5692
5749
|
const open2 = openProp == null ? openState : openProp;
|
|
5693
|
-
const [expanded, setExpanded] =
|
|
5750
|
+
const [expanded, setExpanded] = React36.useState({});
|
|
5694
5751
|
if (!steps.length) return null;
|
|
5695
5752
|
const running = steps.some((s) => s.status === "running");
|
|
5696
5753
|
const failed = steps.filter((s) => s.status === "error").length;
|
|
@@ -5748,7 +5805,7 @@ function StepList({
|
|
|
5748
5805
|
}
|
|
5749
5806
|
|
|
5750
5807
|
// src/components/data/VirtualList.tsx
|
|
5751
|
-
var
|
|
5808
|
+
var React37 = __toESM(require("react"), 1);
|
|
5752
5809
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
5753
5810
|
var VIRTUAL_LIST_BUFFER_ROWS = 20;
|
|
5754
5811
|
var VIRTUAL_LIST_ROW_GAP = 6;
|
|
@@ -5800,35 +5857,35 @@ function VirtualList({
|
|
|
5800
5857
|
className = "",
|
|
5801
5858
|
style
|
|
5802
5859
|
}) {
|
|
5803
|
-
const [scrollTop, setScrollTop] =
|
|
5804
|
-
const loaded =
|
|
5860
|
+
const [scrollTop, setScrollTop] = React37.useState(0);
|
|
5861
|
+
const loaded = React37.useMemo(
|
|
5805
5862
|
() => ({ firstItemIndex, count: items.length }),
|
|
5806
5863
|
[firstItemIndex, items.length]
|
|
5807
5864
|
);
|
|
5808
5865
|
const total = Math.max(totalCount == null ? 0 : totalCount, firstItemIndex + items.length);
|
|
5809
5866
|
const bandKey = firstItemIndex + ":" + items.length;
|
|
5810
|
-
const win =
|
|
5867
|
+
const win = React37.useMemo(
|
|
5811
5868
|
() => computeVirtualWindow({ scrollTop, viewportHeight: height, itemHeight, itemCount: total, loaded }),
|
|
5812
5869
|
[scrollTop, height, itemHeight, total, loaded]
|
|
5813
5870
|
);
|
|
5814
|
-
const need =
|
|
5871
|
+
const need = React37.useMemo(() => computeNeedMore(win, loaded), [win, loaded]);
|
|
5815
5872
|
const wantStart = need.start && hasMore?.start !== false;
|
|
5816
5873
|
const wantEnd = need.end && hasMore?.end !== false;
|
|
5817
5874
|
const bucket2 = Math.floor(win.visibleStart / VIRTUAL_LIST_BUFFER_ROWS);
|
|
5818
5875
|
const askKey = bandKey + "@" + bucket2;
|
|
5819
|
-
const asked =
|
|
5820
|
-
|
|
5876
|
+
const asked = React37.useRef({ start: null, end: null });
|
|
5877
|
+
React37.useEffect(() => {
|
|
5821
5878
|
if (loading || !wantStart || asked.current.start === askKey) return;
|
|
5822
5879
|
asked.current.start = askKey;
|
|
5823
5880
|
onNeedMore("start", win);
|
|
5824
5881
|
}, [wantStart, loading, askKey, onNeedMore, win]);
|
|
5825
|
-
|
|
5882
|
+
React37.useEffect(() => {
|
|
5826
5883
|
if (loading || !wantEnd || asked.current.end === askKey) return;
|
|
5827
5884
|
asked.current.end = askKey;
|
|
5828
5885
|
onNeedMore("end", win);
|
|
5829
5886
|
}, [wantEnd, loading, askKey, onNeedMore, win]);
|
|
5830
|
-
const lastKeysRef =
|
|
5831
|
-
const newKeys =
|
|
5887
|
+
const lastKeysRef = React37.useRef(null);
|
|
5888
|
+
const newKeys = React37.useMemo(() => {
|
|
5832
5889
|
const prev = lastKeysRef.current;
|
|
5833
5890
|
if (!prev) return /* @__PURE__ */ new Set();
|
|
5834
5891
|
const fresh = /* @__PURE__ */ new Set();
|
|
@@ -5838,7 +5895,7 @@ function VirtualList({
|
|
|
5838
5895
|
}
|
|
5839
5896
|
return fresh;
|
|
5840
5897
|
}, [items]);
|
|
5841
|
-
|
|
5898
|
+
React37.useEffect(() => {
|
|
5842
5899
|
lastKeysRef.current = new Set(items.map(keyOf));
|
|
5843
5900
|
}, [items]);
|
|
5844
5901
|
const gapStyle = { "--fd-vlist-gap": rowGap + "px" };
|
|
@@ -5883,7 +5940,7 @@ function VirtualList({
|
|
|
5883
5940
|
}
|
|
5884
5941
|
|
|
5885
5942
|
// src/components/data/EntityRow.tsx
|
|
5886
|
-
var
|
|
5943
|
+
var React38 = __toESM(require("react"), 1);
|
|
5887
5944
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
5888
5945
|
var ENTITY_ROW_METRIC_WIDTH = 74;
|
|
5889
5946
|
var METRIC_TONE_COLOR = {
|
|
@@ -5896,7 +5953,7 @@ function EntityRowMetrics({ metrics, className = "", style }) {
|
|
|
5896
5953
|
const key = m.id || m.label || i;
|
|
5897
5954
|
const className2 = ["fd-erow-metric", m.tone && m.tone !== "default" ? "is-" + m.tone : "", m.tooltip != null ? "is-described" : ""].filter(Boolean).join(" ");
|
|
5898
5955
|
const tone = { color: METRIC_TONE_COLOR[m.tone || "default"] };
|
|
5899
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
5956
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(React38.Fragment, { children: [
|
|
5900
5957
|
m.icon ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("i", { className: "ph ph-" + m.icon, "aria-hidden": "true" }) : null,
|
|
5901
5958
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "fd-erow-metric-value fd-tabular", children: m.value }),
|
|
5902
5959
|
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "fd-sr", children: " " + m.label })
|
|
@@ -5988,8 +6045,8 @@ function EntityRow({
|
|
|
5988
6045
|
}
|
|
5989
6046
|
|
|
5990
6047
|
// src/components/data/TransferList.tsx
|
|
5991
|
-
var
|
|
5992
|
-
var
|
|
6048
|
+
var React39 = __toESM(require("react"), 1);
|
|
6049
|
+
var import_react_dom6 = require("react-dom");
|
|
5993
6050
|
|
|
5994
6051
|
// src/components/forms/Input.tsx
|
|
5995
6052
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
@@ -6094,12 +6151,12 @@ function TransferList({
|
|
|
6094
6151
|
listHeight = 440,
|
|
6095
6152
|
className = ""
|
|
6096
6153
|
}) {
|
|
6097
|
-
const [drag, setDrag] =
|
|
6098
|
-
const [dragOverSide, setDragOverSide] =
|
|
6099
|
-
const dragRef =
|
|
6100
|
-
const armedRef =
|
|
6101
|
-
const sideRefs =
|
|
6102
|
-
const hitTestSide =
|
|
6154
|
+
const [drag, setDrag] = React39.useState(null);
|
|
6155
|
+
const [dragOverSide, setDragOverSide] = React39.useState(null);
|
|
6156
|
+
const dragRef = React39.useRef(null);
|
|
6157
|
+
const armedRef = React39.useRef(null);
|
|
6158
|
+
const sideRefs = React39.useRef({ left: null, right: null });
|
|
6159
|
+
const hitTestSide = React39.useCallback((x, y) => {
|
|
6103
6160
|
for (const side of ["left", "right"]) {
|
|
6104
6161
|
const el = sideRefs.current[side];
|
|
6105
6162
|
if (!el) continue;
|
|
@@ -6108,7 +6165,7 @@ function TransferList({
|
|
|
6108
6165
|
}
|
|
6109
6166
|
return null;
|
|
6110
6167
|
}, []);
|
|
6111
|
-
const findItem =
|
|
6168
|
+
const findItem = React39.useCallback(
|
|
6112
6169
|
(side, key) => (side === "left" ? left.items : right.items).find((it) => keyOf(it) === key),
|
|
6113
6170
|
[left.items, right.items, keyOf]
|
|
6114
6171
|
);
|
|
@@ -6130,7 +6187,7 @@ function TransferList({
|
|
|
6130
6187
|
height: rect.height
|
|
6131
6188
|
};
|
|
6132
6189
|
};
|
|
6133
|
-
|
|
6190
|
+
React39.useEffect(() => {
|
|
6134
6191
|
const onMovePointer = (e) => {
|
|
6135
6192
|
const armed = armedRef.current;
|
|
6136
6193
|
if (!armed || e.pointerId !== armed.pointerId) return;
|
|
@@ -6183,7 +6240,7 @@ function TransferList({
|
|
|
6183
6240
|
window.removeEventListener("pointercancel", endDrag);
|
|
6184
6241
|
};
|
|
6185
6242
|
}, [hitTestSide, findItem, onMove]);
|
|
6186
|
-
|
|
6243
|
+
React39.useEffect(() => {
|
|
6187
6244
|
if (!drag || typeof document === "undefined") return;
|
|
6188
6245
|
const prev = document.body.style.userSelect;
|
|
6189
6246
|
document.body.style.userSelect = "none";
|
|
@@ -6266,7 +6323,7 @@ function TransferList({
|
|
|
6266
6323
|
renderSide("left", left, "right"),
|
|
6267
6324
|
renderSide("right", right, "left")
|
|
6268
6325
|
] }),
|
|
6269
|
-
drag ? (0,
|
|
6326
|
+
drag ? (0, import_react_dom6.createPortal)(
|
|
6270
6327
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6271
6328
|
"div",
|
|
6272
6329
|
{
|
|
@@ -6291,11 +6348,11 @@ function TransferList({
|
|
|
6291
6348
|
}
|
|
6292
6349
|
|
|
6293
6350
|
// src/components/forms/Checkbox.tsx
|
|
6294
|
-
var
|
|
6351
|
+
var React40 = __toESM(require("react"), 1);
|
|
6295
6352
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6296
6353
|
function Checkbox({ label, description, card = false, indeterminate = false, className = "", ...rest }) {
|
|
6297
|
-
const ref =
|
|
6298
|
-
|
|
6354
|
+
const ref = React40.useRef(null);
|
|
6355
|
+
React40.useEffect(() => {
|
|
6299
6356
|
if (ref.current) ref.current.indeterminate = indeterminate;
|
|
6300
6357
|
}, [indeterminate]);
|
|
6301
6358
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("label", { className: ["fd-choice", card ? "fd-choice-card" : "", className].filter(Boolean).join(" "), children: [
|
|
@@ -6339,7 +6396,7 @@ function Switch({ label, description, className = "", ...rest }) {
|
|
|
6339
6396
|
}
|
|
6340
6397
|
|
|
6341
6398
|
// src/components/forms/Select.tsx
|
|
6342
|
-
var
|
|
6399
|
+
var React41 = __toESM(require("react"), 1);
|
|
6343
6400
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6344
6401
|
var norm = (o) => typeof o === "string" ? { value: o, label: o } : o;
|
|
6345
6402
|
function Select({
|
|
@@ -6367,12 +6424,12 @@ function Select({
|
|
|
6367
6424
|
const isOn = (v) => multiple ? vals.includes(v) : v === value;
|
|
6368
6425
|
const hasSearch = searchable === void 0 ? opts.length > 8 : searchable;
|
|
6369
6426
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id, hiddenLabel);
|
|
6370
|
-
const [open2, setOpen] =
|
|
6371
|
-
const [q, setQ] =
|
|
6372
|
-
const rootRef =
|
|
6373
|
-
const boxRef =
|
|
6374
|
-
const listRef =
|
|
6375
|
-
const typeBuf =
|
|
6427
|
+
const [open2, setOpen] = React41.useState(false);
|
|
6428
|
+
const [q, setQ] = React41.useState("");
|
|
6429
|
+
const rootRef = React41.useRef(null);
|
|
6430
|
+
const boxRef = React41.useRef(null);
|
|
6431
|
+
const listRef = React41.useRef(null);
|
|
6432
|
+
const typeBuf = React41.useRef({ s: "", t: 0 });
|
|
6376
6433
|
const selected = multiple ? null : opts.find((o) => o.value === value);
|
|
6377
6434
|
const chosen = multiple ? opts.filter((o) => vals.includes(o.value)) : [];
|
|
6378
6435
|
const boxText = multiple ? chosen.length === 0 ? placeholder : chosen.length === 1 ? chosen[0].label : summary ? summary(chosen.map((o) => o.value)) : chosen.length + " selected" : selected ? selected.label : placeholder;
|
|
@@ -6508,7 +6565,7 @@ function Select({
|
|
|
6508
6565
|
),
|
|
6509
6566
|
q ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "fd-body-sm fd-muted", children: visible.length }) : null
|
|
6510
6567
|
] }) : void 0,
|
|
6511
|
-
footer: multiple ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
6568
|
+
footer: multiple ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(React41.Fragment, { children: [
|
|
6512
6569
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6513
6570
|
"button",
|
|
6514
6571
|
{
|
|
@@ -6539,7 +6596,7 @@ function Select({
|
|
|
6539
6596
|
'Nothing matches "',
|
|
6540
6597
|
q,
|
|
6541
6598
|
'".'
|
|
6542
|
-
] }) : groups.map((grp) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
6599
|
+
] }) : groups.map((grp) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(React41.Fragment, { children: [
|
|
6543
6600
|
grp.g ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "fd-pop-group", children: grp.g }) : null,
|
|
6544
6601
|
grp.items.map(({ o, i }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
6545
6602
|
"button",
|
|
@@ -6576,7 +6633,7 @@ function Select({
|
|
|
6576
6633
|
}
|
|
6577
6634
|
|
|
6578
6635
|
// src/components/forms/TimePicker.tsx
|
|
6579
|
-
var
|
|
6636
|
+
var React42 = __toESM(require("react"), 1);
|
|
6580
6637
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6581
6638
|
var pad = (n) => String(n).padStart(2, "0");
|
|
6582
6639
|
function ClockFace({ value = "09:00", onChange }) {
|
|
@@ -6585,9 +6642,9 @@ function ClockFace({ value = "09:00", onChange }) {
|
|
|
6585
6642
|
if (isNaN(m)) m = 0;
|
|
6586
6643
|
const pm = h24 >= 12;
|
|
6587
6644
|
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
6588
|
-
const [mode2, setMode] =
|
|
6589
|
-
const faceRef =
|
|
6590
|
-
const dragging =
|
|
6645
|
+
const [mode2, setMode] = React42.useState("h");
|
|
6646
|
+
const faceRef = React42.useRef(null);
|
|
6647
|
+
const dragging = React42.useRef(false);
|
|
6591
6648
|
const set = (h, mm, isPm) => onChange((isPm ? h % 12 + 12 : h % 12) + ":" + pad(mm));
|
|
6592
6649
|
const R = 108, NR = 80;
|
|
6593
6650
|
const nums = mode2 === "h" ? Array.from({ length: 12 }, (_, i) => i + 1) : Array.from({ length: 12 }, (_, i) => i * 5);
|
|
@@ -6660,9 +6717,9 @@ function ClockFace({ value = "09:00", onChange }) {
|
|
|
6660
6717
|
}
|
|
6661
6718
|
function TimePicker({ label, help, error, required = false, disabled = false, value = "", onChange, placeholder = "Pick a time", id, className = "", style }) {
|
|
6662
6719
|
const { fieldId, labelId, ariaLabelledBy } = useTriggerLabelling(label, id);
|
|
6663
|
-
const [open2, setOpen] =
|
|
6664
|
-
const rootRef =
|
|
6665
|
-
const boxRef =
|
|
6720
|
+
const [open2, setOpen] = React42.useState(false);
|
|
6721
|
+
const rootRef = React42.useRef(null);
|
|
6722
|
+
const boxRef = React42.useRef(null);
|
|
6666
6723
|
const disp = () => {
|
|
6667
6724
|
if (!value) return "";
|
|
6668
6725
|
const [h, m] = value.split(":").map(Number);
|
|
@@ -6705,7 +6762,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
|
|
|
6705
6762
|
offset: 6,
|
|
6706
6763
|
width: 262,
|
|
6707
6764
|
role: "presentation",
|
|
6708
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
6765
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(React42.Fragment, { children: [
|
|
6709
6766
|
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
6710
6767
|
"button",
|
|
6711
6768
|
{
|
|
@@ -6733,7 +6790,7 @@ function TimePicker({ label, help, error, required = false, disabled = false, va
|
|
|
6733
6790
|
}
|
|
6734
6791
|
|
|
6735
6792
|
// src/components/forms/Slider.tsx
|
|
6736
|
-
var
|
|
6793
|
+
var React43 = __toESM(require("react"), 1);
|
|
6737
6794
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6738
6795
|
function Slider({
|
|
6739
6796
|
label,
|
|
@@ -6751,7 +6808,7 @@ function Slider({
|
|
|
6751
6808
|
...rest
|
|
6752
6809
|
}) {
|
|
6753
6810
|
const fieldId = useFieldId(id);
|
|
6754
|
-
const [dragging, setDragging] =
|
|
6811
|
+
const [dragging, setDragging] = React43.useState(false);
|
|
6755
6812
|
const v = value === void 0 ? min : Number(value);
|
|
6756
6813
|
const pct = max === min ? 0 : (v - min) / (max - min) * 100;
|
|
6757
6814
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: ["fd-field", className].filter(Boolean).join(" "), children: [
|
|
@@ -6785,7 +6842,7 @@ function Slider({
|
|
|
6785
6842
|
}
|
|
6786
6843
|
|
|
6787
6844
|
// src/components/forms/RangeSlider.tsx
|
|
6788
|
-
var
|
|
6845
|
+
var React44 = __toESM(require("react"), 1);
|
|
6789
6846
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
6790
6847
|
function RangeSlider({
|
|
6791
6848
|
label,
|
|
@@ -6805,9 +6862,9 @@ function RangeSlider({
|
|
|
6805
6862
|
}) {
|
|
6806
6863
|
const fmt2 = format || ((v) => String(v));
|
|
6807
6864
|
const [a, b] = value || [min, max];
|
|
6808
|
-
const [drag, setDrag] =
|
|
6809
|
-
const [focus, setFocus] =
|
|
6810
|
-
const railRef =
|
|
6865
|
+
const [drag, setDrag] = React44.useState(null);
|
|
6866
|
+
const [focus, setFocus] = React44.useState(null);
|
|
6867
|
+
const railRef = React44.useRef(null);
|
|
6811
6868
|
const pct = (v) => max === min ? 0 : (v - min) / (max - min) * 100;
|
|
6812
6869
|
const clampPair = (i, v) => {
|
|
6813
6870
|
v = Math.min(max, Math.max(min, Math.round(v / step) * step));
|
|
@@ -6822,7 +6879,7 @@ function RangeSlider({
|
|
|
6822
6879
|
const r = railRef.current.getBoundingClientRect();
|
|
6823
6880
|
return min + Math.min(1, Math.max(0, (e.clientX - r.left) / r.width)) * (max - min);
|
|
6824
6881
|
};
|
|
6825
|
-
|
|
6882
|
+
React44.useEffect(() => {
|
|
6826
6883
|
if (drag === null) return;
|
|
6827
6884
|
const mv = (e) => onChange && onChange(clampPair(drag, fromEvent(e)));
|
|
6828
6885
|
const upH = () => setDrag(null);
|
|
@@ -6903,7 +6960,7 @@ function RangeSlider({
|
|
|
6903
6960
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "fd-range" + (hasLabels ? " has-labels" : ""), onPointerDown: onRailDown, children: [
|
|
6904
6961
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "fd-range-rail", ref: railRef }),
|
|
6905
6962
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "fd-range-fill", style: { left: pct(a) + "%", width: pct(b) - pct(a) + "%" } }),
|
|
6906
|
-
marks.map((m) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
6963
|
+
marks.map((m) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(React44.Fragment, { children: [
|
|
6907
6964
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "fd-range-mark" + (m.value >= a && m.value <= b ? " is-in" : ""), style: { left: pct(m.value) + "%" } }),
|
|
6908
6965
|
m.label ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "fd-range-mark-label", style: { left: pct(m.value) + "%" }, children: m.label }) : null
|
|
6909
6966
|
] }, m.value)),
|
|
@@ -6932,7 +6989,7 @@ function RangeSlider({
|
|
|
6932
6989
|
}
|
|
6933
6990
|
|
|
6934
6991
|
// src/components/forms/Dropzone.tsx
|
|
6935
|
-
var
|
|
6992
|
+
var React45 = __toESM(require("react"), 1);
|
|
6936
6993
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
6937
6994
|
function Dropzone({
|
|
6938
6995
|
onFiles,
|
|
@@ -6947,8 +7004,8 @@ function Dropzone({
|
|
|
6947
7004
|
className = "",
|
|
6948
7005
|
style
|
|
6949
7006
|
}) {
|
|
6950
|
-
const [over, setOver] =
|
|
6951
|
-
const depth =
|
|
7007
|
+
const [over, setOver] = React45.useState(false);
|
|
7008
|
+
const depth = React45.useRef(0);
|
|
6952
7009
|
const has = (e) => {
|
|
6953
7010
|
const dt = e.dataTransfer;
|
|
6954
7011
|
if (!dt) return false;
|
|
@@ -7010,8 +7067,8 @@ function FilePickButton({
|
|
|
7010
7067
|
className = "",
|
|
7011
7068
|
children
|
|
7012
7069
|
}) {
|
|
7013
|
-
const ref =
|
|
7014
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
7070
|
+
const ref = React45.useRef(null);
|
|
7071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(React45.Fragment, { children: [
|
|
7015
7072
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7016
7073
|
"button",
|
|
7017
7074
|
{
|
|
@@ -7044,10 +7101,10 @@ function FilePickButton({
|
|
|
7044
7101
|
}
|
|
7045
7102
|
function useStagedFiles(upload, opts) {
|
|
7046
7103
|
const o = opts || {};
|
|
7047
|
-
const [items, setItems] =
|
|
7048
|
-
const controllers =
|
|
7104
|
+
const [items, setItems] = React45.useState([]);
|
|
7105
|
+
const controllers = React45.useRef({});
|
|
7049
7106
|
const patch = (id, next) => setItems((list) => list.map((f) => f.id === id ? Object.assign({}, f, next) : f));
|
|
7050
|
-
const run =
|
|
7107
|
+
const run = React45.useCallback((att) => {
|
|
7051
7108
|
if (!upload) return;
|
|
7052
7109
|
const ac = typeof AbortController !== "undefined" ? new AbortController() : null;
|
|
7053
7110
|
controllers.current[att.id] = ac;
|
|
@@ -7064,14 +7121,14 @@ function useStagedFiles(upload, opts) {
|
|
|
7064
7121
|
delete controllers.current[att.id];
|
|
7065
7122
|
});
|
|
7066
7123
|
}, [upload]);
|
|
7067
|
-
const add =
|
|
7124
|
+
const add = React45.useCallback((files) => {
|
|
7068
7125
|
if (!upload) return [];
|
|
7069
7126
|
const atts = Array.from(files).map((f) => toAttachment(f));
|
|
7070
7127
|
setItems((list) => list.concat(atts));
|
|
7071
7128
|
atts.forEach(run);
|
|
7072
7129
|
return atts;
|
|
7073
7130
|
}, [upload, run]);
|
|
7074
|
-
const remove =
|
|
7131
|
+
const remove = React45.useCallback((att) => {
|
|
7075
7132
|
const ac = controllers.current[att.id];
|
|
7076
7133
|
if (ac) {
|
|
7077
7134
|
try {
|
|
@@ -7082,10 +7139,10 @@ function useStagedFiles(upload, opts) {
|
|
|
7082
7139
|
}
|
|
7083
7140
|
setItems((list) => list.filter((f) => f.id !== att.id));
|
|
7084
7141
|
}, []);
|
|
7085
|
-
const retry =
|
|
7142
|
+
const retry = React45.useCallback((att) => {
|
|
7086
7143
|
run(att);
|
|
7087
7144
|
}, [run]);
|
|
7088
|
-
const clear =
|
|
7145
|
+
const clear = React45.useCallback(() => {
|
|
7089
7146
|
Object.values(controllers.current).forEach((ac) => {
|
|
7090
7147
|
try {
|
|
7091
7148
|
ac && ac.abort();
|
|
@@ -7209,7 +7266,7 @@ function FileGrid({ files = [], onOpen, onRemove, onRetry, tiles = true, maxHeig
|
|
|
7209
7266
|
}
|
|
7210
7267
|
|
|
7211
7268
|
// src/components/forms/MarkdownEditor.tsx
|
|
7212
|
-
var
|
|
7269
|
+
var React46 = __toESM(require("react"), 1);
|
|
7213
7270
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
7214
7271
|
var isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent || "");
|
|
7215
7272
|
var INLINE_RE = /(\*\*\*[^*\n]+\*\*\*|\*\*[^*\n]+\*\*|__[^_\n]+__|~~[^~\n]+~~|`[^`\n]+`|\*[^*\s][^*\n]*\*|(?<![A-Za-z0-9_])_[^_\s][^_\n]*_|\[[^\]\n]*\]\([^)\s\n]*\)|https?:\/\/\S+)/g;
|
|
@@ -7423,7 +7480,7 @@ function syncDom(root, value) {
|
|
|
7423
7480
|
while (root.children.length > lines.length) root.removeChild(root.lastChild);
|
|
7424
7481
|
}
|
|
7425
7482
|
var LIST_CONT = RE_LI;
|
|
7426
|
-
var MarkdownEditor =
|
|
7483
|
+
var MarkdownEditor = React46.forwardRef(function MarkdownEditor2({
|
|
7427
7484
|
value = "",
|
|
7428
7485
|
onChange,
|
|
7429
7486
|
onSubmit,
|
|
@@ -7442,10 +7499,10 @@ var MarkdownEditor = React45.forwardRef(function MarkdownEditor2({
|
|
|
7442
7499
|
className = "",
|
|
7443
7500
|
id
|
|
7444
7501
|
}, ref) {
|
|
7445
|
-
const boxRef =
|
|
7446
|
-
const composing =
|
|
7447
|
-
const pendingCaret =
|
|
7448
|
-
|
|
7502
|
+
const boxRef = React46.useRef(null);
|
|
7503
|
+
const composing = React46.useRef(false);
|
|
7504
|
+
const pendingCaret = React46.useRef(null);
|
|
7505
|
+
React46.useLayoutEffect(() => {
|
|
7449
7506
|
const root = boxRef.current;
|
|
7450
7507
|
if (!root || composing.current) return;
|
|
7451
7508
|
const active = document.activeElement === root || root.contains(document.activeElement);
|
|
@@ -7454,7 +7511,7 @@ var MarkdownEditor = React45.forwardRef(function MarkdownEditor2({
|
|
|
7454
7511
|
pendingCaret.current = null;
|
|
7455
7512
|
if (active && caret != null) placeCaret(root, caret);
|
|
7456
7513
|
}, [value]);
|
|
7457
|
-
|
|
7514
|
+
React46.useEffect(() => {
|
|
7458
7515
|
if (autoFocus && boxRef.current) boxRef.current.focus();
|
|
7459
7516
|
}, [autoFocus]);
|
|
7460
7517
|
const caretNow = () => {
|
|
@@ -7521,8 +7578,8 @@ var MarkdownEditor = React45.forwardRef(function MarkdownEditor2({
|
|
|
7521
7578
|
api.replaceRange(from, to, next, from + next.length);
|
|
7522
7579
|
}
|
|
7523
7580
|
};
|
|
7524
|
-
|
|
7525
|
-
const caretAtKeydown =
|
|
7581
|
+
React46.useImperativeHandle(ref, () => api);
|
|
7582
|
+
const caretAtKeydown = React46.useRef(-1);
|
|
7526
7583
|
function detect(text, caret) {
|
|
7527
7584
|
if (!onTrigger) return;
|
|
7528
7585
|
const upto = text.slice(0, caret);
|
|
@@ -7675,7 +7732,7 @@ var MarkdownEditor = React45.forwardRef(function MarkdownEditor2({
|
|
|
7675
7732
|
});
|
|
7676
7733
|
|
|
7677
7734
|
// src/components/forms/CodeEditor.tsx
|
|
7678
|
-
var
|
|
7735
|
+
var React47 = __toESM(require("react"), 1);
|
|
7679
7736
|
var import_view = require("@codemirror/view");
|
|
7680
7737
|
var import_state = require("@codemirror/state");
|
|
7681
7738
|
var import_commands = require("@codemirror/commands");
|
|
@@ -7779,16 +7836,16 @@ function CodeEditor({
|
|
|
7779
7836
|
const fieldId = useFieldId(id);
|
|
7780
7837
|
const descId = fieldId + "-desc";
|
|
7781
7838
|
const liveId = fieldId + "-live";
|
|
7782
|
-
const hostRef =
|
|
7783
|
-
const viewRef =
|
|
7784
|
-
const valueRef =
|
|
7785
|
-
const onChangeRef =
|
|
7839
|
+
const hostRef = React47.useRef(null);
|
|
7840
|
+
const viewRef = React47.useRef(null);
|
|
7841
|
+
const valueRef = React47.useRef(value);
|
|
7842
|
+
const onChangeRef = React47.useRef(onChange);
|
|
7786
7843
|
onChangeRef.current = onChange;
|
|
7787
|
-
const editableCompartment =
|
|
7788
|
-
const attributesCompartment =
|
|
7789
|
-
const errorRef =
|
|
7844
|
+
const editableCompartment = React47.useRef(new import_state.Compartment()).current;
|
|
7845
|
+
const attributesCompartment = React47.useRef(new import_state.Compartment()).current;
|
|
7846
|
+
const errorRef = React47.useRef(error);
|
|
7790
7847
|
errorRef.current = error;
|
|
7791
|
-
const diagnosticsCountRef =
|
|
7848
|
+
const diagnosticsCountRef = React47.useRef(diagnostics.length);
|
|
7792
7849
|
diagnosticsCountRef.current = diagnostics.length;
|
|
7793
7850
|
function contentAttributes() {
|
|
7794
7851
|
return {
|
|
@@ -7798,9 +7855,9 @@ function CodeEditor({
|
|
|
7798
7855
|
...label ? { "aria-label": label } : {}
|
|
7799
7856
|
};
|
|
7800
7857
|
}
|
|
7801
|
-
|
|
7802
|
-
const
|
|
7803
|
-
if (!
|
|
7858
|
+
React47.useEffect(() => {
|
|
7859
|
+
const host2 = hostRef.current;
|
|
7860
|
+
if (!host2) return;
|
|
7804
7861
|
const updateListener = import_view.EditorView.updateListener.of((update) => {
|
|
7805
7862
|
if (!update.docChanged) return;
|
|
7806
7863
|
const next = update.state.doc.toString();
|
|
@@ -7832,7 +7889,7 @@ function CodeEditor({
|
|
|
7832
7889
|
attributesCompartment.of(import_view.EditorView.contentAttributes.of(contentAttributes()))
|
|
7833
7890
|
]
|
|
7834
7891
|
});
|
|
7835
|
-
const view = new import_view.EditorView({ state, parent:
|
|
7892
|
+
const view = new import_view.EditorView({ state, parent: host2 });
|
|
7836
7893
|
viewRef.current = view;
|
|
7837
7894
|
if (autoFocus) view.focus();
|
|
7838
7895
|
return () => {
|
|
@@ -7840,7 +7897,7 @@ function CodeEditor({
|
|
|
7840
7897
|
viewRef.current = null;
|
|
7841
7898
|
};
|
|
7842
7899
|
}, []);
|
|
7843
|
-
|
|
7900
|
+
React47.useEffect(() => {
|
|
7844
7901
|
const view = viewRef.current;
|
|
7845
7902
|
if (!view) return;
|
|
7846
7903
|
const current2 = view.state.doc.toString();
|
|
@@ -7849,12 +7906,12 @@ function CodeEditor({
|
|
|
7849
7906
|
}
|
|
7850
7907
|
valueRef.current = value;
|
|
7851
7908
|
}, [value]);
|
|
7852
|
-
|
|
7909
|
+
React47.useEffect(() => {
|
|
7853
7910
|
const view = viewRef.current;
|
|
7854
7911
|
if (!view) return;
|
|
7855
7912
|
view.dispatch({ effects: editableCompartment.reconfigure(import_view.EditorView.editable.of(!disabled)) });
|
|
7856
7913
|
}, [disabled, editableCompartment]);
|
|
7857
|
-
|
|
7914
|
+
React47.useEffect(() => {
|
|
7858
7915
|
const view = viewRef.current;
|
|
7859
7916
|
if (!view) return;
|
|
7860
7917
|
view.dispatch({
|
|
@@ -7912,16 +7969,16 @@ function CodeEditor({
|
|
|
7912
7969
|
}
|
|
7913
7970
|
|
|
7914
7971
|
// src/components/platform/AccountMenu.tsx
|
|
7915
|
-
var
|
|
7972
|
+
var React49 = __toESM(require("react"), 1);
|
|
7916
7973
|
|
|
7917
7974
|
// src/kits/sessionContext.tsx
|
|
7918
|
-
var
|
|
7919
|
-
var SessionContext =
|
|
7975
|
+
var React48 = __toESM(require("react"), 1);
|
|
7976
|
+
var SessionContext = React48.createContext(null);
|
|
7920
7977
|
function SessionProvider({ value, children }) {
|
|
7921
|
-
return
|
|
7978
|
+
return React48.createElement(SessionContext.Provider, { value }, children);
|
|
7922
7979
|
}
|
|
7923
7980
|
function useSessionContext() {
|
|
7924
|
-
const ctx =
|
|
7981
|
+
const ctx = React48.useContext(SessionContext);
|
|
7925
7982
|
if (!ctx) {
|
|
7926
7983
|
throw new Error(
|
|
7927
7984
|
"useSessionContext() was called outside a <SessionProvider>. Wrap your app root in <SessionProvider value={...}> with your real session, or \u2014 in the docs site or a demo \u2014 in <DemoSessionProvider>, before rendering AccountMenu, Gate, ProfilePage or AppSwitcher."
|
|
@@ -7961,11 +8018,11 @@ function AccountMenu({
|
|
|
7961
8018
|
...rest
|
|
7962
8019
|
}) {
|
|
7963
8020
|
const { user, roles, can: can2, signOut: ctxSignOut, demo, pending } = useSessionContext();
|
|
7964
|
-
const [open2, setOpen] =
|
|
7965
|
-
const [switching, setSwitching] =
|
|
7966
|
-
const [signingOut, setSigningOut] =
|
|
7967
|
-
const [signOutError, setSignOutError] =
|
|
7968
|
-
const ref =
|
|
8021
|
+
const [open2, setOpen] = React49.useState(false);
|
|
8022
|
+
const [switching, setSwitching] = React49.useState(false);
|
|
8023
|
+
const [signingOut, setSigningOut] = React49.useState(false);
|
|
8024
|
+
const [signOutError, setSignOutError] = React49.useState(null);
|
|
8025
|
+
const ref = React49.useRef(null);
|
|
7969
8026
|
const visibleLinks = links.filter((l) => !l.perm || !pending && can2(l.perm));
|
|
7970
8027
|
const visibleGroups = groups.map((g) => ({ label: g.label, links: g.links.filter((l) => !l.perm || !pending && can2(l.perm)) })).filter((g) => g.links.length);
|
|
7971
8028
|
const closeMenu = () => {
|
|
@@ -8090,13 +8147,13 @@ function AccountMenu({
|
|
|
8090
8147
|
}
|
|
8091
8148
|
|
|
8092
8149
|
// src/components/platform/AppSwitcher.tsx
|
|
8093
|
-
var
|
|
8150
|
+
var React50 = __toESM(require("react"), 1);
|
|
8094
8151
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
8095
8152
|
function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
8096
8153
|
const { apps: contextApps } = useSessionContext();
|
|
8097
8154
|
const apps = appsProp ?? contextApps ?? [];
|
|
8098
|
-
const [open2, setOpen] =
|
|
8099
|
-
const anchorRef =
|
|
8155
|
+
const [open2, setOpen] = React50.useState(false);
|
|
8156
|
+
const anchorRef = React50.useRef(null);
|
|
8100
8157
|
if (!apps.length) return null;
|
|
8101
8158
|
const items = apps.map((app) => ({
|
|
8102
8159
|
id: app.key,
|
|
@@ -8110,7 +8167,7 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
|
8110
8167
|
window.location.href = app.url;
|
|
8111
8168
|
}
|
|
8112
8169
|
}));
|
|
8113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
8170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(React50.Fragment, { children: [
|
|
8114
8171
|
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { ref: anchorRef, className: ["fd-appswitch-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
8115
8172
|
IconButton,
|
|
8116
8173
|
{
|
|
@@ -8139,10 +8196,10 @@ function AppSwitcher({ apps: appsProp, onNavigate, className = "" }) {
|
|
|
8139
8196
|
}
|
|
8140
8197
|
|
|
8141
8198
|
// src/components/platform/AppearanceMenu.tsx
|
|
8142
|
-
var
|
|
8199
|
+
var React52 = __toESM(require("react"), 1);
|
|
8143
8200
|
|
|
8144
8201
|
// src/kits/appearance.ts
|
|
8145
|
-
var
|
|
8202
|
+
var React51 = __toESM(require("react"), 1);
|
|
8146
8203
|
var DEFAULT_STORAGE_KEY = "fd-appearance";
|
|
8147
8204
|
var DEFAULT_PREFS = {
|
|
8148
8205
|
theme: "system",
|
|
@@ -8237,11 +8294,11 @@ function applyPrefs(prefs, root = document.documentElement) {
|
|
|
8237
8294
|
else root.removeAttribute("data-motion");
|
|
8238
8295
|
}
|
|
8239
8296
|
function useAppearancePrefs(store) {
|
|
8240
|
-
const prefs =
|
|
8241
|
-
|
|
8297
|
+
const prefs = React51.useSyncExternalStore(store.subscribe, store.getSnapshot);
|
|
8298
|
+
React51.useEffect(() => {
|
|
8242
8299
|
applyPrefs(prefs);
|
|
8243
8300
|
}, [prefs]);
|
|
8244
|
-
|
|
8301
|
+
React51.useEffect(() => {
|
|
8245
8302
|
if (prefs.theme !== "system" || typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
8246
8303
|
return;
|
|
8247
8304
|
}
|
|
@@ -8250,7 +8307,7 @@ function useAppearancePrefs(store) {
|
|
|
8250
8307
|
mq.addEventListener("change", onChange);
|
|
8251
8308
|
return () => mq.removeEventListener("change", onChange);
|
|
8252
8309
|
}, [prefs]);
|
|
8253
|
-
const update =
|
|
8310
|
+
const update = React51.useCallback(
|
|
8254
8311
|
(patch) => {
|
|
8255
8312
|
store.write({ ...store.getSnapshot(), ...patch });
|
|
8256
8313
|
},
|
|
@@ -8273,15 +8330,15 @@ var TEXT_SCALE_OPTIONS = [
|
|
|
8273
8330
|
{ value: "xl", label: "XL" }
|
|
8274
8331
|
];
|
|
8275
8332
|
function AppearanceMenu({ className = "", store: storeProp, storageKey, storage, defaults }) {
|
|
8276
|
-
const store =
|
|
8333
|
+
const store = React52.useMemo(
|
|
8277
8334
|
() => storeProp ?? createLocalStorageAppearanceStore({ storageKey, storage, defaults }),
|
|
8278
8335
|
[storeProp, storageKey, storage, defaults]
|
|
8279
8336
|
);
|
|
8280
8337
|
const [prefs, update] = useAppearancePrefs(store);
|
|
8281
|
-
const [open2, setOpen] =
|
|
8282
|
-
const anchorRef =
|
|
8338
|
+
const [open2, setOpen] = React52.useState(false);
|
|
8339
|
+
const anchorRef = React52.useRef(null);
|
|
8283
8340
|
const patch = (p) => update(p);
|
|
8284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
8341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(React52.Fragment, { children: [
|
|
8285
8342
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { ref: anchorRef, className: ["fd-appearance-anchor", className].filter(Boolean).join(" "), style: { display: "inline-flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
8286
8343
|
IconButton,
|
|
8287
8344
|
{
|
|
@@ -8350,14 +8407,14 @@ function AppearanceMenu({ className = "", store: storeProp, storageKey, storage,
|
|
|
8350
8407
|
}
|
|
8351
8408
|
|
|
8352
8409
|
// src/components/platform/ApiSpecBrowser.tsx
|
|
8353
|
-
var
|
|
8410
|
+
var React53 = __toESM(require("react"), 1);
|
|
8354
8411
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
8355
8412
|
var METHOD_TONE = { GET: "success", POST: "info", PATCH: "warning", PUT: "warning", DELETE: "danger" };
|
|
8356
8413
|
function Json({ obj }) {
|
|
8357
8414
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("pre", { className: "fd-json", children: JSON.stringify(obj, null, 2) });
|
|
8358
8415
|
}
|
|
8359
8416
|
function Endpoint({ s, onRequest }) {
|
|
8360
|
-
const [tried, setTried] =
|
|
8417
|
+
const [tried, setTried] = React53.useState(null);
|
|
8361
8418
|
const run = async () => {
|
|
8362
8419
|
setTried("busy");
|
|
8363
8420
|
const t0 = (window.performance || Date).now();
|
|
@@ -8430,10 +8487,10 @@ function ApiSpecBrowser({
|
|
|
8430
8487
|
className = "",
|
|
8431
8488
|
...rest
|
|
8432
8489
|
}) {
|
|
8433
|
-
const [q, setQ] =
|
|
8434
|
-
const [method, setMethod] =
|
|
8435
|
-
const [mod, setMod] =
|
|
8436
|
-
const [listOnly, setListOnly] =
|
|
8490
|
+
const [q, setQ] = React53.useState("");
|
|
8491
|
+
const [method, setMethod] = React53.useState(null);
|
|
8492
|
+
const [mod, setMod] = React53.useState(null);
|
|
8493
|
+
const [listOnly, setListOnly] = React53.useState(false);
|
|
8437
8494
|
const activeModule = modules && modules.find((m) => m.id === mod);
|
|
8438
8495
|
const hits = spec.filter((s) => (!method || s.method === method) && (!listOnly || s.isList) && (!activeModule || activeModule.endpoints.indexOf(s.id) >= 0) && (!q || (s.path + " " + s.title + " " + s.purpose + " " + (s.usedBy || []).join(" ")).toLowerCase().includes(q.toLowerCase())));
|
|
8439
8496
|
const effGroups = groups && groups.length ? groups : [["All endpoints", spec.map((s) => s.id)]];
|
|
@@ -8512,7 +8569,7 @@ function ApiSpecBrowser({
|
|
|
8512
8569
|
}
|
|
8513
8570
|
|
|
8514
8571
|
// src/components/platform/ProfilePage.tsx
|
|
8515
|
-
var
|
|
8572
|
+
var React54 = __toESM(require("react"), 1);
|
|
8516
8573
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
8517
8574
|
function fieldInitialValue(field, user) {
|
|
8518
8575
|
if (field.value) return field.value(user);
|
|
@@ -8548,21 +8605,21 @@ function ProfilePage({
|
|
|
8548
8605
|
}) {
|
|
8549
8606
|
const { user: sessionUser, roles, permissions, saveProfile: saveProfile2 } = useSessionContext();
|
|
8550
8607
|
const user = userProp || sessionUser;
|
|
8551
|
-
const initialFieldValues =
|
|
8608
|
+
const initialFieldValues = React54.useMemo(() => {
|
|
8552
8609
|
const values2 = {};
|
|
8553
8610
|
for (const field of fields) values2[field.key] = fieldInitialValue(field, user);
|
|
8554
8611
|
return values2;
|
|
8555
8612
|
}, [user.id, fields]);
|
|
8556
|
-
const initialNotify =
|
|
8613
|
+
const initialNotify = React54.useMemo(() => {
|
|
8557
8614
|
const values2 = {};
|
|
8558
8615
|
for (const n of notifications) values2[n.key] = !!user.notify?.[n.key];
|
|
8559
8616
|
return values2;
|
|
8560
8617
|
}, [user.id, notifications]);
|
|
8561
|
-
const [values, setValues] =
|
|
8562
|
-
const [notify, setNotify] =
|
|
8563
|
-
const [saving, setSaving] =
|
|
8564
|
-
const [saved, setSaved] =
|
|
8565
|
-
const [prevUserId, setPrevUserId] =
|
|
8618
|
+
const [values, setValues] = React54.useState(initialFieldValues);
|
|
8619
|
+
const [notify, setNotify] = React54.useState(initialNotify);
|
|
8620
|
+
const [saving, setSaving] = React54.useState(false);
|
|
8621
|
+
const [saved, setSaved] = React54.useState(false);
|
|
8622
|
+
const [prevUserId, setPrevUserId] = React54.useState(user.id);
|
|
8566
8623
|
if (user.id !== prevUserId) {
|
|
8567
8624
|
setPrevUserId(user.id);
|
|
8568
8625
|
setValues(initialFieldValues);
|
|
@@ -8750,11 +8807,11 @@ function ProfilePage({
|
|
|
8750
8807
|
}
|
|
8751
8808
|
|
|
8752
8809
|
// src/components/platform/SignInPage.tsx
|
|
8753
|
-
var
|
|
8810
|
+
var React55 = __toESM(require("react"), 1);
|
|
8754
8811
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
8755
8812
|
function SignInPage({ productName, onSignIn, continueAs, error }) {
|
|
8756
|
-
const [signingIn, setSigningIn] =
|
|
8757
|
-
const [resuming, setResuming] =
|
|
8813
|
+
const [signingIn, setSigningIn] = React55.useState(false);
|
|
8814
|
+
const [resuming, setResuming] = React55.useState(false);
|
|
8758
8815
|
function handleSignIn() {
|
|
8759
8816
|
setSigningIn(true);
|
|
8760
8817
|
onSignIn();
|
|
@@ -8943,10 +9000,10 @@ function GoogleGlyph() {
|
|
|
8943
9000
|
}
|
|
8944
9001
|
|
|
8945
9002
|
// src/components/platform/RoadmapTimeline.tsx
|
|
8946
|
-
var
|
|
9003
|
+
var React58 = __toESM(require("react"), 1);
|
|
8947
9004
|
|
|
8948
9005
|
// src/kits/session.ts
|
|
8949
|
-
var
|
|
9006
|
+
var React56 = __toESM(require("react"), 1);
|
|
8950
9007
|
var PERMISSION_CATALOG = [
|
|
8951
9008
|
{ group: "Plans", items: [
|
|
8952
9009
|
{ key: "plan.view", label: "View plans", detail: "Read any plan in the workspace." },
|
|
@@ -10513,8 +10570,8 @@ function roadmap(overrides) {
|
|
|
10513
10570
|
};
|
|
10514
10571
|
}
|
|
10515
10572
|
function useSession() {
|
|
10516
|
-
const [s, setS] =
|
|
10517
|
-
|
|
10573
|
+
const [s, setS] = React56.useState(getSession);
|
|
10574
|
+
React56.useEffect(() => subscribe(setS), []);
|
|
10518
10575
|
return s;
|
|
10519
10576
|
}
|
|
10520
10577
|
var SessionKit = {
|
|
@@ -10547,7 +10604,7 @@ var SessionKit = {
|
|
|
10547
10604
|
};
|
|
10548
10605
|
function DemoSessionProvider({ children }) {
|
|
10549
10606
|
const session = useSession();
|
|
10550
|
-
const value =
|
|
10607
|
+
const value = React56.useMemo(
|
|
10551
10608
|
() => ({
|
|
10552
10609
|
user: session.user,
|
|
10553
10610
|
roles: session.roles,
|
|
@@ -10563,11 +10620,11 @@ function DemoSessionProvider({ children }) {
|
|
|
10563
10620
|
}),
|
|
10564
10621
|
[session]
|
|
10565
10622
|
);
|
|
10566
|
-
return
|
|
10623
|
+
return React56.createElement(SessionProvider, { value }, children);
|
|
10567
10624
|
}
|
|
10568
10625
|
|
|
10569
10626
|
// src/kits/runtime.ts
|
|
10570
|
-
var
|
|
10627
|
+
var React57 = __toESM(require("react"), 1);
|
|
10571
10628
|
var WIRED_ENDPOINTS = [
|
|
10572
10629
|
// Nothing yet. Every id below would come from a real service:
|
|
10573
10630
|
// "plan.get", "placements.list", …
|
|
@@ -10738,8 +10795,8 @@ var RuntimeKit = {
|
|
|
10738
10795
|
};
|
|
10739
10796
|
RuntimeKit.declare(FEATURE_NEEDS);
|
|
10740
10797
|
function useRuntimeMode() {
|
|
10741
|
-
const [m, setM] =
|
|
10742
|
-
|
|
10798
|
+
const [m, setM] = React57.useState(RuntimeKit.getMode());
|
|
10799
|
+
React57.useEffect(() => RuntimeKit.subscribe(setM), []);
|
|
10743
10800
|
return m;
|
|
10744
10801
|
}
|
|
10745
10802
|
function useFeatureStatus(key) {
|
|
@@ -10822,12 +10879,12 @@ function RoadmapCard({ item, byKey, onOpenFlag }) {
|
|
|
10822
10879
|
}
|
|
10823
10880
|
function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
10824
10881
|
const session = SessionKit.useSession();
|
|
10825
|
-
const [project, setProject] =
|
|
10826
|
-
const [q, setQ] =
|
|
10827
|
-
const scrollRef =
|
|
10828
|
-
const nowRef =
|
|
10829
|
-
const rm =
|
|
10830
|
-
const byKey =
|
|
10882
|
+
const [project, setProject] = React58.useState("");
|
|
10883
|
+
const [q, setQ] = React58.useState("");
|
|
10884
|
+
const scrollRef = React58.useRef(null);
|
|
10885
|
+
const nowRef = React58.useRef(null);
|
|
10886
|
+
const rm = React58.useMemo(() => SessionKit.roadmap({ isComplete: RuntimeKit.isComplete }), [session]);
|
|
10887
|
+
const byKey = React58.useMemo(() => {
|
|
10831
10888
|
const m = {};
|
|
10832
10889
|
rm.items.forEach((i) => {
|
|
10833
10890
|
m[i.key] = i;
|
|
@@ -10836,7 +10893,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
10836
10893
|
}, [rm]);
|
|
10837
10894
|
const items = rm.items.filter((i) => (!project || i.project === project) && (!q || (i.label + " " + i.description + " " + (i.backend || "") + " " + i.key).toLowerCase().includes(q.toLowerCase())));
|
|
10838
10895
|
const projects = [...new Set(rm.items.map((i) => i.project))];
|
|
10839
|
-
|
|
10896
|
+
React58.useEffect(() => {
|
|
10840
10897
|
let raf1 = 0, raf2 = 0;
|
|
10841
10898
|
const place = () => {
|
|
10842
10899
|
const box = scrollRef.current, mark = nowRef.current;
|
|
@@ -10910,7 +10967,7 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
10910
10967
|
lastPhase = item.phase;
|
|
10911
10968
|
const inPhase = items.filter((i) => i.phase === item.phase).length;
|
|
10912
10969
|
const isBoundary = n === firstPending;
|
|
10913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(React58.Fragment, { children: [
|
|
10914
10971
|
showPhase ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fd-rm-era", children: [
|
|
10915
10972
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("span", { className: "fd-row", style: { gap: 8, flexWrap: "wrap", alignItems: "baseline" }, children: [
|
|
10916
10973
|
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { style: { fontWeight: 700 }, children: item.phase === 0 ? "Shipped" : "Phase " + item.phase + " \u2014 " + item.phaseName }),
|
|
@@ -10954,8 +11011,8 @@ function RoadmapTimeline({ onOpenFlag, title = "Roadmap", lede }) {
|
|
|
10954
11011
|
}
|
|
10955
11012
|
|
|
10956
11013
|
// src/components/platform/ComingSoon.tsx
|
|
10957
|
-
var
|
|
10958
|
-
var
|
|
11014
|
+
var React59 = __toESM(require("react"), 1);
|
|
11015
|
+
var import_react_dom7 = require("react-dom");
|
|
10959
11016
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
10960
11017
|
var BYPASS_STORE = "fd.soon.bypass.v1";
|
|
10961
11018
|
function readBypassed() {
|
|
@@ -10972,8 +11029,8 @@ function writeBypassed(list) {
|
|
|
10972
11029
|
}
|
|
10973
11030
|
}
|
|
10974
11031
|
function useBypass(key) {
|
|
10975
|
-
const [on, setOn] =
|
|
10976
|
-
|
|
11032
|
+
const [on, setOn] = React59.useState(() => !!key && readBypassed().indexOf(key) >= 0);
|
|
11033
|
+
React59.useEffect(() => {
|
|
10977
11034
|
setOn(!!key && readBypassed().indexOf(key) >= 0);
|
|
10978
11035
|
}, [key]);
|
|
10979
11036
|
const set = (next) => {
|
|
@@ -11020,9 +11077,9 @@ function SoonCard({ label, detail, backend, eta, effort, onRoadmap, allowed, onB
|
|
|
11020
11077
|
] });
|
|
11021
11078
|
}
|
|
11022
11079
|
function useHoverCard(open2) {
|
|
11023
|
-
const anchor =
|
|
11024
|
-
const [pos, setPos] =
|
|
11025
|
-
|
|
11080
|
+
const anchor = React59.useRef(null);
|
|
11081
|
+
const [pos, setPos] = React59.useState(null);
|
|
11082
|
+
React59.useLayoutEffect(() => {
|
|
11026
11083
|
if (!open2 || !anchor.current) {
|
|
11027
11084
|
setPos(null);
|
|
11028
11085
|
return;
|
|
@@ -11149,12 +11206,12 @@ function ComingSoon({
|
|
|
11149
11206
|
] });
|
|
11150
11207
|
}
|
|
11151
11208
|
function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, onBypass, blur, tip, className, rest, children }) {
|
|
11152
|
-
const [open2, setOpen] =
|
|
11209
|
+
const [open2, setOpen] = React59.useState(false);
|
|
11153
11210
|
const [anchor, pos] = useHoverCard(open2);
|
|
11154
|
-
const hoverCardRef =
|
|
11211
|
+
const hoverCardRef = React59.useRef(null);
|
|
11155
11212
|
const hoverLayer = useStackedLayer({ active: open2, containerRef: hoverCardRef, returnFocus: false });
|
|
11156
11213
|
const zIndex = useLayerZIndex(hoverLayer);
|
|
11157
|
-
const close2 =
|
|
11214
|
+
const close2 = React59.useRef(null);
|
|
11158
11215
|
const show = () => {
|
|
11159
11216
|
if (close2.current) {
|
|
11160
11217
|
clearTimeout(close2.current);
|
|
@@ -11170,7 +11227,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
|
|
|
11170
11227
|
setOpen(false);
|
|
11171
11228
|
}, 140);
|
|
11172
11229
|
};
|
|
11173
|
-
|
|
11230
|
+
React59.useEffect(() => () => {
|
|
11174
11231
|
if (close2.current) clearTimeout(close2.current);
|
|
11175
11232
|
}, []);
|
|
11176
11233
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
@@ -11199,7 +11256,7 @@ function InlineSoon({ label, detail, backend, eta, effort, onRoadmap, allowed, o
|
|
|
11199
11256
|
children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("i", { className: "ph ph-traffic-cone", "aria-hidden": "true" })
|
|
11200
11257
|
}
|
|
11201
11258
|
),
|
|
11202
|
-
open2 && pos ? (0,
|
|
11259
|
+
open2 && pos ? (0, import_react_dom7.createPortal)(
|
|
11203
11260
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
11204
11261
|
"div",
|
|
11205
11262
|
{
|
|
@@ -11622,7 +11679,7 @@ function SaturationDistribution({ campuses = [], floorBand, floorScore, onSelect
|
|
|
11622
11679
|
}
|
|
11623
11680
|
|
|
11624
11681
|
// src/components/planner/MixGap.tsx
|
|
11625
|
-
var
|
|
11682
|
+
var React60 = __toESM(require("react"), 1);
|
|
11626
11683
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
11627
11684
|
var MIX_GAP_LAYOUT = {
|
|
11628
11685
|
trackHeight: 30,
|
|
@@ -11637,7 +11694,7 @@ function mixGapOffset(value, max) {
|
|
|
11637
11694
|
}
|
|
11638
11695
|
function MixGap({ rows = [], loading = false, className = "" }) {
|
|
11639
11696
|
const max = Math.max(1, ...rows.flatMap((r) => [r.target, r.realized]));
|
|
11640
|
-
const [hover, setHover] =
|
|
11697
|
+
const [hover, setHover] = React60.useState(null);
|
|
11641
11698
|
const toneOf = (gap) => gap >= -1 ? "ok" : gap >= -4 ? "warn" : "danger";
|
|
11642
11699
|
const TONE = { ok: "var(--ok-solid)", warn: "var(--warn-solid)", danger: "var(--danger-solid)" };
|
|
11643
11700
|
const { trackHeight, barHeight, targetWidth, labelGap } = MIX_GAP_LAYOUT;
|
|
@@ -11780,7 +11837,7 @@ function ChannelContribution({
|
|
|
11780
11837
|
}
|
|
11781
11838
|
|
|
11782
11839
|
// src/components/planner/BudgetReallocator.tsx
|
|
11783
|
-
var
|
|
11840
|
+
var React61 = __toESM(require("react"), 1);
|
|
11784
11841
|
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
11785
11842
|
var bandFor = (crp) => crp >= 200 ? "dominant" : crp >= 100 ? "strong" : crp >= 50 ? "adequate" : "weak";
|
|
11786
11843
|
function BudgetReallocator({
|
|
@@ -11796,8 +11853,8 @@ function BudgetReallocator({
|
|
|
11796
11853
|
onCancel,
|
|
11797
11854
|
className = ""
|
|
11798
11855
|
}) {
|
|
11799
|
-
const [draft, setDraft] =
|
|
11800
|
-
|
|
11856
|
+
const [draft, setDraft] = React61.useState(spend);
|
|
11857
|
+
React61.useEffect(() => setDraft(spend), [spend]);
|
|
11801
11858
|
const dirty = draft !== spend;
|
|
11802
11859
|
const nextCrp = scoreFor ? scoreFor(draft) : crp;
|
|
11803
11860
|
const nextBand = bandFor(nextCrp);
|
|
@@ -11812,10 +11869,10 @@ function BudgetReallocator({
|
|
|
11812
11869
|
setDraft(spend);
|
|
11813
11870
|
if (onCancel) onCancel();
|
|
11814
11871
|
};
|
|
11815
|
-
const trackRef =
|
|
11816
|
-
const chipRef =
|
|
11817
|
-
const [chipLeft, setChipLeft] =
|
|
11818
|
-
|
|
11872
|
+
const trackRef = React61.useRef(null);
|
|
11873
|
+
const chipRef = React61.useRef(null);
|
|
11874
|
+
const [chipLeft, setChipLeft] = React61.useState(null);
|
|
11875
|
+
React61.useLayoutEffect(() => {
|
|
11819
11876
|
const track = trackRef.current;
|
|
11820
11877
|
if (!dirty || !track) {
|
|
11821
11878
|
setChipLeft(null);
|
|
@@ -12003,7 +12060,7 @@ function ImportanceTag({ level, showLabel = true, size = "sm", className = "", d
|
|
|
12003
12060
|
}
|
|
12004
12061
|
|
|
12005
12062
|
// src/components/planner/PreferenceMeter.tsx
|
|
12006
|
-
var
|
|
12063
|
+
var React62 = __toESM(require("react"), 1);
|
|
12007
12064
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12008
12065
|
function preferenceScore(criteria) {
|
|
12009
12066
|
const earned = criteria.reduce((n, c) => n + (Number(c.earned) || 0), 0);
|
|
@@ -12033,7 +12090,7 @@ function PreferenceMeter({
|
|
|
12033
12090
|
className = ""
|
|
12034
12091
|
}) {
|
|
12035
12092
|
const value = score == null ? preferenceScore(criteria) : score;
|
|
12036
|
-
const segments =
|
|
12093
|
+
const segments = React62.useMemo(() => preferenceSegments(criteria), [criteria]);
|
|
12037
12094
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
12038
12095
|
ScoreMeter,
|
|
12039
12096
|
{
|
|
@@ -12072,10 +12129,10 @@ function PreferenceMeter({
|
|
|
12072
12129
|
}
|
|
12073
12130
|
|
|
12074
12131
|
// src/components/chat/AgentChatPanel.tsx
|
|
12075
|
-
var
|
|
12132
|
+
var React68 = __toESM(require("react"), 1);
|
|
12076
12133
|
|
|
12077
12134
|
// src/components/chat/chatEngine.ts
|
|
12078
|
-
var
|
|
12135
|
+
var React63 = __toESM(require("react"), 1);
|
|
12079
12136
|
var CHAT_UNAVAILABLE = "chat_unavailable";
|
|
12080
12137
|
var JOB_PENDING = ["queued", "running"];
|
|
12081
12138
|
var JOB_SUCCESS = ["completed", "recovered"];
|
|
@@ -12129,22 +12186,22 @@ function useChatEngine(opts) {
|
|
|
12129
12186
|
onClear,
|
|
12130
12187
|
onFeedback
|
|
12131
12188
|
} = opts || {};
|
|
12132
|
-
const [status, setStatus] =
|
|
12133
|
-
const [threadId, setThreadId] =
|
|
12134
|
-
const [messages, setMessages] =
|
|
12135
|
-
const [queue, setQueue] =
|
|
12136
|
-
const [fatal, setFatal] =
|
|
12137
|
-
const [busy, setBusy] =
|
|
12138
|
-
const [turnStartedAt, setTurnStartedAt] =
|
|
12139
|
-
const listRef =
|
|
12140
|
-
const queueRef =
|
|
12141
|
-
const busyRef =
|
|
12142
|
-
const stoppedRef =
|
|
12143
|
-
const abortRef =
|
|
12144
|
-
const serverCount =
|
|
12145
|
-
const threadRef =
|
|
12146
|
-
const mounted =
|
|
12147
|
-
|
|
12189
|
+
const [status, setStatus] = React63.useState("idle");
|
|
12190
|
+
const [threadId, setThreadId] = React63.useState(null);
|
|
12191
|
+
const [messages, setMessages] = React63.useState([]);
|
|
12192
|
+
const [queue, setQueue] = React63.useState([]);
|
|
12193
|
+
const [fatal, setFatal] = React63.useState(null);
|
|
12194
|
+
const [busy, setBusy] = React63.useState(false);
|
|
12195
|
+
const [turnStartedAt, setTurnStartedAt] = React63.useState(null);
|
|
12196
|
+
const listRef = React63.useRef([]);
|
|
12197
|
+
const queueRef = React63.useRef([]);
|
|
12198
|
+
const busyRef = React63.useRef(false);
|
|
12199
|
+
const stoppedRef = React63.useRef(false);
|
|
12200
|
+
const abortRef = React63.useRef(null);
|
|
12201
|
+
const serverCount = React63.useRef(0);
|
|
12202
|
+
const threadRef = React63.useRef(null);
|
|
12203
|
+
const mounted = React63.useRef(true);
|
|
12204
|
+
React63.useEffect(() => {
|
|
12148
12205
|
mounted.current = true;
|
|
12149
12206
|
return () => {
|
|
12150
12207
|
mounted.current = false;
|
|
@@ -12166,14 +12223,14 @@ function useChatEngine(opts) {
|
|
|
12166
12223
|
}
|
|
12167
12224
|
return false;
|
|
12168
12225
|
};
|
|
12169
|
-
const loadThread =
|
|
12226
|
+
const loadThread = React63.useCallback(async (id) => {
|
|
12170
12227
|
const data = await apiAdapter.getThread(id);
|
|
12171
12228
|
const list = [...data && data.messages || []];
|
|
12172
12229
|
serverCount.current = list.length;
|
|
12173
12230
|
commit(list);
|
|
12174
12231
|
return list;
|
|
12175
12232
|
}, [apiAdapter]);
|
|
12176
|
-
|
|
12233
|
+
React63.useEffect(() => {
|
|
12177
12234
|
if (!apiAdapter) {
|
|
12178
12235
|
setStatus("idle");
|
|
12179
12236
|
setFatal(null);
|
|
@@ -12386,7 +12443,7 @@ function useChatEngine(opts) {
|
|
|
12386
12443
|
await dispatchTurn(turn);
|
|
12387
12444
|
}
|
|
12388
12445
|
}
|
|
12389
|
-
const send =
|
|
12446
|
+
const send = React63.useCallback((text, attachments) => {
|
|
12390
12447
|
const body = (text || "").trim();
|
|
12391
12448
|
if (!body && !(attachments && attachments.length)) return;
|
|
12392
12449
|
if (status === "disconnected") return;
|
|
@@ -12396,7 +12453,7 @@ function useChatEngine(opts) {
|
|
|
12396
12453
|
stoppedRef.current = false;
|
|
12397
12454
|
drain();
|
|
12398
12455
|
}, [status]);
|
|
12399
|
-
const stop =
|
|
12456
|
+
const stop = React63.useCallback(() => {
|
|
12400
12457
|
stoppedRef.current = true;
|
|
12401
12458
|
const ac = abortRef.current;
|
|
12402
12459
|
if (ac) {
|
|
@@ -12415,11 +12472,11 @@ function useChatEngine(opts) {
|
|
|
12415
12472
|
store.del(STORAGE_PREFIX + threadRef.current);
|
|
12416
12473
|
}
|
|
12417
12474
|
}, [apiAdapter]);
|
|
12418
|
-
const removeQueued =
|
|
12475
|
+
const removeQueued = React63.useCallback((id) => {
|
|
12419
12476
|
queueRef.current = queueRef.current.filter((t) => t.id !== id);
|
|
12420
12477
|
setQueue(queueRef.current.slice());
|
|
12421
12478
|
}, []);
|
|
12422
|
-
const retry =
|
|
12479
|
+
const retry = React63.useCallback(() => {
|
|
12423
12480
|
const list = listRef.current;
|
|
12424
12481
|
let at = -1;
|
|
12425
12482
|
for (let i = list.length - 1; i >= 0; i--) if (list[i].role === "user") {
|
|
@@ -12435,19 +12492,19 @@ function useChatEngine(opts) {
|
|
|
12435
12492
|
setQueue(queueRef.current.slice());
|
|
12436
12493
|
drain();
|
|
12437
12494
|
}, []);
|
|
12438
|
-
const clear =
|
|
12495
|
+
const clear = React63.useCallback(() => {
|
|
12439
12496
|
commit([]);
|
|
12440
12497
|
serverCount.current = 0;
|
|
12441
12498
|
queueRef.current = [];
|
|
12442
12499
|
setQueue([]);
|
|
12443
12500
|
onClear && onClear();
|
|
12444
12501
|
}, [onClear]);
|
|
12445
|
-
const setFeedback =
|
|
12502
|
+
const setFeedback = React63.useCallback((id, value) => {
|
|
12446
12503
|
patch(id, (m) => ({ feedback: m.feedback === value ? null : value }));
|
|
12447
12504
|
const msg = listRef.current.find((m) => m.id === id);
|
|
12448
12505
|
onFeedback && onFeedback({ message: msg, feedback: msg ? msg.feedback : value });
|
|
12449
12506
|
}, [onFeedback]);
|
|
12450
|
-
const reload =
|
|
12507
|
+
const reload = React63.useCallback(async () => {
|
|
12451
12508
|
if (!threadRef.current) return;
|
|
12452
12509
|
setStatus("loading");
|
|
12453
12510
|
try {
|
|
@@ -12485,10 +12542,10 @@ var ChatKit = {
|
|
|
12485
12542
|
};
|
|
12486
12543
|
|
|
12487
12544
|
// src/components/chat/ChatTranscript.tsx
|
|
12488
|
-
var
|
|
12545
|
+
var React65 = __toESM(require("react"), 1);
|
|
12489
12546
|
|
|
12490
12547
|
// src/components/chat/ChatTurn.tsx
|
|
12491
|
-
var
|
|
12548
|
+
var React64 = __toESM(require("react"), 1);
|
|
12492
12549
|
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
12493
12550
|
function JsonView({ value }) {
|
|
12494
12551
|
let text;
|
|
@@ -12525,7 +12582,7 @@ function PacketCard({ packet, schema, render, onApply, applied }) {
|
|
|
12525
12582
|
] });
|
|
12526
12583
|
}
|
|
12527
12584
|
function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
|
|
12528
|
-
const [open2, setOpen] =
|
|
12585
|
+
const [open2, setOpen] = React64.useState(defaultOpen);
|
|
12529
12586
|
if (!text) return null;
|
|
12530
12587
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fdc-think" + (open2 ? " is-open" : ""), children: [
|
|
12531
12588
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("button", { type: "button", className: "fdc-think-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
|
|
@@ -12542,7 +12599,7 @@ function ThinkingBlock({ text, durationMs, streaming, defaultOpen = false }) {
|
|
|
12542
12599
|
] });
|
|
12543
12600
|
}
|
|
12544
12601
|
function Citations({ items = [], onOpen }) {
|
|
12545
|
-
const [open2, setOpen] =
|
|
12602
|
+
const [open2, setOpen] = React64.useState(false);
|
|
12546
12603
|
if (!items.length) return null;
|
|
12547
12604
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fdc-cites", children: [
|
|
12548
12605
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("button", { type: "button", className: "fdc-cites-head", onClick: () => setOpen((v) => !v), "aria-expanded": open2, children: [
|
|
@@ -12568,7 +12625,7 @@ function clampText(text, max) {
|
|
|
12568
12625
|
return (at > max * 0.6 ? cut.slice(0, at) : cut).trimEnd() + "\u2026";
|
|
12569
12626
|
}
|
|
12570
12627
|
function MessageBody({ message: m, ctx }) {
|
|
12571
|
-
const [expanded, setExpanded] =
|
|
12628
|
+
const [expanded, setExpanded] = React64.useState(false);
|
|
12572
12629
|
const isUser = m.role === "user";
|
|
12573
12630
|
const raw = m.text || "";
|
|
12574
12631
|
const clamped = !expanded && !m.streaming ? clampText(raw, ctx.maxVisibleChars) : null;
|
|
@@ -12648,7 +12705,7 @@ function RunActions({ group, ctx }) {
|
|
|
12648
12705
|
] }),
|
|
12649
12706
|
isAssistant && ctx.onRetry ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", className: "fdc-act", onClick: ctx.onRetry, "aria-label": "Retry this turn", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("i", { className: "ph ph-arrow-clockwise", "aria-hidden": "true" }) }) : null,
|
|
12650
12707
|
group.role === "user" && ctx.onEdit ? /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", className: "fdc-act", onClick: () => ctx.onEdit(last), "aria-label": "Edit and resend", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("i", { className: "ph ph-pencil-simple", "aria-hidden": "true" }) }) : null,
|
|
12651
|
-
isAssistant && ctx.onFeedback ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
|
|
12708
|
+
isAssistant && ctx.onFeedback ? /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(React64.Fragment, { children: [
|
|
12652
12709
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", className: "fdc-act" + (fb === "up" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "up"), "aria-pressed": fb === "up", "aria-label": "Good response", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("i", { className: "ph ph-thumbs-up", "aria-hidden": "true" }) }),
|
|
12653
12710
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", className: "fdc-act" + (fb === "down" ? " is-on" : ""), onClick: () => ctx.onFeedback(last.id, "down"), "aria-pressed": fb === "down", "aria-label": "Bad response", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("i", { className: "ph ph-thumbs-down", "aria-hidden": "true" }) })
|
|
12654
12711
|
] }) : null,
|
|
@@ -12743,10 +12800,10 @@ function ChatTranscript({
|
|
|
12743
12800
|
renderEmpty,
|
|
12744
12801
|
className = ""
|
|
12745
12802
|
}) {
|
|
12746
|
-
const scroller =
|
|
12747
|
-
const stick =
|
|
12748
|
-
const [pill, setPill] =
|
|
12749
|
-
const seen =
|
|
12803
|
+
const scroller = React65.useRef(null);
|
|
12804
|
+
const stick = React65.useRef(true);
|
|
12805
|
+
const [pill, setPill] = React65.useState(0);
|
|
12806
|
+
const seen = React65.useRef(0);
|
|
12750
12807
|
const toBottom = (smooth) => {
|
|
12751
12808
|
const el = scroller.current;
|
|
12752
12809
|
if (!el) return;
|
|
@@ -12765,7 +12822,7 @@ function ChatTranscript({
|
|
|
12765
12822
|
seen.current = messages.length;
|
|
12766
12823
|
}
|
|
12767
12824
|
};
|
|
12768
|
-
|
|
12825
|
+
React65.useLayoutEffect(() => {
|
|
12769
12826
|
const el = scroller.current;
|
|
12770
12827
|
if (!el) return;
|
|
12771
12828
|
if (stick.current) {
|
|
@@ -12773,7 +12830,7 @@ function ChatTranscript({
|
|
|
12773
12830
|
seen.current = messages.length;
|
|
12774
12831
|
} else setPill(Math.max(0, messages.length - seen.current));
|
|
12775
12832
|
}, [messages]);
|
|
12776
|
-
|
|
12833
|
+
React65.useEffect(() => {
|
|
12777
12834
|
const el = scroller.current;
|
|
12778
12835
|
const inner = el && el.firstChild;
|
|
12779
12836
|
if (!el || !inner || typeof ResizeObserver === "undefined") return;
|
|
@@ -12783,7 +12840,7 @@ function ChatTranscript({
|
|
|
12783
12840
|
ro.observe(inner);
|
|
12784
12841
|
return () => ro.disconnect();
|
|
12785
12842
|
}, []);
|
|
12786
|
-
const groups =
|
|
12843
|
+
const groups = React65.useMemo(() => groupMessages(messages), [messages]);
|
|
12787
12844
|
const empty = !messages.length && status === "ready";
|
|
12788
12845
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: ["fdc-scroll", className].filter(Boolean).join(" "), ref: scroller, onScroll, children: [
|
|
12789
12846
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsxs)("div", { className: "fdc-log", role: "log", "aria-label": "Conversation", children: [
|
|
@@ -12807,7 +12864,7 @@ function ChatTranscript({
|
|
|
12807
12864
|
const prev = groups[i - 1];
|
|
12808
12865
|
const k = dayKey(g.messages[0].timestamp);
|
|
12809
12866
|
const showDay = !!k && (!prev || dayKey(prev.messages[0].timestamp) !== k);
|
|
12810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
12867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(React65.Fragment, { children: [
|
|
12811
12868
|
showDay ? /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "fdc-day", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("span", { children: dayLabel(k) }) }) : null,
|
|
12812
12869
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ChatTurn, { group: g, ctx })
|
|
12813
12870
|
] }, g.key || i);
|
|
@@ -12824,7 +12881,7 @@ function ChatTranscript({
|
|
|
12824
12881
|
var TranscriptKit = { groupMessages };
|
|
12825
12882
|
|
|
12826
12883
|
// src/components/chat/ChatComposer.tsx
|
|
12827
|
-
var
|
|
12884
|
+
var React66 = __toESM(require("react"), 1);
|
|
12828
12885
|
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
12829
12886
|
function ChatComposer({
|
|
12830
12887
|
onSubmit,
|
|
@@ -12852,17 +12909,17 @@ function ChatComposer({
|
|
|
12852
12909
|
onReject,
|
|
12853
12910
|
onOpenAttachment
|
|
12854
12911
|
}) {
|
|
12855
|
-
const [text, setText] =
|
|
12856
|
-
const [trigger, setTrigger] =
|
|
12857
|
-
const [mentionItems, setMentionItems] =
|
|
12858
|
-
const [listening, setListening] =
|
|
12859
|
-
const [notice, setNotice] =
|
|
12860
|
-
const editor =
|
|
12861
|
-
const wrap =
|
|
12862
|
-
const stopVoice =
|
|
12912
|
+
const [text, setText] = React66.useState(draft || "");
|
|
12913
|
+
const [trigger, setTrigger] = React66.useState(null);
|
|
12914
|
+
const [mentionItems, setMentionItems] = React66.useState([]);
|
|
12915
|
+
const [listening, setListening] = React66.useState(false);
|
|
12916
|
+
const [notice, setNotice] = React66.useState(null);
|
|
12917
|
+
const editor = React66.useRef(null);
|
|
12918
|
+
const wrap = React66.useRef(null);
|
|
12919
|
+
const stopVoice = React66.useRef(null);
|
|
12863
12920
|
const staged = useStagedFiles(fileUploadHandler, { onError: () => {
|
|
12864
12921
|
} });
|
|
12865
|
-
|
|
12922
|
+
React66.useEffect(() => {
|
|
12866
12923
|
if (draft != null && draft !== text) setText(draft);
|
|
12867
12924
|
}, [draft]);
|
|
12868
12925
|
const change = (v) => {
|
|
@@ -12898,7 +12955,7 @@ function ChatComposer({
|
|
|
12898
12955
|
e.preventDefault();
|
|
12899
12956
|
staged.add(found.files);
|
|
12900
12957
|
};
|
|
12901
|
-
|
|
12958
|
+
React66.useEffect(() => {
|
|
12902
12959
|
if (!trigger || trigger.type !== "mention" || !mentionSources) {
|
|
12903
12960
|
setMentionItems([]);
|
|
12904
12961
|
return;
|
|
@@ -12916,7 +12973,7 @@ function ChatComposer({
|
|
|
12916
12973
|
const q = (trigger.query || "").toLowerCase();
|
|
12917
12974
|
setMentionItems(mentionSources.filter((m) => !q || (m.label + " " + (m.description || "")).toLowerCase().includes(q)));
|
|
12918
12975
|
}, [trigger, mentionSources]);
|
|
12919
|
-
const slashItems =
|
|
12976
|
+
const slashItems = React66.useMemo(() => {
|
|
12920
12977
|
if (!trigger || trigger.type !== "slash" || !slashCommands) return [];
|
|
12921
12978
|
const q = (trigger.query || "").toLowerCase();
|
|
12922
12979
|
return slashCommands.filter((c) => !q || (c.id + " " + c.label + " " + (c.description || "")).toLowerCase().includes(q));
|
|
@@ -13086,12 +13143,12 @@ function ChatComposer({
|
|
|
13086
13143
|
}
|
|
13087
13144
|
|
|
13088
13145
|
// src/components/chat/ChatSessionBar.tsx
|
|
13089
|
-
var
|
|
13146
|
+
var React67 = __toESM(require("react"), 1);
|
|
13090
13147
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
13091
13148
|
var compact2 = meterFormats.compact;
|
|
13092
13149
|
function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extras }) {
|
|
13093
|
-
const [open2, setOpen] =
|
|
13094
|
-
const anchor =
|
|
13150
|
+
const [open2, setOpen] = React67.useState(false);
|
|
13151
|
+
const anchor = React67.useRef(null);
|
|
13095
13152
|
const stats = sessionStats || null;
|
|
13096
13153
|
const cu = contextUsage || null;
|
|
13097
13154
|
const limits = usageLimits || null;
|
|
@@ -13106,7 +13163,7 @@ function ChatSessionBar({ sessionStats, contextUsage, usageLimits, onClear, extr
|
|
|
13106
13163
|
if (stats && stats.runningTasks) bits.push(stats.runningTasks + " running task" + (stats.runningTasks === 1 ? "" : "s"));
|
|
13107
13164
|
if (cu) bits.push(pct + "% context");
|
|
13108
13165
|
const expandable = !!(cu || limits);
|
|
13109
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(React67.Fragment, { children: [
|
|
13110
13167
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "fdc-bar", children: [
|
|
13111
13168
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13112
13169
|
"button",
|
|
@@ -13247,7 +13304,7 @@ function ModelControls({
|
|
|
13247
13304
|
] })
|
|
13248
13305
|
});
|
|
13249
13306
|
}
|
|
13250
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
13307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(React67.Fragment, { children: [
|
|
13251
13308
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13252
13309
|
MenuButton,
|
|
13253
13310
|
{
|
|
@@ -13364,11 +13421,11 @@ function AgentChatPanel({
|
|
|
13364
13421
|
onFeedback,
|
|
13365
13422
|
onEditMessage
|
|
13366
13423
|
}) {
|
|
13367
|
-
const [panelWidth, setPanelWidth] =
|
|
13368
|
-
const [applied, setApplied] =
|
|
13369
|
-
const [draft, setDraft] =
|
|
13370
|
-
const dragging =
|
|
13371
|
-
|
|
13424
|
+
const [panelWidth, setPanelWidth] = React68.useState(width);
|
|
13425
|
+
const [applied, setApplied] = React68.useState({});
|
|
13426
|
+
const [draft, setDraft] = React68.useState("");
|
|
13427
|
+
const dragging = React68.useRef(null);
|
|
13428
|
+
React68.useEffect(() => setPanelWidth(width), [width]);
|
|
13372
13429
|
const engine = useChatEngine({
|
|
13373
13430
|
contextType,
|
|
13374
13431
|
contextId,
|
|
@@ -13572,7 +13629,7 @@ function AgentChatPanel({
|
|
|
13572
13629
|
}
|
|
13573
13630
|
|
|
13574
13631
|
// src/components/files/FileViewer.tsx
|
|
13575
|
-
var
|
|
13632
|
+
var React69 = __toESM(require("react"), 1);
|
|
13576
13633
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13577
13634
|
function previewKindOf(file) {
|
|
13578
13635
|
const mime = (file.mime || "").toLowerCase();
|
|
@@ -13629,13 +13686,13 @@ function parseDelimited(text, delimiter) {
|
|
|
13629
13686
|
return rows;
|
|
13630
13687
|
}
|
|
13631
13688
|
function usePreview(file, kind, resolveUrl) {
|
|
13632
|
-
const [state, setState] =
|
|
13633
|
-
const [attempt, setAttempt] =
|
|
13634
|
-
const resolveRef =
|
|
13635
|
-
|
|
13689
|
+
const [state, setState] = React69.useState({ status: "loading" });
|
|
13690
|
+
const [attempt, setAttempt] = React69.useState(0);
|
|
13691
|
+
const resolveRef = React69.useRef(resolveUrl);
|
|
13692
|
+
React69.useEffect(() => {
|
|
13636
13693
|
resolveRef.current = resolveUrl;
|
|
13637
13694
|
}, [resolveUrl]);
|
|
13638
|
-
|
|
13695
|
+
React69.useEffect(() => {
|
|
13639
13696
|
if (kind === "none") {
|
|
13640
13697
|
setState({ status: "ready" });
|
|
13641
13698
|
return;
|
|
@@ -13665,7 +13722,7 @@ function usePreview(file, kind, resolveUrl) {
|
|
|
13665
13722
|
if (ac) ac.abort();
|
|
13666
13723
|
};
|
|
13667
13724
|
}, [file.id, kind, attempt]);
|
|
13668
|
-
return { ...state, retry:
|
|
13725
|
+
return { ...state, retry: React69.useCallback(() => setAttempt((a) => a + 1), []) };
|
|
13669
13726
|
}
|
|
13670
13727
|
function PreviewBody({ file, kind, state }) {
|
|
13671
13728
|
if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("img", { className: "fd-fv-image", src: state.url, alt: file.name || "Preview" });
|
|
@@ -13710,13 +13767,13 @@ function PreviewBody({ file, kind, state }) {
|
|
|
13710
13767
|
] });
|
|
13711
13768
|
}
|
|
13712
13769
|
function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", onClose, actions, className = "" }) {
|
|
13713
|
-
const kind =
|
|
13770
|
+
const kind = React69.useMemo(() => previewKindOf(file), [file]);
|
|
13714
13771
|
const preview = usePreview(file, kind, resolveUrl);
|
|
13715
|
-
const [tab, setTab] =
|
|
13716
|
-
const [downloading, setDownloading] =
|
|
13717
|
-
const [downloadError, setDownloadError] =
|
|
13772
|
+
const [tab, setTab] = React69.useState("preview");
|
|
13773
|
+
const [downloading, setDownloading] = React69.useState(false);
|
|
13774
|
+
const [downloadError, setDownloadError] = React69.useState(null);
|
|
13718
13775
|
const hasSide = sidePanel != null;
|
|
13719
|
-
|
|
13776
|
+
React69.useEffect(() => {
|
|
13720
13777
|
setTab("preview");
|
|
13721
13778
|
}, [file.id]);
|
|
13722
13779
|
const download = () => {
|
|
@@ -13783,7 +13840,7 @@ function FileViewer({ file, resolveUrl, sidePanel, sidePanelLabel = "Details", o
|
|
|
13783
13840
|
}
|
|
13784
13841
|
|
|
13785
13842
|
// src/components/files/FileBrowser.tsx
|
|
13786
|
-
var
|
|
13843
|
+
var React70 = __toESM(require("react"), 1);
|
|
13787
13844
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13788
13845
|
function childrenOf(folders, parentId) {
|
|
13789
13846
|
return folders.filter((f) => f.parentId === parentId).sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -13893,8 +13950,8 @@ function FolderPickerMenu({
|
|
|
13893
13950
|
] });
|
|
13894
13951
|
}
|
|
13895
13952
|
function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropPayload, actions, className = "" }) {
|
|
13896
|
-
const [over, setOver] =
|
|
13897
|
-
const dragCounter =
|
|
13953
|
+
const [over, setOver] = React70.useState(false);
|
|
13954
|
+
const dragCounter = React70.useRef(0);
|
|
13898
13955
|
const dropHandlers = isDropTarget ? {
|
|
13899
13956
|
onDragEnter: (e) => {
|
|
13900
13957
|
if (!hasInternalPayload(e)) return;
|
|
@@ -13942,8 +13999,8 @@ function RowShell({ icon, name, meta, onOpen, draggableId, isDropTarget, onDropP
|
|
|
13942
13999
|
}
|
|
13943
14000
|
function TreeNode({ folder, depth, folders, currentFolderId, onNavigate, onMoveInto, canMove }) {
|
|
13944
14001
|
const kids = childrenOf(folders, folder.id);
|
|
13945
|
-
const [expanded, setExpanded] =
|
|
13946
|
-
|
|
14002
|
+
const [expanded, setExpanded] = React70.useState(() => currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId));
|
|
14003
|
+
React70.useEffect(() => {
|
|
13947
14004
|
if (currentFolderId != null && isSelfOrDescendant(folders, folder.id, currentFolderId)) setExpanded(true);
|
|
13948
14005
|
}, [currentFolderId, folder.id, folders]);
|
|
13949
14006
|
const isCurrent = folder.id === currentFolderId;
|
|
@@ -14009,15 +14066,15 @@ function FileBrowser({
|
|
|
14009
14066
|
const canUpload = perm.canUpload !== false && !!onUpload;
|
|
14010
14067
|
const canRemoveFile = perm.canRemoveFile !== false && !!onRemoveFile;
|
|
14011
14068
|
const canDeleteFolder = perm.canDeleteFolder !== false && !!onDeleteFolder;
|
|
14012
|
-
const [createOpen, setCreateOpen] =
|
|
14013
|
-
const [createName, setCreateName] =
|
|
14014
|
-
const [renameTarget, setRenameTarget] =
|
|
14015
|
-
const [renameValue, setRenameValue] =
|
|
14016
|
-
const [deleteTarget, setDeleteTarget] =
|
|
14017
|
-
const uploadInputRef =
|
|
14018
|
-
const crumbFolders =
|
|
14019
|
-
const subfolders =
|
|
14020
|
-
const currentFiles =
|
|
14069
|
+
const [createOpen, setCreateOpen] = React70.useState(false);
|
|
14070
|
+
const [createName, setCreateName] = React70.useState("");
|
|
14071
|
+
const [renameTarget, setRenameTarget] = React70.useState(null);
|
|
14072
|
+
const [renameValue, setRenameValue] = React70.useState("");
|
|
14073
|
+
const [deleteTarget, setDeleteTarget] = React70.useState(null);
|
|
14074
|
+
const uploadInputRef = React70.useRef(null);
|
|
14075
|
+
const crumbFolders = React70.useMemo(() => ancestorsOf(folders, currentFolderId), [folders, currentFolderId]);
|
|
14076
|
+
const subfolders = React70.useMemo(() => childrenOf(folders, currentFolderId), [folders, currentFolderId]);
|
|
14077
|
+
const currentFiles = React70.useMemo(
|
|
14021
14078
|
() => files.filter((f) => f.folderId === currentFolderId).sort((a, b) => a.name.localeCompare(b.name)),
|
|
14022
14079
|
[files, currentFolderId]
|
|
14023
14080
|
);
|
|
@@ -14249,8 +14306,8 @@ function BreadcrumbCrumb({
|
|
|
14249
14306
|
isDropTarget,
|
|
14250
14307
|
onDropPayload
|
|
14251
14308
|
}) {
|
|
14252
|
-
const [over, setOver] =
|
|
14253
|
-
const dragCounter =
|
|
14309
|
+
const [over, setOver] = React70.useState(false);
|
|
14310
|
+
const dragCounter = React70.useRef(0);
|
|
14254
14311
|
const dropHandlers = isDropTarget ? {
|
|
14255
14312
|
onDragEnter: (e) => {
|
|
14256
14313
|
if (!hasInternalPayload(e)) return;
|
|
@@ -14279,7 +14336,7 @@ function BreadcrumbCrumb({
|
|
|
14279
14336
|
}
|
|
14280
14337
|
|
|
14281
14338
|
// src/kits/query.ts
|
|
14282
|
-
var
|
|
14339
|
+
var React71 = __toESM(require("react"), 1);
|
|
14283
14340
|
var isMultiSelectShaped = (v) => !!v && typeof v === "object" && Array.isArray(v.values);
|
|
14284
14341
|
var isRangeShaped = (v) => !!v && typeof v === "object" && ("min" in v || "max" in v);
|
|
14285
14342
|
var isDateShaped = (v) => !!v && typeof v === "object" && "kind" in v;
|
|
@@ -14334,22 +14391,22 @@ function compare(a, b, dir) {
|
|
|
14334
14391
|
var API = null;
|
|
14335
14392
|
var PREFS = null;
|
|
14336
14393
|
function useServerTable({ endpoint, params, defaults, deps, prefsKey }) {
|
|
14337
|
-
const [query, setQuery] =
|
|
14394
|
+
const [query, setQuery] = React71.useState(() => {
|
|
14338
14395
|
const store = PREFS || window.PlannerPrefs;
|
|
14339
14396
|
const saved = prefsKey && store ? store.getTable(prefsKey) : {};
|
|
14340
14397
|
return { ...DEFAULTS, ...defaults || {}, ...saved.pageSize ? { pageSize: saved.pageSize } : {}, ...saved.sort ? { sort: saved.sort, dir: saved.dir || "desc" } : {} };
|
|
14341
14398
|
});
|
|
14342
|
-
const savePref =
|
|
14399
|
+
const savePref = React71.useCallback((patch2) => {
|
|
14343
14400
|
const store = PREFS || window.PlannerPrefs;
|
|
14344
14401
|
if (prefsKey && store) store.setTable(prefsKey, patch2);
|
|
14345
14402
|
}, [prefsKey]);
|
|
14346
|
-
const [res, setRes] =
|
|
14347
|
-
const [loading, setLoading] =
|
|
14348
|
-
const seq2 =
|
|
14403
|
+
const [res, setRes] = React71.useState(null);
|
|
14404
|
+
const [loading, setLoading] = React71.useState(true);
|
|
14405
|
+
const seq2 = React71.useRef(0);
|
|
14349
14406
|
const depKey = (deps || []).join("|");
|
|
14350
14407
|
const paramKey = JSON.stringify(params || {});
|
|
14351
14408
|
const queryKey = JSON.stringify(query);
|
|
14352
|
-
|
|
14409
|
+
React71.useEffect(() => {
|
|
14353
14410
|
const id = ++seq2.current;
|
|
14354
14411
|
setLoading(true);
|
|
14355
14412
|
const t = setTimeout(() => {
|
|
@@ -14668,12 +14725,12 @@ function createVersionStore(initialState, options) {
|
|
|
14668
14725
|
}
|
|
14669
14726
|
|
|
14670
14727
|
// src/kits/documentTitle.ts
|
|
14671
|
-
var
|
|
14728
|
+
var React72 = __toESM(require("react"), 1);
|
|
14672
14729
|
function formatDocumentTitle(routeTitle, appName) {
|
|
14673
14730
|
return [routeTitle, appName, "Flytedesk"].filter((part) => !!part && part.length > 0).join(" \xB7 ");
|
|
14674
14731
|
}
|
|
14675
14732
|
function useDocumentTitle(routeTitle, appName) {
|
|
14676
|
-
|
|
14733
|
+
React72.useEffect(() => {
|
|
14677
14734
|
if (typeof document === "undefined") return;
|
|
14678
14735
|
document.title = formatDocumentTitle(routeTitle, appName);
|
|
14679
14736
|
}, [routeTitle, appName]);
|
|
@@ -14720,6 +14777,7 @@ function useDocumentTitle(routeTitle, appName) {
|
|
|
14720
14777
|
CodeEditor,
|
|
14721
14778
|
Collapsible,
|
|
14722
14779
|
ComingSoon,
|
|
14780
|
+
CornerStackPortal,
|
|
14723
14781
|
CsiBadge,
|
|
14724
14782
|
CsiHero,
|
|
14725
14783
|
CsiMeter,
|
|
@@ -14888,6 +14946,7 @@ function useDocumentTitle(routeTitle, appName) {
|
|
|
14888
14946
|
useAppearancePrefs,
|
|
14889
14947
|
useChatEngine,
|
|
14890
14948
|
useCopyToClipboard,
|
|
14949
|
+
useCornerStackSlot,
|
|
14891
14950
|
useDocumentTitle,
|
|
14892
14951
|
useFeatureStatus,
|
|
14893
14952
|
useLayerZIndex,
|