@ai-matrx/associations 0.12.1 → 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 +28 -0
- package/dist/{CommentThread-C78e8433.d.cts → CommentThread-DP4sEzb2.d.cts} +19 -8
- package/dist/{CommentThread-C78e8433.d.ts → CommentThread-DP4sEzb2.d.ts} +19 -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 +662 -538
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +38 -5
- package/dist/react/index.d.ts +38 -5
- package/dist/react/index.js +635 -511
- 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 +3 -3
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,6 +1627,11 @@ function useUniversalEntitySearch(args) {
|
|
|
1628
1627
|
const store = useAssociationsStore();
|
|
1629
1628
|
const [results, setResults] = useState3([]);
|
|
1630
1629
|
const [loading, setLoading] = useState3(false);
|
|
1630
|
+
const [failures, setFailures] = useState3([]);
|
|
1631
|
+
const [error, setError] = useState3(null);
|
|
1632
|
+
const [status, setStatus] = useState3(
|
|
1633
|
+
enabled ? "loading" : "ready"
|
|
1634
|
+
);
|
|
1631
1635
|
const [source, setSource] = useState3(
|
|
1632
1636
|
emptyQueryMode === "candidates" ? "candidates" : "recents"
|
|
1633
1637
|
);
|
|
@@ -1640,41 +1644,72 @@ function useUniversalEntitySearch(args) {
|
|
|
1640
1644
|
const timer = setTimeout(async () => {
|
|
1641
1645
|
if (runRef.current !== run) return;
|
|
1642
1646
|
setLoading(true);
|
|
1647
|
+
setStatus("loading");
|
|
1643
1648
|
const activeTokens = tokensKey ? tokensKey.split(",") : store.registry.listableTokens();
|
|
1644
1649
|
const browse = () => store.candidates.searchCandidatesAcrossTokens({
|
|
1645
1650
|
tokens: activeTokens,
|
|
1646
1651
|
search: trimmed,
|
|
1647
|
-
ownerId: ownerId ?? null,
|
|
1648
1652
|
perTokenLimit
|
|
1649
1653
|
});
|
|
1654
|
+
const allFailed = (r) => activeTokens.length > 0 && r.failures.length >= activeTokens.length;
|
|
1650
1655
|
let next = [];
|
|
1651
1656
|
let nextSource;
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
next =
|
|
1657
|
-
|
|
1657
|
+
const nextFailures = [];
|
|
1658
|
+
let nextError = null;
|
|
1659
|
+
if (trimmed || emptyQueryMode === "candidates") {
|
|
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);
|
|
1658
1665
|
} else {
|
|
1659
|
-
|
|
1666
|
+
const recents = await loadRecents(store, activeTokens);
|
|
1660
1667
|
nextSource = "recents";
|
|
1668
|
+
if (recents.ok) {
|
|
1669
|
+
next = recents.data;
|
|
1670
|
+
} else {
|
|
1671
|
+
nextFailures.push({ token: null, error: recents.error });
|
|
1672
|
+
}
|
|
1661
1673
|
if (next.length === 0 && runRef.current === run) {
|
|
1662
|
-
|
|
1674
|
+
const r = await browse();
|
|
1675
|
+
next = r.results;
|
|
1676
|
+
nextFailures.push(...r.failures);
|
|
1663
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
|
+
}
|
|
1664
1681
|
}
|
|
1665
1682
|
}
|
|
1666
1683
|
if (runRef.current !== run) return;
|
|
1667
1684
|
setResults(next);
|
|
1668
1685
|
setSource(nextSource);
|
|
1686
|
+
setFailures(nextFailures);
|
|
1687
|
+
setError(nextError);
|
|
1688
|
+
setStatus(nextError ? "error" : "ready");
|
|
1669
1689
|
setLoading(false);
|
|
1670
1690
|
}, DEBOUNCE_MS);
|
|
1671
1691
|
return () => clearTimeout(timer);
|
|
1672
|
-
}, [query, tokensKey,
|
|
1673
|
-
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}` : ""}`;
|
|
1674
1709
|
}
|
|
1675
1710
|
async function loadRecents(store, tokens) {
|
|
1676
1711
|
const res = await store.favorites.list();
|
|
1677
|
-
if (!res.ok) return
|
|
1712
|
+
if (!res.ok) return { ok: false, error: res.error.message };
|
|
1678
1713
|
const tokenSet = new Set(tokens);
|
|
1679
1714
|
const rows = res.data.items.filter(
|
|
1680
1715
|
(i) => tokenSet.has(i.entityType) && isEntityTypeToken(i.entityType) && (i.isFavorite || i.lastViewedAt)
|
|
@@ -1682,7 +1717,7 @@ async function loadRecents(store, tokens) {
|
|
|
1682
1717
|
if (a.isFavorite !== b.isFavorite) return a.isFavorite ? -1 : 1;
|
|
1683
1718
|
return (b.lastViewedAt ?? "").localeCompare(a.lastViewedAt ?? "");
|
|
1684
1719
|
}).slice(0, RECENTS_LIMIT);
|
|
1685
|
-
if (rows.length === 0) return [];
|
|
1720
|
+
if (rows.length === 0) return { ok: true, data: [] };
|
|
1686
1721
|
const byToken = /* @__PURE__ */ new Map();
|
|
1687
1722
|
for (const r of rows) {
|
|
1688
1723
|
const list = byToken.get(r.entityType) ?? [];
|
|
@@ -1705,7 +1740,72 @@ async function loadRecents(store, tokens) {
|
|
|
1705
1740
|
title
|
|
1706
1741
|
});
|
|
1707
1742
|
}
|
|
1708
|
-
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
|
+
);
|
|
1709
1809
|
}
|
|
1710
1810
|
|
|
1711
1811
|
// src/react/hooks/useAssociationCandidates.ts
|
|
@@ -1713,7 +1813,6 @@ import { useEffect as useEffect6, useState as useState4 } from "react";
|
|
|
1713
1813
|
function useAssociationCandidates(args) {
|
|
1714
1814
|
const { token, enabled = true, search, limit } = args;
|
|
1715
1815
|
const store = useAssociationsStore();
|
|
1716
|
-
const userId = currentUserIdOrNull(store);
|
|
1717
1816
|
const [candidates, setCandidates] = useState4([]);
|
|
1718
1817
|
const [loading, setLoading] = useState4(false);
|
|
1719
1818
|
const [error, setError] = useState4(null);
|
|
@@ -1726,7 +1825,6 @@ function useAssociationCandidates(args) {
|
|
|
1726
1825
|
setError(null);
|
|
1727
1826
|
const res = await store.candidates.listAssociationCandidates({
|
|
1728
1827
|
token,
|
|
1729
|
-
ownerId: userId,
|
|
1730
1828
|
...search !== void 0 ? { search } : {},
|
|
1731
1829
|
...limit !== void 0 ? { limit } : {}
|
|
1732
1830
|
});
|
|
@@ -1742,7 +1840,7 @@ function useAssociationCandidates(args) {
|
|
|
1742
1840
|
return () => {
|
|
1743
1841
|
cancelled = true;
|
|
1744
1842
|
};
|
|
1745
|
-
}, [token, enabled,
|
|
1843
|
+
}, [token, enabled, search, limit, tick, store]);
|
|
1746
1844
|
return {
|
|
1747
1845
|
candidates,
|
|
1748
1846
|
loading,
|
|
@@ -1750,13 +1848,6 @@ function useAssociationCandidates(args) {
|
|
|
1750
1848
|
reload: () => setTick((t) => t + 1)
|
|
1751
1849
|
};
|
|
1752
1850
|
}
|
|
1753
|
-
function currentUserIdOrNull(store) {
|
|
1754
|
-
try {
|
|
1755
|
-
return store.identity.requireUserId();
|
|
1756
|
-
} catch {
|
|
1757
|
-
return null;
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
1851
|
|
|
1761
1852
|
// src/react/hooks/useComments.ts
|
|
1762
1853
|
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
@@ -1900,13 +1991,13 @@ function useAssociationEntitySelectAdapter(args) {
|
|
|
1900
1991
|
|
|
1901
1992
|
// src/react/components/PrimaryEntityContext.tsx
|
|
1902
1993
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1903
|
-
import { jsx as
|
|
1994
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
1904
1995
|
var PrimaryEntityCtx = createContext2(null);
|
|
1905
1996
|
function PrimaryEntityProvider({
|
|
1906
1997
|
value,
|
|
1907
1998
|
children
|
|
1908
1999
|
}) {
|
|
1909
|
-
return /* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx3(PrimaryEntityCtx.Provider, { value, children });
|
|
1910
2001
|
}
|
|
1911
2002
|
function usePrimaryEntity() {
|
|
1912
2003
|
return useContext2(PrimaryEntityCtx);
|
|
@@ -1924,10 +2015,10 @@ import {
|
|
|
1924
2015
|
useState as useState6
|
|
1925
2016
|
} from "react";
|
|
1926
2017
|
import { createPortal } from "react-dom";
|
|
1927
|
-
import { cn } from "@ai-matrx/design-system";
|
|
2018
|
+
import { cn as cn2 } from "@ai-matrx/design-system";
|
|
1928
2019
|
|
|
1929
2020
|
// src/react/icons.tsx
|
|
1930
|
-
import { jsx as
|
|
2021
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1931
2022
|
function base(props) {
|
|
1932
2023
|
return {
|
|
1933
2024
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1944,129 +2035,129 @@ function base(props) {
|
|
|
1944
2035
|
};
|
|
1945
2036
|
}
|
|
1946
2037
|
function SpinnerIcon(props) {
|
|
1947
|
-
return /* @__PURE__ */
|
|
2038
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) });
|
|
1948
2039
|
}
|
|
1949
2040
|
function PlusIcon(props) {
|
|
1950
|
-
return /* @__PURE__ */
|
|
1951
|
-
/* @__PURE__ */
|
|
1952
|
-
/* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ jsxs2("svg", { ...base(props), children: [
|
|
2042
|
+
/* @__PURE__ */ jsx4("path", { d: "M5 12h14" }),
|
|
2043
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 5v14" })
|
|
1953
2044
|
] });
|
|
1954
2045
|
}
|
|
1955
2046
|
function XIcon(props) {
|
|
1956
|
-
return /* @__PURE__ */
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__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" })
|
|
1959
2050
|
] });
|
|
1960
2051
|
}
|
|
1961
2052
|
function CheckIcon(props) {
|
|
1962
|
-
return /* @__PURE__ */
|
|
2053
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "M20 6 9 17l-5-5" }) });
|
|
1963
2054
|
}
|
|
1964
2055
|
function SearchIcon(props) {
|
|
1965
|
-
return /* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1967
|
-
/* @__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" })
|
|
1968
2059
|
] });
|
|
1969
2060
|
}
|
|
1970
2061
|
function Link2Icon(props) {
|
|
1971
|
-
return /* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__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" })
|
|
1975
2066
|
] });
|
|
1976
2067
|
}
|
|
1977
2068
|
function RefreshIcon(props) {
|
|
1978
|
-
return /* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1980
|
-
/* @__PURE__ */
|
|
1981
|
-
/* @__PURE__ */
|
|
1982
|
-
/* @__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" })
|
|
1983
2074
|
] });
|
|
1984
2075
|
}
|
|
1985
2076
|
function PinIcon(props) {
|
|
1986
|
-
return /* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
1988
|
-
/* @__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" })
|
|
1989
2080
|
] });
|
|
1990
2081
|
}
|
|
1991
2082
|
function UploadIcon(props) {
|
|
1992
|
-
return /* @__PURE__ */
|
|
1993
|
-
/* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
1995
|
-
/* @__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" })
|
|
1996
2087
|
] });
|
|
1997
2088
|
}
|
|
1998
2089
|
function FolderOpenIcon(props) {
|
|
1999
|
-
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" }) });
|
|
2000
2091
|
}
|
|
2001
2092
|
function ExternalLinkIcon(props) {
|
|
2002
|
-
return /* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2004
|
-
/* @__PURE__ */
|
|
2005
|
-
/* @__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" })
|
|
2006
2097
|
] });
|
|
2007
2098
|
}
|
|
2008
2099
|
function ChevronDownIcon(props) {
|
|
2009
|
-
return /* @__PURE__ */
|
|
2100
|
+
return /* @__PURE__ */ jsx4("svg", { ...base(props), children: /* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }) });
|
|
2010
2101
|
}
|
|
2011
2102
|
function ChevronsUpDownIcon(props) {
|
|
2012
|
-
return /* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__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" })
|
|
2015
2106
|
] });
|
|
2016
2107
|
}
|
|
2017
2108
|
function CornerDownRightIcon(props) {
|
|
2018
|
-
return /* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__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" })
|
|
2021
2112
|
] });
|
|
2022
2113
|
}
|
|
2023
2114
|
function TagIcon(props) {
|
|
2024
|
-
return /* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__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" })
|
|
2027
2118
|
] });
|
|
2028
2119
|
}
|
|
2029
2120
|
function DefaultEntityIcon(props) {
|
|
2030
|
-
return /* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
/* @__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" })
|
|
2043
2134
|
] });
|
|
2044
2135
|
}
|
|
2045
2136
|
function MaximizeIcon(props) {
|
|
2046
|
-
return /* @__PURE__ */
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2049
|
-
/* @__PURE__ */
|
|
2050
|
-
/* @__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" })
|
|
2051
2142
|
] });
|
|
2052
2143
|
}
|
|
2053
2144
|
function RestoreIcon(props) {
|
|
2054
|
-
return /* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__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" })
|
|
2059
2150
|
] });
|
|
2060
2151
|
}
|
|
2061
2152
|
function GripResizeIcon(props) {
|
|
2062
|
-
return /* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__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" })
|
|
2065
2156
|
] });
|
|
2066
2157
|
}
|
|
2067
2158
|
|
|
2068
2159
|
// src/react/components/DefaultWindowShell.tsx
|
|
2069
|
-
import { jsx as
|
|
2160
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2070
2161
|
var DEFAULT_WIDTH = 440;
|
|
2071
2162
|
var DEFAULT_HEIGHT = 580;
|
|
2072
2163
|
var MIN_WIDTH = 330;
|
|
@@ -2189,7 +2280,7 @@ function DefaultWindowShell({
|
|
|
2189
2280
|
height: rect.height
|
|
2190
2281
|
};
|
|
2191
2282
|
return createPortal(
|
|
2192
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsxs3(
|
|
2193
2284
|
"div",
|
|
2194
2285
|
{
|
|
2195
2286
|
ref: panelRef,
|
|
@@ -2197,7 +2288,7 @@ function DefaultWindowShell({
|
|
|
2197
2288
|
"aria-labelledby": labelId,
|
|
2198
2289
|
tabIndex: -1,
|
|
2199
2290
|
style,
|
|
2200
|
-
className:
|
|
2291
|
+
className: cn2(
|
|
2201
2292
|
// Non-modal by design: no backdrop element exists, so the page
|
|
2202
2293
|
// behind keeps every click. `pointer-events-auto` re-asserts our
|
|
2203
2294
|
// own subtree in case a Radix surface left <body> inert.
|
|
@@ -2206,7 +2297,7 @@ function DefaultWindowShell({
|
|
|
2206
2297
|
className
|
|
2207
2298
|
),
|
|
2208
2299
|
children: [
|
|
2209
|
-
/* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ jsxs3(
|
|
2210
2301
|
"header",
|
|
2211
2302
|
{
|
|
2212
2303
|
onPointerDown: beginGesture("move"),
|
|
@@ -2216,24 +2307,24 @@ function DefaultWindowShell({
|
|
|
2216
2307
|
onDoubleClick: () => {
|
|
2217
2308
|
if (!isMobile) setMaximized((v) => !v);
|
|
2218
2309
|
},
|
|
2219
|
-
className:
|
|
2310
|
+
className: cn2(
|
|
2220
2311
|
"flex shrink-0 items-center justify-between gap-2 border-b border-border px-3 py-2 select-none",
|
|
2221
2312
|
isMobile ? "" : "cursor-move touch-none"
|
|
2222
2313
|
),
|
|
2223
2314
|
children: [
|
|
2224
|
-
/* @__PURE__ */
|
|
2315
|
+
/* @__PURE__ */ jsxs3(
|
|
2225
2316
|
"span",
|
|
2226
2317
|
{
|
|
2227
2318
|
id: labelId,
|
|
2228
2319
|
className: "flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground",
|
|
2229
2320
|
children: [
|
|
2230
2321
|
icon,
|
|
2231
|
-
/* @__PURE__ */
|
|
2322
|
+
/* @__PURE__ */ jsx5("span", { className: "truncate", children: title })
|
|
2232
2323
|
]
|
|
2233
2324
|
}
|
|
2234
2325
|
),
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
isMobile ? null : /* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsxs3("span", { className: "flex shrink-0 items-center gap-0.5", children: [
|
|
2327
|
+
isMobile ? null : /* @__PURE__ */ jsx5(
|
|
2237
2328
|
"button",
|
|
2238
2329
|
{
|
|
2239
2330
|
type: "button",
|
|
@@ -2241,10 +2332,10 @@ function DefaultWindowShell({
|
|
|
2241
2332
|
onClick: () => setMaximized((v) => !v),
|
|
2242
2333
|
"aria-label": maximized ? "Restore window" : "Maximize window",
|
|
2243
2334
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2244
|
-
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" })
|
|
2245
2336
|
}
|
|
2246
2337
|
),
|
|
2247
|
-
/* @__PURE__ */
|
|
2338
|
+
/* @__PURE__ */ jsx5(
|
|
2248
2339
|
"button",
|
|
2249
2340
|
{
|
|
2250
2341
|
type: "button",
|
|
@@ -2252,15 +2343,15 @@ function DefaultWindowShell({
|
|
|
2252
2343
|
onClick: onClose,
|
|
2253
2344
|
"aria-label": "Close",
|
|
2254
2345
|
className: "flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",
|
|
2255
|
-
children: /* @__PURE__ */
|
|
2346
|
+
children: /* @__PURE__ */ jsx5(XIcon, { className: "h-3.5 w-3.5" })
|
|
2256
2347
|
}
|
|
2257
2348
|
)
|
|
2258
2349
|
] })
|
|
2259
2350
|
]
|
|
2260
2351
|
}
|
|
2261
2352
|
),
|
|
2262
|
-
/* @__PURE__ */
|
|
2263
|
-
isMobile || maximized ? null : /* @__PURE__ */
|
|
2353
|
+
/* @__PURE__ */ jsx5("div", { className: "min-h-0 flex-1 overflow-hidden", children }),
|
|
2354
|
+
isMobile || maximized ? null : /* @__PURE__ */ jsx5(
|
|
2264
2355
|
"button",
|
|
2265
2356
|
{
|
|
2266
2357
|
type: "button",
|
|
@@ -2270,7 +2361,7 @@ function DefaultWindowShell({
|
|
|
2270
2361
|
onPointerUp: endGesture,
|
|
2271
2362
|
onPointerCancel: endGesture,
|
|
2272
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",
|
|
2273
|
-
children: /* @__PURE__ */
|
|
2364
|
+
children: /* @__PURE__ */ jsx5(GripResizeIcon, { className: "h-3 w-3" })
|
|
2274
2365
|
}
|
|
2275
2366
|
)
|
|
2276
2367
|
]
|
|
@@ -2281,7 +2372,7 @@ function DefaultWindowShell({
|
|
|
2281
2372
|
}
|
|
2282
2373
|
|
|
2283
2374
|
// src/react/components/AssociationWindow.tsx
|
|
2284
|
-
import { jsx as
|
|
2375
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2285
2376
|
function AssociationWindow({
|
|
2286
2377
|
open,
|
|
2287
2378
|
onClose,
|
|
@@ -2294,16 +2385,16 @@ function AssociationWindow({
|
|
|
2294
2385
|
const instanceId = useId();
|
|
2295
2386
|
const { windowShell } = useAssociationsUiPorts();
|
|
2296
2387
|
if (!open) return null;
|
|
2297
|
-
const body = /* @__PURE__ */
|
|
2298
|
-
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,
|
|
2299
2390
|
children
|
|
2300
2391
|
] });
|
|
2301
2392
|
const windowId = `association:${scopeId}:${instanceId}`;
|
|
2302
2393
|
if (windowShell) {
|
|
2303
2394
|
const HostWindow = windowShell.Window;
|
|
2304
|
-
return /* @__PURE__ */
|
|
2395
|
+
return /* @__PURE__ */ jsx6(HostWindow, { id: windowId, title, onClose, children: body });
|
|
2305
2396
|
}
|
|
2306
|
-
return /* @__PURE__ */
|
|
2397
|
+
return /* @__PURE__ */ jsx6(
|
|
2307
2398
|
DefaultWindowShell,
|
|
2308
2399
|
{
|
|
2309
2400
|
id: windowId,
|
|
@@ -2317,28 +2408,28 @@ function AssociationWindow({
|
|
|
2317
2408
|
|
|
2318
2409
|
// src/react/components/AssociationPicker.tsx
|
|
2319
2410
|
import { useState as useState7 } from "react";
|
|
2320
|
-
import { cn as
|
|
2321
|
-
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";
|
|
2322
2413
|
function AssociationPicker(props) {
|
|
2323
2414
|
const store = useAssociationsStore();
|
|
2324
2415
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
2325
2416
|
const info = store.registry.getEntityInfo(props.token);
|
|
2326
2417
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
2327
2418
|
const Override = pickerOverrides?.[props.token];
|
|
2328
|
-
if (Override) return /* @__PURE__ */
|
|
2419
|
+
if (Override) return /* @__PURE__ */ jsx7(Override, { ...props });
|
|
2329
2420
|
const title = `Add ${info.labelPlural}`;
|
|
2330
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";
|
|
2331
2422
|
if (!props.open) return null;
|
|
2332
|
-
return /* @__PURE__ */
|
|
2423
|
+
return /* @__PURE__ */ jsx7(
|
|
2333
2424
|
AssociationWindow,
|
|
2334
2425
|
{
|
|
2335
2426
|
open: props.open,
|
|
2336
2427
|
onClose: () => props.onOpenChange(false),
|
|
2337
2428
|
scopeId: `picker:${props.token}`,
|
|
2338
2429
|
title,
|
|
2339
|
-
icon: /* @__PURE__ */
|
|
2430
|
+
icon: /* @__PURE__ */ jsx7(Icon, { className: "size-3.5 text-primary" }),
|
|
2340
2431
|
subtitle,
|
|
2341
|
-
children: /* @__PURE__ */
|
|
2432
|
+
children: /* @__PURE__ */ jsx7(
|
|
2342
2433
|
AssociationCandidateBody,
|
|
2343
2434
|
{
|
|
2344
2435
|
token: props.token,
|
|
@@ -2363,7 +2454,7 @@ function AssociationCandidateBody({
|
|
|
2363
2454
|
onClose
|
|
2364
2455
|
}) {
|
|
2365
2456
|
void onClose;
|
|
2366
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsx7(
|
|
2367
2458
|
EntityCandidateList,
|
|
2368
2459
|
{
|
|
2369
2460
|
token,
|
|
@@ -2394,7 +2485,11 @@ function EntityCandidateList({
|
|
|
2394
2485
|
enabled,
|
|
2395
2486
|
...search.trim() ? { search: search.trim() } : {}
|
|
2396
2487
|
});
|
|
2397
|
-
const {
|
|
2488
|
+
const {
|
|
2489
|
+
results: recentCandidates,
|
|
2490
|
+
loading: recentsLoading,
|
|
2491
|
+
failures: recentsFailures
|
|
2492
|
+
} = useUniversalEntitySearch({
|
|
2398
2493
|
query: "",
|
|
2399
2494
|
tokens: [token],
|
|
2400
2495
|
enabled: enabled && !search.trim()
|
|
@@ -2419,10 +2514,10 @@ function EntityCandidateList({
|
|
|
2419
2514
|
setBusyId(null);
|
|
2420
2515
|
}
|
|
2421
2516
|
};
|
|
2422
|
-
return /* @__PURE__ */
|
|
2423
|
-
/* @__PURE__ */
|
|
2424
|
-
/* @__PURE__ */
|
|
2425
|
-
/* @__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(
|
|
2426
2521
|
Input,
|
|
2427
2522
|
{
|
|
2428
2523
|
value: search,
|
|
@@ -2433,46 +2528,58 @@ function EntityCandidateList({
|
|
|
2433
2528
|
}
|
|
2434
2529
|
)
|
|
2435
2530
|
] }),
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
|
|
2439
|
-
] }) : error ? /* @__PURE__ */ jsxs4("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: [
|
|
2440
|
-
/* @__PURE__ */ jsx6("p", { className: "font-medium", children: "Couldn\u2019t load items" }),
|
|
2441
|
-
/* @__PURE__ */ jsx6("p", { className: "opacity-80", children: error }),
|
|
2442
|
-
/* @__PURE__ */ jsx6(
|
|
2443
|
-
"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,
|
|
2444
2534
|
{
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
)
|
|
2451
|
-
] }) : 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: [
|
|
2452
|
-
visibleRecents.length > 0 && /* @__PURE__ */ jsx6(
|
|
2453
|
-
CandidateSection,
|
|
2454
|
-
{
|
|
2455
|
-
label: "Recent",
|
|
2456
|
-
candidates: visibleRecents,
|
|
2457
|
-
attachedIds,
|
|
2458
|
-
busyId,
|
|
2459
|
-
icon: /* @__PURE__ */ jsx6(Icon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
2460
|
-
onToggle: toggle
|
|
2535
|
+
error: null,
|
|
2536
|
+
failures: recentsFailures,
|
|
2537
|
+
operation: `Load recent ${info.labelPlural.toLowerCase()}`,
|
|
2538
|
+
origin: "associations/AssociationPicker",
|
|
2539
|
+
className: "mb-1"
|
|
2461
2540
|
}
|
|
2462
2541
|
),
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
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(
|
|
2476
2583
|
CreateAndAttachFooter,
|
|
2477
2584
|
{
|
|
2478
2585
|
token,
|
|
@@ -2492,33 +2599,33 @@ function CandidateSection({
|
|
|
2492
2599
|
icon,
|
|
2493
2600
|
onToggle
|
|
2494
2601
|
}) {
|
|
2495
|
-
return /* @__PURE__ */
|
|
2496
|
-
label && /* @__PURE__ */
|
|
2497
|
-
/* @__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) => {
|
|
2498
2605
|
const attached = attachedIds.has(candidate.id);
|
|
2499
2606
|
const busy = busyId === candidate.id;
|
|
2500
|
-
return /* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsxs5(
|
|
2501
2608
|
"button",
|
|
2502
2609
|
{
|
|
2503
2610
|
type: "button",
|
|
2504
2611
|
disabled: busy,
|
|
2505
2612
|
onClick: () => void onToggle(candidate.id, candidate.title),
|
|
2506
|
-
className:
|
|
2613
|
+
className: cn3(
|
|
2507
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",
|
|
2508
2615
|
"hover:bg-accent disabled:opacity-50",
|
|
2509
2616
|
attached && "bg-accent/40"
|
|
2510
2617
|
),
|
|
2511
2618
|
children: [
|
|
2512
2619
|
icon,
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
/* @__PURE__ */
|
|
2620
|
+
/* @__PURE__ */ jsx7("span", { className: "flex-1 min-w-0 truncate text-foreground", children: candidate.title }),
|
|
2621
|
+
/* @__PURE__ */ jsx7(
|
|
2515
2622
|
"span",
|
|
2516
2623
|
{
|
|
2517
|
-
className:
|
|
2624
|
+
className: cn3(
|
|
2518
2625
|
"flex h-5 w-5 items-center justify-center rounded-full shrink-0",
|
|
2519
2626
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2520
2627
|
),
|
|
2521
|
-
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" })
|
|
2522
2629
|
}
|
|
2523
2630
|
)
|
|
2524
2631
|
]
|
|
@@ -2574,7 +2681,7 @@ function CreateAndAttachFooter({
|
|
|
2574
2681
|
}
|
|
2575
2682
|
};
|
|
2576
2683
|
if (!editing) {
|
|
2577
|
-
return /* @__PURE__ */
|
|
2684
|
+
return /* @__PURE__ */ jsxs5(
|
|
2578
2685
|
"button",
|
|
2579
2686
|
{
|
|
2580
2687
|
type: "button",
|
|
@@ -2584,10 +2691,10 @@ function CreateAndAttachFooter({
|
|
|
2584
2691
|
},
|
|
2585
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",
|
|
2586
2693
|
children: [
|
|
2587
|
-
/* @__PURE__ */
|
|
2694
|
+
/* @__PURE__ */ jsx7(PlusIcon, { className: "h-4 w-4" }),
|
|
2588
2695
|
"New ",
|
|
2589
2696
|
info.label,
|
|
2590
|
-
seed ? /* @__PURE__ */
|
|
2697
|
+
seed ? /* @__PURE__ */ jsxs5("span", { className: "max-w-40 truncate text-muted-foreground/70", children: [
|
|
2591
2698
|
"\u201C",
|
|
2592
2699
|
seed,
|
|
2593
2700
|
"\u201D"
|
|
@@ -2596,8 +2703,8 @@ function CreateAndAttachFooter({
|
|
|
2596
2703
|
}
|
|
2597
2704
|
);
|
|
2598
2705
|
}
|
|
2599
|
-
return /* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2706
|
+
return /* @__PURE__ */ jsxs5("div", { className: "mt-2 flex shrink-0 items-center gap-1.5", children: [
|
|
2707
|
+
/* @__PURE__ */ jsx7(
|
|
2601
2708
|
Input,
|
|
2602
2709
|
{
|
|
2603
2710
|
autoFocus: true,
|
|
@@ -2616,17 +2723,17 @@ function CreateAndAttachFooter({
|
|
|
2616
2723
|
style: { fontSize: 16 }
|
|
2617
2724
|
}
|
|
2618
2725
|
),
|
|
2619
|
-
/* @__PURE__ */
|
|
2726
|
+
/* @__PURE__ */ jsx7(
|
|
2620
2727
|
"button",
|
|
2621
2728
|
{
|
|
2622
2729
|
type: "button",
|
|
2623
2730
|
disabled: busy || !name.trim(),
|
|
2624
2731
|
onClick: () => void submit(),
|
|
2625
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",
|
|
2626
|
-
children: busy ? /* @__PURE__ */
|
|
2733
|
+
children: busy ? /* @__PURE__ */ jsx7(SpinnerIcon, { className: "h-3.5 w-3.5 animate-spin" }) : "Create"
|
|
2627
2734
|
}
|
|
2628
2735
|
),
|
|
2629
|
-
/* @__PURE__ */
|
|
2736
|
+
/* @__PURE__ */ jsx7(
|
|
2630
2737
|
"button",
|
|
2631
2738
|
{
|
|
2632
2739
|
type: "button",
|
|
@@ -2637,37 +2744,37 @@ function CreateAndAttachFooter({
|
|
|
2637
2744
|
},
|
|
2638
2745
|
title: "Cancel",
|
|
2639
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",
|
|
2640
|
-
children: /* @__PURE__ */
|
|
2747
|
+
children: /* @__PURE__ */ jsx7(XIcon, { className: "h-4 w-4" })
|
|
2641
2748
|
}
|
|
2642
2749
|
)
|
|
2643
2750
|
] });
|
|
2644
2751
|
}
|
|
2645
2752
|
function ListMessage({ children }) {
|
|
2646
|
-
return /* @__PURE__ */
|
|
2753
|
+
return /* @__PURE__ */ jsx7("div", { className: "flex items-center justify-center gap-2 py-8 text-[13px] text-muted-foreground", children });
|
|
2647
2754
|
}
|
|
2648
2755
|
|
|
2649
2756
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2650
2757
|
import { useState as useState8 } from "react";
|
|
2651
|
-
import { Button, cn as
|
|
2758
|
+
import { Button, cn as cn5, Input as Input2 } from "@ai-matrx/design-system";
|
|
2652
2759
|
|
|
2653
2760
|
// src/react/components/entityDoors.tsx
|
|
2654
|
-
import { cn as
|
|
2655
|
-
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";
|
|
2656
2763
|
function DoorRef(props) {
|
|
2657
2764
|
const { onOpen, ...refProps } = props;
|
|
2658
2765
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2659
2766
|
const store = useAssociationsStore();
|
|
2660
2767
|
const HostRef = entityDoors?.EntityRef;
|
|
2661
|
-
if (HostRef) return /* @__PURE__ */
|
|
2768
|
+
if (HostRef) return /* @__PURE__ */ jsx8(HostRef, { ...refProps });
|
|
2662
2769
|
const name = refProps.name ?? null;
|
|
2663
2770
|
const href = store.registry.tryGetEntityInfo(refProps.token)?.hrefFor?.(refProps.id) ?? null;
|
|
2664
2771
|
if (onOpen) {
|
|
2665
|
-
return /* @__PURE__ */
|
|
2772
|
+
return /* @__PURE__ */ jsx8(
|
|
2666
2773
|
"button",
|
|
2667
2774
|
{
|
|
2668
2775
|
type: "button",
|
|
2669
2776
|
onClick: onOpen,
|
|
2670
|
-
className:
|
|
2777
|
+
className: cn4(
|
|
2671
2778
|
"min-w-0 truncate text-left underline-offset-2 hover:underline",
|
|
2672
2779
|
refProps.className
|
|
2673
2780
|
),
|
|
@@ -2676,30 +2783,30 @@ function DoorRef(props) {
|
|
|
2676
2783
|
);
|
|
2677
2784
|
}
|
|
2678
2785
|
if (href) {
|
|
2679
|
-
return /* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsxs6(
|
|
2680
2787
|
"a",
|
|
2681
2788
|
{
|
|
2682
2789
|
href,
|
|
2683
2790
|
target: refProps.openInNewTab === false ? void 0 : "_blank",
|
|
2684
2791
|
rel: "noopener noreferrer",
|
|
2685
|
-
className:
|
|
2792
|
+
className: cn4(
|
|
2686
2793
|
"inline-flex min-w-0 items-center gap-1 truncate underline-offset-2 hover:underline",
|
|
2687
2794
|
refProps.className
|
|
2688
2795
|
),
|
|
2689
2796
|
children: [
|
|
2690
|
-
/* @__PURE__ */
|
|
2691
|
-
/* @__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" })
|
|
2692
2799
|
]
|
|
2693
2800
|
}
|
|
2694
2801
|
);
|
|
2695
2802
|
}
|
|
2696
|
-
return /* @__PURE__ */
|
|
2803
|
+
return /* @__PURE__ */ jsx8("span", { className: cn4("min-w-0 truncate", refProps.className), children: name });
|
|
2697
2804
|
}
|
|
2698
2805
|
function UnresolvedRef({ token, id }) {
|
|
2699
2806
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2700
2807
|
const HostUnresolved = entityDoors?.UnresolvedRef;
|
|
2701
|
-
if (HostUnresolved) return /* @__PURE__ */
|
|
2702
|
-
return /* @__PURE__ */
|
|
2808
|
+
if (HostUnresolved) return /* @__PURE__ */ jsx8(HostUnresolved, { token, id });
|
|
2809
|
+
return /* @__PURE__ */ jsx8(
|
|
2703
2810
|
"span",
|
|
2704
2811
|
{
|
|
2705
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",
|
|
@@ -2712,11 +2819,11 @@ function DoorControlsSlot(props) {
|
|
|
2712
2819
|
const { entityDoors } = useAssociationsUiPorts();
|
|
2713
2820
|
const store = useAssociationsStore();
|
|
2714
2821
|
const HostControls = entityDoors?.DoorControls;
|
|
2715
|
-
if (HostControls) return /* @__PURE__ */
|
|
2822
|
+
if (HostControls) return /* @__PURE__ */ jsx8(HostControls, { ...props });
|
|
2716
2823
|
const href = store.registry.tryGetEntityInfo(props.token)?.hrefFor?.(props.id) ?? null;
|
|
2717
2824
|
if (!href) return null;
|
|
2718
2825
|
const label = props.name ? `Open ${props.name}` : `Open this ${props.token}`;
|
|
2719
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ jsx8(
|
|
2720
2827
|
"a",
|
|
2721
2828
|
{
|
|
2722
2829
|
href,
|
|
@@ -2724,17 +2831,17 @@ function DoorControlsSlot(props) {
|
|
|
2724
2831
|
rel: "noopener noreferrer",
|
|
2725
2832
|
"aria-label": label,
|
|
2726
2833
|
title: label,
|
|
2727
|
-
className:
|
|
2834
|
+
className: cn4(
|
|
2728
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",
|
|
2729
2836
|
props.className
|
|
2730
2837
|
),
|
|
2731
|
-
children: /* @__PURE__ */
|
|
2838
|
+
children: /* @__PURE__ */ jsx8(ExternalLinkIcon, { className: "h-3 w-3" })
|
|
2732
2839
|
}
|
|
2733
2840
|
);
|
|
2734
2841
|
}
|
|
2735
2842
|
|
|
2736
2843
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
2737
|
-
import { jsx as
|
|
2844
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2738
2845
|
function attachedKey(token, id) {
|
|
2739
2846
|
return `${token}:${id}`;
|
|
2740
2847
|
}
|
|
@@ -2743,7 +2850,6 @@ function UniversalAssociationPicker(props) {
|
|
|
2743
2850
|
attachedKeys,
|
|
2744
2851
|
onAttach,
|
|
2745
2852
|
onDetach,
|
|
2746
|
-
ownerId,
|
|
2747
2853
|
orgId,
|
|
2748
2854
|
emptyQueryMode = "recents",
|
|
2749
2855
|
className
|
|
@@ -2757,10 +2863,9 @@ function UniversalAssociationPicker(props) {
|
|
|
2757
2863
|
const [busyKey, setBusyKey] = useState8(null);
|
|
2758
2864
|
const [overrideOpen, setOverrideOpen] = useState8(false);
|
|
2759
2865
|
const [overrideMount, setOverrideMount] = useState8(0);
|
|
2760
|
-
const { results, loading, source } = useUniversalEntitySearch({
|
|
2866
|
+
const { results, loading, source, failures, error } = useUniversalEntitySearch({
|
|
2761
2867
|
query,
|
|
2762
2868
|
tokens,
|
|
2763
|
-
ownerId: ownerId ?? null,
|
|
2764
2869
|
enabled: browseToken === null,
|
|
2765
2870
|
emptyQueryMode
|
|
2766
2871
|
});
|
|
@@ -2791,10 +2896,10 @@ function UniversalAssociationPicker(props) {
|
|
|
2791
2896
|
groups.set(r.token, list);
|
|
2792
2897
|
}
|
|
2793
2898
|
const BrowseOverride = browseToken ? pickerOverrides?.[browseToken] : void 0;
|
|
2794
|
-
return /* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__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(
|
|
2798
2903
|
Input2,
|
|
2799
2904
|
{
|
|
2800
2905
|
value: query,
|
|
@@ -2807,9 +2912,9 @@ function UniversalAssociationPicker(props) {
|
|
|
2807
2912
|
style: { fontSize: 16 }
|
|
2808
2913
|
}
|
|
2809
2914
|
),
|
|
2810
|
-
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" })
|
|
2811
2916
|
] }),
|
|
2812
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsx9(
|
|
2813
2918
|
"div",
|
|
2814
2919
|
{
|
|
2815
2920
|
role: "group",
|
|
@@ -2819,18 +2924,18 @@ function UniversalAssociationPicker(props) {
|
|
|
2819
2924
|
const info = store.registry.getEntityInfo(t);
|
|
2820
2925
|
const ChipIcon = info.Icon ?? DefaultEntityIcon;
|
|
2821
2926
|
const active = browseToken === t;
|
|
2822
|
-
return /* @__PURE__ */
|
|
2927
|
+
return /* @__PURE__ */ jsxs7(
|
|
2823
2928
|
"button",
|
|
2824
2929
|
{
|
|
2825
2930
|
type: "button",
|
|
2826
2931
|
"aria-pressed": active,
|
|
2827
2932
|
onClick: () => selectToken(active ? null : t),
|
|
2828
|
-
className:
|
|
2933
|
+
className: cn5(
|
|
2829
2934
|
"inline-flex shrink-0 items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
2830
2935
|
active ? "border-primary/50 bg-primary/10 text-foreground" : "border-border text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
2831
2936
|
),
|
|
2832
2937
|
children: [
|
|
2833
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx9(ChipIcon, { className: "h-3 w-3" }),
|
|
2834
2939
|
info.labelPlural
|
|
2835
2940
|
]
|
|
2836
2941
|
},
|
|
@@ -2843,17 +2948,17 @@ function UniversalAssociationPicker(props) {
|
|
|
2843
2948
|
// The token's canonical host picker (e.g. the stored-files browser)
|
|
2844
2949
|
// owns per-token browsing when registered — never a plain list twin.
|
|
2845
2950
|
// It opens in its own window; this body says where it went.
|
|
2846
|
-
/* @__PURE__ */
|
|
2951
|
+
/* @__PURE__ */ jsxs7(
|
|
2847
2952
|
"div",
|
|
2848
2953
|
{
|
|
2849
2954
|
role: "region",
|
|
2850
2955
|
"aria-label": `${store.registry.getEntityInfo(browseToken).labelPlural} window`,
|
|
2851
2956
|
className: "flex flex-1 flex-col items-center justify-center gap-3 px-4 py-8 text-center",
|
|
2852
2957
|
children: [
|
|
2853
|
-
/* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
/* @__PURE__ */
|
|
2856
|
-
/* @__PURE__ */
|
|
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(
|
|
2857
2962
|
Button,
|
|
2858
2963
|
{
|
|
2859
2964
|
type: "button",
|
|
@@ -2864,12 +2969,12 @@ function UniversalAssociationPicker(props) {
|
|
|
2864
2969
|
setOverrideMount((n) => n + 1);
|
|
2865
2970
|
},
|
|
2866
2971
|
children: [
|
|
2867
|
-
/* @__PURE__ */
|
|
2972
|
+
/* @__PURE__ */ jsx9(MaximizeIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
2868
2973
|
overrideOpen ? "Bring window to front" : "Reopen window"
|
|
2869
2974
|
]
|
|
2870
2975
|
}
|
|
2871
2976
|
),
|
|
2872
|
-
/* @__PURE__ */
|
|
2977
|
+
/* @__PURE__ */ jsx9(
|
|
2873
2978
|
Button,
|
|
2874
2979
|
{
|
|
2875
2980
|
type: "button",
|
|
@@ -2880,7 +2985,7 @@ function UniversalAssociationPicker(props) {
|
|
|
2880
2985
|
}
|
|
2881
2986
|
)
|
|
2882
2987
|
] }),
|
|
2883
|
-
overrideOpen && /* @__PURE__ */
|
|
2988
|
+
overrideOpen && /* @__PURE__ */ jsx9(
|
|
2884
2989
|
BrowseOverride,
|
|
2885
2990
|
{
|
|
2886
2991
|
open: true,
|
|
@@ -2900,7 +3005,7 @@ function UniversalAssociationPicker(props) {
|
|
|
2900
3005
|
]
|
|
2901
3006
|
}
|
|
2902
3007
|
)
|
|
2903
|
-
) : browseToken ? /* @__PURE__ */
|
|
3008
|
+
) : browseToken ? /* @__PURE__ */ jsx9("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ jsx9(
|
|
2904
3009
|
AssociationCandidateBody,
|
|
2905
3010
|
{
|
|
2906
3011
|
token: browseToken,
|
|
@@ -2913,62 +3018,79 @@ function UniversalAssociationPicker(props) {
|
|
|
2913
3018
|
onAttach: (id, title) => onAttach(browseToken, id, title),
|
|
2914
3019
|
onDetach: (id) => onDetach(browseToken, id)
|
|
2915
3020
|
}
|
|
2916
|
-
) }) : /* @__PURE__ */
|
|
3021
|
+
) }) : /* @__PURE__ */ jsx9(
|
|
2917
3022
|
"div",
|
|
2918
3023
|
{
|
|
2919
3024
|
role: "region",
|
|
2920
3025
|
"aria-label": "Association search results",
|
|
2921
3026
|
className: "-mx-1 min-h-24 flex-1 overflow-y-auto overscroll-contain px-1",
|
|
2922
|
-
children:
|
|
2923
|
-
|
|
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" }),
|
|
2924
3046
|
[...groups.entries()].map(([token, items]) => {
|
|
2925
3047
|
const info = store.registry.getEntityInfo(token);
|
|
2926
3048
|
const GroupIcon = info.Icon ?? DefaultEntityIcon;
|
|
2927
|
-
return /* @__PURE__ */
|
|
2928
|
-
/* @__PURE__ */
|
|
2929
|
-
/* @__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" }),
|
|
2930
3052
|
info.labelPlural
|
|
2931
3053
|
] }),
|
|
2932
|
-
/* @__PURE__ */
|
|
3054
|
+
/* @__PURE__ */ jsx9("ul", { className: "space-y-0.5", children: items.map((c) => {
|
|
2933
3055
|
const key = attachedKey(c.token, c.id);
|
|
2934
3056
|
const attached = attachedKeys.has(key);
|
|
2935
3057
|
const busy = busyKey === key;
|
|
2936
|
-
return /* @__PURE__ */
|
|
3058
|
+
return /* @__PURE__ */ jsxs7(
|
|
2937
3059
|
"li",
|
|
2938
3060
|
{
|
|
2939
|
-
className:
|
|
3061
|
+
className: cn5(
|
|
2940
3062
|
"group/entity-ref group flex items-center gap-1 rounded-md pr-1.5 transition-colors",
|
|
2941
3063
|
"hover:bg-accent",
|
|
2942
3064
|
attached && "bg-accent/40"
|
|
2943
3065
|
),
|
|
2944
3066
|
children: [
|
|
2945
|
-
/* @__PURE__ */
|
|
3067
|
+
/* @__PURE__ */ jsxs7(
|
|
2946
3068
|
"button",
|
|
2947
3069
|
{
|
|
2948
3070
|
type: "button",
|
|
2949
3071
|
disabled: busy,
|
|
2950
3072
|
onClick: () => toggle(c),
|
|
2951
3073
|
title: attached ? `Detach "${c.title}"` : `Attach "${c.title}"`,
|
|
2952
|
-
className:
|
|
3074
|
+
className: cn5(
|
|
2953
3075
|
"flex min-w-0 flex-1 items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm",
|
|
2954
3076
|
"disabled:opacity-50"
|
|
2955
3077
|
),
|
|
2956
3078
|
children: [
|
|
2957
|
-
/* @__PURE__ */
|
|
2958
|
-
/* @__PURE__ */
|
|
3079
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1 truncate text-foreground", children: c.title }),
|
|
3080
|
+
/* @__PURE__ */ jsx9(
|
|
2959
3081
|
"span",
|
|
2960
3082
|
{
|
|
2961
|
-
className:
|
|
3083
|
+
className: cn5(
|
|
2962
3084
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
2963
3085
|
attached ? "bg-primary text-primary-foreground" : "border border-border text-muted-foreground group-hover:border-primary/60"
|
|
2964
3086
|
),
|
|
2965
|
-
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" })
|
|
2966
3088
|
}
|
|
2967
3089
|
)
|
|
2968
3090
|
]
|
|
2969
3091
|
}
|
|
2970
3092
|
),
|
|
2971
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsx9(
|
|
2972
3094
|
DoorControlsSlot,
|
|
2973
3095
|
{
|
|
2974
3096
|
token: c.token,
|
|
@@ -2991,8 +3113,8 @@ function UniversalAssociationPicker(props) {
|
|
|
2991
3113
|
|
|
2992
3114
|
// src/react/components/AttachedItemsSheet.tsx
|
|
2993
3115
|
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2994
|
-
import { cn as
|
|
2995
|
-
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";
|
|
2996
3118
|
function metadataIsPinned(metadata) {
|
|
2997
3119
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
2998
3120
|
}
|
|
@@ -3003,9 +3125,9 @@ function AttachedItemsSheet(props) {
|
|
|
3003
3125
|
const title = info.labelPlural;
|
|
3004
3126
|
const containerName = props.container?.label ?? props.containerLabel;
|
|
3005
3127
|
const filing = props.container?.direction === "outgoing";
|
|
3006
|
-
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: [
|
|
3007
3129
|
filing ? "What this is filed under:" : "Attached to",
|
|
3008
|
-
/* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsx10(
|
|
3009
3131
|
DoorRef,
|
|
3010
3132
|
{
|
|
3011
3133
|
token: props.container.type,
|
|
@@ -3016,16 +3138,16 @@ function AttachedItemsSheet(props) {
|
|
|
3016
3138
|
)
|
|
3017
3139
|
] }) : props.containerLabel ? `Attached to ${props.containerLabel}` : "Attached items";
|
|
3018
3140
|
if (!props.open) return null;
|
|
3019
|
-
return /* @__PURE__ */
|
|
3141
|
+
return /* @__PURE__ */ jsx10(
|
|
3020
3142
|
AssociationWindow,
|
|
3021
3143
|
{
|
|
3022
3144
|
open: props.open,
|
|
3023
3145
|
onClose: () => props.onOpenChange(false),
|
|
3024
3146
|
scopeId: `attached:${props.token}`,
|
|
3025
3147
|
title,
|
|
3026
|
-
icon: /* @__PURE__ */
|
|
3148
|
+
icon: /* @__PURE__ */ jsx10(Icon, { className: "size-3.5 text-primary" }),
|
|
3027
3149
|
subtitle,
|
|
3028
|
-
children: /* @__PURE__ */
|
|
3150
|
+
children: /* @__PURE__ */ jsx10(
|
|
3029
3151
|
AttachedItemsBody,
|
|
3030
3152
|
{
|
|
3031
3153
|
token: props.token,
|
|
@@ -3114,31 +3236,31 @@ function AttachedItemsBody({
|
|
|
3114
3236
|
setBusyId(null);
|
|
3115
3237
|
}
|
|
3116
3238
|
};
|
|
3117
|
-
return /* @__PURE__ */
|
|
3118
|
-
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: [
|
|
3119
3241
|
"Showing names recorded at attach time \u2014 they may be out of date.",
|
|
3120
3242
|
" ",
|
|
3121
3243
|
titleError
|
|
3122
3244
|
] }) : null,
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__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" }),
|
|
3125
3247
|
"Loading\u2026"
|
|
3126
|
-
] }) : /* @__PURE__ */
|
|
3248
|
+
] }) : /* @__PURE__ */ jsx10("ul", { className: "space-y-0.5", children: links.map((link) => {
|
|
3127
3249
|
const resolved = titles.get(link.resourceId);
|
|
3128
3250
|
const missing = !titles.has(link.resourceId);
|
|
3129
3251
|
const name = resolved ?? link.label ?? (missing ? null : "Untitled");
|
|
3130
3252
|
const busy = busyId === link.resourceId;
|
|
3131
3253
|
const pinned = metadataIsPinned(link.metadata);
|
|
3132
|
-
return /* @__PURE__ */
|
|
3254
|
+
return /* @__PURE__ */ jsxs8(
|
|
3133
3255
|
"li",
|
|
3134
3256
|
{
|
|
3135
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",
|
|
3136
3258
|
children: [
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__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 ? (
|
|
3139
3261
|
// The X beside the row stays the one-click detach.
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
) : /* @__PURE__ */
|
|
3262
|
+
/* @__PURE__ */ jsx10(UnresolvedRef, { token, id: link.resourceId })
|
|
3263
|
+
) : /* @__PURE__ */ jsx10(
|
|
3142
3264
|
DoorRef,
|
|
3143
3265
|
{
|
|
3144
3266
|
token,
|
|
@@ -3148,7 +3270,7 @@ function AttachedItemsBody({
|
|
|
3148
3270
|
className: "text-foreground"
|
|
3149
3271
|
}
|
|
3150
3272
|
) }),
|
|
3151
|
-
onSetPinned ? /* @__PURE__ */
|
|
3273
|
+
onSetPinned ? /* @__PURE__ */ jsx10(
|
|
3152
3274
|
"button",
|
|
3153
3275
|
{
|
|
3154
3276
|
type: "button",
|
|
@@ -3156,14 +3278,14 @@ function AttachedItemsBody({
|
|
|
3156
3278
|
onClick: () => void setPinned(link, !pinned),
|
|
3157
3279
|
title: pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3158
3280
|
"aria-label": pinned ? "Unpin" : "Pin",
|
|
3159
|
-
className:
|
|
3281
|
+
className: cn6(
|
|
3160
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",
|
|
3161
3283
|
pinned ? "text-primary" : "text-muted-foreground"
|
|
3162
3284
|
),
|
|
3163
|
-
children: /* @__PURE__ */
|
|
3285
|
+
children: /* @__PURE__ */ jsx10(
|
|
3164
3286
|
PinIcon,
|
|
3165
3287
|
{
|
|
3166
|
-
className:
|
|
3288
|
+
className: cn6(
|
|
3167
3289
|
"h-3.5 w-3.5",
|
|
3168
3290
|
pinned && "fill-primary/20"
|
|
3169
3291
|
)
|
|
@@ -3171,18 +3293,18 @@ function AttachedItemsBody({
|
|
|
3171
3293
|
)
|
|
3172
3294
|
}
|
|
3173
3295
|
) : null,
|
|
3174
|
-
/* @__PURE__ */
|
|
3296
|
+
/* @__PURE__ */ jsx10(
|
|
3175
3297
|
"button",
|
|
3176
3298
|
{
|
|
3177
3299
|
type: "button",
|
|
3178
3300
|
disabled: busy,
|
|
3179
3301
|
onClick: () => void detach(link),
|
|
3180
3302
|
title: "Detach",
|
|
3181
|
-
className:
|
|
3303
|
+
className: cn6(
|
|
3182
3304
|
"flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors",
|
|
3183
3305
|
"hover:bg-destructive/10 hover:text-destructive disabled:opacity-50"
|
|
3184
3306
|
),
|
|
3185
|
-
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" })
|
|
3186
3308
|
}
|
|
3187
3309
|
)
|
|
3188
3310
|
]
|
|
@@ -3190,14 +3312,14 @@ function AttachedItemsBody({
|
|
|
3190
3312
|
link.edgeId
|
|
3191
3313
|
);
|
|
3192
3314
|
}) }) }),
|
|
3193
|
-
onAdd ? /* @__PURE__ */
|
|
3315
|
+
onAdd ? /* @__PURE__ */ jsxs8(
|
|
3194
3316
|
"button",
|
|
3195
3317
|
{
|
|
3196
3318
|
type: "button",
|
|
3197
3319
|
onClick: onAdd,
|
|
3198
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",
|
|
3199
3321
|
children: [
|
|
3200
|
-
/* @__PURE__ */
|
|
3322
|
+
/* @__PURE__ */ jsx10(PlusIcon, { className: "h-4 w-4" }),
|
|
3201
3323
|
"Attach ",
|
|
3202
3324
|
info.labelPlural.toLowerCase()
|
|
3203
3325
|
]
|
|
@@ -3208,7 +3330,7 @@ function AttachedItemsBody({
|
|
|
3208
3330
|
|
|
3209
3331
|
// src/react/components/AssociationCard.tsx
|
|
3210
3332
|
import { useState as useState10 } from "react";
|
|
3211
|
-
import { cn as
|
|
3333
|
+
import { cn as cn7 } from "@ai-matrx/design-system";
|
|
3212
3334
|
|
|
3213
3335
|
// src/react/contentRoles.ts
|
|
3214
3336
|
var CONTENT_ROLES = [
|
|
@@ -3258,7 +3380,7 @@ function getContentRoleMeta(role) {
|
|
|
3258
3380
|
}
|
|
3259
3381
|
|
|
3260
3382
|
// src/react/components/AssociationCard.tsx
|
|
3261
|
-
import { Fragment as Fragment3, jsx as
|
|
3383
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3262
3384
|
function AssociationCard({
|
|
3263
3385
|
token,
|
|
3264
3386
|
container: containerProp,
|
|
@@ -3294,58 +3416,58 @@ function AssociationCard({
|
|
|
3294
3416
|
const filing = container.direction === "outgoing";
|
|
3295
3417
|
const canAttach = info.canListCandidates && (!filing || isAssociationTargetType(token));
|
|
3296
3418
|
const canDrillIn = count > 0;
|
|
3297
|
-
return /* @__PURE__ */
|
|
3298
|
-
/* @__PURE__ */
|
|
3419
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
3420
|
+
/* @__PURE__ */ jsxs9(
|
|
3299
3421
|
"div",
|
|
3300
3422
|
{
|
|
3301
|
-
className:
|
|
3423
|
+
className: cn7(
|
|
3302
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",
|
|
3303
3425
|
className
|
|
3304
3426
|
),
|
|
3305
3427
|
children: [
|
|
3306
|
-
/* @__PURE__ */
|
|
3428
|
+
/* @__PURE__ */ jsx11(
|
|
3307
3429
|
"span",
|
|
3308
3430
|
{
|
|
3309
|
-
className:
|
|
3431
|
+
className: cn7(
|
|
3310
3432
|
"absolute inset-x-0 top-0 h-0.5 opacity-60",
|
|
3311
3433
|
role.accentBar
|
|
3312
3434
|
)
|
|
3313
3435
|
}
|
|
3314
3436
|
),
|
|
3315
|
-
/* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsxs9(
|
|
3316
3438
|
"button",
|
|
3317
3439
|
{
|
|
3318
3440
|
type: "button",
|
|
3319
3441
|
disabled: !canDrillIn,
|
|
3320
3442
|
onClick: () => setListOpen(true),
|
|
3321
3443
|
title: canDrillIn ? `View the ${info.labelPlural.toLowerCase()} attached to ${container.label ?? "this"}` : void 0,
|
|
3322
|
-
className:
|
|
3444
|
+
className: cn7(
|
|
3323
3445
|
"flex min-w-0 flex-1 items-center gap-3 px-3 py-2.5 text-left",
|
|
3324
3446
|
canDrillIn ? "cursor-pointer" : "cursor-default"
|
|
3325
3447
|
),
|
|
3326
3448
|
children: [
|
|
3327
|
-
/* @__PURE__ */
|
|
3449
|
+
/* @__PURE__ */ jsx11(
|
|
3328
3450
|
"span",
|
|
3329
3451
|
{
|
|
3330
|
-
className:
|
|
3452
|
+
className: cn7(
|
|
3331
3453
|
"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",
|
|
3332
3454
|
role.accentBg,
|
|
3333
3455
|
role.accentText
|
|
3334
3456
|
),
|
|
3335
|
-
children: /* @__PURE__ */
|
|
3457
|
+
children: /* @__PURE__ */ jsx11(Icon, { className: "h-4 w-4" })
|
|
3336
3458
|
}
|
|
3337
3459
|
),
|
|
3338
|
-
/* @__PURE__ */
|
|
3339
|
-
/* @__PURE__ */
|
|
3340
|
-
/* @__PURE__ */
|
|
3341
|
-
/* @__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" }),
|
|
3342
3464
|
"Loading\u2026"
|
|
3343
3465
|
] }) : `${count} ${container.direction === "outgoing" ? "filed under" : "attached"}` })
|
|
3344
3466
|
] })
|
|
3345
3467
|
]
|
|
3346
3468
|
}
|
|
3347
3469
|
),
|
|
3348
|
-
canAttach && /* @__PURE__ */
|
|
3470
|
+
canAttach && /* @__PURE__ */ jsx11(
|
|
3349
3471
|
"button",
|
|
3350
3472
|
{
|
|
3351
3473
|
type: "button",
|
|
@@ -3353,13 +3475,13 @@ function AssociationCard({
|
|
|
3353
3475
|
"aria-label": `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3354
3476
|
title: `Attach ${info.labelPlural.toLowerCase()}`,
|
|
3355
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",
|
|
3356
|
-
children: /* @__PURE__ */
|
|
3478
|
+
children: /* @__PURE__ */ jsx11(PlusIcon, { className: "h-4 w-4" })
|
|
3357
3479
|
}
|
|
3358
3480
|
)
|
|
3359
3481
|
]
|
|
3360
3482
|
}
|
|
3361
3483
|
),
|
|
3362
|
-
listOpen && /* @__PURE__ */
|
|
3484
|
+
listOpen && /* @__PURE__ */ jsx11(
|
|
3363
3485
|
AttachedItemsSheet,
|
|
3364
3486
|
{
|
|
3365
3487
|
open: listOpen,
|
|
@@ -3378,7 +3500,7 @@ function AssociationCard({
|
|
|
3378
3500
|
onSetPinned: (resourceId, pinned, role2) => setPinned(token, resourceId, pinned, role2 ?? void 0)
|
|
3379
3501
|
}
|
|
3380
3502
|
),
|
|
3381
|
-
canAttach && /* @__PURE__ */
|
|
3503
|
+
canAttach && /* @__PURE__ */ jsx11(
|
|
3382
3504
|
AssociationPicker,
|
|
3383
3505
|
{
|
|
3384
3506
|
open,
|
|
@@ -3396,8 +3518,8 @@ function AssociationCard({
|
|
|
3396
3518
|
}
|
|
3397
3519
|
|
|
3398
3520
|
// src/react/components/AssociationCardGrid.tsx
|
|
3399
|
-
import { cn as
|
|
3400
|
-
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";
|
|
3401
3523
|
function AssociationCardGrid({
|
|
3402
3524
|
tokens,
|
|
3403
3525
|
excludeTokens,
|
|
@@ -3423,42 +3545,42 @@ function AssociationCardGrid({
|
|
|
3423
3545
|
const role = store.registry.getEntityInfo(token).contentRole;
|
|
3424
3546
|
return !role || !roleIds.has(role);
|
|
3425
3547
|
}) : [];
|
|
3426
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn8("space-y-5", className), children: [
|
|
3427
3549
|
CONTENT_ROLES.map((role) => {
|
|
3428
3550
|
const inRole = list.filter(
|
|
3429
3551
|
(token) => store.registry.getEntityInfo(token).contentRole === role.id
|
|
3430
3552
|
);
|
|
3431
3553
|
if (inRole.length === 0) return null;
|
|
3432
|
-
return /* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
/* @__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(
|
|
3436
3558
|
"span",
|
|
3437
3559
|
{
|
|
3438
|
-
className:
|
|
3560
|
+
className: cn8("h-2.5 w-2.5 rounded-full", role.accentBar)
|
|
3439
3561
|
}
|
|
3440
3562
|
),
|
|
3441
|
-
/* @__PURE__ */
|
|
3563
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: role.title })
|
|
3442
3564
|
] }),
|
|
3443
|
-
/* @__PURE__ */
|
|
3565
|
+
/* @__PURE__ */ jsx12("p", { className: "hidden text-xs text-muted-foreground sm:block", children: role.tagline })
|
|
3444
3566
|
] }),
|
|
3445
|
-
/* @__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)) })
|
|
3446
3568
|
] }, role.id);
|
|
3447
3569
|
}),
|
|
3448
|
-
roleless.length > 0 && /* @__PURE__ */
|
|
3449
|
-
/* @__PURE__ */
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
/* @__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." })
|
|
3452
3574
|
] }),
|
|
3453
|
-
/* @__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)) })
|
|
3454
3576
|
] })
|
|
3455
3577
|
] });
|
|
3456
3578
|
}
|
|
3457
3579
|
|
|
3458
3580
|
// src/react/components/AssociationList.tsx
|
|
3459
3581
|
import { useState as useState11 } from "react";
|
|
3460
|
-
import { cn as
|
|
3461
|
-
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";
|
|
3462
3584
|
function metadataIsPinned2(metadata) {
|
|
3463
3585
|
return metadata !== null && typeof metadata === "object" && !Array.isArray(metadata) && Reflect.get(metadata, "pinned") === true;
|
|
3464
3586
|
}
|
|
@@ -3564,40 +3686,40 @@ function AssociationList(props) {
|
|
|
3564
3686
|
const grouped = groupRows(store, visibleRows);
|
|
3565
3687
|
const isLoading = adapter.status === "loading" || adapter.status === "idle";
|
|
3566
3688
|
const attachableTokens = tokenFilter ?? store.registry.listableTokens();
|
|
3567
|
-
return /* @__PURE__ */
|
|
3568
|
-
/* @__PURE__ */
|
|
3569
|
-
/* @__PURE__ */
|
|
3570
|
-
/* @__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" }),
|
|
3571
3693
|
"Resources",
|
|
3572
|
-
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 })
|
|
3573
3695
|
] }),
|
|
3574
|
-
/* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5", children: [
|
|
3697
|
+
/* @__PURE__ */ jsxs11(
|
|
3576
3698
|
"button",
|
|
3577
3699
|
{
|
|
3578
3700
|
type: "button",
|
|
3579
3701
|
onClick: () => setShowUniversal((v) => !v),
|
|
3580
|
-
className:
|
|
3702
|
+
className: cn9(
|
|
3581
3703
|
"inline-flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] transition-colors",
|
|
3582
3704
|
showUniversal ? "bg-accent text-foreground" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
3583
3705
|
),
|
|
3584
3706
|
children: [
|
|
3585
|
-
/* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ jsx13(PlusIcon, { className: "h-3 w-3" }),
|
|
3586
3708
|
"Add"
|
|
3587
3709
|
]
|
|
3588
3710
|
}
|
|
3589
3711
|
),
|
|
3590
|
-
/* @__PURE__ */
|
|
3712
|
+
/* @__PURE__ */ jsx13(
|
|
3591
3713
|
"button",
|
|
3592
3714
|
{
|
|
3593
3715
|
type: "button",
|
|
3594
3716
|
onClick: () => void adapter.reload(),
|
|
3595
3717
|
title: "Refresh",
|
|
3596
3718
|
className: "text-muted-foreground/60 transition-colors hover:text-foreground",
|
|
3597
|
-
children: /* @__PURE__ */
|
|
3719
|
+
children: /* @__PURE__ */ jsx13(
|
|
3598
3720
|
RefreshIcon,
|
|
3599
3721
|
{
|
|
3600
|
-
className:
|
|
3722
|
+
className: cn9(
|
|
3601
3723
|
"h-3 w-3",
|
|
3602
3724
|
adapter.status === "loading" && "animate-spin"
|
|
3603
3725
|
)
|
|
@@ -3607,7 +3729,7 @@ function AssociationList(props) {
|
|
|
3607
3729
|
)
|
|
3608
3730
|
] })
|
|
3609
3731
|
] }),
|
|
3610
|
-
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(
|
|
3611
3733
|
UniversalAssociationPicker,
|
|
3612
3734
|
{
|
|
3613
3735
|
tokens: attachableTokens,
|
|
@@ -3617,9 +3739,9 @@ function AssociationList(props) {
|
|
|
3617
3739
|
onDetach: (token, id) => adapter.detach(token, id)
|
|
3618
3740
|
}
|
|
3619
3741
|
) }),
|
|
3620
|
-
adapter.status === "error" && /* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__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(
|
|
3623
3745
|
"button",
|
|
3624
3746
|
{
|
|
3625
3747
|
type: "button",
|
|
@@ -3629,29 +3751,29 @@ function AssociationList(props) {
|
|
|
3629
3751
|
}
|
|
3630
3752
|
)
|
|
3631
3753
|
] }),
|
|
3632
|
-
adapter.status !== "error" && isLoading && visibleRows.length === 0 && /* @__PURE__ */
|
|
3633
|
-
/* @__PURE__ */
|
|
3634
|
-
/* @__PURE__ */
|
|
3635
|
-
/* @__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" })
|
|
3636
3758
|
] }),
|
|
3637
|
-
adapter.status === "ready" && visibleRows.length === 0 && /* @__PURE__ */
|
|
3638
|
-
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 }) => {
|
|
3639
3761
|
const roleMeta = getContentRoleMeta(role);
|
|
3640
|
-
return /* @__PURE__ */
|
|
3641
|
-
variant === "full" && /* @__PURE__ */
|
|
3642
|
-
/* @__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(
|
|
3643
3765
|
"span",
|
|
3644
3766
|
{
|
|
3645
|
-
className:
|
|
3767
|
+
className: cn9(
|
|
3646
3768
|
"h-3 w-0.5 rounded-full",
|
|
3647
3769
|
roleMeta.accentBar
|
|
3648
3770
|
)
|
|
3649
3771
|
}
|
|
3650
3772
|
),
|
|
3651
|
-
/* @__PURE__ */
|
|
3773
|
+
/* @__PURE__ */ jsx13(
|
|
3652
3774
|
"p",
|
|
3653
3775
|
{
|
|
3654
|
-
className:
|
|
3776
|
+
className: cn9(
|
|
3655
3777
|
"text-[10px] font-semibold uppercase tracking-wider",
|
|
3656
3778
|
roleMeta.accentText
|
|
3657
3779
|
),
|
|
@@ -3661,28 +3783,28 @@ function AssociationList(props) {
|
|
|
3661
3783
|
] }),
|
|
3662
3784
|
tokenGroups.map(({ info, token, rows: tokenRows }) => {
|
|
3663
3785
|
const TokenIcon = info?.Icon ?? null;
|
|
3664
|
-
return /* @__PURE__ */
|
|
3665
|
-
/* @__PURE__ */
|
|
3666
|
-
/* @__PURE__ */
|
|
3667
|
-
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,
|
|
3668
3790
|
info?.labelPlural ?? titleize(token),
|
|
3669
|
-
/* @__PURE__ */
|
|
3791
|
+
/* @__PURE__ */ jsx13("span", { className: "text-muted-foreground/50", children: tokenRows.length })
|
|
3670
3792
|
] }),
|
|
3671
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
3672
3794
|
props.renderSectionActions && info ? props.renderSectionActions(info.token) : null,
|
|
3673
|
-
info?.canListCandidates && /* @__PURE__ */
|
|
3795
|
+
info?.canListCandidates && /* @__PURE__ */ jsx13(
|
|
3674
3796
|
"button",
|
|
3675
3797
|
{
|
|
3676
3798
|
type: "button",
|
|
3677
3799
|
onClick: () => setPickerToken(info.token),
|
|
3678
3800
|
title: `Add ${info.labelPlural}`,
|
|
3679
3801
|
className: "rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-accent hover:text-foreground",
|
|
3680
|
-
children: /* @__PURE__ */
|
|
3802
|
+
children: /* @__PURE__ */ jsx13(PlusIcon, { className: "h-3 w-3" })
|
|
3681
3803
|
}
|
|
3682
3804
|
)
|
|
3683
3805
|
] })
|
|
3684
3806
|
] }),
|
|
3685
|
-
/* @__PURE__ */
|
|
3807
|
+
/* @__PURE__ */ jsx13("ul", { className: "space-y-0.5", children: tokenRows.map((row) => {
|
|
3686
3808
|
const busy = removingKeys.has(row.key);
|
|
3687
3809
|
const custom = props.renderRow?.(row, {
|
|
3688
3810
|
title: titleFor({
|
|
@@ -3695,12 +3817,12 @@ function AssociationList(props) {
|
|
|
3695
3817
|
onOpen: () => openRow(row)
|
|
3696
3818
|
});
|
|
3697
3819
|
if (custom != null) {
|
|
3698
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ jsx13("li", { children: custom }, row.key);
|
|
3699
3821
|
}
|
|
3700
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsxs11(
|
|
3701
3823
|
"div",
|
|
3702
3824
|
{
|
|
3703
|
-
className:
|
|
3825
|
+
className: cn9(
|
|
3704
3826
|
"group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-accent",
|
|
3705
3827
|
busy && "opacity-50"
|
|
3706
3828
|
),
|
|
@@ -3709,7 +3831,7 @@ function AssociationList(props) {
|
|
|
3709
3831
|
token: row.token,
|
|
3710
3832
|
id: row.resourceId,
|
|
3711
3833
|
label: row.label
|
|
3712
|
-
}) ? /* @__PURE__ */
|
|
3834
|
+
}) ? /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx13(UnresolvedRef, { token: row.token, id: row.resourceId }) }) : /* @__PURE__ */ jsx13(
|
|
3713
3835
|
DoorRef,
|
|
3714
3836
|
{
|
|
3715
3837
|
token: row.token,
|
|
@@ -3725,9 +3847,9 @@ function AssociationList(props) {
|
|
|
3725
3847
|
className: "min-w-0 flex-1 text-foreground"
|
|
3726
3848
|
}
|
|
3727
3849
|
),
|
|
3728
|
-
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: [
|
|
3729
3851
|
"via",
|
|
3730
|
-
row.originRefs.map((origin) => /* @__PURE__ */
|
|
3852
|
+
row.originRefs.map((origin) => /* @__PURE__ */ jsx13(
|
|
3731
3853
|
DoorRef,
|
|
3732
3854
|
{
|
|
3733
3855
|
token: origin.token,
|
|
@@ -3739,8 +3861,8 @@ function AssociationList(props) {
|
|
|
3739
3861
|
},
|
|
3740
3862
|
`${origin.token}:${origin.id}`
|
|
3741
3863
|
))
|
|
3742
|
-
] }) : row.originNote ? /* @__PURE__ */
|
|
3743
|
-
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(
|
|
3744
3866
|
"button",
|
|
3745
3867
|
{
|
|
3746
3868
|
type: "button",
|
|
@@ -3748,14 +3870,14 @@ function AssociationList(props) {
|
|
|
3748
3870
|
onClick: () => void handlePin(row, !(row.pinned ?? false)),
|
|
3749
3871
|
title: row.pinned ? "Unpin (stops staying in agent context)" : "Pin \u2014 always in agent context",
|
|
3750
3872
|
"aria-label": row.pinned ? "Unpin" : "Pin",
|
|
3751
|
-
className:
|
|
3873
|
+
className: cn9(
|
|
3752
3874
|
"shrink-0 rounded p-0.5 transition-colors hover:!text-foreground",
|
|
3753
3875
|
row.pinned ? "text-primary" : "text-muted-foreground/0 group-hover:text-muted-foreground"
|
|
3754
3876
|
),
|
|
3755
|
-
children: pinningKeys.has(row.key) ? /* @__PURE__ */
|
|
3877
|
+
children: pinningKeys.has(row.key) ? /* @__PURE__ */ jsx13(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx13(
|
|
3756
3878
|
PinIcon,
|
|
3757
3879
|
{
|
|
3758
|
-
className:
|
|
3880
|
+
className: cn9(
|
|
3759
3881
|
"h-3 w-3",
|
|
3760
3882
|
row.pinned && "fill-primary/20"
|
|
3761
3883
|
)
|
|
@@ -3763,7 +3885,7 @@ function AssociationList(props) {
|
|
|
3763
3885
|
)
|
|
3764
3886
|
}
|
|
3765
3887
|
),
|
|
3766
|
-
row.removable && /* @__PURE__ */
|
|
3888
|
+
row.removable && /* @__PURE__ */ jsx13(
|
|
3767
3889
|
"button",
|
|
3768
3890
|
{
|
|
3769
3891
|
type: "button",
|
|
@@ -3772,7 +3894,7 @@ function AssociationList(props) {
|
|
|
3772
3894
|
title: "Detach",
|
|
3773
3895
|
"aria-label": "Detach",
|
|
3774
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",
|
|
3775
|
-
children: busy ? /* @__PURE__ */
|
|
3897
|
+
children: busy ? /* @__PURE__ */ jsx13(SpinnerIcon, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ jsx13(XIcon, { className: "h-3 w-3" })
|
|
3776
3898
|
}
|
|
3777
3899
|
)
|
|
3778
3900
|
]
|
|
@@ -3783,7 +3905,7 @@ function AssociationList(props) {
|
|
|
3783
3905
|
})
|
|
3784
3906
|
] }, role);
|
|
3785
3907
|
}) }),
|
|
3786
|
-
pickerToken && /* @__PURE__ */
|
|
3908
|
+
pickerToken && /* @__PURE__ */ jsx13(
|
|
3787
3909
|
AssociationPicker,
|
|
3788
3910
|
{
|
|
3789
3911
|
open: true,
|
|
@@ -3840,8 +3962,8 @@ function titleize(token) {
|
|
|
3840
3962
|
|
|
3841
3963
|
// src/react/components/AssociationCaptureToolbar.tsx
|
|
3842
3964
|
import { useRef as useRef8, useState as useState12 } from "react";
|
|
3843
|
-
import { Button as Button2, cn as
|
|
3844
|
-
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";
|
|
3845
3967
|
function AssociationCaptureToolbar({
|
|
3846
3968
|
attach,
|
|
3847
3969
|
uploadFolderPath,
|
|
@@ -4072,10 +4194,10 @@ function AssociationCaptureToolbar({
|
|
|
4072
4194
|
}
|
|
4073
4195
|
};
|
|
4074
4196
|
const anyBuiltIn = actions.upload || actions.addFile || actions.newDocument;
|
|
4075
|
-
return /* @__PURE__ */
|
|
4197
|
+
return /* @__PURE__ */ jsxs12(
|
|
4076
4198
|
"div",
|
|
4077
4199
|
{
|
|
4078
|
-
className:
|
|
4200
|
+
className: cn10(
|
|
4079
4201
|
"relative flex h-full min-h-0 flex-col",
|
|
4080
4202
|
isDragOver && "ring-2 ring-inset ring-primary/50",
|
|
4081
4203
|
className
|
|
@@ -4093,11 +4215,11 @@ function AssociationCaptureToolbar({
|
|
|
4093
4215
|
},
|
|
4094
4216
|
onDrop: handleDrop,
|
|
4095
4217
|
children: [
|
|
4096
|
-
isDragOver ? /* @__PURE__ */
|
|
4097
|
-
/* @__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" }),
|
|
4098
4220
|
"Drop to upload & attach"
|
|
4099
4221
|
] }) }) : null,
|
|
4100
|
-
/* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx14(
|
|
4101
4223
|
"input",
|
|
4102
4224
|
{
|
|
4103
4225
|
ref: fileInputRef,
|
|
@@ -4107,8 +4229,8 @@ function AssociationCaptureToolbar({
|
|
|
4107
4229
|
onChange: handleFilesSelected
|
|
4108
4230
|
}
|
|
4109
4231
|
),
|
|
4110
|
-
showToolbar && (anyBuiltIn || extraActions) ? /* @__PURE__ */
|
|
4111
|
-
/* @__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(
|
|
4112
4234
|
Input3,
|
|
4113
4235
|
{
|
|
4114
4236
|
autoFocus: true,
|
|
@@ -4127,17 +4249,17 @@ function AssociationCaptureToolbar({
|
|
|
4127
4249
|
style: { fontSize: 16 }
|
|
4128
4250
|
}
|
|
4129
4251
|
),
|
|
4130
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx14(
|
|
4131
4253
|
"button",
|
|
4132
4254
|
{
|
|
4133
4255
|
type: "button",
|
|
4134
4256
|
disabled: creatingDoc || !docName.trim(),
|
|
4135
4257
|
onClick: () => void handleCreateDoc(),
|
|
4136
4258
|
className: "flex h-7 items-center rounded-md bg-primary px-2 text-[11px] font-medium text-primary-foreground disabled:opacity-50",
|
|
4137
|
-
children: creatingDoc ? /* @__PURE__ */
|
|
4259
|
+
children: creatingDoc ? /* @__PURE__ */ jsx14(SpinnerIcon, { className: "size-3.5 animate-spin" }) : "Create"
|
|
4138
4260
|
}
|
|
4139
4261
|
),
|
|
4140
|
-
/* @__PURE__ */
|
|
4262
|
+
/* @__PURE__ */ jsx14(
|
|
4141
4263
|
"button",
|
|
4142
4264
|
{
|
|
4143
4265
|
type: "button",
|
|
@@ -4150,8 +4272,8 @@ function AssociationCaptureToolbar({
|
|
|
4150
4272
|
children: "Cancel"
|
|
4151
4273
|
}
|
|
4152
4274
|
)
|
|
4153
|
-
] }) : /* @__PURE__ */
|
|
4154
|
-
actions.upload ? /* @__PURE__ */
|
|
4275
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4276
|
+
actions.upload ? /* @__PURE__ */ jsx14(
|
|
4155
4277
|
CaptureToolbarAction,
|
|
4156
4278
|
{
|
|
4157
4279
|
icon: isUploading ? SpinnerIcon : UploadIcon,
|
|
@@ -4161,7 +4283,7 @@ function AssociationCaptureToolbar({
|
|
|
4161
4283
|
disabled: isPicking || isUploading
|
|
4162
4284
|
}
|
|
4163
4285
|
) : null,
|
|
4164
|
-
actions.addFile ? /* @__PURE__ */
|
|
4286
|
+
actions.addFile ? /* @__PURE__ */ jsx14(
|
|
4165
4287
|
CaptureToolbarAction,
|
|
4166
4288
|
{
|
|
4167
4289
|
icon: isPicking ? SpinnerIcon : FolderOpenIcon,
|
|
@@ -4171,8 +4293,8 @@ function AssociationCaptureToolbar({
|
|
|
4171
4293
|
disabled: isPicking || isUploading
|
|
4172
4294
|
}
|
|
4173
4295
|
) : null,
|
|
4174
|
-
(actions.upload || actions.addFile) && actions.newDocument ? /* @__PURE__ */
|
|
4175
|
-
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(
|
|
4176
4298
|
CaptureToolbarAction,
|
|
4177
4299
|
{
|
|
4178
4300
|
icon: creatingDoc ? SpinnerIcon : PlusIcon,
|
|
@@ -4196,7 +4318,7 @@ function CaptureToolbarAction({
|
|
|
4196
4318
|
disabled,
|
|
4197
4319
|
spinning
|
|
4198
4320
|
}) {
|
|
4199
|
-
return /* @__PURE__ */
|
|
4321
|
+
return /* @__PURE__ */ jsxs12(
|
|
4200
4322
|
Button2,
|
|
4201
4323
|
{
|
|
4202
4324
|
type: "button",
|
|
@@ -4206,7 +4328,7 @@ function CaptureToolbarAction({
|
|
|
4206
4328
|
disabled,
|
|
4207
4329
|
className: "h-7 gap-1 px-2 text-[11px] text-muted-foreground hover:text-foreground",
|
|
4208
4330
|
children: [
|
|
4209
|
-
/* @__PURE__ */
|
|
4331
|
+
/* @__PURE__ */ jsx14(Icon, { className: cn10("size-3.5", spinning && "animate-spin") }),
|
|
4210
4332
|
label
|
|
4211
4333
|
]
|
|
4212
4334
|
}
|
|
@@ -4215,7 +4337,7 @@ function CaptureToolbarAction({
|
|
|
4215
4337
|
|
|
4216
4338
|
// src/react/lazyPorts.tsx
|
|
4217
4339
|
import { Suspense, lazy } from "react";
|
|
4218
|
-
import { jsx as
|
|
4340
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
4219
4341
|
function lazyComponent(load) {
|
|
4220
4342
|
return lazy(async () => {
|
|
4221
4343
|
const loaded = await load();
|
|
@@ -4225,14 +4347,14 @@ function lazyComponent(load) {
|
|
|
4225
4347
|
function lazyWindowShell(load) {
|
|
4226
4348
|
const Loaded = lazyComponent(load);
|
|
4227
4349
|
return function LazyWindowShell(props) {
|
|
4228
|
-
return /* @__PURE__ */
|
|
4350
|
+
return /* @__PURE__ */ jsx15(Suspense, { fallback: null, children: /* @__PURE__ */ jsx15(Loaded, { ...props }) });
|
|
4229
4351
|
};
|
|
4230
4352
|
}
|
|
4231
4353
|
function lazyPickerOverride(load) {
|
|
4232
4354
|
const Loaded = lazyComponent(load);
|
|
4233
4355
|
return function LazyPickerOverride(props) {
|
|
4234
4356
|
if (!props.open) return null;
|
|
4235
|
-
return /* @__PURE__ */
|
|
4357
|
+
return /* @__PURE__ */ jsx15(Suspense, { fallback: null, children: /* @__PURE__ */ jsx15(Loaded, { ...props }) });
|
|
4236
4358
|
};
|
|
4237
4359
|
}
|
|
4238
4360
|
|
|
@@ -4346,7 +4468,7 @@ function useAssociationPickerBridge(props, options = {}) {
|
|
|
4346
4468
|
// src/react/components/AssociationEntitySelect.tsx
|
|
4347
4469
|
import { useState as useState14 } from "react";
|
|
4348
4470
|
import {
|
|
4349
|
-
cn as
|
|
4471
|
+
cn as cn11,
|
|
4350
4472
|
Command,
|
|
4351
4473
|
CommandEmpty,
|
|
4352
4474
|
CommandGroup,
|
|
@@ -4358,7 +4480,7 @@ import {
|
|
|
4358
4480
|
PopoverContent,
|
|
4359
4481
|
PopoverTrigger
|
|
4360
4482
|
} from "@ai-matrx/design-system";
|
|
4361
|
-
import { jsx as
|
|
4483
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4362
4484
|
function AssociationEntitySelect({
|
|
4363
4485
|
token,
|
|
4364
4486
|
adapter,
|
|
@@ -4399,25 +4521,25 @@ function AssociationEntitySelect({
|
|
|
4399
4521
|
if (id) close();
|
|
4400
4522
|
else notifier.error(`Couldn't create the ${entityLabel}`);
|
|
4401
4523
|
};
|
|
4402
|
-
return /* @__PURE__ */
|
|
4524
|
+
return /* @__PURE__ */ jsxs13(
|
|
4403
4525
|
"div",
|
|
4404
4526
|
{
|
|
4405
|
-
className:
|
|
4527
|
+
className: cn11(
|
|
4406
4528
|
"group/entity-ref flex min-w-0 items-center gap-0.5",
|
|
4407
4529
|
className
|
|
4408
4530
|
),
|
|
4409
4531
|
children: [
|
|
4410
|
-
showIcon ? /* @__PURE__ */
|
|
4532
|
+
showIcon ? /* @__PURE__ */ jsx16(
|
|
4411
4533
|
InfoIcon,
|
|
4412
4534
|
{
|
|
4413
|
-
className:
|
|
4535
|
+
className: cn11(
|
|
4414
4536
|
"size-3.5 shrink-0",
|
|
4415
4537
|
iconClassName ?? "text-muted-foreground"
|
|
4416
4538
|
),
|
|
4417
4539
|
"aria-hidden": true
|
|
4418
4540
|
}
|
|
4419
4541
|
) : null,
|
|
4420
|
-
active ? /* @__PURE__ */
|
|
4542
|
+
active ? /* @__PURE__ */ jsx16(
|
|
4421
4543
|
EditableLabel,
|
|
4422
4544
|
{
|
|
4423
4545
|
value: active.title,
|
|
@@ -4431,29 +4553,29 @@ function AssociationEntitySelect({
|
|
|
4431
4553
|
commitMode: "await",
|
|
4432
4554
|
activation: renameActivation,
|
|
4433
4555
|
ariaLabel: info.label,
|
|
4434
|
-
className:
|
|
4556
|
+
className: cn11("max-w-[14rem]", labelClassName),
|
|
4435
4557
|
displayClassName: "text-xs font-medium text-foreground",
|
|
4436
4558
|
inputClassName: "text-xs font-medium"
|
|
4437
4559
|
}
|
|
4438
4560
|
) : null,
|
|
4439
|
-
active ? /* @__PURE__ */
|
|
4440
|
-
!active ? /* @__PURE__ */
|
|
4561
|
+
active ? /* @__PURE__ */ jsx16(DoorControlsSlot, { token, id: active.id, name: active.title }) : null,
|
|
4562
|
+
!active ? /* @__PURE__ */ jsx16(
|
|
4441
4563
|
"span",
|
|
4442
4564
|
{
|
|
4443
|
-
className:
|
|
4565
|
+
className: cn11(
|
|
4444
4566
|
"truncate px-1 text-xs font-medium text-muted-foreground",
|
|
4445
4567
|
labelClassName
|
|
4446
4568
|
),
|
|
4447
4569
|
children: adapter.loading ? "\u2026" : emptyLabel ?? info.labelPlural
|
|
4448
4570
|
}
|
|
4449
4571
|
) : null,
|
|
4450
|
-
/* @__PURE__ */
|
|
4572
|
+
/* @__PURE__ */ jsxs13(
|
|
4451
4573
|
Popover,
|
|
4452
4574
|
{
|
|
4453
4575
|
open,
|
|
4454
4576
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
4455
4577
|
children: [
|
|
4456
|
-
/* @__PURE__ */
|
|
4578
|
+
/* @__PURE__ */ jsx16(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs13(
|
|
4457
4579
|
"button",
|
|
4458
4580
|
{
|
|
4459
4581
|
type: "button",
|
|
@@ -4461,17 +4583,17 @@ function AssociationEntitySelect({
|
|
|
4461
4583
|
title: `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4462
4584
|
"aria-label": `Switch or add ${info.labelPlural.toLowerCase()}`,
|
|
4463
4585
|
children: [
|
|
4464
|
-
items.length > 1 ? /* @__PURE__ */
|
|
4586
|
+
items.length > 1 ? /* @__PURE__ */ jsxs13("span", { className: "tabular-nums", children: [
|
|
4465
4587
|
activeIndex >= 0 ? activeIndex + 1 : "\u2014",
|
|
4466
4588
|
"/",
|
|
4467
4589
|
items.length
|
|
4468
4590
|
] }) : null,
|
|
4469
|
-
/* @__PURE__ */
|
|
4591
|
+
/* @__PURE__ */ jsx16(ChevronDownIcon, { className: "size-3 opacity-60" })
|
|
4470
4592
|
]
|
|
4471
4593
|
}
|
|
4472
4594
|
) }),
|
|
4473
|
-
/* @__PURE__ */
|
|
4474
|
-
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(
|
|
4475
4597
|
CommandInput,
|
|
4476
4598
|
{
|
|
4477
4599
|
value: query,
|
|
@@ -4479,9 +4601,9 @@ function AssociationEntitySelect({
|
|
|
4479
4601
|
placeholder: `Search ${info.labelPlural.toLowerCase()}\u2026`
|
|
4480
4602
|
}
|
|
4481
4603
|
) : null,
|
|
4482
|
-
/* @__PURE__ */
|
|
4483
|
-
/* @__PURE__ */
|
|
4484
|
-
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(
|
|
4485
4607
|
CommandItem,
|
|
4486
4608
|
{
|
|
4487
4609
|
value: `${item.title} ${item.id}`,
|
|
@@ -4492,17 +4614,17 @@ function AssociationEntitySelect({
|
|
|
4492
4614
|
},
|
|
4493
4615
|
className: "group/entity-ref group gap-2",
|
|
4494
4616
|
children: [
|
|
4495
|
-
/* @__PURE__ */
|
|
4617
|
+
/* @__PURE__ */ jsx16(
|
|
4496
4618
|
CheckIcon,
|
|
4497
4619
|
{
|
|
4498
|
-
className:
|
|
4620
|
+
className: cn11(
|
|
4499
4621
|
"size-3.5 shrink-0",
|
|
4500
4622
|
item.id === activeId ? "opacity-100" : "opacity-0"
|
|
4501
4623
|
)
|
|
4502
4624
|
}
|
|
4503
4625
|
),
|
|
4504
|
-
/* @__PURE__ */
|
|
4505
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate", children: item.title }),
|
|
4627
|
+
/* @__PURE__ */ jsx16(
|
|
4506
4628
|
"span",
|
|
4507
4629
|
{
|
|
4508
4630
|
className: "inline-flex shrink-0 items-center",
|
|
@@ -4510,7 +4632,7 @@ function AssociationEntitySelect({
|
|
|
4510
4632
|
e.preventDefault();
|
|
4511
4633
|
e.stopPropagation();
|
|
4512
4634
|
},
|
|
4513
|
-
children: /* @__PURE__ */
|
|
4635
|
+
children: /* @__PURE__ */ jsx16(
|
|
4514
4636
|
DoorControlsSlot,
|
|
4515
4637
|
{
|
|
4516
4638
|
token,
|
|
@@ -4520,7 +4642,7 @@ function AssociationEntitySelect({
|
|
|
4520
4642
|
)
|
|
4521
4643
|
}
|
|
4522
4644
|
),
|
|
4523
|
-
adapter.detach && item.id !== activeId ? /* @__PURE__ */
|
|
4645
|
+
adapter.detach && item.id !== activeId ? /* @__PURE__ */ jsx16(
|
|
4524
4646
|
"button",
|
|
4525
4647
|
{
|
|
4526
4648
|
type: "button",
|
|
@@ -4535,7 +4657,7 @@ function AssociationEntitySelect({
|
|
|
4535
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",
|
|
4536
4658
|
title: `Remove this ${entityLabel} from here (does not delete it)`,
|
|
4537
4659
|
"aria-label": `Remove ${item.title}`,
|
|
4538
|
-
children: /* @__PURE__ */
|
|
4660
|
+
children: /* @__PURE__ */ jsx16(XIcon, { className: "size-3" })
|
|
4539
4661
|
}
|
|
4540
4662
|
) : null
|
|
4541
4663
|
]
|
|
@@ -4543,9 +4665,9 @@ function AssociationEntitySelect({
|
|
|
4543
4665
|
item.id
|
|
4544
4666
|
)) }) : null
|
|
4545
4667
|
] }),
|
|
4546
|
-
createSlot !== void 0 ? /* @__PURE__ */
|
|
4547
|
-
createSlot === void 0 && adapter.createAndAttach ? /* @__PURE__ */
|
|
4548
|
-
/* @__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(
|
|
4549
4671
|
"input",
|
|
4550
4672
|
{
|
|
4551
4673
|
autoFocus: true,
|
|
@@ -4569,17 +4691,17 @@ function AssociationEntitySelect({
|
|
|
4569
4691
|
"aria-label": `New ${entityLabel} name`
|
|
4570
4692
|
}
|
|
4571
4693
|
),
|
|
4572
|
-
/* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsx16(
|
|
4573
4695
|
"button",
|
|
4574
4696
|
{
|
|
4575
4697
|
type: "button",
|
|
4576
4698
|
disabled: busy || !draftName.trim(),
|
|
4577
4699
|
onClick: () => void create(draftName),
|
|
4578
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",
|
|
4579
|
-
children: busy ? /* @__PURE__ */
|
|
4701
|
+
children: busy ? /* @__PURE__ */ jsx16(SpinnerIcon, { className: "size-3 animate-spin" }) : "Create"
|
|
4580
4702
|
}
|
|
4581
4703
|
)
|
|
4582
|
-
] }) : /* @__PURE__ */
|
|
4704
|
+
] }) : /* @__PURE__ */ jsxs13(
|
|
4583
4705
|
"button",
|
|
4584
4706
|
{
|
|
4585
4707
|
type: "button",
|
|
@@ -4590,7 +4712,7 @@ function AssociationEntitySelect({
|
|
|
4590
4712
|
},
|
|
4591
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",
|
|
4592
4714
|
children: [
|
|
4593
|
-
busy ? /* @__PURE__ */
|
|
4715
|
+
busy ? /* @__PURE__ */ jsx16(SpinnerIcon, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ jsx16(PlusIcon, { className: "size-3.5" }),
|
|
4594
4716
|
query.trim() ? `Create "${query.trim()}"` : `New ${info.label}`
|
|
4595
4717
|
]
|
|
4596
4718
|
}
|
|
@@ -4680,7 +4802,7 @@ function buildCategoryHierarchy(categories) {
|
|
|
4680
4802
|
}
|
|
4681
4803
|
|
|
4682
4804
|
// src/react/components/CategorySelect.tsx
|
|
4683
|
-
import { jsx as
|
|
4805
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4684
4806
|
var NONE = "__none__";
|
|
4685
4807
|
var ROOT_PARENT = "__root__";
|
|
4686
4808
|
function plural(noun) {
|
|
@@ -4716,9 +4838,9 @@ function CategorySelect({
|
|
|
4716
4838
|
// The type-ahead matches the parent's name too, so someone who knows
|
|
4717
4839
|
// the branch but not the leaf still finds it.
|
|
4718
4840
|
keywords: parent ? parent.name : "",
|
|
4719
|
-
render: depth === 0 ? /* @__PURE__ */
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
/* @__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 })
|
|
4722
4844
|
] })
|
|
4723
4845
|
})) : categories.map((category) => ({
|
|
4724
4846
|
value: category.id,
|
|
@@ -4765,8 +4887,8 @@ function CategorySelect({
|
|
|
4765
4887
|
);
|
|
4766
4888
|
return result.id;
|
|
4767
4889
|
};
|
|
4768
|
-
return /* @__PURE__ */
|
|
4769
|
-
/* @__PURE__ */
|
|
4890
|
+
return /* @__PURE__ */ jsxs14("div", { children: [
|
|
4891
|
+
/* @__PURE__ */ jsx17(
|
|
4770
4892
|
CreatablePicker,
|
|
4771
4893
|
{
|
|
4772
4894
|
value: value ?? (allowNone ? NONE : null),
|
|
@@ -4782,18 +4904,18 @@ function CategorySelect({
|
|
|
4782
4904
|
emptyLabel: `No ${noun} matches that.`,
|
|
4783
4905
|
...allowCreate ? { onCreate: create } : {},
|
|
4784
4906
|
...allowCreate && hierarchy.hasHierarchy ? {
|
|
4785
|
-
createExtra: /* @__PURE__ */
|
|
4786
|
-
/* @__PURE__ */
|
|
4907
|
+
createExtra: /* @__PURE__ */ jsxs14(Select, { value: createParentId, onValueChange: setCreateParentId, children: [
|
|
4908
|
+
/* @__PURE__ */ jsx17(
|
|
4787
4909
|
SelectTrigger,
|
|
4788
4910
|
{
|
|
4789
4911
|
className: "h-7 text-xs",
|
|
4790
4912
|
"aria-label": `Put the new ${noun} under`,
|
|
4791
|
-
children: /* @__PURE__ */
|
|
4913
|
+
children: /* @__PURE__ */ jsx17(SelectValue, {})
|
|
4792
4914
|
}
|
|
4793
4915
|
),
|
|
4794
|
-
/* @__PURE__ */
|
|
4795
|
-
/* @__PURE__ */
|
|
4796
|
-
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(
|
|
4797
4919
|
SelectItem,
|
|
4798
4920
|
{
|
|
4799
4921
|
value: item.category.id,
|
|
@@ -4813,13 +4935,13 @@ function CategorySelect({
|
|
|
4813
4935
|
selected === null && value !== null ? (
|
|
4814
4936
|
// A stored id whose row this reader cannot see is not "nothing chosen":
|
|
4815
4937
|
// saying so beats a blank box that looks like an unsaved field.
|
|
4816
|
-
/* @__PURE__ */
|
|
4938
|
+
/* @__PURE__ */ jsxs14("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
4817
4939
|
"This ",
|
|
4818
4940
|
noun,
|
|
4819
4941
|
" is no longer available to you."
|
|
4820
4942
|
] })
|
|
4821
4943
|
) : null,
|
|
4822
|
-
error ? /* @__PURE__ */
|
|
4944
|
+
error ? /* @__PURE__ */ jsx17("p", { className: "mt-1 text-xs text-destructive", children: error }) : null
|
|
4823
4945
|
] });
|
|
4824
4946
|
}
|
|
4825
4947
|
|
|
@@ -4828,7 +4950,7 @@ import { useState as useState16 } from "react";
|
|
|
4828
4950
|
import {
|
|
4829
4951
|
Badge,
|
|
4830
4952
|
Button as Button3,
|
|
4831
|
-
cn as
|
|
4953
|
+
cn as cn12,
|
|
4832
4954
|
Command as Command2,
|
|
4833
4955
|
CommandEmpty as CommandEmpty2,
|
|
4834
4956
|
CommandGroup as CommandGroup2,
|
|
@@ -4844,7 +4966,7 @@ import {
|
|
|
4844
4966
|
SelectTrigger as SelectTrigger2,
|
|
4845
4967
|
SelectValue as SelectValue2
|
|
4846
4968
|
} from "@ai-matrx/design-system";
|
|
4847
|
-
import { jsx as
|
|
4969
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4848
4970
|
var ROOT_PARENT2 = "__root__";
|
|
4849
4971
|
function CategoryTagPicker({
|
|
4850
4972
|
entityType,
|
|
@@ -4968,44 +5090,44 @@ function CategoryTagPicker({
|
|
|
4968
5090
|
const exactMatch = categories.some(
|
|
4969
5091
|
(c) => c.name.toLowerCase() === search.trim().toLowerCase()
|
|
4970
5092
|
);
|
|
4971
|
-
return /* @__PURE__ */
|
|
4972
|
-
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(
|
|
4973
5095
|
Badge,
|
|
4974
5096
|
{
|
|
4975
5097
|
variant: "secondary",
|
|
4976
5098
|
className: "gap-1 pr-1 text-xs font-medium",
|
|
4977
5099
|
children: [
|
|
4978
5100
|
showHierarchy ? hierarchyById.get(c.id)?.displayName ?? c.name : c.name,
|
|
4979
|
-
/* @__PURE__ */
|
|
5101
|
+
/* @__PURE__ */ jsx18(
|
|
4980
5102
|
"button",
|
|
4981
5103
|
{
|
|
4982
5104
|
type: "button",
|
|
4983
5105
|
onClick: () => void toggle(c.id),
|
|
4984
5106
|
className: "ml-0.5 rounded-full p-0.5 hover:bg-muted-foreground/20",
|
|
4985
5107
|
"aria-label": `Remove ${c.name}`,
|
|
4986
|
-
children: /* @__PURE__ */
|
|
5108
|
+
children: /* @__PURE__ */ jsx18(XIcon, { className: "h-2.5 w-2.5" })
|
|
4987
5109
|
}
|
|
4988
5110
|
)
|
|
4989
5111
|
]
|
|
4990
5112
|
},
|
|
4991
5113
|
c.id
|
|
4992
5114
|
)),
|
|
4993
|
-
/* @__PURE__ */
|
|
4994
|
-
/* @__PURE__ */
|
|
5115
|
+
/* @__PURE__ */ jsxs15(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5116
|
+
/* @__PURE__ */ jsx18(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs15(
|
|
4995
5117
|
Button3,
|
|
4996
5118
|
{
|
|
4997
5119
|
variant: "outline",
|
|
4998
5120
|
size: "sm",
|
|
4999
5121
|
className: "h-7 gap-1 px-2 text-xs",
|
|
5000
5122
|
children: [
|
|
5001
|
-
/* @__PURE__ */
|
|
5123
|
+
/* @__PURE__ */ jsx18(Icon, { className: "h-3.5 w-3.5" }),
|
|
5002
5124
|
selected.length === 0 ? addLabel : "Edit",
|
|
5003
|
-
/* @__PURE__ */
|
|
5125
|
+
/* @__PURE__ */ jsx18(ChevronsUpDownIcon, { className: "h-3 w-3 opacity-50" })
|
|
5004
5126
|
]
|
|
5005
5127
|
}
|
|
5006
5128
|
) }),
|
|
5007
|
-
/* @__PURE__ */
|
|
5008
|
-
/* @__PURE__ */
|
|
5129
|
+
/* @__PURE__ */ jsx18(PopoverContent2, { sizing: "content", className: "p-0", align: "start", children: /* @__PURE__ */ jsxs15(Command2, { shouldFilter: false, children: [
|
|
5130
|
+
/* @__PURE__ */ jsx18(
|
|
5009
5131
|
CommandInput2,
|
|
5010
5132
|
{
|
|
5011
5133
|
placeholder: allowCreate ? "Search or create..." : "Search...",
|
|
@@ -5013,41 +5135,41 @@ function CategoryTagPicker({
|
|
|
5013
5135
|
onValueChange: setSearch
|
|
5014
5136
|
}
|
|
5015
5137
|
),
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__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(
|
|
5019
5141
|
CommandItem2,
|
|
5020
5142
|
{
|
|
5021
5143
|
value: category.id,
|
|
5022
5144
|
keywords: parent ? [parent.name, category.name] : [],
|
|
5023
5145
|
onSelect: () => void toggle(category.id),
|
|
5024
|
-
className:
|
|
5146
|
+
className: cn12("text-xs", depth === 1 && "pl-6"),
|
|
5025
5147
|
children: [
|
|
5026
|
-
/* @__PURE__ */
|
|
5148
|
+
/* @__PURE__ */ jsx18(
|
|
5027
5149
|
CheckIcon,
|
|
5028
5150
|
{
|
|
5029
|
-
className:
|
|
5151
|
+
className: cn12(
|
|
5030
5152
|
"mr-2 h-3.5 w-3.5",
|
|
5031
5153
|
selectedIds.has(category.id) ? "opacity-100" : "opacity-0"
|
|
5032
5154
|
)
|
|
5033
5155
|
}
|
|
5034
5156
|
),
|
|
5035
|
-
depth === 1 ? /* @__PURE__ */
|
|
5036
|
-
/* @__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 })
|
|
5037
5159
|
]
|
|
5038
5160
|
},
|
|
5039
5161
|
category.id
|
|
5040
|
-
)) : filtered.map((c) => /* @__PURE__ */
|
|
5162
|
+
)) : filtered.map((c) => /* @__PURE__ */ jsxs15(
|
|
5041
5163
|
CommandItem2,
|
|
5042
5164
|
{
|
|
5043
5165
|
value: c.id,
|
|
5044
5166
|
onSelect: () => void toggle(c.id),
|
|
5045
5167
|
className: "text-xs",
|
|
5046
5168
|
children: [
|
|
5047
|
-
/* @__PURE__ */
|
|
5169
|
+
/* @__PURE__ */ jsx18(
|
|
5048
5170
|
CheckIcon,
|
|
5049
5171
|
{
|
|
5050
|
-
className:
|
|
5172
|
+
className: cn12(
|
|
5051
5173
|
"mr-2 h-3.5 w-3.5",
|
|
5052
5174
|
selectedIds.has(c.id) ? "opacity-100" : "opacity-0"
|
|
5053
5175
|
)
|
|
@@ -5058,25 +5180,25 @@ function CategoryTagPicker({
|
|
|
5058
5180
|
},
|
|
5059
5181
|
c.id
|
|
5060
5182
|
)) }),
|
|
5061
|
-
allowCreate && search.trim() && !exactMatch ? /* @__PURE__ */
|
|
5062
|
-
showHierarchy ? /* @__PURE__ */
|
|
5063
|
-
/* @__PURE__ */
|
|
5064
|
-
/* @__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(
|
|
5065
5187
|
Select2,
|
|
5066
5188
|
{
|
|
5067
5189
|
value: createParentId,
|
|
5068
5190
|
onValueChange: setCreateParentId,
|
|
5069
5191
|
children: [
|
|
5070
|
-
/* @__PURE__ */
|
|
5071
|
-
/* @__PURE__ */
|
|
5072
|
-
/* @__PURE__ */
|
|
5073
|
-
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))
|
|
5074
5196
|
] })
|
|
5075
5197
|
]
|
|
5076
5198
|
}
|
|
5077
5199
|
)
|
|
5078
5200
|
] }) : null,
|
|
5079
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ jsxs15(
|
|
5080
5202
|
CommandItem2,
|
|
5081
5203
|
{
|
|
5082
5204
|
value: `__create__${search}`,
|
|
@@ -5084,7 +5206,7 @@ function CategoryTagPicker({
|
|
|
5084
5206
|
disabled: creating,
|
|
5085
5207
|
className: "text-xs text-primary",
|
|
5086
5208
|
children: [
|
|
5087
|
-
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" }),
|
|
5088
5210
|
"Create \u201C",
|
|
5089
5211
|
search.trim(),
|
|
5090
5212
|
"\u201D"
|
|
@@ -5100,9 +5222,9 @@ function CategoryTagPicker({
|
|
|
5100
5222
|
|
|
5101
5223
|
// src/react/components/CommentThread.tsx
|
|
5102
5224
|
import { useState as useState17 } from "react";
|
|
5103
|
-
import { Button as Button4, ErrorBox, Skeleton as Skeleton2, cn as
|
|
5225
|
+
import { Button as Button4, ErrorBox as ErrorBox2, Skeleton as Skeleton2, cn as cn13 } from "@ai-matrx/design-system";
|
|
5104
5226
|
import { formatRelativeTime } from "@ai-matrx/kit/format";
|
|
5105
|
-
import { Fragment as Fragment5, jsx as
|
|
5227
|
+
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5106
5228
|
var AUTHOR_DOOR_TOKEN = "user";
|
|
5107
5229
|
function resolveAuthor(comment, authorDisplay) {
|
|
5108
5230
|
const base2 = {
|
|
@@ -5121,7 +5243,7 @@ function resolveAuthor(comment, authorDisplay) {
|
|
|
5121
5243
|
}
|
|
5122
5244
|
function AuthorAvatar({ author }) {
|
|
5123
5245
|
if (author.avatarUrl) {
|
|
5124
|
-
return /* @__PURE__ */
|
|
5246
|
+
return /* @__PURE__ */ jsx19(
|
|
5125
5247
|
"img",
|
|
5126
5248
|
{
|
|
5127
5249
|
src: author.avatarUrl,
|
|
@@ -5130,7 +5252,7 @@ function AuthorAvatar({ author }) {
|
|
|
5130
5252
|
}
|
|
5131
5253
|
);
|
|
5132
5254
|
}
|
|
5133
|
-
return /* @__PURE__ */
|
|
5255
|
+
return /* @__PURE__ */ jsx19(
|
|
5134
5256
|
"span",
|
|
5135
5257
|
{
|
|
5136
5258
|
"aria-hidden": true,
|
|
@@ -5145,7 +5267,7 @@ function AuthorName({
|
|
|
5145
5267
|
}) {
|
|
5146
5268
|
const DoorRef2 = entityDoors?.EntityRef;
|
|
5147
5269
|
if (DoorRef2 && author.userId) {
|
|
5148
|
-
return /* @__PURE__ */
|
|
5270
|
+
return /* @__PURE__ */ jsx19(
|
|
5149
5271
|
DoorRef2,
|
|
5150
5272
|
{
|
|
5151
5273
|
token: AUTHOR_DOOR_TOKEN,
|
|
@@ -5156,7 +5278,7 @@ function AuthorName({
|
|
|
5156
5278
|
}
|
|
5157
5279
|
);
|
|
5158
5280
|
}
|
|
5159
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsx19("span", { className: "text-sm font-medium text-foreground", children: author.name });
|
|
5160
5282
|
}
|
|
5161
5283
|
function CommentComposer({
|
|
5162
5284
|
onSubmit,
|
|
@@ -5186,8 +5308,8 @@ function CommentComposer({
|
|
|
5186
5308
|
}
|
|
5187
5309
|
setBody("");
|
|
5188
5310
|
}
|
|
5189
|
-
return /* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5311
|
+
return /* @__PURE__ */ jsxs16("form", { onSubmit: submit, className: "flex flex-col gap-1.5", children: [
|
|
5312
|
+
/* @__PURE__ */ jsx19(
|
|
5191
5313
|
"textarea",
|
|
5192
5314
|
{
|
|
5193
5315
|
value: body,
|
|
@@ -5202,8 +5324,8 @@ function CommentComposer({
|
|
|
5202
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"
|
|
5203
5325
|
}
|
|
5204
5326
|
),
|
|
5205
|
-
error && /* @__PURE__ */
|
|
5206
|
-
|
|
5327
|
+
error && /* @__PURE__ */ jsx19(
|
|
5328
|
+
ErrorBox2,
|
|
5207
5329
|
{
|
|
5208
5330
|
className: "text-xs text-destructive",
|
|
5209
5331
|
message: error,
|
|
@@ -5212,9 +5334,9 @@ function CommentComposer({
|
|
|
5212
5334
|
origin: "associations/CommentThread"
|
|
5213
5335
|
}
|
|
5214
5336
|
),
|
|
5215
|
-
/* @__PURE__ */
|
|
5216
|
-
/* @__PURE__ */
|
|
5217
|
-
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" }),
|
|
5218
5340
|
submitLabel
|
|
5219
5341
|
] }),
|
|
5220
5342
|
trailing
|
|
@@ -5247,19 +5369,19 @@ function CommentItem({
|
|
|
5247
5369
|
notifier.error(res.error ?? "Could not delete the comment");
|
|
5248
5370
|
}
|
|
5249
5371
|
}
|
|
5250
|
-
return /* @__PURE__ */
|
|
5372
|
+
return /* @__PURE__ */ jsxs16(
|
|
5251
5373
|
"div",
|
|
5252
5374
|
{
|
|
5253
5375
|
"data-comment-id": comment.id,
|
|
5254
|
-
className:
|
|
5376
|
+
className: cn13(
|
|
5255
5377
|
"flex flex-col gap-1",
|
|
5256
5378
|
depth > 0 && "border-l border-border pl-3"
|
|
5257
5379
|
),
|
|
5258
5380
|
children: [
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__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(
|
|
5263
5385
|
"span",
|
|
5264
5386
|
{
|
|
5265
5387
|
className: "text-xs text-muted-foreground",
|
|
@@ -5270,7 +5392,7 @@ function CommentItem({
|
|
|
5270
5392
|
})
|
|
5271
5393
|
}
|
|
5272
5394
|
),
|
|
5273
|
-
edited && /* @__PURE__ */
|
|
5395
|
+
edited && /* @__PURE__ */ jsx19(
|
|
5274
5396
|
"span",
|
|
5275
5397
|
{
|
|
5276
5398
|
className: "text-xs text-muted-foreground",
|
|
@@ -5279,7 +5401,7 @@ function CommentItem({
|
|
|
5279
5401
|
}
|
|
5280
5402
|
)
|
|
5281
5403
|
] }),
|
|
5282
|
-
editing ? /* @__PURE__ */
|
|
5404
|
+
editing ? /* @__PURE__ */ jsx19("div", { className: "pl-8", children: /* @__PURE__ */ jsx19(
|
|
5283
5405
|
CommentComposer,
|
|
5284
5406
|
{
|
|
5285
5407
|
initialValue: comment.body,
|
|
@@ -5291,7 +5413,7 @@ function CommentItem({
|
|
|
5291
5413
|
if (res.ok) setEditing(false);
|
|
5292
5414
|
return res;
|
|
5293
5415
|
},
|
|
5294
|
-
trailing: /* @__PURE__ */
|
|
5416
|
+
trailing: /* @__PURE__ */ jsx19(
|
|
5295
5417
|
Button4,
|
|
5296
5418
|
{
|
|
5297
5419
|
type: "button",
|
|
@@ -5302,10 +5424,10 @@ function CommentItem({
|
|
|
5302
5424
|
}
|
|
5303
5425
|
)
|
|
5304
5426
|
}
|
|
5305
|
-
) }) : /* @__PURE__ */
|
|
5306
|
-
!editing && /* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5308
|
-
/* @__PURE__ */
|
|
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(
|
|
5309
5431
|
Button4,
|
|
5310
5432
|
{
|
|
5311
5433
|
type: "button",
|
|
@@ -5314,12 +5436,12 @@ function CommentItem({
|
|
|
5314
5436
|
disabled: deleting,
|
|
5315
5437
|
onClick: () => void confirmDelete(),
|
|
5316
5438
|
children: [
|
|
5317
|
-
deleting && /* @__PURE__ */
|
|
5439
|
+
deleting && /* @__PURE__ */ jsx19(SpinnerIcon, { className: "mr-1 h-3 w-3 animate-spin" }),
|
|
5318
5440
|
"Delete"
|
|
5319
5441
|
]
|
|
5320
5442
|
}
|
|
5321
5443
|
),
|
|
5322
|
-
/* @__PURE__ */
|
|
5444
|
+
/* @__PURE__ */ jsx19(
|
|
5323
5445
|
Button4,
|
|
5324
5446
|
{
|
|
5325
5447
|
type: "button",
|
|
@@ -5330,8 +5452,8 @@ function CommentItem({
|
|
|
5330
5452
|
children: "Cancel"
|
|
5331
5453
|
}
|
|
5332
5454
|
)
|
|
5333
|
-
] }) : /* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5455
|
+
] }) : /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
5456
|
+
/* @__PURE__ */ jsx19(
|
|
5335
5457
|
"button",
|
|
5336
5458
|
{
|
|
5337
5459
|
type: "button",
|
|
@@ -5340,8 +5462,8 @@ function CommentItem({
|
|
|
5340
5462
|
children: "Reply"
|
|
5341
5463
|
}
|
|
5342
5464
|
),
|
|
5343
|
-
isOwn && /* @__PURE__ */
|
|
5344
|
-
/* @__PURE__ */
|
|
5465
|
+
isOwn && /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
5466
|
+
/* @__PURE__ */ jsx19(
|
|
5345
5467
|
"button",
|
|
5346
5468
|
{
|
|
5347
5469
|
type: "button",
|
|
@@ -5350,7 +5472,7 @@ function CommentItem({
|
|
|
5350
5472
|
children: "Edit"
|
|
5351
5473
|
}
|
|
5352
5474
|
),
|
|
5353
|
-
/* @__PURE__ */
|
|
5475
|
+
/* @__PURE__ */ jsx19(
|
|
5354
5476
|
"button",
|
|
5355
5477
|
{
|
|
5356
5478
|
type: "button",
|
|
@@ -5361,9 +5483,9 @@ function CommentItem({
|
|
|
5361
5483
|
)
|
|
5362
5484
|
] })
|
|
5363
5485
|
] }) }),
|
|
5364
|
-
replying && /* @__PURE__ */
|
|
5365
|
-
/* @__PURE__ */
|
|
5366
|
-
/* @__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(
|
|
5367
5489
|
CommentComposer,
|
|
5368
5490
|
{
|
|
5369
5491
|
submitLabel: "Reply",
|
|
@@ -5377,7 +5499,7 @@ function CommentItem({
|
|
|
5377
5499
|
if (res.ok) setReplying(false);
|
|
5378
5500
|
return res;
|
|
5379
5501
|
},
|
|
5380
|
-
trailing: /* @__PURE__ */
|
|
5502
|
+
trailing: /* @__PURE__ */ jsx19(
|
|
5381
5503
|
Button4,
|
|
5382
5504
|
{
|
|
5383
5505
|
type: "button",
|
|
@@ -5390,7 +5512,7 @@ function CommentItem({
|
|
|
5390
5512
|
}
|
|
5391
5513
|
) })
|
|
5392
5514
|
] }),
|
|
5393
|
-
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(
|
|
5394
5516
|
CommentItem,
|
|
5395
5517
|
{
|
|
5396
5518
|
comment: reply,
|
|
@@ -5430,11 +5552,11 @@ function CommentThread({
|
|
|
5430
5552
|
const thread = useComments({ token, id });
|
|
5431
5553
|
const { roots, childrenOf } = buildCommentTree(thread.comments);
|
|
5432
5554
|
const loading = (thread.status === "loading" || thread.status === "idle") && thread.comments.length === 0;
|
|
5433
|
-
return /* @__PURE__ */
|
|
5434
|
-
showHeader && /* @__PURE__ */
|
|
5435
|
-
/* @__PURE__ */
|
|
5436
|
-
/* @__PURE__ */
|
|
5437
|
-
/* @__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(
|
|
5438
5560
|
"button",
|
|
5439
5561
|
{
|
|
5440
5562
|
type: "button",
|
|
@@ -5442,12 +5564,12 @@ function CommentThread({
|
|
|
5442
5564
|
"aria-label": "Refresh comments",
|
|
5443
5565
|
title: "Refresh comments",
|
|
5444
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",
|
|
5445
|
-
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" })
|
|
5446
5568
|
}
|
|
5447
5569
|
)
|
|
5448
5570
|
] }),
|
|
5449
|
-
thread.error && /* @__PURE__ */
|
|
5450
|
-
|
|
5571
|
+
thread.error && /* @__PURE__ */ jsxs16(
|
|
5572
|
+
ErrorBox2,
|
|
5451
5573
|
{
|
|
5452
5574
|
as: "div",
|
|
5453
5575
|
className: "flex items-center gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
@@ -5455,8 +5577,8 @@ function CommentThread({
|
|
|
5455
5577
|
operation: "Load comments",
|
|
5456
5578
|
origin: "associations/CommentThread",
|
|
5457
5579
|
children: [
|
|
5458
|
-
/* @__PURE__ */
|
|
5459
|
-
/* @__PURE__ */
|
|
5580
|
+
/* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1", children: thread.error }),
|
|
5581
|
+
/* @__PURE__ */ jsx19(
|
|
5460
5582
|
Button4,
|
|
5461
5583
|
{
|
|
5462
5584
|
type: "button",
|
|
@@ -5470,10 +5592,10 @@ function CommentThread({
|
|
|
5470
5592
|
]
|
|
5471
5593
|
}
|
|
5472
5594
|
),
|
|
5473
|
-
loading ? /* @__PURE__ */
|
|
5474
|
-
/* @__PURE__ */
|
|
5475
|
-
/* @__PURE__ */
|
|
5476
|
-
] }) : 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(
|
|
5477
5599
|
CommentItem,
|
|
5478
5600
|
{
|
|
5479
5601
|
comment,
|
|
@@ -5484,7 +5606,7 @@ function CommentThread({
|
|
|
5484
5606
|
},
|
|
5485
5607
|
comment.id
|
|
5486
5608
|
)) }),
|
|
5487
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ jsx19(
|
|
5488
5610
|
CommentComposer,
|
|
5489
5611
|
{
|
|
5490
5612
|
onSubmit: (body) => thread.add(body, { orgId: orgId ?? null })
|
|
@@ -5514,11 +5636,13 @@ export {
|
|
|
5514
5636
|
DoorControlsSlot,
|
|
5515
5637
|
DoorRef,
|
|
5516
5638
|
PrimaryEntityProvider,
|
|
5639
|
+
SearchFailureNotice,
|
|
5517
5640
|
UniversalAssociationPicker,
|
|
5518
5641
|
UnresolvedRef,
|
|
5519
5642
|
attachedKey,
|
|
5520
5643
|
buildCommentTree,
|
|
5521
5644
|
containerLinksArgs,
|
|
5645
|
+
describeSearchFailures,
|
|
5522
5646
|
getContentRoleMeta,
|
|
5523
5647
|
lazyPickerOverride,
|
|
5524
5648
|
lazyWindowShell,
|