@manta-eu/react 0.1.5 → 0.1.6
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/components/chat/chat-input/index.d.ts +1 -1
- package/dist/components/chat/chat-input/index.d.ts.map +1 -1
- package/dist/components/chat/chat-input/index.js +4 -5
- package/dist/components/chat-view/Chat.js +13 -3
- package/dist/components/layouts/Sidebar.d.ts.map +1 -1
- package/dist/components/layouts/Sidebar.js +15 -2
- package/dist/components/sidebar/nav-menu.d.ts +2 -0
- package/dist/components/sidebar/nav-menu.d.ts.map +1 -1
- package/dist/components/sidebar/nav-menu.js +11 -6
- package/dist/components/table/index.d.ts +26 -0
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.js +31 -1
- package/dist/explain-fact/DatalogCode.d.ts.map +1 -1
- package/dist/explain-fact/DatalogCode.js +7 -2
- package/dist/explain-fact/FactValue.js +3 -3
- package/dist/explain-fact/proof-tree/ProofTreeFormulaFooter.d.ts.map +1 -1
- package/dist/explain-fact/proof-tree/ProofTreeFormulaFooter.js +2 -1
- package/dist/globals.css +10 -102
- package/dist/graph/createNodeRouter.d.ts.map +1 -1
- package/dist/graph/createNodeRouter.js +3 -0
- package/dist/graph/nodes/BrandFacetRuleView.d.ts.map +1 -1
- package/dist/graph/nodes/BrandFacetRuleView.js +6 -4
- package/dist/graph/nodes/BrandFontFamilyView.d.ts +3 -0
- package/dist/graph/nodes/BrandFontFamilyView.d.ts.map +1 -0
- package/dist/graph/nodes/BrandFontFamilyView.js +56 -0
- package/dist/graph/nodes/BrandFontUploadButton.d.ts +6 -0
- package/dist/graph/nodes/BrandFontUploadButton.d.ts.map +1 -0
- package/dist/graph/nodes/BrandFontUploadButton.js +65 -0
- package/dist/graph/nodes/BrandGuidelinesView.d.ts.map +1 -1
- package/dist/graph/nodes/BrandGuidelinesView.js +2 -6
- package/dist/graph/nodes/brand-font.d.ts +12 -0
- package/dist/graph/nodes/brand-font.d.ts.map +1 -0
- package/dist/graph/nodes/brand-font.js +12 -0
- package/dist/graph/nodes/brand-shared.d.ts +3 -2
- package/dist/graph/nodes/brand-shared.d.ts.map +1 -1
- package/dist/graph/nodes/brand-shared.js +3 -2
- package/dist/hooks/use-connection-problems.d.ts +15 -0
- package/dist/hooks/use-connection-problems.d.ts.map +1 -0
- package/dist/hooks/use-connection-problems.js +9 -0
- package/dist/hooks/use-font-face.d.ts +3 -0
- package/dist/hooks/use-font-face.d.ts.map +1 -0
- package/dist/hooks/use-font-face.js +33 -0
- package/dist/hooks/use-graph-refresh-after-turn.d.ts +2 -0
- package/dist/hooks/use-graph-refresh-after-turn.d.ts.map +1 -0
- package/dist/hooks/use-graph-refresh-after-turn.js +12 -0
- package/dist/hooks/useAuth.d.ts +1 -0
- package/dist/hooks/useAuth.d.ts.map +1 -1
- package/dist/hooks/useAuth.js +32 -9
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/lib/activity-changeset.d.ts.map +1 -1
- package/dist/lib/activity-changeset.js +6 -3
- package/dist/lib/datastore-route-table.d.ts +1 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -1
- package/dist/lib/datastore-route-table.js +2 -0
- package/dist/lib/tool-icons.d.ts.map +1 -1
- package/dist/lib/tool-icons.js +1 -5
- package/dist/providers/ActiveChatProvider.d.ts.map +1 -1
- package/dist/providers/ActiveChatProvider.js +2 -0
- package/dist/providers/KnowledgeGraphStateContext.d.ts +0 -1
- package/dist/providers/KnowledgeGraphStateContext.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.d.ts.map +1 -1
- package/dist/providers/KnowledgeGraphStateProvider.js +8 -19
- package/dist/routes/activity/change-display.js +1 -1
- package/dist/routes/data-explorer/components/record-detail/ActionFormDialog.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/record-detail/ActionFormDialog.js +23 -9
- package/dist/routes/data-explorer/components/record-detail/action-properties.d.ts +2 -4
- package/dist/routes/data-explorer/components/record-detail/action-properties.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/record-detail/action-properties.js +8 -50
- package/dist/routes/integrations/connection-view.d.ts +4 -1
- package/dist/routes/integrations/connection-view.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.js +25 -5
- package/dist/routes/integrations/types.d.ts +1 -0
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/shacl/shacl-form-types.d.ts +2 -3
- package/dist/shacl/shacl-form-types.d.ts.map +1 -1
- package/dist/shared/graph-derived-queries.d.ts +5 -0
- package/dist/shared/graph-derived-queries.d.ts.map +1 -0
- package/dist/shared/graph-derived-queries.js +28 -0
- package/package.json +8 -11
- package/dist/components/ai-elements/chain-of-thought.d.ts +0 -30
- package/dist/components/ai-elements/chain-of-thought.d.ts.map +0 -1
- package/dist/components/ai-elements/chain-of-thought.js +0 -57
- package/dist/components/context-menu.d.ts +0 -29
- package/dist/components/context-menu.d.ts.map +0 -1
- package/dist/components/context-menu.js +0 -67
- package/dist/components/hover-card.d.ts +0 -6
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/hover-card.js +0 -15
- package/dist/components/layouts/ChatHistoryItem.d.ts +0 -9
- package/dist/components/layouts/ChatHistoryItem.d.ts.map +0 -1
- package/dist/components/layouts/ChatHistoryItem.js +0 -7
- package/dist/components/layouts/SectionHeader.d.ts +0 -8
- package/dist/components/layouts/SectionHeader.d.ts.map +0 -1
- package/dist/components/layouts/SectionHeader.js +0 -6
- package/dist/components/orbit-site/Block.d.ts +0 -8
- package/dist/components/orbit-site/Block.d.ts.map +0 -1
- package/dist/components/orbit-site/Block.js +0 -7
- package/dist/components/orbit-site/Inset.d.ts +0 -7
- package/dist/components/orbit-site/Inset.d.ts.map +0 -1
- package/dist/components/orbit-site/Inset.js +0 -6
- package/dist/components/orbit-site/Section.d.ts +0 -7
- package/dist/components/orbit-site/Section.d.ts.map +0 -1
- package/dist/components/orbit-site/Section.js +0 -6
- package/dist/components/orbit-site/ThemeSelector.d.ts +0 -3
- package/dist/components/orbit-site/ThemeSelector.d.ts.map +0 -1
- package/dist/components/orbit-site/ThemeSelector.js +0 -42
- package/dist/components/planning/SampleChanges.d.ts +0 -9
- package/dist/components/planning/SampleChanges.d.ts.map +0 -1
- package/dist/components/planning/SampleChanges.js +0 -117
- package/dist/components/tool-invocation-card/index.d.ts +0 -8
- package/dist/components/tool-invocation-card/index.d.ts.map +0 -1
- package/dist/components/tool-invocation-card/index.js +0 -7
- package/dist/lib/schema-fields.d.ts +0 -2
- package/dist/lib/schema-fields.d.ts.map +0 -1
- package/dist/lib/schema-fields.js +0 -3
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts +0 -7
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts.map +0 -1
- package/dist/routes/memories/components/ConflictTimeoutFooter.js +0 -6
|
@@ -36,7 +36,7 @@ export type ChatInputSubmitProps = {
|
|
|
36
36
|
isLoading?: boolean;
|
|
37
37
|
isDisabled?: boolean;
|
|
38
38
|
className?: string;
|
|
39
|
-
stopGeneration?: () => void
|
|
39
|
+
stopGeneration?: () => void | Promise<void>;
|
|
40
40
|
};
|
|
41
41
|
export declare function ChatInputSubmit(props: ChatInputSubmitProps): import("react/jsx-runtime").JSX.Element;
|
|
42
42
|
export type ChatInputAttachButtonProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/chat-input/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAQL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAuFF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CA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CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CAsC1D;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAmCtE;AA6ED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC,CAAC;AAIF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,kDA6DpE"}
|
|
@@ -208,11 +208,10 @@ export function ChatInputSubmit(props) {
|
|
|
208
208
|
const value = useChatInputStore((s) => s.value);
|
|
209
209
|
const files = useChatInputStore((s) => s.files);
|
|
210
210
|
const isEmpty = !value.trim() && files.length === 0;
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
return (_jsx(Button, { type: "submit", variant: "primary", size: "sm", icon: isDisabled ? Square : icon, iconOnly: true, "aria-label": ariaLabel, className: cn("mt-auto", className), disabled: isEmpty || disabled || isDisabled, isLoading: isLoading }));
|
|
211
|
+
const pause = stopGeneration ? (_jsx(Button, { type: "button", variant: "tertiary", size: "sm", icon: Pause, iconOnly: true, "aria-label": "Pause generation", className: cn("[&>svg]:size-4", className), disabled: isDisabled, onClick: () => void stopGeneration() })) : null;
|
|
212
|
+
if (pause && isEmpty)
|
|
213
|
+
return pause;
|
|
214
|
+
return (_jsxs(_Fragment, { children: [pause, _jsx(Button, { type: "submit", variant: "primary", size: "sm", icon: isDisabled ? Square : icon, iconOnly: true, "aria-label": ariaLabel, className: cn("mt-auto", className), disabled: isEmpty || disabled || isDisabled, isLoading: isLoading })] }));
|
|
216
215
|
}
|
|
217
216
|
export function ChatInputAttachButton(props) {
|
|
218
217
|
const { className } = props;
|
|
@@ -177,7 +177,7 @@ function ChatContent(props) {
|
|
|
177
177
|
setPendingAssistantTurn(true);
|
|
178
178
|
}, [setActiveTurnKey, setPendingAssistantTurn, turnKeyRef]);
|
|
179
179
|
const handleAgentSubmit = useCallback(async (value, files) => {
|
|
180
|
-
if (status === "streaming") {
|
|
180
|
+
if (status === "submitted" || status === "streaming") {
|
|
181
181
|
await stop?.();
|
|
182
182
|
}
|
|
183
183
|
let fileParts;
|
|
@@ -232,6 +232,14 @@ function ChatContent(props) {
|
|
|
232
232
|
resetChatTurn();
|
|
233
233
|
}
|
|
234
234
|
}, [beginAssistantTurn, chatData?.regenerate, resetChatTurn]);
|
|
235
|
+
const handleStopGeneration = useCallback(async () => {
|
|
236
|
+
try {
|
|
237
|
+
await stop?.();
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
resetChatTurn();
|
|
241
|
+
}
|
|
242
|
+
}, [stop, resetChatTurn]);
|
|
235
243
|
const handleFilesRejected = useCallback((rejected) => {
|
|
236
244
|
for (const { file, reason } of rejected) {
|
|
237
245
|
toast.error(`${file.name}: ${reason}`);
|
|
@@ -250,7 +258,9 @@ function ChatContent(props) {
|
|
|
250
258
|
const turnError = status === "error" ? error : undefined;
|
|
251
259
|
const isAwaitingAssistant = status === "submitted" || status === "streaming";
|
|
252
260
|
const turnInProgress = isAwaitingAssistant || isChatStreaming || isChatRecovering;
|
|
253
|
-
const
|
|
261
|
+
const isChatStarting = hasPendingMessage && !chatData;
|
|
262
|
+
const isComposerBusy = isUploading || isSessionConnecting || isChatStarting || hasPendingQuestionnaire;
|
|
263
|
+
const areStartersDisabled = isComposerBusy || turnInProgress || isResumeProbe;
|
|
254
264
|
const pendingAssistantMessageId = activeTurnKey ?? latestMessage?.id;
|
|
255
265
|
const needsPendingPlaceholder = isAwaitingAssistant && latestMessage?.role !== "assistant";
|
|
256
266
|
const displayMessages = useMemo(() => {
|
|
@@ -291,7 +301,7 @@ function ChatContent(props) {
|
|
|
291
301
|
.with({ ruleEditContext: P.nonNullable }, () => "Describe the change you'd like to make to this rule…")
|
|
292
302
|
.with({ isRuleCreateContext: true }, () => "Describe the rule you'd like to create…")
|
|
293
303
|
.otherwise(() => `Ask me anything about ${datastoreName ?? "your datastore"}...`);
|
|
294
|
-
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled:
|
|
304
|
+
const chatPanel = (_jsx("div", { ref: dropZoneRef, className: "relative h-full w-full min-w-0", children: _jsx("div", { ref: chatPanelRef, className: "h-full w-full overflow-y-auto overscroll-contain bg-base-background", children: _jsx(Conversation, { scrollRef: chatPanelRef, children: _jsxs("div", { className: "min-h-full flex flex-col", children: [_jsxs("div", { className: "sticky top-0 z-20", children: [connectionNotice, isCopilot && (_jsx(CopilotHeader, { isOperator: isOperator, datastoreId: datastore?.id, onClear: chatData?.clearHistory, onClose: onCloseAction, conversationId: activeConversation?.id, messages: chatData?.messages ?? [], isEmbedded: isEmbedded, renderMenuItems: renderMenuItems, title: title })), !isCopilot && ruleEditContext && (_jsx(RuleEditBanner, { ruleIri: ruleEditContext.ruleIri, ruleName: ruleEditName, onExit: () => startNewChat() }))] }), showGraphContextPanel && (_jsx("div", { className: "sticky top-0 z-10 h-0", children: _jsx(GraphContextPanel, { mergedGraph: graphContext.mergedGraph, graphCount: graphContext.graphCount, nodeCount: graphContext.nodeCount, sparqlQueries: graphContext.sparqlQueries }) })), _jsxs("div", { className: "flex-1 flex flex-col min-h-0", children: [!hasMessages && (_jsx("div", { "data-testid": "chat-welcome", className: "flex-1 flex flex-col items-center justify-center px-6 py-12", children: _jsxs("div", { className: "w-full max-w-4xl space-y-8 text-center", children: [_jsx(ChatWelcome, { channel: "MANTA", title: welcome.title, subtitle: welcome.subtitle, mark: mark }), _jsx(ConversationStarters, { onSubmit: handleConversationStarterSubmit, disabled: areStartersDisabled })] }) })), hasMessages && (_jsx(MessagesContainer, { messages: displayMessages, toolsUsedInSession: toolsUsedInSession, onAddToolResult: addToolResult || (() => { }), status: status, thinkingSeconds: thinkingSeconds, activeTurnKey: activeTurnKey, compact: isCopilot, animateOnMount: !hasPendingMessage, turnError: turnError, onRetryTurn: () => void handleRetryTurn(), onStartNewChat: startNewChat }))] }), _jsxs("div", { className: cn("sticky bottom-0 z-20 py-2 px-4 space-y-2 w-full bg-base-background", !isCopilot && "max-w-3xl mx-auto", isCopilot && "pb-4"), children: [hasMessages && (_jsx("div", { className: "pointer-events-none absolute -top-10 left-0 right-0 h-10 bg-linear-to-t from-base-background to-transparent" })), _jsx(ConversationScrollButton, { className: "absolute -top-12 left-1/2 -translate-x-1/2 z-30" }), !isEmbedded && latestShowcase && (_jsx(ReviewCta, { title: humanizePlanName(latestShowcase.planName), subtitle: planStatusLabel(latestShowcase.status), className: "plan-badge-border gap-4 px-4 py-2 rounded-full", onClick: () => void handleSelectPlan(latestShowcase.planIri) })), !isEmbedded && isRuleCreateContext && _jsx(StagedRuleCta, { messages: agentMessages }), _jsxs(ChatInput, { initialValue: composerDraft.initialValue, dropTargetRef: dropZoneRef, onSubmit: isComposerBusy ? undefined : composerDraft.onSubmit, onRejected: handleFilesRejected, topContent: _jsx(ChatInputFilePreview, { progress: uploadProgress }), children: [!hasPendingQuestionnaire && _jsx(ChatInputAttachButton, {}), _jsx(ChatInputTextarea, { placeholder: composerPlaceholder, className: "pl-5", autoFocus: shouldAutoFocusInput, disabled: hasPendingQuestionnaire, "data-chat-input": true }), _jsx(ChatInputSubmit, { icon: ArrowUp, "aria-label": "Send", isLoading: isUploading, disabled: isComposerBusy, stopGeneration: turnInProgress && stop ? handleStopGeneration : undefined })] }, composerDraft.key), !isCopilot && (_jsx(ChatInputFooter, { infoText: `${assistantName} can make mistakes.`, version: kg.knowledgeGraphState?.dataVersion?.uniqueId ?? "unknown", circularProgressTooltip: "Context used (tokens)", min: agentState?.contextTokens ?? 0, max: contextWindow, actions: _jsxs(_Fragment, { children: [isOperator && modelPickerOptions.length > 1 && (_jsx(ChatModelPicker, { models: modelPickerOptions, selectedId: selectedModel, onChange: setSelectedModel })), showDebugMessages && _jsx(DebugMessagesButton, { messages: agentMessages })] }) }))] })] }) }) }) }));
|
|
295
305
|
if (isConnectingOrSyncing) {
|
|
296
306
|
return (_jsxs("div", { className: "relative", children: [_jsx(LoadingView, {}), activeChat?.connectionState === "closed" && (_jsx("div", { className: "absolute inset-x-0 top-0 z-20", children: connectionNotice }))] }));
|
|
297
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layouts/Sidebar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/layouts/Sidebar.tsx"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AA6BvD,KAAK,YAAY,GAAG;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,2CAmZ1C"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { chatIdToPath } from "@manta-eu/client/shared/index";
|
|
3
3
|
import { realmVocabLabel } from "@manta-eu/ldo/realm";
|
|
4
4
|
import { isPresent } from "@manta-eu/lib/present";
|
|
5
|
-
import { Activity, Brain, ChevronUp, Command, Database, FileCode2, History, PanelLeftIcon, Plug, Plus, Search, Trash2, UserPlus, Waypoints, Zap, } from "lucide-react";
|
|
5
|
+
import { Activity, Brain, ChevronUp, CircleAlert, Command, Database, FileCode2, History, PanelLeftIcon, Plug, Plus, Search, Trash2, UserPlus, Waypoints, Zap, } from "lucide-react";
|
|
6
6
|
import { AnimatePresence, motion } from "motion/react";
|
|
7
7
|
import { use, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { Link, useLocation } from "react-router";
|
|
@@ -17,6 +17,7 @@ import { ChannelIcon } from "#components/channel-icon/index";
|
|
|
17
17
|
import { DropdownGroup, DropdownItem } from "#components/dropdown/index";
|
|
18
18
|
import { Popover, PopoverContent, PopoverTrigger } from "#components/popover/index";
|
|
19
19
|
import { Sidebar as BaseSidebar, Initials, NavMenu, NavUser, SidebarContent, SidebarFooter, SidebarHeader, SidebarMenu, SidebarMenuButton, SidebarMenuItem, useSidebar, } from "#components/sidebar/index";
|
|
20
|
+
import { useConnectionProblems } from "#hooks/use-connection-problems";
|
|
20
21
|
import { useConversations } from "#hooks/useConversations";
|
|
21
22
|
import { useDeleteChat } from "#hooks/useDeleteChat";
|
|
22
23
|
import { canPickDatastore } from "#ldo-ui";
|
|
@@ -62,6 +63,7 @@ export function Sidebar(props) {
|
|
|
62
63
|
const { setOpen } = useCommandContext();
|
|
63
64
|
const { conversations } = useConversations({ limit: 10 });
|
|
64
65
|
const { datastorePath } = useMantaClient();
|
|
66
|
+
const hasConnectionProblems = isPresent(useConnectionProblems());
|
|
65
67
|
const { isApple } = usePlatform();
|
|
66
68
|
const ModifierIcon = isApple ? Command : ChevronUp;
|
|
67
69
|
const navItemTooltip = isKnowledgeGraphUnavailable ? "Available when Manta is ready" : undefined;
|
|
@@ -104,6 +106,8 @@ export function Sidebar(props) {
|
|
|
104
106
|
icon: Plug,
|
|
105
107
|
isActive: pathname.startsWith("/integrations"),
|
|
106
108
|
href: "/integrations",
|
|
109
|
+
badge: hasConnectionProblems && (_jsx(CircleAlert, { className: "size-4 text-error-foreground group-data-[collapsible=icon]:size-2.5" })),
|
|
110
|
+
badgeLabel: "needs attention",
|
|
107
111
|
},
|
|
108
112
|
{
|
|
109
113
|
title: "Rules",
|
|
@@ -128,7 +132,16 @@ export function Sidebar(props) {
|
|
|
128
132
|
},
|
|
129
133
|
]
|
|
130
134
|
: []),
|
|
131
|
-
].map((item) => ({ ...item, disabled: isKnowledgeGraphUnavailable, tooltip: navItemTooltip })), [
|
|
135
|
+
].map((item) => ({ ...item, disabled: isKnowledgeGraphUnavailable, tooltip: navItemTooltip })), [
|
|
136
|
+
ModifierIcon,
|
|
137
|
+
startNewChat,
|
|
138
|
+
isKnowledgeGraphUnavailable,
|
|
139
|
+
canManageStreams,
|
|
140
|
+
pathname,
|
|
141
|
+
setOpen,
|
|
142
|
+
navItemTooltip,
|
|
143
|
+
hasConnectionProblems,
|
|
144
|
+
]);
|
|
132
145
|
const userName = isPresent(user?.name) ? user.name : isPresent(user?.email) ? user.email : "User";
|
|
133
146
|
// An operator with no explicit pick is still on the realm default, not a blank name.
|
|
134
147
|
const datastoreName = datastore?.name ?? (isOperator ? realmVocabLabel(realmDatastoreId) : "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-menu.d.ts","sourceRoot":"","sources":["../../../src/components/sidebar/nav-menu.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAuBf,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,GAAG,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,CAAC,EAAE,MAAM,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WAAW,GAAG,cAAc,CAAC;AAEnD,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,UAAU,CAAC;AAExD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAC;CACxC,CAAC;AAWF,wBAAgB,OAAO,CAAC,KAAK,EAAE,WAAW,2CAczC"}
|
|
@@ -26,6 +26,11 @@ function NavMenuEntry(props) {
|
|
|
26
26
|
function hasSubItems(item) {
|
|
27
27
|
return Array.isArray(item.items) && item.items.length > 0;
|
|
28
28
|
}
|
|
29
|
+
function navItemLabel(item) {
|
|
30
|
+
if (item.disabled || !item.badge || !item.badgeLabel)
|
|
31
|
+
return item.title;
|
|
32
|
+
return `${item.title}, ${item.badgeLabel}`;
|
|
33
|
+
}
|
|
29
34
|
function NavSubmenuMenuItem(props) {
|
|
30
35
|
const { item, linkComponent, submenuVariant } = props;
|
|
31
36
|
const { isMobile, state } = useSidebar();
|
|
@@ -42,12 +47,12 @@ function NavSubmenuMenuItem(props) {
|
|
|
42
47
|
}
|
|
43
48
|
}, [hasActiveSubItem]);
|
|
44
49
|
if (item.disabled) {
|
|
45
|
-
return (_jsx(SidebarMenuItem, { children: _jsx(NavMenuDisabledTooltip, { content: tooltipContent, children: _jsx(SidebarMenuButton, { type: "button", disabled: true, isActive: isActive, "aria-label": item
|
|
50
|
+
return (_jsx(SidebarMenuItem, { children: _jsx(NavMenuDisabledTooltip, { content: tooltipContent, children: _jsx(SidebarMenuButton, { type: "button", disabled: true, isActive: isActive, "aria-label": navItemLabel(item), className: disabledTopLevelClassName, "data-nav-id": item.id, children: _jsx(NavMenuItemContent, { item: item }) }) }) }));
|
|
46
51
|
}
|
|
47
52
|
if (resolvedSubmenuVariant === "dropdown") {
|
|
48
|
-
return (_jsx(SidebarMenuItem, { children: _jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsxs(SidebarMenuButton, { type: "button", isActive: isActive, tooltip: tooltipContent, "aria-label": item
|
|
53
|
+
return (_jsx(SidebarMenuItem, { children: _jsxs(Dropdown, { children: [_jsx(DropdownTrigger, { asChild: true, children: _jsxs(SidebarMenuButton, { type: "button", isActive: isActive, tooltip: tooltipContent, "aria-label": navItemLabel(item), className: "group data-[state=open]:bg-muted data-[state=open]:text-default-foreground", "data-nav-id": item.id, children: [_jsx(NavMenuItemContent, { item: item }), _jsx(ChevronDown, { className: "ml-auto size-4 shrink-0 transition-transform duration-150 ease-out group-data-[collapsible=icon]:hidden group-data-[state=open]:rotate-180" })] }) }), _jsx(DropdownContent, { className: "w-40 min-w-40 p-0 shadow-md", side: isMobile ? "bottom" : "right", align: "start", sideOffset: 8, children: _jsx(DropdownGroup, { label: item.title, className: "p-2", children: item.items.map((subItem) => (_jsx(NavDropdownSubItem, { item: subItem, linkComponent: linkComponent }, subItem.title))) }) })] }) }));
|
|
49
54
|
}
|
|
50
|
-
return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { type: "button", isActive: isActive, tooltip: tooltipContent, "aria-label": item
|
|
55
|
+
return (_jsxs(SidebarMenuItem, { children: [_jsxs(SidebarMenuButton, { type: "button", isActive: isActive, tooltip: tooltipContent, "aria-label": navItemLabel(item), "aria-expanded": isOpen, "aria-controls": submenuId, onClick: () => setIsOpen((current) => !current), "data-nav-id": item.id, children: [_jsx(NavMenuItemContent, { item: item }), _jsx(ChevronDown, { className: cn("ml-auto size-4 shrink-0 transition-transform duration-150 ease-out group-data-[collapsible=icon]:hidden", isOpen && "rotate-180") })] }), _jsx(AnimatePresence, { initial: false, children: isOpen && (_jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: shouldReduceMotion ? { duration: 0 } : { duration: 0.2, ease: [0.23, 1, 0.32, 1] }, className: "overflow-hidden", children: _jsx(SidebarMenuSub, { id: submenuId, className: "ml-5.5 mr-0 mt-1 translate-x-0 border-muted-border px-3 py-0", children: item.items.map((subItem) => (_jsx(SidebarMenuSubItem, { children: _jsx(NavListSubItem, { item: subItem, linkComponent: linkComponent }) }, subItem.title))) }) })) })] }));
|
|
51
56
|
}
|
|
52
57
|
function NavLeafMenuItem(props) {
|
|
53
58
|
const { item, linkComponent: LinkComponent } = props;
|
|
@@ -55,13 +60,13 @@ function NavLeafMenuItem(props) {
|
|
|
55
60
|
const tooltipContent = useNavMenuTooltipContent(item);
|
|
56
61
|
if (item.onClick || !href || item.disabled) {
|
|
57
62
|
const isDisabled = item.disabled || !item.onClick;
|
|
58
|
-
const button = (_jsx(SidebarMenuButton, { type: "button", onClick: item.disabled ? undefined : item.onClick, disabled: isDisabled, tooltip: isDisabled ? undefined : tooltipContent, isActive: !item.disabled && item.isActive, "aria-label": item
|
|
63
|
+
const button = (_jsx(SidebarMenuButton, { type: "button", onClick: item.disabled ? undefined : item.onClick, disabled: isDisabled, tooltip: isDisabled ? undefined : tooltipContent, isActive: !item.disabled && item.isActive, "aria-label": navItemLabel(item), className: isDisabled ? disabledTopLevelClassName : undefined, "data-nav-id": item.id, children: _jsx(NavMenuItemContent, { item: item }) }));
|
|
59
64
|
if (isDisabled) {
|
|
60
65
|
return _jsx(NavMenuDisabledTooltip, { content: tooltipContent, children: button });
|
|
61
66
|
}
|
|
62
67
|
return button;
|
|
63
68
|
}
|
|
64
|
-
return (_jsx(SidebarMenuButton, { asChild: true, tooltip: tooltipContent, isActive: item.isActive, "data-nav-id": item.id, children: _jsx(LinkComponent, { href: href, "aria-label": item
|
|
69
|
+
return (_jsx(SidebarMenuButton, { asChild: true, tooltip: tooltipContent, isActive: item.isActive, "data-nav-id": item.id, children: _jsx(LinkComponent, { href: href, "aria-label": navItemLabel(item), children: _jsx(NavMenuItemContent, { item: item }) }) }));
|
|
65
70
|
}
|
|
66
71
|
function useNavMenuTooltipContent(item) {
|
|
67
72
|
const { isMobile, state } = useSidebar();
|
|
@@ -83,7 +88,7 @@ function NavMenuDisabledTooltip(props) {
|
|
|
83
88
|
}
|
|
84
89
|
function NavMenuItemContent(props) {
|
|
85
90
|
const { item } = props;
|
|
86
|
-
return (_jsxs(_Fragment, { children: [_jsx(item.icon, { height: 20, width: 20, className: "size-5" }), _jsx("span", { children: item.title }), !item.disabled && item.shortcut, item.disabled && (_jsx(LockIcon, { className: "ml-auto size-4 shrink-0 text-muted-foreground group-data-[collapsible=icon]:absolute group-data-[collapsible=icon]:top-1 group-data-[collapsible=icon]:right-1 group-data-[collapsible=icon]:size-2.5" }))] }));
|
|
91
|
+
return (_jsxs(_Fragment, { children: [_jsx(item.icon, { height: 20, width: 20, className: "size-5" }), _jsx("span", { children: item.title }), !item.disabled && item.shortcut, !item.disabled && item.badge && (_jsx("div", { className: "ml-auto flex shrink-0 group-data-[collapsible=icon]:absolute group-data-[collapsible=icon]:top-1 group-data-[collapsible=icon]:right-1", children: item.badge })), item.disabled && (_jsx(LockIcon, { className: "ml-auto size-4 shrink-0 text-muted-foreground group-data-[collapsible=icon]:absolute group-data-[collapsible=icon]:top-1 group-data-[collapsible=icon]:right-1 group-data-[collapsible=icon]:size-2.5" }))] }));
|
|
87
92
|
}
|
|
88
93
|
function NavListSubItem(props) {
|
|
89
94
|
const { item, linkComponent: LinkComponent } = props;
|
|
@@ -69,6 +69,32 @@ export type DataTableWithoutRowInteraction<TData> = DataTableBaseProps<TData> &
|
|
|
69
69
|
};
|
|
70
70
|
export type DataTableProps<TData> = DataTableWithRowClick<TData> | DataTableWithRowHref<TData> | DataTableWithoutRowInteraction<TData>;
|
|
71
71
|
export declare function DataTable<TData>(props: DataTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
export type SortableColumn<TRow> = {
|
|
73
|
+
key: keyof TRow & string;
|
|
74
|
+
header: string;
|
|
75
|
+
numeric?: boolean;
|
|
76
|
+
sortable?: boolean;
|
|
77
|
+
cell?: (row: TRow) => ReactNode;
|
|
78
|
+
};
|
|
79
|
+
export type SortableTableBaseProps<TRow> = {
|
|
80
|
+
columns: SortableColumn<TRow>[];
|
|
81
|
+
rows: TRow[];
|
|
82
|
+
noResultsMessage?: string;
|
|
83
|
+
className?: string;
|
|
84
|
+
isLoading?: boolean;
|
|
85
|
+
};
|
|
86
|
+
export type SortableTableProps<TRow> = (SortableTableBaseProps<TRow> & {
|
|
87
|
+
onRowClick: (row: TRow) => void;
|
|
88
|
+
rowHref?: never;
|
|
89
|
+
}) | (SortableTableBaseProps<TRow> & {
|
|
90
|
+
onRowClick?: never;
|
|
91
|
+
rowHref: (row: TRow) => string;
|
|
92
|
+
}) | (SortableTableBaseProps<TRow> & {
|
|
93
|
+
onRowClick?: never;
|
|
94
|
+
rowHref?: never;
|
|
95
|
+
});
|
|
96
|
+
export declare function renderCellValue(value: unknown): ReactNode;
|
|
97
|
+
export declare function SortableTable<TRow extends object>(props: SortableTableProps<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
72
98
|
export type { TableColumnRearrangePopoverProps, WithClassName } from "./table-column-rearrange-popover.js";
|
|
73
99
|
export type { TableConfigProps } from "./table-config.js";
|
|
74
100
|
export type { PinnedColumnInfo } from "./table-utils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/table/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAa,GAAG,EAAgB,KAAK,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGhH,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAiB,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQjG,OAAO,EAAE,2BAA2B,EAAE,KAA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AkC,CAAC;AACxG,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { flexRender } from "@tanstack/react-table";
|
|
3
|
+
import { flexRender, getCoreRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
4
4
|
import { ChevronDown, ChevronsUpDown, ChevronUp } from "lucide-react";
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
5
6
|
import { match } from "ts-pattern";
|
|
6
7
|
import { getCommonPinnedColumnStyles } from "./table-utils.js";
|
|
7
8
|
import { Button } from "#components/button/index";
|
|
@@ -114,3 +115,32 @@ export function DataTable(props) {
|
|
|
114
115
|
return (_jsx(TableHead, { className: cn("h-13 px-4 not-first:px-3 py-2", header.column.columnDef.meta?.className), "data-is-pinned": header.column.getIsPinned() ? true : undefined, style: pinningStyles, ref: (thElement) => columnSizingHandler(thElement, table, header.column), children: header.isPlaceholder ? null : header.column.getCanSort() ? (_jsx(ColumnHeader, { column: header.column, children: headerContent })) : (headerContent) }, header.id));
|
|
115
116
|
}) }, headerGroup.id))) }), _jsx(TableBody, { className: cn(isLoading && "animate-pulse", bodyClassName), children: table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => renderTableRow(row))) : (_jsx(TableRow, { className: tableBodyRowClassName, children: _jsx(TableCell, { colSpan: table.getAllColumns().length, className: "h-24 text-center", children: resolvedNoResultsMessage }) })) })] }) }));
|
|
116
117
|
}
|
|
118
|
+
export function renderCellValue(value) {
|
|
119
|
+
if (typeof value === "string" || typeof value === "number")
|
|
120
|
+
return value;
|
|
121
|
+
return value === null || value === undefined ? "" : String(value);
|
|
122
|
+
}
|
|
123
|
+
export function SortableTable(props) {
|
|
124
|
+
const { columns, rows, onRowClick, rowHref, ...rest } = props;
|
|
125
|
+
const columnDefs = useMemo(() => columns.map((column) => ({
|
|
126
|
+
accessorKey: column.key,
|
|
127
|
+
header: column.header,
|
|
128
|
+
enableSorting: column.sortable ?? true,
|
|
129
|
+
cell: (info) => (column.cell ? column.cell(info.row.original) : renderCellValue(info.getValue())),
|
|
130
|
+
...(column.numeric ? { meta: { type: "number" } } : {}),
|
|
131
|
+
})), [columns]);
|
|
132
|
+
const [sorting, setSorting] = useState([]);
|
|
133
|
+
const table = useReactTable({
|
|
134
|
+
data: rows,
|
|
135
|
+
columns: columnDefs,
|
|
136
|
+
state: { sorting },
|
|
137
|
+
onSortingChange: setSorting,
|
|
138
|
+
getCoreRowModel: getCoreRowModel(),
|
|
139
|
+
getSortedRowModel: getSortedRowModel(),
|
|
140
|
+
});
|
|
141
|
+
if (onRowClick)
|
|
142
|
+
return _jsx(DataTable, { table: table, onRowClick: (row) => onRowClick(row.original), ...rest });
|
|
143
|
+
if (rowHref)
|
|
144
|
+
return _jsx(DataTable, { table: table, rowHref: (row) => rowHref(row.original), ...rest });
|
|
145
|
+
return _jsx(DataTable, { table: table, ...rest });
|
|
146
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatalogCode.d.ts","sourceRoot":"","sources":["../../src/explain-fact/DatalogCode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatalogCode.d.ts","sourceRoot":"","sources":["../../src/explain-fact/DatalogCode.tsx"],"names":[],"mappings":"AAmDA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAMlD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BLANK_NODE, booleanLiteralTokenTypes, builtinFunctionTokenTypes, delimiterTokenTypes, iriTokenTypes, keywordTokenTypes, LANGTAG, NOT, numericLiteralTokenTypes, operatorTokenTypes, stringLiteralTokenTypes, tokenizeDatalog, VARIABLE, } from "@manta-eu/datalog-parser";
|
|
2
|
+
import { BLANK_NODE, booleanLiteralTokenTypes, builtinFunctionTokenTypes, delimiterTokenTypes, DOUBLE, iriTokenTypes, keywordTokenTypes, LANGTAG, NOT, numericLiteralTokenTypes, operatorTokenTypes, plainDecimalText, stringLiteralTokenTypes, tokenizeDatalog, VARIABLE, } from "@manta-eu/datalog-parser";
|
|
3
3
|
import { Fragment, useMemo } from "react";
|
|
4
4
|
import { OntologyTermText } from "../ontology/OntologyTermText.js";
|
|
5
5
|
import { cn } from "#style";
|
|
@@ -45,6 +45,11 @@ function highlightWithBlankNodes(code) {
|
|
|
45
45
|
}
|
|
46
46
|
return segments;
|
|
47
47
|
}
|
|
48
|
+
// DOUBLE is matched before PLUS, so a leading + is part of the number token.
|
|
49
|
+
function plainDoubleTokenText(text) {
|
|
50
|
+
const plain = plainDecimalText(text);
|
|
51
|
+
return text.startsWith("+") && !plain.startsWith("+") ? `+${plain}` : plain;
|
|
52
|
+
}
|
|
48
53
|
function highlightDatalog(code, keyPrefix = "") {
|
|
49
54
|
const { tokens } = tokenizeDatalog(code);
|
|
50
55
|
const segments = [];
|
|
@@ -62,7 +67,7 @@ function highlightDatalog(code, keyPrefix = "") {
|
|
|
62
67
|
segments.push(_jsx(OntologyTermText, { term: text, className: className }, `${keyPrefix}token-${index}`));
|
|
63
68
|
}
|
|
64
69
|
else {
|
|
65
|
-
segments.push(_jsx("span", { className: className, children: text }, `${keyPrefix}token-${index}`));
|
|
70
|
+
segments.push(_jsx("span", { className: className, children: tokenName === DOUBLE.name ? plainDoubleTokenText(text) : text }, `${keyPrefix}token-${index}`));
|
|
66
71
|
}
|
|
67
72
|
cursor = end;
|
|
68
73
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isDateTimeLiteral, isLiteralTerm,
|
|
2
|
+
import { isDateTimeLiteral, isLiteralTerm, isNumericLiteralTerm, literalToDisplayText, parseBooleanLiteral, parseDatalogTermText, } from "@manta-eu/datalog-parser";
|
|
3
3
|
import { isPresent } from "@manta-eu/lib/present";
|
|
4
4
|
import { Check, Sparkles, X } from "lucide-react";
|
|
5
5
|
import { useMemo } from "react";
|
|
@@ -30,8 +30,8 @@ export function FactValue(props) {
|
|
|
30
30
|
const Icon = boolean ? Check : X;
|
|
31
31
|
return (_jsxs("span", { className: cn("inline-flex items-center gap-1 typography-small-medium", boolean ? "text-success-foreground" : "text-muted-foreground", className), children: [_jsx(Icon, { className: "size-3.5" }), boolean ? "true" : "false"] }));
|
|
32
32
|
}
|
|
33
|
-
if (
|
|
34
|
-
return _jsx(ValuePill, { className: className, children: formatMeasureValue(value, measure) });
|
|
33
|
+
if (isPresent(term) && isNumericLiteralTerm(term)) {
|
|
34
|
+
return _jsx(ValuePill, { className: className, children: formatMeasureValue(term.value, measure) });
|
|
35
35
|
}
|
|
36
36
|
if (literal) {
|
|
37
37
|
return (_jsx(ValuePill, { className: className, children: isDateTimeLiteral(literal) ? literalToDisplayText(literal) : literal.value }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProofTreeFormulaFooter.d.ts","sourceRoot":"","sources":["../../../src/explain-fact/proof-tree/ProofTreeFormulaFooter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ProofTreeFormulaFooter.d.ts","sourceRoot":"","sources":["../../../src/explain-fact/proof-tree/ProofTreeFormulaFooter.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD,MAAM,MAAM,2BAA2B,GAAG;IACxC,OAAO,EAAE,uBAAuB,CAAC;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,2CAmBxE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DatalogCode } from "../DatalogCode.js";
|
|
2
3
|
import { datalogTextClass } from "../explain-styles.js";
|
|
3
4
|
import { factTokenText } from "../fact-token.js";
|
|
4
5
|
import { formulaHueClass } from "../formula-hues.js";
|
|
@@ -7,7 +8,7 @@ import { cn } from "#style";
|
|
|
7
8
|
const variableTokenPattern = /(\?\w+)/;
|
|
8
9
|
export function ProofTreeFormulaFooter(props) {
|
|
9
10
|
const { formula, mode, rawText } = props;
|
|
10
|
-
return (_jsx("div", { className: "flex items-center gap-3 border-t border-muted-border bg-faint px-3.5 py-4", children: _jsx("span", { className: "flex min-w-0 items-center gap-2.5", children: mode === "datalog" ? (_jsx("span", { className:
|
|
11
|
+
return (_jsx("div", { className: "flex items-center gap-3 border-t border-muted-border bg-faint px-3.5 py-4", children: _jsx("span", { className: "flex min-w-0 items-center gap-2.5", children: mode === "datalog" ? (_jsx("span", { className: "min-w-0 truncate", title: rawText, children: _jsx(DatalogCode, { code: rawText ?? formula.expression, className: cn(datalogTextClass, "text-body-foreground") }) })) : (_jsx(FormulaExpression, { formula: formula })) }) }));
|
|
11
12
|
}
|
|
12
13
|
function FormulaExpression(props) {
|
|
13
14
|
const { formula } = props;
|