@gitlab/ui 66.35.0 → 66.35.1
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 +7 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +9 -2
- package/dist/components/experimental/duo/chat/mock_data.js +8 -1
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.stories.js +6 -3
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +3 -1
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.stories.js +6 -4
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +9 -2
- package/src/components/experimental/duo/chat/duo_chat.stories.js +2 -3
- package/src/components/experimental/duo/chat/mock_data.js +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [66.35.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.35.0...v66.35.1) (2023-10-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlDuoChatMessage:** nextTick() when rendering GFM ([835900c](https://gitlab.com/gitlab-org/gitlab-ui/commit/835900cb9cf01e26b4e24120be3abc6f48c3c371))
|
|
7
|
+
|
|
1
8
|
# [66.35.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v66.34.0...v66.35.0) (2023-10-20)
|
|
2
9
|
|
|
3
10
|
|
package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { nextTick } from 'vue';
|
|
1
2
|
import GlDuoUserFeedback from '../../../user_feedback/user_feedback';
|
|
2
3
|
import { SafeHtmlDirective } from '../../../../../../directives/safe_html/safe_html';
|
|
3
4
|
import { MESSAGE_MODEL_ROLES } from '../../constants';
|
|
@@ -60,7 +61,7 @@ var script = {
|
|
|
60
61
|
if (!chunkId) {
|
|
61
62
|
this.messageChunks = [];
|
|
62
63
|
this.messageContent = this.content;
|
|
63
|
-
this.
|
|
64
|
+
this.hydrateContentWithGFM();
|
|
64
65
|
} else {
|
|
65
66
|
this.messageChunks[chunkId] = content;
|
|
66
67
|
this.messageContent = this.renderMarkdown(concatIndicesUntilEmpty(this.messageChunks));
|
|
@@ -81,7 +82,13 @@ var script = {
|
|
|
81
82
|
if (this.message.chunkId) {
|
|
82
83
|
this.messageChunks[this.message.chunkId] = this.message.content;
|
|
83
84
|
}
|
|
84
|
-
this.
|
|
85
|
+
this.hydrateContentWithGFM();
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
async hydrateContentWithGFM() {
|
|
89
|
+
await nextTick();
|
|
90
|
+
this.renderGFM(this.$refs.content);
|
|
91
|
+
}
|
|
85
92
|
}
|
|
86
93
|
};
|
|
87
94
|
|
|
@@ -80,5 +80,12 @@ const MOCK_USER_PROMPT_MESSAGE = {
|
|
|
80
80
|
timestamp: '2021-04-21T12:00:00.000Z',
|
|
81
81
|
extras: null
|
|
82
82
|
};
|
|
83
|
+
const renderMarkdown = content => content;
|
|
84
|
+
const renderGFM = el => {
|
|
85
|
+
const codeBlock = el.querySelectorAll('.markdown-code-block');
|
|
86
|
+
codeBlock.forEach(block => {
|
|
87
|
+
block === null || block === void 0 ? void 0 : block.classList.add('gl-bg-purple-50', 'gl-p-3', 'gl-mb-3');
|
|
88
|
+
});
|
|
89
|
+
};
|
|
83
90
|
|
|
84
|
-
export { MOCK_CHUNK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, generateMockResponseChunks };
|
|
91
|
+
export { MOCK_CHUNK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, generateMockResponseChunks, renderGFM, renderMarkdown };
|
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MOCK_USER_PROMPT_MESSAGE,
|
|
3
|
+
MOCK_RESPONSE_MESSAGE,
|
|
4
|
+
renderGFM,
|
|
5
|
+
renderMarkdown,
|
|
6
|
+
} from '../../mock_data';
|
|
2
7
|
import GlDuoChatConversation from './duo_chat_conversation.vue';
|
|
3
8
|
import readme from './duo_chat_conversation.md';
|
|
4
9
|
|
|
5
10
|
const defaultValue = (prop) => GlDuoChatConversation.props[prop].default;
|
|
6
|
-
const renderMarkdown = (content) => content;
|
|
7
|
-
const renderGFM = () => {};
|
|
8
11
|
|
|
9
12
|
const generateProps = ({ messages = [], showDelimiter = defaultValue('showDelimiter') } = {}) => ({
|
|
10
13
|
messages,
|
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js
CHANGED
|
@@ -109,8 +109,9 @@ describe('DuoChatMessage', () => {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
describe('message output', () => {
|
|
112
|
-
it('hydrates the message with GLFM when mounting the component', () => {
|
|
112
|
+
it('hydrates the message with GLFM when mounting the component', async () => {
|
|
113
113
|
createComponent();
|
|
114
|
+
await nextTick();
|
|
114
115
|
expect(renderGFM).toHaveBeenCalled();
|
|
115
116
|
});
|
|
116
117
|
|
|
@@ -327,6 +328,7 @@ describe('DuoChatMessage', () => {
|
|
|
327
328
|
message: chunk1,
|
|
328
329
|
},
|
|
329
330
|
});
|
|
331
|
+
await nextTick();
|
|
330
332
|
renderGFM.mockClear();
|
|
331
333
|
expect(renderGFM).not.toHaveBeenCalled();
|
|
332
334
|
|
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.stories.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MOCK_RESPONSE_MESSAGE,
|
|
3
|
+
MOCK_USER_PROMPT_MESSAGE,
|
|
4
|
+
renderGFM,
|
|
5
|
+
renderMarkdown,
|
|
6
|
+
} from '../../mock_data';
|
|
2
7
|
import GlDuoChatMessage from './duo_chat_message.vue';
|
|
3
8
|
import readme from './duo_chat_message.md';
|
|
4
9
|
|
|
5
|
-
const renderMarkdown = (content) => content;
|
|
6
|
-
const renderGFM = () => {};
|
|
7
|
-
|
|
8
10
|
const generateProps = ({ message = MOCK_RESPONSE_MESSAGE } = {}) => ({
|
|
9
11
|
message,
|
|
10
12
|
});
|
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>
|
|
2
|
+
import { nextTick } from 'vue';
|
|
2
3
|
import GlDuoUserFeedback from '../../../user_feedback/user_feedback.vue';
|
|
3
4
|
import { SafeHtmlDirective as SafeHtml } from '../../../../../../directives/safe_html/safe_html';
|
|
4
5
|
import { MESSAGE_MODEL_ROLES } from '../../constants';
|
|
@@ -60,7 +61,7 @@ export default {
|
|
|
60
61
|
if (!chunkId) {
|
|
61
62
|
this.messageChunks = [];
|
|
62
63
|
this.messageContent = this.content;
|
|
63
|
-
this.
|
|
64
|
+
this.hydrateContentWithGFM();
|
|
64
65
|
} else {
|
|
65
66
|
this.messageChunks[chunkId] = content;
|
|
66
67
|
this.messageContent = this.renderMarkdown(concatIndicesUntilEmpty(this.messageChunks));
|
|
@@ -81,7 +82,13 @@ export default {
|
|
|
81
82
|
if (this.message.chunkId) {
|
|
82
83
|
this.messageChunks[this.message.chunkId] = this.message.content;
|
|
83
84
|
}
|
|
84
|
-
this.
|
|
85
|
+
this.hydrateContentWithGFM();
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
async hydrateContentWithGFM() {
|
|
89
|
+
await nextTick();
|
|
90
|
+
this.renderGFM(this.$refs.content);
|
|
91
|
+
},
|
|
85
92
|
},
|
|
86
93
|
};
|
|
87
94
|
</script>
|
|
@@ -8,11 +8,10 @@ import {
|
|
|
8
8
|
MOCK_RESPONSE_MESSAGE,
|
|
9
9
|
MOCK_USER_PROMPT_MESSAGE,
|
|
10
10
|
generateMockResponseChunks,
|
|
11
|
+
renderGFM,
|
|
12
|
+
renderMarkdown,
|
|
11
13
|
} from './mock_data';
|
|
12
14
|
|
|
13
|
-
const renderMarkdown = (content) => content;
|
|
14
|
-
const renderGFM = () => {};
|
|
15
|
-
|
|
16
15
|
const defaultValue = (prop) =>
|
|
17
16
|
typeof GlDuoChat.props[prop].default === 'function'
|
|
18
17
|
? GlDuoChat.props[prop].default()
|
|
@@ -94,3 +94,11 @@ export const MOCK_USER_PROMPT_MESSAGE = {
|
|
|
94
94
|
timestamp: '2021-04-21T12:00:00.000Z',
|
|
95
95
|
extras: null,
|
|
96
96
|
};
|
|
97
|
+
|
|
98
|
+
export const renderMarkdown = (content) => content;
|
|
99
|
+
export const renderGFM = (el) => {
|
|
100
|
+
const codeBlock = el.querySelectorAll('.markdown-code-block');
|
|
101
|
+
codeBlock.forEach((block) => {
|
|
102
|
+
block?.classList.add('gl-bg-purple-50', 'gl-p-3', 'gl-mb-3');
|
|
103
|
+
});
|
|
104
|
+
};
|