vue-layout-gitcode 1.0.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/GloabarSearch-37405ec8.js +141 -0
- package/ProjectSearch-cbd30a7b.js +131 -0
- package/SearchHistoryList-6fa78d5b.js +144 -0
- package/SearchPrefixTag-d6298d77.js +91 -0
- package/SearchRecommed-bbea8abe.js +724 -0
- package/SearchScopeList-6eba07a3.js +105 -0
- package/UserSearch-f7f1ff0d.js +129 -0
- package/formatNameSpace-d87daa04.js +75 -0
- package/index-36595f17.js +19813 -0
- package/index-a06332e6.js +106 -0
- package/index.d.ts +1010 -0
- package/index.js +56 -0
- package/notice-425401c1.js +106 -0
- package/package.json +16 -0
- package/style.css +1 -0
|
@@ -0,0 +1,724 @@
|
|
|
1
|
+
import { defineComponent, toDisplayString, inject, ref, openBlock, createElementBlock, normalizeClass, createElementVNode, withModifiers, withDirectives, vShow, createVNode, computed, unref, normalizeStyle, createCommentVNode, createTextVNode, onMounted, onUnmounted, Fragment, createBlock, renderList, reactive, resolveComponent, withCtx } from "vue";
|
|
2
|
+
import { h as headRequest, I as Icon, r as reqCatch, _ as _export_sfc, T as TOPIC_TYPE, f as useTimeFormat, g as usePageResize, d as i18n, j as highlightWords, t as transWebUrl, k as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, R as REPO_MODULE, a as useReport, b as REPO_EVENT } from "./index-36595f17.js";
|
|
3
|
+
import { f as formatNameSpace, u as useReportRepo } from "./formatNameSpace-d87daa04.js";
|
|
4
|
+
import { useRouter } from "vue-router";
|
|
5
|
+
import "vue-devui-lal/button";
|
|
6
|
+
import "vue-devui-lal/popover";
|
|
7
|
+
import "vue-devui-lal/tooltip";
|
|
8
|
+
import "vue-devui-lal/textarea";
|
|
9
|
+
import "vue-devui-lal/button/style.css";
|
|
10
|
+
import "vue-devui-lal/popover/style.css";
|
|
11
|
+
import "vue-devui-lal/tooltip/style.css";
|
|
12
|
+
import "vue-devui-lal/textarea/style.css";
|
|
13
|
+
import "vue-devui-lal/icon";
|
|
14
|
+
import "vue-devui-lal/icon/style.css";
|
|
15
|
+
import "vue-i18n";
|
|
16
|
+
import "@vueuse/core";
|
|
17
|
+
import "vue-devui-lal/avatar";
|
|
18
|
+
import "vue-devui-lal/avatar/style.css";
|
|
19
|
+
import "vue-devui-lal/select";
|
|
20
|
+
import "vue-devui-lal/input";
|
|
21
|
+
import "vue-devui-lal/skeleton";
|
|
22
|
+
import "vue-devui-lal/menu";
|
|
23
|
+
import "vue-devui-lal/select/style.css";
|
|
24
|
+
import "vue-devui-lal/input/style.css";
|
|
25
|
+
import "vue-devui-lal/skeleton/style.css";
|
|
26
|
+
import "vue-devui-lal/menu/style.css";
|
|
27
|
+
import "vue-devui-lal/dropdown";
|
|
28
|
+
import "vue-devui-lal/dropdown/style.css";
|
|
29
|
+
import "vue-devui-lal/drawer";
|
|
30
|
+
import "vue-devui-lal/layout";
|
|
31
|
+
import "vue-devui-lal/drawer/style.css";
|
|
32
|
+
import "vue-devui-lal/layout/style.css";
|
|
33
|
+
import "dayjs";
|
|
34
|
+
import "vue-devui-lal/message";
|
|
35
|
+
import "vue-devui-lal/message/style.css";
|
|
36
|
+
import "vue-devui-lal/badge";
|
|
37
|
+
import "vue-devui-lal/badge/style.css";
|
|
38
|
+
import "vue-devui-lal/tabs";
|
|
39
|
+
import "vue-devui-lal/tabs/style.css";
|
|
40
|
+
import "vue-devui-lal/radio";
|
|
41
|
+
import "vue-devui-lal/radio/style.css";
|
|
42
|
+
import "vue-devui-lal/form";
|
|
43
|
+
import "vue-devui-lal/form/style.css";
|
|
44
|
+
import "vue-devui-lal/checkbox";
|
|
45
|
+
import "vue-devui-lal/checkbox/style.css";
|
|
46
|
+
import "vue-devui-lal/modal";
|
|
47
|
+
import "vue-devui-lal/modal/style.css";
|
|
48
|
+
import "vue-devui-lal/notification";
|
|
49
|
+
import "vue-devui-lal/notification/style.css";
|
|
50
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
51
|
+
__name: "index",
|
|
52
|
+
props: {
|
|
53
|
+
number: {},
|
|
54
|
+
fixed: { default: 2 },
|
|
55
|
+
byte: { type: Boolean }
|
|
56
|
+
},
|
|
57
|
+
setup(__props) {
|
|
58
|
+
const props = __props;
|
|
59
|
+
const DECIMAL_PACE = [
|
|
60
|
+
{ unit: "K", base: 1e3 },
|
|
61
|
+
{ unit: "M", base: 1e6 }
|
|
62
|
+
// 百万
|
|
63
|
+
];
|
|
64
|
+
const BYTE_PACE = [
|
|
65
|
+
{ unit: "B", base: 1 },
|
|
66
|
+
{ unit: "KB", base: Math.pow(2, 10) },
|
|
67
|
+
{ unit: "MB", base: Math.pow(2, 20) },
|
|
68
|
+
{ unit: "GB", base: Math.pow(2, 30) }
|
|
69
|
+
];
|
|
70
|
+
const transfer = (val) => {
|
|
71
|
+
try {
|
|
72
|
+
const pace = props.byte ? BYTE_PACE : DECIMAL_PACE;
|
|
73
|
+
return pace.reduce((res, { base, unit }) => {
|
|
74
|
+
if (val >= base) {
|
|
75
|
+
const fixedBase = Math.pow(10, props.fixed);
|
|
76
|
+
res = `${parseFloat((Math.round(val * fixedBase / base) / fixedBase).toFixed(props.fixed))} ${unit}`;
|
|
77
|
+
}
|
|
78
|
+
return res;
|
|
79
|
+
}, `${val}`);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
}
|
|
82
|
+
return `${val}`;
|
|
83
|
+
};
|
|
84
|
+
return (_ctx, _cache) => {
|
|
85
|
+
return toDisplayString(transfer(_ctx.number));
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
const _hoisted_1$6 = {
|
|
90
|
+
class: "mr-[4px]",
|
|
91
|
+
style: { "width": "15px", "height": "15px" }
|
|
92
|
+
};
|
|
93
|
+
const _hoisted_2$5 = { class: "i-star-tag__text" };
|
|
94
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
95
|
+
__name: "index",
|
|
96
|
+
props: {
|
|
97
|
+
starInfo: { default: () => ({
|
|
98
|
+
starred: false,
|
|
99
|
+
starCount: 0
|
|
100
|
+
}) }
|
|
101
|
+
},
|
|
102
|
+
emits: ["report"],
|
|
103
|
+
setup(__props, { emit: __emit }) {
|
|
104
|
+
const API = headRequest(inject("request"));
|
|
105
|
+
const props = __props;
|
|
106
|
+
const emits = __emit;
|
|
107
|
+
const running = ref(false);
|
|
108
|
+
const starred = ref(props.starInfo.starred);
|
|
109
|
+
const starCount = ref(props.starInfo.starCount);
|
|
110
|
+
const starLoading = ref(false);
|
|
111
|
+
const handleStar = async (e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
try {
|
|
114
|
+
if (starLoading.value)
|
|
115
|
+
return;
|
|
116
|
+
starLoading.value = true;
|
|
117
|
+
const params = { repoId: props.starInfo.id };
|
|
118
|
+
let res;
|
|
119
|
+
if (starred.value) {
|
|
120
|
+
res = await reqCatch(API.unstarRepo, params);
|
|
121
|
+
} else {
|
|
122
|
+
res = await reqCatch(API.starRepo, params);
|
|
123
|
+
running.value = true;
|
|
124
|
+
}
|
|
125
|
+
if (res && !(res == null ? void 0 : res.error)) {
|
|
126
|
+
starred.value = !starred.value;
|
|
127
|
+
starred.value ? starCount.value++ : starCount.value--;
|
|
128
|
+
starCount.value < 0 && (starCount.value = 0);
|
|
129
|
+
if (starred.value) {
|
|
130
|
+
emits("report");
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} finally {
|
|
134
|
+
starLoading.value = false;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const animationend = () => {
|
|
138
|
+
setTimeout(() => {
|
|
139
|
+
running.value = false;
|
|
140
|
+
}, 100);
|
|
141
|
+
};
|
|
142
|
+
return (_ctx, _cache) => {
|
|
143
|
+
return openBlock(), createElementBlock("div", {
|
|
144
|
+
class: normalizeClass(["i-star", {
|
|
145
|
+
"i-star__active": starred.value
|
|
146
|
+
}])
|
|
147
|
+
}, [
|
|
148
|
+
createElementVNode("span", {
|
|
149
|
+
class: normalizeClass(["i-star-tag hover:bg-[var(--theme-btn-default-hover)]", {
|
|
150
|
+
"i-star-tag__active": starred.value
|
|
151
|
+
}]),
|
|
152
|
+
onClick: withModifiers(handleStar, ["stop", "prevent"])
|
|
153
|
+
}, [
|
|
154
|
+
withDirectives(createElementVNode("div", {
|
|
155
|
+
class: "star",
|
|
156
|
+
onAnimationend: animationend
|
|
157
|
+
}, null, 544), [
|
|
158
|
+
[vShow, running.value]
|
|
159
|
+
]),
|
|
160
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
161
|
+
withDirectives(createVNode(Icon, {
|
|
162
|
+
size: "15",
|
|
163
|
+
name: starred.value ? "gt-a-star_open_16px1" : "gt-line-new-star",
|
|
164
|
+
style: {
|
|
165
|
+
transition: "all 0.2s"
|
|
166
|
+
}
|
|
167
|
+
}, null, 8, ["name"]), [
|
|
168
|
+
[vShow, !running.value]
|
|
169
|
+
])
|
|
170
|
+
]),
|
|
171
|
+
createElementVNode("span", _hoisted_2$5, [
|
|
172
|
+
createVNode(_sfc_main$8, {
|
|
173
|
+
number: Number(starCount.value || 0)
|
|
174
|
+
}, null, 8, ["number"])
|
|
175
|
+
])
|
|
176
|
+
], 2)
|
|
177
|
+
], 2);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const index_vue_vue_type_style_index_0_scoped_6d9f98e2_lang = "";
|
|
182
|
+
const StarTag = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-6d9f98e2"]]);
|
|
183
|
+
const _hoisted_1$5 = { class: "fork-tag" };
|
|
184
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
185
|
+
__name: "index",
|
|
186
|
+
props: {
|
|
187
|
+
count: {}
|
|
188
|
+
},
|
|
189
|
+
setup(__props) {
|
|
190
|
+
return (_ctx, _cache) => {
|
|
191
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
192
|
+
createVNode(Icon, {
|
|
193
|
+
class: "mr-[4px]",
|
|
194
|
+
name: "gt-line-fork",
|
|
195
|
+
color: "var(--theme-home-card-color-placeholder)",
|
|
196
|
+
size: "14"
|
|
197
|
+
}),
|
|
198
|
+
createElementVNode("span", null, [
|
|
199
|
+
createVNode(_sfc_main$8, {
|
|
200
|
+
number: _ctx.count || 0
|
|
201
|
+
}, null, 8, ["number"])
|
|
202
|
+
])
|
|
203
|
+
]);
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const index_vue_vue_type_style_index_0_scoped_cb84d9d8_lang = "";
|
|
208
|
+
const ForkTag = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-cb84d9d8"]]);
|
|
209
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
210
|
+
__name: "index",
|
|
211
|
+
props: {
|
|
212
|
+
tagInfo: { default: [] },
|
|
213
|
+
type: {}
|
|
214
|
+
},
|
|
215
|
+
setup(__props) {
|
|
216
|
+
const props = __props;
|
|
217
|
+
const isTag = computed(() => props.type === "tag");
|
|
218
|
+
const languageTag = props.tagInfo[0] || "";
|
|
219
|
+
const tagColor = props.tagInfo[1] || "#00ADD8";
|
|
220
|
+
computed(() => {
|
|
221
|
+
if (isTag.value) {
|
|
222
|
+
return {
|
|
223
|
+
background: tagColor,
|
|
224
|
+
opacity: 0.1
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
return {};
|
|
228
|
+
});
|
|
229
|
+
const tagFontColor = computed(() => {
|
|
230
|
+
if (isTag.value) {
|
|
231
|
+
return { color: tagColor };
|
|
232
|
+
}
|
|
233
|
+
return { color: "var(--theme-home-card-color-placeholder)" };
|
|
234
|
+
});
|
|
235
|
+
return (_ctx, _cache) => {
|
|
236
|
+
return unref(languageTag) ? (openBlock(), createElementBlock("span", {
|
|
237
|
+
key: 0,
|
|
238
|
+
class: normalizeClass(["i-language-tag", { "text-tag": !isTag.value }]),
|
|
239
|
+
style: normalizeStyle(tagFontColor.value)
|
|
240
|
+
}, [
|
|
241
|
+
isTag.value ? (openBlock(), createElementBlock("span", {
|
|
242
|
+
key: 0,
|
|
243
|
+
style: normalizeStyle({ background: unref(tagColor), opacity: 0.1 })
|
|
244
|
+
}, null, 4)) : createCommentVNode("", true),
|
|
245
|
+
createElementVNode("i", {
|
|
246
|
+
class: "mr-[4px]",
|
|
247
|
+
style: normalizeStyle({ background: unref(tagColor) })
|
|
248
|
+
}, null, 4),
|
|
249
|
+
createTextVNode(toDisplayString(unref(languageTag)), 1)
|
|
250
|
+
], 6)) : createCommentVNode("", true);
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
const index_vue_vue_type_style_index_0_scoped_f41c9ade_lang = "";
|
|
255
|
+
const LanguageTag = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f41c9ade"]]);
|
|
256
|
+
const _hoisted_1$4 = { class: "star-count-one" };
|
|
257
|
+
const _hoisted_2$4 = { key: 0 };
|
|
258
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
259
|
+
...{ name: "star-count-one" },
|
|
260
|
+
__name: "index",
|
|
261
|
+
props: {
|
|
262
|
+
starCountOne: {},
|
|
263
|
+
hideText: { type: Boolean }
|
|
264
|
+
},
|
|
265
|
+
setup(__props) {
|
|
266
|
+
return (_ctx, _cache) => {
|
|
267
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
268
|
+
createVNode(Icon, {
|
|
269
|
+
name: "gt-line-new-star",
|
|
270
|
+
color: "var(--theme-home-card-color-placeholder)",
|
|
271
|
+
size: "14"
|
|
272
|
+
}),
|
|
273
|
+
!_ctx.hideText ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(_ctx.$t("components.repo.today")), 1)) : createCommentVNode("", true),
|
|
274
|
+
createVNode(_sfc_main$8, {
|
|
275
|
+
number: _ctx.starCountOne || 0
|
|
276
|
+
}, null, 8, ["number"])
|
|
277
|
+
]);
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
const index_vue_vue_type_style_index_0_scoped_b13b2143_lang = "";
|
|
282
|
+
const StarCountOne = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b13b2143"]]);
|
|
283
|
+
const _hoisted_1$3 = { class: "github-star-num" };
|
|
284
|
+
const _hoisted_2$3 = { class: "leading-none" };
|
|
285
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
286
|
+
...{ name: "GithubStarNum" },
|
|
287
|
+
__name: "index",
|
|
288
|
+
props: {
|
|
289
|
+
count: {}
|
|
290
|
+
},
|
|
291
|
+
setup(__props) {
|
|
292
|
+
return (_ctx, _cache) => {
|
|
293
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
294
|
+
createVNode(Icon, {
|
|
295
|
+
name: "gt-line-github",
|
|
296
|
+
color: "var(--theme-home-card-color-placeholder)",
|
|
297
|
+
size: "14"
|
|
298
|
+
}),
|
|
299
|
+
createElementVNode("span", _hoisted_2$3, [
|
|
300
|
+
_cache[0] || (_cache[0] = createTextVNode("Star ")),
|
|
301
|
+
createVNode(_sfc_main$8, {
|
|
302
|
+
number: _ctx.count || 0
|
|
303
|
+
}, null, 8, ["number"])
|
|
304
|
+
])
|
|
305
|
+
]);
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
const index_vue_vue_type_style_index_0_scoped_49819ac3_lang = "";
|
|
310
|
+
const GithubStarNum = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-49819ac3"]]);
|
|
311
|
+
const _hoisted_1$2 = { class: "repo-card-footer mt-[4px]" };
|
|
312
|
+
const _hoisted_2$2 = {
|
|
313
|
+
key: 3,
|
|
314
|
+
class: "line-separator"
|
|
315
|
+
};
|
|
316
|
+
const _hoisted_3$2 = {
|
|
317
|
+
key: 4,
|
|
318
|
+
class: "repo-card-footer-timer"
|
|
319
|
+
};
|
|
320
|
+
const _hoisted_4$2 = ["onClick"];
|
|
321
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
322
|
+
__name: "index",
|
|
323
|
+
props: {
|
|
324
|
+
repoInfo: {},
|
|
325
|
+
hideTopicTags: { type: Boolean },
|
|
326
|
+
tagInfo: {},
|
|
327
|
+
hideUpdateTime: { type: Boolean },
|
|
328
|
+
hideStarIncrease: { type: Boolean },
|
|
329
|
+
hideStarCount: { type: Boolean },
|
|
330
|
+
searchCard: { type: Boolean }
|
|
331
|
+
},
|
|
332
|
+
emits: ["topicClick"],
|
|
333
|
+
setup(__props, { emit: __emit }) {
|
|
334
|
+
const { formatTimeFromNow } = useTimeFormat();
|
|
335
|
+
const props = __props;
|
|
336
|
+
const emits = __emit;
|
|
337
|
+
const topicTagsRef = ref();
|
|
338
|
+
const topicNames = computed(() => {
|
|
339
|
+
var _a;
|
|
340
|
+
return ((_a = props.repoInfo.tags) == null ? void 0 : _a.filter((item) => item.type === TOPIC_TYPE.USER)) || [];
|
|
341
|
+
});
|
|
342
|
+
ref(topicNames.value);
|
|
343
|
+
const visibleCount = ref(0);
|
|
344
|
+
ref(false);
|
|
345
|
+
computed(() => {
|
|
346
|
+
return topicNames.value.length - visibleCount.value + 1;
|
|
347
|
+
});
|
|
348
|
+
const handleTopicClick = (topic) => {
|
|
349
|
+
emits("topicClick", topic);
|
|
350
|
+
};
|
|
351
|
+
onMounted(() => {
|
|
352
|
+
});
|
|
353
|
+
onUnmounted(() => {
|
|
354
|
+
});
|
|
355
|
+
return (_ctx, _cache) => {
|
|
356
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
357
|
+
createElementVNode("div", null, [
|
|
358
|
+
createElementVNode("div", _hoisted_1$2, [
|
|
359
|
+
_ctx.tagInfo ? (openBlock(), createBlock(LanguageTag, {
|
|
360
|
+
key: 0,
|
|
361
|
+
"tag-info": _ctx.tagInfo
|
|
362
|
+
}, null, 8, ["tag-info"])) : createCommentVNode("", true),
|
|
363
|
+
!_ctx.hideStarCount ? (openBlock(), createBlock(StarCountOne, {
|
|
364
|
+
key: 1,
|
|
365
|
+
hideText: "",
|
|
366
|
+
starCountOne: _ctx.repoInfo.star_count
|
|
367
|
+
}, null, 8, ["starCountOne"])) : createCommentVNode("", true),
|
|
368
|
+
_ctx.repoInfo.forks_count ? (openBlock(), createBlock(ForkTag, {
|
|
369
|
+
key: 2,
|
|
370
|
+
count: _ctx.repoInfo.forks_count
|
|
371
|
+
}, null, 8, ["count"])) : createCommentVNode("", true),
|
|
372
|
+
!_ctx.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_2$2)) : createCommentVNode("", true),
|
|
373
|
+
!_ctx.hideUpdateTime ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(unref(formatTimeFromNow)((_ctx.searchCard ? _ctx.repoInfo.last_repository_updated_at : _ctx.repoInfo.last_activity_at) || _ctx.repoInfo.last_activity_at)), 1)) : createCommentVNode("", true),
|
|
374
|
+
!_ctx.hideStarIncrease && _ctx.repoInfo.star_count_one ? (openBlock(), createBlock(StarCountOne, {
|
|
375
|
+
key: 5,
|
|
376
|
+
starCountOne: _ctx.repoInfo.star_count_one
|
|
377
|
+
}, null, 8, ["starCountOne"])) : createCommentVNode("", true),
|
|
378
|
+
_ctx.repoInfo.show_recommend_icon ? (openBlock(), createBlock(GithubStarNum, {
|
|
379
|
+
key: 6,
|
|
380
|
+
count: _ctx.repoInfo.import_star_count
|
|
381
|
+
}, null, 8, ["count"])) : createCommentVNode("", true)
|
|
382
|
+
])
|
|
383
|
+
]),
|
|
384
|
+
!_ctx.hideTopicTags && topicNames.value.length && _ctx.searchCard ? (openBlock(), createElementBlock("div", {
|
|
385
|
+
key: 0,
|
|
386
|
+
class: "topic-tags",
|
|
387
|
+
ref_key: "topicTagsRef",
|
|
388
|
+
ref: topicTagsRef
|
|
389
|
+
}, [
|
|
390
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(topicNames.value, (topic) => {
|
|
391
|
+
return openBlock(), createElementBlock("div", {
|
|
392
|
+
class: "topic-tag",
|
|
393
|
+
key: topic.topic_id,
|
|
394
|
+
onClick: withModifiers(($event) => handleTopicClick(topic), ["stop"])
|
|
395
|
+
}, toDisplayString(topic.name), 9, _hoisted_4$2);
|
|
396
|
+
}), 128))
|
|
397
|
+
], 512)) : createCommentVNode("", true)
|
|
398
|
+
], 64);
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
const index_vue_vue_type_style_index_0_scoped_145cdce2_lang = "";
|
|
403
|
+
const RepoCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-145cdce2"]]);
|
|
404
|
+
const _hoisted_1$1 = ["innerHTML"];
|
|
405
|
+
const _hoisted_2$1 = {
|
|
406
|
+
key: 0,
|
|
407
|
+
class: "is-recommend ml-[8px]"
|
|
408
|
+
};
|
|
409
|
+
const _hoisted_3$1 = ["innerHTML"];
|
|
410
|
+
const _hoisted_4$1 = { key: 0 };
|
|
411
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
412
|
+
__name: "index",
|
|
413
|
+
props: {
|
|
414
|
+
info: {},
|
|
415
|
+
keyword: {},
|
|
416
|
+
cardType: {},
|
|
417
|
+
noborder: { type: Boolean },
|
|
418
|
+
hover: { type: Boolean },
|
|
419
|
+
hideTopicTags: { type: Boolean },
|
|
420
|
+
urlParams: {}
|
|
421
|
+
},
|
|
422
|
+
emits: ["report"],
|
|
423
|
+
setup(__props, { emit: __emit }) {
|
|
424
|
+
const API = headRequest(inject("request"));
|
|
425
|
+
const emits = __emit;
|
|
426
|
+
const router = useRouter();
|
|
427
|
+
const { widthType } = usePageResize();
|
|
428
|
+
const { t: $t } = i18n.global;
|
|
429
|
+
const handleClick = () => {
|
|
430
|
+
window.open(transWebUrl(props.info.web_url, props.urlParams), "_blank");
|
|
431
|
+
emits("report");
|
|
432
|
+
_frEventTrack(EVENT_NAME.CLICK_SEARCH_RESULT);
|
|
433
|
+
};
|
|
434
|
+
const handleStarReport = () => {
|
|
435
|
+
emits("report", "starReport");
|
|
436
|
+
};
|
|
437
|
+
const rowSpan = reactive({ xxl: 8, xl: 12, md: 12, lg: 24, sm: 24 });
|
|
438
|
+
const repoIcon = { repo: "gt-line-repositories", model: "gt-line-Models", dataset: "gt-line-Datasets" };
|
|
439
|
+
const props = __props;
|
|
440
|
+
const iconName = computed(() => {
|
|
441
|
+
var _a;
|
|
442
|
+
if ((_a = props.info) == null ? void 0 : _a.is_gh_mirrors) {
|
|
443
|
+
return "gt-line-github";
|
|
444
|
+
}
|
|
445
|
+
return repoIcon[props.cardType] || "gt-line-repositories";
|
|
446
|
+
});
|
|
447
|
+
const graphInfo = reactive({ commit_stat: null, trends: null });
|
|
448
|
+
const starInfo = computed(() => {
|
|
449
|
+
return { id: props.info.id, starred: props.info.starred, starCount: props.info.star_count };
|
|
450
|
+
});
|
|
451
|
+
const tagInfo = computed(() => {
|
|
452
|
+
return props.info.main_repository_language || [];
|
|
453
|
+
});
|
|
454
|
+
const handleTopicClick = (topic) => {
|
|
455
|
+
router.push({
|
|
456
|
+
path: "/search",
|
|
457
|
+
query: {
|
|
458
|
+
q: topic.name,
|
|
459
|
+
type: "tag"
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
const queryLoading = ref(true);
|
|
464
|
+
function handleQueryGraph() {
|
|
465
|
+
API.queryGraph({ repoId: props.info.id, p: 1 }).then((res) => {
|
|
466
|
+
var _a;
|
|
467
|
+
const { commit_stat = [], trends = {} } = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.data) || {};
|
|
468
|
+
graphInfo.commit_stat = commit_stat;
|
|
469
|
+
graphInfo.trends = trends;
|
|
470
|
+
}).finally(() => {
|
|
471
|
+
queryLoading.value = false;
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
const preHandWord = () => {
|
|
475
|
+
var _a;
|
|
476
|
+
const { keyword, info } = props;
|
|
477
|
+
const {
|
|
478
|
+
name_with_namespace: nameWithSpace,
|
|
479
|
+
path_with_namespace: path,
|
|
480
|
+
import_url: importUrl,
|
|
481
|
+
is_gh_mirrors: isGhMirrors,
|
|
482
|
+
is_mirrors: isMirrors
|
|
483
|
+
} = info || {};
|
|
484
|
+
const isGitcodeRepo = REPO_TYPE.GITCODE === isMirrors;
|
|
485
|
+
const content = (!isGitcodeRepo ? extractRepoInfoWithURL(importUrl) : nameWithSpace) || nameWithSpace;
|
|
486
|
+
const contentArr = formatNameSpace(content);
|
|
487
|
+
const pathArr = ((_a = path == null ? void 0 : path.replace(/\s+/g, "")) == null ? void 0 : _a.split("/")) || [];
|
|
488
|
+
if (pathArr[0] === "gh_mirrors" && pathArr.length === 3 && contentArr.length === 3) {
|
|
489
|
+
contentArr.splice(1, 1);
|
|
490
|
+
}
|
|
491
|
+
return highlightWords(keyword, contentArr.join("/"), true);
|
|
492
|
+
};
|
|
493
|
+
onMounted(() => {
|
|
494
|
+
if (props.info.is_recommend && props.info.index === 0)
|
|
495
|
+
handleQueryGraph();
|
|
496
|
+
});
|
|
497
|
+
return (_ctx, _cache) => {
|
|
498
|
+
const _component_d_col = resolveComponent("d-col");
|
|
499
|
+
const _component_d_row = resolveComponent("d-row");
|
|
500
|
+
const _component_DSkeletonItem = resolveComponent("DSkeletonItem");
|
|
501
|
+
const _component_d_skeleton = resolveComponent("d-skeleton");
|
|
502
|
+
return openBlock(), createElementBlock("a", {
|
|
503
|
+
class: normalizeClass(["i-search-projects-card", { noborder: _ctx.noborder, "full-hover": _ctx.hover }]),
|
|
504
|
+
onClick: handleClick
|
|
505
|
+
}, [
|
|
506
|
+
createVNode(_component_d_row, { class: "i-search-projects-card-title mb-[8px]" }, {
|
|
507
|
+
default: withCtx(() => [
|
|
508
|
+
createVNode(_component_d_col, {
|
|
509
|
+
class: "ellipsis",
|
|
510
|
+
flex: "auto"
|
|
511
|
+
}, {
|
|
512
|
+
default: withCtx(() => [
|
|
513
|
+
createVNode(Icon, {
|
|
514
|
+
class: normalizeClass(["mr-[8px]", { "align-middle": _ctx.info.is_gh_mirrors }]),
|
|
515
|
+
name: iconName.value,
|
|
516
|
+
color: "var(--theme-placeholder)"
|
|
517
|
+
}, null, 8, ["name", "class"]),
|
|
518
|
+
createElementVNode("span", {
|
|
519
|
+
class: "repo-title",
|
|
520
|
+
innerHTML: preHandWord()
|
|
521
|
+
}, null, 8, _hoisted_1$1),
|
|
522
|
+
_ctx.info.show_recommend_icon ? (openBlock(), createElementBlock("span", _hoisted_2$1, toDisplayString(unref($t)("search.recommendTag")), 1)) : createCommentVNode("", true)
|
|
523
|
+
]),
|
|
524
|
+
_: 1
|
|
525
|
+
}),
|
|
526
|
+
createVNode(_component_d_col, { flex: "none" }, {
|
|
527
|
+
default: withCtx(() => [
|
|
528
|
+
createVNode(StarTag, {
|
|
529
|
+
"star-info": starInfo.value,
|
|
530
|
+
onReport: handleStarReport
|
|
531
|
+
}, null, 8, ["star-info"])
|
|
532
|
+
]),
|
|
533
|
+
_: 1
|
|
534
|
+
})
|
|
535
|
+
]),
|
|
536
|
+
_: 1
|
|
537
|
+
}),
|
|
538
|
+
createElementVNode("div", {
|
|
539
|
+
innerHTML: unref(highlightWords)("", _ctx.info.description),
|
|
540
|
+
class: "i-search-projects-card-desc ellipsis"
|
|
541
|
+
}, null, 8, _hoisted_3$1),
|
|
542
|
+
_ctx.info.index === 0 && _ctx.info.is_recommend ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
|
|
543
|
+
queryLoading.value ? (openBlock(), createBlock(_component_d_skeleton, { key: 0 }, {
|
|
544
|
+
placeholder: withCtx(() => [
|
|
545
|
+
createVNode(_component_d_row, {
|
|
546
|
+
gutter: 16,
|
|
547
|
+
wrap: true
|
|
548
|
+
}, {
|
|
549
|
+
default: withCtx(() => [
|
|
550
|
+
createVNode(_component_d_col, {
|
|
551
|
+
span: rowSpan[unref(widthType)]
|
|
552
|
+
}, {
|
|
553
|
+
default: withCtx(() => [
|
|
554
|
+
createVNode(_component_DSkeletonItem, { class: "h-[110px] mt-[16px]" })
|
|
555
|
+
]),
|
|
556
|
+
_: 1
|
|
557
|
+
}, 8, ["span"]),
|
|
558
|
+
createVNode(_component_d_col, {
|
|
559
|
+
span: rowSpan[unref(widthType)]
|
|
560
|
+
}, {
|
|
561
|
+
default: withCtx(() => [
|
|
562
|
+
createVNode(_component_DSkeletonItem, { class: "h-[110px] mt-[16px]" })
|
|
563
|
+
]),
|
|
564
|
+
_: 1
|
|
565
|
+
}, 8, ["span"]),
|
|
566
|
+
createVNode(_component_d_col, {
|
|
567
|
+
span: rowSpan[unref(widthType)]
|
|
568
|
+
}, {
|
|
569
|
+
default: withCtx(() => [
|
|
570
|
+
createVNode(_component_DSkeletonItem, { class: "h-[110px] mt-[16px]" })
|
|
571
|
+
]),
|
|
572
|
+
_: 1
|
|
573
|
+
}, 8, ["span"])
|
|
574
|
+
]),
|
|
575
|
+
_: 1
|
|
576
|
+
})
|
|
577
|
+
]),
|
|
578
|
+
_: 1
|
|
579
|
+
})) : createCommentVNode("", true)
|
|
580
|
+
])) : (openBlock(), createBlock(RepoCardFooter, {
|
|
581
|
+
key: 1,
|
|
582
|
+
hideTopicTags: _ctx.hideTopicTags,
|
|
583
|
+
hideStarCount: "",
|
|
584
|
+
tagInfo: tagInfo.value,
|
|
585
|
+
repoInfo: _ctx.info,
|
|
586
|
+
searchCard: "",
|
|
587
|
+
class: "i-search-projects-card-bottom mt-[8px]",
|
|
588
|
+
onTopicClick: handleTopicClick
|
|
589
|
+
}, null, 8, ["hideTopicTags", "tagInfo", "repoInfo"]))
|
|
590
|
+
], 2);
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
const index_vue_vue_type_style_index_0_scoped_d350880d_lang = "";
|
|
595
|
+
const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d350880d"]]);
|
|
596
|
+
const _hoisted_1 = { class: "g-header-search-recommed" };
|
|
597
|
+
const _hoisted_2 = { key: 0 };
|
|
598
|
+
const _hoisted_3 = { class: "g-header-search-recommed-title" };
|
|
599
|
+
const _hoisted_4 = { key: 1 };
|
|
600
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
601
|
+
__name: "SearchRecommed",
|
|
602
|
+
setup(__props) {
|
|
603
|
+
const API = headRequest(inject("request"));
|
|
604
|
+
const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
|
|
605
|
+
const recommendRepoList = ref([]);
|
|
606
|
+
const handleReport = (repo, index, evt) => {
|
|
607
|
+
const params = evt === "starReport" ? {
|
|
608
|
+
module_name: REPO_MODULE.SEARCH_RECOMMEND_CARD,
|
|
609
|
+
repo_id: repo.id,
|
|
610
|
+
Project_card_star: "star",
|
|
611
|
+
repo_index: index
|
|
612
|
+
} : { module_name: REPO_MODULE.SEARCH_RECOMMEND_CARD, repo_id: repo.id, repo_index: index };
|
|
613
|
+
useReport(REPO_EVENT.CLICK, params, () => {
|
|
614
|
+
});
|
|
615
|
+
};
|
|
616
|
+
const getRecommendRepo = async () => {
|
|
617
|
+
var _a;
|
|
618
|
+
const channel_id = "67bc3f5f97a0293d6bfebd01";
|
|
619
|
+
const params = { channel_id, sub_channel_id: "", page: 1, per_page: 20, sort: "star_cnt_desc", repo_type: -1 };
|
|
620
|
+
const res = await API.openSourceProject(params);
|
|
621
|
+
const data = (((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.content) || []).filter((item) => item.source_type !== "github-trending").slice(0, 5);
|
|
622
|
+
data.forEach((item, index) => {
|
|
623
|
+
triggerReport("expo", { ...item, index });
|
|
624
|
+
});
|
|
625
|
+
recommendRepoList.value = data;
|
|
626
|
+
};
|
|
627
|
+
onMounted(() => {
|
|
628
|
+
console.log("onMounted");
|
|
629
|
+
getRecommendRepo();
|
|
630
|
+
});
|
|
631
|
+
return (_ctx, _cache) => {
|
|
632
|
+
const _component_DSkeletonItem = resolveComponent("DSkeletonItem");
|
|
633
|
+
const _component_d_col = resolveComponent("d-col");
|
|
634
|
+
const _component_d_row = resolveComponent("d-row");
|
|
635
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
636
|
+
recommendRepoList.value.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
637
|
+
createElementVNode("div", _hoisted_3, toDisplayString(_ctx.$t("search.trendingToday")), 1),
|
|
638
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(recommendRepoList.value, (item, index) => {
|
|
639
|
+
return openBlock(), createBlock(SearchRepoCard, {
|
|
640
|
+
key: item.id,
|
|
641
|
+
class: "mb-[8px]",
|
|
642
|
+
info: { ...item, index },
|
|
643
|
+
keyword: "",
|
|
644
|
+
hover: "",
|
|
645
|
+
hideTopicTags: "",
|
|
646
|
+
onReport: (evt) => handleReport(item, index, evt),
|
|
647
|
+
cardType: "repo",
|
|
648
|
+
"url-params": { source_module: "today_trending" }
|
|
649
|
+
}, null, 8, ["info", "onReport"]);
|
|
650
|
+
}), 128))
|
|
651
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
652
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(5, (item) => {
|
|
653
|
+
return createElementVNode("div", {
|
|
654
|
+
class: "pt-[8px] pb-[16px]",
|
|
655
|
+
key: item
|
|
656
|
+
}, [
|
|
657
|
+
createVNode(_component_d_row, {
|
|
658
|
+
align: "middle",
|
|
659
|
+
gutter: 16
|
|
660
|
+
}, {
|
|
661
|
+
default: withCtx(() => [
|
|
662
|
+
createVNode(_component_d_col, { flex: "auto" }, {
|
|
663
|
+
default: withCtx(() => [
|
|
664
|
+
createVNode(_component_DSkeletonItem, { style: { "width": "50%", "height": "20px" } })
|
|
665
|
+
]),
|
|
666
|
+
_: 1
|
|
667
|
+
}),
|
|
668
|
+
createVNode(_component_d_col, { flex: "none" }, {
|
|
669
|
+
default: withCtx(() => [
|
|
670
|
+
createVNode(_component_DSkeletonItem, { style: { "width": "40px", "height": "20px" } })
|
|
671
|
+
]),
|
|
672
|
+
_: 1
|
|
673
|
+
})
|
|
674
|
+
]),
|
|
675
|
+
_: 1
|
|
676
|
+
}),
|
|
677
|
+
createVNode(_component_d_row, {
|
|
678
|
+
class: "mt-[12px]",
|
|
679
|
+
align: "middle",
|
|
680
|
+
gutter: 16
|
|
681
|
+
}, {
|
|
682
|
+
default: withCtx(() => [
|
|
683
|
+
createVNode(_component_d_col, { flex: "auto" }, {
|
|
684
|
+
default: withCtx(() => [
|
|
685
|
+
createVNode(_component_DSkeletonItem, { style: { "width": "80%", "height": "20px" } })
|
|
686
|
+
]),
|
|
687
|
+
_: 1
|
|
688
|
+
})
|
|
689
|
+
]),
|
|
690
|
+
_: 1
|
|
691
|
+
}),
|
|
692
|
+
createVNode(_component_d_row, {
|
|
693
|
+
class: "mt-[12px]",
|
|
694
|
+
align: "middle",
|
|
695
|
+
gutter: 16
|
|
696
|
+
}, {
|
|
697
|
+
default: withCtx(() => [
|
|
698
|
+
createVNode(_component_d_col, { flex: "none" }, {
|
|
699
|
+
default: withCtx(() => [
|
|
700
|
+
createVNode(_component_DSkeletonItem, { style: { "width": "50px", "height": "20px", "border-radius": "20px" } })
|
|
701
|
+
]),
|
|
702
|
+
_: 1
|
|
703
|
+
}),
|
|
704
|
+
createVNode(_component_d_col, { flex: "none" }, {
|
|
705
|
+
default: withCtx(() => [
|
|
706
|
+
createVNode(_component_DSkeletonItem, { style: { "width": "60px", "height": "20px" } })
|
|
707
|
+
]),
|
|
708
|
+
_: 1
|
|
709
|
+
})
|
|
710
|
+
]),
|
|
711
|
+
_: 1
|
|
712
|
+
})
|
|
713
|
+
]);
|
|
714
|
+
}), 64))
|
|
715
|
+
]))
|
|
716
|
+
]);
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
});
|
|
720
|
+
const SearchRecommed_vue_vue_type_style_index_0_scoped_b0c9e3bd_lang = "";
|
|
721
|
+
const SearchRecommed = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b0c9e3bd"]]);
|
|
722
|
+
export {
|
|
723
|
+
SearchRecommed as default
|
|
724
|
+
};
|