@gitlab/ui 71.11.1 → 72.1.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 CHANGED
@@ -1,3 +1,32 @@
1
+ # [72.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v72.0.0...v72.1.0) (2023-12-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * **css:** Add gl-align-self-baseline utility class ([7291f50](https://gitlab.com/gitlab-org/gitlab-ui/commit/7291f50cac7a4f9a2ca5e43390fad6896906022a))
7
+ * **CSS:** add `gl-h-10` utility CSS class ([75c253a](https://gitlab.com/gitlab-org/gitlab-ui/commit/75c253abc389a126e9ffa37ec4d64a6c87ffc807))
8
+
9
+ # [72.0.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.11.1...v72.0.0) (2023-12-18)
10
+
11
+
12
+ * Merge branch 'force-release' into 'main' ([7df9bbe](https://gitlab.com/gitlab-org/gitlab-ui/commit/7df9bbececf3e79513be7d022269fc84864cc7a2))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Force a release ([090865a](https://gitlab.com/gitlab-org/gitlab-ui/commit/090865a92acbefa8b1891331651bfb27e430e0d8))
18
+
19
+
20
+ ### BREAKING CHANGES
21
+
22
+ * This changes the API the GitLab duo chat component expects
23
+
24
+ See merge request https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/3868
25
+
26
+ Merged-by: Lukas 'Eipi' Eipert <leipert@gitlab.com>
27
+ Approved-by: Lukas 'Eipi' Eipert <leipert@gitlab.com>
28
+ Co-authored-by: Pavel Shutsin <pshutsin@gitlab.com>
29
+
1
30
  ## [71.11.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v71.11.0...v71.11.1) (2023-12-15)
2
31
 
3
32
 
@@ -5,12 +5,11 @@ import DocumentationSources from '../duo_chat_message_sources/duo_chat_message_s
5
5
  import { CopyCodeElement } from './copy_code_element';
6
6
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
7
7
 
8
- const concatIndicesUntilEmpty = arr => {
9
- const start = arr.findIndex(el => el);
10
- if (start === -1 || start !== 1) return ''; // If there are no non-empty elements
11
-
12
- const end = arr.slice(start).findIndex(el => !el);
13
- return end > 0 ? arr.slice(start, end).join('') : arr.slice(start).join('');
8
+ const concatUntilEmpty = arr => {
9
+ if (!arr) return '';
10
+ let end = arr.findIndex(el => !el);
11
+ if (end < 0) end = arr.length;
12
+ return arr.slice(0, end).join('');
14
13
  };
15
14
  var script = {
16
15
  name: 'GlDuoChatMessage',
@@ -34,12 +33,6 @@ var script = {
34
33
  required: true
35
34
  }
36
35
  },
37
- data() {
38
- return {
39
- messageContent: '',
40
- messageWatcher: null
41
- };
42
- },
43
36
  computed: {
44
37
  isAssistantMessage() {
45
38
  return this.message.role.toLowerCase() === MESSAGE_MODEL_ROLES.assistant;
@@ -51,50 +44,29 @@ var script = {
51
44
  var _this$message$extras;
52
45
  return (_this$message$extras = this.message.extras) === null || _this$message$extras === void 0 ? void 0 : _this$message$extras.sources;
53
46
  },
54
- content() {
55
- return this.message.contentHtml || this.renderMarkdown(this.message.content || this.message.errors.join('; '));
47
+ messageContent() {
48
+ if (this.message.errors.length > 0) return this.renderMarkdown(this.message.errors.join('; '));
49
+ if (this.message.contentHtml) {
50
+ return this.message.contentHtml;
51
+ }
52
+ return this.renderMarkdown(this.message.content || concatUntilEmpty(this.message.chunks));
56
53
  }
57
54
  },
58
- created() {
59
- this.messageWatcher = this.$watch('message', this.messageUpdateHandler, {
60
- deep: true
61
- });
62
- },
63
55
  beforeCreate() {
64
- /**
65
- * Keeps cache of previous chunks used for rerendering the AI response when streaming.
66
- * Is intentionally non-reactive
67
- */
68
- this.messageChunks = [];
69
56
  if (!customElements.get('copy-code')) {
70
57
  customElements.define('copy-code', CopyCodeElement);
71
58
  }
72
59
  },
73
60
  mounted() {
74
- this.messageContent = this.content;
75
- if (this.message.chunkId) {
76
- this.messageChunks[this.message.chunkId] = this.message.content;
77
- }
78
- this.hydrateContentWithGFM();
61
+ this.$nextTick(this.hydrateContentWithGFM);
62
+ },
63
+ updated() {
64
+ this.$nextTick(this.hydrateContentWithGFM);
79
65
  },
80
66
  methods: {
81
67
  async hydrateContentWithGFM() {
82
- await this.$nextTick();
83
- this.renderGFM(this.$refs.content);
84
- },
85
- async messageUpdateHandler() {
86
- const {
87
- chunkId,
88
- content
89
- } = this.message;
90
- if (!chunkId) {
91
- this.messageChunks = [];
92
- this.messageContent = this.content;
93
- this.messageWatcher();
94
- this.hydrateContentWithGFM();
95
- } else {
96
- this.messageChunks[chunkId] = content;
97
- this.messageContent = this.renderMarkdown(concatIndicesUntilEmpty(this.messageChunks));
68
+ if (this.message.contentHtml) {
69
+ this.renderGFM(this.$refs.content);
98
70
  }
99
71
  }
100
72
  }
@@ -27,14 +27,6 @@ const MOCK_RESPONSE_MESSAGE = {
27
27
  errors: [],
28
28
  timestamp: '2021-04-21T12:00:00.000Z'
29
29
  };
30
- const MOCK_CHUNK_RESPONSE_MESSAGE = {
31
- chunkId: 1,
32
- content: 'chunk',
33
- role: MESSAGE_MODEL_ROLES.assistant,
34
- requestId: '987',
35
- errors: [],
36
- timestamp: '2021-04-21T12:00:00.000Z'
37
- };
38
30
  const MOCK_RESPONSE_MESSAGE_FOR_STREAMING = {
39
31
  id: '123',
40
32
  content: `To change your password in GitLab:
@@ -88,4 +80,4 @@ const renderGFM = el => {
88
80
  });
89
81
  };
90
82
 
91
- export { MOCK_CHUNK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, generateMockResponseChunks, renderGFM, renderMarkdown };
83
+ export { MOCK_RESPONSE_MESSAGE, MOCK_RESPONSE_MESSAGE_FOR_STREAMING, MOCK_USER_PROMPT_MESSAGE, generateMockResponseChunks, renderGFM, renderMarkdown };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 15 Dec 2023 11:13:48 GMT
3
+ * Generated on Mon, 18 Dec 2023 23:30:47 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 15 Dec 2023 11:13:48 GMT
3
+ * Generated on Mon, 18 Dec 2023 23:30:47 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 Fri, 15 Dec 2023 11:13:48 GMT
3
+ * Generated on Mon, 18 Dec 2023 23:30:47 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Fri, 15 Dec 2023 11:13:48 GMT
3
+ * Generated on Mon, 18 Dec 2023 23:30:47 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Fri, 15 Dec 2023 11:13:48 GMT
3
+ // Generated on Mon, 18 Dec 2023 23:30:47 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 Fri, 15 Dec 2023 11:13:48 GMT
3
+ // Generated on Mon, 18 Dec 2023 23:30:47 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;