@anvia/react-ui 1.0.9 → 1.0.11
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/README.md +49 -1
- package/dist/attachment/index.js +2 -2
- package/dist/chat/index.js +4 -4
- package/dist/{chunk-MISX4WUT.js → chunk-22EZJUPM.js} +2 -2
- package/dist/{chunk-XC7K4XYM.js → chunk-DLBNFBXQ.js} +2 -2
- package/dist/{chunk-SOG2GVE4.js → chunk-E73S3SOF.js} +102 -55
- package/dist/chunk-E73S3SOF.js.map +1 -0
- package/dist/{chunk-S4XLE2RN.js → chunk-HGOPGZNQ.js} +2 -2
- package/dist/{chunk-UCBAG42A.js → chunk-KHB5CHAU.js} +2 -2
- package/dist/{chunk-647LAYRV.js → chunk-LHABOAOP.js} +2 -2
- package/dist/{chunk-OQE6SHZE.js → chunk-N5XQU36W.js} +2 -2
- package/dist/{chunk-HWJIMLHC.js → chunk-UAPCHIJI.js} +4 -4
- package/dist/{chunk-CRXNFZRW.js → chunk-Y4JLSCT7.js} +3 -3
- package/dist/completion/index.js +2 -2
- package/dist/graph-explorer/index.d.ts +77 -0
- package/dist/graph-explorer/index.js +261 -0
- package/dist/graph-explorer/index.js.map +1 -0
- package/dist/human-input/index.js +2 -2
- package/dist/image/index.js +2 -2
- package/dist/index.js +15 -15
- package/dist/message/index.js +3 -3
- package/dist/selection-toolbar/index.js +2 -2
- package/dist/shared.js +1 -1
- package/dist/thread-list/index.js +2 -2
- package/package.json +18 -7
- package/dist/chunk-SOG2GVE4.js.map +0 -1
- /package/dist/{chunk-MISX4WUT.js.map → chunk-22EZJUPM.js.map} +0 -0
- /package/dist/{chunk-XC7K4XYM.js.map → chunk-DLBNFBXQ.js.map} +0 -0
- /package/dist/{chunk-S4XLE2RN.js.map → chunk-HGOPGZNQ.js.map} +0 -0
- /package/dist/{chunk-UCBAG42A.js.map → chunk-KHB5CHAU.js.map} +0 -0
- /package/dist/{chunk-647LAYRV.js.map → chunk-LHABOAOP.js.map} +0 -0
- /package/dist/{chunk-OQE6SHZE.js.map → chunk-N5XQU36W.js.map} +0 -0
- /package/dist/{chunk-HWJIMLHC.js.map → chunk-UAPCHIJI.js.map} +0 -0
- /package/dist/{chunk-CRXNFZRW.js.map → chunk-Y4JLSCT7.js.map} +0 -0
package/dist/completion/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompletionPrimitive
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-HGOPGZNQ.js";
|
|
4
4
|
import "../chunk-T3ZFZ3NP.js";
|
|
5
5
|
import {
|
|
6
6
|
CompletionProvider,
|
|
7
7
|
useCompletionContext,
|
|
8
8
|
useCompletionInput
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-E73S3SOF.js";
|
|
10
10
|
export {
|
|
11
11
|
CompletionPrimitive,
|
|
12
12
|
CompletionProvider,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as _anvia_react_graph_explorer from '@anvia/react/graph-explorer';
|
|
2
|
+
import { GraphExplorerController } from '@anvia/react/graph-explorer';
|
|
3
|
+
export { GraphExplorerController, GraphExplorerExpandNodeOptions, GraphExplorerStatus } from '@anvia/react/graph-explorer';
|
|
4
|
+
import * as _anvia_graph from '@anvia/graph';
|
|
5
|
+
import { GraphExploreNode, GraphSchemaLike } from '@anvia/graph';
|
|
6
|
+
import * as react from 'react';
|
|
7
|
+
import { ReactNode, ReactElement } from 'react';
|
|
8
|
+
import { P as PrimitiveProps } from '../render-CRKWam2v.js';
|
|
9
|
+
|
|
10
|
+
type GraphExplorerProviderProps<Schema extends GraphSchemaLike = GraphSchemaLike> = {
|
|
11
|
+
controller: GraphExplorerController<Schema>;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
type GraphExplorerNodeContextValue = {
|
|
15
|
+
node: GraphExploreNode;
|
|
16
|
+
selected: boolean;
|
|
17
|
+
matched: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare function GraphExplorerProvider<Schema extends GraphSchemaLike = GraphSchemaLike>({ controller, children, }: GraphExplorerProviderProps<Schema>): ReactElement;
|
|
20
|
+
declare function useGraphExplorerContext<Schema extends GraphSchemaLike = GraphSchemaLike>(): GraphExplorerController<Schema>;
|
|
21
|
+
declare function useGraphExplorerNode(): GraphExplorerNodeContextValue;
|
|
22
|
+
|
|
23
|
+
declare function graphExplorerNodeLabel(node: GraphExploreNode): string;
|
|
24
|
+
|
|
25
|
+
type GraphExplorerNodeRootProps = PrimitiveProps<"div"> & {
|
|
26
|
+
nodeId?: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
declare const GraphExplorerPrimitive: {
|
|
30
|
+
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
31
|
+
asChild?: boolean;
|
|
32
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
readonly Viewport: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
36
|
+
readonly Search: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "asChild"> & {
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
39
|
+
readonly Nodes: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
40
|
+
children?: react.ReactNode | ((node: _anvia_graph.GraphExploreNode, state: GraphExplorerNodeContextValue) => react.ReactNode);
|
|
41
|
+
keepMounted?: boolean;
|
|
42
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
readonly Empty: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
44
|
+
asChild?: boolean;
|
|
45
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
readonly Status: react.ForwardRefExoticComponent<Omit<PrimitiveProps<"div">, "children"> & {
|
|
47
|
+
children?: react.ReactNode | ((explorer: _anvia_react_graph_explorer.GraphExplorerController) => react.ReactNode);
|
|
48
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
49
|
+
readonly Refresh: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
50
|
+
asChild?: boolean;
|
|
51
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
52
|
+
};
|
|
53
|
+
declare const GraphExplorerNodePrimitive: {
|
|
54
|
+
readonly Root: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "asChild"> & {
|
|
55
|
+
asChild?: boolean;
|
|
56
|
+
} & {
|
|
57
|
+
nodeId?: string;
|
|
58
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
59
|
+
readonly Trigger: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
62
|
+
readonly Expand: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "asChild"> & {
|
|
63
|
+
asChild?: boolean;
|
|
64
|
+
} & {
|
|
65
|
+
options?: {
|
|
66
|
+
readonly relationships?: readonly string[] | undefined;
|
|
67
|
+
readonly nodeTypes?: readonly string[] | undefined;
|
|
68
|
+
readonly includeProvenance?: boolean | undefined | undefined;
|
|
69
|
+
readonly maxNodes?: number | undefined | undefined;
|
|
70
|
+
readonly maxRelationships?: number | undefined | undefined;
|
|
71
|
+
readonly direction?: _anvia_graph.GraphExploreDirection | undefined;
|
|
72
|
+
readonly maxDepth?: number | undefined | undefined;
|
|
73
|
+
};
|
|
74
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { type GraphExplorerNodeContextValue, GraphExplorerNodePrimitive, type GraphExplorerNodeRootProps, GraphExplorerPrimitive, GraphExplorerProvider, type GraphExplorerProviderProps, graphExplorerNodeLabel, useGraphExplorerContext, useGraphExplorerNode };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderPrimitive
|
|
3
|
+
} from "../chunk-T3ZFZ3NP.js";
|
|
4
|
+
import {
|
|
5
|
+
GraphExplorerProvider,
|
|
6
|
+
InternalGraphExplorerNodeProvider,
|
|
7
|
+
useGraphExplorerContext,
|
|
8
|
+
useGraphExplorerNode,
|
|
9
|
+
useOptionalGraphExplorerNode
|
|
10
|
+
} from "../chunk-E73S3SOF.js";
|
|
11
|
+
|
|
12
|
+
// src/graph-explorer/parts.tsx
|
|
13
|
+
import { forwardRef, useCallback } from "react";
|
|
14
|
+
|
|
15
|
+
// src/graph-explorer/helpers.ts
|
|
16
|
+
function graphExplorerNodeLabel(node) {
|
|
17
|
+
for (const key of ["name", "title", "label"]) {
|
|
18
|
+
const value = node.properties[key];
|
|
19
|
+
if (typeof value === "string" && value.trim().length > 0) return value;
|
|
20
|
+
}
|
|
21
|
+
if (node.key !== void 0) return node.key;
|
|
22
|
+
return `${node.type} ${node.id}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/graph-explorer/parts.tsx
|
|
26
|
+
import { jsx } from "react/jsx-runtime";
|
|
27
|
+
var GraphExplorerRoot = forwardRef(
|
|
28
|
+
function GraphExplorerRoot2(props, ref) {
|
|
29
|
+
const explorer = useGraphExplorerContext();
|
|
30
|
+
const truncated = explorer.truncated.nodes || explorer.truncated.relationships;
|
|
31
|
+
return renderPrimitive(
|
|
32
|
+
"div",
|
|
33
|
+
{
|
|
34
|
+
...props,
|
|
35
|
+
"aria-busy": explorer.status === "loading",
|
|
36
|
+
"data-role": "graph-explorer",
|
|
37
|
+
"data-state": explorer.status,
|
|
38
|
+
"data-truncated": truncated ? "true" : "false"
|
|
39
|
+
},
|
|
40
|
+
ref
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
var GraphExplorerSearch = forwardRef(
|
|
45
|
+
function GraphExplorerSearch2({ onChange, ...props }, ref) {
|
|
46
|
+
const explorer = useGraphExplorerContext();
|
|
47
|
+
const handleChange = useCallback(
|
|
48
|
+
(event) => {
|
|
49
|
+
onChange?.(event);
|
|
50
|
+
if (!event.defaultPrevented) explorer.setQuery(event.currentTarget.value);
|
|
51
|
+
},
|
|
52
|
+
[explorer, onChange]
|
|
53
|
+
);
|
|
54
|
+
return renderPrimitive(
|
|
55
|
+
"input",
|
|
56
|
+
{
|
|
57
|
+
...props,
|
|
58
|
+
"aria-label": props["aria-label"] ?? "Search graph",
|
|
59
|
+
"data-state": explorer.query.length === 0 ? "empty" : "populated",
|
|
60
|
+
onChange: handleChange,
|
|
61
|
+
type: props.type ?? "search",
|
|
62
|
+
value: explorer.query
|
|
63
|
+
},
|
|
64
|
+
ref
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
var GraphExplorerViewport = forwardRef(
|
|
69
|
+
function GraphExplorerViewport2(props, ref) {
|
|
70
|
+
return renderPrimitive(
|
|
71
|
+
"div",
|
|
72
|
+
{ ...props, "data-role": "graph-explorer-viewport" },
|
|
73
|
+
ref
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
var GraphExplorerNodes = forwardRef(
|
|
78
|
+
function GraphExplorerNodes2({ children, keepMounted = false, ...props }, ref) {
|
|
79
|
+
const explorer = useGraphExplorerContext();
|
|
80
|
+
const empty = explorer.nodes.length === 0;
|
|
81
|
+
if (empty && !keepMounted) return null;
|
|
82
|
+
return renderPrimitive(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
...props,
|
|
86
|
+
children: explorer.nodes.map((node) => {
|
|
87
|
+
const state = {
|
|
88
|
+
node,
|
|
89
|
+
selected: node.id === explorer.selectedNodeId,
|
|
90
|
+
matched: explorer.matchedNodeIds.has(node.id)
|
|
91
|
+
};
|
|
92
|
+
return /* @__PURE__ */ jsx(InternalGraphExplorerNodeProvider, { value: state, children: typeof children === "function" ? children(node, state) : children ?? /* @__PURE__ */ jsx(GraphExplorerNodeRoot, { children: /* @__PURE__ */ jsx(GraphExplorerNodeTrigger, {}) }) }, node.id);
|
|
93
|
+
}),
|
|
94
|
+
"data-state": empty ? "empty" : "populated",
|
|
95
|
+
role: props.role ?? "list"
|
|
96
|
+
},
|
|
97
|
+
ref
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
var GraphExplorerEmpty = forwardRef(
|
|
102
|
+
function GraphExplorerEmpty2(props, ref) {
|
|
103
|
+
const explorer = useGraphExplorerContext();
|
|
104
|
+
if (explorer.nodes.length > 0 || explorer.status === "loading") return null;
|
|
105
|
+
return renderPrimitive(
|
|
106
|
+
"div",
|
|
107
|
+
{ ...props, children: props.children ?? "No graph nodes." },
|
|
108
|
+
ref
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
var GraphExplorerStatus = forwardRef(
|
|
113
|
+
function GraphExplorerStatus2({ children, ...props }, ref) {
|
|
114
|
+
const explorer = useGraphExplorerContext();
|
|
115
|
+
const content = typeof children === "function" ? children(explorer) : children ?? statusText(explorer);
|
|
116
|
+
return renderPrimitive(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
...props,
|
|
120
|
+
children: content,
|
|
121
|
+
"data-state": explorer.status,
|
|
122
|
+
role: props.role ?? "status"
|
|
123
|
+
},
|
|
124
|
+
ref
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
var GraphExplorerRefresh = forwardRef(
|
|
129
|
+
function GraphExplorerRefresh2({ onClick, ...props }, ref) {
|
|
130
|
+
const explorer = useGraphExplorerContext();
|
|
131
|
+
const disabled = props.disabled ?? explorer.status === "loading";
|
|
132
|
+
const handleClick = useAsyncAction(onClick, disabled, explorer.refresh);
|
|
133
|
+
return renderPrimitive(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
...props,
|
|
137
|
+
children: props.children ?? "Refresh graph",
|
|
138
|
+
disabled,
|
|
139
|
+
onClick: handleClick,
|
|
140
|
+
type: props.type ?? "button"
|
|
141
|
+
},
|
|
142
|
+
ref
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
var GraphExplorerNodeRoot = forwardRef(
|
|
147
|
+
function GraphExplorerNodeRoot2({ nodeId, ...props }, ref) {
|
|
148
|
+
const explorer = useGraphExplorerContext();
|
|
149
|
+
const inherited = useOptionalGraphExplorerNode();
|
|
150
|
+
const node = nodeId === void 0 ? inherited?.node : explorer.nodeById.get(nodeId);
|
|
151
|
+
if (node === void 0) {
|
|
152
|
+
throw new Error(
|
|
153
|
+
nodeId === void 0 ? "GraphExplorerNodePrimitive.Root requires a nodeId outside GraphExplorerPrimitive.Nodes." : `Graph explorer node ${nodeId} is not loaded.`
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
const state = {
|
|
157
|
+
node,
|
|
158
|
+
selected: node.id === explorer.selectedNodeId,
|
|
159
|
+
matched: explorer.matchedNodeIds.has(node.id)
|
|
160
|
+
};
|
|
161
|
+
return /* @__PURE__ */ jsx(InternalGraphExplorerNodeProvider, { value: state, children: renderPrimitive(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
...props,
|
|
165
|
+
"data-match": state.matched ? "matched" : "unmatched",
|
|
166
|
+
"data-node-id": state.node.id,
|
|
167
|
+
"data-node-type": state.node.type,
|
|
168
|
+
"data-state": state.selected ? "selected" : "unselected",
|
|
169
|
+
role: props.role ?? (inherited === void 0 ? void 0 : "listitem")
|
|
170
|
+
},
|
|
171
|
+
ref
|
|
172
|
+
) });
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
var GraphExplorerNodeTrigger = forwardRef(
|
|
176
|
+
function GraphExplorerNodeTrigger2({ onClick, ...props }, ref) {
|
|
177
|
+
const explorer = useGraphExplorerContext();
|
|
178
|
+
const state = useGraphExplorerNode();
|
|
179
|
+
const handleClick = useCallback(
|
|
180
|
+
(event) => {
|
|
181
|
+
onClick?.(event);
|
|
182
|
+
if (!event.defaultPrevented && !props.disabled) explorer.selectNode(state.node.id);
|
|
183
|
+
},
|
|
184
|
+
[explorer, onClick, props.disabled, state.node.id]
|
|
185
|
+
);
|
|
186
|
+
return renderPrimitive(
|
|
187
|
+
"button",
|
|
188
|
+
{
|
|
189
|
+
...props,
|
|
190
|
+
children: props.children ?? graphExplorerNodeLabel(state.node),
|
|
191
|
+
onClick: handleClick,
|
|
192
|
+
type: props.type ?? "button",
|
|
193
|
+
"aria-pressed": state.selected
|
|
194
|
+
},
|
|
195
|
+
ref
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
var GraphExplorerNodeExpand = forwardRef(
|
|
200
|
+
function GraphExplorerNodeExpand2({ onClick, options, ...props }, ref) {
|
|
201
|
+
const explorer = useGraphExplorerContext();
|
|
202
|
+
const state = useGraphExplorerNode();
|
|
203
|
+
const disabled = props.disabled ?? explorer.status === "loading";
|
|
204
|
+
const expand = useCallback(
|
|
205
|
+
() => explorer.expandNode(state.node.id, options),
|
|
206
|
+
[explorer, options, state.node.id]
|
|
207
|
+
);
|
|
208
|
+
const handleClick = useAsyncAction(onClick, disabled, expand);
|
|
209
|
+
return renderPrimitive(
|
|
210
|
+
"button",
|
|
211
|
+
{
|
|
212
|
+
...props,
|
|
213
|
+
children: props.children ?? "Expand",
|
|
214
|
+
disabled,
|
|
215
|
+
onClick: handleClick,
|
|
216
|
+
type: props.type ?? "button"
|
|
217
|
+
},
|
|
218
|
+
ref
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
function useAsyncAction(onClick, disabled, action) {
|
|
223
|
+
return useCallback(
|
|
224
|
+
(event) => {
|
|
225
|
+
onClick?.(event);
|
|
226
|
+
if (event.defaultPrevented || disabled) return;
|
|
227
|
+
void action().catch(() => void 0);
|
|
228
|
+
},
|
|
229
|
+
[action, disabled, onClick]
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
function statusText(explorer) {
|
|
233
|
+
if (explorer.status === "loading") return "Loading graph.";
|
|
234
|
+
if (explorer.status === "error") return "Graph exploration failed.";
|
|
235
|
+
return `${explorer.nodes.length} nodes, ${explorer.relationships.length} relationships.`;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/graph-explorer/index.ts
|
|
239
|
+
var GraphExplorerPrimitive = {
|
|
240
|
+
Root: GraphExplorerRoot,
|
|
241
|
+
Viewport: GraphExplorerViewport,
|
|
242
|
+
Search: GraphExplorerSearch,
|
|
243
|
+
Nodes: GraphExplorerNodes,
|
|
244
|
+
Empty: GraphExplorerEmpty,
|
|
245
|
+
Status: GraphExplorerStatus,
|
|
246
|
+
Refresh: GraphExplorerRefresh
|
|
247
|
+
};
|
|
248
|
+
var GraphExplorerNodePrimitive = {
|
|
249
|
+
Root: GraphExplorerNodeRoot,
|
|
250
|
+
Trigger: GraphExplorerNodeTrigger,
|
|
251
|
+
Expand: GraphExplorerNodeExpand
|
|
252
|
+
};
|
|
253
|
+
export {
|
|
254
|
+
GraphExplorerNodePrimitive,
|
|
255
|
+
GraphExplorerPrimitive,
|
|
256
|
+
GraphExplorerProvider,
|
|
257
|
+
graphExplorerNodeLabel,
|
|
258
|
+
useGraphExplorerContext,
|
|
259
|
+
useGraphExplorerNode
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/graph-explorer/parts.tsx","../../src/graph-explorer/helpers.ts","../../src/graph-explorer/index.ts"],"sourcesContent":["import type { GraphExploreNode } from \"@anvia/graph\";\nimport { forwardRef, type ChangeEvent, type MouseEvent, type ReactNode, useCallback } from \"react\";\n\nimport {\n InternalGraphExplorerNodeProvider,\n type GraphExplorerController,\n type GraphExplorerExpandNodeOptions,\n type GraphExplorerNodeContextValue,\n useGraphExplorerContext,\n useGraphExplorerNode,\n useOptionalGraphExplorerNode,\n} from \"../contexts\";\nimport { type PrimitiveProps, renderPrimitive } from \"../primitives\";\nimport { graphExplorerNodeLabel } from \"./helpers\";\n\nexport const GraphExplorerRoot = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function GraphExplorerRoot(props, ref) {\n const explorer = useGraphExplorerContext();\n const truncated = explorer.truncated.nodes || explorer.truncated.relationships;\n return renderPrimitive(\n \"div\",\n {\n ...props,\n \"aria-busy\": explorer.status === \"loading\",\n \"data-role\": \"graph-explorer\",\n \"data-state\": explorer.status,\n \"data-truncated\": truncated ? \"true\" : \"false\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport const GraphExplorerSearch = forwardRef<HTMLInputElement, PrimitiveProps<\"input\">>(\n function GraphExplorerSearch({ onChange, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n if (!event.defaultPrevented) explorer.setQuery(event.currentTarget.value);\n },\n [explorer, onChange],\n );\n return renderPrimitive(\n \"input\",\n {\n ...props,\n \"aria-label\": props[\"aria-label\"] ?? \"Search graph\",\n \"data-state\": explorer.query.length === 0 ? \"empty\" : \"populated\",\n onChange: handleChange,\n type: props.type ?? \"search\",\n value: explorer.query,\n } as PrimitiveProps<\"input\">,\n ref,\n );\n },\n);\n\nexport const GraphExplorerViewport = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function GraphExplorerViewport(props, ref) {\n return renderPrimitive(\n \"div\",\n { ...props, \"data-role\": \"graph-explorer-viewport\" } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype GraphExplorerNodesChildren =\n | ReactNode\n | ((node: GraphExploreNode, state: GraphExplorerNodeContextValue) => ReactNode);\n\ntype GraphExplorerNodesProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: GraphExplorerNodesChildren;\n keepMounted?: boolean;\n};\n\nexport const GraphExplorerNodes = forwardRef<HTMLDivElement, GraphExplorerNodesProps>(\n function GraphExplorerNodes({ children, keepMounted = false, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const empty = explorer.nodes.length === 0;\n if (empty && !keepMounted) return null;\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: explorer.nodes.map((node) => {\n const state: GraphExplorerNodeContextValue = {\n node,\n selected: node.id === explorer.selectedNodeId,\n matched: explorer.matchedNodeIds.has(node.id),\n };\n return (\n <InternalGraphExplorerNodeProvider key={node.id} value={state}>\n {typeof children === \"function\"\n ? children(node, state)\n : (children ?? (\n <GraphExplorerNodeRoot>\n <GraphExplorerNodeTrigger />\n </GraphExplorerNodeRoot>\n ))}\n </InternalGraphExplorerNodeProvider>\n );\n }),\n \"data-state\": empty ? \"empty\" : \"populated\",\n role: props.role ?? \"list\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport const GraphExplorerEmpty = forwardRef<HTMLDivElement, PrimitiveProps<\"div\">>(\n function GraphExplorerEmpty(props, ref) {\n const explorer = useGraphExplorerContext();\n if (explorer.nodes.length > 0 || explorer.status === \"loading\") return null;\n return renderPrimitive(\n \"div\",\n { ...props, children: props.children ?? \"No graph nodes.\" } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\ntype GraphExplorerStatusChildren = ReactNode | ((explorer: GraphExplorerController) => ReactNode);\ntype GraphExplorerStatusProps = Omit<PrimitiveProps<\"div\">, \"children\"> & {\n children?: GraphExplorerStatusChildren;\n};\n\nexport const GraphExplorerStatus = forwardRef<HTMLDivElement, GraphExplorerStatusProps>(\n function GraphExplorerStatus({ children, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const content =\n typeof children === \"function\" ? children(explorer) : (children ?? statusText(explorer));\n return renderPrimitive(\n \"div\",\n {\n ...props,\n children: content,\n \"data-state\": explorer.status,\n role: props.role ?? \"status\",\n } as PrimitiveProps<\"div\">,\n ref,\n );\n },\n);\n\nexport const GraphExplorerRefresh = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function GraphExplorerRefresh({ onClick, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const disabled = props.disabled ?? explorer.status === \"loading\";\n const handleClick = useAsyncAction(onClick, disabled, explorer.refresh);\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Refresh graph\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nexport type GraphExplorerNodeRootProps = PrimitiveProps<\"div\"> & { nodeId?: string };\n\nexport const GraphExplorerNodeRoot = forwardRef<HTMLDivElement, GraphExplorerNodeRootProps>(\n function GraphExplorerNodeRoot({ nodeId, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const inherited = useOptionalGraphExplorerNode();\n const node = nodeId === undefined ? inherited?.node : explorer.nodeById.get(nodeId);\n if (node === undefined) {\n throw new Error(\n nodeId === undefined\n ? \"GraphExplorerNodePrimitive.Root requires a nodeId outside GraphExplorerPrimitive.Nodes.\"\n : `Graph explorer node ${nodeId} is not loaded.`,\n );\n }\n const state: GraphExplorerNodeContextValue = {\n node,\n selected: node.id === explorer.selectedNodeId,\n matched: explorer.matchedNodeIds.has(node.id),\n };\n return (\n <InternalGraphExplorerNodeProvider value={state}>\n {renderPrimitive(\n \"div\",\n {\n ...props,\n \"data-match\": state.matched ? \"matched\" : \"unmatched\",\n \"data-node-id\": state.node.id,\n \"data-node-type\": state.node.type,\n \"data-state\": state.selected ? \"selected\" : \"unselected\",\n role: props.role ?? (inherited === undefined ? undefined : \"listitem\"),\n } as PrimitiveProps<\"div\">,\n ref,\n )}\n </InternalGraphExplorerNodeProvider>\n );\n },\n);\n\nexport const GraphExplorerNodeTrigger = forwardRef<HTMLButtonElement, PrimitiveProps<\"button\">>(\n function GraphExplorerNodeTrigger({ onClick, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const state = useGraphExplorerNode();\n const handleClick = useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented && !props.disabled) explorer.selectNode(state.node.id);\n },\n [explorer, onClick, props.disabled, state.node.id],\n );\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? graphExplorerNodeLabel(state.node),\n onClick: handleClick,\n type: props.type ?? \"button\",\n \"aria-pressed\": state.selected,\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\ntype GraphExplorerNodeExpandOptions = Omit<GraphExplorerExpandNodeOptions, \"abortSignal\">;\ntype GraphExplorerNodeExpandProps = PrimitiveProps<\"button\"> & {\n options?: GraphExplorerNodeExpandOptions;\n};\n\nexport const GraphExplorerNodeExpand = forwardRef<HTMLButtonElement, GraphExplorerNodeExpandProps>(\n function GraphExplorerNodeExpand({ onClick, options, ...props }, ref) {\n const explorer = useGraphExplorerContext();\n const state = useGraphExplorerNode();\n const disabled = props.disabled ?? explorer.status === \"loading\";\n const expand = useCallback(\n () => explorer.expandNode(state.node.id, options),\n [explorer, options, state.node.id],\n );\n const handleClick = useAsyncAction(onClick, disabled, expand);\n return renderPrimitive(\n \"button\",\n {\n ...props,\n children: props.children ?? \"Expand\",\n disabled,\n onClick: handleClick,\n type: props.type ?? \"button\",\n } as PrimitiveProps<\"button\">,\n ref,\n );\n },\n);\n\nfunction useAsyncAction(\n onClick: ((event: MouseEvent<HTMLButtonElement>) => void) | undefined,\n disabled: boolean,\n action: () => Promise<unknown>,\n) {\n return useCallback(\n (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled) return;\n void action().catch(() => undefined);\n },\n [action, disabled, onClick],\n );\n}\n\nfunction statusText(explorer: GraphExplorerController): ReactNode {\n if (explorer.status === \"loading\") return \"Loading graph.\";\n if (explorer.status === \"error\") return \"Graph exploration failed.\";\n return `${explorer.nodes.length} nodes, ${explorer.relationships.length} relationships.`;\n}\n","import type { GraphExploreNode } from \"@anvia/graph\";\n\nexport function graphExplorerNodeLabel(node: GraphExploreNode): string {\n for (const key of [\"name\", \"title\", \"label\"] as const) {\n const value = node.properties[key];\n if (typeof value === \"string\" && value.trim().length > 0) return value;\n }\n if (node.key !== undefined) return node.key;\n return `${node.type} ${node.id}`;\n}\n","import {\n GraphExplorerEmpty,\n GraphExplorerNodes,\n GraphExplorerRefresh,\n GraphExplorerRoot,\n GraphExplorerSearch,\n GraphExplorerStatus,\n GraphExplorerViewport,\n GraphExplorerNodeExpand,\n GraphExplorerNodeRoot,\n GraphExplorerNodeTrigger,\n} from \"./parts\";\n\nexport const GraphExplorerPrimitive = {\n Root: GraphExplorerRoot,\n Viewport: GraphExplorerViewport,\n Search: GraphExplorerSearch,\n Nodes: GraphExplorerNodes,\n Empty: GraphExplorerEmpty,\n Status: GraphExplorerStatus,\n Refresh: GraphExplorerRefresh,\n} as const;\n\nexport const GraphExplorerNodePrimitive = {\n Root: GraphExplorerNodeRoot,\n Trigger: GraphExplorerNodeTrigger,\n Expand: GraphExplorerNodeExpand,\n} as const;\n\nexport type {\n GraphExplorerController,\n GraphExplorerExpandNodeOptions,\n GraphExplorerNodeContextValue,\n GraphExplorerProviderProps,\n GraphExplorerStatus,\n} from \"../contexts/graph-explorer\";\nexport {\n GraphExplorerProvider,\n useGraphExplorerContext,\n useGraphExplorerNode,\n} from \"../contexts/graph-explorer\";\nexport { graphExplor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H,UAAU,MAAM,YAAY;AAAA,QAC5B;AAAA,QACA,SAAS;AAAA,QACT,MAAM,MAAM,QAAQ;AAAA,MACtB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,eACP,SACA,UACA,QACA;AACA,SAAO;AAAA,IACL,CAAC,UAAyC;AACxC,gBAAU,KAAK;AACf,UAAI,MAAM,oBAAoB,SAAU;AACxC,WAAK,OAAO,EAAE,MAAM,MAAM,MAAS;AAAA,IACrC;AAAA,IACA,CAAC,QAAQ,UAAU,OAAO;AAAA,EAC5B;AACF;AAEA,SAAS,WAAW,UAA8C;AAChE,MAAI,SAAS,WAAW,UAAW,QAAO;AAC1C,MAAI,SAAS,WAAW,QAAS,QAAO;AACxC,SAAO,GAAG,SAAS,MAAM,MAAM,WAAW,SAAS,cAAc,MAAM;AACzE;;;AExQO,IAAM,yBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,IAAM,6BAA6B;AAAA,EACxC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AACV;","names":["GraphExplorerRoot","GraphExplorerSearch","GraphExplorerViewport","GraphExplorerNodes","GraphExplorerEmpty","GraphExplorerStatus","GraphExplorerRefresh","GraphExplorerNodeRoot","GraphExplorerNodeTrigger","GraphExplorerNodeExpand"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HumanInputPrimitive
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-N5XQU36W.js";
|
|
4
4
|
import "../chunk-CKA4CE26.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useHumanInput,
|
|
10
10
|
useQuestion,
|
|
11
11
|
useQuestionPrompt
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-E73S3SOF.js";
|
|
13
13
|
export {
|
|
14
14
|
HumanInputPrimitive,
|
|
15
15
|
useApproval,
|
package/dist/image/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectionToolbarPrimitive
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KHB5CHAU.js";
|
|
4
4
|
import {
|
|
5
5
|
ThreadListItemPrimitive,
|
|
6
6
|
ThreadListPrimitive
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LHABOAOP.js";
|
|
8
8
|
import {
|
|
9
9
|
ComposerPrimitive,
|
|
10
10
|
ThreadPrimitive
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import {
|
|
13
|
-
CompletionPrimitive
|
|
14
|
-
} from "./chunk-S4XLE2RN.js";
|
|
15
|
-
import {
|
|
16
|
-
HumanInputPrimitive
|
|
17
|
-
} from "./chunk-OQE6SHZE.js";
|
|
18
|
-
import {
|
|
19
|
-
ImagePrimitive
|
|
20
|
-
} from "./chunk-XC7K4XYM.js";
|
|
11
|
+
} from "./chunk-UAPCHIJI.js";
|
|
21
12
|
import {
|
|
22
13
|
MessagePrimitive
|
|
23
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Y4JLSCT7.js";
|
|
24
15
|
import "./chunk-6XOJFLX4.js";
|
|
25
16
|
import {
|
|
26
17
|
StreamMarkdown
|
|
27
18
|
} from "./chunk-F6AKBUO3.js";
|
|
28
19
|
import {
|
|
29
20
|
AttachmentPrimitive
|
|
30
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-22EZJUPM.js";
|
|
22
|
+
import {
|
|
23
|
+
CompletionPrimitive
|
|
24
|
+
} from "./chunk-HGOPGZNQ.js";
|
|
25
|
+
import {
|
|
26
|
+
HumanInputPrimitive
|
|
27
|
+
} from "./chunk-N5XQU36W.js";
|
|
31
28
|
import "./chunk-CKA4CE26.js";
|
|
29
|
+
import {
|
|
30
|
+
ImagePrimitive
|
|
31
|
+
} from "./chunk-DLBNFBXQ.js";
|
|
32
32
|
import {
|
|
33
33
|
renderPrimitive
|
|
34
34
|
} from "./chunk-T3ZFZ3NP.js";
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
useThread,
|
|
53
53
|
useThreadList,
|
|
54
54
|
useThreadListItem
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-E73S3SOF.js";
|
|
56
56
|
|
|
57
57
|
// src/context-meter.tsx
|
|
58
58
|
import { forwardRef } from "react";
|
package/dist/message/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MessagePrimitive
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Y4JLSCT7.js";
|
|
4
4
|
import "../chunk-6XOJFLX4.js";
|
|
5
5
|
import "../chunk-F6AKBUO3.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-22EZJUPM.js";
|
|
7
7
|
import "../chunk-CKA4CE26.js";
|
|
8
8
|
import "../chunk-T3ZFZ3NP.js";
|
|
9
9
|
import {
|
|
10
10
|
useChatContext,
|
|
11
11
|
useMessage,
|
|
12
12
|
useMessagePart
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-E73S3SOF.js";
|
|
14
14
|
export {
|
|
15
15
|
MessagePrimitive,
|
|
16
16
|
useChatContext,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SelectionToolbarPrimitive
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-KHB5CHAU.js";
|
|
4
4
|
import "../chunk-6XOJFLX4.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
7
7
|
useSelectionToolbar
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-E73S3SOF.js";
|
|
9
9
|
export {
|
|
10
10
|
SelectionToolbarPrimitive,
|
|
11
11
|
useSelectionToolbar
|
package/dist/shared.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ThreadListItemPrimitive,
|
|
3
3
|
ThreadListPrimitive
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-LHABOAOP.js";
|
|
5
5
|
import "../chunk-T3ZFZ3NP.js";
|
|
6
6
|
import {
|
|
7
7
|
ThreadListProvider,
|
|
8
8
|
useThreadList,
|
|
9
9
|
useThreadListItem
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-E73S3SOF.js";
|
|
11
11
|
export {
|
|
12
12
|
ThreadListItemPrimitive,
|
|
13
13
|
ThreadListPrimitive,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anvia/react-ui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Composable React UI primitives for Anvia
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "Composable, headless React UI primitives for Anvia applications.",
|
|
5
5
|
"author": "anvia",
|
|
6
6
|
"maintainer": "Indra Zulfi",
|
|
7
7
|
"license": "MIT",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/completion/index.d.ts",
|
|
37
37
|
"import": "./dist/completion/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./graph-explorer": {
|
|
40
|
+
"types": "./dist/graph-explorer/index.d.ts",
|
|
41
|
+
"import": "./dist/graph-explorer/index.js"
|
|
42
|
+
},
|
|
39
43
|
"./human-input": {
|
|
40
44
|
"types": "./dist/human-input/index.d.ts",
|
|
41
45
|
"import": "./dist/human-input/index.js"
|
|
@@ -84,8 +88,14 @@
|
|
|
84
88
|
"peerDependencies": {
|
|
85
89
|
"react": ">=18",
|
|
86
90
|
"react-dom": ">=18",
|
|
87
|
-
"@anvia/client": "1.0.
|
|
88
|
-
"@anvia/
|
|
91
|
+
"@anvia/client": "1.0.10",
|
|
92
|
+
"@anvia/graph": "1.0.11",
|
|
93
|
+
"@anvia/react": "1.0.11"
|
|
94
|
+
},
|
|
95
|
+
"peerDependenciesMeta": {
|
|
96
|
+
"@anvia/graph": {
|
|
97
|
+
"optional": true
|
|
98
|
+
}
|
|
89
99
|
},
|
|
90
100
|
"devDependencies": {
|
|
91
101
|
"@testing-library/react": "^16.3.2",
|
|
@@ -99,11 +109,12 @@
|
|
|
99
109
|
"tsup": "^8.5.0",
|
|
100
110
|
"typescript": "^5.9.3",
|
|
101
111
|
"vitest": "^4.0.8",
|
|
102
|
-
"@anvia/client": "1.0.
|
|
103
|
-
"@anvia/react": "1.0.
|
|
112
|
+
"@anvia/client": "1.0.10",
|
|
113
|
+
"@anvia/react": "1.0.11",
|
|
114
|
+
"@anvia/graph": "1.0.11"
|
|
104
115
|
},
|
|
105
116
|
"scripts": {
|
|
106
|
-
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom",
|
|
117
|
+
"build": "tsup src/index.ts src/attachment/index.ts src/chat/index.ts src/completion/index.ts src/graph-explorer/index.ts src/human-input/index.ts src/image/index.ts src/message/index.ts src/selection-toolbar/index.ts src/shared.ts src/stream/index.ts src/thread-list/index.ts --format esm --dts --sourcemap --clean --external react --external react-dom",
|
|
107
118
|
"coverage": "vitest run --coverage",
|
|
108
119
|
"test": "vitest run",
|
|
109
120
|
"typecheck": "tsc --noEmit"
|