@dxos/react-ui-rdf 0.0.0 → 0.11.1

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.
Files changed (31) hide show
  1. package/dist/lib/index.mjs +338 -0
  2. package/dist/lib/index.mjs.map +1 -0
  3. package/dist/types/src/components/FactViewer/FactViewer.d.ts +73 -0
  4. package/dist/types/src/components/FactViewer/FactViewer.d.ts.map +1 -0
  5. package/dist/types/src/{FactViewer.stories.d.ts → components/FactViewer/FactViewer.stories.d.ts} +4 -2
  6. package/dist/types/src/components/FactViewer/FactViewer.stories.d.ts.map +1 -0
  7. package/dist/types/src/components/FactViewer/FactViewer.theme.d.ts +74 -0
  8. package/dist/types/src/components/FactViewer/FactViewer.theme.d.ts.map +1 -0
  9. package/dist/types/src/components/FactViewer/index.d.ts +2 -0
  10. package/dist/types/src/components/FactViewer/index.d.ts.map +1 -0
  11. package/dist/types/src/components/index.d.ts +2 -0
  12. package/dist/types/src/components/index.d.ts.map +1 -0
  13. package/dist/types/src/index.d.ts +1 -1
  14. package/dist/types/tsconfig.tsbuildinfo +1 -1
  15. package/package.json +12 -13
  16. package/src/{FactViewer.stories.tsx → components/FactViewer/FactViewer.stories.tsx} +15 -2
  17. package/src/components/FactViewer/FactViewer.theme.ts +51 -0
  18. package/src/components/FactViewer/FactViewer.tsx +289 -0
  19. package/src/components/FactViewer/index.ts +5 -0
  20. package/src/components/index.ts +5 -0
  21. package/src/index.ts +1 -1
  22. package/dist/lib/browser/index.mjs +0 -249
  23. package/dist/lib/browser/index.mjs.map +0 -7
  24. package/dist/lib/browser/meta.json +0 -1
  25. package/dist/lib/node-esm/index.mjs +0 -251
  26. package/dist/lib/node-esm/index.mjs.map +0 -7
  27. package/dist/lib/node-esm/meta.json +0 -1
  28. package/dist/types/src/FactViewer.d.ts +0 -18
  29. package/dist/types/src/FactViewer.d.ts.map +0 -1
  30. package/dist/types/src/FactViewer.stories.d.ts.map +0 -1
  31. package/src/FactViewer.tsx +0 -161
@@ -0,0 +1,338 @@
1
+ import { createContext, forwardRef, useContext, useMemo, useState } from "react";
2
+ import { buildFactGraph, factSourceFromFacts } from "@dxos/pipeline-rdf";
3
+ import { Icon, IconButton, Input, Panel, ScrollArea, Tag, Toolbar } from "@dxos/react-ui";
4
+ import { Tree } from "@dxos/react-ui-graph";
5
+ import { Empty, Listbox } from "@dxos/react-ui-list";
6
+ import { mx, tv } from "@dxos/ui-theme";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/types.ts
9
+ /** Group facts by subject entity and flag predicate-level conflicts within each group. */
10
+ var groupFacts = (facts, filter) => {
11
+ const needle = filter.trim().toLowerCase();
12
+ const filtered = needle ? facts.filter((fact) => {
13
+ const { subject, predicate, object } = fact.assertion;
14
+ return [
15
+ formatTerm(subject),
16
+ predicate,
17
+ formatTerm(object)
18
+ ].some((value) => value.toLowerCase().includes(needle));
19
+ }) : facts;
20
+ const bySubject = /* @__PURE__ */ new Map();
21
+ const labelByKey = /* @__PURE__ */ new Map();
22
+ for (const fact of filtered) {
23
+ const key = termKey(fact.assertion.subject);
24
+ const list = bySubject.get(key) ?? [];
25
+ list.push(fact);
26
+ bySubject.set(key, list);
27
+ if (!labelByKey.has(key)) labelByKey.set(key, formatTerm(fact.assertion.subject));
28
+ }
29
+ return [...bySubject.entries()].map(([key, groupFactsList]) => {
30
+ const subject = labelByKey.get(key) ?? key;
31
+ const byPredicate = /* @__PURE__ */ new Map();
32
+ for (const fact of groupFactsList) {
33
+ const list = byPredicate.get(fact.assertion.predicate) ?? [];
34
+ list.push(fact);
35
+ byPredicate.set(fact.assertion.predicate, list);
36
+ }
37
+ const conflictedIds = /* @__PURE__ */ new Set();
38
+ for (const list of byPredicate.values()) if (new Set(list.map((fact) => termKey(fact.assertion.object))).size > 1) for (const fact of list) conflictedIds.add(fact.id);
39
+ return {
40
+ subject,
41
+ facts: groupFactsList,
42
+ conflicted: conflictedIds.size > 0,
43
+ conflictedIds
44
+ };
45
+ });
46
+ };
47
+ /** The join/grouping key: the entity slug (or literal). Casing variants collapse to one key. */
48
+ var termKey = (term) => "entity" in term ? term.entity : term.literal;
49
+ /** Display form: the preserved surface label, else a prettified slug; literals render verbatim. */
50
+ var formatTerm = (term) => "entity" in term ? term.label ?? humanize(term.entity) : term.literal;
51
+ /**
52
+ * Convert a {@link FactGraph} into a rooted {@link TreeNode} hierarchy for the tidy-tree renderer.
53
+ * A fact graph is a general (cyclic) graph; the tidy tree needs a hierarchy, so this takes the BFS
54
+ * spanning tree from `rootId` over the undirected edges (each node appears once). Returns `undefined`
55
+ * if the root isn't in the graph.
56
+ */
57
+ var graphToTreeNode = (graph, rootId) => {
58
+ const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));
59
+ if (!nodeById.has(rootId)) return;
60
+ const adjacency = /* @__PURE__ */ new Map();
61
+ const link = (from, to) => {
62
+ const list = adjacency.get(from) ?? [];
63
+ list.push(to);
64
+ adjacency.set(from, list);
65
+ };
66
+ for (const edge of graph.edges) {
67
+ link(edge.source, edge.target);
68
+ link(edge.target, edge.source);
69
+ }
70
+ const visited = /* @__PURE__ */ new Set([rootId]);
71
+ const build = (id) => {
72
+ const children = [];
73
+ for (const neighbour of adjacency.get(id) ?? []) if (!visited.has(neighbour)) {
74
+ visited.add(neighbour);
75
+ children.push(build(neighbour));
76
+ }
77
+ return {
78
+ id,
79
+ label: nodeById.get(id)?.label ?? id,
80
+ ...children.length > 0 ? { children } : {}
81
+ };
82
+ };
83
+ return build(rootId);
84
+ };
85
+ /** Render ids like `q3-board-meeting` as `Q3 Board Meeting`. */
86
+ var humanize = (value) => value.replace(/[-_]/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
87
+ var formatDate = (iso) => iso.slice(0, 10);
88
+ /** Map FactBank factuality to a real react-ui palette member. */
89
+ var factualityColor = (factuality) => {
90
+ switch (factuality) {
91
+ case "CT+": return "emerald";
92
+ case "PR+": return "amber";
93
+ case "PS+": return "sky";
94
+ case "CT-":
95
+ case "PR-":
96
+ case "PS-": return "red";
97
+ default: return "neutral";
98
+ }
99
+ };
100
+ //#endregion
101
+ //#region src/components/FactViewer/FactViewer.tsx
102
+ var styles = { styles: tv({
103
+ slots: {
104
+ toolbarSpacer: "grow",
105
+ listViewport: "flex flex-col gap-2 py-1",
106
+ graphContent: "overflow-hidden",
107
+ graphTree: "w-full h-full",
108
+ group: "shrink-0 flex flex-col dx-card-surface border border-subdued-separator rounded-sm overflow-hidden",
109
+ groupHeader: "flex px-3 py-1 items-center justify-between",
110
+ groupConflict: "flex items-center gap-1",
111
+ row: "flex flex-col items-stretch gap-2 px-3 py-1",
112
+ rowQuote: "text-sm text-description italic",
113
+ rowGrid: "grid grid-cols-[1fr_5rem] items-center justify-between gap-2",
114
+ rowTriple: "w-full grid grid-cols-[1fr_1rem_1fr_1rem_1fr] items-center flex-wrap",
115
+ cell: "bg-input-surface border border-subdued-separator rounded-sm px-2 py-0.5 font-medium whitespace-nowrap truncate",
116
+ cellDivider: "border border-subdued-separator",
117
+ rowMeta: "flex items-center justify-end gap-2 shrink-0",
118
+ rowConfidence: "text-xs text-subdued",
119
+ rowAttribution: "text-xs text-subdued text-right"
120
+ },
121
+ variants: { conflicting: { true: { row: "border-is-2 border-warning-border" } } }
122
+ }) }.styles();
123
+ var FactViewerContext = createContext(null);
124
+ var useFactViewerContext = (consumer) => {
125
+ const context = useContext(FactViewerContext);
126
+ if (!context) throw new Error(`FactViewer.${consumer} must be rendered within FactViewer.Root`);
127
+ return context;
128
+ };
129
+ /**
130
+ * Viewer for extracted semantic facts with two views: a grouped **list** (by subject entity, with
131
+ * conflicts highlighted) and a **graph** (tidy tree rooted at the context entity). A `context` entity
132
+ * scopes the list and roots the graph; a `predicate` further filters the list. Pure/presentational.
133
+ *
134
+ * Renders a default toolbar + body when given no children; pass children to compose the parts
135
+ * (`FactViewer.Toolbar`, `FactViewer.List`, `FactViewer.Graph`) directly.
136
+ */
137
+ var FactViewerRoot = forwardRef(({ classNames, facts, context, predicate, children }, forwardedRef) => {
138
+ const [filter, setFilter] = useState("");
139
+ const [view, setView] = useState("list");
140
+ const scoped = useMemo(() => facts.filter((fact) => (context == null || termKey(fact.assertion.subject) === context || termKey(fact.assertion.object) === context) && (predicate == null || fact.assertion.predicate === predicate)), [
141
+ facts,
142
+ context,
143
+ predicate
144
+ ]);
145
+ const groups = useMemo(() => groupFacts(scoped, filter), [scoped, filter]);
146
+ const graph = useMemo(() => context == null ? void 0 : graphToTreeNode(buildFactGraph(context, factSourceFromFacts(facts)), context), [facts, context]);
147
+ const value = useMemo(() => ({
148
+ facts,
149
+ context,
150
+ predicate,
151
+ groups,
152
+ graph,
153
+ filter,
154
+ setFilter,
155
+ view,
156
+ setView
157
+ }), [
158
+ facts,
159
+ context,
160
+ predicate,
161
+ groups,
162
+ graph,
163
+ filter,
164
+ view
165
+ ]);
166
+ return /* @__PURE__ */ jsx(FactViewerContext.Provider, {
167
+ value,
168
+ children: /* @__PURE__ */ jsx(Panel.Root, {
169
+ classNames,
170
+ ref: forwardedRef,
171
+ children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FactViewerToolbar, {}), view === "list" ? /* @__PURE__ */ jsx(FactViewerList, {}) : /* @__PURE__ */ jsx(FactViewerGraph, {})] })
172
+ })
173
+ });
174
+ });
175
+ FactViewerRoot.displayName = "FactViewer.Root";
176
+ var FactViewerToolbar = ({ classNames }) => {
177
+ const { filter, setFilter, view, setView } = useFactViewerContext("Toolbar");
178
+ return /* @__PURE__ */ jsx(Panel.Toolbar, {
179
+ asChild: true,
180
+ children: /* @__PURE__ */ jsxs(Toolbar.Root, {
181
+ classNames,
182
+ children: [
183
+ /* @__PURE__ */ jsxs(Input.Root, { children: [/* @__PURE__ */ jsx(Input.Label, {
184
+ srOnly: true,
185
+ children: "Filter facts"
186
+ }), /* @__PURE__ */ jsx(Input.TextInput, {
187
+ placeholder: "Filter by entity or predicate…",
188
+ value: filter,
189
+ onChange: (event) => setFilter(event.target.value)
190
+ })] }),
191
+ /* @__PURE__ */ jsx("div", { className: styles.toolbarSpacer() }),
192
+ /* @__PURE__ */ jsx(IconButton, {
193
+ icon: "ph--list--regular",
194
+ iconOnly: true,
195
+ label: "List view",
196
+ variant: view === "list" ? "primary" : "default",
197
+ onClick: () => setView("list")
198
+ }),
199
+ /* @__PURE__ */ jsx(IconButton, {
200
+ icon: "ph--graph--regular",
201
+ iconOnly: true,
202
+ label: "Graph view",
203
+ variant: view === "graph" ? "primary" : "default",
204
+ onClick: () => setView("graph")
205
+ })
206
+ ]
207
+ })
208
+ });
209
+ };
210
+ FactViewerToolbar.displayName = "FactViewer.Toolbar";
211
+ var FactViewerList = ({ classNames }) => {
212
+ const { groups } = useFactViewerContext("List");
213
+ return /* @__PURE__ */ jsx(Panel.Content, {
214
+ asChild: true,
215
+ children: /* @__PURE__ */ jsx(ScrollArea.Root, {
216
+ padding: true,
217
+ classNames,
218
+ children: /* @__PURE__ */ jsxs(ScrollArea.Viewport, {
219
+ classNames: styles.listViewport(),
220
+ children: [groups.length === 0 && /* @__PURE__ */ jsx(Empty, { label: "No facts." }), groups.map((group) => /* @__PURE__ */ jsx(FactViewerGroup, { group }, group.subject))]
221
+ })
222
+ })
223
+ });
224
+ };
225
+ FactViewerList.displayName = "FactViewer.List";
226
+ var FactViewerGraph = ({ classNames }) => {
227
+ const { graph } = useFactViewerContext("Graph");
228
+ return /* @__PURE__ */ jsx(Panel.Content, {
229
+ classNames: mx(styles.graphContent(), classNames),
230
+ children: graph ? /* @__PURE__ */ jsx(Tree, {
231
+ data: graph,
232
+ variant: "tidy",
233
+ margin: 80,
234
+ classNames: styles.graphTree()
235
+ }) : /* @__PURE__ */ jsx(Empty, {
236
+ icon: "ph--graph--regular",
237
+ label: "Select an entity to root the graph."
238
+ })
239
+ });
240
+ };
241
+ FactViewerGraph.displayName = "FactViewer.Graph";
242
+ var FactViewerGroup = forwardRef(({ classNames, group }, forwardedRef) => /* @__PURE__ */ jsxs("div", {
243
+ className: styles.group({ class: mx(classNames) }),
244
+ ref: forwardedRef,
245
+ children: [/* @__PURE__ */ jsxs("div", {
246
+ className: styles.groupHeader(),
247
+ children: [/* @__PURE__ */ jsx("h3", { children: group.subject }), group.conflicted && /* @__PURE__ */ jsx(Tag, {
248
+ hue: "warning",
249
+ children: /* @__PURE__ */ jsxs("span", {
250
+ className: styles.groupConflict(),
251
+ children: [/* @__PURE__ */ jsx(Icon, {
252
+ icon: "ph--warning--regular",
253
+ size: 3
254
+ }), "conflict"]
255
+ })
256
+ })]
257
+ }), /* @__PURE__ */ jsx(Listbox.Root, { children: /* @__PURE__ */ jsx(Listbox.Content, {
258
+ "aria-label": group.subject,
259
+ children: group.facts.map((fact) => /* @__PURE__ */ jsx(FactViewerRow, {
260
+ fact,
261
+ conflicting: group.conflictedIds.has(fact.id)
262
+ }, fact.id))
263
+ }) })]
264
+ }));
265
+ FactViewerGroup.displayName = "FactViewer.Group";
266
+ var FactViewerRow = forwardRef(({ classNames, fact, conflicting }, forwardedRef) => {
267
+ const { assertion, factuality, attribution } = fact;
268
+ return /* @__PURE__ */ jsxs(Listbox.Item, {
269
+ id: fact.id,
270
+ classNames: styles.row({
271
+ conflicting,
272
+ class: mx(classNames)
273
+ }),
274
+ ref: forwardedRef,
275
+ children: [
276
+ assertion.quote && /* @__PURE__ */ jsxs("div", {
277
+ className: styles.rowQuote(),
278
+ children: [
279
+ "\"",
280
+ assertion.quote,
281
+ "\""
282
+ ]
283
+ }),
284
+ /* @__PURE__ */ jsxs("div", {
285
+ className: styles.rowGrid(),
286
+ children: [/* @__PURE__ */ jsxs("div", {
287
+ className: styles.rowTriple(),
288
+ children: [
289
+ /* @__PURE__ */ jsx("span", {
290
+ className: styles.cell({ class: "text-right" }),
291
+ children: formatTerm(assertion.subject)
292
+ }),
293
+ /* @__PURE__ */ jsx("span", { className: styles.cellDivider() }),
294
+ /* @__PURE__ */ jsx("span", {
295
+ className: styles.cell({ class: "text-center text-description" }),
296
+ children: assertion.predicate
297
+ }),
298
+ /* @__PURE__ */ jsx("span", { className: styles.cellDivider() }),
299
+ /* @__PURE__ */ jsx("span", {
300
+ className: styles.cell(),
301
+ children: formatTerm(assertion.object)
302
+ })
303
+ ]
304
+ }), /* @__PURE__ */ jsxs("div", {
305
+ className: styles.rowMeta(),
306
+ children: [factuality.confidence != null && /* @__PURE__ */ jsxs("span", {
307
+ className: styles.rowConfidence(),
308
+ children: [Math.round(factuality.confidence * 100), "%"]
309
+ }), /* @__PURE__ */ jsx(Tag, {
310
+ hue: factualityColor(factuality.value),
311
+ children: factuality.value
312
+ })]
313
+ })]
314
+ }),
315
+ /* @__PURE__ */ jsx("div", {
316
+ className: styles.rowAttribution(),
317
+ children: [
318
+ attribution.agent,
319
+ attribution.source,
320
+ formatDate(attribution.generatedAtTime)
321
+ ].filter(Boolean).join(" · ")
322
+ })
323
+ ]
324
+ });
325
+ });
326
+ FactViewerRow.displayName = "FactViewer.Row";
327
+ var FactViewer = {
328
+ Root: FactViewerRoot,
329
+ Toolbar: FactViewerToolbar,
330
+ List: FactViewerList,
331
+ Graph: FactViewerGraph,
332
+ Group: FactViewerGroup,
333
+ Row: FactViewerRow
334
+ };
335
+ //#endregion
336
+ export { FactViewer, factualityColor, formatDate, formatTerm, graphToTreeNode, groupFacts, humanize, termKey };
337
+
338
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/types.ts","../../src/components/FactViewer/FactViewer.theme.ts","../../src/components/FactViewer/FactViewer.tsx"],"sourcesContent":["//\n// Copyright 2026 DXOS.org\n//\n\nimport { type FactGraph, type RDF } from '@dxos/pipeline-rdf';\nimport { type TreeNode } from '@dxos/react-ui-graph';\nimport { type ChromaticPalette, type MessageValence, type NeutralPalette } from '@dxos/ui-types';\n\nexport type Group = {\n subject: string;\n facts: RDF.Fact[];\n conflicted: boolean;\n conflictedIds: Set<string>;\n};\n\n/** Group facts by subject entity and flag predicate-level conflicts within each group. */\nexport const groupFacts = (facts: RDF.Fact[], filter: string): Group[] => {\n const needle = filter.trim().toLowerCase();\n const filtered = needle\n ? facts.filter((fact) => {\n const { subject, predicate, object } = fact.assertion;\n return [formatTerm(subject), predicate, formatTerm(object)].some((value) =>\n value.toLowerCase().includes(needle),\n );\n })\n : facts;\n\n // Group by the entity slug (so `DXOS`/`dxos` collapse) but remember a display label for the header.\n const bySubject = new Map<string, RDF.Fact[]>();\n const labelByKey = new Map<string, string>();\n for (const fact of filtered) {\n const key = termKey(fact.assertion.subject);\n const list = bySubject.get(key) ?? [];\n list.push(fact);\n bySubject.set(key, list);\n if (!labelByKey.has(key)) {\n labelByKey.set(key, formatTerm(fact.assertion.subject));\n }\n }\n\n return [...bySubject.entries()].map(([key, groupFactsList]) => {\n const subject = labelByKey.get(key) ?? key;\n const byPredicate = new Map<string, RDF.Fact[]>();\n for (const fact of groupFactsList) {\n const list = byPredicate.get(fact.assertion.predicate) ?? [];\n list.push(fact);\n byPredicate.set(fact.assertion.predicate, list);\n }\n\n const conflictedIds = new Set<string>();\n for (const list of byPredicate.values()) {\n const objects = new Set(list.map((fact) => termKey(fact.assertion.object)));\n if (objects.size > 1) {\n for (const fact of list) {\n conflictedIds.add(fact.id);\n }\n }\n }\n\n return {\n subject,\n facts: groupFactsList,\n conflicted: conflictedIds.size > 0,\n conflictedIds,\n };\n });\n};\n\n/** The join/grouping key: the entity slug (or literal). Casing variants collapse to one key. */\nexport const termKey = (term: RDF.Term): string => ('entity' in term ? term.entity : term.literal);\n\n/** Display form: the preserved surface label, else a prettified slug; literals render verbatim. */\nexport const formatTerm = (term: RDF.Term): string =>\n 'entity' in term ? (term.label ?? humanize(term.entity)) : term.literal;\n\n/**\n * Convert a {@link FactGraph} into a rooted {@link TreeNode} hierarchy for the tidy-tree renderer.\n * A fact graph is a general (cyclic) graph; the tidy tree needs a hierarchy, so this takes the BFS\n * spanning tree from `rootId` over the undirected edges (each node appears once). Returns `undefined`\n * if the root isn't in the graph.\n */\nexport const graphToTreeNode = (graph: FactGraph, rootId: string): TreeNode | undefined => {\n const nodeById = new Map(graph.nodes.map((node) => [node.id, node]));\n if (!nodeById.has(rootId)) {\n return undefined;\n }\n const adjacency = new Map<string, string[]>();\n const link = (from: string, to: string) => {\n const list = adjacency.get(from) ?? [];\n list.push(to);\n adjacency.set(from, list);\n };\n for (const edge of graph.edges) {\n link(edge.source, edge.target);\n link(edge.target, edge.source);\n }\n\n const visited = new Set<string>([rootId]);\n const build = (id: string): TreeNode => {\n const children: TreeNode[] = [];\n for (const neighbour of adjacency.get(id) ?? []) {\n if (!visited.has(neighbour)) {\n visited.add(neighbour);\n children.push(build(neighbour));\n }\n }\n return { id, label: nodeById.get(id)?.label ?? id, ...(children.length > 0 ? { children } : {}) };\n };\n return build(rootId);\n};\n\n/** Render ids like `q3-board-meeting` as `Q3 Board Meeting`. */\nexport const humanize = (value: string): string =>\n value.replace(/[-_]/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase());\n\nexport const formatDate = (iso: string): string => iso.slice(0, 10);\n\n/** Map FactBank factuality to a real react-ui palette member. */\nexport const factualityColor = (\n factuality: RDF.FactualityValue,\n): NeutralPalette | ChromaticPalette | MessageValence => {\n switch (factuality) {\n case 'CT+':\n return 'emerald';\n case 'PR+':\n return 'amber';\n case 'PS+':\n return 'sky';\n case 'CT-':\n case 'PR-':\n case 'PS-':\n return 'red';\n case 'CTu':\n case 'Uu':\n default:\n return 'neutral';\n }\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport { tv } from '@dxos/ui-theme';\n\n/**\n * Tailwind-variants theme for the {@link FactViewer} composite. Consumers call\n * `factViewerTheme.styles()` for the per-slot class functions; each accepts an optional\n * `{ class: … }` override for per-instance merging (mirrors the react-ui-list theme pattern).\n */\nconst factViewerStyles = tv({\n slots: {\n // Toolbar spacer pushing the view toggles to the inline-end edge.\n toolbarSpacer: 'grow',\n\n // List view.\n listViewport: 'flex flex-col gap-2 py-1',\n\n // Graph view.\n graphContent: 'overflow-hidden',\n graphTree: 'w-full h-full',\n\n // Subject group card.\n group: 'shrink-0 flex flex-col dx-card-surface border border-subdued-separator rounded-sm overflow-hidden',\n groupHeader: 'flex px-3 py-1 items-center justify-between',\n groupConflict: 'flex items-center gap-1',\n\n // Fact row.\n row: 'flex flex-col items-stretch gap-2 px-3 py-1',\n rowQuote: 'text-sm text-description italic',\n rowGrid: 'grid grid-cols-[1fr_5rem] items-center justify-between gap-2',\n rowTriple: 'w-full grid grid-cols-[1fr_1rem_1fr_1rem_1fr] items-center flex-wrap',\n cell: 'bg-input-surface border border-subdued-separator rounded-sm px-2 py-0.5 font-medium whitespace-nowrap truncate',\n cellDivider: 'border border-subdued-separator',\n rowMeta: 'flex items-center justify-end gap-2 shrink-0',\n rowConfidence: 'text-xs text-subdued',\n rowAttribution: 'text-xs text-subdued text-right',\n },\n variants: {\n // Conflicting facts get a warning rule on the inline-start edge.\n conflicting: {\n true: { row: 'border-is-2 border-warning-border' },\n },\n },\n});\n\n/** react-ui-rdf FactViewer theme: call `.styles()` for per-slot class functions. */\nexport const factViewerTheme = {\n styles: factViewerStyles,\n};\n","//\n// Copyright 2026 DXOS.org\n//\n\nimport React, { type ReactNode, createContext, forwardRef, useContext, useMemo, useState } from 'react';\n\nimport { type RDF, buildFactGraph, factSourceFromFacts } from '@dxos/pipeline-rdf';\nimport { Icon, IconButton, Input, Panel, ScrollArea, Tag, type ThemedClassName, Toolbar } from '@dxos/react-ui';\nimport { Tree } from '@dxos/react-ui-graph';\nimport { Empty, Listbox } from '@dxos/react-ui-list';\nimport { mx } from '@dxos/ui-theme';\n\nimport { type Group, factualityColor, formatDate, formatTerm, graphToTreeNode, groupFacts, termKey } from '../../types';\nimport { factViewerTheme } from './FactViewer.theme';\n\nconst styles = factViewerTheme.styles();\n\ntype View = 'list' | 'graph';\n\n//\n// Context\n//\n\ntype FactViewerContextValue = {\n facts: RDF.Fact[];\n context?: string;\n predicate?: string;\n groups: Group[];\n graph: ReturnType<typeof graphToTreeNode> | undefined;\n filter: string;\n setFilter: (value: string) => void;\n view: View;\n setView: (view: View) => void;\n};\n\nconst FactViewerContext = createContext<FactViewerContextValue | null>(null);\n\nconst useFactViewerContext = (consumer: string): FactViewerContextValue => {\n const context = useContext(FactViewerContext);\n if (!context) {\n throw new Error(`FactViewer.${consumer} must be rendered within FactViewer.Root`);\n }\n return context;\n};\n\n//\n// Root\n//\n\ntype FactViewerRootProps = ThemedClassName<{\n facts: RDF.Fact[];\n /** Context entity id; scopes the list and roots the graph. */\n context?: string;\n /** Predicate filter; when set, only facts with this predicate are shown. */\n predicate?: string;\n /** Custom composition; when omitted the default toolbar + list/graph body is rendered. */\n children?: ReactNode;\n}>;\n\n/**\n * Viewer for extracted semantic facts with two views: a grouped **list** (by subject entity, with\n * conflicts highlighted) and a **graph** (tidy tree rooted at the context entity). A `context` entity\n * scopes the list and roots the graph; a `predicate` further filters the list. Pure/presentational.\n *\n * Renders a default toolbar + body when given no children; pass children to compose the parts\n * (`FactViewer.Toolbar`, `FactViewer.List`, `FactViewer.Graph`) directly.\n */\nconst FactViewerRoot = forwardRef<HTMLDivElement, FactViewerRootProps>(\n ({ classNames, facts, context, predicate, children }, forwardedRef) => {\n const [filter, setFilter] = useState('');\n const [view, setView] = useState<View>('list');\n const scoped = useMemo(\n () =>\n facts.filter(\n (fact) =>\n (context == null ||\n termKey(fact.assertion.subject) === context ||\n termKey(fact.assertion.object) === context) &&\n (predicate == null || fact.assertion.predicate === predicate),\n ),\n [facts, context, predicate],\n );\n const groups = useMemo(() => groupFacts(scoped, filter), [scoped, filter]);\n const graph = useMemo(\n () =>\n context == null ? undefined : graphToTreeNode(buildFactGraph(context, factSourceFromFacts(facts)), context),\n [facts, context],\n );\n\n const value = useMemo<FactViewerContextValue>(\n () => ({ facts, context, predicate, groups, graph, filter, setFilter, view, setView }),\n [facts, context, predicate, groups, graph, filter, view],\n );\n\n return (\n <FactViewerContext.Provider value={value}>\n <Panel.Root classNames={classNames} ref={forwardedRef}>\n {children ?? (\n <>\n <FactViewerToolbar />\n {view === 'list' ? <FactViewerList /> : <FactViewerGraph />}\n </>\n )}\n </Panel.Root>\n </FactViewerContext.Provider>\n );\n },\n);\n\nFactViewerRoot.displayName = 'FactViewer.Root';\n\n//\n// Toolbar\n//\n\ntype FactViewerToolbarProps = ThemedClassName<{}>;\n\nconst FactViewerToolbar = ({ classNames }: FactViewerToolbarProps) => {\n const { filter, setFilter, view, setView } = useFactViewerContext('Toolbar');\n return (\n <Panel.Toolbar asChild>\n <Toolbar.Root classNames={classNames}>\n <Input.Root>\n <Input.Label srOnly>Filter facts</Input.Label>\n <Input.TextInput\n placeholder='Filter by entity or predicate…'\n value={filter}\n onChange={(event) => setFilter(event.target.value)}\n />\n </Input.Root>\n <div className={styles.toolbarSpacer()} />\n <IconButton\n icon='ph--list--regular'\n iconOnly\n label='List view'\n variant={view === 'list' ? 'primary' : 'default'}\n onClick={() => setView('list')}\n />\n <IconButton\n icon='ph--graph--regular'\n iconOnly\n label='Graph view'\n variant={view === 'graph' ? 'primary' : 'default'}\n onClick={() => setView('graph')}\n />\n </Toolbar.Root>\n </Panel.Toolbar>\n );\n};\n\nFactViewerToolbar.displayName = 'FactViewer.Toolbar';\n\n//\n// List\n//\n\ntype FactViewerListProps = ThemedClassName<{}>;\n\nconst FactViewerList = ({ classNames }: FactViewerListProps) => {\n const { groups } = useFactViewerContext('List');\n return (\n <Panel.Content asChild>\n <ScrollArea.Root padding classNames={classNames}>\n <ScrollArea.Viewport classNames={styles.listViewport()}>\n {groups.length === 0 && <Empty label='No facts.' />}\n {groups.map((group) => (\n <FactViewerGroup key={group.subject} group={group} />\n ))}\n </ScrollArea.Viewport>\n </ScrollArea.Root>\n </Panel.Content>\n );\n};\n\nFactViewerList.displayName = 'FactViewer.List';\n\n//\n// Graph\n//\n\ntype FactViewerGraphProps = ThemedClassName<{}>;\n\nconst FactViewerGraph = ({ classNames }: FactViewerGraphProps) => {\n const { graph } = useFactViewerContext('Graph');\n return (\n <Panel.Content classNames={mx(styles.graphContent(), classNames)}>\n {graph ? (\n <Tree data={graph} variant='tidy' margin={80} classNames={styles.graphTree()} />\n ) : (\n <Empty icon='ph--graph--regular' label='Select an entity to root the graph.' />\n )}\n </Panel.Content>\n );\n};\n\nFactViewerGraph.displayName = 'FactViewer.Graph';\n\n//\n// Group\n//\n\ntype FactViewerGroupProps = ThemedClassName<{ group: Group }>;\n\nconst FactViewerGroup = forwardRef<HTMLDivElement, FactViewerGroupProps>(({ classNames, group }, forwardedRef) => (\n <div className={styles.group({ class: mx(classNames) })} ref={forwardedRef}>\n <div className={styles.groupHeader()}>\n <h3>{group.subject}</h3>\n {group.conflicted && (\n <Tag hue='warning'>\n <span className={styles.groupConflict()}>\n <Icon icon='ph--warning--regular' size={3} />\n conflict\n </span>\n </Tag>\n )}\n </div>\n <Listbox.Root>\n <Listbox.Content aria-label={group.subject}>\n {group.facts.map((fact) => (\n <FactViewerRow key={fact.id} fact={fact} conflicting={group.conflictedIds.has(fact.id)} />\n ))}\n </Listbox.Content>\n </Listbox.Root>\n </div>\n));\n\nFactViewerGroup.displayName = 'FactViewer.Group';\n\n//\n// Row\n//\n\ntype FactViewerRowProps = ThemedClassName<{ fact: RDF.Fact; conflicting?: boolean }>;\n\nconst FactViewerRow = forwardRef<HTMLLIElement, FactViewerRowProps>(\n ({ classNames, fact, conflicting }, forwardedRef) => {\n const { assertion, factuality, attribution } = fact;\n return (\n <Listbox.Item id={fact.id} classNames={styles.row({ conflicting, class: mx(classNames) })} ref={forwardedRef}>\n {assertion.quote && <div className={styles.rowQuote()}>\"{assertion.quote}\"</div>}\n\n <div className={styles.rowGrid()}>\n <div className={styles.rowTriple()}>\n <span className={styles.cell({ class: 'text-right' })}>{formatTerm(assertion.subject)}</span>\n <span className={styles.cellDivider()} />\n <span className={styles.cell({ class: 'text-center text-description' })}>{assertion.predicate}</span>\n <span className={styles.cellDivider()} />\n <span className={styles.cell()}>{formatTerm(assertion.object)}</span>\n </div>\n\n <div className={styles.rowMeta()}>\n {factuality.confidence != null && (\n <span className={styles.rowConfidence()}>{Math.round(factuality.confidence * 100)}%</span>\n )}\n <Tag hue={factualityColor(factuality.value)}>{factuality.value}</Tag>\n </div>\n </div>\n\n <div className={styles.rowAttribution()}>\n {[attribution.agent, attribution.source, formatDate(attribution.generatedAtTime)].filter(Boolean).join(' · ')}\n </div>\n </Listbox.Item>\n );\n },\n);\n\nFactViewerRow.displayName = 'FactViewer.Row';\n\n//\n// FactViewer\n//\n\nexport const FactViewer = {\n Root: FactViewerRoot,\n Toolbar: FactViewerToolbar,\n List: FactViewerList,\n Graph: FactViewerGraph,\n Group: FactViewerGroup,\n Row: FactViewerRow,\n};\n\nexport type {\n FactViewerGraphProps,\n FactViewerGroupProps,\n FactViewerListProps,\n FactViewerRootProps,\n FactViewerRowProps,\n FactViewerToolbarProps,\n};\n"],"mappings":";;;;;;;;;AAgBA,IAAa,cAAc,OAAmB,WAA4B;CACxE,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,YAAY;CACzC,MAAM,WAAW,SACb,MAAM,QAAQ,SAAS;EACrB,MAAM,EAAE,SAAS,WAAW,WAAW,KAAK;EAC5C,OAAO;GAAC,WAAW,OAAO;GAAG;GAAW,WAAW,MAAM;EAAC,CAAC,CAAC,MAAM,UAChE,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CACrC;CACF,CAAC,IACD;CAGJ,MAAM,4BAAY,IAAI,IAAwB;CAC9C,MAAM,6BAAa,IAAI,IAAoB;CAC3C,KAAK,MAAM,QAAQ,UAAU;EAC3B,MAAM,MAAM,QAAQ,KAAK,UAAU,OAAO;EAC1C,MAAM,OAAO,UAAU,IAAI,GAAG,KAAK,CAAC;EACpC,KAAK,KAAK,IAAI;EACd,UAAU,IAAI,KAAK,IAAI;EACvB,IAAI,CAAC,WAAW,IAAI,GAAG,GACrB,WAAW,IAAI,KAAK,WAAW,KAAK,UAAU,OAAO,CAAC;CAE1D;CAEA,OAAO,CAAC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AAK,EAAE,OAAO,aAAa,CAAC;iBAAI,WAAW,UAAU,OAAO;MAAQ,CAAA;MAC5F,oBAAC,QAAD,EAAM,WAAW,OAAO,YAAY,EAAI,CAAA;MACxC,oBAAC,QAAD;OAAM,WAAW,OAAO,KAAK,EAAE,OAAO,+BAA+B,CAAC;iBAAI,UAAU;MAAgB,CAAA;MACpG,oBAAC,QAAD,EAAM,WAAW,OAAO,YAAY,EAAI,CAAA;MACxC,oBAAC,QAAD;OAAM,WAAW,OAAO,KAAK;iBAAI,WAAW,UAAU,MAAM;MAAQ,CAAA;KACjE;QAEL,qBAAC,OAAD;KAAK,WAAW,OAAO,QAAQ;eAA/B,CACG,WAAW,cAAc,QACxB,qBAAC,QAAD;MAAM,WAAW,OAAO,cAAc;gBAAtC,CAA0C,KAAK,MAAM,WAAW,aAAa,GAAG,GAAE,GAAO;SAE3F,oBAAC,KAAD;MAAK,KAAK,gBAAgB,WAAW,KAAK;gBAAI,WAAW;KAAW,CAAA,CACjE;MACF;;GAEL,oBAAC,OAAD;IAAK,WAAW,OAAO,eAAe;cACnC;KAAC,YAAY;KAAO,YAAY;KAAQ,WAAW,YAAY,eAAe;IAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;GACzG,CAAA;EACO;;AAElB,CACF;AAEA,cAAc,cAAc;AAM5B,IAAa,aAAa;CACxB,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,OAAO;CACP,KAAK;AACP"}
@@ -0,0 +1,73 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type RDF } from '@dxos/pipeline-rdf';
3
+ import { type ThemedClassName } from '@dxos/react-ui';
4
+ import { type Group } from '../../types';
5
+ type FactViewerRootProps = ThemedClassName<{
6
+ facts: RDF.Fact[];
7
+ /** Context entity id; scopes the list and roots the graph. */
8
+ context?: string;
9
+ /** Predicate filter; when set, only facts with this predicate are shown. */
10
+ predicate?: string;
11
+ /** Custom composition; when omitted the default toolbar + list/graph body is rendered. */
12
+ children?: ReactNode;
13
+ }>;
14
+ type FactViewerToolbarProps = ThemedClassName<{}>;
15
+ declare function FactViewerToolbar({ classNames }: FactViewerToolbarProps): React.JSX.Element;
16
+ declare namespace FactViewerToolbar {
17
+ var displayName: string;
18
+ }
19
+ type FactViewerListProps = ThemedClassName<{}>;
20
+ declare function FactViewerList({ classNames }: FactViewerListProps): React.JSX.Element;
21
+ declare namespace FactViewerList {
22
+ var displayName: string;
23
+ }
24
+ type FactViewerGraphProps = ThemedClassName<{}>;
25
+ declare function FactViewerGraph({ classNames }: FactViewerGraphProps): React.JSX.Element;
26
+ declare namespace FactViewerGraph {
27
+ var displayName: string;
28
+ }
29
+ type FactViewerGroupProps = ThemedClassName<{
30
+ group: Group;
31
+ }>;
32
+ type FactViewerRowProps = ThemedClassName<{
33
+ fact: RDF.Fact;
34
+ conflicting?: boolean;
35
+ }>;
36
+ export declare const FactViewer: {
37
+ Root: React.ForwardRefExoticComponent<Omit<{
38
+ facts: RDF.Fact[];
39
+ /** Context entity id; scopes the list and roots the graph. */
40
+ context?: string;
41
+ /** Predicate filter; when set, only facts with this predicate are shown. */
42
+ predicate?: string;
43
+ /** Custom composition; when omitted the default toolbar + list/graph body is rendered. */
44
+ children?: ReactNode;
45
+ }, "className"> & {
46
+ classNames?: import("@dxos/ui-types").ClassNameValue;
47
+ } & React.RefAttributes<HTMLDivElement>>;
48
+ Toolbar: {
49
+ ({ classNames }: FactViewerToolbarProps): React.JSX.Element;
50
+ displayName: string;
51
+ };
52
+ List: {
53
+ ({ classNames }: FactViewerListProps): React.JSX.Element;
54
+ displayName: string;
55
+ };
56
+ Graph: {
57
+ ({ classNames }: FactViewerGraphProps): React.JSX.Element;
58
+ displayName: string;
59
+ };
60
+ Group: React.ForwardRefExoticComponent<Omit<{
61
+ group: Group;
62
+ }, "className"> & {
63
+ classNames?: import("@dxos/ui-types").ClassNameValue;
64
+ } & React.RefAttributes<HTMLDivElement>>;
65
+ Row: React.ForwardRefExoticComponent<Omit<{
66
+ fact: RDF.Fact;
67
+ conflicting?: boolean;
68
+ }, "className"> & {
69
+ classNames?: import("@dxos/ui-types").ClassNameValue;
70
+ } & React.RefAttributes<HTMLLIElement>>;
71
+ };
72
+ export type { FactViewerGraphProps, FactViewerGroupProps, FactViewerListProps, FactViewerRootProps, FactViewerRowProps, FactViewerToolbarProps, };
73
+ //# sourceMappingURL=FactViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FactViewer.d.ts","sourceRoot":"","sources":["../../../../../src/components/FactViewer/FactViewer.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAA4D,MAAM,OAAO,CAAC;AAExG,OAAO,EAAE,KAAK,GAAG,EAAuC,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAmD,KAAK,eAAe,EAAW,MAAM,gBAAgB,CAAC;AAKhH,OAAO,EAAE,KAAK,KAAK,EAAiF,MAAM,aAAa,CAAC;AAqCxH,KAAK,mBAAmB,GAAG,eAAe,CAAC;IACzC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;IAClB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC,CAAC;AA0DH,KAAK,sBAAsB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;mCAEvB,EAAE,UAAU,EAAE,EAAE,sBAAsB;;;;AAuCjE,KAAK,mBAAmB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;gCAEvB,EAAE,UAAU,EAAE,EAAE,mBAAmB;;;;AAsB3D,KAAK,oBAAoB,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;iCAEvB,EAAE,UAAU,EAAE,EAAE,oBAAoB;;;;AAmB7D,KAAK,oBAAoB,GAAG,eAAe,CAAC;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AA+B9D,KAAK,kBAAkB,GAAG,eAAe,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAwCrF,eAAO,MAAM,UAAU;IACrB,IAAI;eA/NG,GAAG,CAAC,IAAI,EAAE;QACjB,8DAA8D;kBACpD,MAAM;QAChB,4EAA4E;oBAChE,MAAM;QAClB,0FAA0F;mBAC/E,SAAS;;;;IA0NpB,OAAO;yBA7JkC,sBAAsB;;;IA8J/D,IAAI;yBArHkC,mBAAmB;;;IAsHzD,KAAK;yBA9FkC,oBAAoB;;;IA+F3D,KAAK;eA5E8C,KAAK;;;;IA6ExD,GAAG;cA9C6C,GAAG,CAAC,IAAI;sBAAgB,OAAO;;;;CA+ChF,CAAC;AAEF,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,CAAC"}
@@ -8,14 +8,16 @@
8
8
  */
9
9
  import { type StoryObj } from '@storybook/react-vite';
10
10
  import React from 'react';
11
- import { type FactViewerProps } from './FactViewer';
11
+ import { type FactViewerRootProps } from './FactViewer';
12
12
  declare const meta: {
13
13
  title: string;
14
- render: (props: FactViewerProps) => React.JSX.Element;
14
+ render: (props: FactViewerRootProps) => React.JSX.Element;
15
15
  decorators: import("@storybook/react").Decorator[];
16
16
  };
17
17
  export default meta;
18
18
  type Story = StoryObj<typeof meta>;
19
19
  export declare const Default: Story;
20
20
  export declare const Empty: Story;
21
+ /** Explicit composition of the parts (`FactViewer.Toolbar` + `FactViewer.List`) under `FactViewer.Root`. */
22
+ export declare const Composed: Story;
21
23
  //# sourceMappingURL=FactViewer.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FactViewer.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/FactViewer/FactViewer.stories.tsx"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAc,KAAK,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAyEpE,QAAA,MAAM,IAAI;;oBAFmB,mBAAmB;;CAMX,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAInB,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,QAAQ,EAAE,KAUtB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /** react-ui-rdf FactViewer theme: call `.styles()` for per-slot class functions. */
2
+ export declare const factViewerTheme: {
3
+ styles: import("tailwind-variants").TVReturnType<{
4
+ conflicting: {
5
+ true: {
6
+ row: string;
7
+ };
8
+ };
9
+ }, {
10
+ toolbarSpacer: string;
11
+ listViewport: string;
12
+ graphContent: string;
13
+ graphTree: string;
14
+ group: string;
15
+ groupHeader: string;
16
+ groupConflict: string;
17
+ row: string;
18
+ rowQuote: string;
19
+ rowGrid: string;
20
+ rowTriple: string;
21
+ cell: string;
22
+ cellDivider: string;
23
+ rowMeta: string;
24
+ rowConfidence: string;
25
+ rowAttribution: string;
26
+ }, undefined, {
27
+ conflicting: {
28
+ true: {
29
+ row: string;
30
+ };
31
+ };
32
+ }, {
33
+ toolbarSpacer: string;
34
+ listViewport: string;
35
+ graphContent: string;
36
+ graphTree: string;
37
+ group: string;
38
+ groupHeader: string;
39
+ groupConflict: string;
40
+ row: string;
41
+ rowQuote: string;
42
+ rowGrid: string;
43
+ rowTriple: string;
44
+ cell: string;
45
+ cellDivider: string;
46
+ rowMeta: string;
47
+ rowConfidence: string;
48
+ rowAttribution: string;
49
+ }, import("tailwind-variants").TVReturnType<{
50
+ conflicting: {
51
+ true: {
52
+ row: string;
53
+ };
54
+ };
55
+ }, {
56
+ toolbarSpacer: string;
57
+ listViewport: string;
58
+ graphContent: string;
59
+ graphTree: string;
60
+ group: string;
61
+ groupHeader: string;
62
+ groupConflict: string;
63
+ row: string;
64
+ rowQuote: string;
65
+ rowGrid: string;
66
+ rowTriple: string;
67
+ cell: string;
68
+ cellDivider: string;
69
+ rowMeta: string;
70
+ rowConfidence: string;
71
+ rowAttribution: string;
72
+ }, undefined, unknown, unknown, undefined>>;
73
+ };
74
+ //# sourceMappingURL=FactViewer.theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FactViewer.theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/FactViewer/FactViewer.theme.ts"],"names":[],"mappings":"AA+CA,oFAAoF;AACpF,eAAO,MAAM,eAAe;IAC1B,MAAM;;YAPF,IAAI;gBAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQhB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './FactViewer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/FactViewer/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './FactViewer';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC"}
@@ -1,3 +1,3 @@
1
- export * from './FactViewer';
1
+ export * from './components';
2
2
  export * from './types';
3
3
  //# sourceMappingURL=index.d.ts.map