@athenaintel/react 0.13.0 → 0.14.0
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/dist/chat-ui/auth/sign-in-card.d.ts +57 -0
- package/dist/chat-ui/composer/composer-action.d.ts +5 -0
- package/dist/chat-ui/composer/pending-attachment-uploads.d.ts +5 -0
- package/dist/chat-ui/composer/tiptap-composer.d.ts +35 -0
- package/dist/chat-ui/index.d.ts +34 -0
- package/dist/chat-ui/lib/asset-urls.d.ts +6 -0
- package/dist/chat-ui/mentions/mention-chip.d.ts +38 -0
- package/dist/chat-ui/mentions/mention-extension.d.ts +35 -0
- package/dist/chat-ui/mentions/suggestions/components/get-scope-name.d.ts +15 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-icon.d.ts +10 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.d.ts +22 -0
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.d.ts +9 -0
- package/dist/chat-ui/mentions/suggestions/components/menu-breadcrumbs.d.ts +10 -0
- package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +13 -0
- package/dist/chat-ui/mentions/suggestions/components/menu-skeleton.d.ts +4 -0
- package/dist/chat-ui/mentions/suggestions/components/menu-summary.d.ts +13 -0
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.d.ts +19 -0
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.d.ts +64 -0
- package/dist/chat-ui/mentions/suggestions/components/utils.d.ts +8 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +41 -0
- package/dist/chat-ui/mentions/suggestions/data/item-cache.d.ts +76 -0
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +29 -0
- package/dist/chat-ui/mentions/suggestions/data/scope-registry.d.ts +105 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +25 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +59 -0
- package/dist/chat-ui/mentions/suggestions/data/types.d.ts +156 -0
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +37 -0
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +34 -0
- package/dist/chat-ui/mentions/suggestions/data/utils/filter-items.d.ts +13 -0
- package/dist/chat-ui/mentions/suggestions/data/utils/match-query.d.ts +5 -0
- package/dist/chat-ui/mentions/suggestions/data/utils/score-match.d.ts +5 -0
- package/dist/chat-ui/mentions/suggestions/mention-suggestions.extension.d.ts +25 -0
- package/dist/chat-ui/mentions/suggestions/shims.d.ts +19 -0
- package/dist/chat-ui/messages/message-components.d.ts +56 -0
- package/dist/chat-ui/messages/running-indicator.d.ts +10 -0
- package/dist/chat-ui/thread/chat-composer-dock.d.ts +22 -0
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +46 -0
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +44 -0
- package/dist/chat-ui.cjs +6217 -0
- package/dist/chat-ui.cjs.map +1 -0
- package/dist/chat-ui.js +6217 -0
- package/dist/chat-ui.js.map +1 -0
- package/dist/index.cjs +8513 -36126
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7944 -35557
- package/dist/index.js.map +1 -1
- package/dist/mentions/mention-suggestion-list.d.ts +1 -1
- package/dist/mentions/use-mention-suggestions.d.ts +3 -2
- package/dist/scope-registry-B9XYV-FT.js +28480 -0
- package/dist/scope-registry-B9XYV-FT.js.map +1 -0
- package/dist/scope-registry-Bti8l_Xy.cjs +28495 -0
- package/dist/scope-registry-Bti8l_Xy.cjs.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/threads/api.d.ts +1 -0
- package/dist/threads/conversation-list-fetcher.d.ts +40 -0
- package/package.json +16 -4
- package/src/chat-ui/styles/theme.css +30 -0
- package/src/chat-ui/tailwind-preset.js +57 -0
- package/dist/mentions/scope-registry.d.ts +0 -21
- package/dist/mentions/types.d.ts +0 -39
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { FC, ReactNode } from "react";
|
|
2
|
+
export declare const SignInCard: FC<{
|
|
3
|
+
/** e.g. "Local build abcd1234" — shown under the heading when set. */
|
|
4
|
+
buildLabel?: string | null;
|
|
5
|
+
subtitle?: ReactNode;
|
|
6
|
+
/** Environment pickers, consent checkboxes, and other host controls. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
error?: string | null;
|
|
9
|
+
/** Hint shown above the button (e.g. host cannot open a dialog). */
|
|
10
|
+
notice?: ReactNode;
|
|
11
|
+
primaryLabel: string;
|
|
12
|
+
primaryPendingLabel: string;
|
|
13
|
+
isPending: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
onPrimary: () => void;
|
|
16
|
+
/** Developer fallbacks and other secondary affordances. */
|
|
17
|
+
footer?: ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const SignInSelect: FC<{
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
value: string;
|
|
23
|
+
options: ReadonlyArray<{
|
|
24
|
+
label: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}>;
|
|
27
|
+
onChange: (value: string) => void;
|
|
28
|
+
/** Resolved endpoint shown under the select. */
|
|
29
|
+
hint?: string | null;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const SignInTextField: FC<{
|
|
32
|
+
label: string;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
value: string;
|
|
35
|
+
onChange: (value: string) => void;
|
|
36
|
+
type?: "url" | "password" | "text";
|
|
37
|
+
className?: string;
|
|
38
|
+
}>;
|
|
39
|
+
/** Collapsible section under the primary button, for developer-only logins. */
|
|
40
|
+
export declare const SignInFallbackSection: FC<{
|
|
41
|
+
isOpen: boolean;
|
|
42
|
+
onToggle: () => void;
|
|
43
|
+
label: string;
|
|
44
|
+
children: ReactNode;
|
|
45
|
+
}>;
|
|
46
|
+
/** Secondary button matching the fallback section's weight. */
|
|
47
|
+
export declare const SignInSecondaryButton: FC<{
|
|
48
|
+
onClick: () => void;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
children: ReactNode;
|
|
51
|
+
}>;
|
|
52
|
+
/** Checkbox + explanatory copy, used for host data-use disclosures. */
|
|
53
|
+
export declare const SignInConsent: FC<{
|
|
54
|
+
checked: boolean;
|
|
55
|
+
onChange: (checked: boolean) => void;
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiptap Composer — Full Olympus mention system integration
|
|
3
|
+
*
|
|
4
|
+
* Uses the ported Olympus infrastructure:
|
|
5
|
+
* - MentionSuggestionList (with scope navigation, breadcrumbs, keyboard nav)
|
|
6
|
+
* - MentionSuggestionPopup (Floating UI positioning)
|
|
7
|
+
* - MentionSuggestionsExtension (Tiptap @ trigger)
|
|
8
|
+
* - MentionExtension (inline mention chips)
|
|
9
|
+
* - useMentionSuggestions (full Olympus categories + async data)
|
|
10
|
+
*
|
|
11
|
+
* Auth credentials for GraphQL are provided via MentionAuthCtx, and the host
|
|
12
|
+
* app (Chrome side panel, Office task pane) supplies any host-only mention
|
|
13
|
+
* items — browser tabs, for instance — through `webpages`.
|
|
14
|
+
*/
|
|
15
|
+
import { type JSONContent } from "@tiptap/core";
|
|
16
|
+
import { type MentionRootCategory } from "../mentions/suggestions/data/use-mention-suggestions";
|
|
17
|
+
import type { WebpageMention } from "../mentions/suggestions/data/types";
|
|
18
|
+
import { type UploadedChatAsset } from "@athenaintel/agent-runtime";
|
|
19
|
+
/** Convert recovered runtime text without letting Tiptap parse it as HTML. */
|
|
20
|
+
export declare function plainTextToTiptapContent(text: string): JSONContent;
|
|
21
|
+
export interface TiptapComposerHandle {
|
|
22
|
+
submit: () => Promise<void>;
|
|
23
|
+
addAttachment: (file: File) => Promise<void>;
|
|
24
|
+
insertAssetMention: (asset: UploadedChatAsset) => void;
|
|
25
|
+
}
|
|
26
|
+
export interface TiptapComposerProps {
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
threadId: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** Host-provided browser-tab mentions; empty in hosts without tab access. */
|
|
31
|
+
webpages?: readonly WebpageMention[];
|
|
32
|
+
rootCategories?: readonly MentionRootCategory[];
|
|
33
|
+
onDraftStateChange?: (hasDraft: boolean) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare const TiptapComposer: import("react").ForwardRefExoticComponent<TiptapComposerProps & import("react").RefAttributes<TiptapComposerHandle>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Athena chat UI — the thread shell, the Tiptap composer, the `@`
|
|
3
|
+
* mention system and the mention chips used by the Chrome extension side
|
|
4
|
+
* panel and the Microsoft 365 task pane. Host-specific behaviour (browser
|
|
5
|
+
* tabs, screenshots, auth transports) is injected by the host rather than
|
|
6
|
+
* living here.
|
|
7
|
+
*
|
|
8
|
+
* Published as the `@athenaintel/react/chat-ui` sub-path.
|
|
9
|
+
*/
|
|
10
|
+
export { ChatThreadShell } from "./thread/chat-thread-shell";
|
|
11
|
+
export type { ChatThreadMessageComponents, ChatThreadShellProps, } from "./thread/chat-thread-shell";
|
|
12
|
+
export { ChatComposerDock } from "./thread/chat-composer-dock";
|
|
13
|
+
export type { ChatComposerDockProps } from "./thread/chat-composer-dock";
|
|
14
|
+
export { ComposerSendOrStop } from "./thread/composer-send-or-stop";
|
|
15
|
+
export type { ComposerSendOrStopProps, ComposerStopControls, } from "./thread/composer-send-or-stop";
|
|
16
|
+
export { TiptapComposer, plainTextToTiptapContent, type TiptapComposerHandle, type TiptapComposerProps, } from "./composer/tiptap-composer";
|
|
17
|
+
export { PendingAttachmentUploads } from "./composer/pending-attachment-uploads";
|
|
18
|
+
export { resolveComposerAction, type ComposerAction, } from "./composer/composer-action";
|
|
19
|
+
export { MentionExtension, makeMentionUrl, parseMentionAnchorAttributes, } from "./mentions/mention-extension";
|
|
20
|
+
export { MentionChip, MentionLink, normalizeAthenaMentionHtml, parseMentionUrl, parseMentionsInText, } from "./mentions/mention-chip";
|
|
21
|
+
export { MentionSuggestionsExtension } from "./mentions/suggestions/mention-suggestions.extension";
|
|
22
|
+
export { MentionSuggestionList } from "./mentions/suggestions/components/mention-suggestion-list";
|
|
23
|
+
export { MentionSuggestionPopup } from "./mentions/suggestions/components/mention-suggestion-popup";
|
|
24
|
+
export { MentionIcon } from "./mentions/suggestions/components/mention-icon";
|
|
25
|
+
export { MenuList } from "./mentions/suggestions/components/menu-list";
|
|
26
|
+
export { MentionAuthCtx, fetchGraphQL, SIMPLE_SEARCH_QUERY, useMentionAuth, type MentionAuthContext, } from "./mentions/suggestions/data/api-client";
|
|
27
|
+
export { ROOT_MENTION_CATEGORIES, useMentionSuggestions, webpageMentionFingerprint, type MentionRootCategory, type MentionSuggestionsStore, } from "./mentions/suggestions/data/use-mention-suggestions";
|
|
28
|
+
export { buildRootMenuItems } from "./mentions/suggestions/data/sources";
|
|
29
|
+
export { assetTypeToIcon, assetTypeToThumb, configureAssetIconBasePath, } from "./mentions/suggestions/data/sources/asset-type-icons";
|
|
30
|
+
export { MentionMenuSection, type MenuItem, type MenuScope, type WebpageMention, type WebpageMentionScope, } from "./mentions/suggestions/data/types";
|
|
31
|
+
export { createOlympusAssetUrl } from "./lib/asset-urls";
|
|
32
|
+
export { COMPOSER_DOCK_CLASS, COMPOSER_EDITOR_ROW_CLASS, COMPOSER_SURFACE_CLASS, COMPOSER_TOOLBAR_CLASS, BranchPicker, ComposerSendButton, ComposerStopButton, IconButton, MarkdownText, SmallIconButton, THREAD_HEADER_ACTIONS_CLASS, THREAD_HEADER_CLASS, THREAD_HEADER_ICON_CLASS, THREAD_HEADER_PILL_CLASS, THREAD_PANEL_CLASS, THREAD_SCROLL_TO_BOTTOM_CLASS, UserMessage, createAssistantMessage, type CreateAssistantMessageOptions, } from "./messages/message-components";
|
|
33
|
+
export { TextShimmerLoader, ThreadRunningIndicator, } from "./messages/running-indicator";
|
|
34
|
+
export { SignInCard, SignInConsent, SignInFallbackSection, SignInSecondaryButton, SignInSelect, SignInTextField, } from "./auth/sign-in-card";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mention chip rendering for message display.
|
|
3
|
+
*
|
|
4
|
+
* Parses [@name](mention://type?...) markdown links and renders them
|
|
5
|
+
* as styled inline chips matching the Olympus mention style.
|
|
6
|
+
* Used in both user messages (inline text) and assistant messages (markdown links).
|
|
7
|
+
*/
|
|
8
|
+
import { type FC, type ReactElement, type ReactNode } from "react";
|
|
9
|
+
/**
|
|
10
|
+
* Custom <a> renderer for MarkdownTextPrimitive.
|
|
11
|
+
* Intercepts mention:// links and renders them as chips.
|
|
12
|
+
* Falls through to a normal link for non-mention URLs.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MentionLink: FC<{
|
|
15
|
+
href?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}>;
|
|
18
|
+
export declare const MentionChip: FC<{
|
|
19
|
+
name: string;
|
|
20
|
+
type?: string;
|
|
21
|
+
assetIds?: string[];
|
|
22
|
+
thumbnailUrl?: string;
|
|
23
|
+
sourceHref?: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function parseMentionUrl(url: string): {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
id: string;
|
|
29
|
+
assetIds?: string[];
|
|
30
|
+
thumbnailUrl?: string;
|
|
31
|
+
};
|
|
32
|
+
/** Turn complete model-emitted URL citation anchors into safe Markdown links. */
|
|
33
|
+
export declare function normalizeAthenaMentionHtml(text: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Parse text containing [@name](mention://...) patterns into
|
|
36
|
+
* an array of string segments and MentionChip elements.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseMentionsInText(text: string): (string | ReactElement)[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiptap Mention Node Extension
|
|
3
|
+
*
|
|
4
|
+
* Defines the mention node type used in the editor. When a mention is
|
|
5
|
+
* inserted, it creates a non-editable inline node with metadata.
|
|
6
|
+
*
|
|
7
|
+
* Renders as a chip with: [icon] Name
|
|
8
|
+
*/
|
|
9
|
+
import { Node } from "@tiptap/core";
|
|
10
|
+
export declare function makeMentionUrl(attrs: {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
name: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
thumbnailUrl?: string;
|
|
18
|
+
assetType?: string;
|
|
19
|
+
}): string;
|
|
20
|
+
export interface MentionNodeAttrs {
|
|
21
|
+
type: string;
|
|
22
|
+
name: string;
|
|
23
|
+
id: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
url?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
thumbnailUrl?: string;
|
|
28
|
+
fallbackIcon?: string;
|
|
29
|
+
assetType?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function parseMentionAnchorAttributes({ href, textContent, }: {
|
|
32
|
+
href: string;
|
|
33
|
+
textContent: string | null;
|
|
34
|
+
}): MentionNodeAttrs;
|
|
35
|
+
export declare const MentionExtension: Node<any, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MenuScope } from '../data/types';
|
|
2
|
+
import type { MentionSuggestionsStore } from '../data/use-mention-suggestions';
|
|
3
|
+
/**
|
|
4
|
+
* getScopeName - Get friendly display name for a scope
|
|
5
|
+
*
|
|
6
|
+
* Strategy:
|
|
7
|
+
* 1. Check known category names (fast path)
|
|
8
|
+
* 2. Look up dynamic item in cache (folders, assets, etc.)
|
|
9
|
+
* 3. Fall back to scope ID itself
|
|
10
|
+
*
|
|
11
|
+
* @param scope - The scope ID to look up
|
|
12
|
+
* @param store - The mention suggestions store (to access cache)
|
|
13
|
+
* @returns Friendly display name
|
|
14
|
+
*/
|
|
15
|
+
export declare function getScopeName(scope: MenuScope, store: MentionSuggestionsStore): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mention icon component.
|
|
3
|
+
* Maps string icon names to Lucide icon components.
|
|
4
|
+
*/
|
|
5
|
+
export declare function MentionIcon({ fallbackIcon, thumbnailUrl, alt, className, }: {
|
|
6
|
+
fallbackIcon?: string;
|
|
7
|
+
thumbnailUrl?: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MentionSuggestionList — Main mention menu component.
|
|
3
|
+
*
|
|
4
|
+
* Composed of:
|
|
5
|
+
* - Registry + cache backed data (async fetching)
|
|
6
|
+
* - useMenuNavigation for scope stack management
|
|
7
|
+
* - useKeyboardNavigation for keyboard handling
|
|
8
|
+
* - MenuList for item rendering with loading states
|
|
9
|
+
* - MenuSummary for breadcrumbs + back
|
|
10
|
+
*/
|
|
11
|
+
import type { Editor } from "@tiptap/core";
|
|
12
|
+
import type { MenuItem } from "../data/types";
|
|
13
|
+
import type { MentionSuggestionsStore } from "../data/use-mention-suggestions";
|
|
14
|
+
import { type KeyboardNavigationHandle } from "./use-keyboard-navigation";
|
|
15
|
+
export interface MentionSuggestionListProps {
|
|
16
|
+
store: MentionSuggestionsStore;
|
|
17
|
+
editor: Editor;
|
|
18
|
+
query: string;
|
|
19
|
+
command: (item: MenuItem) => void;
|
|
20
|
+
closeMenu: (dismissedByUser?: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const MentionSuggestionList: import("react").ForwardRefExoticComponent<MentionSuggestionListProps & import("react").RefAttributes<KeyboardNavigationHandle>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Floating popup wrapper for the mention suggestion menu.
|
|
3
|
+
* Uses Floating UI for positioning near the cursor.
|
|
4
|
+
*/
|
|
5
|
+
import { type FC, type ReactNode } from "react";
|
|
6
|
+
export declare const MentionSuggestionPopup: FC<{
|
|
7
|
+
clientRect: (() => DOMRect | null) | null;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breadcrumb navigation for the mention menu.
|
|
3
|
+
*/
|
|
4
|
+
export declare function MenuBreadcrumbs({ scopePath, onNavigate, }: {
|
|
5
|
+
scopePath: {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}[];
|
|
9
|
+
onNavigate: (scopeId: string) => void;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Individual menu item in the mention popup.
|
|
3
|
+
* Supports: tools (with description), users (with email), assets, categories.
|
|
4
|
+
*/
|
|
5
|
+
import type { MenuItem } from "../data/types";
|
|
6
|
+
export declare function MenuItemRow({ item, isSelected, onMouseEnter, onClick, showArrow, }: {
|
|
7
|
+
item: MenuItem;
|
|
8
|
+
isSelected: boolean;
|
|
9
|
+
onMouseEnter: () => void;
|
|
10
|
+
onClick: () => void;
|
|
11
|
+
showArrow?: boolean;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scrollable list of menu items with loading and empty states.
|
|
3
|
+
*/
|
|
4
|
+
import { type MenuItem } from "../data/types";
|
|
5
|
+
export declare function MenuList({ items, selectedIndex, isLoading, hasMore, onSelect, onMouseEnter, onLoadMore, }: {
|
|
6
|
+
items: MenuItem[];
|
|
7
|
+
selectedIndex: number;
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
hasMore?: boolean;
|
|
10
|
+
onSelect: (item: MenuItem) => void;
|
|
11
|
+
onMouseEnter: (index: number) => void;
|
|
12
|
+
onLoadMore?: () => void;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Summary bar at the bottom of the mention menu.
|
|
3
|
+
* Shows breadcrumbs + back button + optional loading spinner.
|
|
4
|
+
*/
|
|
5
|
+
export declare function MenuSummary({ scopePath, onNavigate, onBackClick, isFetching, }: {
|
|
6
|
+
scopePath: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}[];
|
|
10
|
+
onNavigate: (scopeId: string) => void;
|
|
11
|
+
onBackClick?: () => void;
|
|
12
|
+
isFetching?: boolean;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyboard navigation for the mention menu.
|
|
3
|
+
*
|
|
4
|
+
* Exposes an imperative handle so MentionSuggestionList can forward keystrokes
|
|
5
|
+
* from the editor into the menu.
|
|
6
|
+
*/
|
|
7
|
+
import type { ForwardedRef } from "react";
|
|
8
|
+
import type { MenuItem } from "../data/types";
|
|
9
|
+
export interface KeyboardNavigationHandle {
|
|
10
|
+
onKeyDown: (event: KeyboardEvent) => boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function useKeyboardNavigation(ref: ForwardedRef<KeyboardNavigationHandle>, opts: {
|
|
13
|
+
items: MenuItem[];
|
|
14
|
+
selectedIndex: number;
|
|
15
|
+
setSelectedIndex: (index: number) => void;
|
|
16
|
+
onSelect: (item: MenuItem) => void;
|
|
17
|
+
onBack?: () => void;
|
|
18
|
+
onClose: () => void;
|
|
19
|
+
}): void;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Store } from '@tanstack/store';
|
|
2
|
+
import type { MenuScope } from '../data/types';
|
|
3
|
+
/**
|
|
4
|
+
* Stack entry with scope and selected item position
|
|
5
|
+
*
|
|
6
|
+
* When navigating forward, we save the current selectedIndex so we can restore
|
|
7
|
+
* it when navigating back (like browser history).
|
|
8
|
+
*/
|
|
9
|
+
export interface ScopeStackEntry {
|
|
10
|
+
scope: MenuScope;
|
|
11
|
+
selectedIndex: number;
|
|
12
|
+
breadcrumbLabel?: string;
|
|
13
|
+
parentScope?: MenuScope;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Menu navigation state - tracks current navigation context
|
|
17
|
+
*
|
|
18
|
+
* This is the "current UI state" that changes as user navigates and types.
|
|
19
|
+
* Cleared when menu opens/closes.
|
|
20
|
+
*
|
|
21
|
+
* Uses a navigation stack for proper back button behavior:
|
|
22
|
+
* - Forward navigation: push to stack (with current selectedIndex)
|
|
23
|
+
* - Back navigation: pop from stack (restore selectedIndex)
|
|
24
|
+
* - Current scope: last item in stack
|
|
25
|
+
* - Parent scope: second-to-last item in stack
|
|
26
|
+
*/
|
|
27
|
+
export interface MenuNavigationState {
|
|
28
|
+
scopeStack: ScopeStackEntry[];
|
|
29
|
+
query: string;
|
|
30
|
+
isActive: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Menu navigation store with helper methods
|
|
34
|
+
*/
|
|
35
|
+
export interface MenuNavigationStore extends Store<MenuNavigationState> {
|
|
36
|
+
navigateTo: (scope: MenuScope, currentSelectedIndex: number, options?: {
|
|
37
|
+
breadcrumbLabel?: string;
|
|
38
|
+
parentScope?: MenuScope;
|
|
39
|
+
}) => void;
|
|
40
|
+
navigateBack: () => void;
|
|
41
|
+
setQuery: (query: string) => void;
|
|
42
|
+
open: () => void;
|
|
43
|
+
close: () => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Get current scope from state
|
|
47
|
+
*/
|
|
48
|
+
export declare function getCurrentScope(state: MenuNavigationState): MenuScope;
|
|
49
|
+
/**
|
|
50
|
+
* Get parent scope from state (for source inheritance)
|
|
51
|
+
*/
|
|
52
|
+
export declare function getParentScope(state: MenuNavigationState): MenuScope | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Get selected index from current scope stack entry
|
|
55
|
+
*/
|
|
56
|
+
export declare function getSelectedIndex(state: MenuNavigationState): number;
|
|
57
|
+
/**
|
|
58
|
+
* useMenuNavigation - Creates per-editor navigation state
|
|
59
|
+
*
|
|
60
|
+
* This is a UI concern - each editor instance gets its own navigation state.
|
|
61
|
+
*
|
|
62
|
+
* Returns a TanStack Store with navigation helper methods.
|
|
63
|
+
*/
|
|
64
|
+
export declare function useMenuNavigation(): MenuNavigationStore;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API client for mention data fetching.
|
|
3
|
+
*
|
|
4
|
+
* Wraps raw fetch() with GraphQL support. Hosts authenticate with either a
|
|
5
|
+
* bearer token (Chrome extension) or a workspace API key (Microsoft 365
|
|
6
|
+
* add-in); agora's /graphql accepts both.
|
|
7
|
+
*/
|
|
8
|
+
export interface MentionAuthContext {
|
|
9
|
+
backendUrl: string;
|
|
10
|
+
appUrl?: string;
|
|
11
|
+
/** Bearer credential; hosts without one authenticate with `apiKey`. */
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
workspaceId?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const MentionAuthCtx: import("react").Context<MentionAuthContext | null>;
|
|
18
|
+
export declare function useMentionAuth(): MentionAuthContext;
|
|
19
|
+
export declare function fetchGraphQL<T = any>(auth: MentionAuthContext, query: string, variables?: Record<string, any>): Promise<T>;
|
|
20
|
+
export declare const SIMPLE_SEARCH_QUERY = "\n query SimpleSearch($input: SimpleSearchRequestInput!) {\n simpleSearch(input: $input) {\n assets {\n \n id\n title\n athenaOriginalType\n athenaConvertedType\n parentFolderId\n updatedAt\n isFavorited\n isArchived\n isHidden\n\n }\n totalCount\n }\n }\n";
|
|
21
|
+
export declare const PAGINATED_ASSETS_QUERY = "\n query GetPaginatedAssetsForWorkspace(\n $limit: Int!\n $offset: Int!\n $parentFolderId: String\n $filterTypes: [String!]\n $filterColumns: ColumnFilter\n ) {\n getPaginatedAssetsForWorkspace(\n limit: $limit\n offset: $offset\n parentFolderId: $parentFolderId\n filterTypes: $filterTypes\n filterColumns: $filterColumns\n ) {\n \n id\n title\n athenaOriginalType\n athenaConvertedType\n parentFolderId\n updatedAt\n isFavorited\n isArchived\n isHidden\n\n }\n }\n";
|
|
22
|
+
export declare const WORKSPACE_MEMBERS_QUERY = "\n query GetUsersInWorkspace($workspaceId: String!) {\n getUsersInWorkspace(workspaceId: $workspaceId) {\n id\n email\n firstName\n lastName\n isAdmin\n avatarUrl\n }\n }\n";
|
|
23
|
+
export interface AssetResult {
|
|
24
|
+
id: string;
|
|
25
|
+
title: string | null;
|
|
26
|
+
athenaOriginalType: string | null;
|
|
27
|
+
athenaConvertedType: string | null;
|
|
28
|
+
parentFolderId: string | null;
|
|
29
|
+
updatedAt: string | null;
|
|
30
|
+
isFavorited: boolean | null;
|
|
31
|
+
isArchived: boolean | null;
|
|
32
|
+
isHidden: boolean | null;
|
|
33
|
+
}
|
|
34
|
+
export interface WorkspaceMember {
|
|
35
|
+
id: string;
|
|
36
|
+
email: string | null;
|
|
37
|
+
firstName: string | null;
|
|
38
|
+
lastName: string | null;
|
|
39
|
+
isAdmin: boolean;
|
|
40
|
+
avatarUrl: string | null;
|
|
41
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { MenuItem, MenuScope } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Item Cache
|
|
4
|
+
*
|
|
5
|
+
* Plain object + pure functions for caching menu items.
|
|
6
|
+
* Deduplicates by ID, handles renames/updates automatically.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Item cache - plain object
|
|
10
|
+
* Stores all fetched items
|
|
11
|
+
*/
|
|
12
|
+
export interface ItemCache {
|
|
13
|
+
items: Record<string, MenuItem>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Create empty cache
|
|
17
|
+
*/
|
|
18
|
+
export declare function createItemCache(): ItemCache;
|
|
19
|
+
/**
|
|
20
|
+
* Add items to cache with scope tagging (mutates cache)
|
|
21
|
+
*
|
|
22
|
+
* Multi-scope system:
|
|
23
|
+
* - If item exists: ADD scope to existing scopes, update fields
|
|
24
|
+
* - If item new: Create with single scope
|
|
25
|
+
*
|
|
26
|
+
* Deduplication by ID:
|
|
27
|
+
* - ✅ Handles renames: Same ID, new name → updates name, adds scope
|
|
28
|
+
* - ✅ Handles multi-membership: Same ID → adds new scope without removing old ones
|
|
29
|
+
* - ✅ Handles updates: Same ID, new data → updates data, adds scope
|
|
30
|
+
* - ❌ Does NOT handle deletions: Use clearByScope() to remove stale data
|
|
31
|
+
*
|
|
32
|
+
* @param cache - Cache to mutate
|
|
33
|
+
* @param items - Items to add (without visibleInScopes set)
|
|
34
|
+
* @param scope - Scope to tag these items with
|
|
35
|
+
*/
|
|
36
|
+
export declare function addItems(cache: ItemCache, items: MenuItem[], scope: MenuScope): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get all items (read-only)
|
|
39
|
+
*/
|
|
40
|
+
export declare function getAllItems(cache: ItemCache): MenuItem[];
|
|
41
|
+
/**
|
|
42
|
+
* Get filtered items by scope (read-only, no fetching)
|
|
43
|
+
*
|
|
44
|
+
* @param cache - Cache to read from
|
|
45
|
+
* @param scope - Current scope to filter by
|
|
46
|
+
* @param query - Search query
|
|
47
|
+
* @returns Filtered items from cache that belong to this scope
|
|
48
|
+
*/
|
|
49
|
+
export declare function getFilteredItems(cache: ItemCache, scope: MenuScope, query: string): MenuItem[];
|
|
50
|
+
/**
|
|
51
|
+
* Clear all items
|
|
52
|
+
*/
|
|
53
|
+
export declare function clearCache(cache: ItemCache): void;
|
|
54
|
+
/**
|
|
55
|
+
* Clear scope from all items (mutates cache)
|
|
56
|
+
* Used for invalidation when dynamic data changes
|
|
57
|
+
*
|
|
58
|
+
* Items lose the scope but stay in cache if they have other scopes.
|
|
59
|
+
* Only remove items completely if they have no scopes left.
|
|
60
|
+
*
|
|
61
|
+
* @param cache - Cache to mutate
|
|
62
|
+
* @param scope - Scope to remove from all items
|
|
63
|
+
*/
|
|
64
|
+
export declare function clearByScope(cache: ItemCache, scope: MenuScope): void;
|
|
65
|
+
/**
|
|
66
|
+
* Remove specific item
|
|
67
|
+
*/
|
|
68
|
+
export declare function removeItem(cache: ItemCache, itemId: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Get item by ID
|
|
71
|
+
*/
|
|
72
|
+
export declare function getItem(cache: ItemCache, itemId: string): MenuItem | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Check if item belongs to a scope
|
|
75
|
+
*/
|
|
76
|
+
export declare function hasScope(item: MenuItem, scope: MenuScope): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mention Orchestrator — Async data fetching with registry + cache.
|
|
3
|
+
*
|
|
4
|
+
* selectItems (pure read) + triggerFetchIfNeeded (async fetch).
|
|
5
|
+
*/
|
|
6
|
+
import type { MenuItem, MenuScope } from "./types";
|
|
7
|
+
import type { MentionSuggestionsStore } from "./use-mention-suggestions";
|
|
8
|
+
/**
|
|
9
|
+
* Select items for a given scope + query from the cache.
|
|
10
|
+
* Pure, synchronous read — no side effects.
|
|
11
|
+
*/
|
|
12
|
+
export declare function selectItems(store: MentionSuggestionsStore, scope: MenuScope | {
|
|
13
|
+
id: string;
|
|
14
|
+
}, query: string, _targetCount?: number, parentScope?: MenuScope | {
|
|
15
|
+
id: string;
|
|
16
|
+
}): {
|
|
17
|
+
items: MenuItem[];
|
|
18
|
+
isFetching: boolean;
|
|
19
|
+
hasMore: boolean;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Trigger an async fetch if needed.
|
|
23
|
+
* Called by useMenuItems when cache < target AND hasMore AND !fetching.
|
|
24
|
+
*/
|
|
25
|
+
export declare function triggerFetchIfNeeded(store: MentionSuggestionsStore, scope: MenuScope | {
|
|
26
|
+
id: string;
|
|
27
|
+
}, query: string, _targetCount?: number, parentScope?: MenuScope | {
|
|
28
|
+
id: string;
|
|
29
|
+
}): void;
|