@ai-matrx/associations 0.11.4 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/dist/{CommentThread-DDeqHgTk.d.cts → CommentThread-DP4sEzb2.d.cts} +25 -8
- package/dist/{CommentThread-DDeqHgTk.d.ts → CommentThread-DP4sEzb2.d.ts} +25 -8
- package/dist/core/index.cjs +9 -4
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +20 -7
- package/dist/core/index.d.ts +20 -7
- package/dist/core/index.js +9 -4
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +740 -545
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +48 -6
- package/dist/react/index.d.ts +48 -6
- package/dist/react/index.js +723 -528
- package/dist/react/index.js.map +1 -1
- package/dist/react/lazy/index.d.cts +1 -1
- package/dist/react/lazy/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1620,7 +1620,6 @@ function useUniversalEntitySearch(args) {
|
|
|
1620
1620
|
const {
|
|
1621
1621
|
query,
|
|
1622
1622
|
tokens,
|
|
1623
|
-
ownerId,
|
|
1624
1623
|
enabled = true,
|
|
1625
1624
|
perTokenLimit = 5,
|
|
1626
1625
|
emptyQueryMode = "recents"
|
|
@@ -1628,7 +1627,14 @@ function useUniversalEntitySearch(args) {
|
|
|
1628
1627
|
const store = useAssociationsStore();
|
|
1629
1628
|
const [results, setResults] = useState3([]);
|
|
1630
1629
|
const [loading, setLoading] = useState3(false);
|
|
1631
|
-
const [
|
|
1630
|
+
const [failures, setFailures] = useState3([]);
|
|
1631
|
+
const [error, setError] = useState3(null);
|
|
1632
|
+
const [status, setStatus] = useState3(
|
|
1633
|
+
enabled ? "loading" : "ready"
|
|
1634
|
+
);
|
|
1635
|
+
const [source, setSource] = useState3(
|
|
1636
|
+
emptyQueryMode === "candidates" ? "candidates" : "recents"
|
|
1637
|
+
);
|
|
1632
1638
|
const runRef = useRef5(0);
|
|
1633
1639
|
const tokensKey = (tokens ?? []).join(",");
|
|
1634
1640
|
useEffect5(() => {
|
|
@@ -1638,30 +1644,72 @@ function useUniversalEntitySearch(args) {
|
|
|
1638
1644
|
const timer = setTimeout(async () => {
|
|
1639
1645
|
if (runRef.current !== run) return;
|
|
1640
1646
|
setLoading(true);
|
|
1647
|
+
setStatus("loading");
|
|
1641
1648
|
const activeTokens = tokensKey ? tokensKey.split(",") : store.registry.listableTokens();
|
|
1649
|
+
const browse = () => store.candidates.searchCandidatesAcrossTokens({
|
|
1650
|
+
tokens: activeTokens,
|
|
1651
|
+
search: trimmed,
|
|
1652
|
+
perTokenLimit
|
|
1653
|
+
});
|
|
1654
|
+
const allFailed = (r) => activeTokens.length > 0 && r.failures.length >= activeTokens.length;
|
|
1642
1655
|
let next = [];
|
|
1656
|
+
let nextSource;
|
|
1657
|
+
const nextFailures = [];
|
|
1658
|
+
let nextError = null;
|
|
1643
1659
|
if (trimmed || emptyQueryMode === "candidates") {
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
});
|
|
1660
|
+
const r = await browse();
|
|
1661
|
+
next = r.results;
|
|
1662
|
+
nextFailures.push(...r.failures);
|
|
1663
|
+
nextSource = trimmed ? "search" : "candidates";
|
|
1664
|
+
if (allFailed(r)) nextError = totalFailureMessage(store, r);
|
|
1650
1665
|
} else {
|
|
1651
|
-
|
|
1666
|
+
const recents = await loadRecents(store, activeTokens);
|
|
1667
|
+
nextSource = "recents";
|
|
1668
|
+
if (recents.ok) {
|
|
1669
|
+
next = recents.data;
|
|
1670
|
+
} else {
|
|
1671
|
+
nextFailures.push({ token: null, error: recents.error });
|
|
1672
|
+
}
|
|
1673
|
+
if (next.length === 0 && runRef.current === run) {
|
|
1674
|
+
const r = await browse();
|
|
1675
|
+
next = r.results;
|
|
1676
|
+
nextFailures.push(...r.failures);
|
|
1677
|
+
nextSource = "candidates";
|
|
1678
|
+
if (allFailed(r)) {
|
|
1679
|
+
nextError = recents.ok ? totalFailureMessage(store, r) : `Couldn't load recent items (${recents.error}) or browse: ${totalFailureMessage(store, r)}`;
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1652
1682
|
}
|
|
1653
1683
|
if (runRef.current !== run) return;
|
|
1654
1684
|
setResults(next);
|
|
1655
|
-
|
|
1685
|
+
setSource(nextSource);
|
|
1686
|
+
setFailures(nextFailures);
|
|
1687
|
+
setError(nextError);
|
|
1688
|
+
setStatus(nextError ? "error" : "ready");
|
|
1656
1689
|
setLoading(false);
|
|
1657
1690
|
}, DEBOUNCE_MS);
|
|
1658
1691
|
return () => clearTimeout(timer);
|
|
1659
|
-
}, [query, tokensKey,
|
|
1660
|
-
return {
|
|
1692
|
+
}, [query, tokensKey, enabled, perTokenLimit, emptyQueryMode, store]);
|
|
1693
|
+
return {
|
|
1694
|
+
results,
|
|
1695
|
+
loading,
|
|
1696
|
+
isRecents: source === "recents",
|
|
1697
|
+
source,
|
|
1698
|
+
failures,
|
|
1699
|
+
error,
|
|
1700
|
+
status
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
function totalFailureMessage(store, r) {
|
|
1704
|
+
const labels = r.failures.map(
|
|
1705
|
+
(f) => store.registry.getEntityInfo(f.token).labelPlural
|
|
1706
|
+
);
|
|
1707
|
+
const first = r.failures[0]?.error;
|
|
1708
|
+
return `Couldn't search ${labels.join(", ")}${first ? `: ${first}` : ""}`;
|
|
1661
1709
|
}
|
|
1662
1710
|
async function loadRecents(store, tokens) {
|
|
1663
1711
|
const res = await store.favorites.list();
|
|
1664
|
-
if (!res.ok) return
|
|
1712
|
+
if (!res.ok) return { ok: false, error: res.error.message };
|
|
1665
1713
|
const tokenSet = new Set(tokens);
|
|
1666
1714
|
const rows = res.data.items.filter(
|
|
1667
1715
|
(i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && (i.isFavorite || i.lastViewedAt)
|
|
@@ -1669,7 +1717,7 @@ async function loadRecents(store, tokens) {
|
|
|
1669
1717
|
if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;
|
|
1670
1718
|
return (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "");
|
|
1671
1719
|
}).slice(0, RECENTS_LIMIT);
|
|
1672
|
-
if (rows.length === 0) return [];
|
|
1720
|
+
if (rows.length === 0) return { ok: true, data: [] };
|
|
1673
1721
|
const byToken = /* @__PURE__ */ new Map();
|
|
1674
1722
|
for (const r of rows) {
|
|
1675
1723
|
const list = byToken.get(r.entityType) ?? [];
|
|
@@ -1692,7 +1740,72 @@ async function loadRecents(store, tokens) {
|
|
|
1692
1740
|
title
|
|
1693
1741
|
});
|
|
1694
1742
|
}
|
|
1695
|
-
return out;
|
|
1743
|
+
return { ok: true, data: out };
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
// src/react/components/SearchFailureNotice.tsx
|
|
1747
|
+
import { ErrorBox, cn } from "@ai-matrx/design-system";
|
|
1748
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1749
|
+
function describeSearchFailures(failures, labelFor) {
|
|
1750
|
+
const recentsFailed = failures.some((f) => f.token === null);
|
|
1751
|
+
const labels = [];
|
|
1752
|
+
for (const f of failures) {
|
|
1753
|
+
if (f.token === null) continue;
|
|
1754
|
+
const label = labelFor(f.token);
|
|
1755
|
+
if (!labels.includes(label)) labels.push(label);
|
|
1756
|
+
}
|
|
1757
|
+
const parts = [];
|
|
1758
|
+
if (recentsFailed) parts.push("Couldn't load recent items");
|
|
1759
|
+
if (labels.length > 0) {
|
|
1760
|
+
parts.push(
|
|
1761
|
+
`${recentsFailed ? "couldn't" : "Couldn't"} search ${labels.join(", ")}`
|
|
1762
|
+
);
|
|
1763
|
+
}
|
|
1764
|
+
return parts.join("; ");
|
|
1765
|
+
}
|
|
1766
|
+
function SearchFailureNotice(props) {
|
|
1767
|
+
const {
|
|
1768
|
+
error,
|
|
1769
|
+
failures,
|
|
1770
|
+
operation = "Search",
|
|
1771
|
+
origin = "associations/SearchFailureNotice",
|
|
1772
|
+
className
|
|
1773
|
+
} = props;
|
|
1774
|
+
const store = useAssociationsStore();
|
|
1775
|
+
if (error) {
|
|
1776
|
+
return /* @__PURE__ */ jsxs(
|
|
1777
|
+
ErrorBox,
|
|
1778
|
+
{
|
|
1779
|
+
as: "div",
|
|
1780
|
+
className: cn(
|
|
1781
|
+
"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive",
|
|
1782
|
+
className
|
|
1783
|
+
),
|
|
1784
|
+
message: error,
|
|
1785
|
+
operation,
|
|
1786
|
+
origin,
|
|
1787
|
+
children: [
|
|
1788
|
+
/* @__PURE__ */ jsx2("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
1789
|
+
/* @__PURE__ */ jsx2("p", { className: "opacity-80", children: error })
|
|
1790
|
+
]
|
|
1791
|
+
}
|
|
1792
|
+
);
|
|
1793
|
+
}
|
|
1794
|
+
if (failures.length === 0) return null;
|
|
1795
|
+
const summary = describeSearchFailures(
|
|
1796
|
+
failures,
|
|
1797
|
+
(token) => store.registry.getEntityInfo(token).labelPlural
|
|
1798
|
+
);
|
|
1799
|
+
return /* @__PURE__ */ jsx2(
|
|
1800
|
+
ErrorBox,
|
|
1801
|
+
{
|
|
1802
|
+
className: cn("px-1 text-[11px] text-destructive", className),
|
|
1803
|
+
message: summary,
|
|
1804
|
+
error: failures.map((f) => `${f.token ?? "recents"}: ${f.error}`).join("\n"),
|
|
1805
|
+
operation,
|
|
1806
|
+
origin
|
|
1807
|
+
}
|
|
1808
|
+
);
|
|
1696
1809
|
}
|
|
1697
1810
|
|
|
1698
1811
|
// src/react/hooks/useAssociationCandidates.ts
|
|
@@ -1700,7 +1813,6 @@ import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
|
1700
1813
|
function useAssociationCandidates(args) {
|
|
1701
1814
|
const { token, enabled = true, search, limit } = args;
|
|
1702
1815
|
const store = useAssociationsStore();
|
|
1703
|
-
const userId = currentUserIdOrNull(store);
|
|
1704
1816
|
const [candidates, setCandidates] = useState4([]);
|
|
1705
1817
|
const [loading, setLoading] = useState4(false);
|
|
1706
1818
|
const [error, setError] = useState4(null);
|
|
@@ -1713,7 +1825,6 @@ function useAssociationCandidates(args) {
|
|
|
1713
1825
|
setError(null);
|
|
1714
1826
|
const res = await store.candidates.listAssociationCandidates({
|
|
1715
1827
|
token,
|
|
1716
|
-
ownerId: userId,
|
|
1717
1828
|
...search !== void 0 ? { search } : {},
|
|
1718
1829
|
...limit !== void 0 ? { limit } : {}
|
|
1719
1830
|
});
|
|
@@ -1729,7 +1840,7 @@ function useAssociationCandidates(args) {
|
|
|
1729
1840
|
return () => {
|
|
1730
1841
|
cancelled = true;
|
|
1731
1842
|
};
|
|
1732
|
-
}, [token, enabled,
|
|
1843
|
+
}, [token, enabled, search, limit, tick, store]);
|
|
1733
1844
|
return {
|
|
1734
1845
|
candidates,
|
|
1735
1846
|
loading,
|
|
@@ -1737,13 +1848,6 @@ function useAssociationCandidates(args) {
|
|
|
1737
1848
|
reload: () => setTick((t) => t + 1)
|
|
1738
1849
|
};
|
|
1739
1850
|
}
|
|
1740
|
-
function currentUserIdOrNull(store) {
|
|
1741
|
-
try {
|
|
1742
|
-
return store.identity.requireUserId();
|
|
1743
|
-
} catch {
|
|
1744
|
-
return null;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
1851
|
|
|
1748
1852
|
// src/react/hooks/useComments.ts
|
|
1749
1853
|
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
@@ -1887,13 +1991,13 @@ function useAssociationEntitySelectAdapter(args) {
|
|
|
1887
1991
|
|
|
1888
1992
|
// src/react/components/PrimaryEntityContext.tsx
|
|
1889
1993
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1890
|
-
import { jsx as
|
|
1994
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1891
1995
|
var PrimaryEntityCtx = createContext2(null);
|
|
1892
1996
|
function PrimaryEntityProvider({
|
|
1893
1997
|
value,
|
|
1894
1998
|
children
|
|
1895
1999
|
}) {
|
|
1896
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx3(PrimaryEntityCtx.Provider, { value, children });
|
|
1897
2001
|
}
|
|
1898
2002
|
function usePrimaryEntity() {
|
|
1899
2003
|
return useContext2(PrimaryEntityCtx);
|
|
@@ -1911,10 +2015,10 @@ import {
|
|
|
1911
2015
|
useState as useState6
|
|
1912
2016
|
} from "react";
|
|
1913
2017
|
import { createPortal } from "react-dom";
|
|
1914
|
-
import { cn } from "@ai-matrx/design-system";
|
|
2018
|
+
import { cn as cn2 } from "@ai-matrx/design-system";
|
|
1915
2019
|
|
|
1916
2020
|
// src/react/icons.tsx
|
|
1917
|
-
import { jsx as
|
|
2021
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1918
2022
|
function base(props) {
|
|
1919
2023
|
return {
|
|
1920
2024
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1931,129 +2035,129 @@ function base(props) {
|
|
|
1931
2035
|
};
|
|
1932
2036
|
}
|
|
1933
2037
|
function SpinnerIcon(props) {
|
|
1934
|
-
return /* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
1935
2039
|
}
|
|
1936
2040
|
function PlusIcon(props) {
|
|
1937
|
-
return /* @__PURE__ */
|
|
1938
|
-
/* @__PURE__ */
|
|
1939
|
-
/* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2042
|
+
/* @__PURE__ */ jsx4("path", { d: "M5 12h14" }),
|
|
2043
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 5v14" })
|
|
1940
2044
|
] });
|
|
1941
2045
|
}
|
|
1942
2046
|
function XIcon(props) {
|
|
1943
|
-
return /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
2047
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2048
|
+
/* @__PURE__ */ jsx4("path", { d: "M18 6 6 18" }),
|
|
2049
|
+
/* @__PURE__ */ jsx4("path", { d: "m6 6 12 12" })
|
|
1946
2050
|
] });
|
|
1947
2051
|
}
|
|
1948
2052
|
function CheckIcon(props) {
|
|
1949
|
-
return /* @__PURE__ */
|
|
2053
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "M20 6 9 17l-5-5" }) });
|
|
1950
2054
|
}
|
|
1951
2055
|
function SearchIcon(props) {
|
|
1952
|
-
return /* @__PURE__ */
|
|
1953
|
-
/* @__PURE__ */
|
|
1954
|
-
/* @__PURE__ */
|
|
2056
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2057
|
+
/* @__PURE__ */ jsx4("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2058
|
+
/* @__PURE__ */ jsx4("path", { d: "m21 21-4.3-4.3" })
|
|
1955
2059
|
] });
|
|
1956
2060
|
}
|
|
1957
2061
|
function Link2Icon(props) {
|
|
1958
|
-
return /* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
2062
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2063
|
+
/* @__PURE__ */ jsx4("path", { d: "M9 17H7A5 5 0 0 1 7 7h2" }),
|
|
2064
|
+
/* @__PURE__ */ jsx4("path", { d: "M15 7h2a5 5 0 1 1 0 10h-2" }),
|
|
2065
|
+
/* @__PURE__ */ jsx4("line", { x1: "8", x2: "16", y1: "12", y2: "12" })
|
|
1962
2066
|
] });
|
|
1963
2067
|
}
|
|
1964
2068
|
function RefreshIcon(props) {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
/* @__PURE__ */
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
2069
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2070
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
2071
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 3v5h-5" }),
|
|
2072
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
2073
|
+
/* @__PURE__ */ jsx4("path", { d: "M8 16H3v5" })
|
|
1970
2074
|
] });
|
|
1971
2075
|
}
|
|
1972
2076
|
function PinIcon(props) {
|
|
1973
|
-
return /* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2078
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 17v5" }),
|
|
2079
|
+
/* @__PURE__ */ jsx4("path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" })
|
|
1976
2080
|
] });
|
|
1977
2081
|
}
|
|
1978
2082
|
function UploadIcon(props) {
|
|
1979
|
-
return /* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
2083
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2084
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
2085
|
+
/* @__PURE__ */ jsx4("polyline", { points: "17 8 12 3 7 8" }),
|
|
2086
|
+
/* @__PURE__ */ jsx4("line", { x1: "12", x2: "12", y1: "3", y2: "15" })
|
|
1983
2087
|
] });
|
|
1984
2088
|
}
|
|
1985
2089
|
function FolderOpenIcon(props) {
|
|
1986
|
-
return /* @__PURE__ */
|
|
2090
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }) });
|
|
1987
2091
|
}
|
|
1988
2092
|
function ExternalLinkIcon(props) {
|
|
1989
|
-
return /* @__PURE__ */
|
|
1990
|
-
/* @__PURE__ */
|
|
1991
|
-
/* @__PURE__ */
|
|
1992
|
-
/* @__PURE__ */
|
|
2093
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2094
|
+
/* @__PURE__ */ jsx4("path", { d: "M15 3h6v6" }),
|
|
2095
|
+
/* @__PURE__ */ jsx4("path", { d: "M10 14 21 3" }),
|
|
2096
|
+
/* @__PURE__ */ jsx4("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
1993
2097
|
] });
|
|
1994
2098
|
}
|
|
1995
2099
|
function ChevronDownIcon(props) {
|
|
1996
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }) });
|
|
1997
2101
|
}
|
|
1998
2102
|
function ChevronsUpDownIcon(props) {
|
|
1999
|
-
return /* @__PURE__ */
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2103
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2104
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 15 5 5 5-5" }),
|
|
2105
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 9 5-5 5 5" })
|
|
2002
2106
|
] });
|
|
2003
2107
|
}
|
|
2004
2108
|
function CornerDownRightIcon(props) {
|
|
2005
|
-
return /* @__PURE__ */
|
|
2006
|
-
/* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2109
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2110
|
+
/* @__PURE__ */ jsx4("polyline", { points: "15 10 20 15 15 20" }),
|
|
2111
|
+
/* @__PURE__ */ jsx4("path", { d: "M4 4v7a4 4 0 0 0 4 4h12" })
|
|
2008
2112
|
] });
|
|
2009
2113
|
}
|
|
2010
2114
|
function TagIcon(props) {
|
|
2011
|
-
return /* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2115
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2116
|
+
/* @__PURE__ */ jsx4("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
|
|
2117
|
+
/* @__PURE__ */ jsx4("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
|
|
2014
2118
|
] });
|
|
2015
2119
|
}
|
|
2016
2120
|
function DefaultEntityIcon(props) {
|
|
2017
|
-
return /* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
/* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
/* @__PURE__ */
|
|
2121
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2122
|
+
/* @__PURE__ */ jsx4("path", { d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" }),
|
|
2123
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 16.5-4.74-2.85" }),
|
|
2124
|
+
/* @__PURE__ */ jsx4("path", { d: "m7 16.5 5-3" }),
|
|
2125
|
+
/* @__PURE__ */ jsx4("path", { d: "M7 16.5v5.17" }),
|
|
2126
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" }),
|
|
2127
|
+
/* @__PURE__ */ jsx4("path", { d: "m17 16.5-5-3" }),
|
|
2128
|
+
/* @__PURE__ */ jsx4("path", { d: "m17 16.5 4.74-2.85" }),
|
|
2129
|
+
/* @__PURE__ */ jsx4("path", { d: "M17 16.5v5.17" }),
|
|
2130
|
+
/* @__PURE__ */ jsx4("path", { d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z" }),
|
|
2131
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 8 7.26 5.15" }),
|
|
2132
|
+
/* @__PURE__ */ jsx4("path", { d: "m12 8 4.74-2.85" }),
|
|
2133
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 13.5V8" })
|
|
2030
2134
|
] });
|
|
2031
2135
|
}
|
|
2032
2136
|
function MaximizeIcon(props) {
|
|
2033
|
-
return /* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2138
|
+
/* @__PURE__ */ jsx4("path", { d: "M15 3h6v6" }),
|
|
2139
|
+
/* @__PURE__ */ jsx4("path", { d: "M9 21H3v-6" }),
|
|
2140
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 3l-7 7" }),
|
|
2141
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 21l7-7" })
|
|
2038
2142
|
] });
|
|
2039
2143
|
}
|
|
2040
2144
|
function RestoreIcon(props) {
|
|
2041
|
-
return /* @__PURE__ */
|
|
2042
|
-
/* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2146
|
+
/* @__PURE__ */ jsx4("path", { d: "M4 14h6v6" }),
|
|
2147
|
+
/* @__PURE__ */ jsx4("path", { d: "M20 10h-6V4" }),
|
|
2148
|
+
/* @__PURE__ */ jsx4("path", { d: "M14 10l7-7" }),
|
|
2149
|
+
/* @__PURE__ */ jsx4("path", { d: "M3 21l7-7" })
|
|
2046
2150
|
] });
|
|
2047
2151
|
}
|
|
2048
2152
|
function GripResizeIcon(props) {
|
|
2049
|
-
return /* @__PURE__ */
|
|
2050
|
-
/* @__PURE__ */
|
|
2051
|
-
/* @__PURE__ */
|
|
2153
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2154
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 15 15 21" }),
|
|
2155
|
+
/* @__PURE__ */ jsx4("path", { d: "M21 20 20 21" })
|
|
2052
2156
|
] });
|
|
2053
2157
|
}
|
|
2054
2158
|
|
|
2055
2159
|
// src/react/components/DefaultWindowShell.tsx
|
|
2056
|
-
import { jsx as
|
|
2160
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2057
2161
|
var DEFAULT_WIDTH = 440;
|
|
2058
2162
|
var DEFAULT_HEIGHT = 580;
|
|
2059
2163
|
var MIN_WIDTH = 330;
|
|
@@ -2176,7 +2280,7 @@ function DefaultWindowShell({
|
|
|
2176
2280
|
height: rect.height
|
|
2177
2281
|
};
|
|
2178
2282
|
return createPortal(
|
|
2179
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsxs3(
|
|
2180
2284
|
"div",
|
|
2181
2285
|
{
|
|
2182
2286
|
ref: panelRef,
|
|
@@ -2184,7 +2288,7 @@ function DefaultWindowShell({
|
|
|
2184
2288
|
"aria-labelledby": labelId,
|
|
2185
2289
|
tabIndex: -1,
|
|
2186
2290
|
style,
|
|
2187
|
-
className:
|
|
2291
|
+
className: cn2(
|
|
2188
2292
|
// Non-modal by design: no backdrop element exists, so the page
|
|
2189
2293
|
// behind keeps every click. `pointer-events-auto` re-asserts our
|
|
2190
2294
|
// own subtree in case a Radix surface left <body> inert.
|
|
@@ -2193,7 +2297,7 @@ function DefaultWindowShell({
|
|
|
2193
2297
|
className
|
|
2194
2298
|
),
|
|
2195
2299
|
children: [
|
|
2196
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ jsxs3(
|
|
2197
2301
|
"header",
|
|
2198
2302
|
{
|
|
2199
2303
|
onPointerDown: beginGesture("move"),
|
|
@@ -2203,24 +2307,24 @@ function DefaultWindowShell({
|
|
|
2203
2307
|
onDoubleClick: () => {
|
|
2204
2308
|
if (!isMobile) setMaximized((v) => !v);
|
|
2205
2309
|
},
|
|
2206
|
-
className:
|
|
2310
|
+
className: cn2(
|
|
2207
2311
|
"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2 select-none",
|
|
2208
2312
|
isMobile ? "" : "cursor-move touch-none"
|
|
2209
2313
|
),
|
|
2210
2314
|
children: [
|
|
2211
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ jsxs3(
|
|
2212
2316
|
"span",
|
|
2213
2317
|
{
|
|
2214
2318
|
id: labelId,
|
|
2215
2319
|
className: "flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground",
|
|
2216
2320
|
children: [
|
|
2217
2321
|
icon,
|
|
2218
|
-
/* @__PURE__ */
|
|
2322
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate", children: title })
|
|
2219
2323
|
]
|
|
2220
2324
|
}
|
|
2221
2325
|
),
|
|
2222
|
-
/* @__PURE__ */
|
|
2223
|
-
isMobile ? null : /* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
2327
|
+
isMobile ? null : /* @__PURE__ */ jsx5(
|
|
2224
2328
|
"button",
|
|
2225
2329
|
{
|
|
2226
2330
|
type: "button",
|
|
@@ -2228,10 +2332,10 @@ function DefaultWindowShell({
|
|
|
2228
2332
|
onClick: () => setMaximized((v) => !v),
|
|
2229
2333
|
"aria-label": maximized ? "Restore window" : "Maximize window",
|
|
2230
2334
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2231
|
-
children: maximized ? /* @__PURE__ */
|
|
2335
|
+
children: maximized ? /* @__PURE__ */ jsx5(RestoreIcon, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx5(MaximizeIcon, { className: "h-3.5 w-3.5" })
|
|
2232
2336
|
}
|
|
2233
2337
|
),
|
|
2234
|
-
/* @__PURE__ */
|
|
2338
|
+
/* @__PURE__ */ jsx5(
|
|
2235
2339
|
"button",
|
|
2236
2340
|
{
|
|
2237
2341
|
type: "button",
|
|
@@ -2239,15 +2343,15 @@ function DefaultWindowShell({
|
|
|
2239
2343
|
onClick: onClose,
|
|
2240
2344
|
"aria-label": "Close",
|
|
2241
2345
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2242
|
-
children: /* @__PURE__ */
|
|
2346
|
+
children: /* @__PURE__ */ jsx5(XIcon, { className: "h-3.5 w-3.5" })
|
|
2243
2347
|
}
|
|
2244
2348
|
)
|
|
2245
2349
|
] })
|
|
2246
2350
|
]
|
|
2247
2351
|
}
|
|
2248
2352
|
),
|
|
2249
|
-
/* @__PURE__ */
|
|
2250
|
-
isMobile || maximized ? null : /* @__PURE__ */
|
|
2353
|
+
/* @__PURE__ */ jsx5("div", { className: "min-h-0 flex-1 overflow-hidden", children }),
|
|
2354
|
+
isMobile || maximized ? null : /* @__PURE__ */ jsx5(
|
|
2251
2355
|
"button",
|
|
2252
2356
|
{
|
|
2253
2357
|
type: "button",
|
|
@@ -2257,7 +2361,7 @@ function DefaultWindowShell({
|
|
|
2257
2361
|
onPointerUp: endGesture,
|
|
2258
2362
|
onPointerCancel: endGesture,
|
|
2259
2363
|
className: "absolute bottom-0 right-0 flex h-4 w-4 cursor-nwse-resize touch-none items-center justify-center text-muted-foreground/60 hover:text-foreground",
|
|
2260
|
-
children: /* @__PURE__ */
|
|
2364
|
+
children: /* @__PURE__ */ jsx5(GripResizeIcon, { className: "h-3 w-3" })
|
|
2261
2365
|
}
|
|
2262
2366
|
)
|
|
2263
2367
|
]
|
|
@@ -2268,7 +2372,7 @@ function DefaultWindowShell({
|
|
|
2268
2372
|
}
|
|
2269
2373
|
|
|
2270
2374
|
// src/react/components/AssociationWindow.tsx
|
|
2271
|
-
import { jsx as
|
|
2375
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2272
2376
|
function AssociationWindow({
|
|
2273
2377
|
open,
|
|
2274
2378
|
onClose,
|
|
@@ -2281,16 +2385,16 @@ function AssociationWindow({
|
|
|
2281
2385
|
const instanceId = useId();
|
|
2282
2386
|
const { windowShell } = useAssociationsUiPorts();
|
|
2283
2387
|
if (!open) return null;
|
|
2284
|
-
const body = /* @__PURE__ */
|
|
2285
|
-
subtitle ? /* @__PURE__ */
|
|
2388
|
+
const body = /* @__PURE__ */ jsxs4("div", { className: "flex h-full min-h-0 flex-col gap-2 p-3", children: [
|
|
2389
|
+
subtitle ? /* @__PURE__ */ jsx6("div", { className: "shrink-0 text-xs text-muted-foreground", children: subtitle }) : null,
|
|
2286
2390
|
children
|
|
2287
2391
|
] });
|
|
2288
2392
|
const windowId = `association:${scopeId}:${instanceId}`;
|
|
2289
2393
|
if (windowShell) {
|
|
2290
2394
|
const HostWindow = windowShell.Window;
|
|
2291
|
-
return /* @__PURE__ */
|
|
2395
|
+
return /* @__PURE__ */ jsx6(HostWindow, { id: windowId, title, onClose, children: body });
|
|
2292
2396
|
}
|
|
2293
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsx6(
|
|
2294
2398
|
DefaultWindowShell,
|
|
2295
2399
|
{
|
|
2296
2400
|
id: windowId,
|
|
@@ -2304,28 +2408,28 @@ function AssociationWindow({
|
|
|
2304
2408
|
|
|
2305
2409
|
// src/react/components/AssociationPicker.tsx
|
|
2306
2410
|
import { useState as useState7 } from "react";
|
|
2307
|
-
import { cn as
|
|
2308
|
-
import { Fragment, jsx as
|
|
2411
|
+
import { cn as cn3, Input } from "@ai-matrx/design-system";
|
|
2412
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2309
2413
|
function AssociationPicker(props) {
|
|
2310
2414
|
const store = useAssociationsStore();
|
|
2311
2415
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
2312
2416
|
const info = store.registry.getEntityInfo(props.token);
|
|
2313
2417
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
2314
2418
|
const Override = pickerOverrides?.[props.token];
|
|
2315
|
-
if (Override) return /* @__PURE__ */
|
|
2419
|
+
if (Override) return /* @__PURE__ */ jsx7(Override, { ...props });
|
|
2316
2420
|
const title = `Add ${info.labelPlural}`;
|
|
2317
2421
|
const subtitle = props.filing ? `File ${props.containerLabel ?? "this"} under a ${info.label.toLowerCase()}` : props.containerLabel ? `Attach to ${props.containerLabel}` : "Click an item to attach or detach it";
|
|
2318
2422
|
if (!props.open) return null;
|
|
2319
|
-
return /* @__PURE__ */
|
|
2423
|
+
return /* @__PURE__ */ jsx7(
|
|
2320
2424
|
AssociationWindow,
|
|
2321
2425
|
{
|
|
2322
2426
|
open: props.open,
|
|
2323
2427
|
onClose: () => props.onOpenChange(false),
|
|
2324
2428
|
scopeId: `picker:${props.token}`,
|
|
2325
2429
|
title,
|
|
2326
|
-
icon: /* @__PURE__ */
|
|
2430
|
+
icon: /* @__PURE__ */ jsx7(Icon, { className: "size-3.5 text-primary" }),
|
|
2327
2431
|
subtitle,
|
|
2328
|
-
children: /* @__PURE__ */
|
|
2432
|
+
children: /* @__PURE__ */ jsx7(
|
|
2329
2433
|
AssociationCandidateBody,
|
|
2330
2434
|
{
|
|
2331
2435
|
token: props.token,
|
|
@@ -2350,7 +2454,7 @@ function AssociationCandidateBody({
|
|
|
2350
2454
|
onClose
|
|
2351
2455
|
}) {
|
|
2352
2456
|
void onClose;
|
|
2353
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsx7(
|
|
2354
2458
|
EntityCandidateList,
|
|
2355
2459
|
{
|
|
2356
2460
|
token,
|
|
@@ -2381,7 +2485,11 @@ function EntityCandidateList({
|
|
|
2381
2485
|
enabled,
|
|
2382
2486
|
...search.trim() ? { search: search.trim() } : {}
|
|
2383
2487
|
});
|
|
2384
|
-
const {
|
|
2488
|
+
const {
|
|
2489
|
+
results: recentCandidates,
|
|
2490
|
+
loading: recentsLoading,
|
|
2491
|
+
failures: recentsFailures
|
|
2492
|
+
} = useUniversalEntitySearch({
|
|
2385
2493
|
query: "",
|
|
2386
2494
|
tokens: [token],
|
|
2387
2495
|
enabled: enabled && !search.trim()
|
|
@@ -2406,10 +2514,10 @@ function EntityCandidateList({
|
|
|
2406
2514
|
setBusyId(null);
|
|
2407
2515
|
}
|
|
2408
2516
|
};
|
|
2409
|
-
return /* @__PURE__ */
|
|
2410
|
-
/* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2412
|
-
/* @__PURE__ */
|
|
2517
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
2518
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative mb-2", children: [
|
|
2519
|
+
/* @__PURE__ */ jsx7(SearchIcon, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }),
|
|
2520
|
+
/* @__PURE__ */ jsx7(
|
|
2413
2521
|
Input,
|
|
2414
2522
|
{
|
|
2415
2523
|
value: search,
|
|
@@ -2420,46 +2528,58 @@ function EntityCandidateList({
|
|
|
2420
2528
|
}
|
|
2421
2529
|
)
|
|
2422
2530
|
] }),
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
|
|
2426
|
-
] }) : error ? /* @__PURE__ */ jsxs4("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
2427
|
-
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
2428
|
-
/* @__PURE__ */ jsx6("p", { className: "opacity-80", children: error }),
|
|
2429
|
-
/* @__PURE__ */ jsx6(
|
|
2430
|
-
"button",
|
|
2531
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: [
|
|
2532
|
+
!search.trim() && !error && /* @__PURE__ */ jsx7(
|
|
2533
|
+
SearchFailureNotice,
|
|
2431
2534
|
{
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
)
|
|
2438
|
-
] }) : visibleCount === 0 ? /* @__PURE__ */ jsx6(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
2439
|
-
visibleRecents.length > 0 && /* @__PURE__ */ jsx6(
|
|
2440
|
-
CandidateSection,
|
|
2441
|
-
{
|
|
2442
|
-
label: "Recent",
|
|
2443
|
-
candidates: visibleRecents,
|
|
2444
|
-
attachedIds,
|
|
2445
|
-
busyId,
|
|
2446
|
-
icon: /* @__PURE__ */ jsx6(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2447
|
-
onToggle: toggle
|
|
2535
|
+
error: null,
|
|
2536
|
+
failures: recentsFailures,
|
|
2537
|
+
operation: `Load recent ${info.labelPlural.toLowerCase()}`,
|
|
2538
|
+
origin: "associations/AssociationPicker",
|
|
2539
|
+
className: "mb-1"
|
|
2448
2540
|
}
|
|
2449
2541
|
),
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2542
|
+
(loading || recentsLoading) && visibleCount === 0 ? /* @__PURE__ */ jsxs5(ListMessage, { children: [
|
|
2543
|
+
/* @__PURE__ */ jsx7(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
|
|
2544
|
+
"Loading\u2026"
|
|
2545
|
+
] }) : error ? /* @__PURE__ */ jsxs5("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
2546
|
+
/* @__PURE__ */ jsx7("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
2547
|
+
/* @__PURE__ */ jsx7("p", { className: "opacity-80", children: error }),
|
|
2548
|
+
/* @__PURE__ */ jsx7(
|
|
2549
|
+
"button",
|
|
2550
|
+
{
|
|
2551
|
+
type: "button",
|
|
2552
|
+
onClick: reload,
|
|
2553
|
+
className: "mt-1 underline hover:no-underline",
|
|
2554
|
+
children: "Retry"
|
|
2555
|
+
}
|
|
2556
|
+
)
|
|
2557
|
+
] }) : visibleCount === 0 ? /* @__PURE__ */ jsx7(ListMessage, { children: canCreate ? `Nothing to attach yet \u2014 create a new ${info.label.toLowerCase()} below.` : "Nothing to attach." }) : /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
2558
|
+
visibleRecents.length > 0 && /* @__PURE__ */ jsx7(
|
|
2559
|
+
CandidateSection,
|
|
2560
|
+
{
|
|
2561
|
+
label: "Recent",
|
|
2562
|
+
candidates: visibleRecents,
|
|
2563
|
+
attachedIds,
|
|
2564
|
+
busyId,
|
|
2565
|
+
icon: /* @__PURE__ */ jsx7(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2566
|
+
onToggle: toggle
|
|
2567
|
+
}
|
|
2568
|
+
),
|
|
2569
|
+
ordinaryCandidates.length > 0 && /* @__PURE__ */ jsx7(
|
|
2570
|
+
CandidateSection,
|
|
2571
|
+
{
|
|
2572
|
+
label: visibleRecents.length > 0 ? `All ${info.labelPlural}` : null,
|
|
2573
|
+
candidates: ordinaryCandidates,
|
|
2574
|
+
attachedIds,
|
|
2575
|
+
busyId,
|
|
2576
|
+
icon: /* @__PURE__ */ jsx7(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2577
|
+
onToggle: toggle
|
|
2578
|
+
}
|
|
2579
|
+
)
|
|
2580
|
+
] })
|
|
2581
|
+
] }),
|
|
2582
|
+
canCreate && /* @__PURE__ */ jsx7(
|
|
2463
2583
|
CreateAndAttachFooter,
|
|
2464
2584
|
{
|
|
2465
2585
|
token,
|
|
@@ -2479,33 +2599,33 @@ function CandidateSection({
|
|
|
2479
2599
|
icon,
|
|
2480
2600
|
onToggle
|
|
2481
2601
|
}) {
|
|
2482
|
-
return /* @__PURE__ */
|
|
2483
|
-
label && /* @__PURE__ */
|
|
2484
|
-
/* @__PURE__ */
|
|
2602
|
+
return /* @__PURE__ */ jsxs5("section", { className: "space-y-0.5", children: [
|
|
2603
|
+
label && /* @__PURE__ */ jsx7("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: label }),
|
|
2604
|
+
/* @__PURE__ */ jsx7("ul", { className: "space-y-0.5", children: candidates.map((candidate) => {
|
|
2485
2605
|
const attached = attachedIds.has(candidate.id);
|
|
2486
2606
|
const busy = busyId === candidate.id;
|
|
2487
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsxs5(
|
|
2488
2608
|
"button",
|
|
2489
2609
|
{
|
|
2490
2610
|
type: "button",
|
|
2491
2611
|
disabled: busy,
|
|
2492
2612
|
onClick: () => void onToggle(candidate.id, candidate.title),
|
|
2493
|
-
className:
|
|
2613
|
+
className: cn3(
|
|
2494
2614
|
"group flex min-h-11 w-full items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors md:min-h-0",
|
|
2495
2615
|
"hover:bg-accent disabled:opacity-50",
|
|
2496
2616
|
attached && "bg-accent/40"
|
|
2497
2617
|
),
|
|
2498
2618
|
children: [
|
|
2499
2619
|
icon,
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ jsx7("span", { className: "flex-1 min-w-0 truncate text-foreground", children: candidate.title }),
|
|
2621
|
+
/* @__PURE__ */ jsx7(
|
|
2502
2622
|
"span",
|
|
2503
2623
|
{
|
|
2504
|
-
className:
|
|
2624
|
+
className: cn3(
|
|
2505
2625
|
"flex h-5 w-5 items-center justify-center rounded-full shrink-0",
|
|
2506
2626
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2507
2627
|
),
|
|
2508
|
-
children: busy ? /* @__PURE__ */
|
|
2628
|
+
children: busy ? /* @__PURE__ */ jsx7(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ jsx7(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx7(PlusIcon, { className: "h-3 w-3" })
|
|
2509
2629
|
}
|
|
2510
2630
|
)
|
|
2511
2631
|
]
|
|
@@ -2561,7 +2681,7 @@ function CreateAndAttachFooter({
|
|
|
2561
2681
|
}
|
|
2562
2682
|
};
|
|
2563
2683
|
if (!editing) {
|
|
2564
|
-
return /* @__PURE__ */
|
|
2684
|
+
return /* @__PURE__ */ jsxs5(
|
|
2565
2685
|
"button",
|
|
2566
2686
|
{
|
|
2567
2687
|
type: "button",
|
|
@@ -2571,10 +2691,10 @@ function CreateAndAttachFooter({
|
|
|
2571
2691
|
},
|
|
2572
2692
|
className: "mt-2 flex min-h-11 w-full shrink-0 items-center justify-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground md:min-h-0",
|
|
2573
2693
|
children: [
|
|
2574
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ jsx7(PlusIcon, { className: "h-4 w-4" }),
|
|
2575
2695
|
"New ",
|
|
2576
2696
|
info.label,
|
|
2577
|
-
seed ? /* @__PURE__ */
|
|
2697
|
+
seed ? /* @__PURE__ */ jsxs5("span", { className: "max-w-40 truncate text-muted-foreground/70", children: [
|
|
2578
2698
|
"\u201C",
|
|
2579
2699
|
seed,
|
|
2580
2700
|
"\u201D"
|
|
@@ -2583,8 +2703,8 @@ function CreateAndAttachFooter({
|
|
|
2583
2703
|
}
|
|
2584
2704
|
);
|
|
2585
2705
|
}
|
|
2586
|
-
return /* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsxs5("div", { className: "mt-2 flex shrink-0 items-center gap-1.5", children: [
|
|
2707
|
+
/* @__PURE__ */ jsx7(
|
|
2588
2708
|
Input,
|
|
2589
2709
|
{
|
|
2590
2710
|
autoFocus: true,
|
|
@@ -2603,17 +2723,17 @@ function CreateAndAttachFooter({
|
|
|
2603
2723
|
style: { fontSize: 16 }
|
|
2604
2724
|
}
|
|
2605
2725
|
),
|
|
2606
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx7(
|
|
2607
2727
|
"button",
|
|
2608
2728
|
{
|
|
2609
2729
|
type: "button",
|
|
2610
2730
|
disabled: busy || !name.trim(),
|
|
2611
2731
|
onClick: () => void submit(),
|
|
2612
2732
|
className: "flex h-11 items-center gap-1 rounded-md bg-primary px-2.5 text-sm font-medium text-primary-foreground transition-opacity disabled:opacity-50 md:h-8",
|
|
2613
|
-
children: busy ? /* @__PURE__ */
|
|
2733
|
+
children: busy ? /* @__PURE__ */ jsx7(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : "Create"
|
|
2614
2734
|
}
|
|
2615
2735
|
),
|
|
2616
|
-
/* @__PURE__ */
|
|
2736
|
+
/* @__PURE__ */ jsx7(
|
|
2617
2737
|
"button",
|
|
2618
2738
|
{
|
|
2619
2739
|
type: "button",
|
|
@@ -2624,37 +2744,37 @@ function CreateAndAttachFooter({
|
|
|
2624
2744
|
},
|
|
2625
2745
|
title: "Cancel",
|
|
2626
2746
|
className: "flex h-11 w-11 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50 md:h-8 md:w-8",
|
|
2627
|
-
children: /* @__PURE__ */
|
|
2747
|
+
children: /* @__PURE__ */ jsx7(XIcon, { className: "h-4 w-4" })
|
|
2628
2748
|
}
|
|
2629
2749
|
)
|
|
2630
2750
|
] });
|
|
2631
2751
|
}
|
|
2632
2752
|
function ListMessage({ children }) {
|
|
2633
|
-
return /* @__PURE__ */
|
|
2753
|
+
return /* @__PURE__ */ jsx7("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children });
|
|
2634
2754
|
}
|
|
2635
2755
|
|
|
2636
2756
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2637
2757
|
import { useState as useState8 } from "react";
|
|
2638
|
-
import { cn as
|
|
2758
|
+
import { Button, cn as cn5, Input as Input2 } from "@ai-matrx/design-system";
|
|
2639
2759
|
|
|
2640
2760
|
// src/react/components/entityDoors.tsx
|
|
2641
|
-
import { cn as
|
|
2642
|
-
import { jsx as
|
|
2761
|
+
import { cn as cn4 } from "@ai-matrx/design-system";
|
|
2762
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2643
2763
|
function DoorRef(props) {
|
|
2644
2764
|
const { onOpen, ...refProps } = props;
|
|
2645
2765
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2646
2766
|
const store = useAssociationsStore();
|
|
2647
2767
|
const HostRef = entityDoors?.EntityRef;
|
|
2648
|
-
if (HostRef) return /* @__PURE__ */
|
|
2768
|
+
if (HostRef) return /* @__PURE__ */ jsx8(HostRef, { ...refProps });
|
|
2649
2769
|
const name = refProps.name ?? null;
|
|
2650
2770
|
const href = store.registry.tryGetEntityInfo(refProps.token)?.hrefFor?.(refProps.id) ?? null;
|
|
2651
2771
|
if (onOpen) {
|
|
2652
|
-
return /* @__PURE__ */
|
|
2772
|
+
return /* @__PURE__ */ jsx8(
|
|
2653
2773
|
"button",
|
|
2654
2774
|
{
|
|
2655
2775
|
type: "button",
|
|
2656
2776
|
onClick: onOpen,
|
|
2657
|
-
className:
|
|
2777
|
+
className: cn4(
|
|
2658
2778
|
"min-w-0 truncate text-left underline-offset-2 hover:underline",
|
|
2659
2779
|
refProps.className
|
|
2660
2780
|
),
|
|
@@ -2663,30 +2783,30 @@ function DoorRef(props) {
|
|
|
2663
2783
|
);
|
|
2664
2784
|
}
|
|
2665
2785
|
if (href) {
|
|
2666
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsxs6(
|
|
2667
2787
|
"a",
|
|
2668
2788
|
{
|
|
2669
2789
|
href,
|
|
2670
2790
|
target: refProps.openInNewTab === false ? void 0 : "_blank",
|
|
2671
2791
|
rel: "noopener noreferrer",
|
|
2672
|
-
className:
|
|
2792
|
+
className: cn4(
|
|
2673
2793
|
"inline-flex min-w-0 items-center gap-1 truncate underline-offset-2 hover:underline",
|
|
2674
2794
|
refProps.className
|
|
2675
2795
|
),
|
|
2676
2796
|
children: [
|
|
2677
|
-
/* @__PURE__ */
|
|
2678
|
-
/* @__PURE__ */
|
|
2797
|
+
/* @__PURE__ */ jsx8("span", { className: "min-w-0 truncate", children: name }),
|
|
2798
|
+
/* @__PURE__ */ jsx8(ExternalLinkIcon, { className: "h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-60" })
|
|
2679
2799
|
]
|
|
2680
2800
|
}
|
|
2681
2801
|
);
|
|
2682
2802
|
}
|
|
2683
|
-
return /* @__PURE__ */
|
|
2803
|
+
return /* @__PURE__ */ jsx8("span", { className: cn4("min-w-0 truncate", refProps.className), children: name });
|
|
2684
2804
|
}
|
|
2685
2805
|
function UnresolvedRef({ token, id }) {
|
|
2686
2806
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2687
2807
|
const HostUnresolved = entityDoors?.UnresolvedRef;
|
|
2688
|
-
if (HostUnresolved) return /* @__PURE__ */
|
|
2689
|
-
return /* @__PURE__ */
|
|
2808
|
+
if (HostUnresolved) return /* @__PURE__ */ jsx8(HostUnresolved, { token, id });
|
|
2809
|
+
return /* @__PURE__ */ jsx8(
|
|
2690
2810
|
"span",
|
|
2691
2811
|
{
|
|
2692
2812
|
className: "inline-flex items-center rounded border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] text-muted-foreground",
|
|
@@ -2699,11 +2819,11 @@ function DoorControlsSlot(props) {
|
|
|
2699
2819
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2700
2820
|
const store = useAssociationsStore();
|
|
2701
2821
|
const HostControls = entityDoors?.DoorControls;
|
|
2702
|
-
if (HostControls) return /* @__PURE__ */
|
|
2822
|
+
if (HostControls) return /* @__PURE__ */ jsx8(HostControls, { ...props });
|
|
2703
2823
|
const href = store.registry.tryGetEntityInfo(props.token)?.hrefFor?.(props.id) ?? null;
|
|
2704
2824
|
if (!href) return null;
|
|
2705
2825
|
const label = props.name ? `Open ${props.name}` : `Open this ${props.token}`;
|
|
2706
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ jsx8(
|
|
2707
2827
|
"a",
|
|
2708
2828
|
{
|
|
2709
2829
|
href,
|
|
@@ -2711,22 +2831,29 @@ function DoorControlsSlot(props) {
|
|
|
2711
2831
|
rel: "noopener noreferrer",
|
|
2712
2832
|
"aria-label": label,
|
|
2713
2833
|
title: label,
|
|
2714
|
-
className:
|
|
2834
|
+
className: cn4(
|
|
2715
2835
|
"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2716
2836
|
props.className
|
|
2717
2837
|
),
|
|
2718
|
-
children: /* @__PURE__ */
|
|
2838
|
+
children: /* @__PURE__ */ jsx8(ExternalLinkIcon, { className: "h-3 w-3" })
|
|
2719
2839
|
}
|
|
2720
2840
|
);
|
|
2721
2841
|
}
|
|
2722
2842
|
|
|
2723
2843
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2724
|
-
import { jsx as
|
|
2844
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2725
2845
|
function attachedKey(token, id) {
|
|
2726
2846
|
return `${token}:${id}`;
|
|
2727
2847
|
}
|
|
2728
2848
|
function UniversalAssociationPicker(props) {
|
|
2729
|
-
const {
|
|
2849
|
+
const {
|
|
2850
|
+
attachedKeys,
|
|
2851
|
+
onAttach,
|
|
2852
|
+
onDetach,
|
|
2853
|
+
orgId,
|
|
2854
|
+
emptyQueryMode = "recents",
|
|
2855
|
+
className
|
|
2856
|
+
} = props;
|
|
2730
2857
|
const store = useAssociationsStore();
|
|
2731
2858
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
2732
2859
|
const notifier = useNotifier();
|
|
@@ -2734,12 +2861,18 @@ function UniversalAssociationPicker(props) {
|
|
|
2734
2861
|
const [query, setQuery] = useState8("");
|
|
2735
2862
|
const [browseToken, setBrowseToken] = useState8(null);
|
|
2736
2863
|
const [busyKey, setBusyKey] = useState8(null);
|
|
2737
|
-
const
|
|
2864
|
+
const [overrideOpen, setOverrideOpen] = useState8(false);
|
|
2865
|
+
const [overrideMount, setOverrideMount] = useState8(0);
|
|
2866
|
+
const { results, loading, source, failures, error } = useUniversalEntitySearch({
|
|
2738
2867
|
query,
|
|
2739
2868
|
tokens,
|
|
2740
|
-
|
|
2741
|
-
|
|
2869
|
+
enabled: browseToken === null,
|
|
2870
|
+
emptyQueryMode
|
|
2742
2871
|
});
|
|
2872
|
+
const selectToken = (next) => {
|
|
2873
|
+
setBrowseToken(next);
|
|
2874
|
+
setOverrideOpen(next !== null && Boolean(pickerOverrides?.[next]));
|
|
2875
|
+
};
|
|
2743
2876
|
const toggle = async (c) => {
|
|
2744
2877
|
const key = attachedKey(c.token, c.id);
|
|
2745
2878
|
if (busyKey) return;
|
|
@@ -2763,25 +2896,25 @@ function UniversalAssociationPicker(props) {
|
|
|
2763
2896
|
groups.set(r.token, list);
|
|
2764
2897
|
}
|
|
2765
2898
|
const BrowseOverride = browseToken ? pickerOverrides?.[browseToken] : void 0;
|
|
2766
|
-
return /* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
2899
|
+
return /* @__PURE__ */ jsxs7("div", { className: cn5("flex min-h-0 flex-1 flex-col gap-2", className), children: [
|
|
2900
|
+
/* @__PURE__ */ jsxs7("div", { className: "relative", children: [
|
|
2901
|
+
/* @__PURE__ */ jsx9(SearchIcon, { className: "absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
2902
|
+
/* @__PURE__ */ jsx9(
|
|
2770
2903
|
Input2,
|
|
2771
2904
|
{
|
|
2772
2905
|
value: query,
|
|
2773
2906
|
onChange: (e) => {
|
|
2774
2907
|
setQuery(e.target.value);
|
|
2775
|
-
if (browseToken)
|
|
2908
|
+
if (browseToken) selectToken(null);
|
|
2776
2909
|
},
|
|
2777
2910
|
placeholder: "Search everything\u2026",
|
|
2778
2911
|
className: "pl-8 text-base",
|
|
2779
2912
|
style: { fontSize: 16 }
|
|
2780
2913
|
}
|
|
2781
2914
|
),
|
|
2782
|
-
loading && browseToken === null && /* @__PURE__ */
|
|
2915
|
+
loading && browseToken === null && /* @__PURE__ */ jsx9(SpinnerIcon, { className: "absolute right-2.5 top-1/2 h-4 w-4 -translate-y-1/2 animate-spin text-muted-foreground" })
|
|
2783
2916
|
] }),
|
|
2784
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx9(
|
|
2785
2918
|
"div",
|
|
2786
2919
|
{
|
|
2787
2920
|
role: "group",
|
|
@@ -2791,17 +2924,18 @@ function UniversalAssociationPicker(props) {
|
|
|
2791
2924
|
const info = store.registry.getEntityInfo(t);
|
|
2792
2925
|
const ChipIcon = info.Icon ?? DefaultEntityIcon;
|
|
2793
2926
|
const active = browseToken === t;
|
|
2794
|
-
return /* @__PURE__ */
|
|
2927
|
+
return /* @__PURE__ */ jsxs7(
|
|
2795
2928
|
"button",
|
|
2796
2929
|
{
|
|
2797
2930
|
type: "button",
|
|
2798
|
-
|
|
2799
|
-
|
|
2931
|
+
"aria-pressed": active,
|
|
2932
|
+
onClick: () => selectToken(active ? null : t),
|
|
2933
|
+
className: cn5(
|
|
2800
2934
|
"inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
2801
2935
|
active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
2802
2936
|
),
|
|
2803
2937
|
children: [
|
|
2804
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx9(ChipIcon, { className: "h-3 w-3" }),
|
|
2805
2939
|
info.labelPlural
|
|
2806
2940
|
]
|
|
2807
2941
|
},
|
|
@@ -2813,91 +2947,150 @@ function UniversalAssociationPicker(props) {
|
|
|
2813
2947
|
browseToken && BrowseOverride ? (
|
|
2814
2948
|
// The token's canonical host picker (e.g. the stored-files browser)
|
|
2815
2949
|
// owns per-token browsing when registered — never a plain list twin.
|
|
2816
|
-
|
|
2817
|
-
|
|
2950
|
+
// It opens in its own window; this body says where it went.
|
|
2951
|
+
/* @__PURE__ */ jsxs7(
|
|
2952
|
+
"div",
|
|
2818
2953
|
{
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2954
|
+
role: "region",
|
|
2955
|
+
"aria-label": `${store.registry.getEntityInfo(browseToken).labelPlural} window`,
|
|
2956
|
+
className: "flex flex-1 flex-col items-center justify-center gap-3 px-4 py-8 text-center",
|
|
2957
|
+
children: [
|
|
2958
|
+
/* @__PURE__ */ jsx9("p", { className: "text-sm text-foreground", children: overrideOpen ? `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is open.` : `The ${store.registry.getEntityInfo(browseToken).labelPlural.toLowerCase()} window is closed.` }),
|
|
2959
|
+
/* @__PURE__ */ jsx9("p", { className: "max-w-xs text-[12px] text-muted-foreground", children: overrideOpen ? "Check items there to attach them; uncheck to detach. Changes save as you go." : "Reopen it to pick more, or go back to search everything." }),
|
|
2960
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
2961
|
+
/* @__PURE__ */ jsxs7(
|
|
2962
|
+
Button,
|
|
2963
|
+
{
|
|
2964
|
+
type: "button",
|
|
2965
|
+
size: "sm",
|
|
2966
|
+
variant: overrideOpen ? "outline" : "default",
|
|
2967
|
+
onClick: () => {
|
|
2968
|
+
setOverrideOpen(true);
|
|
2969
|
+
setOverrideMount((n) => n + 1);
|
|
2970
|
+
},
|
|
2971
|
+
children: [
|
|
2972
|
+
/* @__PURE__ */ jsx9(MaximizeIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
2973
|
+
overrideOpen ? "Bring window to front" : "Reopen window"
|
|
2974
|
+
]
|
|
2975
|
+
}
|
|
2976
|
+
),
|
|
2977
|
+
/* @__PURE__ */ jsx9(
|
|
2978
|
+
Button,
|
|
2979
|
+
{
|
|
2980
|
+
type: "button",
|
|
2981
|
+
size: "sm",
|
|
2982
|
+
variant: "ghost",
|
|
2983
|
+
onClick: () => selectToken(null),
|
|
2984
|
+
children: "Back to search"
|
|
2985
|
+
}
|
|
2986
|
+
)
|
|
2987
|
+
] }),
|
|
2988
|
+
overrideOpen && /* @__PURE__ */ jsx9(
|
|
2989
|
+
BrowseOverride,
|
|
2990
|
+
{
|
|
2991
|
+
open: true,
|
|
2992
|
+
onOpenChange: (open) => {
|
|
2993
|
+
if (!open) setOverrideOpen(false);
|
|
2994
|
+
},
|
|
2995
|
+
token: browseToken,
|
|
2996
|
+
orgId: orgId ?? null,
|
|
2997
|
+
attachedIds: new Set(
|
|
2998
|
+
[...attachedKeys].filter((k) => k.startsWith(`${browseToken}:`)).map((k) => k.slice(browseToken.length + 1))
|
|
2999
|
+
),
|
|
3000
|
+
onAttach: (id, title) => onAttach(browseToken, id, title),
|
|
3001
|
+
onDetach: (id) => onDetach(browseToken, id)
|
|
3002
|
+
},
|
|
3003
|
+
overrideMount
|
|
3004
|
+
)
|
|
3005
|
+
]
|
|
2830
3006
|
}
|
|
2831
3007
|
)
|
|
2832
|
-
) : browseToken ? /* @__PURE__ */
|
|
3008
|
+
) : browseToken ? /* @__PURE__ */ jsx9("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ jsx9(
|
|
2833
3009
|
AssociationCandidateBody,
|
|
2834
3010
|
{
|
|
2835
3011
|
token: browseToken,
|
|
2836
3012
|
enabled: true,
|
|
2837
3013
|
orgId,
|
|
2838
|
-
onClose: () =>
|
|
3014
|
+
onClose: () => selectToken(null),
|
|
2839
3015
|
attachedIds: new Set(
|
|
2840
3016
|
[...attachedKeys].filter((k) => k.startsWith(`${browseToken}:`)).map((k) => k.slice(browseToken.length + 1))
|
|
2841
3017
|
),
|
|
2842
3018
|
onAttach: (id, title) => onAttach(browseToken, id, title),
|
|
2843
3019
|
onDetach: (id) => onDetach(browseToken, id)
|
|
2844
3020
|
}
|
|
2845
|
-
) }) : /* @__PURE__ */
|
|
3021
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
2846
3022
|
"div",
|
|
2847
3023
|
{
|
|
2848
3024
|
role: "region",
|
|
2849
3025
|
"aria-label": "Association search results",
|
|
2850
3026
|
className: "-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1",
|
|
2851
|
-
children:
|
|
2852
|
-
|
|
3027
|
+
children: error ? /* @__PURE__ */ jsx9(
|
|
3028
|
+
SearchFailureNotice,
|
|
3029
|
+
{
|
|
3030
|
+
error,
|
|
3031
|
+
failures,
|
|
3032
|
+
operation: "Search to attach",
|
|
3033
|
+
origin: "associations/UniversalAssociationPicker"
|
|
3034
|
+
}
|
|
3035
|
+
) : results.length === 0 && failures.length === 0 ? /* @__PURE__ */ jsx9("p", { className: "py-6 text-center text-[12px] text-muted-foreground", children: loading ? "Searching\u2026" : query.trim() ? "No matches \u2014 narrow with a type chip to browse." : "Nothing to attach yet. Type to search, or pick a type to browse." }) : /* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
3036
|
+
/* @__PURE__ */ jsx9(
|
|
3037
|
+
SearchFailureNotice,
|
|
3038
|
+
{
|
|
3039
|
+
error: null,
|
|
3040
|
+
failures,
|
|
3041
|
+
operation: "Search to attach",
|
|
3042
|
+
origin: "associations/UniversalAssociationPicker"
|
|
3043
|
+
}
|
|
3044
|
+
),
|
|
3045
|
+
source !== "search" && results.length > 0 && /* @__PURE__ */ jsx9("p", { className: "px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/60", children: source === "recents" ? "Recent" : "Browse" }),
|
|
2853
3046
|
[...groups.entries()].map(([token, items]) => {
|
|
2854
3047
|
const info = store.registry.getEntityInfo(token);
|
|
2855
3048
|
const GroupIcon = info.Icon ?? DefaultEntityIcon;
|
|
2856
|
-
return /* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsxs7("div", { className: "space-y-0.5", children: [
|
|
3050
|
+
/* @__PURE__ */ jsxs7("p", { className: "flex items-center gap-1 px-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground/70", children: [
|
|
3051
|
+
/* @__PURE__ */ jsx9(GroupIcon, { className: "h-3 w-3" }),
|
|
2859
3052
|
info.labelPlural
|
|
2860
3053
|
] }),
|
|
2861
|
-
/* @__PURE__ */
|
|
3054
|
+
/* @__PURE__ */ jsx9("ul", { className: "space-y-0.5", children: items.map((c) => {
|
|
2862
3055
|
const key = attachedKey(c.token, c.id);
|
|
2863
3056
|
const attached = attachedKeys.has(key);
|
|
2864
3057
|
const busy = busyKey === key;
|
|
2865
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ jsxs7(
|
|
2866
3059
|
"li",
|
|
2867
3060
|
{
|
|
2868
|
-
className:
|
|
3061
|
+
className: cn5(
|
|
2869
3062
|
"group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
|
|
2870
3063
|
"hover:bg-accent",
|
|
2871
3064
|
attached && "bg-accent/40"
|
|
2872
3065
|
),
|
|
2873
3066
|
children: [
|
|
2874
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ jsxs7(
|
|
2875
3068
|
"button",
|
|
2876
3069
|
{
|
|
2877
3070
|
type: "button",
|
|
2878
3071
|
disabled: busy,
|
|
2879
3072
|
onClick: () => toggle(c),
|
|
2880
3073
|
title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
|
|
2881
|
-
className:
|
|
3074
|
+
className: cn5(
|
|
2882
3075
|
"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
|
|
2883
3076
|
"disabled:opacity-50"
|
|
2884
3077
|
),
|
|
2885
3078
|
children: [
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
|
|
3080
|
+
/* @__PURE__ */ jsx9(
|
|
2888
3081
|
"span",
|
|
2889
3082
|
{
|
|
2890
|
-
className:
|
|
3083
|
+
className: cn5(
|
|
2891
3084
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
2892
3085
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2893
3086
|
),
|
|
2894
|
-
children: busy ? /* @__PURE__ */
|
|
3087
|
+
children: busy ? /* @__PURE__ */ jsx9(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : attached ? /* @__PURE__ */ jsx9(CheckIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx9(PlusIcon, { className: "h-3 w-3" })
|
|
2895
3088
|
}
|
|
2896
3089
|
)
|
|
2897
3090
|
]
|
|
2898
3091
|
}
|
|
2899
3092
|
),
|
|
2900
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsx9(
|
|
2901
3094
|
DoorControlsSlot,
|
|
2902
3095
|
{
|
|
2903
3096
|
token: c.token,
|
|
@@ -2920,8 +3113,8 @@ function UniversalAssociationPicker(props) {
|
|
|
2920
3113
|
|
|
2921
3114
|
// src/react/components/AttachedItemsSheet.tsx
|
|
2922
3115
|
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2923
|
-
import { cn as
|
|
2924
|
-
import { Fragment as Fragment2, jsx as
|
|
3116
|
+
import { cn as cn6 } from "@ai-matrx/design-system";
|
|
3117
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2925
3118
|
function metadataIsPinned(metadata) {
|
|
2926
3119
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
2927
3120
|
}
|
|
@@ -2932,9 +3125,9 @@ function AttachedItemsSheet(props) {
|
|
|
2932
3125
|
const title = info.labelPlural;
|
|
2933
3126
|
const containerName = props.container?.label ?? props.containerLabel;
|
|
2934
3127
|
const filing = props.container?.direction === "outgoing";
|
|
2935
|
-
const subtitle = props.container ? /* @__PURE__ */
|
|
3128
|
+
const subtitle = props.container ? /* @__PURE__ */ jsxs8("span", { className: "inline-flex min-w-0 max-w-full items-center gap-1", children: [
|
|
2936
3129
|
filing ? "What this is filed under:" : "Attached to",
|
|
2937
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsx10(
|
|
2938
3131
|
DoorRef,
|
|
2939
3132
|
{
|
|
2940
3133
|
token: props.container.type,
|
|
@@ -2945,16 +3138,16 @@ function AttachedItemsSheet(props) {
|
|
|
2945
3138
|
)
|
|
2946
3139
|
] }) : props.containerLabel ? `Attached to ${props.containerLabel}` : "Attached items";
|
|
2947
3140
|
if (!props.open) return null;
|
|
2948
|
-
return /* @__PURE__ */
|
|
3141
|
+
return /* @__PURE__ */ jsx10(
|
|
2949
3142
|
AssociationWindow,
|
|
2950
3143
|
{
|
|
2951
3144
|
open: props.open,
|
|
2952
3145
|
onClose: () => props.onOpenChange(false),
|
|
2953
3146
|
scopeId: `attached:${props.token}`,
|
|
2954
3147
|
title,
|
|
2955
|
-
icon: /* @__PURE__ */
|
|
3148
|
+
icon: /* @__PURE__ */ jsx10(Icon, { className: "size-3.5 text-primary" }),
|
|
2956
3149
|
subtitle,
|
|
2957
|
-
children: /* @__PURE__ */
|
|
3150
|
+
children: /* @__PURE__ */ jsx10(
|
|
2958
3151
|
AttachedItemsBody,
|
|
2959
3152
|
{
|
|
2960
3153
|
token: props.token,
|
|
@@ -3043,31 +3236,31 @@ function AttachedItemsBody({
|
|
|
3043
3236
|
setBusyId(null);
|
|
3044
3237
|
}
|
|
3045
3238
|
};
|
|
3046
|
-
return /* @__PURE__ */
|
|
3047
|
-
titleError ? /* @__PURE__ */
|
|
3239
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
3240
|
+
titleError ? /* @__PURE__ */ jsxs8("div", { className: "mb-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
3048
3241
|
"Showing names recorded at attach time \u2014 they may be out of date.",
|
|
3049
3242
|
" ",
|
|
3050
3243
|
titleError
|
|
3051
3244
|
] }) : null,
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
/* @__PURE__ */
|
|
3245
|
+
/* @__PURE__ */ jsx10("div", { className: "flex-1 min-h-0 overflow-y-auto -mx-1 px-1", children: links.length === 0 ? /* @__PURE__ */ jsx10("div", { className: "flex items-center justify-center py-8 text-[13px] text-muted-foreground", children: "Nothing attached yet." }) : titles === null ? /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children: [
|
|
3246
|
+
/* @__PURE__ */ jsx10(SpinnerIcon, { className: "h-4 w-4 animate-spin" }),
|
|
3054
3247
|
"Loading\u2026"
|
|
3055
|
-
] }) : /* @__PURE__ */
|
|
3248
|
+
] }) : /* @__PURE__ */ jsx10("ul", { className: "space-y-0.5", children: links.map((link) => {
|
|
3056
3249
|
const resolved = titles.get(link.resourceId);
|
|
3057
3250
|
const missing = !titles.has(link.resourceId);
|
|
3058
3251
|
const name = resolved ?? link.label ?? (missing ? null : "Untitled");
|
|
3059
3252
|
const busy = busyId === link.resourceId;
|
|
3060
3253
|
const pinned = metadataIsPinned(link.metadata);
|
|
3061
|
-
return /* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ jsxs8(
|
|
3062
3255
|
"li",
|
|
3063
3256
|
{
|
|
3064
3257
|
className: "group/entity-ref group flex items-center gap-2 rounded-md px-2.5 py-2 text-sm transition-colors hover:bg-accent",
|
|
3065
3258
|
children: [
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx10(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3260
|
+
/* @__PURE__ */ jsx10("span", { className: "flex-1 min-w-0 truncate", children: name === null ? (
|
|
3068
3261
|
// The X beside the row stays the one-click detach.
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
) : /* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx10(UnresolvedRef, { token, id: link.resourceId })
|
|
3263
|
+
) : /* @__PURE__ */ jsx10(
|
|
3071
3264
|
DoorRef,
|
|
3072
3265
|
{
|
|
3073
3266
|
token,
|
|
@@ -3077,7 +3270,7 @@ function AttachedItemsBody({
|
|
|
3077
3270
|
className: "text-foreground"
|
|
3078
3271
|
}
|
|
3079
3272
|
) }),
|
|
3080
|
-
onSetPinned ? /* @__PURE__ */
|
|
3273
|
+
onSetPinned ? /* @__PURE__ */ jsx10(
|
|
3081
3274
|
"button",
|
|
3082
3275
|
{
|
|
3083
3276
|
type: "button",
|
|
@@ -3085,14 +3278,14 @@ function AttachedItemsBody({
|
|
|
3085
3278
|
onClick: () => void setPinned(link, !pinned),
|
|
3086
3279
|
title: pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3087
3280
|
"aria-label": pinned ? "Unpin" : "Pin",
|
|
3088
|
-
className:
|
|
3281
|
+
className: cn6(
|
|
3089
3282
|
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
3090
3283
|
pinned ? "text-primary" : "text-muted-foreground"
|
|
3091
3284
|
),
|
|
3092
|
-
children: /* @__PURE__ */
|
|
3285
|
+
children: /* @__PURE__ */ jsx10(
|
|
3093
3286
|
PinIcon,
|
|
3094
3287
|
{
|
|
3095
|
-
className:
|
|
3288
|
+
className: cn6(
|
|
3096
3289
|
"h-3.5 w-3.5",
|
|
3097
3290
|
pinned && "fill-primary/20"
|
|
3098
3291
|
)
|
|
@@ -3100,18 +3293,18 @@ function AttachedItemsBody({
|
|
|
3100
3293
|
)
|
|
3101
3294
|
}
|
|
3102
3295
|
) : null,
|
|
3103
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsx10(
|
|
3104
3297
|
"button",
|
|
3105
3298
|
{
|
|
3106
3299
|
type: "button",
|
|
3107
3300
|
disabled: busy,
|
|
3108
3301
|
onClick: () => void detach(link),
|
|
3109
3302
|
title: "Detach",
|
|
3110
|
-
className:
|
|
3303
|
+
className: cn6(
|
|
3111
3304
|
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
3112
3305
|
"hover:bg-destructive/10 hover:text-destructive disabled:opacity-50"
|
|
3113
3306
|
),
|
|
3114
|
-
children: busy ? /* @__PURE__ */
|
|
3307
|
+
children: busy ? /* @__PURE__ */ jsx10(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx10(XIcon, { className: "h-3.5 w-3.5" })
|
|
3115
3308
|
}
|
|
3116
3309
|
)
|
|
3117
3310
|
]
|
|
@@ -3119,14 +3312,14 @@ function AttachedItemsBody({
|
|
|
3119
3312
|
link.edgeId
|
|
3120
3313
|
);
|
|
3121
3314
|
}) }) }),
|
|
3122
|
-
onAdd ? /* @__PURE__ */
|
|
3315
|
+
onAdd ? /* @__PURE__ */ jsxs8(
|
|
3123
3316
|
"button",
|
|
3124
3317
|
{
|
|
3125
3318
|
type: "button",
|
|
3126
3319
|
onClick: onAdd,
|
|
3127
3320
|
className: "mt-2 flex w-full items-center justify-center gap-1.5 rounded-md border border-border px-3 py-2 text-sm text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground",
|
|
3128
3321
|
children: [
|
|
3129
|
-
/* @__PURE__ */
|
|
3322
|
+
/* @__PURE__ */ jsx10(PlusIcon, { className: "h-4 w-4" }),
|
|
3130
3323
|
"Attach ",
|
|
3131
3324
|
info.labelPlural.toLowerCase()
|
|
3132
3325
|
]
|
|
@@ -3137,7 +3330,7 @@ function AttachedItemsBody({
|
|
|
3137
3330
|
|
|
3138
3331
|
// src/react/components/AssociationCard.tsx
|
|
3139
3332
|
import { useState as useState10 } from "react";
|
|
3140
|
-
import { cn as
|
|
3333
|
+
import { cn as cn7 } from "@ai-matrx/design-system";
|
|
3141
3334
|
|
|
3142
3335
|
// src/react/contentRoles.ts
|
|
3143
3336
|
var CONTENT_ROLES = [
|
|
@@ -3187,7 +3380,7 @@ function getContentRoleMeta(role) {
|
|
|
3187
3380
|
}
|
|
3188
3381
|
|
|
3189
3382
|
// src/react/components/AssociationCard.tsx
|
|
3190
|
-
import { Fragment as Fragment3, jsx as
|
|
3383
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3191
3384
|
function AssociationCard({
|
|
3192
3385
|
token,
|
|
3193
3386
|
container: containerProp,
|
|
@@ -3223,58 +3416,58 @@ function AssociationCard({
|
|
|
3223
3416
|
const filing = container.direction === "outgoing";
|
|
3224
3417
|
const canAttach = info.canListCandidates && (!filing || isAssociationTargetType(token));
|
|
3225
3418
|
const canDrillIn = count > 0;
|
|
3226
|
-
return /* @__PURE__ */
|
|
3227
|
-
/* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
3420
|
+
/* @__PURE__ */ jsxs9(
|
|
3228
3421
|
"div",
|
|
3229
3422
|
{
|
|
3230
|
-
className:
|
|
3423
|
+
className: cn7(
|
|
3231
3424
|
"group relative flex items-center gap-3 overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary/30 hover:bg-accent/40",
|
|
3232
3425
|
className
|
|
3233
3426
|
),
|
|
3234
3427
|
children: [
|
|
3235
|
-
/* @__PURE__ */
|
|
3428
|
+
/* @__PURE__ */ jsx11(
|
|
3236
3429
|
"span",
|
|
3237
3430
|
{
|
|
3238
|
-
className:
|
|
3431
|
+
className: cn7(
|
|
3239
3432
|
"absolute inset-x-0 top-0 h-0.5 opacity-60",
|
|
3240
3433
|
role.accentBar
|
|
3241
3434
|
)
|
|
3242
3435
|
}
|
|
3243
3436
|
),
|
|
3244
|
-
/* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsxs9(
|
|
3245
3438
|
"button",
|
|
3246
3439
|
{
|
|
3247
3440
|
type: "button",
|
|
3248
3441
|
disabled: !canDrillIn,
|
|
3249
3442
|
onClick: () => setListOpen(true),
|
|
3250
3443
|
title: canDrillIn ? `View the ${info.labelPlural.toLowerCase()} attached to ${container.label ?? "this"}` : void 0,
|
|
3251
|
-
className:
|
|
3444
|
+
className: cn7(
|
|
3252
3445
|
"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",
|
|
3253
3446
|
canDrillIn ? "cursor-pointer" : "cursor-default"
|
|
3254
3447
|
),
|
|
3255
3448
|
children: [
|
|
3256
|
-
/* @__PURE__ */
|
|
3449
|
+
/* @__PURE__ */ jsx11(
|
|
3257
3450
|
"span",
|
|
3258
3451
|
{
|
|
3259
|
-
className:
|
|
3452
|
+
className: cn7(
|
|
3260
3453
|
"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",
|
|
3261
3454
|
role.accentBg,
|
|
3262
3455
|
role.accentText
|
|
3263
3456
|
),
|
|
3264
|
-
children: /* @__PURE__ */
|
|
3457
|
+
children: /* @__PURE__ */ jsx11(Icon, { className: "h-4 w-4" })
|
|
3265
3458
|
}
|
|
3266
3459
|
),
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
/* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3460
|
+
/* @__PURE__ */ jsxs9("span", { className: "min-w-0 flex-1", children: [
|
|
3461
|
+
/* @__PURE__ */ jsx11("span", { className: "block truncate text-sm font-medium text-foreground", children: info.labelPlural }),
|
|
3462
|
+
/* @__PURE__ */ jsx11("span", { className: "block text-[11px] text-muted-foreground tabular-nums", children: loading ? /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1", children: [
|
|
3463
|
+
/* @__PURE__ */ jsx11(SpinnerIcon, { className: "h-3 w-3 animate-spin" }),
|
|
3271
3464
|
"Loading\u2026"
|
|
3272
3465
|
] }) : `${count} ${container.direction === "outgoing" ? "filed under" : "attached"}` })
|
|
3273
3466
|
] })
|
|
3274
3467
|
]
|
|
3275
3468
|
}
|
|
3276
3469
|
),
|
|
3277
|
-
canAttach && /* @__PURE__ */
|
|
3470
|
+
canAttach && /* @__PURE__ */ jsx11(
|
|
3278
3471
|
"button",
|
|
3279
3472
|
{
|
|
3280
3473
|
type: "button",
|
|
@@ -3282,13 +3475,13 @@ function AssociationCard({
|
|
|
3282
3475
|
"aria-label": `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3283
3476
|
title: `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3284
3477
|
className: "mr-2 flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-border text-muted-foreground transition-colors hover:border-primary/60 hover:text-foreground lg:mr-3 lg:h-7 lg:w-7",
|
|
3285
|
-
children: /* @__PURE__ */
|
|
3478
|
+
children: /* @__PURE__ */ jsx11(PlusIcon, { className: "h-4 w-4" })
|
|
3286
3479
|
}
|
|
3287
3480
|
)
|
|
3288
3481
|
]
|
|
3289
3482
|
}
|
|
3290
3483
|
),
|
|
3291
|
-
listOpen && /* @__PURE__ */
|
|
3484
|
+
listOpen && /* @__PURE__ */ jsx11(
|
|
3292
3485
|
AttachedItemsSheet,
|
|
3293
3486
|
{
|
|
3294
3487
|
open: listOpen,
|
|
@@ -3307,7 +3500,7 @@ function AssociationCard({
|
|
|
3307
3500
|
onSetPinned: (resourceId, pinned, role2) => setPinned(token, resourceId, pinned, role2 ?? void 0)
|
|
3308
3501
|
}
|
|
3309
3502
|
),
|
|
3310
|
-
canAttach && /* @__PURE__ */
|
|
3503
|
+
canAttach && /* @__PURE__ */ jsx11(
|
|
3311
3504
|
AssociationPicker,
|
|
3312
3505
|
{
|
|
3313
3506
|
open,
|
|
@@ -3325,8 +3518,8 @@ function AssociationCard({
|
|
|
3325
3518
|
}
|
|
3326
3519
|
|
|
3327
3520
|
// src/react/components/AssociationCardGrid.tsx
|
|
3328
|
-
import { cn as
|
|
3329
|
-
import { jsx as
|
|
3521
|
+
import { cn as cn8 } from "@ai-matrx/design-system";
|
|
3522
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3330
3523
|
function AssociationCardGrid({
|
|
3331
3524
|
tokens,
|
|
3332
3525
|
excludeTokens,
|
|
@@ -3352,42 +3545,42 @@ function AssociationCardGrid({
|
|
|
3352
3545
|
const role = store.registry.getEntityInfo(token).contentRole;
|
|
3353
3546
|
return !role || !roleIds.has(role);
|
|
3354
3547
|
}) : [];
|
|
3355
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn8("space-y-5", className), children: [
|
|
3356
3549
|
CONTENT_ROLES.map((role) => {
|
|
3357
3550
|
const inRole = list.filter(
|
|
3358
3551
|
(token) => store.registry.getEntityInfo(token).contentRole === role.id
|
|
3359
3552
|
);
|
|
3360
3553
|
if (inRole.length === 0) return null;
|
|
3361
|
-
return /* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3554
|
+
return /* @__PURE__ */ jsxs10("section", { children: [
|
|
3555
|
+
/* @__PURE__ */ jsxs10("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
|
|
3556
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
3557
|
+
/* @__PURE__ */ jsx12(
|
|
3365
3558
|
"span",
|
|
3366
3559
|
{
|
|
3367
|
-
className:
|
|
3560
|
+
className: cn8("h-2.5 w-2.5 rounded-full", role.accentBar)
|
|
3368
3561
|
}
|
|
3369
3562
|
),
|
|
3370
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
|
|
3371
3564
|
] }),
|
|
3372
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx12("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
|
|
3373
3566
|
] }),
|
|
3374
|
-
/* @__PURE__ */
|
|
3567
|
+
/* @__PURE__ */ jsx12("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: inRole.map((token) => /* @__PURE__ */ jsx12(AssociationCard, { token }, token)) })
|
|
3375
3568
|
] }, role.id);
|
|
3376
3569
|
}),
|
|
3377
|
-
roleless.length > 0 && /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
/* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3570
|
+
roleless.length > 0 && /* @__PURE__ */ jsxs10("section", { children: [
|
|
3571
|
+
/* @__PURE__ */ jsxs10("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: [
|
|
3572
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: "Filed under" }),
|
|
3573
|
+
/* @__PURE__ */ jsx12("p", { className: "hidden text-xs text-muted-foreground sm:block", children: "Libraries, topics and other places this is kept." })
|
|
3381
3574
|
] }),
|
|
3382
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsx12("div", { className: "grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3", children: roleless.map((token) => /* @__PURE__ */ jsx12(AssociationCard, { token }, token)) })
|
|
3383
3576
|
] })
|
|
3384
3577
|
] });
|
|
3385
3578
|
}
|
|
3386
3579
|
|
|
3387
3580
|
// src/react/components/AssociationList.tsx
|
|
3388
3581
|
import { useState as useState11 } from "react";
|
|
3389
|
-
import { cn as
|
|
3390
|
-
import { jsx as
|
|
3582
|
+
import { cn as cn9, Skeleton } from "@ai-matrx/design-system";
|
|
3583
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3391
3584
|
function metadataIsPinned2(metadata) {
|
|
3392
3585
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
3393
3586
|
}
|
|
@@ -3493,40 +3686,40 @@ function AssociationList(props) {
|
|
|
3493
3686
|
const grouped = groupRows(store, visibleRows);
|
|
3494
3687
|
const isLoading = adapter.status === "loading" || adapter.status === "idle";
|
|
3495
3688
|
const attachableTokens = tokenFilter ?? store.registry.listableTokens();
|
|
3496
|
-
return /* @__PURE__ */
|
|
3497
|
-
/* @__PURE__ */
|
|
3498
|
-
/* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn9("flex flex-col gap-2 text-foreground", props.className), children: [
|
|
3690
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 px-1", children: [
|
|
3691
|
+
/* @__PURE__ */ jsxs11("h3", { className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: [
|
|
3692
|
+
/* @__PURE__ */ jsx13(Link2Icon, { className: "h-3.5 w-3.5" }),
|
|
3500
3693
|
"Resources",
|
|
3501
|
-
visibleRows.length > 0 && /* @__PURE__ */
|
|
3694
|
+
visibleRows.length > 0 && /* @__PURE__ */ jsx13("span", { className: "rounded bg-muted px-1 text-[10px] font-medium text-muted-foreground", children: visibleRows.length })
|
|
3502
3695
|
] }),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
|
|
3697
|
+
/* @__PURE__ */ jsxs11(
|
|
3505
3698
|
"button",
|
|
3506
3699
|
{
|
|
3507
3700
|
type: "button",
|
|
3508
3701
|
onClick: () => setShowUniversal((v) => !v),
|
|
3509
|
-
className:
|
|
3702
|
+
className: cn9(
|
|
3510
3703
|
"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
3511
3704
|
showUniversal ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
3512
3705
|
),
|
|
3513
3706
|
children: [
|
|
3514
|
-
/* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ jsx13(PlusIcon, { className: "h-3 w-3" }),
|
|
3515
3708
|
"Add"
|
|
3516
3709
|
]
|
|
3517
3710
|
}
|
|
3518
3711
|
),
|
|
3519
|
-
/* @__PURE__ */
|
|
3712
|
+
/* @__PURE__ */ jsx13(
|
|
3520
3713
|
"button",
|
|
3521
3714
|
{
|
|
3522
3715
|
type: "button",
|
|
3523
3716
|
onClick: () => void adapter.reload(),
|
|
3524
3717
|
title: "Refresh",
|
|
3525
3718
|
className: "text-muted-foreground/60 transition-colors hover:text-foreground",
|
|
3526
|
-
children: /* @__PURE__ */
|
|
3719
|
+
children: /* @__PURE__ */ jsx13(
|
|
3527
3720
|
RefreshIcon,
|
|
3528
3721
|
{
|
|
3529
|
-
className:
|
|
3722
|
+
className: cn9(
|
|
3530
3723
|
"h-3 w-3",
|
|
3531
3724
|
adapter.status === "loading" && "animate-spin"
|
|
3532
3725
|
)
|
|
@@ -3536,7 +3729,7 @@ function AssociationList(props) {
|
|
|
3536
3729
|
)
|
|
3537
3730
|
] })
|
|
3538
3731
|
] }),
|
|
3539
|
-
showUniversal && /* @__PURE__ */
|
|
3732
|
+
showUniversal && /* @__PURE__ */ jsx13("div", { className: "rounded-md border border-border/60 bg-muted/30 p-2 max-h-80 flex flex-col", children: /* @__PURE__ */ jsx13(
|
|
3540
3733
|
UniversalAssociationPicker,
|
|
3541
3734
|
{
|
|
3542
3735
|
tokens: attachableTokens,
|
|
@@ -3546,9 +3739,9 @@ function AssociationList(props) {
|
|
|
3546
3739
|
onDetach: (token, id) => adapter.detach(token, id)
|
|
3547
3740
|
}
|
|
3548
3741
|
) }),
|
|
3549
|
-
adapter.status === "error" && /* @__PURE__ */
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3742
|
+
adapter.status === "error" && /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-2.5 py-2", children: [
|
|
3743
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate text-[11px] text-destructive", children: adapter.error || "Failed to load resources" }),
|
|
3744
|
+
/* @__PURE__ */ jsx13(
|
|
3552
3745
|
"button",
|
|
3553
3746
|
{
|
|
3554
3747
|
type: "button",
|
|
@@ -3558,29 +3751,29 @@ function AssociationList(props) {
|
|
|
3558
3751
|
}
|
|
3559
3752
|
)
|
|
3560
3753
|
] }),
|
|
3561
|
-
adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
3564
|
-
/* @__PURE__ */
|
|
3754
|
+
adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5 px-1", children: [
|
|
3755
|
+
/* @__PURE__ */ jsx13(Skeleton, { className: "h-3 w-20" }),
|
|
3756
|
+
/* @__PURE__ */ jsx13(Skeleton, { className: "h-7 w-full rounded-md" }),
|
|
3757
|
+
/* @__PURE__ */ jsx13(Skeleton, { className: "h-7 w-3/4 rounded-md" })
|
|
3565
3758
|
] }),
|
|
3566
|
-
adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */
|
|
3567
|
-
visibleRows.length > 0 && /* @__PURE__ */
|
|
3759
|
+
adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */ jsx13("p", { className: "px-1 py-1 text-[11px] text-muted-foreground", children: "Nothing attached yet \u2014 use Add to link anything." }),
|
|
3760
|
+
visibleRows.length > 0 && /* @__PURE__ */ jsx13("div", { className: "space-y-2.5", children: grouped.map(({ role, tokens: tokenGroups }) => {
|
|
3568
3761
|
const roleMeta = getContentRoleMeta(role);
|
|
3569
|
-
return /* @__PURE__ */
|
|
3570
|
-
variant === "full" && /* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-1.5", children: [
|
|
3763
|
+
variant === "full" && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5 px-1", children: [
|
|
3764
|
+
/* @__PURE__ */ jsx13(
|
|
3572
3765
|
"span",
|
|
3573
3766
|
{
|
|
3574
|
-
className:
|
|
3767
|
+
className: cn9(
|
|
3575
3768
|
"h-3 w-0.5 rounded-full",
|
|
3576
3769
|
roleMeta.accentBar
|
|
3577
3770
|
)
|
|
3578
3771
|
}
|
|
3579
3772
|
),
|
|
3580
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsx13(
|
|
3581
3774
|
"p",
|
|
3582
3775
|
{
|
|
3583
|
-
className:
|
|
3776
|
+
className: cn9(
|
|
3584
3777
|
"text-[10px] font-semibold uppercase tracking-wider",
|
|
3585
3778
|
roleMeta.accentText
|
|
3586
3779
|
),
|
|
@@ -3590,28 +3783,28 @@ function AssociationList(props) {
|
|
|
3590
3783
|
] }),
|
|
3591
3784
|
tokenGroups.map(({ info, token, rows: tokenRows }) => {
|
|
3592
3785
|
const TokenIcon = info?.Icon ?? null;
|
|
3593
|
-
return /* @__PURE__ */
|
|
3594
|
-
/* @__PURE__ */
|
|
3595
|
-
/* @__PURE__ */
|
|
3596
|
-
TokenIcon ? /* @__PURE__ */
|
|
3786
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-0.5", children: [
|
|
3787
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-1 px-1", children: [
|
|
3788
|
+
/* @__PURE__ */ jsxs11("p", { className: "flex items-center gap-1 text-[10px] font-medium text-muted-foreground/80", children: [
|
|
3789
|
+
TokenIcon ? /* @__PURE__ */ jsx13(TokenIcon, { className: "h-3 w-3" }) : null,
|
|
3597
3790
|
info?.labelPlural ?? titleize(token),
|
|
3598
|
-
/* @__PURE__ */
|
|
3791
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground/50", children: tokenRows.length })
|
|
3599
3792
|
] }),
|
|
3600
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
3601
3794
|
props.renderSectionActions && info ? props.renderSectionActions(info.token) : null,
|
|
3602
|
-
info?.canListCandidates && /* @__PURE__ */
|
|
3795
|
+
info?.canListCandidates && /* @__PURE__ */ jsx13(
|
|
3603
3796
|
"button",
|
|
3604
3797
|
{
|
|
3605
3798
|
type: "button",
|
|
3606
3799
|
onClick: () => setPickerToken(info.token),
|
|
3607
3800
|
title: `Add ${info.labelPlural}`,
|
|
3608
3801
|
className: "rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground",
|
|
3609
|
-
children: /* @__PURE__ */
|
|
3802
|
+
children: /* @__PURE__ */ jsx13(PlusIcon, { className: "h-3 w-3" })
|
|
3610
3803
|
}
|
|
3611
3804
|
)
|
|
3612
3805
|
] })
|
|
3613
3806
|
] }),
|
|
3614
|
-
/* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx13("ul", { className: "space-y-0.5", children: tokenRows.map((row) => {
|
|
3615
3808
|
const busy = removingKeys.has(row.key);
|
|
3616
3809
|
const custom = props.renderRow?.(row, {
|
|
3617
3810
|
title: titleFor({
|
|
@@ -3624,12 +3817,12 @@ function AssociationList(props) {
|
|
|
3624
3817
|
onOpen: () => openRow(row)
|
|
3625
3818
|
});
|
|
3626
3819
|
if (custom != null) {
|
|
3627
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsx13("li", { children: custom }, row.key);
|
|
3628
3821
|
}
|
|
3629
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsxs11(
|
|
3630
3823
|
"div",
|
|
3631
3824
|
{
|
|
3632
|
-
className:
|
|
3825
|
+
className: cn9(
|
|
3633
3826
|
"group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent",
|
|
3634
3827
|
busy && "opacity-50"
|
|
3635
3828
|
),
|
|
@@ -3638,7 +3831,7 @@ function AssociationList(props) {
|
|
|
3638
3831
|
token: row.token,
|
|
3639
3832
|
id: row.resourceId,
|
|
3640
3833
|
label: row.label
|
|
3641
|
-
}) ? /* @__PURE__ */
|
|
3834
|
+
}) ? /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx13(UnresolvedRef, { token: row.token, id: row.resourceId }) }) : /* @__PURE__ */ jsx13(
|
|
3642
3835
|
DoorRef,
|
|
3643
3836
|
{
|
|
3644
3837
|
token: row.token,
|
|
@@ -3654,9 +3847,9 @@ function AssociationList(props) {
|
|
|
3654
3847
|
className: "min-w-0 flex-1 text-foreground"
|
|
3655
3848
|
}
|
|
3656
3849
|
),
|
|
3657
|
-
row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */
|
|
3850
|
+
row.originRefs && row.originRefs.length > 0 ? /* @__PURE__ */ jsxs11("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-muted-foreground/60", children: [
|
|
3658
3851
|
"via",
|
|
3659
|
-
row.originRefs.map((origin) => /* @__PURE__ */
|
|
3852
|
+
row.originRefs.map((origin) => /* @__PURE__ */ jsx13(
|
|
3660
3853
|
DoorRef,
|
|
3661
3854
|
{
|
|
3662
3855
|
token: origin.token,
|
|
@@ -3668,8 +3861,8 @@ function AssociationList(props) {
|
|
|
3668
3861
|
},
|
|
3669
3862
|
`${origin.token}:${origin.id}`
|
|
3670
3863
|
))
|
|
3671
|
-
] }) : row.originNote ? /* @__PURE__ */
|
|
3672
|
-
adapter.setPinned && info && row.removable && /* @__PURE__ */
|
|
3864
|
+
] }) : row.originNote ? /* @__PURE__ */ jsx13("span", { className: "shrink-0 text-[10px] text-muted-foreground/60", children: row.originNote }) : null,
|
|
3865
|
+
adapter.setPinned && info && row.removable && /* @__PURE__ */ jsx13(
|
|
3673
3866
|
"button",
|
|
3674
3867
|
{
|
|
3675
3868
|
type: "button",
|
|
@@ -3677,14 +3870,14 @@ function AssociationList(props) {
|
|
|
3677
3870
|
onClick: () => void handlePin(row, !(row.pinned ?? false)),
|
|
3678
3871
|
title: row.pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3679
3872
|
"aria-label": row.pinned ? "Unpin" : "Pin",
|
|
3680
|
-
className:
|
|
3873
|
+
className: cn9(
|
|
3681
3874
|
"shrink-0 rounded p-0.5 transition-colors hover:!text-foreground",
|
|
3682
3875
|
row.pinned ? "text-primary" : "text-muted-foreground/0 group-hover:text-muted-foreground"
|
|
3683
3876
|
),
|
|
3684
|
-
children: pinningKeys.has(row.key) ? /* @__PURE__ */
|
|
3877
|
+
children: pinningKeys.has(row.key) ? /* @__PURE__ */ jsx13(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx13(
|
|
3685
3878
|
PinIcon,
|
|
3686
3879
|
{
|
|
3687
|
-
className:
|
|
3880
|
+
className: cn9(
|
|
3688
3881
|
"h-3 w-3",
|
|
3689
3882
|
row.pinned && "fill-primary/20"
|
|
3690
3883
|
)
|
|
@@ -3692,7 +3885,7 @@ function AssociationList(props) {
|
|
|
3692
3885
|
)
|
|
3693
3886
|
}
|
|
3694
3887
|
),
|
|
3695
|
-
row.removable && /* @__PURE__ */
|
|
3888
|
+
row.removable && /* @__PURE__ */ jsx13(
|
|
3696
3889
|
"button",
|
|
3697
3890
|
{
|
|
3698
3891
|
type: "button",
|
|
@@ -3701,7 +3894,7 @@ function AssociationList(props) {
|
|
|
3701
3894
|
title: "Detach",
|
|
3702
3895
|
"aria-label": "Detach",
|
|
3703
3896
|
className: "shrink-0 rounded p-0.5 text-muted-foreground/0 transition-colors group-hover:text-muted-foreground hover:!text-destructive disabled:opacity-50",
|
|
3704
|
-
children: busy ? /* @__PURE__ */
|
|
3897
|
+
children: busy ? /* @__PURE__ */ jsx13(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx13(XIcon, { className: "h-3 w-3" })
|
|
3705
3898
|
}
|
|
3706
3899
|
)
|
|
3707
3900
|
]
|
|
@@ -3712,7 +3905,7 @@ function AssociationList(props) {
|
|
|
3712
3905
|
})
|
|
3713
3906
|
] }, role);
|
|
3714
3907
|
}) }),
|
|
3715
|
-
pickerToken && /* @__PURE__ */
|
|
3908
|
+
pickerToken && /* @__PURE__ */ jsx13(
|
|
3716
3909
|
AssociationPicker,
|
|
3717
3910
|
{
|
|
3718
3911
|
open: true,
|
|
@@ -3769,8 +3962,8 @@ function titleize(token) {
|
|
|
3769
3962
|
|
|
3770
3963
|
// src/react/components/AssociationCaptureToolbar.tsx
|
|
3771
3964
|
import { useRef as useRef8, useState as useState12 } from "react";
|
|
3772
|
-
import { Button, cn as
|
|
3773
|
-
import { Fragment as Fragment4, jsx as
|
|
3965
|
+
import { Button as Button2, cn as cn10, Input as Input3 } from "@ai-matrx/design-system";
|
|
3966
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3774
3967
|
function AssociationCaptureToolbar({
|
|
3775
3968
|
attach,
|
|
3776
3969
|
uploadFolderPath,
|
|
@@ -4001,10 +4194,10 @@ function AssociationCaptureToolbar({
|
|
|
4001
4194
|
}
|
|
4002
4195
|
};
|
|
4003
4196
|
const anyBuiltIn = actions.upload || actions.addFile || actions.newDocument;
|
|
4004
|
-
return /* @__PURE__ */
|
|
4197
|
+
return /* @__PURE__ */ jsxs12(
|
|
4005
4198
|
"div",
|
|
4006
4199
|
{
|
|
4007
|
-
className:
|
|
4200
|
+
className: cn10(
|
|
4008
4201
|
"relative flex h-full min-h-0 flex-col",
|
|
4009
4202
|
isDragOver && "ring-2 ring-inset ring-primary/50",
|
|
4010
4203
|
className
|
|
@@ -4022,11 +4215,11 @@ function AssociationCaptureToolbar({
|
|
|
4022
4215
|
},
|
|
4023
4216
|
onDrop: handleDrop,
|
|
4024
4217
|
children: [
|
|
4025
|
-
isDragOver ? /* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4218
|
+
isDragOver ? /* @__PURE__ */ jsx14("div", { className: "pointer-events-none absolute inset-0 z-10 grid place-items-center bg-background/70", children: /* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-2 rounded-md border border-primary/40 bg-card px-3 py-1.5 text-xs font-medium text-foreground", children: [
|
|
4219
|
+
/* @__PURE__ */ jsx14(UploadIcon, { className: "size-3.5 text-primary" }),
|
|
4027
4220
|
"Drop to upload & attach"
|
|
4028
4221
|
] }) }) : null,
|
|
4029
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx14(
|
|
4030
4223
|
"input",
|
|
4031
4224
|
{
|
|
4032
4225
|
ref: fileInputRef,
|
|
@@ -4036,8 +4229,8 @@ function AssociationCaptureToolbar({
|
|
|
4036
4229
|
onChange: handleFilesSelected
|
|
4037
4230
|
}
|
|
4038
4231
|
),
|
|
4039
|
-
showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4232
|
+
showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */ jsx14("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-border/60 px-1.5 py-1", children: namingDoc ? /* @__PURE__ */ jsxs12("div", { className: "flex flex-1 items-center gap-1.5 py-0.5", children: [
|
|
4233
|
+
/* @__PURE__ */ jsx14(
|
|
4041
4234
|
Input3,
|
|
4042
4235
|
{
|
|
4043
4236
|
autoFocus: true,
|
|
@@ -4056,17 +4249,17 @@ function AssociationCaptureToolbar({
|
|
|
4056
4249
|
style: { fontSize: 16 }
|
|
4057
4250
|
}
|
|
4058
4251
|
),
|
|
4059
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx14(
|
|
4060
4253
|
"button",
|
|
4061
4254
|
{
|
|
4062
4255
|
type: "button",
|
|
4063
4256
|
disabled: creatingDoc || !docName.trim(),
|
|
4064
4257
|
onClick: () => void handleCreateDoc(),
|
|
4065
4258
|
className: "flex h-7 items-center rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground disabled:opacity-50",
|
|
4066
|
-
children: creatingDoc ? /* @__PURE__ */
|
|
4259
|
+
children: creatingDoc ? /* @__PURE__ */ jsx14(SpinnerIcon, { className: "size-3.5 animate-spin" }) : "Create"
|
|
4067
4260
|
}
|
|
4068
4261
|
),
|
|
4069
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ jsx14(
|
|
4070
4263
|
"button",
|
|
4071
4264
|
{
|
|
4072
4265
|
type: "button",
|
|
@@ -4079,8 +4272,8 @@ function AssociationCaptureToolbar({
|
|
|
4079
4272
|
children: "Cancel"
|
|
4080
4273
|
}
|
|
4081
4274
|
)
|
|
4082
|
-
] }) : /* @__PURE__ */
|
|
4083
|
-
actions.upload ? /* @__PURE__ */
|
|
4275
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4276
|
+
actions.upload ? /* @__PURE__ */ jsx14(
|
|
4084
4277
|
CaptureToolbarAction,
|
|
4085
4278
|
{
|
|
4086
4279
|
icon: isUploading ? SpinnerIcon : UploadIcon,
|
|
@@ -4090,7 +4283,7 @@ function AssociationCaptureToolbar({
|
|
|
4090
4283
|
disabled: isPicking || isUploading
|
|
4091
4284
|
}
|
|
4092
4285
|
) : null,
|
|
4093
|
-
actions.addFile ? /* @__PURE__ */
|
|
4286
|
+
actions.addFile ? /* @__PURE__ */ jsx14(
|
|
4094
4287
|
CaptureToolbarAction,
|
|
4095
4288
|
{
|
|
4096
4289
|
icon: isPicking ? SpinnerIcon : FolderOpenIcon,
|
|
@@ -4100,8 +4293,8 @@ function AssociationCaptureToolbar({
|
|
|
4100
4293
|
disabled: isPicking || isUploading
|
|
4101
4294
|
}
|
|
4102
4295
|
) : null,
|
|
4103
|
-
(actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */
|
|
4104
|
-
actions.newDocument ? /* @__PURE__ */
|
|
4296
|
+
(actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */ jsx14("span", { className: "mx-1 h-4 w-px bg-border" }) : null,
|
|
4297
|
+
actions.newDocument ? /* @__PURE__ */ jsx14(
|
|
4105
4298
|
CaptureToolbarAction,
|
|
4106
4299
|
{
|
|
4107
4300
|
icon: creatingDoc ? SpinnerIcon : PlusIcon,
|
|
@@ -4125,8 +4318,8 @@ function CaptureToolbarAction({
|
|
|
4125
4318
|
disabled,
|
|
4126
4319
|
spinning
|
|
4127
4320
|
}) {
|
|
4128
|
-
return /* @__PURE__ */
|
|
4129
|
-
|
|
4321
|
+
return /* @__PURE__ */ jsxs12(
|
|
4322
|
+
Button2,
|
|
4130
4323
|
{
|
|
4131
4324
|
type: "button",
|
|
4132
4325
|
size: "sm",
|
|
@@ -4135,7 +4328,7 @@ function CaptureToolbarAction({
|
|
|
4135
4328
|
disabled,
|
|
4136
4329
|
className: "h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground",
|
|
4137
4330
|
children: [
|
|
4138
|
-
/* @__PURE__ */
|
|
4331
|
+
/* @__PURE__ */ jsx14(Icon, { className: cn10("size-3.5", spinning && "animate-spin") }),
|
|
4139
4332
|
label
|
|
4140
4333
|
]
|
|
4141
4334
|
}
|
|
@@ -4144,7 +4337,7 @@ function CaptureToolbarAction({
|
|
|
4144
4337
|
|
|
4145
4338
|
// src/react/lazyPorts.tsx
|
|
4146
4339
|
import { Suspense, lazy } from "react";
|
|
4147
|
-
import { jsx as
|
|
4340
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
4148
4341
|
function lazyComponent(load) {
|
|
4149
4342
|
return lazy(async () => {
|
|
4150
4343
|
const loaded = await load();
|
|
@@ -4154,14 +4347,14 @@ function lazyComponent(load) {
|
|
|
4154
4347
|
function lazyWindowShell(load) {
|
|
4155
4348
|
const Loaded = lazyComponent(load);
|
|
4156
4349
|
return function LazyWindowShell(props) {
|
|
4157
|
-
return /* @__PURE__ */
|
|
4350
|
+
return /* @__PURE__ */ jsx15(Suspense, { fallback: null, children: /* @__PURE__ */ jsx15(Loaded, { ...props }) });
|
|
4158
4351
|
};
|
|
4159
4352
|
}
|
|
4160
4353
|
function lazyPickerOverride(load) {
|
|
4161
4354
|
const Loaded = lazyComponent(load);
|
|
4162
4355
|
return function LazyPickerOverride(props) {
|
|
4163
4356
|
if (!props.open) return null;
|
|
4164
|
-
return /* @__PURE__ */
|
|
4357
|
+
return /* @__PURE__ */ jsx15(Suspense, { fallback: null, children: /* @__PURE__ */ jsx15(Loaded, { ...props }) });
|
|
4165
4358
|
};
|
|
4166
4359
|
}
|
|
4167
4360
|
|
|
@@ -4275,7 +4468,7 @@ function useAssociationPickerBridge(props, options = {}) {
|
|
|
4275
4468
|
// src/react/components/AssociationEntitySelect.tsx
|
|
4276
4469
|
import { useState as useState14 } from "react";
|
|
4277
4470
|
import {
|
|
4278
|
-
cn as
|
|
4471
|
+
cn as cn11,
|
|
4279
4472
|
Command,
|
|
4280
4473
|
CommandEmpty,
|
|
4281
4474
|
CommandGroup,
|
|
@@ -4287,7 +4480,7 @@ import {
|
|
|
4287
4480
|
PopoverContent,
|
|
4288
4481
|
PopoverTrigger
|
|
4289
4482
|
} from "@ai-matrx/design-system";
|
|
4290
|
-
import { jsx as
|
|
4483
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4291
4484
|
function AssociationEntitySelect({
|
|
4292
4485
|
token,
|
|
4293
4486
|
adapter,
|
|
@@ -4328,25 +4521,25 @@ function AssociationEntitySelect({
|
|
|
4328
4521
|
if (id) close();
|
|
4329
4522
|
else notifier.error(`Couldn't create the ${entityLabel}`);
|
|
4330
4523
|
};
|
|
4331
|
-
return /* @__PURE__ */
|
|
4524
|
+
return /* @__PURE__ */ jsxs13(
|
|
4332
4525
|
"div",
|
|
4333
4526
|
{
|
|
4334
|
-
className:
|
|
4527
|
+
className: cn11(
|
|
4335
4528
|
"group/entity-ref flex min-w-0 items-center gap-0.5",
|
|
4336
4529
|
className
|
|
4337
4530
|
),
|
|
4338
4531
|
children: [
|
|
4339
|
-
showIcon ? /* @__PURE__ */
|
|
4532
|
+
showIcon ? /* @__PURE__ */ jsx16(
|
|
4340
4533
|
InfoIcon,
|
|
4341
4534
|
{
|
|
4342
|
-
className:
|
|
4535
|
+
className: cn11(
|
|
4343
4536
|
"size-3.5 shrink-0",
|
|
4344
4537
|
iconClassName ?? "text-muted-foreground"
|
|
4345
4538
|
),
|
|
4346
4539
|
"aria-hidden": true
|
|
4347
4540
|
}
|
|
4348
4541
|
) : null,
|
|
4349
|
-
active ? /* @__PURE__ */
|
|
4542
|
+
active ? /* @__PURE__ */ jsx16(
|
|
4350
4543
|
EditableLabel,
|
|
4351
4544
|
{
|
|
4352
4545
|
value: active.title,
|
|
@@ -4360,29 +4553,29 @@ function AssociationEntitySelect({
|
|
|
4360
4553
|
commitMode: "await",
|
|
4361
4554
|
activation: renameActivation,
|
|
4362
4555
|
ariaLabel: info.label,
|
|
4363
|
-
className:
|
|
4556
|
+
className: cn11("max-w-[14rem]", labelClassName),
|
|
4364
4557
|
displayClassName: "text-xs font-medium text-foreground",
|
|
4365
4558
|
inputClassName: "text-xs font-medium"
|
|
4366
4559
|
}
|
|
4367
4560
|
) : null,
|
|
4368
|
-
active ? /* @__PURE__ */
|
|
4369
|
-
!active ? /* @__PURE__ */
|
|
4561
|
+
active ? /* @__PURE__ */ jsx16(DoorControlsSlot, { token, id: active.id, name: active.title }) : null,
|
|
4562
|
+
!active ? /* @__PURE__ */ jsx16(
|
|
4370
4563
|
"span",
|
|
4371
4564
|
{
|
|
4372
|
-
className:
|
|
4565
|
+
className: cn11(
|
|
4373
4566
|
"truncate px-1 text-xs font-medium text-muted-foreground",
|
|
4374
4567
|
labelClassName
|
|
4375
4568
|
),
|
|
4376
4569
|
children: adapter.loading ? "\u2026" : emptyLabel ?? info.labelPlural
|
|
4377
4570
|
}
|
|
4378
4571
|
) : null,
|
|
4379
|
-
/* @__PURE__ */
|
|
4572
|
+
/* @__PURE__ */ jsxs13(
|
|
4380
4573
|
Popover,
|
|
4381
4574
|
{
|
|
4382
4575
|
open,
|
|
4383
4576
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
4384
4577
|
children: [
|
|
4385
|
-
/* @__PURE__ */
|
|
4578
|
+
/* @__PURE__ */ jsx16(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs13(
|
|
4386
4579
|
"button",
|
|
4387
4580
|
{
|
|
4388
4581
|
type: "button",
|
|
@@ -4390,17 +4583,17 @@ function AssociationEntitySelect({
|
|
|
4390
4583
|
title: `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4391
4584
|
"aria-label": `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4392
4585
|
children: [
|
|
4393
|
-
items.length > 1 ? /* @__PURE__ */
|
|
4586
|
+
items.length > 1 ? /* @__PURE__ */ jsxs13("span", { className: "tabular-nums", children: [
|
|
4394
4587
|
activeIndex >= 0 ? activeIndex + 1 : "\u2014",
|
|
4395
4588
|
"/",
|
|
4396
4589
|
items.length
|
|
4397
4590
|
] }) : null,
|
|
4398
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx16(ChevronDownIcon, { className: "size-3 opacity-60" })
|
|
4399
4592
|
]
|
|
4400
4593
|
}
|
|
4401
4594
|
) }),
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
items.length > 5 ? /* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx16(PopoverContent, { sizing: "content", className: "p-0", align, children: /* @__PURE__ */ jsxs13(Command, { children: [
|
|
4596
|
+
items.length > 5 ? /* @__PURE__ */ jsx16(
|
|
4404
4597
|
CommandInput,
|
|
4405
4598
|
{
|
|
4406
4599
|
value: query,
|
|
@@ -4408,9 +4601,9 @@ function AssociationEntitySelect({
|
|
|
4408
4601
|
placeholder: `Search ${info.labelPlural.toLowerCase()}\u2026`
|
|
4409
4602
|
}
|
|
4410
4603
|
) : null,
|
|
4411
|
-
/* @__PURE__ */
|
|
4412
|
-
/* @__PURE__ */
|
|
4413
|
-
items.length > 0 ? /* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ jsxs13(CommandList, { children: [
|
|
4605
|
+
/* @__PURE__ */ jsx16(CommandEmpty, { children: "No match." }),
|
|
4606
|
+
items.length > 0 ? /* @__PURE__ */ jsx16(CommandGroup, { children: items.map((item) => /* @__PURE__ */ jsxs13(
|
|
4414
4607
|
CommandItem,
|
|
4415
4608
|
{
|
|
4416
4609
|
value: `${item.title} ${item.id}`,
|
|
@@ -4421,17 +4614,17 @@ function AssociationEntitySelect({
|
|
|
4421
4614
|
},
|
|
4422
4615
|
className: "group/entity-ref group gap-2",
|
|
4423
4616
|
children: [
|
|
4424
|
-
/* @__PURE__ */
|
|
4617
|
+
/* @__PURE__ */ jsx16(
|
|
4425
4618
|
CheckIcon,
|
|
4426
4619
|
{
|
|
4427
|
-
className:
|
|
4620
|
+
className: cn11(
|
|
4428
4621
|
"size-3.5 shrink-0",
|
|
4429
4622
|
item.id === activeId ? "opacity-100" : "opacity-0"
|
|
4430
4623
|
)
|
|
4431
4624
|
}
|
|
4432
4625
|
),
|
|
4433
|
-
/* @__PURE__ */
|
|
4434
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate", children: item.title }),
|
|
4627
|
+
/* @__PURE__ */ jsx16(
|
|
4435
4628
|
"span",
|
|
4436
4629
|
{
|
|
4437
4630
|
className: "inline-flex shrink-0 items-center",
|
|
@@ -4439,7 +4632,7 @@ function AssociationEntitySelect({
|
|
|
4439
4632
|
e.preventDefault();
|
|
4440
4633
|
e.stopPropagation();
|
|
4441
4634
|
},
|
|
4442
|
-
children: /* @__PURE__ */
|
|
4635
|
+
children: /* @__PURE__ */ jsx16(
|
|
4443
4636
|
DoorControlsSlot,
|
|
4444
4637
|
{
|
|
4445
4638
|
token,
|
|
@@ -4449,7 +4642,7 @@ function AssociationEntitySelect({
|
|
|
4449
4642
|
)
|
|
4450
4643
|
}
|
|
4451
4644
|
),
|
|
4452
|
-
adapter.detach && item.id !== activeId ? /* @__PURE__ */
|
|
4645
|
+
adapter.detach && item.id !== activeId ? /* @__PURE__ */ jsx16(
|
|
4453
4646
|
"button",
|
|
4454
4647
|
{
|
|
4455
4648
|
type: "button",
|
|
@@ -4464,7 +4657,7 @@ function AssociationEntitySelect({
|
|
|
4464
4657
|
className: "grid size-5 shrink-0 place-items-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-destructive group-hover:opacity-100",
|
|
4465
4658
|
title: `Remove this ${entityLabel} from here (does not delete it)`,
|
|
4466
4659
|
"aria-label": `Remove ${item.title}`,
|
|
4467
|
-
children: /* @__PURE__ */
|
|
4660
|
+
children: /* @__PURE__ */ jsx16(XIcon, { className: "size-3" })
|
|
4468
4661
|
}
|
|
4469
4662
|
) : null
|
|
4470
4663
|
]
|
|
@@ -4472,9 +4665,9 @@ function AssociationEntitySelect({
|
|
|
4472
4665
|
item.id
|
|
4473
4666
|
)) }) : null
|
|
4474
4667
|
] }),
|
|
4475
|
-
createSlot !== void 0 ? /* @__PURE__ */
|
|
4476
|
-
createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */
|
|
4477
|
-
/* @__PURE__ */
|
|
4668
|
+
createSlot !== void 0 ? /* @__PURE__ */ jsx16("div", { className: "border-t border-border p-1", children: typeof createSlot === "function" ? createSlot(close) : createSlot }) : null,
|
|
4669
|
+
createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */ jsx16("div", { className: "border-t border-border p-1", children: creating ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1 px-1 py-0.5", children: [
|
|
4670
|
+
/* @__PURE__ */ jsx16(
|
|
4478
4671
|
"input",
|
|
4479
4672
|
{
|
|
4480
4673
|
autoFocus: true,
|
|
@@ -4498,17 +4691,17 @@ function AssociationEntitySelect({
|
|
|
4498
4691
|
"aria-label": `New ${entityLabel} name`
|
|
4499
4692
|
}
|
|
4500
4693
|
),
|
|
4501
|
-
/* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsx16(
|
|
4502
4695
|
"button",
|
|
4503
4696
|
{
|
|
4504
4697
|
type: "button",
|
|
4505
4698
|
disabled: busy || !draftName.trim(),
|
|
4506
4699
|
onClick: () => void create(draftName),
|
|
4507
4700
|
className: "inline-flex h-6 shrink-0 items-center rounded-md px-1.5 text-[10px] font-medium text-primary transition-colors hover:bg-accent disabled:opacity-50",
|
|
4508
|
-
children: busy ? /* @__PURE__ */
|
|
4701
|
+
children: busy ? /* @__PURE__ */ jsx16(SpinnerIcon, { className: "size-3 animate-spin" }) : "Create"
|
|
4509
4702
|
}
|
|
4510
4703
|
)
|
|
4511
|
-
] }) : /* @__PURE__ */
|
|
4704
|
+
] }) : /* @__PURE__ */ jsxs13(
|
|
4512
4705
|
"button",
|
|
4513
4706
|
{
|
|
4514
4707
|
type: "button",
|
|
@@ -4519,7 +4712,7 @@ function AssociationEntitySelect({
|
|
|
4519
4712
|
},
|
|
4520
4713
|
className: "flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
4521
4714
|
children: [
|
|
4522
|
-
busy ? /* @__PURE__ */
|
|
4715
|
+
busy ? /* @__PURE__ */ jsx16(SpinnerIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx16(PlusIcon, { className: "size-3.5" }),
|
|
4523
4716
|
query.trim() ? `Create "${query.trim()}"` : `New ${info.label}`
|
|
4524
4717
|
]
|
|
4525
4718
|
}
|
|
@@ -4609,7 +4802,7 @@ function buildCategoryHierarchy(categories) {
|
|
|
4609
4802
|
}
|
|
4610
4803
|
|
|
4611
4804
|
// src/react/components/CategorySelect.tsx
|
|
4612
|
-
import { jsx as
|
|
4805
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4613
4806
|
var NONE = "__none__";
|
|
4614
4807
|
var ROOT_PARENT = "__root__";
|
|
4615
4808
|
function plural(noun) {
|
|
@@ -4645,9 +4838,9 @@ function CategorySelect({
|
|
|
4645
4838
|
// The type-ahead matches the parent's name too, so someone who knows
|
|
4646
4839
|
// the branch but not the leaf still finds it.
|
|
4647
4840
|
keywords: parent ? parent.name : "",
|
|
4648
|
-
render: depth === 0 ? /* @__PURE__ */
|
|
4649
|
-
/* @__PURE__ */
|
|
4650
|
-
/* @__PURE__ */
|
|
4841
|
+
render: depth === 0 ? /* @__PURE__ */ jsx17("span", { className: "font-medium", children: category.name }) : /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1.5 pl-3 text-muted-foreground", children: [
|
|
4842
|
+
/* @__PURE__ */ jsx17(CornerDownRightIcon, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
4843
|
+
/* @__PURE__ */ jsx17("span", { className: "text-foreground", children: category.name })
|
|
4651
4844
|
] })
|
|
4652
4845
|
})) : categories.map((category) => ({
|
|
4653
4846
|
value: category.id,
|
|
@@ -4694,8 +4887,8 @@ function CategorySelect({
|
|
|
4694
4887
|
);
|
|
4695
4888
|
return result.id;
|
|
4696
4889
|
};
|
|
4697
|
-
return /* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4890
|
+
return /* @__PURE__ */ jsxs14("div", { children: [
|
|
4891
|
+
/* @__PURE__ */ jsx17(
|
|
4699
4892
|
CreatablePicker,
|
|
4700
4893
|
{
|
|
4701
4894
|
value: value ?? (allowNone ? NONE : null),
|
|
@@ -4711,18 +4904,18 @@ function CategorySelect({
|
|
|
4711
4904
|
emptyLabel: `No ${noun} matches that.`,
|
|
4712
4905
|
...allowCreate ? { onCreate: create } : {},
|
|
4713
4906
|
...allowCreate && hierarchy.hasHierarchy ? {
|
|
4714
|
-
createExtra: /* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4907
|
+
createExtra: /* @__PURE__ */ jsxs14(Select, { value: createParentId, onValueChange: setCreateParentId, children: [
|
|
4908
|
+
/* @__PURE__ */ jsx17(
|
|
4716
4909
|
SelectTrigger,
|
|
4717
4910
|
{
|
|
4718
4911
|
className: "h-7 text-xs",
|
|
4719
4912
|
"aria-label": `Put the new ${noun} under`,
|
|
4720
|
-
children: /* @__PURE__ */
|
|
4913
|
+
children: /* @__PURE__ */ jsx17(SelectValue, {})
|
|
4721
4914
|
}
|
|
4722
4915
|
),
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
4725
|
-
hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */
|
|
4916
|
+
/* @__PURE__ */ jsxs14(SelectContent, { children: [
|
|
4917
|
+
/* @__PURE__ */ jsx17(SelectItem, { value: ROOT_PARENT, className: "text-xs", children: "Top level" }),
|
|
4918
|
+
hierarchy.items.filter((item) => item.depth === 0).map((item) => /* @__PURE__ */ jsxs14(
|
|
4726
4919
|
SelectItem,
|
|
4727
4920
|
{
|
|
4728
4921
|
value: item.category.id,
|
|
@@ -4742,13 +4935,13 @@ function CategorySelect({
|
|
|
4742
4935
|
selected === null && value !== null ? (
|
|
4743
4936
|
// A stored id whose row this reader cannot see is not "nothing chosen":
|
|
4744
4937
|
// saying so beats a blank box that looks like an unsaved field.
|
|
4745
|
-
/* @__PURE__ */
|
|
4938
|
+
/* @__PURE__ */ jsxs14("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4746
4939
|
"This ",
|
|
4747
4940
|
noun,
|
|
4748
4941
|
" is no longer available to you."
|
|
4749
4942
|
] })
|
|
4750
4943
|
) : null,
|
|
4751
|
-
error ? /* @__PURE__ */
|
|
4944
|
+
error ? /* @__PURE__ */ jsx17("p", { className: "mt-1 text-xs text-destructive", children: error }) : null
|
|
4752
4945
|
] });
|
|
4753
4946
|
}
|
|
4754
4947
|
|
|
@@ -4756,8 +4949,8 @@ function CategorySelect({
|
|
|
4756
4949
|
import { useState as useState16 } from "react";
|
|
4757
4950
|
import {
|
|
4758
4951
|
Badge,
|
|
4759
|
-
Button as
|
|
4760
|
-
cn as
|
|
4952
|
+
Button as Button3,
|
|
4953
|
+
cn as cn12,
|
|
4761
4954
|
Command as Command2,
|
|
4762
4955
|
CommandEmpty as CommandEmpty2,
|
|
4763
4956
|
CommandGroup as CommandGroup2,
|
|
@@ -4773,7 +4966,7 @@ import {
|
|
|
4773
4966
|
SelectTrigger as SelectTrigger2,
|
|
4774
4967
|
SelectValue as SelectValue2
|
|
4775
4968
|
} from "@ai-matrx/design-system";
|
|
4776
|
-
import { jsx as
|
|
4969
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4777
4970
|
var ROOT_PARENT2 = "__root__";
|
|
4778
4971
|
function CategoryTagPicker({
|
|
4779
4972
|
entityType,
|
|
@@ -4897,44 +5090,44 @@ function CategoryTagPicker({
|
|
|
4897
5090
|
const exactMatch = categories.some(
|
|
4898
5091
|
(c) => c.name.toLowerCase() === search.trim().toLowerCase()
|
|
4899
5092
|
);
|
|
4900
|
-
return /* @__PURE__ */
|
|
4901
|
-
selected.map((c) => /* @__PURE__ */
|
|
5093
|
+
return /* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
5094
|
+
selected.map((c) => /* @__PURE__ */ jsxs15(
|
|
4902
5095
|
Badge,
|
|
4903
5096
|
{
|
|
4904
5097
|
variant: "secondary",
|
|
4905
5098
|
className: "gap-1 pr-1 text-xs font-medium",
|
|
4906
5099
|
children: [
|
|
4907
5100
|
showHierarchy ? hierarchyById.get(c.id)?.displayName ?? c.name : c.name,
|
|
4908
|
-
/* @__PURE__ */
|
|
5101
|
+
/* @__PURE__ */ jsx18(
|
|
4909
5102
|
"button",
|
|
4910
5103
|
{
|
|
4911
5104
|
type: "button",
|
|
4912
5105
|
onClick: () => void toggle(c.id),
|
|
4913
5106
|
className: "ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20",
|
|
4914
5107
|
"aria-label": `Remove ${c.name}`,
|
|
4915
|
-
children: /* @__PURE__ */
|
|
5108
|
+
children: /* @__PURE__ */ jsx18(XIcon, { className: "h-2.5 w-2.5" })
|
|
4916
5109
|
}
|
|
4917
5110
|
)
|
|
4918
5111
|
]
|
|
4919
5112
|
},
|
|
4920
5113
|
c.id
|
|
4921
5114
|
)),
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
|
|
5115
|
+
/* @__PURE__ */ jsxs15(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5116
|
+
/* @__PURE__ */ jsx18(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
5117
|
+
Button3,
|
|
4925
5118
|
{
|
|
4926
5119
|
variant: "outline",
|
|
4927
5120
|
size: "sm",
|
|
4928
5121
|
className: "h-7 gap-1 px-2 text-xs",
|
|
4929
5122
|
children: [
|
|
4930
|
-
/* @__PURE__ */
|
|
5123
|
+
/* @__PURE__ */ jsx18(Icon, { className: "h-3.5 w-3.5" }),
|
|
4931
5124
|
selected.length === 0 ? addLabel : "Edit",
|
|
4932
|
-
/* @__PURE__ */
|
|
5125
|
+
/* @__PURE__ */ jsx18(ChevronsUpDownIcon, { className: "h-3 w-3 opacity-50" })
|
|
4933
5126
|
]
|
|
4934
5127
|
}
|
|
4935
5128
|
) }),
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5129
|
+
/* @__PURE__ */ jsx18(PopoverContent2, { sizing: "content", className: "p-0", align: "start", children: /* @__PURE__ */ jsxs15(Command2, { shouldFilter: false, children: [
|
|
5130
|
+
/* @__PURE__ */ jsx18(
|
|
4938
5131
|
CommandInput2,
|
|
4939
5132
|
{
|
|
4940
5133
|
placeholder: allowCreate ? "Search or create..." : "Search...",
|
|
@@ -4942,41 +5135,41 @@ function CategoryTagPicker({
|
|
|
4942
5135
|
onValueChange: setSearch
|
|
4943
5136
|
}
|
|
4944
5137
|
),
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
5138
|
+
/* @__PURE__ */ jsxs15(CommandList2, { children: [
|
|
5139
|
+
/* @__PURE__ */ jsx18(CommandEmpty2, { className: "px-2 py-3 text-xs text-muted-foreground", children: search.trim() ? "No match." : emptyText }),
|
|
5140
|
+
/* @__PURE__ */ jsx18(CommandGroup2, { children: showHierarchy ? filteredHierarchy.map(({ category, depth, parent }) => /* @__PURE__ */ jsxs15(
|
|
4948
5141
|
CommandItem2,
|
|
4949
5142
|
{
|
|
4950
5143
|
value: category.id,
|
|
4951
5144
|
keywords: parent ? [parent.name, category.name] : [],
|
|
4952
5145
|
onSelect: () => void toggle(category.id),
|
|
4953
|
-
className:
|
|
5146
|
+
className: cn12("text-xs", depth === 1 && "pl-6"),
|
|
4954
5147
|
children: [
|
|
4955
|
-
/* @__PURE__ */
|
|
5148
|
+
/* @__PURE__ */ jsx18(
|
|
4956
5149
|
CheckIcon,
|
|
4957
5150
|
{
|
|
4958
|
-
className:
|
|
5151
|
+
className: cn12(
|
|
4959
5152
|
"mr-2 h-3.5 w-3.5",
|
|
4960
5153
|
selectedIds.has(category.id) ? "opacity-100" : "opacity-0"
|
|
4961
5154
|
)
|
|
4962
5155
|
}
|
|
4963
5156
|
),
|
|
4964
|
-
depth === 1 ? /* @__PURE__ */
|
|
4965
|
-
/* @__PURE__ */
|
|
5157
|
+
depth === 1 ? /* @__PURE__ */ jsx18(CornerDownRightIcon, { className: "mr-1.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : null,
|
|
5158
|
+
/* @__PURE__ */ jsx18("span", { className: cn12(depth === 0 && "font-medium"), children: category.name })
|
|
4966
5159
|
]
|
|
4967
5160
|
},
|
|
4968
5161
|
category.id
|
|
4969
|
-
)) : filtered.map((c) => /* @__PURE__ */
|
|
5162
|
+
)) : filtered.map((c) => /* @__PURE__ */ jsxs15(
|
|
4970
5163
|
CommandItem2,
|
|
4971
5164
|
{
|
|
4972
5165
|
value: c.id,
|
|
4973
5166
|
onSelect: () => void toggle(c.id),
|
|
4974
5167
|
className: "text-xs",
|
|
4975
5168
|
children: [
|
|
4976
|
-
/* @__PURE__ */
|
|
5169
|
+
/* @__PURE__ */ jsx18(
|
|
4977
5170
|
CheckIcon,
|
|
4978
5171
|
{
|
|
4979
|
-
className:
|
|
5172
|
+
className: cn12(
|
|
4980
5173
|
"mr-2 h-3.5 w-3.5",
|
|
4981
5174
|
selectedIds.has(c.id) ? "opacity-100" : "opacity-0"
|
|
4982
5175
|
)
|
|
@@ -4987,25 +5180,25 @@ function CategoryTagPicker({
|
|
|
4987
5180
|
},
|
|
4988
5181
|
c.id
|
|
4989
5182
|
)) }),
|
|
4990
|
-
allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */
|
|
4991
|
-
showHierarchy ? /* @__PURE__ */
|
|
4992
|
-
/* @__PURE__ */
|
|
4993
|
-
/* @__PURE__ */
|
|
5183
|
+
allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */ jsxs15(CommandGroup2, { children: [
|
|
5184
|
+
showHierarchy ? /* @__PURE__ */ jsxs15("div", { className: "space-y-1.5 px-2 pb-2", children: [
|
|
5185
|
+
/* @__PURE__ */ jsx18("p", { className: "text-[11px] font-medium text-muted-foreground", children: "Place in" }),
|
|
5186
|
+
/* @__PURE__ */ jsxs15(
|
|
4994
5187
|
Select2,
|
|
4995
5188
|
{
|
|
4996
5189
|
value: createParentId,
|
|
4997
5190
|
onValueChange: setCreateParentId,
|
|
4998
5191
|
children: [
|
|
4999
|
-
/* @__PURE__ */
|
|
5000
|
-
/* @__PURE__ */
|
|
5001
|
-
/* @__PURE__ */
|
|
5002
|
-
hierarchy.roots.map((root) => /* @__PURE__ */
|
|
5192
|
+
/* @__PURE__ */ jsx18(SelectTrigger2, { size: "sm", className: "bg-background", children: /* @__PURE__ */ jsx18(SelectValue2, {}) }),
|
|
5193
|
+
/* @__PURE__ */ jsxs15(SelectContent2, { children: [
|
|
5194
|
+
/* @__PURE__ */ jsx18(SelectItem2, { value: ROOT_PARENT2, children: "Top level" }),
|
|
5195
|
+
hierarchy.roots.map((root) => /* @__PURE__ */ jsx18(SelectItem2, { value: root.id, children: root.name }, root.id))
|
|
5003
5196
|
] })
|
|
5004
5197
|
]
|
|
5005
5198
|
}
|
|
5006
5199
|
)
|
|
5007
5200
|
] }) : null,
|
|
5008
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsxs15(
|
|
5009
5202
|
CommandItem2,
|
|
5010
5203
|
{
|
|
5011
5204
|
value: `__create__${search}`,
|
|
@@ -5013,7 +5206,7 @@ function CategoryTagPicker({
|
|
|
5013
5206
|
disabled: creating,
|
|
5014
5207
|
className: "text-xs text-primary",
|
|
5015
5208
|
children: [
|
|
5016
|
-
creating ? /* @__PURE__ */
|
|
5209
|
+
creating ? /* @__PURE__ */ jsx18(SpinnerIcon, { className: "mr-2 h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx18(Icon, { className: "mr-2 h-3.5 w-3.5" }),
|
|
5017
5210
|
"Create \u201C",
|
|
5018
5211
|
search.trim(),
|
|
5019
5212
|
"\u201D"
|
|
@@ -5029,9 +5222,9 @@ function CategoryTagPicker({
|
|
|
5029
5222
|
|
|
5030
5223
|
// src/react/components/CommentThread.tsx
|
|
5031
5224
|
import { useState as useState17 } from "react";
|
|
5032
|
-
import { Button as
|
|
5225
|
+
import { Button as Button4, ErrorBox as ErrorBox2, Skeleton as Skeleton2, cn as cn13 } from "@ai-matrx/design-system";
|
|
5033
5226
|
import { formatRelativeTime } from "@ai-matrx/kit/format";
|
|
5034
|
-
import { Fragment as Fragment5, jsx as
|
|
5227
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5035
5228
|
var AUTHOR_DOOR_TOKEN = "user";
|
|
5036
5229
|
function resolveAuthor(comment, authorDisplay) {
|
|
5037
5230
|
const base2 = {
|
|
@@ -5050,7 +5243,7 @@ function resolveAuthor(comment, authorDisplay) {
|
|
|
5050
5243
|
}
|
|
5051
5244
|
function AuthorAvatar({ author }) {
|
|
5052
5245
|
if (author.avatarUrl) {
|
|
5053
|
-
return /* @__PURE__ */
|
|
5246
|
+
return /* @__PURE__ */ jsx19(
|
|
5054
5247
|
"img",
|
|
5055
5248
|
{
|
|
5056
5249
|
src: author.avatarUrl,
|
|
@@ -5059,7 +5252,7 @@ function AuthorAvatar({ author }) {
|
|
|
5059
5252
|
}
|
|
5060
5253
|
);
|
|
5061
5254
|
}
|
|
5062
|
-
return /* @__PURE__ */
|
|
5255
|
+
return /* @__PURE__ */ jsx19(
|
|
5063
5256
|
"span",
|
|
5064
5257
|
{
|
|
5065
5258
|
"aria-hidden": true,
|
|
@@ -5074,7 +5267,7 @@ function AuthorName({
|
|
|
5074
5267
|
}) {
|
|
5075
5268
|
const DoorRef2 = entityDoors?.EntityRef;
|
|
5076
5269
|
if (DoorRef2 && author.userId) {
|
|
5077
|
-
return /* @__PURE__ */
|
|
5270
|
+
return /* @__PURE__ */ jsx19(
|
|
5078
5271
|
DoorRef2,
|
|
5079
5272
|
{
|
|
5080
5273
|
token: AUTHOR_DOOR_TOKEN,
|
|
@@ -5085,7 +5278,7 @@ function AuthorName({
|
|
|
5085
5278
|
}
|
|
5086
5279
|
);
|
|
5087
5280
|
}
|
|
5088
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsx19("span", { className: "text-sm font-medium text-foreground", children: author.name });
|
|
5089
5282
|
}
|
|
5090
5283
|
function CommentComposer({
|
|
5091
5284
|
onSubmit,
|
|
@@ -5115,8 +5308,8 @@ function CommentComposer({
|
|
|
5115
5308
|
}
|
|
5116
5309
|
setBody("");
|
|
5117
5310
|
}
|
|
5118
|
-
return /* @__PURE__ */
|
|
5119
|
-
/* @__PURE__ */
|
|
5311
|
+
return /* @__PURE__ */ jsxs16("form", { onSubmit: submit, className: "flex flex-col gap-1.5", children: [
|
|
5312
|
+
/* @__PURE__ */ jsx19(
|
|
5120
5313
|
"textarea",
|
|
5121
5314
|
{
|
|
5122
5315
|
value: body,
|
|
@@ -5131,8 +5324,8 @@ function CommentComposer({
|
|
|
5131
5324
|
className: "w-full resize-y rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
5132
5325
|
}
|
|
5133
5326
|
),
|
|
5134
|
-
error && /* @__PURE__ */
|
|
5135
|
-
|
|
5327
|
+
error && /* @__PURE__ */ jsx19(
|
|
5328
|
+
ErrorBox2,
|
|
5136
5329
|
{
|
|
5137
5330
|
className: "text-xs text-destructive",
|
|
5138
5331
|
message: error,
|
|
@@ -5141,9 +5334,9 @@ function CommentComposer({
|
|
|
5141
5334
|
origin: "associations/CommentThread"
|
|
5142
5335
|
}
|
|
5143
5336
|
),
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5146
|
-
submitting && /* @__PURE__ */
|
|
5337
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
5338
|
+
/* @__PURE__ */ jsxs16(Button4, { type: "submit", size: "sm", disabled: !body.trim() || submitting, children: [
|
|
5339
|
+
submitting && /* @__PURE__ */ jsx19(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
5147
5340
|
submitLabel
|
|
5148
5341
|
] }),
|
|
5149
5342
|
trailing
|
|
@@ -5176,19 +5369,19 @@ function CommentItem({
|
|
|
5176
5369
|
notifier.error(res.error ?? "Could not delete the comment");
|
|
5177
5370
|
}
|
|
5178
5371
|
}
|
|
5179
|
-
return /* @__PURE__ */
|
|
5372
|
+
return /* @__PURE__ */ jsxs16(
|
|
5180
5373
|
"div",
|
|
5181
5374
|
{
|
|
5182
5375
|
"data-comment-id": comment.id,
|
|
5183
|
-
className:
|
|
5376
|
+
className: cn13(
|
|
5184
5377
|
"flex flex-col gap-1",
|
|
5185
5378
|
depth > 0 && "border-l border-border pl-3"
|
|
5186
5379
|
),
|
|
5187
5380
|
children: [
|
|
5188
|
-
/* @__PURE__ */
|
|
5189
|
-
/* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
5382
|
+
/* @__PURE__ */ jsx19(AuthorAvatar, { author }),
|
|
5383
|
+
/* @__PURE__ */ jsx19(AuthorName, { author, entityDoors }),
|
|
5384
|
+
/* @__PURE__ */ jsx19(
|
|
5192
5385
|
"span",
|
|
5193
5386
|
{
|
|
5194
5387
|
className: "text-xs text-muted-foreground",
|
|
@@ -5199,7 +5392,7 @@ function CommentItem({
|
|
|
5199
5392
|
})
|
|
5200
5393
|
}
|
|
5201
5394
|
),
|
|
5202
|
-
edited && /* @__PURE__ */
|
|
5395
|
+
edited && /* @__PURE__ */ jsx19(
|
|
5203
5396
|
"span",
|
|
5204
5397
|
{
|
|
5205
5398
|
className: "text-xs text-muted-foreground",
|
|
@@ -5208,7 +5401,7 @@ function CommentItem({
|
|
|
5208
5401
|
}
|
|
5209
5402
|
)
|
|
5210
5403
|
] }),
|
|
5211
|
-
editing ? /* @__PURE__ */
|
|
5404
|
+
editing ? /* @__PURE__ */ jsx19("div", { className: "pl-8", children: /* @__PURE__ */ jsx19(
|
|
5212
5405
|
CommentComposer,
|
|
5213
5406
|
{
|
|
5214
5407
|
initialValue: comment.body,
|
|
@@ -5220,8 +5413,8 @@ function CommentItem({
|
|
|
5220
5413
|
if (res.ok) setEditing(false);
|
|
5221
5414
|
return res;
|
|
5222
5415
|
},
|
|
5223
|
-
trailing: /* @__PURE__ */
|
|
5224
|
-
|
|
5416
|
+
trailing: /* @__PURE__ */ jsx19(
|
|
5417
|
+
Button4,
|
|
5225
5418
|
{
|
|
5226
5419
|
type: "button",
|
|
5227
5420
|
size: "sm",
|
|
@@ -5231,11 +5424,11 @@ function CommentItem({
|
|
|
5231
5424
|
}
|
|
5232
5425
|
)
|
|
5233
5426
|
}
|
|
5234
|
-
) }) : /* @__PURE__ */
|
|
5235
|
-
!editing && /* @__PURE__ */
|
|
5236
|
-
/* @__PURE__ */
|
|
5237
|
-
/* @__PURE__ */
|
|
5238
|
-
|
|
5427
|
+
) }) : /* @__PURE__ */ jsx19("p", { className: "whitespace-pre-wrap pl-8 text-sm text-foreground", children: comment.body }),
|
|
5428
|
+
!editing && /* @__PURE__ */ jsx19("div", { className: "flex items-center gap-1 pl-7", children: confirmingDelete ? /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
5429
|
+
/* @__PURE__ */ jsx19("span", { className: "text-xs text-destructive", children: "Deletes this comment for everyone." }),
|
|
5430
|
+
/* @__PURE__ */ jsxs16(
|
|
5431
|
+
Button4,
|
|
5239
5432
|
{
|
|
5240
5433
|
type: "button",
|
|
5241
5434
|
size: "sm",
|
|
@@ -5243,13 +5436,13 @@ function CommentItem({
|
|
|
5243
5436
|
disabled: deleting,
|
|
5244
5437
|
onClick: () => void confirmDelete(),
|
|
5245
5438
|
children: [
|
|
5246
|
-
deleting && /* @__PURE__ */
|
|
5439
|
+
deleting && /* @__PURE__ */ jsx19(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
5247
5440
|
"Delete"
|
|
5248
5441
|
]
|
|
5249
5442
|
}
|
|
5250
5443
|
),
|
|
5251
|
-
/* @__PURE__ */
|
|
5252
|
-
|
|
5444
|
+
/* @__PURE__ */ jsx19(
|
|
5445
|
+
Button4,
|
|
5253
5446
|
{
|
|
5254
5447
|
type: "button",
|
|
5255
5448
|
size: "sm",
|
|
@@ -5259,8 +5452,8 @@ function CommentItem({
|
|
|
5259
5452
|
children: "Cancel"
|
|
5260
5453
|
}
|
|
5261
5454
|
)
|
|
5262
|
-
] }) : /* @__PURE__ */
|
|
5263
|
-
/* @__PURE__ */
|
|
5455
|
+
] }) : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
5456
|
+
/* @__PURE__ */ jsx19(
|
|
5264
5457
|
"button",
|
|
5265
5458
|
{
|
|
5266
5459
|
type: "button",
|
|
@@ -5269,8 +5462,8 @@ function CommentItem({
|
|
|
5269
5462
|
children: "Reply"
|
|
5270
5463
|
}
|
|
5271
5464
|
),
|
|
5272
|
-
isOwn && /* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5465
|
+
isOwn && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
5466
|
+
/* @__PURE__ */ jsx19(
|
|
5274
5467
|
"button",
|
|
5275
5468
|
{
|
|
5276
5469
|
type: "button",
|
|
@@ -5279,7 +5472,7 @@ function CommentItem({
|
|
|
5279
5472
|
children: "Edit"
|
|
5280
5473
|
}
|
|
5281
5474
|
),
|
|
5282
|
-
/* @__PURE__ */
|
|
5475
|
+
/* @__PURE__ */ jsx19(
|
|
5283
5476
|
"button",
|
|
5284
5477
|
{
|
|
5285
5478
|
type: "button",
|
|
@@ -5290,9 +5483,9 @@ function CommentItem({
|
|
|
5290
5483
|
)
|
|
5291
5484
|
] })
|
|
5292
5485
|
] }) }),
|
|
5293
|
-
replying && /* @__PURE__ */
|
|
5294
|
-
/* @__PURE__ */
|
|
5295
|
-
/* @__PURE__ */
|
|
5486
|
+
replying && /* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-2 pl-8 pt-1", children: [
|
|
5487
|
+
/* @__PURE__ */ jsx19(CornerDownRightIcon, { className: "mt-2 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5488
|
+
/* @__PURE__ */ jsx19("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx19(
|
|
5296
5489
|
CommentComposer,
|
|
5297
5490
|
{
|
|
5298
5491
|
submitLabel: "Reply",
|
|
@@ -5306,8 +5499,8 @@ function CommentItem({
|
|
|
5306
5499
|
if (res.ok) setReplying(false);
|
|
5307
5500
|
return res;
|
|
5308
5501
|
},
|
|
5309
|
-
trailing: /* @__PURE__ */
|
|
5310
|
-
|
|
5502
|
+
trailing: /* @__PURE__ */ jsx19(
|
|
5503
|
+
Button4,
|
|
5311
5504
|
{
|
|
5312
5505
|
type: "button",
|
|
5313
5506
|
size: "sm",
|
|
@@ -5319,7 +5512,7 @@ function CommentItem({
|
|
|
5319
5512
|
}
|
|
5320
5513
|
) })
|
|
5321
5514
|
] }),
|
|
5322
|
-
replies.length > 0 && /* @__PURE__ */
|
|
5515
|
+
replies.length > 0 && /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-3 pl-8 pt-1", children: replies.map((reply) => /* @__PURE__ */ jsx19(
|
|
5323
5516
|
CommentItem,
|
|
5324
5517
|
{
|
|
5325
5518
|
comment: reply,
|
|
@@ -5359,11 +5552,11 @@ function CommentThread({
|
|
|
5359
5552
|
const thread = useComments({ token, id });
|
|
5360
5553
|
const { roots, childrenOf } = buildCommentTree(thread.comments);
|
|
5361
5554
|
const loading = (thread.status === "loading" || thread.status === "idle") && thread.comments.length === 0;
|
|
5362
|
-
return /* @__PURE__ */
|
|
5363
|
-
showHeader && /* @__PURE__ */
|
|
5364
|
-
/* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5366
|
-
/* @__PURE__ */
|
|
5555
|
+
return /* @__PURE__ */ jsxs16("section", { className: cn13("flex flex-col gap-3", className), children: [
|
|
5556
|
+
showHeader && /* @__PURE__ */ jsxs16("header", { className: "flex items-center gap-2", children: [
|
|
5557
|
+
/* @__PURE__ */ jsx19("h3", { className: "text-sm font-semibold text-foreground", children: "Comments" }),
|
|
5558
|
+
/* @__PURE__ */ jsx19("span", { className: "text-xs text-muted-foreground tabular-nums", children: thread.comments.length }),
|
|
5559
|
+
/* @__PURE__ */ jsx19(
|
|
5367
5560
|
"button",
|
|
5368
5561
|
{
|
|
5369
5562
|
type: "button",
|
|
@@ -5371,12 +5564,12 @@ function CommentThread({
|
|
|
5371
5564
|
"aria-label": "Refresh comments",
|
|
5372
5565
|
title: "Refresh comments",
|
|
5373
5566
|
className: "ml-auto flex h-6 w-6 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
5374
|
-
children: thread.status === "loading" ? /* @__PURE__ */
|
|
5567
|
+
children: thread.status === "loading" ? /* @__PURE__ */ jsx19(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx19(RefreshIcon, { className: "h-3.5 w-3.5" })
|
|
5375
5568
|
}
|
|
5376
5569
|
)
|
|
5377
5570
|
] }),
|
|
5378
|
-
thread.error && /* @__PURE__ */
|
|
5379
|
-
|
|
5571
|
+
thread.error && /* @__PURE__ */ jsxs16(
|
|
5572
|
+
ErrorBox2,
|
|
5380
5573
|
{
|
|
5381
5574
|
as: "div",
|
|
5382
5575
|
className: "flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
@@ -5384,9 +5577,9 @@ function CommentThread({
|
|
|
5384
5577
|
operation: "Load comments",
|
|
5385
5578
|
origin: "associations/CommentThread",
|
|
5386
5579
|
children: [
|
|
5387
|
-
/* @__PURE__ */
|
|
5388
|
-
/* @__PURE__ */
|
|
5389
|
-
|
|
5580
|
+
/* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1", children: thread.error }),
|
|
5581
|
+
/* @__PURE__ */ jsx19(
|
|
5582
|
+
Button4,
|
|
5390
5583
|
{
|
|
5391
5584
|
type: "button",
|
|
5392
5585
|
size: "sm",
|
|
@@ -5399,10 +5592,10 @@ function CommentThread({
|
|
|
5399
5592
|
]
|
|
5400
5593
|
}
|
|
5401
5594
|
),
|
|
5402
|
-
loading ? /* @__PURE__ */
|
|
5403
|
-
/* @__PURE__ */
|
|
5404
|
-
/* @__PURE__ */
|
|
5405
|
-
] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */
|
|
5595
|
+
loading ? /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-3", "aria-hidden": true, "data-testid": "comments-loading", children: [
|
|
5596
|
+
/* @__PURE__ */ jsx19(Skeleton2, { className: "h-12 w-full" }),
|
|
5597
|
+
/* @__PURE__ */ jsx19(Skeleton2, { className: "h-12 w-4/5" })
|
|
5598
|
+
] }) : roots.length === 0 && !thread.error ? /* @__PURE__ */ jsx19("p", { className: "text-sm text-muted-foreground", children: "No comments yet." }) : /* @__PURE__ */ jsx19("div", { className: "flex flex-col gap-4", children: roots.map((comment) => /* @__PURE__ */ jsx19(
|
|
5406
5599
|
CommentItem,
|
|
5407
5600
|
{
|
|
5408
5601
|
comment,
|
|
@@ -5413,7 +5606,7 @@ function CommentThread({
|
|
|
5413
5606
|
},
|
|
5414
5607
|
comment.id
|
|
5415
5608
|
)) }),
|
|
5416
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ jsx19(
|
|
5417
5610
|
CommentComposer,
|
|
5418
5611
|
{
|
|
5419
5612
|
onSubmit: (body) => thread.add(body, { orgId: orgId ?? null })
|
|
@@ -5443,11 +5636,13 @@ export {
|
|
|
5443
5636
|
DoorControlsSlot,
|
|
5444
5637
|
DoorRef,
|
|
5445
5638
|
PrimaryEntityProvider,
|
|
5639
|
+
SearchFailureNotice,
|
|
5446
5640
|
UniversalAssociationPicker,
|
|
5447
5641
|
UnresolvedRef,
|
|
5448
5642
|
attachedKey,
|
|
5449
5643
|
buildCommentTree,
|
|
5450
5644
|
containerLinksArgs,
|
|
5645
|
+
describeSearchFailures,
|
|
5451
5646
|
getContentRoleMeta,
|
|
5452
5647
|
lazyPickerOverride,
|
|
5453
5648
|
lazyWindowShell,
|