@gitlab/ui 108.8.0 → 108.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/utilities/truncate/constants.js +2 -1
- package/dist/components/utilities/truncate/truncate.js +43 -2
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/tailwind.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +4 -4
- package/dist/tokens/build/js/tokens.js +4 -4
- package/dist/tokens/css/tokens.css +8 -8
- package/dist/tokens/css/tokens.dark.css +8 -8
- package/dist/tokens/js/tokens.dark.js +4 -4
- package/dist/tokens/js/tokens.js +4 -4
- package/dist/tokens/json/tokens.dark.json +12 -36
- package/dist/tokens/json/tokens.json +12 -36
- package/dist/tokens/scss/_tokens.dark.scss +8 -8
- package/dist/tokens/scss/_tokens.scss +8 -8
- package/dist/tokens/tailwind/tokens.cjs +8 -8
- package/package.json +2 -2
- package/src/components/utilities/truncate/constants.js +2 -0
- package/src/components/utilities/truncate/truncate.vue +47 -2
- package/src/tokens/build/css/tokens.css +8 -8
- package/src/tokens/build/css/tokens.dark.css +8 -8
- package/src/tokens/build/js/tokens.dark.js +4 -4
- package/src/tokens/build/js/tokens.js +4 -4
- package/src/tokens/build/json/tokens.dark.json +12 -36
- package/src/tokens/build/json/tokens.json +12 -36
- package/src/tokens/build/scss/_tokens.dark.scss +8 -8
- package/src/tokens/build/scss/_tokens.scss +8 -8
- package/src/tokens/build/tailwind/tokens.cjs +8 -8
- package/src/tokens/icon.tokens.json +8 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [108.9.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.8.1...v108.9.0) (2025-02-28)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **DesignTokens:** Update neutral icons ([62316ba](https://gitlab.com/gitlab-org/gitlab-ui/commit/62316ba93ca7eb944119a2ae8143120b26d1b26c))
|
|
7
|
+
|
|
8
|
+
## [108.8.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.8.0...v108.8.1) (2025-02-27)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **GlTruncate:** Prevent total whitespace collapse ([2811b7e](https://gitlab.com/gitlab-org/gitlab-ui/commit/2811b7e7e9a7fc37bd17042063ee3e4504cb380d))
|
|
14
|
+
|
|
1
15
|
# [108.8.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v108.7.0...v108.8.0) (2025-02-27)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
2
2
|
import { GlResizeObserverDirective } from '../../../directives/resize_observer/resize_observer';
|
|
3
|
-
import { POSITION } from './constants';
|
|
3
|
+
import { POSITION, ZERO_WIDTH_SPACE } from './constants';
|
|
4
4
|
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
|
|
5
5
|
|
|
6
6
|
//
|
|
@@ -46,8 +46,49 @@ var script = {
|
|
|
46
46
|
middleIndex() {
|
|
47
47
|
return Math.floor(this.text.length / 2);
|
|
48
48
|
},
|
|
49
|
+
preventWhitespaceCollapse() {
|
|
50
|
+
// We don't use `\s` here since it includes non-breaking spaces and other
|
|
51
|
+
// non-collapsible whitespace characters.
|
|
52
|
+
// See https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
|
|
53
|
+
// and https://infra.spec.whatwg.org/#ascii-whitespace.
|
|
54
|
+
const collapsibleWhitespaceChar = /^[ \n\t\r\f]$/;
|
|
55
|
+
const {
|
|
56
|
+
text,
|
|
57
|
+
middleIndex
|
|
58
|
+
} = this;
|
|
59
|
+
const lastCharOfFirstIsCollapsibleWhitespace = collapsibleWhitespaceChar.test(text.charAt(middleIndex - 1));
|
|
60
|
+
const firstCharOfLastIsCollapsibleWhitespace = collapsibleWhitespaceChar.test(text.charAt(middleIndex));
|
|
61
|
+
return lastCharOfFirstIsCollapsibleWhitespace && !firstCharOfLastIsCollapsibleWhitespace;
|
|
62
|
+
},
|
|
49
63
|
first() {
|
|
50
|
-
|
|
64
|
+
const first = this.text.slice(0, this.middleIndex);
|
|
65
|
+
if (this.preventWhitespaceCollapse) {
|
|
66
|
+
// Because this component's root element has an internal flex layout,
|
|
67
|
+
// whitespace at the end of the first child span and at the beginning
|
|
68
|
+
// of the second child span would be ignored (i.e., totally collapsed).
|
|
69
|
+
//
|
|
70
|
+
// This means that strings with a space character in the middle would
|
|
71
|
+
// render as if there were no space, which would be incorrect (e.g.,
|
|
72
|
+
// "Gap here" would render as "Gaphere").
|
|
73
|
+
//
|
|
74
|
+
// So, in that case, we insert a zero-width space at the end of the
|
|
75
|
+
// first child span to prevent that whitespace from being totally
|
|
76
|
+
// collapsed. In other words:
|
|
77
|
+
// 'first-part-with-space ' → 'first-part-with-space ​'
|
|
78
|
+
//
|
|
79
|
+
// If there's a whitespace character at the begging of the second child
|
|
80
|
+
// span, we do *not* do this, since the left-to-right mark (‎) just
|
|
81
|
+
// before `{{ last }}` in the template prevents the collapse of any
|
|
82
|
+
// whitespace at the start of `last`. If we ignored this edge case,
|
|
83
|
+
// we'd render a double space, which wouldn't correspond to how the
|
|
84
|
+
// string would normally render.
|
|
85
|
+
//
|
|
86
|
+
// See
|
|
87
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model/Whitespace#whitespace_in_block_formatting_contexts
|
|
88
|
+
// for more information on how browsers treat whitespace.
|
|
89
|
+
return `${first}${ZERO_WIDTH_SPACE}`;
|
|
90
|
+
}
|
|
91
|
+
return first;
|
|
51
92
|
},
|
|
52
93
|
last() {
|
|
53
94
|
return this.text.slice(this.middleIndex);
|