@ai-matrx/chat 0.3.11 → 0.3.19
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/CHANGELOG.md +83 -0
- package/dist/agent-copy/export.d.ts +10 -2
- package/dist/agent-copy/export.js +3 -2
- package/dist/agents/components/agent-widgets/chat-assistant/CompactAssistantInput.js +1 -1
- package/dist/agents/components/debug/SandboxFileViewer.js +1 -3
- package/dist/agents/components/inputs/AgentVariablesInline.js +1 -1
- package/dist/agents/components/inputs/smart-input/AgentTextarea.js +1 -1
- package/dist/agents/components/inputs/smart-input/InputActionButtons.js +1 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPeek.js +6 -6
- package/dist/agents/components/messages-display/TranscriptIntegrityCopyButton.js +4 -4
- package/dist/agents/components/messages-display/user/UserActionBar.js +3 -18
- package/dist/agents/components/run/AgentRunHeader.js +1 -2
- package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
- package/dist/agents/components/shared/AgentHeader.js +1 -2
- package/dist/agents/components/shared/AgentHeaderMobile.js +1 -2
- package/dist/agents/components/working-document/DocumentLinkPicker.d.ts +1 -1
- package/dist/agents/components/working-document/WorkingDocumentPanel.js +1 -1
- package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +2 -2
- package/dist/agents/components/working-document/documents-workspace/DocumentsWorkspace.js +2 -2
- package/dist/agents/hooks/useInstanceInputUndoRedo.d.ts +1 -1
- package/dist/agents/hooks/useInstanceInputUndoRedo.js +1 -1
- package/dist/agents/hooks/useWorkingDocument.js +7 -6
- package/dist/agents/model-registry/model-classes.d.ts +1 -43
- package/dist/agents/model-registry/model-classes.js +1 -40
- package/dist/agents/model-registry/parse.d.ts +1 -88
- package/dist/agents/model-registry/parse.js +1 -246
- package/dist/agents/prompt-preview/PromptPreviewContent.js +1 -3
- package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +14 -0
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.js +30 -0
- package/dist/agents/redux/execution-system/client-capabilities/desktop-native.provider.js +10 -1
- package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.d.ts +18 -16
- package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.js +101 -52
- package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.slice.d.ts +2 -2
- package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.thunks.d.ts +1 -1
- package/dist/agents/redux/execution-system/instance-working-document/scratchpad.thunks.d.ts +1 -1
- package/dist/agents/redux/execution-system/message-crud/refetch-single-message.thunk.js +5 -0
- package/dist/agents/redux/execution-system/thunks/process-stream.js +2 -2
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.d.ts +14 -0
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +28 -0
- package/dist/agents/utils/platform-keys.d.ts +15 -0
- package/dist/agents/utils/platform-keys.js +69 -0
- package/dist/context/sources/scopes.d.ts +1 -1
- package/dist/cx-chat/components/user-input/ConversationInput.js +1 -1
- package/dist/cx-conversation/ConversationInput.js +1 -1
- package/dist/host/db-types.d.ts +23242 -23071
- package/dist/host/ui-slots.d.ts +50 -64
- package/dist/host/ui-slots.js +12 -52
- package/dist/public-chat/components/GuidedVariableInputs.js +1 -1
- package/dist/public-chat/components/PublicVariableInputs.js +1 -1
- package/dist/react.cjs +11 -23
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +11 -23
- package/dist/react.js.map +1 -1
- package/dist/surfaces/manifests/_conversation-document.manifest.js +1 -1
- package/dist/tool-call-visualization/registry/registry.js +13 -0
- package/dist/ui/composer/useTouchOnlyDevice.js +1 -1
- package/dist/ui/skills-types.d.ts +1 -275
- package/dist/ui/skills-types.js +1 -0
- package/dist/voice-agent/components/VoiceDebugPanel.js +1 -3
- package/package.json +60 -34
- package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.d.ts +0 -15
- package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.js +0 -201
- package/dist/agents/components/run-controls/AgentExecutionTestModal.d.ts +0 -36
- package/dist/agents/components/run-controls/AgentExecutionTestModal.js +0 -440
- package/dist/agents/components/run-controls/AgentLauncherSidebarTester.d.ts +0 -6
- package/dist/agents/components/run-controls/AgentLauncherSidebarTester.js +0 -127
- package/dist/agents/components/run-controls/AgentWidgetInvokerTester.d.ts +0 -6
- package/dist/agents/components/run-controls/AgentWidgetInvokerTester.js +0 -84
- package/dist/agents/components/run-controls/CreatorRunPanel.d.ts +0 -22
- package/dist/agents/components/run-controls/CreatorRunPanel.js +0 -108
- package/dist/agents/components/run-controls/CreatorRunTabContent.d.ts +0 -30
- package/dist/agents/components/run-controls/CreatorRunTabContent.js +0 -319
- package/dist/agents/components/run-controls/PayloadTab.d.ts +0 -5
- package/dist/agents/components/run-controls/PayloadTab.js +0 -388
- package/dist/agents/components/run-controls/TesterSettingsPanel.d.ts +0 -71
- package/dist/agents/components/run-controls/TesterSettingsPanel.js +0 -470
- package/dist/agents/components/shared/AgentOptionsMenu.d.ts +0 -8
- package/dist/agents/components/shared/AgentOptionsMenu.js +0 -776
- package/dist/agents/components/shared/AgentPeekDuplicateButton.d.ts +0 -8
- package/dist/agents/components/shared/AgentPeekDuplicateButton.js +0 -66
- package/dist/agents/components/shared/AgentSaveStatus.d.ts +0 -7
- package/dist/agents/components/shared/AgentSaveStatus.js +0 -128
- package/dist/agents/components/shared/AgentSaveTapButton.d.ts +0 -18
- package/dist/agents/components/shared/AgentSaveTapButton.js +0 -105
- package/dist/agents/components/shared/useAgentSaveAction.d.ts +0 -33
- package/dist/agents/components/shared/useAgentSaveAction.js +0 -179
- package/dist/agents/components/shell/AgentsListHeader.d.ts +0 -1
- package/dist/agents/components/shell/AgentsListHeader.js +0 -69
- package/dist/agents/components/undo-history/AgentEditHistory.d.ts +0 -9
- package/dist/agents/components/undo-history/AgentEditHistory.js +0 -244
- package/dist/agents/components/unused/AgentSharedHeader.d.ts +0 -3
- package/dist/agents/components/unused/AgentSharedHeader.js +0 -134
- package/dist/agents/components/widgets/AgentWidgetsPage.d.ts +0 -11
- package/dist/agents/components/widgets/AgentWidgetsPage.js +0 -571
- package/dist/agents/components/widgets/WidgetVariableInputs.d.ts +0 -8
- package/dist/agents/components/widgets/WidgetVariableInputs.js +0 -80
- package/dist/agents/components/widgets/build-widget-launch.d.ts +0 -70
- package/dist/agents/components/widgets/build-widget-launch.js +0 -90
- package/dist/agents/hooks/useAgentAutoSave.d.ts +0 -1
- package/dist/agents/hooks/useAgentAutoSave.js +0 -127
- package/dist/agents/hooks/useAgentBuilderWriteHandlers.d.ts +0 -9
- package/dist/agents/hooks/useAgentBuilderWriteHandlers.js +0 -102
- package/dist/agents/hooks/useAgentDuplicateFlow.d.ts +0 -25
- package/dist/agents/hooks/useAgentDuplicateFlow.js +0 -133
- package/dist/agents/hooks/useAgentUndoRedo.d.ts +0 -31
- package/dist/agents/hooks/useAgentUndoRedo.js +0 -134
- package/dist/agents/hooks/useAgentUsages.d.ts +0 -17
- package/dist/agents/hooks/useAgentUsages.js +0 -36
- package/dist/agents/hooks/useDriftAlerts.d.ts +0 -11
- package/dist/agents/hooks/useDriftAlerts.js +0 -36
- package/dist/agents/hooks/useDriftReport.d.ts +0 -20
- package/dist/agents/hooks/useDriftReport.js +0 -34
- package/dist/agents/lifecycle/useAgentLifecycleActions.d.ts +0 -17
- package/dist/agents/lifecycle/useAgentLifecycleActions.js +0 -63
- package/dist/agents/message-flags/useMessageFlags.d.ts +0 -8
- package/dist/agents/message-flags/useMessageFlags.js +0 -68
- package/dist/agents/services/agent-definition-snapshot.service.d.ts +0 -15
- package/dist/agents/services/agent-definition-snapshot.service.js +0 -20
- package/dist/agents/surface-catalog-profile.d.ts +0 -96
- package/dist/agents/surface-catalog-profile.js +0 -79
- package/dist/cx-chat/hooks/useAgentBootstrap.d.ts +0 -1
- package/dist/cx-chat/hooks/useAgentBootstrap.js +0 -110
- package/dist/host/builder-door.d.ts +0 -61
- package/dist/host/builder-door.js +0 -25
- package/dist/next/lazy/CreatorRunPanel.d.ts +0 -1
- package/dist/next/lazy/CreatorRunPanel.js +0 -11
- package/dist/ui/composer/composerSubmit.d.ts +0 -50
- package/dist/ui/composer/composerSubmit.js +0 -32
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { usePathname, useSearchParams } from "../../host/navigation.js";
|
|
4
|
-
import { useAppDispatch, useAppSelector } from "../../store/hooks.js";
|
|
5
|
-
import {
|
|
6
|
-
initializeChatAgents,
|
|
7
|
-
isChatListStale,
|
|
8
|
-
fetchAgentExecutionMinimal
|
|
9
|
-
} from "../../agents/redux/agent-definition/thunks.js";
|
|
10
|
-
import { selectAgentById } from "../../agents/redux/agent-definition/selectors.js";
|
|
11
|
-
import {
|
|
12
|
-
activeChatActions,
|
|
13
|
-
selectActiveChatAgent
|
|
14
|
-
} from "../_legacy-stubs.js";
|
|
15
|
-
import { DEFAULT_AGENTS } from "../components/agent/local-agents.js";
|
|
16
|
-
function resolveAgentIdFromUrl(pathname, searchParams) {
|
|
17
|
-
const agentRouteMatch = pathname.match(/\/demos\/chat\/a\/([^/]+)/);
|
|
18
|
-
if (agentRouteMatch?.[1]) return agentRouteMatch[1];
|
|
19
|
-
const agentParam = searchParams.get("agent");
|
|
20
|
-
if (agentParam) return agentParam;
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
function useAgentBootstrap() {
|
|
24
|
-
const dispatch = useAppDispatch();
|
|
25
|
-
const pathname = usePathname();
|
|
26
|
-
const searchParams = useSearchParams();
|
|
27
|
-
const selectedAgent = useAppSelector(selectActiveChatAgent);
|
|
28
|
-
const lastExecutionId = useRef(null);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
dispatch(initializeChatAgents());
|
|
31
|
-
}, [dispatch]);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const handleVisibility = () => {
|
|
34
|
-
if (document.visibilityState !== "visible") return;
|
|
35
|
-
if (isChatListStale()) {
|
|
36
|
-
dispatch(initializeChatAgents({ force: true }));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
document.addEventListener("visibilitychange", handleVisibility);
|
|
40
|
-
return () => document.removeEventListener("visibilitychange", handleVisibility);
|
|
41
|
-
}, [dispatch]);
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
const agentId = resolveAgentIdFromUrl(pathname, searchParams);
|
|
44
|
-
if (!agentId) return;
|
|
45
|
-
if (agentId === lastExecutionId.current) return;
|
|
46
|
-
lastExecutionId.current = agentId;
|
|
47
|
-
const builtIn = DEFAULT_AGENTS.find((a) => a.promptId === agentId);
|
|
48
|
-
if (builtIn) {
|
|
49
|
-
if (selectedAgent.promptId !== agentId || !selectedAgent.configFetched) {
|
|
50
|
-
dispatch(
|
|
51
|
-
activeChatActions.setSelectedAgent({
|
|
52
|
-
promptId: builtIn.promptId,
|
|
53
|
-
name: builtIn.name,
|
|
54
|
-
description: builtIn.description,
|
|
55
|
-
variableDefaults: builtIn.variableDefaults,
|
|
56
|
-
configFetched: true
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
dispatch(fetchAgentExecutionMinimal(agentId)).then(() => {
|
|
63
|
-
dispatch((_, getState) => {
|
|
64
|
-
const state = getState();
|
|
65
|
-
const record = selectAgentById(state, agentId);
|
|
66
|
-
if (!record) {
|
|
67
|
-
dispatch(
|
|
68
|
-
activeChatActions.setSelectedAgent({
|
|
69
|
-
promptId: agentId,
|
|
70
|
-
name: selectedAgent.promptId === agentId ? selectedAgent.name : "",
|
|
71
|
-
configFetched: true
|
|
72
|
-
})
|
|
73
|
-
);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const variableDefaults = record.variableDefinitions;
|
|
77
|
-
dispatch(
|
|
78
|
-
activeChatActions.setSelectedAgent({
|
|
79
|
-
promptId: record.id,
|
|
80
|
-
name: record.name || (selectedAgent.promptId === agentId ? selectedAgent.name : ""),
|
|
81
|
-
description: record.description ?? void 0,
|
|
82
|
-
variableDefaults,
|
|
83
|
-
configFetched: true
|
|
84
|
-
})
|
|
85
|
-
);
|
|
86
|
-
if (record.settings && Object.keys(record.settings).length > 0) {
|
|
87
|
-
const settings = record.settings;
|
|
88
|
-
const {
|
|
89
|
-
model,
|
|
90
|
-
tools: _tools,
|
|
91
|
-
...runtimeSettings
|
|
92
|
-
} = settings;
|
|
93
|
-
if (typeof model === "string" && model) {
|
|
94
|
-
dispatch(activeChatActions.setModelOverride(model));
|
|
95
|
-
}
|
|
96
|
-
if (Object.keys(runtimeSettings).length > 0) {
|
|
97
|
-
dispatch(
|
|
98
|
-
activeChatActions.setAgentDefaultSettings(
|
|
99
|
-
runtimeSettings
|
|
100
|
-
)
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
}, [pathname, searchParams]);
|
|
107
|
-
}
|
|
108
|
-
export {
|
|
109
|
-
useAgentBootstrap
|
|
110
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* host/builder-door — the agent BUILDER's write thunks, reached from the chat package's
|
|
3
|
-
* agent headers (options menu, save action, lifecycle actions, duplicate flow).
|
|
4
|
-
*
|
|
5
|
-
* The builder owns these writes (matrx-frontend: features/agents/redux/builder-tier.thunks.ts);
|
|
6
|
-
* the package draws the controls and must not import them (PACKAGE-INDEPENDENCE.md P25).
|
|
7
|
-
* The host registers once at startup (`registerBuilderDoor`, providers/chatUiRegistration.ts).
|
|
8
|
-
* A bare host registers nothing: `getBuilderDoor()` answers null and reports ONCE through the
|
|
9
|
-
* host diagnostics port, and every control that needs the door is ABSENT — never a button that
|
|
10
|
-
* does nothing (Law 4).
|
|
11
|
-
*/
|
|
12
|
-
import type { AsyncThunkAction } from "@reduxjs/toolkit";
|
|
13
|
-
import type { ChatDispatch, ChatRootState } from "../store/root-state.js";
|
|
14
|
-
import type { AgentDefinition } from "../agents/types/agent-definition.types.js";
|
|
15
|
-
type Cfg = {
|
|
16
|
-
dispatch: ChatDispatch;
|
|
17
|
-
state: ChatRootState;
|
|
18
|
-
};
|
|
19
|
-
type Door<Arg, Ret> = (arg: Arg) => AsyncThunkAction<Ret, Arg, Cfg>;
|
|
20
|
-
interface DuplicateAgentCommon {
|
|
21
|
-
asSystem?: boolean;
|
|
22
|
-
organizationId?: string;
|
|
23
|
-
followsSource?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* What to copy into a new agent: the agent as it is now (`agentId`), or one
|
|
27
|
-
* exact saved version (`versionId`, an agent.definition_version id — its
|
|
28
|
-
* snapshot is copied, never the possibly-newer master).
|
|
29
|
-
*/
|
|
30
|
-
export type DuplicateAgentOptions = DuplicateAgentCommon & ({
|
|
31
|
-
agentId: string;
|
|
32
|
-
versionId?: string;
|
|
33
|
-
} | {
|
|
34
|
-
agentId?: string;
|
|
35
|
-
versionId: string;
|
|
36
|
-
});
|
|
37
|
-
export type CreateAgentInput = Partial<Omit<AgentDefinition, "id" | "createdBy" | "createdAt" | "updatedAt" | "isVersion" | "parentAgentId" | "version" | "changedAt" | "changeNote">>;
|
|
38
|
-
export interface BuilderDoor {
|
|
39
|
-
saveAgent: Door<string, void>;
|
|
40
|
-
saveAgentField: Door<{
|
|
41
|
-
agentId: string;
|
|
42
|
-
field: keyof AgentDefinition;
|
|
43
|
-
value: AgentDefinition[keyof AgentDefinition];
|
|
44
|
-
}, void>;
|
|
45
|
-
createAgent: Door<CreateAgentInput, string>;
|
|
46
|
-
deleteAgent: Door<string, void>;
|
|
47
|
-
duplicateAgent: Door<string | DuplicateAgentOptions, string>;
|
|
48
|
-
setAgentFavorite: Door<{
|
|
49
|
-
agentId: string;
|
|
50
|
-
isFavorite: boolean;
|
|
51
|
-
}, void>;
|
|
52
|
-
}
|
|
53
|
-
/** The host's registration (idempotent). */
|
|
54
|
-
export declare function registerBuilderDoor(next: BuilderDoor): void;
|
|
55
|
-
/** Test seam: forget the registration. */
|
|
56
|
-
export declare function resetBuilderDoorForTests(): void;
|
|
57
|
-
/** The registered builder door, or null (reported once: the agent builder's controls are absent here). */
|
|
58
|
-
export declare function getBuilderDoor(): BuilderDoor | null;
|
|
59
|
-
/** The door, for a handler that only runs when the control was drawn (so the door was present). */
|
|
60
|
-
export declare function requireBuilderDoor(): BuilderDoor;
|
|
61
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { reportUnregisteredHostSlot } from "./diagnostics.js";
|
|
2
|
-
let door = null;
|
|
3
|
-
function registerBuilderDoor(next) {
|
|
4
|
-
door = next;
|
|
5
|
-
}
|
|
6
|
-
function resetBuilderDoorForTests() {
|
|
7
|
-
door = null;
|
|
8
|
-
}
|
|
9
|
-
function getBuilderDoor() {
|
|
10
|
-
if (!door) {
|
|
11
|
-
reportUnregisteredHostSlot("builder", "the agent options, save and lifecycle controls are absent");
|
|
12
|
-
}
|
|
13
|
-
return door;
|
|
14
|
-
}
|
|
15
|
-
function requireBuilderDoor() {
|
|
16
|
-
const d = getBuilderDoor();
|
|
17
|
-
if (!d) throw new Error('The host registered no "builder" door for the chat package (registerBuilderDoor).');
|
|
18
|
-
return d;
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
getBuilderDoor,
|
|
22
|
-
registerBuilderDoor,
|
|
23
|
-
requireBuilderDoor,
|
|
24
|
-
resetBuilderDoorForTests
|
|
25
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const CreatorRunPanel: import("react").ComponentType<import("../../agents/components/run-controls/CreatorRunPanel.js").CreatorRunPanelProps>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import dynamic from "next/dynamic";
|
|
3
|
-
const CreatorRunPanel = dynamic(
|
|
4
|
-
() => import("../../agents/components/run-controls/CreatorRunPanel.js").then((m) => ({
|
|
5
|
-
default: m.CreatorRunPanel
|
|
6
|
-
})),
|
|
7
|
-
{ ssr: false, loading: () => null }
|
|
8
|
-
);
|
|
9
|
-
export {
|
|
10
|
-
CreatorRunPanel
|
|
11
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type ComposerKeyIntent =
|
|
2
|
-
/** Send the message now. */
|
|
3
|
-
"send"
|
|
4
|
-
/** Deliver mid-run, at the agent's next pause (⌘/Ctrl+Enter while running). */
|
|
5
|
-
| "steer"
|
|
6
|
-
/** Stop the run, then send (⌘/Ctrl+Shift+Enter while running). */
|
|
7
|
-
| "interrupt"
|
|
8
|
-
/** Put a line break in the text. */
|
|
9
|
-
| "newline"
|
|
10
|
-
/** Not ours — let the browser do whatever it does. */
|
|
11
|
-
| "none";
|
|
12
|
-
export interface ComposerKeyState {
|
|
13
|
-
/** The conversation's setting: does a bare Enter send? */
|
|
14
|
-
submitOnEnter: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* A touch-only device (a phone or a tablet with no mouse). Its on-screen
|
|
17
|
-
* keyboard has ONE key for "new line", so Enter can never send there — the
|
|
18
|
-
* send button does (Arman, 2026-09-28). Absent = detected from the device.
|
|
19
|
-
*/
|
|
20
|
-
touchKeyboard?: boolean;
|
|
21
|
-
/** Is a run streaming right now? Enables steer/interrupt. */
|
|
22
|
-
isRunning?: boolean;
|
|
23
|
-
/** Does this composer support the mid-run modes at all? */
|
|
24
|
-
supportsRunModes?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/** The keyboard event fields this rule reads — a plain object, so the rule is
|
|
27
|
-
* testable without a DOM and identical for React and native listeners. */
|
|
28
|
-
export interface ComposerKeyEvent {
|
|
29
|
-
key: string;
|
|
30
|
-
shiftKey: boolean;
|
|
31
|
-
metaKey: boolean;
|
|
32
|
-
ctrlKey: boolean;
|
|
33
|
-
/** True mid-IME composition: Enter is committing characters, never sending. */
|
|
34
|
-
isComposing?: boolean;
|
|
35
|
-
}
|
|
36
|
-
/** A phone or a mouse-less tablet: the keyboard on screen is the only keyboard. */
|
|
37
|
-
export declare const TOUCH_ONLY_DEVICE_QUERY = "(pointer: coarse) and (hover: none)";
|
|
38
|
-
export declare function isTouchOnlyDevice(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Does a bare Enter send on THIS device? The setting, except that on a
|
|
41
|
-
* touch-only device it never does — every composer shows and obeys this.
|
|
42
|
-
*/
|
|
43
|
-
export declare function enterSendsHere(submitOnEnter: boolean, touchKeyboard?: boolean): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* What this keystroke means in a composer. `"none"` means the composer must
|
|
46
|
-
* not call `preventDefault` — anything else means it must.
|
|
47
|
-
*/
|
|
48
|
-
export declare function composerKeyIntent(e: ComposerKeyEvent, state: ComposerKeyState): ComposerKeyIntent;
|
|
49
|
-
/** True when the composer must swallow the browser's own Enter handling. */
|
|
50
|
-
export declare function intentTakesTheKey(intent: ComposerKeyIntent): boolean;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const TOUCH_ONLY_DEVICE_QUERY = "(pointer: coarse) and (hover: none)";
|
|
2
|
-
function isTouchOnlyDevice() {
|
|
3
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
|
|
4
|
-
return window.matchMedia(TOUCH_ONLY_DEVICE_QUERY).matches;
|
|
5
|
-
}
|
|
6
|
-
function enterSendsHere(submitOnEnter, touchKeyboard = isTouchOnlyDevice()) {
|
|
7
|
-
return submitOnEnter && !touchKeyboard;
|
|
8
|
-
}
|
|
9
|
-
function composerKeyIntent(e, state) {
|
|
10
|
-
if (e.key !== "Enter") return "none";
|
|
11
|
-
if (e.isComposing) return "none";
|
|
12
|
-
const withCmd = e.metaKey || e.ctrlKey;
|
|
13
|
-
const running = Boolean(state.isRunning) && state.supportsRunModes !== false;
|
|
14
|
-
const submitOnEnter = enterSendsHere(state.submitOnEnter, state.touchKeyboard);
|
|
15
|
-
if (running && withCmd && e.shiftKey) return "interrupt";
|
|
16
|
-
if (running && withCmd && !e.shiftKey && submitOnEnter) return "steer";
|
|
17
|
-
if (submitOnEnter) {
|
|
18
|
-
if (e.shiftKey) return "newline";
|
|
19
|
-
return "send";
|
|
20
|
-
}
|
|
21
|
-
return withCmd ? "send" : "newline";
|
|
22
|
-
}
|
|
23
|
-
function intentTakesTheKey(intent) {
|
|
24
|
-
return intent !== "none" && intent !== "newline";
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
TOUCH_ONLY_DEVICE_QUERY,
|
|
28
|
-
composerKeyIntent,
|
|
29
|
-
enterSendsHere,
|
|
30
|
-
intentTakesTheKey,
|
|
31
|
-
isTouchOnlyDevice
|
|
32
|
-
};
|