@k2b/ui 0.17.0 → 0.19.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/README.md +3 -2
- package/dist/browser/actions/ContextMenu.js +3 -1
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/Dropdown.js +91 -46
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/FilterChip.js +4 -1
- package/dist/browser/actions/FilterChip.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +1311 -565
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/chat/ChatPrimitives.js +9 -6
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/chat-behavior.js +9 -0
- package/dist/browser/chat/chat-behavior.js.map +1 -1
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/content/Calendar.js +579 -533
- package/dist/browser/content/Calendar.js.map +1 -1
- package/dist/browser/content/FileView.js +62 -36
- package/dist/browser/content/FileView.js.map +1 -1
- package/dist/browser/content/Lightbox.js +76 -40
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/MarkdownView.js +9 -3
- package/dist/browser/content/MarkdownView.js.map +1 -1
- package/dist/browser/content/PdfPreview.js +146 -79
- package/dist/browser/content/PdfPreview.js.map +1 -1
- package/dist/browser/content/Timeline.js +1038 -0
- package/dist/browser/content/Timeline.js.map +1 -0
- package/dist/browser/content/VideoPlayer.js +299 -0
- package/dist/browser/content/VideoPlayer.js.map +1 -0
- package/dist/browser/content/chart-inspection.js +7 -2
- package/dist/browser/content/chart-inspection.js.map +1 -1
- package/dist/browser/content/file-view-preview.js +2 -2
- package/dist/browser/content/file-view-preview.js.map +1 -1
- package/dist/browser/content/index.js +3 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/markdown-links.js +178 -0
- package/dist/browser/content/markdown-links.js.map +1 -0
- package/dist/browser/content/timeline-model.js +579 -0
- package/dist/browser/content/timeline-model.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +26 -14
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/inputs/ChoiceChips.js +66 -0
- package/dist/browser/inputs/ChoiceChips.js.map +1 -0
- package/dist/browser/inputs/ChoiceGroups.js +53 -12
- package/dist/browser/inputs/ChoiceGroups.js.map +1 -1
- package/dist/browser/inputs/FileDropTarget.js +129 -0
- package/dist/browser/inputs/FileDropTarget.js.map +1 -0
- package/dist/browser/inputs/FileInputs.js +84 -43
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/SignatureInput.js +558 -0
- package/dist/browser/inputs/SignatureInput.js.map +1 -0
- package/dist/browser/inputs/emoji/EmojiPicker.js +841 -0
- package/dist/browser/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-data.js +1903 -0
- package/dist/browser/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-index.js +209 -0
- package/dist/browser/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/browser/inputs/emoji/emoji-messages.js +64 -0
- package/dist/browser/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/browser/inputs/file-drop.js +338 -0
- package/dist/browser/inputs/file-drop.js.map +1 -0
- package/dist/browser/inputs/index.js +6 -0
- package/dist/browser/inputs/index.js.map +1 -1
- package/dist/browser/inputs/markdown/MarkdownEditor.js +72 -78
- package/dist/browser/inputs/markdown/MarkdownEditor.js.map +1 -1
- package/dist/browser/inputs/markdown/actions.js +48 -2
- package/dist/browser/inputs/markdown/actions.js.map +1 -1
- package/dist/browser/inputs/markdown/code-zone.js +38 -2
- package/dist/browser/inputs/markdown/code-zone.js.map +1 -1
- package/dist/browser/inputs/signature-messages.js +39 -0
- package/dist/browser/inputs/signature-messages.js.map +1 -0
- package/dist/browser/inputs/signature.js +208 -0
- package/dist/browser/inputs/signature.js.map +1 -0
- package/dist/browser/internal/render-error.js +49 -0
- package/dist/browser/internal/render-error.js.map +1 -0
- package/dist/browser/intl/messages.js +205 -4
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +483 -218
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/FloatingWindow.js +4 -1
- package/dist/browser/layout/FloatingWindow.js.map +1 -1
- package/dist/browser/layout/Navigation.js +274 -197
- package/dist/browser/layout/Navigation.js.map +1 -1
- package/dist/browser/layout/SidebarItemPreview.js +5 -1
- package/dist/browser/layout/SidebarItemPreview.js.map +1 -1
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/navigation-model.js +2 -0
- package/dist/browser/layout/navigation-model.js.map +1 -1
- package/dist/browser/surfaces/NoticeCard.js +47 -44
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/ResourceCard.js +212 -0
- package/dist/browser/surfaces/ResourceCard.js.map +1 -0
- package/dist/browser/surfaces/index.js +1 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/licenses/emojibase-data.txt +21 -0
- package/dist/ssr/actions/ContextMenu.js +3 -1
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/Dropdown.js +49 -12
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/FilterChip.js +4 -1
- package/dist/ssr/actions/FilterChip.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +823 -221
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/chat/ChatPrimitives.js +9 -6
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/chat-behavior.js +9 -0
- package/dist/ssr/chat/chat-behavior.js.map +1 -1
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/content/Calendar.js +183 -142
- package/dist/ssr/content/Calendar.js.map +1 -1
- package/dist/ssr/content/FileView.js +30 -6
- package/dist/ssr/content/FileView.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +19 -5
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/MarkdownView.js +9 -3
- package/dist/ssr/content/MarkdownView.js.map +1 -1
- package/dist/ssr/content/PdfPreview.js +77 -36
- package/dist/ssr/content/PdfPreview.js.map +1 -1
- package/dist/ssr/content/Timeline.js +804 -0
- package/dist/ssr/content/Timeline.js.map +1 -0
- package/dist/ssr/content/VideoPlayer.js +228 -0
- package/dist/ssr/content/VideoPlayer.js.map +1 -0
- package/dist/ssr/content/chart-inspection.js +7 -2
- package/dist/ssr/content/chart-inspection.js.map +1 -1
- package/dist/ssr/content/file-view-preview.js +2 -2
- package/dist/ssr/content/file-view-preview.js.map +1 -1
- package/dist/ssr/content/index.js +3 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/markdown-links.js +178 -0
- package/dist/ssr/content/markdown-links.js.map +1 -0
- package/dist/ssr/content/timeline-model.js +579 -0
- package/dist/ssr/content/timeline-model.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +26 -14
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/inputs/ChoiceChips.js +66 -0
- package/dist/ssr/inputs/ChoiceChips.js.map +1 -0
- package/dist/ssr/inputs/ChoiceGroups.js +12 -4
- package/dist/ssr/inputs/ChoiceGroups.js.map +1 -1
- package/dist/ssr/inputs/FileDropTarget.js +103 -0
- package/dist/ssr/inputs/FileDropTarget.js.map +1 -0
- package/dist/ssr/inputs/FileInputs.js +49 -12
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +404 -0
- package/dist/ssr/inputs/SignatureInput.js.map +1 -0
- package/dist/ssr/inputs/emoji/EmojiPicker.js +551 -0
- package/dist/ssr/inputs/emoji/EmojiPicker.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-data.js +1903 -0
- package/dist/ssr/inputs/emoji/emoji-data.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-index.js +209 -0
- package/dist/ssr/inputs/emoji/emoji-index.js.map +1 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js +64 -0
- package/dist/ssr/inputs/emoji/emoji-messages.js.map +1 -0
- package/dist/ssr/inputs/file-drop.js +338 -0
- package/dist/ssr/inputs/file-drop.js.map +1 -0
- package/dist/ssr/inputs/index.js +6 -0
- package/dist/ssr/inputs/index.js.map +1 -1
- package/dist/ssr/inputs/markdown/MarkdownEditor.js +14 -2
- package/dist/ssr/inputs/markdown/MarkdownEditor.js.map +1 -1
- package/dist/ssr/inputs/markdown/actions.js +48 -2
- package/dist/ssr/inputs/markdown/actions.js.map +1 -1
- package/dist/ssr/inputs/markdown/code-zone.js +38 -2
- package/dist/ssr/inputs/markdown/code-zone.js.map +1 -1
- package/dist/ssr/inputs/signature-messages.js +39 -0
- package/dist/ssr/inputs/signature-messages.js.map +1 -0
- package/dist/ssr/inputs/signature.js +208 -0
- package/dist/ssr/inputs/signature.js.map +1 -0
- package/dist/ssr/internal/render-error.js +49 -0
- package/dist/ssr/internal/render-error.js.map +1 -0
- package/dist/ssr/intl/messages.js +205 -4
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +264 -47
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/FloatingWindow.js +4 -1
- package/dist/ssr/layout/FloatingWindow.js.map +1 -1
- package/dist/ssr/layout/Navigation.js +169 -122
- package/dist/ssr/layout/Navigation.js.map +1 -1
- package/dist/ssr/layout/SidebarItemPreview.js +5 -1
- package/dist/ssr/layout/SidebarItemPreview.js.map +1 -1
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/navigation-model.js +2 -0
- package/dist/ssr/layout/navigation-model.js.map +1 -1
- package/dist/ssr/surfaces/NoticeCard.js +17 -12
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/ResourceCard.js +115 -0
- package/dist/ssr/surfaces/ResourceCard.js.map +1 -0
- package/dist/ssr/surfaces/index.js +1 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +13 -1
- package/dist/types/actions/FilterChip.d.ts +5 -0
- package/dist/types/chat/ChatComposer.d.ts +24 -1
- package/dist/types/chat/ChatPrimitives.d.ts +1 -1
- package/dist/types/chat/chat-behavior.d.ts +15 -0
- package/dist/types/chat/index.d.ts +1 -1
- package/dist/types/chat/types.d.ts +34 -0
- package/dist/types/content/Calendar.d.ts +28 -8
- package/dist/types/content/Lightbox.d.ts +8 -0
- package/dist/types/content/Timeline.d.ts +49 -0
- package/dist/types/content/VideoPlayer.d.ts +41 -0
- package/dist/types/content/index.d.ts +6 -2
- package/dist/types/content/markdown-links.d.ts +66 -0
- package/dist/types/content/timeline-model.d.ts +148 -0
- package/dist/types/feedback/dialog-core.d.ts +1 -1
- package/dist/types/inputs/ChoiceChips.d.ts +20 -0
- package/dist/types/inputs/ChoiceGroups.d.ts +11 -2
- package/dist/types/inputs/FileDropTarget.d.ts +23 -0
- package/dist/types/inputs/FileInputs.d.ts +8 -0
- package/dist/types/inputs/SignatureInput.d.ts +22 -0
- package/dist/types/inputs/emoji/EmojiPicker.d.ts +42 -0
- package/dist/types/inputs/emoji/emoji-data.d.ts +2 -0
- package/dist/types/inputs/emoji/emoji-index.d.ts +109 -0
- package/dist/types/inputs/emoji/emoji-messages.d.ts +30 -0
- package/dist/types/inputs/file-drop.d.ts +80 -0
- package/dist/types/inputs/index.d.ts +12 -0
- package/dist/types/inputs/markdown/actions.d.ts +4 -0
- package/dist/types/inputs/markdown/code-zone.d.ts +7 -0
- package/dist/types/inputs/signature-messages.d.ts +11 -0
- package/dist/types/inputs/signature.d.ts +72 -0
- package/dist/types/internal/render-error.d.ts +13 -0
- package/dist/types/intl/messages.d.ts +101 -0
- package/dist/types/layout/AppWorkspace.d.ts +38 -0
- package/dist/types/layout/SidebarItemPreview.d.ts +2 -0
- package/dist/types/layout/index.d.ts +2 -2
- package/dist/types/layout/navigation-model.d.ts +18 -0
- package/dist/types/surfaces/ResourceCard.d.ts +31 -0
- package/dist/types/surfaces/index.d.ts +2 -0
- package/package.json +5 -4
|
@@ -45,4 +45,13 @@ export const executeChatAction = async action => {
|
|
|
45
45
|
}
|
|
46
46
|
await action.onSelect();
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* What Enter does in a conversation composer: Ctrl/⌘+Enter always sends; Shift+Enter, Enter inside an open code
|
|
50
|
+
* block, and Enter on a touch-only device break the line; otherwise `sendKey` decides. IME input is the caller's check.
|
|
51
|
+
*/
|
|
52
|
+
export const conversationEnterAction = (key, context) => {
|
|
53
|
+
if (key.ctrlKey || key.metaKey) return "send";
|
|
54
|
+
if (key.shiftKey || key.altKey || context.touchOnly || context.inCodeBlock || context.sendKey === "mod-enter") return "newline";
|
|
55
|
+
return "send";
|
|
56
|
+
};
|
|
48
57
|
//# sourceMappingURL=chat-behavior.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["chat/chat-behavior.ts"],"sourcesContent":["import type { ChatAction } from \"./types\";\n\nexport const nextChatCommandIndex = (index: number, length: number, direction: 1 | -1): number =>\n length <= 0 ? 0 : (index + direction + length) % length;\n\nexport const isChatNearBottom = (scrollHeight: number, scrollTop: number, clientHeight: number, threshold = 96): boolean =>\n scrollHeight - scrollTop - clientHeight <= threshold;\n\nexport const restoredChatScrollTop = (previousScrollTop: number, previousScrollHeight: number, nextScrollHeight: number): number =>\n Math.max(0, previousScrollTop + nextScrollHeight - previousScrollHeight);\n\nexport type ChatSubmissionRun = {\n /** Clears the controlled draft (and attachments) before the handler runs. */\n clear: () => void;\n /**\n * The application handler. A synchronous throw, a rejected promise, and a\n * `false` result all count as a rejected submission.\n */\n perform: () => boolean | void | Promise<boolean | void>;\n /** Restores the cleared draft (and attachments) after a rejected submission. */\n restore: () => void;\n onError?: (error: unknown) => void;\n};\n\n/**\n * Runs one composer submission with optimistic clearing. Resolves to `true`\n * when the handler accepted the submission. A synchronous throw is handled\n * exactly like a rejected promise so a controlled draft is never lost.\n */\nexport const runChatSubmission = async (run: ChatSubmissionRun): Promise<boolean> => {\n run.clear();\n try {\n if ((await run.perform()) === false) {\n run.restore();\n return false;\n }\n return true;\n } catch (error) {\n run.onError?.(error);\n run.restore();\n return false;\n }\n};\n\n/** Reports a handler failure without letting a synchronous throw escape. */\nexport const reportChatFailure = (perform: () => unknown, onError?: (error: unknown) => void): void => {\n try {\n const result = perform();\n if (result instanceof Promise) void result.catch((error) => onError?.(error));\n } catch (error) {\n onError?.(error);\n }\n};\n\nconst writeChatClipboard = async (value: string): Promise<void> => {\n if (typeof navigator === \"undefined\" || !navigator.clipboard?.writeText) {\n throw new Error(\"Clipboard access is unavailable.\");\n }\n await navigator.clipboard.writeText(value);\n};\n\n/** Executes the one behavior guaranteed by the ChatAction contract. */\nexport const executeChatAction = async (action: ChatAction): Promise<void> => {\n if (typeof action.copyText === \"string\") {\n await writeChatClipboard(action.copyText);\n return;\n }\n await action.onSelect();\n};\n"],"mappings":"AAEA,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,SAAiB,KACnF,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,IAAI,MAAM;AAEzD,OAAO,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,SAAiB,EAAE,YAAoB,EAAE,SAAS,GAAG,EAAE,KAC5G,YAAY,GAAG,SAAS,GAAG,YAAY,IAAI,SAAS;AAEtD,OAAO,MAAM,qBAAqB,GAAG,CAAC,iBAAyB,EAAE,oBAA4B,EAAE,gBAAwB,KACrH,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAe1E;AACA;AACA;AACA;AACA;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/chat-behavior.ts"],"sourcesContent":["import type { ChatAction } from \"./types\";\n\nexport const nextChatCommandIndex = (index: number, length: number, direction: 1 | -1): number =>\n length <= 0 ? 0 : (index + direction + length) % length;\n\nexport const isChatNearBottom = (scrollHeight: number, scrollTop: number, clientHeight: number, threshold = 96): boolean =>\n scrollHeight - scrollTop - clientHeight <= threshold;\n\nexport const restoredChatScrollTop = (previousScrollTop: number, previousScrollHeight: number, nextScrollHeight: number): number =>\n Math.max(0, previousScrollTop + nextScrollHeight - previousScrollHeight);\n\nexport type ChatSubmissionRun = {\n /** Clears the controlled draft (and attachments) before the handler runs. */\n clear: () => void;\n /**\n * The application handler. A synchronous throw, a rejected promise, and a\n * `false` result all count as a rejected submission.\n */\n perform: () => boolean | void | Promise<boolean | void>;\n /** Restores the cleared draft (and attachments) after a rejected submission. */\n restore: () => void;\n onError?: (error: unknown) => void;\n};\n\n/**\n * Runs one composer submission with optimistic clearing. Resolves to `true`\n * when the handler accepted the submission. A synchronous throw is handled\n * exactly like a rejected promise so a controlled draft is never lost.\n */\nexport const runChatSubmission = async (run: ChatSubmissionRun): Promise<boolean> => {\n run.clear();\n try {\n if ((await run.perform()) === false) {\n run.restore();\n return false;\n }\n return true;\n } catch (error) {\n run.onError?.(error);\n run.restore();\n return false;\n }\n};\n\n/** Reports a handler failure without letting a synchronous throw escape. */\nexport const reportChatFailure = (perform: () => unknown, onError?: (error: unknown) => void): void => {\n try {\n const result = perform();\n if (result instanceof Promise) void result.catch((error) => onError?.(error));\n } catch (error) {\n onError?.(error);\n }\n};\n\nconst writeChatClipboard = async (value: string): Promise<void> => {\n if (typeof navigator === \"undefined\" || !navigator.clipboard?.writeText) {\n throw new Error(\"Clipboard access is unavailable.\");\n }\n await navigator.clipboard.writeText(value);\n};\n\n/** Executes the one behavior guaranteed by the ChatAction contract. */\nexport const executeChatAction = async (action: ChatAction): Promise<void> => {\n if (typeof action.copyText === \"string\") {\n await writeChatClipboard(action.copyText);\n return;\n }\n await action.onSelect();\n};\n\nexport type ChatEnterKey = { shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean };\n\n/**\n * What Enter does in a conversation composer: Ctrl/⌘+Enter always sends; Shift+Enter, Enter inside an open code\n * block, and Enter on a touch-only device break the line; otherwise `sendKey` decides. IME input is the caller's check.\n */\nexport const conversationEnterAction = (\n key: ChatEnterKey,\n context: { sendKey: \"enter\" | \"mod-enter\"; touchOnly: boolean; inCodeBlock: boolean },\n): \"send\" | \"newline\" => {\n if (key.ctrlKey || key.metaKey) return \"send\";\n if (key.shiftKey || key.altKey || context.touchOnly || context.inCodeBlock || context.sendKey === \"mod-enter\") return \"newline\";\n return \"send\";\n};\n"],"mappings":"AAEA,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,MAAc,EAAE,SAAiB,KACnF,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,GAAG,MAAM,IAAI,MAAM;AAEzD,OAAO,MAAM,gBAAgB,GAAG,CAAC,YAAoB,EAAE,SAAiB,EAAE,YAAoB,EAAE,SAAS,GAAG,EAAE,KAC5G,YAAY,GAAG,SAAS,GAAG,YAAY,IAAI,SAAS;AAEtD,OAAO,MAAM,qBAAqB,GAAG,CAAC,iBAAyB,EAAE,oBAA4B,EAAE,gBAAwB,KACrH,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAe1E;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,iBAAiB,GAAG,MAAO,GAAsB,IAAuB;EACnF,GAAG,CAAC,KAAK,CAAC,CAAC;EACX,IAAI;IACF,IAAI,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,EAAE;MACnC,GAAG,CAAC,OAAO,CAAC,CAAC;MACb,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb,CAAC,CAAC,OAAO,KAAK,EAAE;IACd,GAAG,CAAC,OAAO,GAA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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["chat/index.ts"],"sourcesContent":["export type { ChatContextPanelProps, ChatContextPopupProps } from \"./ChatContextPopup\";\n\nimport { ChatContextPanel, ChatContextPopup } from \"./ChatContextPopup\";\nimport { ChatTasks } from \"./ChatTasks\";\n\nexport type { ChatTask, ChatTasksProps } from \"./ChatTasks\";\n\nimport { ChatComposer } from \"./ChatComposer\";\nimport { ChatActivity, ChatContextUsage, ChatMessage } from \"./ChatPrimitives\";\nimport { ChatRoot } from \"./ChatRoot\";\nimport { ChatTimeline } from \"./ChatTimeline\";\n\nexport type { ChatCommand, ChatCommandContext, ChatComposerProps, ChatFileSelection, ChatPasteHandler } from \"./ChatComposer\";\nexport type { ChatActivityProps, ChatContextUsageProps, ChatMessageProps } from \"./ChatPrimitives\";\nexport { formatChatTokens } from \"./ChatPrimitives\";\nexport type { ChatRootProps } from \"./ChatRoot\";\nexport type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from \"./ChatTimeline\";\nexport type {\n ChatAction,\n ChatActivityTone,\n ChatAttachment,\n ChatComposerState,\n ChatContextUsageData,\n ChatMention,\n ChatMessageStatus,\n ChatModelOption,\n ChatRole,\n ChatSubmitInput,\n ChatSubmitIntent,\n ChatUsage,\n} from \"./types\";\n\n/**\n * Portable, controlled chat surface. Applications own storage, streaming,\n * authorization, rich message rendering, and domain actions.\n */\nexport const Chat = Object.assign(ChatRoot, {\n Tasks: ChatTasks,\n Timeline: ChatTimeline,\n Message: ChatMessage,\n Activity: ChatActivity,\n Composer: ChatComposer,\n ContextUsage: ChatContextUsage,\n ContextPopup: ChatContextPopup,\n ContextPanel: ChatContextPanel,\n});\n\nexport { reconcileChatMentions } from \"./composer-document\";\n"],"mappings":"AAEA,SAAS,gBAAgB,EAAE,gBAAgB,QAAQ,oBAAoB;AACvE,SAAS,SAAS,QAAQ,aAAa;AAIvC,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,YAAY,EAAE,gBAAgB,EAAE,WAAW,QAAQ,kBAAkB;AAC9E,SAAS,QAAQ,QAAQ,YAAY;AACrC,SAAS,YAAY,QAAQ,gBAAgB;AAI7C,SAAS,gBAAgB,QAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"names":[],"sources":["chat/index.ts"],"sourcesContent":["export type { ChatContextPanelProps, ChatContextPopupProps } from \"./ChatContextPopup\";\n\nimport { ChatContextPanel, ChatContextPopup } from \"./ChatContextPopup\";\nimport { ChatTasks } from \"./ChatTasks\";\n\nexport type { ChatTask, ChatTasksProps } from \"./ChatTasks\";\n\nimport { ChatComposer } from \"./ChatComposer\";\nimport { ChatActivity, ChatContextUsage, ChatMessage } from \"./ChatPrimitives\";\nimport { ChatRoot } from \"./ChatRoot\";\nimport { ChatTimeline } from \"./ChatTimeline\";\n\nexport type { ChatCommand, ChatCommandContext, ChatComposerProps, ChatFileSelection, ChatPasteHandler } from \"./ChatComposer\";\nexport type { ChatActivityProps, ChatContextUsageProps, ChatMessageProps } from \"./ChatPrimitives\";\nexport { formatChatTokens } from \"./ChatPrimitives\";\nexport type { ChatRootProps } from \"./ChatRoot\";\nexport type { ChatActivityItem, ChatMessageItem, ChatTimelineItem, ChatTimelineProps } from \"./ChatTimeline\";\nexport type {\n ChatAction,\n ChatActivityTone,\n ChatAttachment,\n ChatComposerEmoji,\n ChatComposerMicrophone,\n ChatComposerState,\n ChatContextUsageData,\n ChatDictationState,\n ChatMention,\n ChatMessageStatus,\n ChatModelOption,\n ChatRole,\n ChatSubmitInput,\n ChatSubmitIntent,\n ChatUsage,\n} from \"./types\";\n\n/**\n * Portable, controlled chat surface. Applications own storage, streaming,\n * authorization, rich message rendering, and domain actions.\n */\nexport const Chat = Object.assign(ChatRoot, {\n Tasks: ChatTasks,\n Timeline: ChatTimeline,\n Message: ChatMessage,\n Activity: ChatActivity,\n Composer: ChatComposer,\n ContextUsage: ChatContextUsage,\n ContextPopup: ChatContextPopup,\n ContextPanel: ChatContextPanel,\n});\n\nexport { reconcileChatMentions } from \"./composer-document\";\n"],"mappings":"AAEA,SAAS,gBAAgB,EAAE,gBAAgB,QAAQ,oBAAoB;AACvE,SAAS,SAAS,QAAQ,aAAa;AAIvC,SAAS,YAAY,QAAQ,gBAAgB;AAC7C,SAAS,YAAY,EAAE,gBAAgB,EAAE,WAAW,QAAQ,kBAAkB;AAC9E,SAAS,QAAQ,QAAQ,YAAY;AACrC,SAAS,YAAY,QAAQ,gBAAgB;AAI7C,SAAS,gBAAgB,QAAQ,kBAAkB;AAqBnD;AACA;AACA;AACA;AACA,OAAO,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE;EAC1C,KAAK,EAAE,SAAS;EAChB,QAAQ,EAAE,YAAY;EACtB,OAAO,EAAE,WAAW;EACpB,QAAQ,EAAE,YAAY;EACtB,QAAQ,EAAE,YAAY;EACtB,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE,gBAAgB;EAC9B,YAAY,EAAE;AAChB,CAAC,CAAC;AAEF,SAAS,qBAAqB,QAAQ,qBAAqB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":[],"sources":["chat/types.ts"],"sourcesContent":["import type { EmojiSkinTone } from \"../inputs/emoji/emoji-index\";\n\nexport type ChatRole = \"user\" | \"assistant\" | \"system\" | \"tool\";\n\nexport type ChatMessageStatus = \"pending\" | \"streaming\" | \"complete\" | \"error\";\n\nexport type ChatActivityTone = \"neutral\" | \"ai\" | \"success\" | \"danger\";\n\ntype ChatActionBase = {\n id: string;\n label: string;\n icon?: string;\n variant?: \"danger\";\n disabled?: boolean;\n /** Toggle state for persistent message actions such as feedback. */\n pressed?: boolean;\n /** Semantic foreground for selected feedback actions, without a persistent background. */\n pressedTone?: \"success\" | \"danger\";\n};\n\n/** Exactly one executable behavior for every chat action. */\nexport type ChatAction = ChatActionBase &\n ({ onSelect: () => void | Promise<void>; copyText?: never } | { copyText: string; onSelect?: never });\n\nexport type ChatAttachment = {\n id: string;\n name: string;\n size?: number;\n kind?: \"file\" | \"image\" | \"resource\";\n icon?: string;\n previewUrl?: string;\n alt?: string;\n /** Optional destination represented by this attachment. */\n href?: string;\n /** Opaque application-owned payload returned unchanged with ChatSubmitInput. */\n data?: unknown;\n /** Optional application-owned action presented below the attachment label. */\n action?: ChatAction;\n};\n\nexport type ChatUsage = {\n input?: number;\n output?: number;\n total?: number;\n};\n\nexport type ChatContextUsageData = {\n usage?: ChatUsage | null;\n loopUsage?: ChatUsage | null;\n contextWindow?: number;\n modelLabel?: string;\n};\n\nexport type ChatModelOption = {\n id: string;\n label: string;\n description?: string;\n image?: string;\n icon?: string;\n capabilities?: readonly string[];\n};\n\nexport type ChatComposerState = \"idle\" | \"submitting\" | \"running\" | \"stopping\";\n\nexport type ChatSubmitIntent = \"send\" | \"steer\" | \"queue\";\n\nexport type ChatSubmitInput = {\n intent: ChatSubmitIntent;\n text: string;\n attachments: readonly ChatAttachment[];\n mentions?: readonly ChatMention[];\n};\n\n/** Ranges use UTF-16 offsets into the untrimmed composer text. Payloads stay application-owned. */\nexport type ChatMention = { start: number; end: number; attachment: ChatAttachment };\n\n/**\n * Live dictation as the caller runs it: `listening` while speech arrives, `refining` after the stop until the refined\n * text replaced it, `refined` afterwards, `unrefined` when the raw text stays, and `interrupted` when the connection\n * ended early and the text so far stays.\n */\nexport type ChatDictationState = \"listening\" | \"refining\" | \"refined\" | \"unrefined\" | \"interrupted\";\n\n/** The composer's microphone. Dictation comes first; a voice message is the deliberate second action. */\nexport type ChatComposerMicrophone = {\n /** A tap starts or stops live dictation. Without it, a tap opens the microphone menu. */\n onDictate?: () => void;\n /** Holding the microphone, or \"Record voice message\" in its menu. Omit it where recording is not available. */\n onVoiceMessage?: () => void;\n /** The dictation state, shown on the microphone and in the hint line. */\n dictation?: ChatDictationState | null;\n /** Offered as \"Restore original\" while `dictation` is `refined`. */\n onRestoreOriginal?: () => void;\n disabled?: boolean;\n};\n\n/**\n * The composer's emoji button and `:shortcode` completion. Typing a colon and two letters suggests emoji by their\n * English or German name or GitHub shortcode; a complete `:thumbsup:` becomes 👍 when its closing colon is typed.\n */\nexport type ChatComposerEmoji = {\n /** Opens the emoji choice next to `anchor`, usually `EmojiPicker.Popover`; `insert` puts the chosen text at the caret. */\n onOpen: (context: { anchor: HTMLElement; insert: (text: string) => void }) => void;\n /** The skin tone of completed emoji that have one, as in the picker. */\n skinTone?: EmojiSkinTone;\n /** Called with each emoji the completion inserted, for example to remember it with `rememberEmoji`. */\n onPick?: (emoji: string) => void;\n};\n"],"mappings":"","ignoreList":[]}
|