@jupyter/chat 0.8.0 → 0.9.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.
Files changed (54) hide show
  1. package/lib/components/chat-input.d.ts +3 -11
  2. package/lib/components/chat-input.js +26 -40
  3. package/lib/components/chat-messages.d.ts +17 -4
  4. package/lib/components/chat-messages.js +9 -9
  5. package/lib/components/chat.d.ts +5 -5
  6. package/lib/components/chat.js +9 -8
  7. package/lib/components/code-blocks/copy-button.js +6 -3
  8. package/lib/components/input/buttons/attach-button.d.ts +6 -0
  9. package/lib/components/input/{attach-button.js → buttons/attach-button.js} +11 -8
  10. package/lib/components/input/buttons/cancel-button.d.ts +6 -0
  11. package/lib/components/input/{cancel-button.js → buttons/cancel-button.js} +5 -7
  12. package/lib/components/input/buttons/index.d.ts +3 -0
  13. package/lib/components/input/buttons/index.js +7 -0
  14. package/lib/components/input/buttons/send-button.d.ts +6 -0
  15. package/lib/components/input/{send-button.js → buttons/send-button.js} +52 -42
  16. package/lib/components/input/index.d.ts +3 -3
  17. package/lib/components/input/index.js +3 -3
  18. package/lib/components/input/toolbar-registry.d.ts +98 -0
  19. package/lib/components/input/toolbar-registry.js +85 -0
  20. package/lib/components/input/use-chat-commands.js +3 -2
  21. package/lib/components/mui-extras/tooltipped-button.d.ts +1 -1
  22. package/lib/components/mui-extras/tooltipped-button.js +3 -2
  23. package/lib/components/mui-extras/tooltipped-icon-button.js +4 -2
  24. package/lib/input-model.d.ts +41 -0
  25. package/lib/input-model.js +17 -1
  26. package/lib/model.d.ts +22 -0
  27. package/lib/model.js +18 -2
  28. package/lib/types.d.ts +0 -18
  29. package/lib/widgets/chat-widget.d.ts +5 -1
  30. package/lib/widgets/chat-widget.js +7 -1
  31. package/package.json +1 -1
  32. package/src/components/chat-input.tsx +40 -65
  33. package/src/components/chat-messages.tsx +31 -14
  34. package/src/components/chat.tsx +12 -21
  35. package/src/components/code-blocks/copy-button.tsx +9 -3
  36. package/src/components/input/{attach-button.tsx → buttons/attach-button.tsx} +15 -20
  37. package/src/components/input/{cancel-button.tsx → buttons/cancel-button.tsx} +9 -16
  38. package/src/components/input/buttons/index.ts +8 -0
  39. package/src/components/input/{send-button.tsx → buttons/send-button.tsx} +62 -61
  40. package/src/components/input/index.ts +3 -3
  41. package/src/components/input/toolbar-registry.tsx +162 -0
  42. package/src/components/input/use-chat-commands.tsx +8 -2
  43. package/src/components/mui-extras/tooltipped-button.tsx +4 -2
  44. package/src/components/mui-extras/tooltipped-icon-button.tsx +5 -2
  45. package/src/input-model.ts +58 -1
  46. package/src/model.ts +36 -2
  47. package/src/types.ts +0 -21
  48. package/src/widgets/chat-widget.tsx +8 -1
  49. package/style/base.css +1 -0
  50. package/style/chat.css +10 -0
  51. package/style/input.css +32 -0
  52. package/lib/components/input/attach-button.d.ts +0 -14
  53. package/lib/components/input/cancel-button.d.ts +0 -11
  54. package/lib/components/input/send-button.d.ts +0 -18
@@ -6,7 +6,7 @@
6
6
  import { ReactWidget } from '@jupyterlab/apputils';
7
7
  import React from 'react';
8
8
 
9
- import { Chat } from '../components/chat';
9
+ import { Chat, IInputToolbarRegistry } from '../components';
10
10
  import { chatIcon } from '../icons';
11
11
  import { IChatModel } from '../model';
12
12
 
@@ -29,6 +29,13 @@ export class ChatWidget extends ReactWidget {
29
29
  return this._chatOptions.model;
30
30
  }
31
31
 
32
+ /**
33
+ * Get the input toolbar registry (if it has been provided when creating the widget).
34
+ */
35
+ get inputToolbarRegistry(): IInputToolbarRegistry | undefined {
36
+ return this._chatOptions.inputToolbarRegistry;
37
+ }
38
+
32
39
  render() {
33
40
  // The model need to be passed, otherwise it is undefined in the widget in
34
41
  // the case of collaborative document.
package/style/base.css CHANGED
@@ -11,3 +11,4 @@
11
11
 
12
12
  @import url('./chat.css');
13
13
  @import url('./chat-settings.css');
14
+ @import url('./input.css');
package/style/chat.css CHANGED
@@ -130,3 +130,13 @@
130
130
  .jp-chat-attachment .jp-chat-attachment-clickable:hover {
131
131
  cursor: pointer;
132
132
  }
133
+
134
+ .jp-chat-command-name {
135
+ font-weight: normal;
136
+ margin: 5px;
137
+ }
138
+
139
+ .jp-chat-command-description {
140
+ color: gray;
141
+ margin: 5px;
142
+ }
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
6
+ .jp-chat-input-toolbar {
7
+ gap: 1px;
8
+ }
9
+
10
+ .jp-chat-input-toolbar .jp-chat-tooltipped-wrap button {
11
+ border-radius: 0;
12
+ min-width: unset;
13
+ }
14
+
15
+ .jp-chat-input-toolbar .jp-chat-tooltipped-wrap:first-child button {
16
+ border-top-left-radius: 2px;
17
+ border-bottom-left-radius: 2px;
18
+ }
19
+
20
+ .jp-chat-input-toolbar .jp-chat-tooltipped-wrap:last-child button {
21
+ border-top-right-radius: 2px;
22
+ border-bottom-right-radius: 2px;
23
+ }
24
+
25
+ .jp-chat-input-toolbar .jp-chat-attach-button,
26
+ .jp-chat-input-toolbar .jp-chat-cancel-button {
27
+ padding: 4px;
28
+ }
29
+
30
+ .jp-chat-input-toolbar .jp-chat-send-include-opener {
31
+ padding: 4px 0;
32
+ }
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import { IDocumentManager } from '@jupyterlab/docmanager';
3
- import { IAttachment } from '../../types';
4
- /**
5
- * The attach button props.
6
- */
7
- export type AttachButtonProps = {
8
- documentManager: IDocumentManager;
9
- onAttach: (attachment: IAttachment) => void;
10
- };
11
- /**
12
- * The attach button.
13
- */
14
- export declare function AttachButton(props: AttachButtonProps): JSX.Element;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * The cancel button props.
4
- */
5
- export type CancelButtonProps = {
6
- onCancel: () => void;
7
- };
8
- /**
9
- * The cancel button.
10
- */
11
- export declare function CancelButton(props: CancelButtonProps): JSX.Element;
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- import { IInputModel } from '../../input-model';
3
- import { Selection } from '../../types';
4
- /**
5
- * The send button props.
6
- */
7
- export type SendButtonProps = {
8
- model: IInputModel;
9
- sendWithShiftEnter: boolean;
10
- inputExists: boolean;
11
- onSend: (selection?: Selection) => unknown;
12
- hideIncludeSelection?: boolean;
13
- hasButtonOnLeft?: boolean;
14
- };
15
- /**
16
- * The send button, with optional 'include selection' menu.
17
- */
18
- export declare function SendButton(props: SendButtonProps): JSX.Element;