@gitlab/ui 104.2.0 → 105.0.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/CHANGELOG.md +13 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +0 -5
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/package.json +1 -3
- package/src/index.js +0 -5
- package/src/scss/components.scss +0 -3
- package/translations.js +0 -57
- package/dist/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.js +0 -159
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.js +0 -273
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.js +0 -77
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.js +0 -89
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.js +0 -147
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.js +0 -61
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.js +0 -137
- package/dist/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.js +0 -163
- package/dist/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -308
- package/dist/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -140
- package/dist/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.js +0 -109
- package/dist/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.js +0 -111
- package/dist/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -33
- package/dist/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -14
- package/dist/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +0 -300
- package/dist/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -56
- package/dist/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -17
- package/dist/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.js +0 -115
- package/dist/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.js +0 -72
- package/dist/components/experimental/duo/chat/constants.js +0 -35
- package/dist/components/experimental/duo/chat/duo_chat.js +0 -553
- package/dist/components/experimental/duo/chat/markdown_renderer.js +0 -25
- package/dist/components/experimental/duo/chat/mock_data.js +0 -170
- package/dist/components/experimental/duo/user_feedback/user_feedback.js +0 -106
- package/dist/components/experimental/duo/user_feedback/user_feedback_modal.js +0 -154
- package/dist/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.js +0 -106
- package/dist/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.js +0 -246
- package/src/components/experimental/duo/chat/components/duo_chat_context/constants.js +0 -21
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_details_modal/duo_chat_context_item_details_modal.vue +0 -182
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.md +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu.vue +0 -288
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_category_items.vue +0 -54
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_item.vue +0 -86
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items.vue +0 -168
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_menu/duo_chat_context_item_menu_search_items_loading.vue +0 -43
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_popover/duo_chat_context_item_popover.vue +0 -170
- package/src/components/experimental/duo/chat/components/duo_chat_context/duo_chat_context_item_selections/duo_chat_context_item_selections.vue +0 -196
- package/src/components/experimental/duo/chat/components/duo_chat_context/mock_context_data.js +0 -362
- package/src/components/experimental/duo/chat/components/duo_chat_context/utils.js +0 -169
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.md +0 -27
- package/src/components/experimental/duo/chat/components/duo_chat_conversation/duo_chat_conversation.vue +0 -99
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss +0 -44
- package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.vue +0 -112
- package/src/components/experimental/duo/chat/components/duo_chat_message/buttons_utils.js +0 -39
- package/src/components/experimental/duo/chat/components/duo_chat_message/constants.js +0 -12
- package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js +0 -24
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.md +0 -69
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +0 -105
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +0 -363
- package/src/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +0 -51
- package/src/components/experimental/duo/chat/components/duo_chat_message/utils.js +0 -18
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_message_sources/duo_chat_message_sources.vue +0 -91
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.md +0 -10
- package/src/components/experimental/duo/chat/components/duo_chat_predefined_prompts/duo_chat_predefined_prompts.vue +0 -45
- package/src/components/experimental/duo/chat/constants.js +0 -37
- package/src/components/experimental/duo/chat/duo_chat.md +0 -202
- package/src/components/experimental/duo/chat/duo_chat.scss +0 -413
- package/src/components/experimental/duo/chat/duo_chat.vue +0 -751
- package/src/components/experimental/duo/chat/markdown_renderer.js +0 -29
- package/src/components/experimental/duo/chat/mock_data.js +0 -187
- package/src/components/experimental/duo/chat/variables.scss +0 -9
- package/src/components/experimental/duo/user_feedback/user_feedback.md +0 -90
- package/src/components/experimental/duo/user_feedback/user_feedback.vue +0 -95
- package/src/components/experimental/duo/user_feedback/user_feedback_modal.vue +0 -167
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.md +0 -42
- package/src/components/experimental/duo/workflow/components/duo_workflow_panel/duo_workflow_panel.vue +0 -96
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.md +0 -46
- package/src/components/experimental/duo/workflow/components/duo_workflow_prompt/duo_workflow_prompt.vue +0 -270
package/src/components/experimental/duo/chat/components/duo_chat_loader/duo_chat_loader.scss
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
.duo-chat-loader {
|
|
11
|
-
@apply gl-flex;
|
|
12
|
-
@apply gl-text-gray-500;
|
|
13
|
-
|
|
14
|
-
.transition {
|
|
15
|
-
@include gl-prefers-reduced-motion-transition;
|
|
16
|
-
transition: width 200ms $gl-easing-out-cubic;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.text-enter {
|
|
20
|
-
@apply gl-opacity-0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.text-enter-active {
|
|
24
|
-
@include gl-prefers-reduced-motion-transition;
|
|
25
|
-
transition: opacity 400ms $gl-easing-out-cubic; // we intentionally overlap this transition with .text-leave-active by 200ms
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.text-enter-to {
|
|
29
|
-
@apply gl-opacity-10;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.text-leave {
|
|
33
|
-
@apply gl-opacity-10;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.text-leave-active {
|
|
37
|
-
@include gl-prefers-reduced-motion-transition;
|
|
38
|
-
transition: opacity 200ms $gl-easing-out-cubic;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.text-leave-to {
|
|
42
|
-
@apply gl-opacity-0;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
/**
|
|
3
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
4
|
-
*
|
|
5
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
6
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
7
|
-
*
|
|
8
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { translate } from '../../../../../../utils/i18n';
|
|
12
|
-
import GlSprintf from '../../../../../utilities/sprintf/sprintf.vue';
|
|
13
|
-
import GlAnimatedLoaderIcon from '../../../../../base/animated_icon/animated_loader_icon.vue';
|
|
14
|
-
import { LOADING_TRANSITION_DURATION } from '../../constants';
|
|
15
|
-
|
|
16
|
-
export const i18n = {
|
|
17
|
-
LOADER_LOADING_MESSAGE: translate(
|
|
18
|
-
'GlDuoChatLoader.loaderLoadingMessage',
|
|
19
|
-
'%{tool} is %{transition} an answer'
|
|
20
|
-
),
|
|
21
|
-
LOADER_LOADING_TRANSITIONS: [
|
|
22
|
-
translate('GlDuoChatLoader.loaderLoadingTransitionsFinding', 'finding'),
|
|
23
|
-
translate('GlDuoChatLoader.loaderLoadingTransitionsWorkingOn', 'working on'),
|
|
24
|
-
translate('GlDuoChatLoader.loaderLoadingTransitionsGenerating', 'generating'),
|
|
25
|
-
translate('GlDuoChatLoader.loaderLoadingTransitionsProducing', 'producing'),
|
|
26
|
-
],
|
|
27
|
-
GITLAB_DUO: translate('GlDuoChatLoader.gitlabDuo', 'GitLab Duo'),
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default {
|
|
31
|
-
name: 'GlDuoChatLoader',
|
|
32
|
-
components: {
|
|
33
|
-
GlSprintf,
|
|
34
|
-
GlAnimatedLoaderIcon,
|
|
35
|
-
},
|
|
36
|
-
i18n,
|
|
37
|
-
props: {
|
|
38
|
-
/**
|
|
39
|
-
* The message containing the name of the current AI tool working on the answer.
|
|
40
|
-
*/
|
|
41
|
-
toolName: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: false,
|
|
44
|
-
default: i18n.GITLAB_DUO,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
data() {
|
|
48
|
-
return {
|
|
49
|
-
loadingSequence: 0,
|
|
50
|
-
timeout: null,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
beforeDestroy() {
|
|
54
|
-
clearTimeout(this.timeout);
|
|
55
|
-
},
|
|
56
|
-
mounted() {
|
|
57
|
-
this.computeTransitionWidth();
|
|
58
|
-
this.enter();
|
|
59
|
-
},
|
|
60
|
-
methods: {
|
|
61
|
-
computeTransitionWidth() {
|
|
62
|
-
const container = this.$refs.transition;
|
|
63
|
-
const active = this.$refs.currentTransition[0]; // There's only one `currentTransition` ref at a time, but refs in v-for loops are always Arrays
|
|
64
|
-
const { width, height } = active.getBoundingClientRect();
|
|
65
|
-
container.$el.style.width = `${width}px`;
|
|
66
|
-
container.$el.style.height = `${height}px`;
|
|
67
|
-
},
|
|
68
|
-
enter() {
|
|
69
|
-
clearTimeout(this.timeout);
|
|
70
|
-
this.timeout = setTimeout(() => {
|
|
71
|
-
this.loadingSequence =
|
|
72
|
-
(this.loadingSequence + 1) % this.$options.i18n.LOADER_LOADING_TRANSITIONS.length;
|
|
73
|
-
this.enter();
|
|
74
|
-
}, LOADING_TRANSITION_DURATION);
|
|
75
|
-
},
|
|
76
|
-
isCurrentTransition(index) {
|
|
77
|
-
return index === this.loadingSequence;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
</script>
|
|
82
|
-
|
|
83
|
-
<template>
|
|
84
|
-
<div class="duo-chat-loader gl-mt-5 gl-flex gl-items-center gl-gap-3">
|
|
85
|
-
<gl-animated-loader-icon :is-on="true" />
|
|
86
|
-
<div>
|
|
87
|
-
<gl-sprintf :message="$options.i18n.LOADER_LOADING_MESSAGE">
|
|
88
|
-
<template #tool>
|
|
89
|
-
<strong data-testid="tool">{{ toolName }}</strong>
|
|
90
|
-
</template>
|
|
91
|
-
<template #transition>
|
|
92
|
-
<transition-group
|
|
93
|
-
ref="transition"
|
|
94
|
-
name="text"
|
|
95
|
-
class="transition gl-relative gl-inline-block gl-align-bottom"
|
|
96
|
-
@after-leave="computeTransitionWidth"
|
|
97
|
-
>
|
|
98
|
-
<span
|
|
99
|
-
v-for="(message, index) in $options.i18n.LOADER_LOADING_TRANSITIONS"
|
|
100
|
-
v-show="isCurrentTransition(index)"
|
|
101
|
-
:ref="isCurrentTransition(index) ? 'currentTransition' : ''"
|
|
102
|
-
:key="message"
|
|
103
|
-
:data-testid="isCurrentTransition(index) ? 'current-transition' : ''"
|
|
104
|
-
class="gl-absolute gl-bottom-0 gl-left-0 gl-whitespace-nowrap"
|
|
105
|
-
>{{ message }}</span
|
|
106
|
-
>
|
|
107
|
-
</transition-group>
|
|
108
|
-
</template>
|
|
109
|
-
</gl-sprintf>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</template>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import iconsPath from '@gitlab/svgs/dist/icons.svg';
|
|
11
|
-
|
|
12
|
-
export const createButton = (title = 'Insert the code snippet', iconId = 'insert') => {
|
|
13
|
-
const button = document.createElement('button');
|
|
14
|
-
button.type = 'button';
|
|
15
|
-
button.classList.add(
|
|
16
|
-
'btn',
|
|
17
|
-
'btn-default',
|
|
18
|
-
'btn-md',
|
|
19
|
-
'gl-button',
|
|
20
|
-
'btn-default-secondary',
|
|
21
|
-
'btn-icon'
|
|
22
|
-
);
|
|
23
|
-
button.dataset.title = title;
|
|
24
|
-
|
|
25
|
-
// Create an SVG element with the correct namespace
|
|
26
|
-
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
27
|
-
svg.setAttribute('role', 'img');
|
|
28
|
-
svg.setAttribute('aria-hidden', 'true');
|
|
29
|
-
svg.classList.add('gl-button-icon', 'gl-icon', 's16');
|
|
30
|
-
|
|
31
|
-
// Create a 'use' element with the correct namespace
|
|
32
|
-
const use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
|
|
33
|
-
use.setAttribute('href', `${iconsPath}#${iconId}`);
|
|
34
|
-
|
|
35
|
-
svg.appendChild(use);
|
|
36
|
-
button.appendChild(svg);
|
|
37
|
-
|
|
38
|
-
return button;
|
|
39
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export const DUO_CODE_SCRIM_TOP_CLASS = 'scrim-top';
|
|
11
|
-
export const DUO_CODE_SCRIM_BOTTOM_CLASS = 'scrim-bottom';
|
|
12
|
-
export const DUO_CODE_SCRIM_OFFSET = 16;
|
package/src/components/experimental/duo/chat/components/duo_chat_message/copy_code_element.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { createButton } from './buttons_utils';
|
|
11
|
-
|
|
12
|
-
export class CopyCodeElement extends HTMLElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
const btn = createButton('Copy to clipboard', 'copy-to-clipboard');
|
|
16
|
-
const wrapper = this.parentNode;
|
|
17
|
-
|
|
18
|
-
this.appendChild(btn);
|
|
19
|
-
btn.addEventListener('click', async () => {
|
|
20
|
-
const textToCopy = wrapper.innerText;
|
|
21
|
-
await navigator.clipboard.writeText(textToCopy);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.md
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
The component represents a Duo Chat message.
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
```html
|
|
6
|
-
<gl-duo-chat-message :message="message" />
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Pretty rendering message content
|
|
10
|
-
|
|
11
|
-
There are two ways of pretty-rendering a message's content in the component:
|
|
12
|
-
|
|
13
|
-
- dependency injection, providing functions to convert raw markdown into HTML,
|
|
14
|
-
- sending `contentHtml` prop as part of the `message` property
|
|
15
|
-
|
|
16
|
-
The component ships a default markdown renderer based on `marked`. It should produce
|
|
17
|
-
reasonably well-looking results while streaming messages. The implementation can be found
|
|
18
|
-
[here](https://gitlab.com/gitlab-org/gitlab-ui/-/blob/main/src/components/experimental/duo/chat/markdown_renderer.js).
|
|
19
|
-
|
|
20
|
-
### Injecting functions
|
|
21
|
-
|
|
22
|
-
To inject the `renderMarkdown` function, which converts raw markdown into proper HTML,
|
|
23
|
-
the component relies on [dependency injection, using `provide`/`inject` options](https://docs.gitlab.com/ee/development/fe_guide/vue.html#provide-and-inject).
|
|
24
|
-
The component expects a reference to a function, converting raw markdown into HTML
|
|
25
|
-
to be _provided_ by a consumer.
|
|
26
|
-
[The example implementation](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/notes/utils.js#L22-24)
|
|
27
|
-
|
|
28
|
-
### `contentHtml`
|
|
29
|
-
|
|
30
|
-
This approach is self-explanatory and is used when raw markdown can be converted to HTML on the server
|
|
31
|
-
before the message is returned to the client. Here's an example of a message's structure where markdown
|
|
32
|
-
has been generated on the server and sent down in the `contentHtml` property:
|
|
33
|
-
|
|
34
|
-
```javascript
|
|
35
|
-
{
|
|
36
|
-
content: '_Duo Chat message_ coming from AI',
|
|
37
|
-
contentHtml: '<p><em>Duo Chat message</em> coming from AI</p>',
|
|
38
|
-
role: 'assistant',
|
|
39
|
-
...
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## GitLab Flavored Markdown (GLFM)
|
|
44
|
-
|
|
45
|
-
In most cases, it's not enough to just convert raw markdown into HTML. Messages also require the
|
|
46
|
-
markup to support [GitLab Flavored Markdown (GLFM)](https://docs.gitlab.com/ee/user/markdown.html).
|
|
47
|
-
For this, the component relies on another dependency injection (in addition to `renderMarkdown`)
|
|
48
|
-
expecting a reference to the `renderGFM` function, decorating an HTML element with GLFM to be
|
|
49
|
-
_provided_ by a consumer.
|
|
50
|
-
[The example implementation](https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/assets/javascripts/behaviors/markdown/render_gfm.js#L19-52)
|
|
51
|
-
|
|
52
|
-
## The underlying use of the `GlDuoUserFeedback` component
|
|
53
|
-
|
|
54
|
-
The component integrates the [`GlDuoUserFeedback`](/story/experimental-duo-user-feedback--default)
|
|
55
|
-
component to track user feedback on the AI-generated responses. Note that the `GlDuoChatMessage`
|
|
56
|
-
component renders the default state of `GlDuoUserFeedback` component, not allowing to override
|
|
57
|
-
the slots in that underlying component.
|
|
58
|
-
|
|
59
|
-
### Tracking User Feedback for a response
|
|
60
|
-
|
|
61
|
-
The component emits the `track-feedback` event, a proxy of the `feedback` event emitted by
|
|
62
|
-
the `GlDuoUserFeedback` component. Please refer to
|
|
63
|
-
[the documentation on that component](/story/experimental-duo-user-feedback--docs#listening-to-the-feedback-form-submission)
|
|
64
|
-
when processing feedback from users.
|
|
65
|
-
|
|
66
|
-
## Included context references
|
|
67
|
-
|
|
68
|
-
Messages will display any included context references (files, issues merge requests etc.) when
|
|
69
|
-
the message `meta.contextItems` array contains valid items.
|
package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This component has been migrated to the Duo-UI library (https://gitlab.com/gitlab-org/duo-ui).
|
|
3
|
-
*
|
|
4
|
-
* Please use the corresponding component in Duo-UI going forward.
|
|
5
|
-
* All future development and maintenance for Duo components should take place in Duo-UI.
|
|
6
|
-
*
|
|
7
|
-
* For more details, see the migration epic: https://gitlab.com/groups/gitlab-org/-/epics/15344 or reach out to the Duo-Chat team in #g_duo_chat.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
@import '../../variables';
|
|
11
|
-
|
|
12
|
-
.duo-chat-message {
|
|
13
|
-
max-width: 90%;
|
|
14
|
-
position: relative;
|
|
15
|
-
border-radius: px-to-rem(20px);
|
|
16
|
-
|
|
17
|
-
&:not(:last-child) {
|
|
18
|
-
@apply gl-mb-4;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
code {
|
|
22
|
-
@apply gl-bg-gray-100;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
pre {
|
|
26
|
-
box-shadow: none !important;
|
|
27
|
-
@apply gl-border gl-max-h-[60vh] gl-px-4 gl-py-3 gl-text-inherit;
|
|
28
|
-
|
|
29
|
-
&::before,
|
|
30
|
-
&::after {
|
|
31
|
-
content: '';
|
|
32
|
-
left: $gl-border-size-1;
|
|
33
|
-
width: calc(100% - calc(2 * $gl-border-size-1));
|
|
34
|
-
position: absolute;
|
|
35
|
-
@apply gl-pointer-events-none gl-h-7 gl-rounded-b-base;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&.scrim-top {
|
|
39
|
-
&::before {
|
|
40
|
-
background: $duo-chat-scrim-gradient;
|
|
41
|
-
top: $gl-border-size-1;
|
|
42
|
-
@apply -gl-rotate-180;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
&.scrim-bottom {
|
|
47
|
-
&::after {
|
|
48
|
-
background: $duo-chat-scrim-gradient;
|
|
49
|
-
bottom: $gl-border-size-1;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
pre code {
|
|
55
|
-
@apply gl-text-sm;
|
|
56
|
-
@apply gl-leading-1;
|
|
57
|
-
@apply gl-bg-transparent;
|
|
58
|
-
white-space: inherit;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
p:last-of-type {
|
|
62
|
-
@apply gl-mb-0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
copy-code,
|
|
66
|
-
insert-code-snippet {
|
|
67
|
-
position: absolute;
|
|
68
|
-
@apply gl-transition-all;
|
|
69
|
-
@apply gl-opacity-0;
|
|
70
|
-
right: $gl-spacing-scale-3;
|
|
71
|
-
top: $gl-spacing-scale-3;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
copy-code {
|
|
75
|
-
margin-right: $gl-spacing-scale-8;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.js-markdown-code.markdown-code-block:hover {
|
|
79
|
-
copy-code,
|
|
80
|
-
copy-code:focus-within,
|
|
81
|
-
insert-code-snippet,
|
|
82
|
-
insert-code-snippet:focus-within {
|
|
83
|
-
@apply gl-opacity-10;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.has-error {
|
|
88
|
-
margin-left: $gl-spacing-scale-6;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.error-icon {
|
|
92
|
-
top: 14px;
|
|
93
|
-
position: absolute;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.insert-code-hidden {
|
|
98
|
-
insert-code-snippet {
|
|
99
|
-
display: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
copy-code {
|
|
103
|
-
margin-right: 0;
|
|
104
|
-
}
|
|
105
|
-
}
|