@gitlab/ui 91.7.0 → 91.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.
- package/CHANGELOG.md +14 -0
- package/dist/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +43 -7
- package/dist/components/experimental/duo/chat/duo_chat.js +4 -0
- package/dist/components/experimental/duo/chat/mock_data.js +0 -2
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +3 -1
- package/dist/tokens/build/js/tokens.js +3 -1
- package/dist/tokens/css/tokens.css +2 -0
- package/dist/tokens/css/tokens.dark.css +2 -0
- package/dist/tokens/js/tokens.dark.js +2 -0
- package/dist/tokens/js/tokens.js +2 -0
- package/dist/tokens/json/tokens.dark.json +52 -0
- package/dist/tokens/json/tokens.json +52 -0
- package/dist/tokens/scss/_tokens.dark.scss +2 -0
- package/dist/tokens/scss/_tokens.scss +2 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +2 -0
- package/package.json +1 -1
- package/src/components/base/link/link.scss +2 -7
- package/src/components/experimental/duo/chat/components/duo_chat_message/insert_code_snippet_element.js +35 -10
- package/src/components/experimental/duo/chat/duo_chat.vue +4 -0
- package/src/components/experimental/duo/chat/mock_data.js +0 -2
- package/src/tokens/build/css/tokens.css +2 -0
- package/src/tokens/build/css/tokens.dark.css +2 -0
- package/src/tokens/build/js/tokens.dark.js +2 -0
- package/src/tokens/build/js/tokens.js +2 -0
- package/src/tokens/build/json/tokens.dark.json +52 -0
- package/src/tokens/build/json/tokens.json +52 -0
- package/src/tokens/build/scss/_tokens.dark.scss +2 -0
- package/src/tokens/build/scss/_tokens.scss +2 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +2 -0
- package/src/tokens/contextual/link.tokens.json +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [91.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.8.0...v91.9.0) (2024-09-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **GlDuoChat:** make insert code snippet work with server-generated elements ([ce66a88](https://gitlab.com/gitlab-org/gitlab-ui/commit/ce66a88f7a477d5120c70633850106e8a8c1200e))
|
|
7
|
+
|
|
8
|
+
# [91.8.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.7.0...v91.8.0) (2024-09-04)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **GlLink:** Add and update tokens ([df90a00](https://gitlab.com/gitlab-org/gitlab-ui/commit/df90a0020dabcb05357dc0a65f468ef77c5575cd))
|
|
14
|
+
|
|
1
15
|
# [91.7.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v91.6.0...v91.7.0) (2024-09-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,19 +1,55 @@
|
|
|
1
1
|
import { createButton } from './buttons_utils';
|
|
2
2
|
|
|
3
|
+
function _assertClassBrand(e, t, n) {
|
|
4
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
5
|
+
throw new TypeError("Private element is not present on this object");
|
|
6
|
+
}
|
|
7
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
8
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
9
|
+
}
|
|
10
|
+
function _classPrivateFieldGet2(s, a) {
|
|
11
|
+
return s.get(_assertClassBrand(s, a));
|
|
12
|
+
}
|
|
13
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
14
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
15
|
+
}
|
|
16
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
17
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const CODE_MARKDOWN_CLASS = 'js-markdown-code';
|
|
21
|
+
var _actionButton = /*#__PURE__*/new WeakMap();
|
|
22
|
+
var _codeBlock = /*#__PURE__*/new WeakMap();
|
|
23
|
+
var _handleClick = /*#__PURE__*/new WeakMap();
|
|
3
24
|
class InsertCodeSnippetElement extends HTMLElement {
|
|
4
25
|
constructor(codeBlock) {
|
|
5
26
|
super();
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
wrapper.dispatchEvent(new CustomEvent('insert-code-snippet', {
|
|
27
|
+
_classPrivateFieldInitSpec(this, _actionButton, void 0);
|
|
28
|
+
_classPrivateFieldInitSpec(this, _codeBlock, void 0);
|
|
29
|
+
_classPrivateFieldInitSpec(this, _handleClick, () => {
|
|
30
|
+
if (_classPrivateFieldGet2(_codeBlock, this)) {
|
|
31
|
+
_classPrivateFieldGet2(_codeBlock, this).dispatchEvent(new CustomEvent('insert-code-snippet', {
|
|
12
32
|
bubbles: true,
|
|
13
|
-
cancelable: true
|
|
33
|
+
cancelable: true,
|
|
34
|
+
detail: {
|
|
35
|
+
code: _classPrivateFieldGet2(_codeBlock, this).textContent.trim()
|
|
36
|
+
}
|
|
14
37
|
}));
|
|
15
38
|
}
|
|
16
39
|
});
|
|
40
|
+
_classPrivateFieldSet2(_actionButton, this, createButton());
|
|
41
|
+
|
|
42
|
+
// we handle two possible cases here:
|
|
43
|
+
// 1. we use constructor parameter if the element is created in Javscript and inserted in the document
|
|
44
|
+
// 2. we find the wrapping element containing code if the element is received from the server
|
|
45
|
+
_classPrivateFieldSet2(_codeBlock, this, codeBlock !== null && codeBlock !== void 0 ? codeBlock : this.closest(`.${CODE_MARKDOWN_CLASS}`));
|
|
46
|
+
}
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
this.appendChild(_classPrivateFieldGet2(_actionButton, this));
|
|
49
|
+
_classPrivateFieldGet2(_actionButton, this).addEventListener('click', _classPrivateFieldGet2(_handleClick, this));
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
_classPrivateFieldGet2(_actionButton, this).removeEventListener('click', _classPrivateFieldGet2(_handleClick, this));
|
|
17
53
|
}
|
|
18
54
|
}
|
|
19
55
|
|
|
@@ -419,6 +419,10 @@ var script = {
|
|
|
419
419
|
}
|
|
420
420
|
},
|
|
421
421
|
onInsertCodeSnippet(e) {
|
|
422
|
+
/**
|
|
423
|
+
* Emit insert-code-snippet event that clients can use to interact with a suggested code.
|
|
424
|
+
* @param {*} event An event containing code string in the "detail.code" field.
|
|
425
|
+
*/
|
|
422
426
|
this.$emit('insert-code-snippet', e);
|
|
423
427
|
}
|
|
424
428
|
},
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { setStoryTimeout } from '../../../../utils/test_utils';
|
|
2
|
-
import { InsertCodeSnippetElement } from './components/duo_chat_message/insert_code_snippet_element';
|
|
3
2
|
import { DOCUMENTATION_SOURCE_TYPES, MESSAGE_MODEL_ROLES, CHAT_RESET_MESSAGE, CHAT_CLEAN_MESSAGE } from './constants';
|
|
4
3
|
import { getMockContextItems } from './components/duo_chat_context/mock_context_data';
|
|
5
4
|
|
|
@@ -135,7 +134,6 @@ const renderGFM = el => {
|
|
|
135
134
|
const codeBlock = el.querySelectorAll('.markdown-code-block');
|
|
136
135
|
codeBlock.forEach(block => {
|
|
137
136
|
block === null || block === void 0 ? void 0 : block.classList.add('gl-markdown', 'gl-compact-markdown');
|
|
138
|
-
block === null || block === void 0 ? void 0 : block.appendChild(new InsertCodeSnippetElement(block));
|
|
139
137
|
});
|
|
140
138
|
};
|
|
141
139
|
const SLASH_COMMANDS = [{
|