@gitlab/ui 66.36.0 → 66.37.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ * Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ * Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ * Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#fff";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ * Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
  */
5
5
 
6
6
  export const BLACK = "#000";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ // Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 24 Oct 2023 13:47:52 GMT
3
+ // Generated on Wed, 25 Oct 2023 09:55:57 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "66.36.0",
3
+ "version": "66.37.0",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,7 @@
1
1
  <script>
2
2
  import isEqual from 'lodash/isEqual';
3
3
  import cloneDeep from 'lodash/cloneDeep';
4
- import PortalVue from 'portal-vue';
5
- import Vue from 'vue';
4
+ import { PortalTarget } from 'portal-vue';
6
5
  import { GlTooltipDirective } from '../../../directives/tooltip';
7
6
  import GlIcon from '../icon/icon.vue';
8
7
  import GlSearchBoxByClick from '../search_box_by_click/search_box_by_click.vue';
@@ -18,8 +17,6 @@ import {
18
17
  termTokenDefinition,
19
18
  } from './filtered_search_utils';
20
19
 
21
- Vue.use(PortalVue);
22
-
23
20
  let portalUuid = 0;
24
21
 
25
22
  function initialState() {
@@ -31,6 +28,7 @@ export default {
31
28
  components: {
32
29
  GlSearchBoxByClick,
33
30
  GlIcon,
31
+ PortalTarget,
34
32
  },
35
33
  directives: { GlTooltip: GlTooltipDirective },
36
34
  provide() {
@@ -90,7 +90,7 @@
90
90
  }
91
91
  }
92
92
 
93
- .gl-button .gl-new-dropdown-chevron {
93
+ .gl-button .gl-button-icon.gl-new-dropdown-chevron {
94
94
  @include gl-ml-2;
95
95
  @include gl-mr-0;
96
96
  }
@@ -15,6 +15,7 @@ describe('DuoChatMessage', () => {
15
15
  const findContent = () => wrapper.findComponent({ ref: 'content' });
16
16
  const findDocumentSources = () => wrapper.findComponent(DocumentationSources);
17
17
  const findUserFeedback = () => wrapper.findComponent(GlDuoUserFeedback);
18
+ const findCopyCodeButton = () => wrapper.find('copy-code');
18
19
  const mockMarkdownContent = 'foo **bar**';
19
20
 
20
21
  let renderMarkdown;
@@ -106,6 +107,10 @@ describe('DuoChatMessage', () => {
106
107
  findUserFeedback().vm.$emit('feedback', 'foo');
107
108
  expect(wrapper.emitted('track-feedback')).toEqual([['foo']]);
108
109
  });
110
+
111
+ it('does not strip out the <copy-code/> element from HTML output', () => {
112
+ expect(findCopyCodeButton().exists()).toBe(true);
113
+ });
109
114
  });
110
115
 
111
116
  describe('message output', () => {
@@ -15,6 +15,9 @@ const concatIndicesUntilEmpty = (arr) => {
15
15
 
16
16
  export default {
17
17
  name: 'GlDuoChatMessage',
18
+ safeHtmlConfigExtension: {
19
+ ADD_TAGS: ['copy-code'],
20
+ },
18
21
  components: {
19
22
  DocumentationSources,
20
23
  GlDuoUserFeedback,
@@ -102,7 +105,7 @@ export default {
102
105
  isAssistantMessage,
103
106
  }"
104
107
  >
105
- <div ref="content" v-safe-html="messageContent"></div>
108
+ <div ref="content" v-safe-html:[$options.safeHtmlConfigExtension]="messageContent"></div>
106
109
 
107
110
  <template v-if="isAssistantMessage">
108
111
  <documentation-sources v-if="sources" :sources="sources" />
@@ -23,9 +23,9 @@ const MOCK_SOURCES = [
23
23
  export const MOCK_RESPONSE_MESSAGE = {
24
24
  id: '123',
25
25
  content:
26
- 'To create a new template:\n\n1. Create a new Markdown (`.md`) file inside the `.gitlab/issue_templates/` or `.gitlab/merge_request_templates/` directory in your repository.\n2. Commit the template file to your default branch.\n\nTo check if this has worked correctly, create a new issue or merge request and see if you can find your template in the **Choose a template** dropdown list.',
26
+ 'Here is a simple JavaScript function to sum two numbers:\n\n ```js\n function sum(a, b) {\n return a + b;\n }\n ```\n \n To use it:\n \n ```js\n const result = sum(5, 3); // result = 8\n ```\n \n This function takes two number parameters, a and b. It returns the sum of adding them together.\n',
27
27
  contentHtml:
28
- '\u003cp data-sourcepos="1:1-1:25" dir="auto"\u003eTo create a new template:\u003c/p\u003e\n\u003col data-sourcepos="3:1-5:0" dir="auto"\u003e\n\u003cli data-sourcepos="3:1-3:143"\u003eCreate a new Markdown (\u003ccode\u003e.md\u003c/code\u003e) file inside the \u003ccode\u003e.gitlab/issue_templates/\u003c/code\u003e or \u003ccode\u003e.gitlab/merge_request_templates/\u003c/code\u003e directory in your repository.\u003c/li\u003e\n\u003cli data-sourcepos="4:1-5:0"\u003eCommit the template file to your default branch.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cp data-sourcepos="6:1-6:156" dir="auto"\u003eTo check if this has worked correctly, create a new issue or merge request and see if you can find your template in the \u003cstrong\u003eChoose a template\u003c/strong\u003e dropdown list.\u003c/p\u003e',
28
+ '<p data-sourcepos="1:1-1:56" dir="auto">Here is a simple JavaScript function to sum two numbers:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="3:1-7:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">function</span> <span class="nf">sum</span><span class="p">(</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">)</span> <span class="p">{</span></span>\n<span id="LC2" class="line" lang="javascript"> <span class="k">return</span> <span class="nx">a</span> <span class="o">+</span> <span class="nx">b</span><span class="p">;</span></span>\n<span id="LC3" class="line" lang="javascript"><span class="p">}</span></span></code></pre>\n<copy-code></copy-code>\n</div>\n<p data-sourcepos="9:1-9:10" dir="auto">To use it:</p>\n<div class="gl-relative markdown-code-block js-markdown-code">\n<pre data-sourcepos="11:1-13:3" data-canonical-lang="js" class="code highlight js-syntax-highlight language-javascript" lang="javascript" v-pre="true"><code><span id="LC1" class="line" lang="javascript"><span class="kd">const</span> <span class="nx">result</span> <span class="o">=</span> <span class="nf">sum</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span> <span class="c1">// result = 8</span></span></code></pre>\n<copy-code></copy-code>\n</div>\n<p data-sourcepos="15:1-15:95" dir="auto">This function takes two number parameters, a and b. It returns the sum of adding them together.</p>',
29
29
  role: MESSAGE_MODEL_ROLES.assistant,
30
30
  extras: {
31
31
  sources: MOCK_SOURCES,
@@ -99,6 +99,6 @@ export const renderMarkdown = (content) => content;
99
99
  export const renderGFM = (el) => {
100
100
  const codeBlock = el.querySelectorAll('.markdown-code-block');
101
101
  codeBlock.forEach((block) => {
102
- block?.classList.add('gl-bg-purple-50', 'gl-p-3', 'gl-mb-3');
102
+ block?.classList.add('gl-markdown', 'gl-compact-markdown');
103
103
  });
104
104
  };