@gitlab/ui 111.0.0 → 111.1.1
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/base/token_selector/token_container.js +1 -1
- package/dist/components/base/token_selector/token_selector.js +2 -1
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +1 -2
- package/dist/components/charts/heatmap/heatmap.js +4 -4
- package/dist/components/charts/legend/legend.js +1 -2
- package/dist/components/charts/line/line.js +1 -2
- package/dist/index.css +1 -1
- 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 +8 -1
- package/dist/tokens/build/js/tokens.js +8 -1
- package/dist/tokens/css/tokens.css +8 -1
- package/dist/tokens/css/tokens.dark.css +8 -1
- package/dist/tokens/js/tokens.dark.js +7 -0
- package/dist/tokens/js/tokens.js +7 -0
- package/dist/tokens/json/tokens.dark.json +176 -1
- package/dist/tokens/json/tokens.json +176 -1
- package/dist/tokens/scss/_tokens.dark.scss +8 -1
- package/dist/tokens/scss/_tokens.scss +8 -1
- package/dist/tokens/scss/_tokens_custom_properties.scss +7 -0
- package/dist/utils/charts/theme.js +31 -29
- package/dist/utils/is_slot_empty.js +1 -8
- package/package.json +1 -1
- package/src/components/base/token_selector/token_container.vue +3 -2
- package/src/components/base/token_selector/token_selector.scss +1 -0
- package/src/components/base/token_selector/token_selector.vue +3 -0
- package/src/components/charts/discrete_scatter/discrete_scatter.vue +1 -2
- package/src/components/charts/heatmap/heatmap.vue +4 -4
- package/src/components/charts/legend/legend.vue +1 -2
- package/src/components/charts/line/line.vue +1 -2
- package/src/tokens/build/css/tokens.css +8 -1
- package/src/tokens/build/css/tokens.dark.css +8 -1
- package/src/tokens/build/js/tokens.dark.js +7 -0
- package/src/tokens/build/js/tokens.js +7 -0
- package/src/tokens/build/json/tokens.dark.json +176 -1
- package/src/tokens/build/json/tokens.json +176 -1
- package/src/tokens/build/scss/_tokens.dark.scss +8 -1
- package/src/tokens/build/scss/_tokens.scss +8 -1
- package/src/tokens/build/scss/_tokens_custom_properties.scss +7 -0
- package/src/tokens/contextual/chart.tokens.json +68 -0
- package/src/tokens/contextual/dropdown.tokens.json +2 -0
- package/src/utils/charts/theme.js +150 -153
- package/src/utils/is_slot_empty.js +1 -10
|
@@ -1,68 +1,63 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
DATA_VIZ_ORANGE_600,
|
|
62
|
-
DATA_VIZ_ORANGE_700,
|
|
63
|
-
DATA_VIZ_ORANGE_800,
|
|
64
|
-
DATA_VIZ_ORANGE_950,
|
|
65
|
-
DATA_VIZ_ORANGE_900,
|
|
2
|
+
GL_COLOR_NEUTRAL_50,
|
|
3
|
+
GL_COLOR_NEUTRAL_100,
|
|
4
|
+
GL_COLOR_NEUTRAL_500,
|
|
5
|
+
GL_COLOR_NEUTRAL_900,
|
|
6
|
+
GL_COLOR_DATA_AQUA_50,
|
|
7
|
+
GL_COLOR_DATA_AQUA_100,
|
|
8
|
+
GL_COLOR_DATA_AQUA_200,
|
|
9
|
+
GL_COLOR_DATA_AQUA_300,
|
|
10
|
+
GL_COLOR_DATA_AQUA_400,
|
|
11
|
+
GL_COLOR_DATA_AQUA_500,
|
|
12
|
+
GL_COLOR_DATA_AQUA_600,
|
|
13
|
+
GL_COLOR_DATA_AQUA_700,
|
|
14
|
+
GL_COLOR_DATA_AQUA_800,
|
|
15
|
+
GL_COLOR_DATA_AQUA_900,
|
|
16
|
+
GL_COLOR_DATA_AQUA_950,
|
|
17
|
+
GL_COLOR_DATA_BLUE_50,
|
|
18
|
+
GL_COLOR_DATA_BLUE_100,
|
|
19
|
+
GL_COLOR_DATA_BLUE_200,
|
|
20
|
+
GL_COLOR_DATA_BLUE_300,
|
|
21
|
+
GL_COLOR_DATA_BLUE_400,
|
|
22
|
+
GL_COLOR_DATA_BLUE_500,
|
|
23
|
+
GL_COLOR_DATA_BLUE_600,
|
|
24
|
+
GL_COLOR_DATA_BLUE_700,
|
|
25
|
+
GL_COLOR_DATA_BLUE_800,
|
|
26
|
+
GL_COLOR_DATA_BLUE_900,
|
|
27
|
+
GL_COLOR_DATA_BLUE_950,
|
|
28
|
+
GL_COLOR_DATA_GREEN_50,
|
|
29
|
+
GL_COLOR_DATA_GREEN_100,
|
|
30
|
+
GL_COLOR_DATA_GREEN_200,
|
|
31
|
+
GL_COLOR_DATA_GREEN_300,
|
|
32
|
+
GL_COLOR_DATA_GREEN_400,
|
|
33
|
+
GL_COLOR_DATA_GREEN_500,
|
|
34
|
+
GL_COLOR_DATA_GREEN_600,
|
|
35
|
+
GL_COLOR_DATA_GREEN_700,
|
|
36
|
+
GL_COLOR_DATA_GREEN_800,
|
|
37
|
+
GL_COLOR_DATA_GREEN_900,
|
|
38
|
+
GL_COLOR_DATA_GREEN_950,
|
|
39
|
+
GL_COLOR_DATA_MAGENTA_50,
|
|
40
|
+
GL_COLOR_DATA_MAGENTA_100,
|
|
41
|
+
GL_COLOR_DATA_MAGENTA_200,
|
|
42
|
+
GL_COLOR_DATA_MAGENTA_300,
|
|
43
|
+
GL_COLOR_DATA_MAGENTA_400,
|
|
44
|
+
GL_COLOR_DATA_MAGENTA_500,
|
|
45
|
+
GL_COLOR_DATA_MAGENTA_600,
|
|
46
|
+
GL_COLOR_DATA_MAGENTA_700,
|
|
47
|
+
GL_COLOR_DATA_MAGENTA_800,
|
|
48
|
+
GL_COLOR_DATA_MAGENTA_900,
|
|
49
|
+
GL_COLOR_DATA_MAGENTA_950,
|
|
50
|
+
GL_COLOR_DATA_ORANGE_50,
|
|
51
|
+
GL_COLOR_DATA_ORANGE_100,
|
|
52
|
+
GL_COLOR_DATA_ORANGE_200,
|
|
53
|
+
GL_COLOR_DATA_ORANGE_300,
|
|
54
|
+
GL_COLOR_DATA_ORANGE_400,
|
|
55
|
+
GL_COLOR_DATA_ORANGE_500,
|
|
56
|
+
GL_COLOR_DATA_ORANGE_600,
|
|
57
|
+
GL_COLOR_DATA_ORANGE_700,
|
|
58
|
+
GL_COLOR_DATA_ORANGE_800,
|
|
59
|
+
GL_COLOR_DATA_ORANGE_950,
|
|
60
|
+
GL_COLOR_DATA_ORANGE_900,
|
|
66
61
|
} from '../../tokens/build/js/tokens';
|
|
67
62
|
import {
|
|
68
63
|
scrollHandleSvgPath,
|
|
@@ -71,23 +66,22 @@ import {
|
|
|
71
66
|
clearAllSvgPath,
|
|
72
67
|
downloadSvgPath,
|
|
73
68
|
} from '../svgs/svg_paths';
|
|
74
|
-
import { hexToRgba } from '../utils';
|
|
75
69
|
|
|
76
70
|
const GL_BORDER_RADIUS_BASE = '0.25rem';
|
|
77
71
|
|
|
78
72
|
export const themeName = 'gitlab';
|
|
79
73
|
|
|
80
74
|
export const heatmapHues = [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
GL_COLOR_NEUTRAL_100,
|
|
76
|
+
GL_COLOR_DATA_BLUE_200,
|
|
77
|
+
GL_COLOR_DATA_BLUE_400,
|
|
78
|
+
GL_COLOR_DATA_BLUE_600,
|
|
79
|
+
GL_COLOR_DATA_BLUE_800,
|
|
86
80
|
];
|
|
87
81
|
|
|
88
|
-
export const gaugeNeutralHues = [
|
|
89
|
-
export const gaugeSafeHues = [
|
|
90
|
-
export const gaugeWarningHue =
|
|
82
|
+
export const gaugeNeutralHues = [GL_COLOR_NEUTRAL_900, GL_COLOR_NEUTRAL_500];
|
|
83
|
+
export const gaugeSafeHues = [GL_COLOR_DATA_BLUE_500, GL_COLOR_DATA_BLUE_900];
|
|
84
|
+
export const gaugeWarningHue = GL_COLOR_DATA_ORANGE_500;
|
|
91
85
|
|
|
92
86
|
/**
|
|
93
87
|
* The default palette is based on the Categorical data palette
|
|
@@ -96,71 +90,71 @@ export const gaugeWarningHue = DATA_VIZ_ORANGE_500;
|
|
|
96
90
|
* More info: https://design.gitlab.com/data-visualization/color#categorical-data
|
|
97
91
|
*/
|
|
98
92
|
export const colorPaletteDefault = [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
93
|
+
GL_COLOR_DATA_BLUE_500,
|
|
94
|
+
GL_COLOR_DATA_ORANGE_600,
|
|
95
|
+
GL_COLOR_DATA_AQUA_500,
|
|
96
|
+
GL_COLOR_DATA_GREEN_600,
|
|
97
|
+
GL_COLOR_DATA_MAGENTA_500,
|
|
98
|
+
GL_COLOR_DATA_BLUE_700,
|
|
99
|
+
GL_COLOR_DATA_ORANGE_800,
|
|
100
|
+
GL_COLOR_DATA_AQUA_700,
|
|
101
|
+
GL_COLOR_DATA_GREEN_800,
|
|
102
|
+
GL_COLOR_DATA_MAGENTA_700,
|
|
103
|
+
GL_COLOR_DATA_BLUE_900,
|
|
104
|
+
GL_COLOR_DATA_ORANGE_950,
|
|
105
|
+
GL_COLOR_DATA_AQUA_900,
|
|
106
|
+
GL_COLOR_DATA_GREEN_950,
|
|
107
|
+
GL_COLOR_DATA_MAGENTA_900,
|
|
108
|
+
GL_COLOR_DATA_BLUE_600,
|
|
109
|
+
GL_COLOR_DATA_ORANGE_700,
|
|
110
|
+
GL_COLOR_DATA_AQUA_600,
|
|
111
|
+
GL_COLOR_DATA_GREEN_700,
|
|
112
|
+
GL_COLOR_DATA_MAGENTA_600,
|
|
113
|
+
GL_COLOR_DATA_BLUE_800,
|
|
114
|
+
GL_COLOR_DATA_ORANGE_900,
|
|
115
|
+
GL_COLOR_DATA_AQUA_800,
|
|
116
|
+
GL_COLOR_DATA_GREEN_900,
|
|
117
|
+
GL_COLOR_DATA_MAGENTA_800,
|
|
118
|
+
GL_COLOR_DATA_BLUE_950,
|
|
119
|
+
GL_COLOR_DATA_ORANGE_500,
|
|
120
|
+
GL_COLOR_DATA_AQUA_950,
|
|
121
|
+
GL_COLOR_DATA_GREEN_500,
|
|
122
|
+
GL_COLOR_DATA_MAGENTA_950,
|
|
129
123
|
];
|
|
130
124
|
export const colorFromDefaultPalette = (index) =>
|
|
131
125
|
colorPaletteDefault[index % colorPaletteDefault.length];
|
|
132
126
|
|
|
133
127
|
export const colorPaletteDark = [
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
128
|
+
GL_COLOR_DATA_BLUE_500,
|
|
129
|
+
GL_COLOR_DATA_ORANGE_400,
|
|
130
|
+
GL_COLOR_DATA_AQUA_500,
|
|
131
|
+
GL_COLOR_DATA_GREEN_400,
|
|
132
|
+
GL_COLOR_DATA_MAGENTA_500,
|
|
133
|
+
GL_COLOR_DATA_BLUE_300,
|
|
134
|
+
GL_COLOR_DATA_ORANGE_200,
|
|
135
|
+
GL_COLOR_DATA_AQUA_300,
|
|
136
|
+
GL_COLOR_DATA_GREEN_200,
|
|
137
|
+
GL_COLOR_DATA_MAGENTA_300,
|
|
138
|
+
GL_COLOR_DATA_BLUE_100,
|
|
139
|
+
GL_COLOR_DATA_ORANGE_50,
|
|
140
|
+
GL_COLOR_DATA_AQUA_100,
|
|
141
|
+
GL_COLOR_DATA_GREEN_50,
|
|
142
|
+
GL_COLOR_DATA_MAGENTA_100,
|
|
143
|
+
GL_COLOR_DATA_BLUE_400,
|
|
144
|
+
GL_COLOR_DATA_ORANGE_300,
|
|
145
|
+
GL_COLOR_DATA_AQUA_400,
|
|
146
|
+
GL_COLOR_DATA_GREEN_300,
|
|
147
|
+
GL_COLOR_DATA_MAGENTA_400,
|
|
148
|
+
GL_COLOR_DATA_BLUE_200,
|
|
149
|
+
GL_COLOR_DATA_ORANGE_100,
|
|
150
|
+
GL_COLOR_DATA_AQUA_200,
|
|
151
|
+
GL_COLOR_DATA_GREEN_100,
|
|
152
|
+
GL_COLOR_DATA_MAGENTA_200,
|
|
153
|
+
GL_COLOR_DATA_BLUE_50,
|
|
154
|
+
GL_COLOR_DATA_ORANGE_500,
|
|
155
|
+
GL_COLOR_DATA_AQUA_50,
|
|
156
|
+
GL_COLOR_DATA_GREEN_500,
|
|
157
|
+
GL_COLOR_DATA_MAGENTA_50,
|
|
164
158
|
];
|
|
165
159
|
|
|
166
160
|
export const colorFromDarkPalette = (index) => colorPaletteDark[index % colorPaletteDark.length];
|
|
@@ -169,7 +163,7 @@ const axes = {
|
|
|
169
163
|
axisLabel: {
|
|
170
164
|
margin: 8,
|
|
171
165
|
show: true,
|
|
172
|
-
color:
|
|
166
|
+
color: 'var(--gl-chart-axis-text-color)',
|
|
173
167
|
hideOverlap: true,
|
|
174
168
|
},
|
|
175
169
|
axisLine: {
|
|
@@ -178,7 +172,7 @@ const axes = {
|
|
|
178
172
|
axisPointer: {
|
|
179
173
|
lineStyle: {
|
|
180
174
|
type: 'solid',
|
|
181
|
-
color:
|
|
175
|
+
color: 'var(--gl-chart-axis-pointer-color)',
|
|
182
176
|
},
|
|
183
177
|
label: {
|
|
184
178
|
show: false,
|
|
@@ -188,7 +182,7 @@ const axes = {
|
|
|
188
182
|
show: true,
|
|
189
183
|
alignWithLabel: true,
|
|
190
184
|
lineStyle: {
|
|
191
|
-
color:
|
|
185
|
+
color: 'var(--gl-chart-axis-line-color)',
|
|
192
186
|
},
|
|
193
187
|
},
|
|
194
188
|
nameGap: 30,
|
|
@@ -197,14 +191,11 @@ const axes = {
|
|
|
197
191
|
},
|
|
198
192
|
splitLine: {
|
|
199
193
|
lineStyle: {
|
|
200
|
-
color: [
|
|
194
|
+
color: ['var(--gl-chart-axis-line-color)'],
|
|
201
195
|
},
|
|
202
196
|
},
|
|
203
197
|
splitArea: {
|
|
204
198
|
show: false,
|
|
205
|
-
areaStyle: {
|
|
206
|
-
color: [hexToRgba(GRAY_50, 0.3), hexToRgba(GRAY_300, 0.3)],
|
|
207
|
-
},
|
|
208
199
|
},
|
|
209
200
|
};
|
|
210
201
|
|
|
@@ -216,7 +207,7 @@ export const createTheme = (options = {}) => ({
|
|
|
216
207
|
color: colorPaletteDefault,
|
|
217
208
|
backgroundColor: 'transparent',
|
|
218
209
|
textStyle: {
|
|
219
|
-
color:
|
|
210
|
+
color: 'var(--gl-text-color-default)',
|
|
220
211
|
},
|
|
221
212
|
markLine: {
|
|
222
213
|
silent: true,
|
|
@@ -225,7 +216,7 @@ export const createTheme = (options = {}) => ({
|
|
|
225
216
|
show: false,
|
|
226
217
|
},
|
|
227
218
|
lineStyle: {
|
|
228
|
-
color:
|
|
219
|
+
color: 'var(--gl-chart-threshold-line-color)',
|
|
229
220
|
width: 1,
|
|
230
221
|
type: 'dashed',
|
|
231
222
|
},
|
|
@@ -233,7 +224,7 @@ export const createTheme = (options = {}) => ({
|
|
|
233
224
|
markArea: {
|
|
234
225
|
silent: true,
|
|
235
226
|
itemStyle: {
|
|
236
|
-
color:
|
|
227
|
+
color: 'var(--gl-chart-threshold-area-color)',
|
|
237
228
|
},
|
|
238
229
|
},
|
|
239
230
|
dataZoom: {
|
|
@@ -243,7 +234,7 @@ export const createTheme = (options = {}) => ({
|
|
|
243
234
|
dataBackground: {
|
|
244
235
|
lineStyle: {
|
|
245
236
|
width: 2,
|
|
246
|
-
color:
|
|
237
|
+
color: 'var(--gl-chart-axis-line-color)',
|
|
247
238
|
opacity: 1,
|
|
248
239
|
},
|
|
249
240
|
// render unfilled zoom-graph if the series is a line chart without area styles
|
|
@@ -251,20 +242,25 @@ export const createTheme = (options = {}) => ({
|
|
|
251
242
|
areaStyle: isLineChartWithoutArea(options)
|
|
252
243
|
? {} // Use empty object instead of null, see https://gitlab.com/gitlab-org/gitlab-ui/-/merge_requests/2185#note_707711029 for more context
|
|
253
244
|
: {
|
|
254
|
-
color:
|
|
245
|
+
color: 'var(--gl-background-color-strong)',
|
|
255
246
|
opacity: 1,
|
|
256
247
|
},
|
|
257
248
|
},
|
|
258
|
-
fillerColor:
|
|
249
|
+
fillerColor: 'var(--gl-chart-zoom-filler-color)',
|
|
259
250
|
handleIcon: scrollHandleSvgPath,
|
|
251
|
+
emphasis: {
|
|
252
|
+
handleStyle: {
|
|
253
|
+
color: 'var(--gl-chart-zoom-handle-color)',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
260
256
|
handleStyle: {
|
|
261
257
|
borderColor: 'transparent',
|
|
262
|
-
color:
|
|
258
|
+
color: 'var(--gl-chart-zoom-handle-color)',
|
|
263
259
|
},
|
|
264
260
|
handleSize: '50%',
|
|
265
261
|
labelFormatter: () => null,
|
|
266
262
|
textStyle: {
|
|
267
|
-
color:
|
|
263
|
+
color: 'var(--gl-chart-axis-text-color)',
|
|
268
264
|
},
|
|
269
265
|
},
|
|
270
266
|
toolbox: {
|
|
@@ -274,14 +270,15 @@ export const createTheme = (options = {}) => ({
|
|
|
274
270
|
emphasis: {
|
|
275
271
|
iconStyle: {
|
|
276
272
|
borderWidth: 0,
|
|
277
|
-
color:
|
|
278
|
-
|
|
273
|
+
color: 'var(--gl-icon-color-default)',
|
|
274
|
+
textFill: 'var(--gl-feedback-strong-text-color)',
|
|
275
|
+
textBackgroundColor: 'var(--gl-feedback-strong-background-color)',
|
|
279
276
|
textBorderRadius: GL_BORDER_RADIUS_BASE,
|
|
280
277
|
textPadding: [8, 12],
|
|
281
278
|
},
|
|
282
279
|
},
|
|
283
280
|
iconStyle: {
|
|
284
|
-
color:
|
|
281
|
+
color: 'var(--gl-icon-color-default)',
|
|
285
282
|
borderWidth: 0,
|
|
286
283
|
},
|
|
287
284
|
itemGap: 8,
|
|
@@ -311,12 +308,12 @@ export const createTheme = (options = {}) => ({
|
|
|
311
308
|
label: {
|
|
312
309
|
normal: {
|
|
313
310
|
textStyle: {
|
|
314
|
-
color:
|
|
311
|
+
color: GL_COLOR_NEUTRAL_50,
|
|
315
312
|
},
|
|
316
313
|
},
|
|
317
314
|
emphasis: {
|
|
318
315
|
textStyle: {
|
|
319
|
-
color:
|
|
316
|
+
color: GL_COLOR_NEUTRAL_50,
|
|
320
317
|
},
|
|
321
318
|
},
|
|
322
319
|
},
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
|
-
import { isVue3 } from './constants';
|
|
3
2
|
|
|
4
3
|
// Fragment will be available only in Vue.js 3
|
|
5
4
|
const { Fragment, Comment, Text } = Vue;
|
|
6
5
|
|
|
7
|
-
function callIfNeeded(fnOrResult, args) {
|
|
8
|
-
return fnOrResult instanceof Function ? fnOrResult(args) : fnOrResult;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
6
|
export function isVnodeEmpty(vnode) {
|
|
12
7
|
if (!vnode || (Comment && vnode.type === Comment)) {
|
|
13
8
|
return true;
|
|
@@ -33,11 +28,7 @@ export function isVnodeEmpty(vnode) {
|
|
|
33
28
|
}
|
|
34
29
|
|
|
35
30
|
export function isSlotEmpty(vueInstance, slot, slotArgs) {
|
|
36
|
-
const slotContent =
|
|
37
|
-
? // we need to check both $slots and $scopedSlots due to https://github.com/vuejs/core/issues/8869
|
|
38
|
-
// additionally, in @vue/compat $slot might be a function instead of array of vnodes (sigh)
|
|
39
|
-
callIfNeeded(vueInstance.$slots[slot] || vueInstance.$scopedSlots[slot], slotArgs)
|
|
40
|
-
: vueInstance.$scopedSlots[slot]?.(slotArgs);
|
|
31
|
+
const slotContent = vueInstance.$scopedSlots[slot]?.(slotArgs);
|
|
41
32
|
|
|
42
33
|
// eslint-disable-next-line unicorn/no-array-callback-reference
|
|
43
34
|
return isVnodeEmpty(slotContent);
|