@stigmer/react 3.4.1 → 3.5.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.
- package/agent/AgentDetailView.d.ts +14 -4
- package/agent/AgentDetailView.d.ts.map +1 -1
- package/agent/AgentDetailView.js +73 -11
- package/agent/AgentDetailView.js.map +1 -1
- package/agent/internal/agentToInput.d.ts +3 -0
- package/agent/internal/agentToInput.d.ts.map +1 -1
- package/agent/internal/agentToInput.js +21 -1
- package/agent/internal/agentToInput.js.map +1 -1
- package/api-key/ApiKeyListPanel.d.ts +8 -1
- package/api-key/ApiKeyListPanel.d.ts.map +1 -1
- package/api-key/ApiKeyListPanel.js +9 -7
- package/api-key/ApiKeyListPanel.js.map +1 -1
- package/dependency-graph/DependencyTreeNode.d.ts.map +1 -1
- package/dependency-graph/DependencyTreeNode.js +8 -0
- package/dependency-graph/DependencyTreeNode.js.map +1 -1
- package/dependency-graph/types.d.ts +20 -8
- package/dependency-graph/types.d.ts.map +1 -1
- package/dependency-graph/useDependencyGraph.d.ts.map +1 -1
- package/dependency-graph/useDependencyGraph.js +21 -1
- package/dependency-graph/useDependencyGraph.js.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/internal/scroll-area.d.ts +4 -0
- package/internal/scroll-area.d.ts.map +1 -0
- package/internal/scroll-area.js +15 -0
- package/internal/scroll-area.js.map +1 -0
- package/internal/tooltip.d.ts +7 -0
- package/internal/tooltip.d.ts.map +1 -0
- package/internal/tooltip.js +31 -0
- package/internal/tooltip.js.map +1 -0
- package/mcp-server/StdioSandboxNotice.d.ts +12 -11
- package/mcp-server/StdioSandboxNotice.d.ts.map +1 -1
- package/mcp-server/StdioSandboxNotice.js +13 -12
- package/mcp-server/StdioSandboxNotice.js.map +1 -1
- package/mcp-server/steps/IdentityTransportStep.d.ts.map +1 -1
- package/mcp-server/steps/IdentityTransportStep.js +1 -1
- package/mcp-server/steps/IdentityTransportStep.js.map +1 -1
- package/package.json +4 -4
- package/resource-creation/templates/mcp-server-templates.d.ts.map +1 -1
- package/resource-creation/templates/mcp-server-templates.js +17 -14
- package/resource-creation/templates/mcp-server-templates.js.map +1 -1
- package/session/useSessionExecutions.d.ts +14 -0
- package/session/useSessionExecutions.d.ts.map +1 -1
- package/session/useSessionExecutions.js +27 -1
- package/session/useSessionExecutions.js.map +1 -1
- package/sidebar/SettingsSidebar.d.ts +62 -0
- package/sidebar/SettingsSidebar.d.ts.map +1 -0
- package/sidebar/SettingsSidebar.js +60 -0
- package/sidebar/SettingsSidebar.js.map +1 -0
- package/sidebar/WorkspaceSidebar.d.ts +87 -0
- package/sidebar/WorkspaceSidebar.d.ts.map +1 -0
- package/sidebar/WorkspaceSidebar.js +95 -0
- package/sidebar/WorkspaceSidebar.js.map +1 -0
- package/sidebar/chrome.d.ts +48 -0
- package/sidebar/chrome.d.ts.map +1 -0
- package/sidebar/chrome.js +32 -0
- package/sidebar/chrome.js.map +1 -0
- package/sidebar/index.d.ts +6 -0
- package/sidebar/index.d.ts.map +1 -0
- package/sidebar/index.js +9 -0
- package/sidebar/index.js.map +1 -0
- package/sidebar/types.d.ts +54 -0
- package/sidebar/types.d.ts.map +1 -0
- package/sidebar/types.js +2 -0
- package/sidebar/types.js.map +1 -0
- package/src/agent/AgentDetailView.tsx +198 -11
- package/src/agent/__tests__/AgentDetailView.datastores.test.tsx +166 -0
- package/src/agent/internal/__tests__/agentToInput.test.ts +154 -0
- package/src/agent/internal/agentToInput.ts +25 -7
- package/src/api-key/ApiKeyListPanel.tsx +17 -4
- package/src/dependency-graph/DependencyTreeNode.tsx +8 -0
- package/src/dependency-graph/__tests__/useDependencyGraph.test.ts +108 -0
- package/src/dependency-graph/types.ts +20 -8
- package/src/dependency-graph/useDependencyGraph.ts +23 -1
- package/src/index.ts +13 -0
- package/src/internal/scroll-area.tsx +37 -0
- package/src/internal/tooltip.tsx +66 -0
- package/src/mcp-server/StdioSandboxNotice.tsx +16 -14
- package/src/mcp-server/__tests__/StdioSandboxNotice.test.tsx +3 -2
- package/src/mcp-server/steps/IdentityTransportStep.tsx +7 -0
- package/src/resource-creation/templates/mcp-server-templates.ts +17 -14
- package/src/session/__tests__/useSessionExecutions.test.ts +63 -0
- package/src/session/useSessionExecutions.ts +27 -1
- package/src/sidebar/SettingsSidebar.tsx +173 -0
- package/src/sidebar/WorkspaceSidebar.tsx +386 -0
- package/src/sidebar/__tests__/SettingsSidebar.test.tsx +107 -0
- package/src/sidebar/__tests__/WorkspaceSidebar.test.tsx +236 -0
- package/src/sidebar/chrome.tsx +129 -0
- package/src/sidebar/index.ts +16 -0
- package/src/sidebar/types.ts +55 -0
- package/src/test/__tests__/samples.test.ts +2 -0
- package/src/test/samples.ts +48 -0
- package/styles.css +1 -1
- package/test/samples.d.ts +21 -0
- package/test/samples.d.ts.map +1 -1
- package/test/samples.js +32 -0
- package/test/samples.js.map +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { memo, useMemo } from "react";
|
|
4
|
+
import { Plus, LayoutDashboard, Library, MessageSquare, Workflow, } from "lucide-react";
|
|
5
|
+
import { groupRecentActivityByTime } from "../activity/group-activity.js";
|
|
6
|
+
import { formatRelativeTime } from "../activity/format-relative-time.js";
|
|
7
|
+
import { recentActivityStatusBadge } from "../activity/entry-status-badge.js";
|
|
8
|
+
import { ScrollArea } from "../internal/scroll-area.js";
|
|
9
|
+
import { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent, } from "../internal/tooltip.js";
|
|
10
|
+
import { SidebarChrome, SidebarSeparator, navRowClassName } from "./chrome.js";
|
|
11
|
+
/**
|
|
12
|
+
* The console's workspace-zone sidebar: org switcher, primary navigation
|
|
13
|
+
* (New Session / Dashboard / Library), time-bucketed recent activity,
|
|
14
|
+
* and a user footer.
|
|
15
|
+
*
|
|
16
|
+
* This is the same component the Stigmer web console and desktop app
|
|
17
|
+
* render — hosts differ only in what they return from `renderLink`
|
|
18
|
+
* (their router's link), what they pass as `recentActivity` (live hook
|
|
19
|
+
* data or frozen fixtures), and the `footer` slot. Documentation tours
|
|
20
|
+
* render it too, which is the point: the depicted chrome cannot drift
|
|
21
|
+
* from the product because it *is* the product (stigmer/stigmer#317).
|
|
22
|
+
*
|
|
23
|
+
* Layout note: the sidebar fills its container's height and defines no
|
|
24
|
+
* width — the console's app shell owns the `w-70` (280px) column.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <WorkspaceSidebar
|
|
29
|
+
* activeNav="library"
|
|
30
|
+
* renderLink={({ href, children, ...rest }) => (
|
|
31
|
+
* <Link href={href} {...rest}>{children}</Link>
|
|
32
|
+
* )}
|
|
33
|
+
* recentActivity={useRecentActivity()}
|
|
34
|
+
* footer={<UserMenu />}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function WorkspaceSidebar({ activeNav = null, renderLink, recentActivity, activeSessionId = null, activeExecutionId = null, renderEntryAccessory, footer, isOpen = true, onCollapse, onOrgChanged, now, }) {
|
|
39
|
+
const { entries, isLoading = false, error = null } = recentActivity;
|
|
40
|
+
const groups = useMemo(() => groupRecentActivityByTime(entries, now), [entries, now]);
|
|
41
|
+
return (_jsxs(SidebarChrome, { ariaLabel: "Main navigation", isOpen: isOpen, onCollapse: onCollapse, onOrgChanged: onOrgChanged, footer: footer, children: [_jsx(PrimaryNavRow, { id: "new-session", href: "/", label: "New Session", icon: Plus, active: activeNav === "new-session", renderLink: renderLink }), _jsx(PrimaryNavRow, { id: "dashboard", href: "/dashboard", label: "Dashboard", icon: LayoutDashboard, active: activeNav === "dashboard", renderLink: renderLink }), _jsx(PrimaryNavRow, { id: "library", href: "/library", label: "Library", icon: Library, active: activeNav === "library", renderLink: renderLink }), _jsx(SidebarSeparator, {}), _jsx(ScrollArea, { className: "flex-1", children: _jsxs("div", { className: "p-3", children: [_jsx("p", { className: "text-sidebar-muted-foreground mb-2 px-1 text-[11px] font-semibold tracking-wider uppercase", children: "Recents" }), isLoading ? (_jsx(RecentsSkeletons, {})) : error ? (_jsx(RecentsError, { message: error.message })) : groups.length === 0 ? (_jsx(RecentsEmptyState, {})) : (_jsx(ActivityGroupList, { groups: groups, activeSessionId: activeSessionId, activeExecutionId: activeExecutionId, renderLink: renderLink, renderEntryAccessory: renderEntryAccessory, now: now }))] }) })] }));
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Internals
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
function PrimaryNavRow({ id, href, label, icon: Icon, active, renderLink, }) {
|
|
47
|
+
return (_jsx("div", { className: "flex-none px-3 py-1", children: renderLink({
|
|
48
|
+
id,
|
|
49
|
+
href,
|
|
50
|
+
active,
|
|
51
|
+
className: navRowClassName(active),
|
|
52
|
+
"aria-current": active ? "page" : undefined,
|
|
53
|
+
children: (_jsxs(_Fragment, { children: [_jsx(Icon, { className: "size-4 shrink-0" }), label] })),
|
|
54
|
+
}) }));
|
|
55
|
+
}
|
|
56
|
+
function ActivityGroupList({ groups, activeSessionId, activeExecutionId, renderLink, renderEntryAccessory, now, }) {
|
|
57
|
+
return (_jsx(TooltipProvider, { children: _jsx("div", { className: "space-y-4", children: groups.map((group) => (_jsxs("div", { children: [_jsx("p", { className: "text-sidebar-muted-foreground mb-1 px-2 text-[10px] font-medium tracking-wider uppercase", children: group.label }), _jsx("ul", { className: "space-y-0.5", role: "list", children: group.entries.map((entry) => (_jsx(ActivityEntry, { entry: entry, activeSessionId: activeSessionId, activeExecutionId: activeExecutionId, renderLink: renderLink, renderEntryAccessory: renderEntryAccessory, now: now }, entry.id))) })] }, group.label))) }) }));
|
|
58
|
+
}
|
|
59
|
+
const ActivityEntry = memo(function ActivityEntry({ entry, activeSessionId, activeExecutionId, renderLink, renderEntryAccessory, now, }) {
|
|
60
|
+
const isSession = entry.type === "session";
|
|
61
|
+
const isActive = isSession
|
|
62
|
+
? entry.id === activeSessionId
|
|
63
|
+
: entry.id === activeExecutionId;
|
|
64
|
+
const href = isSession ? `/sessions/${entry.id}` : `/executions/${entry.id}`;
|
|
65
|
+
const TypeIcon = isSession ? MessageSquare : Workflow;
|
|
66
|
+
const statusBadge = recentActivityStatusBadge(entry);
|
|
67
|
+
const row = renderLink({
|
|
68
|
+
id: entry.id,
|
|
69
|
+
href,
|
|
70
|
+
active: isActive,
|
|
71
|
+
"aria-current": isActive ? "page" : undefined,
|
|
72
|
+
entry,
|
|
73
|
+
className: cnActivityRow(isActive),
|
|
74
|
+
children: (_jsxs(_Fragment, { children: [_jsx(TypeIcon, { className: "mt-0.5 size-3 shrink-0 opacity-50", "aria-hidden": "true" }), _jsx("span", { className: "line-clamp-2 flex-1", children: entry.subject }), _jsxs("span", { className: "flex shrink-0 flex-col items-end gap-0.5 text-[10px] leading-tight", children: [_jsx("span", { className: "text-sidebar-muted-foreground tabular-nums", children: formatRelativeTime(entry.updatedAt, now) }), statusBadge && (_jsx("span", { className: statusBadge.tone === "destructive"
|
|
75
|
+
? "text-destructive"
|
|
76
|
+
: "text-sidebar-muted-foreground", children: statusBadge.label }))] }), renderEntryAccessory?.(entry)] })),
|
|
77
|
+
});
|
|
78
|
+
return (_jsx("li", { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: row }), _jsx(TooltipContent, { side: "right", sideOffset: 12, children: entry.subject })] }) }));
|
|
79
|
+
});
|
|
80
|
+
/** Recents rows are denser than primary nav: 12px text, top-aligned icon. */
|
|
81
|
+
function cnActivityRow(active) {
|
|
82
|
+
return active
|
|
83
|
+
? "flex items-start gap-2 rounded-lg px-2 py-1.5 text-xs transition-colors bg-sidebar-accent text-sidebar-accent-foreground font-medium"
|
|
84
|
+
: "flex items-start gap-2 rounded-lg px-2 py-1.5 text-xs transition-colors text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground";
|
|
85
|
+
}
|
|
86
|
+
function RecentsSkeletons() {
|
|
87
|
+
return (_jsx("div", { className: "space-y-2 px-2", "aria-busy": "true", "aria-label": "Loading sessions", children: Array.from({ length: 5 }, (_, i) => (_jsx("div", { className: "bg-sidebar-muted h-5 animate-pulse rounded", style: { width: `${70 + Math.sin(i * 1.5) * 20}%` } }, i))) }));
|
|
88
|
+
}
|
|
89
|
+
function RecentsError({ message }) {
|
|
90
|
+
return (_jsxs(_Fragment, { children: [_jsx("p", { className: "text-destructive mb-4 px-2 text-xs", role: "alert", children: message }), _jsx(RecentsEmptyState, {})] }));
|
|
91
|
+
}
|
|
92
|
+
function RecentsEmptyState() {
|
|
93
|
+
return (_jsxs("div", { className: "flex flex-col items-center gap-2 py-8 text-center", children: [_jsx(MessageSquare, { className: "text-sidebar-muted-foreground size-8" }), _jsx("p", { className: "text-sidebar-muted-foreground text-xs", children: "No recent activity" })] }));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=WorkspaceSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceSidebar.js","sourceRoot":"","sources":["../../src/sidebar/WorkspaceSidebar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AACtD,OAAO,EACL,IAAI,EACJ,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAQ,GAET,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EACL,OAAO,EACP,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,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Y,kBAAkB,YAC3E,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnC,cAEE,SAAS,EAAC,4CAA4C,EACtD,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAF9C,CAAC,CAGN,CACH,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,OAAO,EAAgC;IAC7D,OAAO,CACL,8BACE,YAAG,SAAS,EAAC,oCAAoC,EAAC,IAAI,EAAC,OAAO,YAC3D,OAAO,GACN,EACJ,KAAC,iBAAiB,KAAG,IACpB,CACJ,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,CACL,eAAK,SAAS,EAAC,mDAAmD,aAChE,KAAC,aAAa,IAAC,SAAS,EAAC,sCAAsC,GAAG,EAClE,YAAG,SAAS,EAAC,uCAAuC,mCAAuB,IACvE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Organization } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/api_pb";
|
|
3
|
+
/** Props shared by both sidebar variants' outer chrome. */
|
|
4
|
+
export interface SidebarChromeProps {
|
|
5
|
+
/** Accessible name for the `<nav>` landmark. */
|
|
6
|
+
readonly ariaLabel: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the sidebar is currently expanded, reflected as
|
|
9
|
+
* `aria-expanded` on the collapse toggle. @default true
|
|
10
|
+
*/
|
|
11
|
+
readonly isOpen?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Called when the collapse toggle is pressed. The sidebar renders the
|
|
14
|
+
* toggle either way (it is part of the depicted chrome); hosts that
|
|
15
|
+
* cannot collapse (fixed embeds) simply omit the handler.
|
|
16
|
+
*/
|
|
17
|
+
readonly onCollapse?: () => void;
|
|
18
|
+
/** Passed through to {@link OrgSwitcher}. */
|
|
19
|
+
readonly onOrgChanged?: (org: Organization) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Footer content — typically the host app's `UserMenu` wrapper, which
|
|
22
|
+
* bridges auth, theming, and routing. A slot rather than a built-in
|
|
23
|
+
* because every host wires those systems differently (DD-004).
|
|
24
|
+
*/
|
|
25
|
+
readonly footer: ReactNode;
|
|
26
|
+
readonly children: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Outer sidebar frame: `<nav>` container, top row, content, footer band.
|
|
30
|
+
*
|
|
31
|
+
* The `id="sidebar"` / `aria-controls` pairing matches the console's DOM
|
|
32
|
+
* contract (the app shell's floating "Open sidebar" button targets it);
|
|
33
|
+
* only one sidebar renders at a time, so the id cannot collide.
|
|
34
|
+
*/
|
|
35
|
+
export declare function SidebarChrome({ ariaLabel, isOpen, onCollapse, onOrgChanged, footer, children, }: SidebarChromeProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
/** Hairline separator between sidebar sections. */
|
|
37
|
+
export declare function SidebarSeparator(): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* The one nav-row class recipe both sidebars share: 14px medium labels,
|
|
40
|
+
* 16px icons (sized by callers), 8px/6px padding, rounded row highlight.
|
|
41
|
+
*
|
|
42
|
+
* `muted` renders the resting label in the muted sidebar tone — used by
|
|
43
|
+
* "Back to Sessions", which is an exit, not a destination.
|
|
44
|
+
*/
|
|
45
|
+
export declare function navRowClassName(active: boolean, { muted }?: {
|
|
46
|
+
muted?: boolean;
|
|
47
|
+
}): string;
|
|
48
|
+
//# sourceMappingURL=chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../src/sidebar/chrome.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAc9F,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,MAAa,EACb,UAAU,EACV,YAAY,EACZ,MAAM,EACN,QAAQ,GACT,EAAE,kBAAkB,2CAsCpB;AAED,mDAAmD;AACnD,wBAAgB,gBAAgB,4CAM/B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,OAAO,EACf,EAAE,KAAa,EAAE,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1C,MAAM,CAUR"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PanelLeft } from "lucide-react";
|
|
4
|
+
import { cn } from "@stigmer/theme";
|
|
5
|
+
import { OrgSwitcher } from "../organization/OrgSwitcher.js";
|
|
6
|
+
/**
|
|
7
|
+
* Outer sidebar frame: `<nav>` container, top row, content, footer band.
|
|
8
|
+
*
|
|
9
|
+
* The `id="sidebar"` / `aria-controls` pairing matches the console's DOM
|
|
10
|
+
* contract (the app shell's floating "Open sidebar" button targets it);
|
|
11
|
+
* only one sidebar renders at a time, so the id cannot collide.
|
|
12
|
+
*/
|
|
13
|
+
export function SidebarChrome({ ariaLabel, isOpen = true, onCollapse, onOrgChanged, footer, children, }) {
|
|
14
|
+
return (_jsxs("nav", { id: "sidebar", "aria-label": ariaLabel, className: "bg-sidebar text-sidebar-foreground flex h-full flex-col", children: [_jsxs("div", { className: "flex flex-none items-center gap-1 px-2 py-2", children: [_jsx("button", { type: "button", onClick: onCollapse, "aria-expanded": isOpen, "aria-controls": "sidebar", "aria-label": "Collapse sidebar", className: cn("inline-flex size-7 shrink-0 items-center justify-center rounded-md", "text-sidebar-foreground transition-colors motion-reduce:transition-none", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground", "aria-expanded:bg-sidebar-accent aria-expanded:text-sidebar-accent-foreground", "focus-visible:ring-sidebar-ring focus-visible:ring-2 focus-visible:outline-none"), children: _jsx(PanelLeft, { className: "size-4" }) }), _jsx("div", { className: "min-w-0 flex-1", children: _jsx(OrgSwitcher, { onOrgChanged: onOrgChanged }) })] }), children, _jsx("div", { className: "border-sidebar-border flex-none border-t px-3 py-2", children: footer })] }));
|
|
15
|
+
}
|
|
16
|
+
/** Hairline separator between sidebar sections. */
|
|
17
|
+
export function SidebarSeparator() {
|
|
18
|
+
return (_jsx("div", { className: "px-3 py-1", children: _jsx("div", { className: "bg-sidebar-border h-px" }) }));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The one nav-row class recipe both sidebars share: 14px medium labels,
|
|
22
|
+
* 16px icons (sized by callers), 8px/6px padding, rounded row highlight.
|
|
23
|
+
*
|
|
24
|
+
* `muted` renders the resting label in the muted sidebar tone — used by
|
|
25
|
+
* "Back to Sessions", which is an exit, not a destination.
|
|
26
|
+
*/
|
|
27
|
+
export function navRowClassName(active, { muted = false } = {}) {
|
|
28
|
+
return cn("flex items-center gap-2 rounded-lg px-2 py-1.5 text-sm font-medium transition-colors", active
|
|
29
|
+
? "bg-sidebar-accent text-sidebar-accent-foreground"
|
|
30
|
+
: cn(muted ? "text-sidebar-muted-foreground" : "text-sidebar-foreground", "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chrome.js","sourceRoot":"","sources":["../../src/sidebar/chrome.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAuC7D;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,SAAS,EACT,MAAM,GAAG,IAAI,EACb,UAAU,EACV,YAAY,EACZ,MAAM,EACN,QAAQ,GACW;IACnB,OAAO,CACL,eACE,EAAE,EAAC,SAAS,gBACA,SAAS,EACrB,SAAS,EAAC,yDAAyD,aAGnE,eAAK,SAAS,EAAC,6CAA6C,aAC1D,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,UAAU,mBACJ,MAAM,mBACP,SAAS,gBACZ,kBAAkB,EAC7B,SAAS,EAAE,EAAE,CACX,oEAAoE,EACpE,yEAAyE,EACzE,8DAA8D,EAC9D,8EAA8E,EAC9E,iFAAiF,CAClF,YAED,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,EACT,cAAK,SAAS,EAAC,gBAAgB,YAC7B,KAAC,WAAW,IAAC,YAAY,EAAE,YAAY,GAAI,GACvC,IACF,EAEL,QAAQ,EAGT,cAAK,SAAS,EAAC,oDAAoD,YAChE,MAAM,GACH,IACF,CACP,CAAC;AACJ,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CACL,cAAK,SAAS,EAAC,WAAW,YACxB,cAAK,SAAS,EAAC,wBAAwB,GAAG,GACtC,CACP,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,MAAe,EACf,EAAE,KAAK,GAAG,KAAK,KAA0B,EAAE;IAE3C,OAAO,EAAE,CACP,sFAAsF,EACtF,MAAM;QACJ,CAAC,CAAC,kDAAkD;QACpD,CAAC,CAAC,EAAE,CACA,KAAK,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,yBAAyB,EACnE,8DAA8D,CAC/D,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { WorkspaceSidebar } from "./WorkspaceSidebar.js";
|
|
2
|
+
export type { WorkspaceSidebarProps, WorkspaceSidebarActivity, WorkspaceNavId, } from "./WorkspaceSidebar.js";
|
|
3
|
+
export { SettingsSidebar } from "./SettingsSidebar.js";
|
|
4
|
+
export type { SettingsSidebarProps } from "./SettingsSidebar.js";
|
|
5
|
+
export type { SidebarLinkRenderProps, RenderSidebarLink } from "./types.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sidebar/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EACV,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC"}
|
package/sidebar/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Sidebar — the console's navigation chrome as shared SDK components.
|
|
2
|
+
//
|
|
3
|
+
// One source of truth for the sidebar the web console, desktop app, and
|
|
4
|
+
// documentation tours all render (stigmer/stigmer#317): hosts inject their
|
|
5
|
+
// router via `renderLink`, their data via props, and their user menu via
|
|
6
|
+
// the `footer` slot.
|
|
7
|
+
export { WorkspaceSidebar } from "./WorkspaceSidebar.js";
|
|
8
|
+
export { SettingsSidebar } from "./SettingsSidebar.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sidebar/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,wEAAwE;AACxE,2EAA2E;AAC3E,yEAAyE;AACzE,qBAAqB;AAErB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { RecentActivityEntry } from "../activity/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Everything a sidebar hands to {@link RenderSidebarLink} to draw one
|
|
5
|
+
* interactive row.
|
|
6
|
+
*
|
|
7
|
+
* The sidebar owns the row's look (`className`, `children`) and state
|
|
8
|
+
* (`active`, `aria-current`); the consumer owns only the interactive
|
|
9
|
+
* element wrapping them. That split is what keeps one component serving
|
|
10
|
+
* three very different hosts: the web console returns `next/link`, the
|
|
11
|
+
* desktop app returns a `react-router` link, and documentation embeds
|
|
12
|
+
* return inert rows decorated with capture markers.
|
|
13
|
+
*/
|
|
14
|
+
export interface SidebarLinkRenderProps {
|
|
15
|
+
/**
|
|
16
|
+
* Stable row identifier, for consumers that vary behavior per row:
|
|
17
|
+
* `"new-session"` / `"dashboard"` / `"library"` in the workspace
|
|
18
|
+
* sidebar, `"back-to-sessions"` or the settings route basename (e.g.
|
|
19
|
+
* `"api-keys"`) in the settings sidebar, and the entry id for recent
|
|
20
|
+
* activity rows.
|
|
21
|
+
*/
|
|
22
|
+
readonly id: string;
|
|
23
|
+
/** Console route this row targets (e.g. `/library`, `/sessions/<id>`). */
|
|
24
|
+
readonly href: string;
|
|
25
|
+
/** Whether the row is the current location. */
|
|
26
|
+
readonly active: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Fully-styled row classes computed by the sidebar. Apply verbatim —
|
|
29
|
+
* the row's geometry and type scale are the product surface tours and
|
|
30
|
+
* embeds depict, so consumers must not restyle them.
|
|
31
|
+
*/
|
|
32
|
+
readonly className: string;
|
|
33
|
+
/** `"page"` when active, for assistive tech. Spread onto the element. */
|
|
34
|
+
readonly "aria-current": "page" | undefined;
|
|
35
|
+
/** Row content (icon, label, timestamps). Render inside the element. */
|
|
36
|
+
readonly children: ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* The recent-activity entry behind this row. Present only for recents
|
|
39
|
+
* rows in the workspace sidebar — consumers use it to pick the right
|
|
40
|
+
* navigation flow (session viewer vs. execution viewer) without
|
|
41
|
+
* parsing `href`.
|
|
42
|
+
*/
|
|
43
|
+
readonly entry?: RecentActivityEntry;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Renders one sidebar row as the consumer's interactive element.
|
|
47
|
+
*
|
|
48
|
+
* Must return a single element that spreads unknown props onto its
|
|
49
|
+
* underlying DOM node (all DOM elements, `next/link`, and `react-router`
|
|
50
|
+
* links qualify): the sidebar composes tooltip triggers around recents
|
|
51
|
+
* rows by cloning the returned element with merged event handlers.
|
|
52
|
+
*/
|
|
53
|
+
export type RenderSidebarLink = (props: SidebarLinkRenderProps) => ReactElement;
|
|
54
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sidebar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,sBAAsB,KAAK,YAAY,CAAC"}
|
package/sidebar/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sidebar/types.ts"],"names":[],"mappings":""}
|