@ai-matrx/associations 0.13.136 → 0.13.138
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 +25 -1
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{ports-NWvRv4ug.d.cts → ports-C6ZirUKI.d.cts} +2 -2
- package/dist/{ports-NWvRv4ug.d.ts → ports-C6ZirUKI.d.ts} +2 -2
- package/dist/react/index.cjs +81 -62
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +167 -149
- package/dist/react/index.js.map +1 -1
- package/package.json +4 -4
package/dist/react/index.js
CHANGED
|
@@ -1504,6 +1504,8 @@ var ASSOCIATION_PAIRS = /* @__PURE__ */ new Set([
|
|
|
1504
1504
|
"rulebook>masterwork_source",
|
|
1505
1505
|
"sch_task>record",
|
|
1506
1506
|
"sch_task>scope",
|
|
1507
|
+
"scope>record",
|
|
1508
|
+
"scope>scope",
|
|
1507
1509
|
"seo_keyword>project",
|
|
1508
1510
|
"seo_keyword>web_page",
|
|
1509
1511
|
"seo_map_topic>seo_map_facet_value",
|
|
@@ -1670,9 +1672,8 @@ var useEntityRelationships = useAssociations;
|
|
|
1670
1672
|
import {
|
|
1671
1673
|
useCallback,
|
|
1672
1674
|
useEffect as useEffect2,
|
|
1673
|
-
useLayoutEffect,
|
|
1674
1675
|
useRef as useRef3,
|
|
1675
|
-
|
|
1676
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
1676
1677
|
} from "react";
|
|
1677
1678
|
|
|
1678
1679
|
// src/edges.ts
|
|
@@ -1756,6 +1757,66 @@ function metadataRecord(metadata) {
|
|
|
1756
1757
|
}
|
|
1757
1758
|
return Object.fromEntries(Object.entries(metadata));
|
|
1758
1759
|
}
|
|
1760
|
+
var conversationFileCaches = /* @__PURE__ */ new WeakMap();
|
|
1761
|
+
function conversationFilesFor(store) {
|
|
1762
|
+
const existing = conversationFileCaches.get(store);
|
|
1763
|
+
if (existing) return existing;
|
|
1764
|
+
const entries = /* @__PURE__ */ new Map();
|
|
1765
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
1766
|
+
const seqs = /* @__PURE__ */ new Map();
|
|
1767
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1768
|
+
const set = (entry) => {
|
|
1769
|
+
entries.set(entry.key, entry);
|
|
1770
|
+
for (const listener of listeners) listener();
|
|
1771
|
+
};
|
|
1772
|
+
const cache = {
|
|
1773
|
+
get: (key) => entries.get(key) ?? null,
|
|
1774
|
+
subscribe(listener) {
|
|
1775
|
+
listeners.add(listener);
|
|
1776
|
+
return () => {
|
|
1777
|
+
listeners.delete(listener);
|
|
1778
|
+
};
|
|
1779
|
+
},
|
|
1780
|
+
load(key, conversationId, force) {
|
|
1781
|
+
const kept = entries.get(key);
|
|
1782
|
+
if (!force) {
|
|
1783
|
+
const running = inflight.get(key);
|
|
1784
|
+
if (running) return running;
|
|
1785
|
+
if (kept && !kept.loading && kept.error === null) return Promise.resolve();
|
|
1786
|
+
}
|
|
1787
|
+
const seq = (seqs.get(key) ?? 0) + 1;
|
|
1788
|
+
seqs.set(key, seq);
|
|
1789
|
+
set({ key, files: kept?.files ?? [], error: kept?.error ?? null, loading: true });
|
|
1790
|
+
const request = store.services.associations.listConversationFiles(conversationId).then((result) => {
|
|
1791
|
+
if (seqs.get(key) !== seq) return;
|
|
1792
|
+
if (isAssociationsRpcErr(result)) {
|
|
1793
|
+
set({ key, files: entries.get(key)?.files ?? [], error: result.error.message, loading: false });
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
set({
|
|
1797
|
+
key,
|
|
1798
|
+
files: result.data.files.map((file) => ({
|
|
1799
|
+
edgeId: `conversation-file:${file.fileId}`,
|
|
1800
|
+
resourceId: file.fileId,
|
|
1801
|
+
token: "file",
|
|
1802
|
+
role: null,
|
|
1803
|
+
label: file.label,
|
|
1804
|
+
metadata: file.metadata
|
|
1805
|
+
})),
|
|
1806
|
+
error: null,
|
|
1807
|
+
loading: false
|
|
1808
|
+
});
|
|
1809
|
+
});
|
|
1810
|
+
const tracked = request.finally(() => {
|
|
1811
|
+
if (inflight.get(key) === tracked) inflight.delete(key);
|
|
1812
|
+
});
|
|
1813
|
+
inflight.set(key, tracked);
|
|
1814
|
+
return tracked;
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
conversationFileCaches.set(store, cache);
|
|
1818
|
+
return cache;
|
|
1819
|
+
}
|
|
1759
1820
|
function useContainerLinks(args) {
|
|
1760
1821
|
const { containerType, containerId, orgId } = args;
|
|
1761
1822
|
const outgoing = args.direction === "outgoing";
|
|
@@ -1771,58 +1832,21 @@ function useContainerLinks(args) {
|
|
|
1771
1832
|
id: containerId
|
|
1772
1833
|
});
|
|
1773
1834
|
const conversationKey = !outgoing && containerType === "conversation" && containerId ? `conversation:${containerId}` : null;
|
|
1774
|
-
const
|
|
1775
|
-
const
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
key,
|
|
1788
|
-
files: current?.key === key ? current.files : [],
|
|
1789
|
-
// Keep the visible failure context while retrying so the same control
|
|
1790
|
-
// can disable itself and show progress instead of disappearing.
|
|
1791
|
-
error: current?.key === key ? current.error : null,
|
|
1792
|
-
loading: true
|
|
1793
|
-
}));
|
|
1794
|
-
const result = await store.services.associations.listConversationFiles(containerId);
|
|
1795
|
-
if (generation !== conversationGeneration.current || activeConversationKey.current !== key) {
|
|
1796
|
-
return;
|
|
1797
|
-
}
|
|
1798
|
-
if (isAssociationsRpcErr(result)) {
|
|
1799
|
-
setConversationResult((current) => ({
|
|
1800
|
-
key,
|
|
1801
|
-
files: current?.key === key ? current.files : [],
|
|
1802
|
-
error: result.error.message,
|
|
1803
|
-
loading: false
|
|
1804
|
-
}));
|
|
1805
|
-
return;
|
|
1806
|
-
}
|
|
1807
|
-
setConversationResult({
|
|
1808
|
-
key,
|
|
1809
|
-
files: result.data.files.map((file) => ({
|
|
1810
|
-
edgeId: `conversation-file:${file.fileId}`,
|
|
1811
|
-
resourceId: file.fileId,
|
|
1812
|
-
token: "file",
|
|
1813
|
-
role: null,
|
|
1814
|
-
label: file.label,
|
|
1815
|
-
metadata: file.metadata
|
|
1816
|
-
})),
|
|
1817
|
-
error: null,
|
|
1818
|
-
loading: false
|
|
1819
|
-
});
|
|
1820
|
-
}, [containerId, conversationKey, store]);
|
|
1835
|
+
const files = conversationFilesFor(store);
|
|
1836
|
+
const conversationResult = useSyncExternalStore2(
|
|
1837
|
+
files.subscribe,
|
|
1838
|
+
() => conversationKey ? files.get(conversationKey) : null,
|
|
1839
|
+
() => null
|
|
1840
|
+
);
|
|
1841
|
+
const loadConversationFiles = useCallback(
|
|
1842
|
+
async (force = true) => {
|
|
1843
|
+
if (!conversationKey || !containerId) return;
|
|
1844
|
+
await files.load(conversationKey, containerId, force);
|
|
1845
|
+
},
|
|
1846
|
+
[containerId, conversationKey, files]
|
|
1847
|
+
);
|
|
1821
1848
|
useEffect2(() => {
|
|
1822
|
-
|
|
1823
|
-
void loadConversationFiles();
|
|
1824
|
-
}, 0);
|
|
1825
|
-
return () => clearTimeout(timeout);
|
|
1849
|
+
void loadConversationFiles(false);
|
|
1826
1850
|
}, [loadConversationFiles]);
|
|
1827
1851
|
const lastGenericFetch = useRef3({
|
|
1828
1852
|
key: conversationKey,
|
|
@@ -1984,12 +2008,12 @@ function containerLinksArgs(container) {
|
|
|
1984
2008
|
}
|
|
1985
2009
|
|
|
1986
2010
|
// src/react/hooks/useEntityTitles.ts
|
|
1987
|
-
import { useEffect as useEffect3, useState
|
|
2011
|
+
import { useEffect as useEffect3, useState } from "react";
|
|
1988
2012
|
function useEntityTitles(refs) {
|
|
1989
2013
|
const store = useAssociationsStore();
|
|
1990
|
-
const [resolved, setResolved] =
|
|
1991
|
-
const [attempted, setAttempted] =
|
|
1992
|
-
const [loading, setLoading] =
|
|
2014
|
+
const [resolved, setResolved] = useState({});
|
|
2015
|
+
const [attempted, setAttempted] = useState({});
|
|
2016
|
+
const [loading, setLoading] = useState(false);
|
|
1993
2017
|
const needed = refs.filter(
|
|
1994
2018
|
(r) => store.registry.tryGetEntityInfo(r.token)?.titleColumn != null && store.titles.get(r.token, r.id) == null && !attempted[entityTitleCacheKey(r.token, r.id)]
|
|
1995
2019
|
);
|
|
@@ -2058,13 +2082,13 @@ function useEntityTitles(refs) {
|
|
|
2058
2082
|
}
|
|
2059
2083
|
|
|
2060
2084
|
// src/react/hooks/useCategories.ts
|
|
2061
|
-
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as
|
|
2085
|
+
import { useEffect as useEffect4, useRef as useRef4, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
2062
2086
|
var noopSubscribe2 = () => () => {
|
|
2063
2087
|
};
|
|
2064
2088
|
function useCategories(args) {
|
|
2065
2089
|
const { dimension, autoLoad = true } = args;
|
|
2066
2090
|
const store = useAssociationsStore();
|
|
2067
|
-
const entry =
|
|
2091
|
+
const entry = useSyncExternalStore3(
|
|
2068
2092
|
dimension ? (cb) => store.subscribeCategories(dimension, cb) : noopSubscribe2,
|
|
2069
2093
|
() => store.getCategories(dimension ?? ""),
|
|
2070
2094
|
() => store.getCategories(dimension ?? "")
|
|
@@ -2121,7 +2145,7 @@ function useCategories(args) {
|
|
|
2121
2145
|
}
|
|
2122
2146
|
|
|
2123
2147
|
// src/react/hooks/useUniversalEntitySearch.ts
|
|
2124
|
-
import { useEffect as useEffect5, useRef as useRef5, useState as
|
|
2148
|
+
import { useEffect as useEffect5, useRef as useRef5, useState as useState2 } from "react";
|
|
2125
2149
|
var DEBOUNCE_MS = 250;
|
|
2126
2150
|
var RECENTS_LIMIT = 12;
|
|
2127
2151
|
function useUniversalEntitySearch(args) {
|
|
@@ -2133,14 +2157,14 @@ function useUniversalEntitySearch(args) {
|
|
|
2133
2157
|
emptyQueryMode = "recents"
|
|
2134
2158
|
} = args;
|
|
2135
2159
|
const store = useAssociationsStore();
|
|
2136
|
-
const [results, setResults] =
|
|
2137
|
-
const [loading, setLoading] =
|
|
2138
|
-
const [failures, setFailures] =
|
|
2139
|
-
const [error, setError] =
|
|
2140
|
-
const [status, setStatus] =
|
|
2160
|
+
const [results, setResults] = useState2([]);
|
|
2161
|
+
const [loading, setLoading] = useState2(false);
|
|
2162
|
+
const [failures, setFailures] = useState2([]);
|
|
2163
|
+
const [error, setError] = useState2(null);
|
|
2164
|
+
const [status, setStatus] = useState2(
|
|
2141
2165
|
enabled ? "loading" : "ready"
|
|
2142
2166
|
);
|
|
2143
|
-
const [source, setSource] =
|
|
2167
|
+
const [source, setSource] = useState2(
|
|
2144
2168
|
emptyQueryMode === "candidates" ? "candidates" : "recents"
|
|
2145
2169
|
);
|
|
2146
2170
|
const runRef = useRef5(0);
|
|
@@ -2317,14 +2341,14 @@ function SearchFailureNotice(props) {
|
|
|
2317
2341
|
}
|
|
2318
2342
|
|
|
2319
2343
|
// src/react/hooks/useAssociationCandidates.ts
|
|
2320
|
-
import { useEffect as useEffect6, useState as
|
|
2344
|
+
import { useEffect as useEffect6, useState as useState3 } from "react";
|
|
2321
2345
|
function useAssociationCandidates(args) {
|
|
2322
2346
|
const { token, enabled = true, search, limit } = args;
|
|
2323
2347
|
const store = useAssociationsStore();
|
|
2324
|
-
const [candidates, setCandidates] =
|
|
2325
|
-
const [loading, setLoading] =
|
|
2326
|
-
const [error, setError] =
|
|
2327
|
-
const [tick, setTick] =
|
|
2348
|
+
const [candidates, setCandidates] = useState3([]);
|
|
2349
|
+
const [loading, setLoading] = useState3(false);
|
|
2350
|
+
const [error, setError] = useState3(null);
|
|
2351
|
+
const [tick, setTick] = useState3(0);
|
|
2328
2352
|
useEffect6(() => {
|
|
2329
2353
|
if (!enabled) return void 0;
|
|
2330
2354
|
let cancelled = false;
|
|
@@ -2358,14 +2382,14 @@ function useAssociationCandidates(args) {
|
|
|
2358
2382
|
}
|
|
2359
2383
|
|
|
2360
2384
|
// src/react/hooks/useComments.ts
|
|
2361
|
-
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as
|
|
2385
|
+
import { useEffect as useEffect7, useRef as useRef6, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
2362
2386
|
var noopSubscribe3 = () => () => {
|
|
2363
2387
|
};
|
|
2364
2388
|
function useComments(args) {
|
|
2365
2389
|
const { token, id, autoLoad = true } = args;
|
|
2366
2390
|
const store = useAssociationsStore();
|
|
2367
2391
|
const key = token && id ? associationsKey(token, id) : null;
|
|
2368
|
-
const entry =
|
|
2392
|
+
const entry = useSyncExternalStore4(
|
|
2369
2393
|
key ? (cb) => store.subscribeComments(key, cb) : noopSubscribe3,
|
|
2370
2394
|
() => store.getComments(token, id ?? ""),
|
|
2371
2395
|
() => store.getComments(token, id ?? "")
|
|
@@ -2424,7 +2448,7 @@ function useComments(args) {
|
|
|
2424
2448
|
}
|
|
2425
2449
|
|
|
2426
2450
|
// src/react/hooks/useAssociationEntitySelect.ts
|
|
2427
|
-
import { useState as
|
|
2451
|
+
import { useState as useState4 } from "react";
|
|
2428
2452
|
function useAssociationEntitySelectAdapter(args) {
|
|
2429
2453
|
const { token, container, activeId, onActiveChange, createColumns } = args;
|
|
2430
2454
|
const store = useAssociationsStore();
|
|
@@ -2438,10 +2462,10 @@ function useAssociationEntitySelectAdapter(args) {
|
|
|
2438
2462
|
const { titleFor } = useEntityTitles(
|
|
2439
2463
|
rows.map((r) => ({ token, id: r.resourceId, label: r.label }))
|
|
2440
2464
|
);
|
|
2441
|
-
const [titleOverrides, setTitleOverrides] =
|
|
2465
|
+
const [titleOverrides, setTitleOverrides] = useState4(
|
|
2442
2466
|
{}
|
|
2443
2467
|
);
|
|
2444
|
-
const [localActiveId, setLocalActiveId] =
|
|
2468
|
+
const [localActiveId, setLocalActiveId] = useState4(null);
|
|
2445
2469
|
const items = rows.map((r) => ({
|
|
2446
2470
|
id: r.resourceId,
|
|
2447
2471
|
title: titleOverrides[r.resourceId] ?? titleFor({ token, id: r.resourceId, label: r.label })
|
|
@@ -2518,9 +2542,9 @@ import { useId } from "react";
|
|
|
2518
2542
|
import {
|
|
2519
2543
|
useCallback as useCallback2,
|
|
2520
2544
|
useEffect as useEffect8,
|
|
2521
|
-
useLayoutEffect
|
|
2545
|
+
useLayoutEffect,
|
|
2522
2546
|
useRef as useRef7,
|
|
2523
|
-
useState as
|
|
2547
|
+
useState as useState5
|
|
2524
2548
|
} from "react";
|
|
2525
2549
|
import { createPortal } from "react-dom";
|
|
2526
2550
|
import { cn as cn2, FloatingLayer, useFloatingLayerZIndex } from "@ai-matrx/design-system";
|
|
@@ -2707,12 +2731,12 @@ function DefaultWindowShell({
|
|
|
2707
2731
|
}) {
|
|
2708
2732
|
const panelRef = useRef7(null);
|
|
2709
2733
|
const zIndex = useFloatingLayerZIndex(50);
|
|
2710
|
-
const [mounted, setMounted] =
|
|
2711
|
-
const [isMobile, setIsMobile] =
|
|
2712
|
-
const [rect, setRect] =
|
|
2713
|
-
const [maximized, setMaximized] =
|
|
2734
|
+
const [mounted, setMounted] = useState5(false);
|
|
2735
|
+
const [isMobile, setIsMobile] = useState5(false);
|
|
2736
|
+
const [rect, setRect] = useState5(() => centred());
|
|
2737
|
+
const [maximized, setMaximized] = useState5(false);
|
|
2714
2738
|
const gesture = useRef7(null);
|
|
2715
|
-
|
|
2739
|
+
useLayoutEffect(() => {
|
|
2716
2740
|
setMounted(true);
|
|
2717
2741
|
setIsMobile(window.innerWidth < MOBILE_MAX_WIDTH);
|
|
2718
2742
|
setRect(centred());
|
|
@@ -2910,7 +2934,7 @@ function AssociationWindow({
|
|
|
2910
2934
|
}
|
|
2911
2935
|
|
|
2912
2936
|
// src/react/components/AssociationPicker.tsx
|
|
2913
|
-
import { useState as
|
|
2937
|
+
import { useState as useState6 } from "react";
|
|
2914
2938
|
import { cn as cn3, Input } from "@ai-matrx/design-system";
|
|
2915
2939
|
import { Fragment, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2916
2940
|
function AssociationPicker(props) {
|
|
@@ -2979,8 +3003,8 @@ function EntityCandidateList({
|
|
|
2979
3003
|
}) {
|
|
2980
3004
|
const store = useAssociationsStore();
|
|
2981
3005
|
const notifier = useNotifier();
|
|
2982
|
-
const [search, setSearch] =
|
|
2983
|
-
const [busyId, setBusyId] =
|
|
3006
|
+
const [search, setSearch] = useState6("");
|
|
3007
|
+
const [busyId, setBusyId] = useState6(null);
|
|
2984
3008
|
const info = store.registry.getEntityInfo(token);
|
|
2985
3009
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
2986
3010
|
const { candidates, loading, error, reload } = useAssociationCandidates({
|
|
@@ -3147,9 +3171,9 @@ function CreateAndAttachFooter({
|
|
|
3147
3171
|
const store = useAssociationsStore();
|
|
3148
3172
|
const notifier = useNotifier();
|
|
3149
3173
|
const info = store.registry.getEntityInfo(token);
|
|
3150
|
-
const [editing, setEditing] =
|
|
3151
|
-
const [name, setName] =
|
|
3152
|
-
const [busy, setBusy] =
|
|
3174
|
+
const [editing, setEditing] = useState6(false);
|
|
3175
|
+
const [name, setName] = useState6("");
|
|
3176
|
+
const [busy, setBusy] = useState6(false);
|
|
3153
3177
|
const submit = async () => {
|
|
3154
3178
|
const title = name.trim();
|
|
3155
3179
|
if (!title || busy) return;
|
|
@@ -3257,7 +3281,7 @@ function ListMessage({ children }) {
|
|
|
3257
3281
|
}
|
|
3258
3282
|
|
|
3259
3283
|
// src/react/components/UniversalAssociationPicker.tsx
|
|
3260
|
-
import { useState as
|
|
3284
|
+
import { useState as useState7 } from "react";
|
|
3261
3285
|
import { Button, cn as cn5, Input as Input2 } from "@ai-matrx/design-system";
|
|
3262
3286
|
|
|
3263
3287
|
// src/react/components/entityDoors.tsx
|
|
@@ -3361,11 +3385,11 @@ function UniversalAssociationPicker(props) {
|
|
|
3361
3385
|
const { pickerOverrides } = useAssociationsUiPorts();
|
|
3362
3386
|
const notifier = useNotifier();
|
|
3363
3387
|
const tokens = props.tokens ?? store.registry.listableTokens();
|
|
3364
|
-
const [query, setQuery] =
|
|
3365
|
-
const [browseToken, setBrowseToken] =
|
|
3366
|
-
const [busyKey, setBusyKey] =
|
|
3367
|
-
const [overrideOpen, setOverrideOpen] =
|
|
3368
|
-
const [overrideMount, setOverrideMount] =
|
|
3388
|
+
const [query, setQuery] = useState7("");
|
|
3389
|
+
const [browseToken, setBrowseToken] = useState7(null);
|
|
3390
|
+
const [busyKey, setBusyKey] = useState7(null);
|
|
3391
|
+
const [overrideOpen, setOverrideOpen] = useState7(false);
|
|
3392
|
+
const [overrideMount, setOverrideMount] = useState7(0);
|
|
3369
3393
|
const { results, loading, source, failures, error } = useUniversalEntitySearch({
|
|
3370
3394
|
query,
|
|
3371
3395
|
tokens,
|
|
@@ -3615,7 +3639,7 @@ function UniversalAssociationPicker(props) {
|
|
|
3615
3639
|
}
|
|
3616
3640
|
|
|
3617
3641
|
// src/react/components/AttachedItemsSheet.tsx
|
|
3618
|
-
import { useEffect as useEffect9, useState as
|
|
3642
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
3619
3643
|
import { cn as cn6 } from "@ai-matrx/design-system";
|
|
3620
3644
|
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3621
3645
|
function metadataIsPinned(metadata) {
|
|
@@ -3676,9 +3700,9 @@ function AttachedItemsBody({
|
|
|
3676
3700
|
const notifier = useNotifier();
|
|
3677
3701
|
const info = store.registry.getEntityInfo(token);
|
|
3678
3702
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
3679
|
-
const [titles, setTitles] =
|
|
3680
|
-
const [titleError, setTitleError] =
|
|
3681
|
-
const [busyId, setBusyId] =
|
|
3703
|
+
const [titles, setTitles] = useState8(null);
|
|
3704
|
+
const [titleError, setTitleError] = useState8(null);
|
|
3705
|
+
const [busyId, setBusyId] = useState8(null);
|
|
3682
3706
|
const idKey = links.map((l) => l.resourceId).sort().join(",");
|
|
3683
3707
|
useEffect9(() => {
|
|
3684
3708
|
if (!enabled) return;
|
|
@@ -3832,7 +3856,7 @@ function AttachedItemsBody({
|
|
|
3832
3856
|
}
|
|
3833
3857
|
|
|
3834
3858
|
// src/react/components/AssociationCard.tsx
|
|
3835
|
-
import { useState as
|
|
3859
|
+
import { useState as useState9 } from "react";
|
|
3836
3860
|
import { cn as cn7 } from "@ai-matrx/design-system";
|
|
3837
3861
|
import { PlusTapButton } from "@ai-matrx/tap-target/buttons";
|
|
3838
3862
|
|
|
@@ -3894,11 +3918,11 @@ function AssociationCard({
|
|
|
3894
3918
|
const store = useAssociationsStore();
|
|
3895
3919
|
const fromCtx = usePrimaryEntity();
|
|
3896
3920
|
const container = containerProp ?? fromCtx;
|
|
3897
|
-
const [open, setOpen] =
|
|
3921
|
+
const [open, setOpen] = useState9(false);
|
|
3898
3922
|
const info = store.registry.getEntityInfo(token);
|
|
3899
3923
|
const role = getContentRoleMeta(info.contentRole);
|
|
3900
3924
|
const Icon = info.Icon ?? DefaultEntityIcon;
|
|
3901
|
-
const [listOpen, setListOpen] =
|
|
3925
|
+
const [listOpen, setListOpen] = useState9(false);
|
|
3902
3926
|
const {
|
|
3903
3927
|
status,
|
|
3904
3928
|
countFor,
|
|
@@ -4098,17 +4122,13 @@ var TILE_GRID = "grid grid-cols-1 gap-2 @md:grid-cols-2 @3xl:grid-cols-3";
|
|
|
4098
4122
|
function GroupHeader({
|
|
4099
4123
|
look,
|
|
4100
4124
|
title,
|
|
4101
|
-
tagline,
|
|
4102
4125
|
dotClassName
|
|
4103
4126
|
}) {
|
|
4104
4127
|
if (look !== "tiles") return /* @__PURE__ */ jsx12("h3", { className: SIMPLE_GROUP_LABEL, children: title });
|
|
4105
|
-
return /* @__PURE__ */
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
] }) : /* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: title }),
|
|
4110
|
-
/* @__PURE__ */ jsx12("p", { className: "hidden text-xs text-muted-foreground sm:block", children: tagline })
|
|
4111
|
-
] });
|
|
4128
|
+
return /* @__PURE__ */ jsx12("div", { className: "mb-2.5 flex items-baseline gap-3 pl-1.5", children: dotClassName ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
4129
|
+
/* @__PURE__ */ jsx12("span", { className: cn8("h-2.5 w-2.5 rounded-full", dotClassName) }),
|
|
4130
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: title })
|
|
4131
|
+
] }) : /* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: title }) });
|
|
4112
4132
|
}
|
|
4113
4133
|
function AssociationCardGrid({
|
|
4114
4134
|
tokens,
|
|
@@ -4154,7 +4174,6 @@ function AssociationCardGrid({
|
|
|
4154
4174
|
{
|
|
4155
4175
|
look,
|
|
4156
4176
|
title: role.title,
|
|
4157
|
-
tagline: role.tagline,
|
|
4158
4177
|
dotClassName: role.accentBar
|
|
4159
4178
|
}
|
|
4160
4179
|
),
|
|
@@ -4166,8 +4185,7 @@ function AssociationCardGrid({
|
|
|
4166
4185
|
GroupHeader,
|
|
4167
4186
|
{
|
|
4168
4187
|
look,
|
|
4169
|
-
title: "Filed under"
|
|
4170
|
-
tagline: "Libraries, topics and other places this is kept."
|
|
4188
|
+
title: "Filed under"
|
|
4171
4189
|
}
|
|
4172
4190
|
),
|
|
4173
4191
|
/* @__PURE__ */ jsx12("div", { className: rowClass, children: roleless.map((token) => /* @__PURE__ */ jsx12(AssociationCard, { token, look }, token)) })
|
|
@@ -4178,7 +4196,7 @@ function AssociationCardGrid({
|
|
|
4178
4196
|
}
|
|
4179
4197
|
|
|
4180
4198
|
// src/react/components/AssociationList.tsx
|
|
4181
|
-
import { useState as
|
|
4199
|
+
import { useState as useState10 } from "react";
|
|
4182
4200
|
import { cn as cn9, Skeleton } from "@ai-matrx/design-system";
|
|
4183
4201
|
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4184
4202
|
function metadataIsPinned2(metadata) {
|
|
@@ -4220,10 +4238,10 @@ function AssociationList(props) {
|
|
|
4220
4238
|
const adapter = props.adapter ?? defaultAdapter;
|
|
4221
4239
|
const variant = props.variant ?? "full";
|
|
4222
4240
|
const tokenFilter = props.tokens ?? null;
|
|
4223
|
-
const [pickerToken, setPickerToken] =
|
|
4224
|
-
const [showUniversal, setShowUniversal] =
|
|
4225
|
-
const [removingKeys, setRemovingKeys] =
|
|
4226
|
-
const [pinningKeys, setPinningKeys] =
|
|
4241
|
+
const [pickerToken, setPickerToken] = useState10(null);
|
|
4242
|
+
const [showUniversal, setShowUniversal] = useState10(false);
|
|
4243
|
+
const [removingKeys, setRemovingKeys] = useState10(/* @__PURE__ */ new Set());
|
|
4244
|
+
const [pinningKeys, setPinningKeys] = useState10(/* @__PURE__ */ new Set());
|
|
4227
4245
|
const rows = tokenFilter ? adapter.rows.filter((r) => tokenFilter.includes(r.token)) : adapter.rows;
|
|
4228
4246
|
const visibleRows = rows.filter((r) => !removingKeys.has(r.key));
|
|
4229
4247
|
const { titleFor, isUnresolved } = useEntityTitles(
|
|
@@ -4561,7 +4579,7 @@ function titleize(token) {
|
|
|
4561
4579
|
}
|
|
4562
4580
|
|
|
4563
4581
|
// src/react/components/AssociationCaptureToolbar.tsx
|
|
4564
|
-
import { useRef as useRef8, useState as
|
|
4582
|
+
import { useRef as useRef8, useState as useState11 } from "react";
|
|
4565
4583
|
import { Button as Button2, cn as cn10, Input as Input3 } from "@ai-matrx/design-system";
|
|
4566
4584
|
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4567
4585
|
function AssociationCaptureToolbar({
|
|
@@ -4584,12 +4602,12 @@ function AssociationCaptureToolbar({
|
|
|
4584
4602
|
const { capture } = useAssociationsUiPorts();
|
|
4585
4603
|
const notifier = useNotifier();
|
|
4586
4604
|
const fileInputRef = useRef8(null);
|
|
4587
|
-
const [isUploading, setIsUploading] =
|
|
4588
|
-
const [isDragOver, setIsDragOver] =
|
|
4589
|
-
const [isPicking, setIsPicking] =
|
|
4590
|
-
const [namingDoc, setNamingDoc] =
|
|
4591
|
-
const [docName, setDocName] =
|
|
4592
|
-
const [creatingDoc, setCreatingDoc] =
|
|
4605
|
+
const [isUploading, setIsUploading] = useState11(false);
|
|
4606
|
+
const [isDragOver, setIsDragOver] = useState11(false);
|
|
4607
|
+
const [isPicking, setIsPicking] = useState11(false);
|
|
4608
|
+
const [namingDoc, setNamingDoc] = useState11(false);
|
|
4609
|
+
const [docName, setDocName] = useState11("");
|
|
4610
|
+
const [creatingDoc, setCreatingDoc] = useState11(false);
|
|
4593
4611
|
const hostRequestUpload = capture?.requestUpload;
|
|
4594
4612
|
const hostUploadFile = capture?.uploadFile;
|
|
4595
4613
|
const requestUploadPath = hostRequestUpload ? (opts) => hostRequestUpload(opts) : hostUploadFile ? async (opts) => {
|
|
@@ -4961,11 +4979,11 @@ function lazyPickerOverride(load) {
|
|
|
4961
4979
|
}
|
|
4962
4980
|
|
|
4963
4981
|
// src/react/hooks/useAssociationPickerBridge.ts
|
|
4964
|
-
import { useCallback as useCallback3, useState as
|
|
4982
|
+
import { useCallback as useCallback3, useState as useState12 } from "react";
|
|
4965
4983
|
function useAssociationPickerBridge(props, options = {}) {
|
|
4966
4984
|
const store = useAssociationsStore();
|
|
4967
4985
|
const notifier = useNotifier();
|
|
4968
|
-
const [busy, setBusy] =
|
|
4986
|
+
const [busy, setBusy] = useState12(false);
|
|
4969
4987
|
const { attachedIds, onAttach, onDetach, token } = props;
|
|
4970
4988
|
const {
|
|
4971
4989
|
createdLocationLabel,
|
|
@@ -5068,7 +5086,7 @@ function useAssociationPickerBridge(props, options = {}) {
|
|
|
5068
5086
|
}
|
|
5069
5087
|
|
|
5070
5088
|
// src/react/components/AssociationEntitySelect.tsx
|
|
5071
|
-
import { useState as
|
|
5089
|
+
import { useState as useState13 } from "react";
|
|
5072
5090
|
import {
|
|
5073
5091
|
cn as cn11,
|
|
5074
5092
|
Command,
|
|
@@ -5102,11 +5120,11 @@ function AssociationEntitySelect({
|
|
|
5102
5120
|
const { items, activeId } = adapter;
|
|
5103
5121
|
const active = items.find((i) => i.id === activeId) ?? null;
|
|
5104
5122
|
const activeIndex = active ? items.indexOf(active) : -1;
|
|
5105
|
-
const [open, setOpen] =
|
|
5106
|
-
const [query, setQuery] =
|
|
5107
|
-
const [creating, setCreating] =
|
|
5108
|
-
const [draftName, setDraftName] =
|
|
5109
|
-
const [busy, setBusy] =
|
|
5123
|
+
const [open, setOpen] = useState13(false);
|
|
5124
|
+
const [query, setQuery] = useState13("");
|
|
5125
|
+
const [creating, setCreating] = useState13(false);
|
|
5126
|
+
const [draftName, setDraftName] = useState13("");
|
|
5127
|
+
const [busy, setBusy] = useState13(false);
|
|
5110
5128
|
const entityLabel = info.label.toLowerCase();
|
|
5111
5129
|
const close = () => {
|
|
5112
5130
|
setOpen(false);
|
|
@@ -5329,7 +5347,7 @@ function AssociationEntitySelect({
|
|
|
5329
5347
|
}
|
|
5330
5348
|
|
|
5331
5349
|
// src/react/components/CategorySelect.tsx
|
|
5332
|
-
import { useState as
|
|
5350
|
+
import { useState as useState14 } from "react";
|
|
5333
5351
|
import {
|
|
5334
5352
|
CreatablePicker,
|
|
5335
5353
|
Select,
|
|
@@ -5431,7 +5449,7 @@ function CategorySelect({
|
|
|
5431
5449
|
reload
|
|
5432
5450
|
} = useCategories({ dimension });
|
|
5433
5451
|
const hierarchy = buildCategoryHierarchy(categories);
|
|
5434
|
-
const [createParentId, setCreateParentId] =
|
|
5452
|
+
const [createParentId, setCreateParentId] = useState14(ROOT_PARENT);
|
|
5435
5453
|
const options = [
|
|
5436
5454
|
...allowNone ? [{ value: NONE, label: "None", keywords: "none clear empty" }] : [],
|
|
5437
5455
|
...hierarchy.hasHierarchy ? hierarchy.items.map(({ category, depth, parent }) => ({
|
|
@@ -5548,7 +5566,7 @@ function CategorySelect({
|
|
|
5548
5566
|
}
|
|
5549
5567
|
|
|
5550
5568
|
// src/react/components/CategoryTagPicker.tsx
|
|
5551
|
-
import { useState as
|
|
5569
|
+
import { useState as useState15 } from "react";
|
|
5552
5570
|
import {
|
|
5553
5571
|
Badge,
|
|
5554
5572
|
Button as Button3,
|
|
@@ -5585,11 +5603,11 @@ function CategoryTagPicker({
|
|
|
5585
5603
|
}) {
|
|
5586
5604
|
const store = useAssociationsStore();
|
|
5587
5605
|
const notifier = useNotifier();
|
|
5588
|
-
const [open, setOpen] =
|
|
5589
|
-
const [creating, setCreating] =
|
|
5590
|
-
const [writing, setWriting] =
|
|
5591
|
-
const [search, setSearch] =
|
|
5592
|
-
const [createParentId, setCreateParentId] =
|
|
5606
|
+
const [open, setOpen] = useState15(false);
|
|
5607
|
+
const [creating, setCreating] = useState15(false);
|
|
5608
|
+
const [writing, setWriting] = useState15(false);
|
|
5609
|
+
const [search, setSearch] = useState15("");
|
|
5610
|
+
const [createParentId, setCreateParentId] = useState15(ROOT_PARENT2);
|
|
5593
5611
|
const {
|
|
5594
5612
|
categories,
|
|
5595
5613
|
create: createCategory,
|
|
@@ -5824,7 +5842,7 @@ function CategoryTagPicker({
|
|
|
5824
5842
|
}
|
|
5825
5843
|
|
|
5826
5844
|
// src/react/components/CommentThread.tsx
|
|
5827
|
-
import { useState as
|
|
5845
|
+
import { useState as useState16 } from "react";
|
|
5828
5846
|
import { Button as Button4, ErrorBox as ErrorBox2, Skeleton as Skeleton2, cn as cn13 } from "@ai-matrx/design-system";
|
|
5829
5847
|
import { formatRelativeTime } from "@ai-matrx/kit/format";
|
|
5830
5848
|
import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -5892,9 +5910,9 @@ function CommentComposer({
|
|
|
5892
5910
|
autoFocus = false
|
|
5893
5911
|
}) {
|
|
5894
5912
|
const notifier = useNotifier();
|
|
5895
|
-
const [body, setBody] =
|
|
5896
|
-
const [submitting, setSubmitting] =
|
|
5897
|
-
const [error, setError] =
|
|
5913
|
+
const [body, setBody] = useState16(initialValue);
|
|
5914
|
+
const [submitting, setSubmitting] = useState16(false);
|
|
5915
|
+
const [error, setError] = useState16(null);
|
|
5898
5916
|
async function submit(e) {
|
|
5899
5917
|
e?.preventDefault();
|
|
5900
5918
|
const trimmed = body.trim();
|
|
@@ -5955,10 +5973,10 @@ function CommentItem({
|
|
|
5955
5973
|
}) {
|
|
5956
5974
|
const { authorDisplay, entityDoors } = useAssociationsUiPorts();
|
|
5957
5975
|
const notifier = useNotifier();
|
|
5958
|
-
const [replying, setReplying] =
|
|
5959
|
-
const [editing, setEditing] =
|
|
5960
|
-
const [confirmingDelete, setConfirmingDelete] =
|
|
5961
|
-
const [deleting, setDeleting] =
|
|
5976
|
+
const [replying, setReplying] = useState16(false);
|
|
5977
|
+
const [editing, setEditing] = useState16(false);
|
|
5978
|
+
const [confirmingDelete, setConfirmingDelete] = useState16(false);
|
|
5979
|
+
const [deleting, setDeleting] = useState16(false);
|
|
5962
5980
|
const author = resolveAuthor(comment, authorDisplay);
|
|
5963
5981
|
const isOwn = thread.currentUserId !== null && comment.createdBy === thread.currentUserId;
|
|
5964
5982
|
const edited = comment.updatedAt !== comment.createdAt;
|