@robosystems/core 0.13.0 → 0.13.2
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/components/console/ConsoleContent.d.ts +3 -1
- package/components/console/ConsoleContent.js +4 -3
- package/components/console/ConsoleDrawer.d.ts +15 -0
- package/components/console/ConsoleDrawer.js +145 -0
- package/components/console/index.d.ts +1 -0
- package/components/console/index.js +1 -0
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/lib/console-drawer.d.ts +12 -0
- package/lib/console-drawer.js +24 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ConsoleConfig } from './types';
|
|
2
|
-
export declare function ConsoleContent({ config }: {
|
|
2
|
+
export declare function ConsoleContent({ config, variant, }: {
|
|
3
3
|
config: ConsoleConfig;
|
|
4
|
+
/** `panel` drops the page header and fills its container (the drawer). */
|
|
5
|
+
variant?: 'page' | 'panel';
|
|
4
6
|
}): import("react").JSX.Element;
|
|
@@ -75,7 +75,7 @@ function copyRowsJson(rows) {
|
|
|
75
75
|
var _a;
|
|
76
76
|
(_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(JSON.stringify(rows, null, 2));
|
|
77
77
|
}
|
|
78
|
-
export function ConsoleContent({ config }) {
|
|
78
|
+
export function ConsoleContent({ config, variant = 'page', }) {
|
|
79
79
|
const { state: graphState } = useGraphContext();
|
|
80
80
|
const graphId = graphState.currentGraphId;
|
|
81
81
|
const streamingQuery = useStreamingQuery();
|
|
@@ -738,10 +738,11 @@ export function ConsoleContent({ config }) {
|
|
|
738
738
|
};
|
|
739
739
|
// ── Render ──────────────────────────────────────────────────────────
|
|
740
740
|
const { header } = config;
|
|
741
|
-
|
|
741
|
+
const isPanel = variant === 'panel';
|
|
742
|
+
return (_jsxs("div", { className: isPanel ? 'h-full' : 'mx-auto max-w-7xl space-y-6 p-4 sm:p-6', children: [!isPanel && (_jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-4", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-3 sm:gap-4", children: [_jsx("div", { className: `shrink-0 rounded-lg bg-gradient-to-br ${header.gradientFrom} ${header.gradientTo} p-2.5 sm:p-3`, children: _jsx(HiTerminal, { className: "h-6 w-6 text-white sm:h-8 sm:w-8" }) }), _jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "font-heading text-2xl font-bold break-words text-gray-900 sm:text-3xl dark:text-white", children: header.title }), _jsx("p", { className: "mt-1 text-sm break-words text-gray-500 dark:text-gray-400", children: header.subtitle })] })] }), (streamingQuery.isStreaming || operatorProgress.isRunning) && (_jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-600 dark:text-gray-400", children: [_jsx("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-green-500" }), operatorProgress.isRunning && operatorProgress.message
|
|
742
743
|
? operatorProgress.message
|
|
743
744
|
: 'Processing...', operatorProgress.percentage !== undefined &&
|
|
744
|
-
` (${operatorProgress.percentage}%)`] }))] }), _jsx(Card, { className:
|
|
745
|
+
` (${operatorProgress.percentage}%)`] }))] })), _jsx(Card, { className: `overflow-hidden bg-gray-950 !p-0 [&>div]:!p-0 ${isPanel ? 'h-full rounded-none border-0 [&>div]:h-full' : ''}`, children: _jsxs("div", { className: "flex flex-col bg-gray-950", style: { height: isPanel ? '100%' : 'calc(100vh - 280px)' }, children: [_jsxs("div", { ref: terminalScrollRef, className: "flex-1 overflow-y-auto p-4 font-mono text-sm", children: [terminalMessages.map((message) => (_jsxs("div", { className: "mb-4", children: [_jsxs("div", { className: "mb-1 flex items-center gap-2 text-xs text-gray-700", children: [_jsx("span", { children: message.timestamp.toLocaleTimeString() }), _jsx("span", { children: "-" }), _jsx("span", { className: "tracking-wider uppercase", children: message.type })] }), _jsxs("div", { className: `leading-relaxed break-words ${message.markdown && !message.isAnimating
|
|
745
746
|
? ''
|
|
746
747
|
: 'whitespace-pre-wrap'} ${message.type === 'system'
|
|
747
748
|
? 'text-cyan-400'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ConsoleConfig } from './types';
|
|
2
|
+
/** Height of the closed drawer's bar. */
|
|
3
|
+
export declare const CONSOLE_DRAWER_BAR_HEIGHT = 32;
|
|
4
|
+
/** Set on <html> to the space the drawer covers; pad page content by it. */
|
|
5
|
+
export declare const CONSOLE_DRAWER_HEIGHT_VAR = "--console-drawer-height";
|
|
6
|
+
/**
|
|
7
|
+
* The console as a bottom panel, like VS Code's: a thin bar when closed, a
|
|
8
|
+
* resizable panel when open, toggled with Ctrl+`. It stays mounted once
|
|
9
|
+
* opened, so the conversation survives closing it. `className` positions it,
|
|
10
|
+
* e.g. an offset for the app's sidebar.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ConsoleDrawer({ config, className, }: {
|
|
13
|
+
config: ConsoleConfig;
|
|
14
|
+
className?: string;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
4
|
+
import { HiChevronDown, HiChevronUp, HiOutlineArrowsExpand, HiOutlineMinus, HiTerminal, } from 'react-icons/hi';
|
|
5
|
+
import { CONSOLE_DRAWER_STORAGE_KEY, CONSOLE_OPEN_EVENT, } from '../../lib/console-drawer';
|
|
6
|
+
import { ConsoleContent } from './ConsoleContent';
|
|
7
|
+
const STORAGE_KEY = CONSOLE_DRAWER_STORAGE_KEY;
|
|
8
|
+
/** Height of the closed drawer's bar. */
|
|
9
|
+
export const CONSOLE_DRAWER_BAR_HEIGHT = 32;
|
|
10
|
+
/** Set on <html> to the space the drawer covers; pad page content by it. */
|
|
11
|
+
export const CONSOLE_DRAWER_HEIGHT_VAR = '--console-drawer-height';
|
|
12
|
+
const DEFAULT_HEIGHT = 320;
|
|
13
|
+
const MIN_HEIGHT = 160;
|
|
14
|
+
// Leave the page's own header in view at full stretch.
|
|
15
|
+
const MAX_HEIGHT_RATIO = 0.8;
|
|
16
|
+
function readState() {
|
|
17
|
+
try {
|
|
18
|
+
const raw = window.localStorage.getItem(STORAGE_KEY);
|
|
19
|
+
if (raw) {
|
|
20
|
+
const parsed = JSON.parse(raw);
|
|
21
|
+
return {
|
|
22
|
+
open: parsed.open === true,
|
|
23
|
+
height: typeof parsed.height === 'number' ? parsed.height : DEFAULT_HEIGHT,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (_a) {
|
|
28
|
+
// Storage blocked or corrupt: start closed at the default height.
|
|
29
|
+
}
|
|
30
|
+
return { open: false, height: DEFAULT_HEIGHT };
|
|
31
|
+
}
|
|
32
|
+
function writeState(state) {
|
|
33
|
+
try {
|
|
34
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(state));
|
|
35
|
+
}
|
|
36
|
+
catch (_a) {
|
|
37
|
+
// Not persisting is fine; the drawer still works for this page view.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function clampHeight(height) {
|
|
41
|
+
const max = Math.floor(window.innerHeight * MAX_HEIGHT_RATIO);
|
|
42
|
+
return Math.min(Math.max(height, MIN_HEIGHT), Math.max(max, MIN_HEIGHT));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The console as a bottom panel, like VS Code's: a thin bar when closed, a
|
|
46
|
+
* resizable panel when open, toggled with Ctrl+`. It stays mounted once
|
|
47
|
+
* opened, so the conversation survives closing it. `className` positions it,
|
|
48
|
+
* e.g. an offset for the app's sidebar.
|
|
49
|
+
*/
|
|
50
|
+
export function ConsoleDrawer({ config, className = 'left-0 right-0', }) {
|
|
51
|
+
const [state, setState] = useState({
|
|
52
|
+
open: false,
|
|
53
|
+
height: DEFAULT_HEIGHT,
|
|
54
|
+
});
|
|
55
|
+
// Mount the console on first open, then keep it.
|
|
56
|
+
const [hasOpened, setHasOpened] = useState(false);
|
|
57
|
+
const dragging = useRef(false);
|
|
58
|
+
// The height to return to when a maximized drawer is restored.
|
|
59
|
+
const restoreHeight = useRef(DEFAULT_HEIGHT);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
const stored = readState();
|
|
62
|
+
setState(Object.assign(Object.assign({}, stored), { height: clampHeight(stored.height) }));
|
|
63
|
+
if (stored.open)
|
|
64
|
+
setHasOpened(true);
|
|
65
|
+
}, []);
|
|
66
|
+
const toggle = useCallback(() => {
|
|
67
|
+
setState((prev) => {
|
|
68
|
+
const merged = Object.assign(Object.assign({}, prev), { open: !prev.open });
|
|
69
|
+
writeState(merged);
|
|
70
|
+
return merged;
|
|
71
|
+
});
|
|
72
|
+
setHasOpened(true);
|
|
73
|
+
}, []);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const covered = state.open ? state.height : CONSOLE_DRAWER_BAR_HEIGHT;
|
|
76
|
+
document.documentElement.style.setProperty(CONSOLE_DRAWER_HEIGHT_VAR, `${covered}px`);
|
|
77
|
+
}, [state.open, state.height]);
|
|
78
|
+
useEffect(() => () => {
|
|
79
|
+
document.documentElement.style.removeProperty(CONSOLE_DRAWER_HEIGHT_VAR);
|
|
80
|
+
}, []);
|
|
81
|
+
// openConsoleDrawer() from any button or page.
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
const onOpen = () => {
|
|
84
|
+
setState((prev) => {
|
|
85
|
+
if (prev.open)
|
|
86
|
+
return prev;
|
|
87
|
+
const merged = Object.assign(Object.assign({}, prev), { open: true });
|
|
88
|
+
writeState(merged);
|
|
89
|
+
return merged;
|
|
90
|
+
});
|
|
91
|
+
setHasOpened(true);
|
|
92
|
+
};
|
|
93
|
+
window.addEventListener(CONSOLE_OPEN_EVENT, onOpen);
|
|
94
|
+
return () => window.removeEventListener(CONSOLE_OPEN_EVENT, onOpen);
|
|
95
|
+
}, []);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
const onKey = (event) => {
|
|
98
|
+
if (event.ctrlKey && event.key === '`') {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
toggle();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
window.addEventListener('keydown', onKey);
|
|
104
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
105
|
+
}, [toggle]);
|
|
106
|
+
const setHeight = (height) => {
|
|
107
|
+
setState((prev) => {
|
|
108
|
+
const merged = Object.assign(Object.assign({}, prev), { height: clampHeight(height) });
|
|
109
|
+
writeState(merged);
|
|
110
|
+
return merged;
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const isMaximized = typeof window !== 'undefined' &&
|
|
114
|
+
state.height >= clampHeight(Number.POSITIVE_INFINITY);
|
|
115
|
+
const toggleMaximized = () => {
|
|
116
|
+
if (isMaximized) {
|
|
117
|
+
setHeight(restoreHeight.current);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
restoreHeight.current = state.height;
|
|
121
|
+
setHeight(Number.POSITIVE_INFINITY);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const onResizeStart = (event) => {
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
dragging.current = true;
|
|
127
|
+
const onMove = (move) => {
|
|
128
|
+
if (!dragging.current)
|
|
129
|
+
return;
|
|
130
|
+
setState((prev) => (Object.assign(Object.assign({}, prev), { height: clampHeight(window.innerHeight - move.clientY) })));
|
|
131
|
+
};
|
|
132
|
+
const onUp = () => {
|
|
133
|
+
dragging.current = false;
|
|
134
|
+
window.removeEventListener('pointermove', onMove);
|
|
135
|
+
window.removeEventListener('pointerup', onUp);
|
|
136
|
+
setState((prev) => {
|
|
137
|
+
writeState(prev);
|
|
138
|
+
return prev;
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
window.addEventListener('pointermove', onMove);
|
|
142
|
+
window.addEventListener('pointerup', onUp);
|
|
143
|
+
};
|
|
144
|
+
return (_jsxs("div", { className: `fixed bottom-0 z-30 flex flex-col border-t border-gray-800 bg-gray-950 shadow-2xl ${className}`, style: { height: state.open ? state.height : undefined }, "data-testid": "console-drawer", children: [state.open && (_jsx("div", { role: "separator", "aria-orientation": "horizontal", "aria-label": "Resize console", onPointerDown: onResizeStart, onDoubleClick: () => setHeight(DEFAULT_HEIGHT), title: "Drag to resize; double-click to reset", className: "h-1 shrink-0 cursor-row-resize bg-gray-800 hover:bg-cyan-700" })), _jsxs("div", { className: "flex h-8 shrink-0 items-center text-xs text-gray-400", children: [_jsxs("button", { type: "button", onClick: toggle, "aria-expanded": state.open, className: "flex h-full flex-1 items-center gap-2 px-3 hover:text-gray-200", children: [_jsx(HiTerminal, { className: "h-4 w-4" }), _jsx("span", { className: "font-medium tracking-wider uppercase", children: "Console" }), _jsx("span", { className: "text-gray-600", children: "Ctrl+`" }), _jsx("span", { className: "ml-auto", children: state.open ? (_jsx(HiChevronDown, { className: "h-4 w-4" })) : (_jsx(HiChevronUp, { className: "h-4 w-4" })) })] }), state.open && (_jsx("button", { type: "button", onClick: toggleMaximized, "aria-label": isMaximized ? 'Restore console size' : 'Maximize console', title: isMaximized ? 'Restore' : 'Maximize', className: "flex h-full items-center px-3 hover:text-gray-200", children: isMaximized ? (_jsx(HiOutlineMinus, { className: "h-4 w-4" })) : (_jsx(HiOutlineArrowsExpand, { className: "h-4 w-4" })) }))] }), hasOpened && (_jsx("div", { className: `min-h-0 flex-1 ${state.open ? '' : 'hidden'}`, children: _jsx(ConsoleContent, { config: config, variant: "panel" }) }))] }));
|
|
145
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ConsoleContent } from './ConsoleContent';
|
|
2
|
+
export { CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleDrawer, } from './ConsoleDrawer';
|
|
2
3
|
export { ConsoleMarkdown } from './ConsoleMarkdown';
|
|
3
4
|
export { EXAMPLE_SETS, buildGraphAwareConsoleConfig, getGraphExampleKind, useGraphAwareConsoleConfig, } from './graphAwareConfig';
|
|
4
5
|
export type { ConsoleBranding, GraphExampleKind, GraphExampleSet, } from './graphAwareConfig';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { ConsoleContent } from './ConsoleContent';
|
|
2
|
+
export { CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleDrawer, } from './ConsoleDrawer';
|
|
2
3
|
export { ConsoleMarkdown } from './ConsoleMarkdown';
|
|
3
4
|
export { EXAMPLE_SETS, buildGraphAwareConsoleConfig, getGraphExampleKind, useGraphAwareConsoleConfig, } from './graphAwareConfig';
|
|
4
5
|
export { ProgressiveText } from './ProgressiveText';
|
package/components/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ConsoleContent } from './console';
|
|
1
|
+
export { CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleContent, ConsoleDrawer, } from './console';
|
|
2
2
|
export { EntitySelector, type EntityGroup, type SelectableEntity, } from './EntitySelector';
|
|
3
3
|
export { EntitySelectorCore, type EntityLike, type EntityRecord, type EntitySelectorProps, type GraphWithEntities, } from './EntitySelectorCore';
|
|
4
4
|
export { GraphFilters, byGraphType, composeFilters, excludeRepositories, excludeSubgraphs, hasAllSchemaExtensions, hasAnySchemaExtension, hasSchemaExtension, onlyEntityGraphs, onlyGenericGraphs, onlyRepositories, onlyUserGraphs, } from './graph-filters';
|
package/components/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { ConsoleContent } from './console';
|
|
1
|
+
export { CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleContent, ConsoleDrawer, } from './console';
|
|
2
2
|
export { EntitySelector, } from './EntitySelector';
|
|
3
3
|
export { EntitySelectorCore, } from './EntitySelectorCore';
|
|
4
4
|
export { GraphFilters, byGraphType, composeFilters, excludeRepositories, excludeSubgraphs, hasAllSchemaExtensions, hasAnySchemaExtension, hasSchemaExtension, onlyEntityGraphs, onlyGenericGraphs, onlyRepositories, onlyUserGraphs, } from './graph-filters';
|
package/index.d.ts
CHANGED
|
@@ -4,14 +4,14 @@ export { clearUserCookies, clearUserLocalStorage, clearUserSessionStorage, listU
|
|
|
4
4
|
export { AppSwitcher, AuthGuard, AuthProvider, LoginRedirector, SignInForm, SignUpForm, useAuth, } from './auth-components';
|
|
5
5
|
export { useApiError, useGraphWrites, useMediaQuery, useToast, useUser, useUserLimits, type ToastMessage, } from './hooks';
|
|
6
6
|
export { createGraphContext, createGraphProvider, createUseGraphContext, EntityProvider, GraphContext, GraphProvider, OrgProvider, ServiceOfferingsProvider, SidebarProvider, useEntity, useGraphContext, useOrg, useServiceOfferings, useSidebarContext, type EntityContextValue, type EntityProviderProps, type GraphContextValue, type GraphProviderProps, type GraphState, type OrgContextState, type OrgContextValue, type OrgProviderProps, type ServiceOfferings, } from './contexts';
|
|
7
|
-
export { clientGraphCookie, clientSidebarCookie, createMcpConnectorUrl, emitGraphWrites, entityCookie, GRAPH_WRITES_EVENT, graphCookie, readGraphWrites, sidebarCookie, type EntityCookie, type GraphCookie, type GraphWrite, type GraphWritesDetail, type McpConnectorUrl, type SidebarCookie, } from './lib';
|
|
7
|
+
export { clientGraphCookie, clientSidebarCookie, CONSOLE_OPEN_EVENT, createMcpConnectorUrl, emitGraphWrites, entityCookie, GRAPH_WRITES_EVENT, graphCookie, openConsoleDrawer, readGraphWrites, sidebarCookie, type EntityCookie, type GraphCookie, type GraphWrite, type GraphWritesDetail, type McpConnectorUrl, type SidebarCookie, } from './lib';
|
|
8
8
|
export { ApiError, errorStatus, extractErrorDetail, isApiError, isSessionRejection, isTransientError, toApiError, unwrapSdk, type SdkResult, } from './lib/sdk-errors';
|
|
9
9
|
export { generateEntityUri, isUUID, UUID_REGEX } from './utils';
|
|
10
10
|
export { clearGraphSelection, getGraphSelection, persistGraphSelection, } from './actions/graph-actions';
|
|
11
11
|
export { clearEntitySelection, getEntitySelection, persistEntitySelection, } from './actions/entity-actions';
|
|
12
12
|
export type { Entities, Entity, User } from './types';
|
|
13
13
|
export { customTheme } from './theme';
|
|
14
|
-
export { buildGraphAwareConsoleConfig, ConsoleContent, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
14
|
+
export { buildGraphAwareConsoleConfig, CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleContent, ConsoleDrawer, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
15
15
|
export type { ConsoleBranding, ConsoleCommandContext, ConsoleConfig, ConsoleExtraCommand, ConsoleHeaderConfig, ConsoleMcpConfig, ConsoleWelcomeConfig, GraphExampleKind, GraphExampleSet, SampleQuery, } from './components/console';
|
|
16
16
|
export { anchoredMessage, errorDetail, ReportChat, type ReportChatProps, } from './components/report-chat';
|
|
17
17
|
export { ActiveSubscriptions, BrowseRepositories, EntitySelector, EntitySelectorCore, GraphSelectorCore, PageLayout, RepositoryGuard, SearchBar, SearchContent, SearchHitCard, SearchPagination, SearchResultsMeta, useIsRepository, type ActiveSubscriptionsProps, type BrowseRepositoriesProps, type EntityGroup, type EntityLike, type EntityRecord, type EntitySelectorProps, type GraphSelectorProps, type GraphWithEntities, type SearchBarProps, type SearchConfig, type SearchFilterConfig, type SearchHitCardProps, type SearchPaginationProps, type SearchResultsMetaProps, type SelectableEntity, } from './components';
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ OrgProvider,
|
|
|
20
20
|
// Service offerings context
|
|
21
21
|
ServiceOfferingsProvider, SidebarProvider, useEntity, useGraphContext, useOrg, useServiceOfferings, useSidebarContext, } from './contexts';
|
|
22
22
|
// Export lib utilities
|
|
23
|
-
export { clientGraphCookie, clientSidebarCookie, createMcpConnectorUrl, emitGraphWrites, entityCookie, GRAPH_WRITES_EVENT, graphCookie, readGraphWrites, sidebarCookie, } from './lib';
|
|
23
|
+
export { clientGraphCookie, clientSidebarCookie, CONSOLE_OPEN_EVENT, createMcpConnectorUrl, emitGraphWrites, entityCookie, GRAPH_WRITES_EVENT, graphCookie, openConsoleDrawer, readGraphWrites, sidebarCookie, } from './lib';
|
|
24
24
|
// Export the SDK error seam (unwrap an SDK result or throw ApiError)
|
|
25
25
|
export { ApiError, errorStatus, extractErrorDetail, isApiError, isSessionRejection, isTransientError, toApiError, unwrapSdk, } from './lib/sdk-errors';
|
|
26
26
|
// Export utils
|
|
@@ -32,7 +32,7 @@ export { clearEntitySelection, getEntitySelection, persistEntitySelection, } fro
|
|
|
32
32
|
export { customTheme } from './theme';
|
|
33
33
|
// Export components
|
|
34
34
|
// Export console components
|
|
35
|
-
export { buildGraphAwareConsoleConfig, ConsoleContent, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
35
|
+
export { buildGraphAwareConsoleConfig, CONSOLE_DRAWER_BAR_HEIGHT, CONSOLE_DRAWER_HEIGHT_VAR, ConsoleContent, ConsoleDrawer, EXAMPLE_SETS, getGraphExampleKind, useGraphAwareConsoleConfig, } from './components/console';
|
|
36
36
|
export { anchoredMessage, errorDetail, ReportChat, } from './components/report-chat';
|
|
37
37
|
export { ActiveSubscriptions, BrowseRepositories, EntitySelector, EntitySelectorCore, GraphSelectorCore, PageLayout, RepositoryGuard, SearchBar, SearchContent, SearchHitCard, SearchPagination, SearchResultsMeta, useIsRepository, } from './components';
|
|
38
38
|
// Export graph filters
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Window event that opens the console drawer from anywhere in an app. */
|
|
2
|
+
export declare const CONSOLE_OPEN_EVENT = "robosystems:console-open";
|
|
3
|
+
/** Where the drawer keeps whether it is open and its height. */
|
|
4
|
+
export declare const CONSOLE_DRAWER_STORAGE_KEY = "robosystems:console-drawer";
|
|
5
|
+
/**
|
|
6
|
+
* Open the console drawer: the one way into the console, from any page.
|
|
7
|
+
*
|
|
8
|
+
* Records the open state as well as signalling it, so a call made before
|
|
9
|
+
* the drawer has mounted (a page's effect runs before its layout's) is
|
|
10
|
+
* still honoured when the drawer reads its state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function openConsoleDrawer(): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Window event that opens the console drawer from anywhere in an app. */
|
|
2
|
+
export const CONSOLE_OPEN_EVENT = 'robosystems:console-open';
|
|
3
|
+
/** Where the drawer keeps whether it is open and its height. */
|
|
4
|
+
export const CONSOLE_DRAWER_STORAGE_KEY = 'robosystems:console-drawer';
|
|
5
|
+
/**
|
|
6
|
+
* Open the console drawer: the one way into the console, from any page.
|
|
7
|
+
*
|
|
8
|
+
* Records the open state as well as signalling it, so a call made before
|
|
9
|
+
* the drawer has mounted (a page's effect runs before its layout's) is
|
|
10
|
+
* still honoured when the drawer reads its state.
|
|
11
|
+
*/
|
|
12
|
+
export function openConsoleDrawer() {
|
|
13
|
+
if (typeof window === 'undefined')
|
|
14
|
+
return;
|
|
15
|
+
try {
|
|
16
|
+
const raw = window.localStorage.getItem(CONSOLE_DRAWER_STORAGE_KEY);
|
|
17
|
+
const state = raw ? JSON.parse(raw) : {};
|
|
18
|
+
window.localStorage.setItem(CONSOLE_DRAWER_STORAGE_KEY, JSON.stringify(Object.assign(Object.assign({}, state), { open: true })));
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
// Storage unavailable: the event alone opens a mounted drawer.
|
|
22
|
+
}
|
|
23
|
+
window.dispatchEvent(new Event(CONSOLE_OPEN_EVENT));
|
|
24
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { clientSidebarCookie, sidebarCookie, type SidebarCookie, } from './sidebar-cookie';
|
|
2
2
|
export { clientGraphCookie, graphCookie, type GraphCookie, } from './graph-cookie';
|
|
3
|
+
export { CONSOLE_OPEN_EVENT, openConsoleDrawer } from './console-drawer';
|
|
3
4
|
export { entityCookie, type EntityCookie } from './entity-cookie';
|
|
4
5
|
export { GRAPH_WRITES_EVENT, emitGraphWrites, readGraphWrites, type GraphWrite, type GraphWritesDetail, } from './graph-writes';
|
|
5
6
|
export { createMcpConnectorUrl, type McpConnectorUrl } from './mcp-connector';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { clientSidebarCookie, sidebarCookie, } from './sidebar-cookie';
|
|
2
2
|
export { clientGraphCookie, graphCookie, } from './graph-cookie';
|
|
3
|
+
export { CONSOLE_OPEN_EVENT, openConsoleDrawer } from './console-drawer';
|
|
3
4
|
export { entityCookie } from './entity-cookie';
|
|
4
5
|
export { GRAPH_WRITES_EVENT, emitGraphWrites, readGraphWrites, } from './graph-writes';
|
|
5
6
|
export { createMcpConnectorUrl } from './mcp-connector';
|
package/package.json
CHANGED