vue-layout-gitcode 1.12.15-beta.45 → 1.12.15-beta.46

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.
@@ -1,4 +1,4 @@
1
- import { z as useLayoutConfig } from "./index-B06erXIQ.js";
1
+ import { z as useLayoutConfig } from "./index-DUe_D3tb.js";
2
2
  const layoutConfig = useLayoutConfig();
3
3
  const transWebUrl = (url, params) => {
4
4
  if (!url) return url;
@@ -1,7 +1,6 @@
1
- import { ref, watchEffect, defineComponent, toDisplayString, unref, useModel, watch, openBlock, createElementBlock, createVNode, normalizeClass, withDirectives, createElementVNode, vShow, mergeModels, inject, withModifiers, createBlock, Fragment, computed, normalizeStyle, createCommentVNode, createTextVNode, onMounted, onUnmounted, renderList, withCtx, reactive } from "vue";
2
- import debounce from "lodash/debounce";
3
- import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, r as reqCatch, f as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, o as _sfc_main$b, p as isIncubationRepo, q as highlightWords, t as transformUrl, w as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, x as LANG_KEY } from "./index-B06erXIQ.js";
4
- import { t as transWebUrl } from "./transWebUrl-DSuwNHaC.js";
1
+ import { defineComponent, toDisplayString, unref, useModel, ref, watch, openBlock, createElementBlock, createVNode, normalizeClass, withDirectives, createElementVNode, vShow, mergeModels, inject, withModifiers, createBlock, Fragment, computed, normalizeStyle, createCommentVNode, createTextVNode, onMounted, onUnmounted, renderList, withCtx, reactive, watchEffect } from "vue";
2
+ import { d as transferNumber, G as GIcon, _ as _export_sfc, s as setLoginTriggerSource, r as reqCatch, f as useRequestReport, h as headRequest, a as i18n, T as TOPIC_TYPE, g as useTimeFormat, j as useCookie, k as usePageResize, L as LANG_ZH, m as isGstarRepo, o as _sfc_main$b, p as isIncubationRepo, q as highlightWords, t as transformUrl, w as _frEventTrack, E as EVENT_NAME, c as REPO_TYPE, e as extractRepoInfoWithURL, x as LANG_KEY } from "./index-DUe_D3tb.js";
3
+ import { t as transWebUrl } from "./transWebUrl-BRQANkzP.js";
5
4
  import { useRouter } from "vue-router";
6
5
  import { Row, Col } from "vue-devui-lal/grid";
7
6
  import { Skeleton, SkeletonItem } from "vue-devui-lal/skeleton";
@@ -9,74 +8,7 @@ import "vue-devui-lal/grid/style.css";
9
8
  import "vue-devui-lal/skeleton/style.css";
10
9
  import { Popover } from "vue-devui-lal/popover";
11
10
  import "vue-devui-lal/popover/style.css";
12
- const useReportRepo = (reportParams, viewReport) => {
13
- const list = ref([]);
14
- const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
15
- const locationHref = ref((window == null ? void 0 : window.location.href) || "");
16
- const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
17
- const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
18
- const triggerReport = (type, data) => {
19
- if (type === "click") {
20
- const params = {
21
- chat_title: "",
22
- related: {
23
- list: [formatItem(data)],
24
- type: "repo"
25
- }
26
- };
27
- viewReport(pageRef.value, locationHref.value, "click", params);
28
- } else if (type === "expo") {
29
- list.value.push(data);
30
- }
31
- };
32
- const formatItem = (data) => {
33
- const channelNames = [];
34
- if (data.channelName) channelNames.push(data.channelName);
35
- if (data.subChannelName) channelNames.push(data.subChannelName);
36
- const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
37
- return {
38
- type: "gitcode",
39
- repo_id: repoId,
40
- dest_url: data.web_url,
41
- strategy: channelNames.join("、") || "",
42
- // 官方项目
43
- repo_index: data.index,
44
- page: data.pageIndex || data.p || 0,
45
- per_page: data.pageSize || data.pp || 0,
46
- q: data.keyword || ""
47
- };
48
- };
49
- const doReport = debounce(() => {
50
- if (list.value.length >= 1) {
51
- const reportList = list.value.splice(0).map((item) => {
52
- return formatItem(item);
53
- });
54
- const params = {
55
- chat_title: "",
56
- extend_json: {
57
- key_words: keyword.value,
58
- module_name: moduleName.value
59
- },
60
- related: {
61
- list: reportList,
62
- type: "repo"
63
- }
64
- };
65
- viewReport(pageRef.value, locationHref.value, "expo", params);
66
- }
67
- }, 500, { leading: false });
68
- watchEffect(() => {
69
- if (list.value.length) {
70
- doReport();
71
- }
72
- });
73
- return {
74
- triggerReport
75
- };
76
- };
77
- const formatNameSpace = (content) => {
78
- return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
79
- };
11
+ import debounce from "lodash/debounce";
80
12
  const _sfc_main$a = /* @__PURE__ */ defineComponent({
81
13
  __name: "index",
82
14
  props: {
@@ -489,6 +421,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
489
421
  }
490
422
  });
491
423
  const RepoCardFooter = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-vue-layout-gitcode"]]);
424
+ const formatNameSpace = (content) => {
425
+ return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
426
+ };
492
427
  const _hoisted_1$2 = { class: "new-tag-content" };
493
428
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
494
429
  __name: "index",
@@ -851,6 +786,71 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
851
786
  }
852
787
  });
853
788
  const SearchRepoCard = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
789
+ const useReportRepo = (reportParams, viewReport) => {
790
+ const list = ref([]);
791
+ const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
792
+ const locationHref = ref((window == null ? void 0 : window.location.href) || "");
793
+ const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
794
+ const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
795
+ const triggerReport = (type, data) => {
796
+ if (type === "click") {
797
+ const params = {
798
+ chat_title: "",
799
+ related: {
800
+ list: [formatItem(data)],
801
+ type: "repo"
802
+ }
803
+ };
804
+ viewReport(pageRef.value, locationHref.value, "click", params);
805
+ } else if (type === "expo") {
806
+ list.value.push(data);
807
+ }
808
+ };
809
+ const formatItem = (data) => {
810
+ const channelNames = [];
811
+ if (data.channelName) channelNames.push(data.channelName);
812
+ if (data.subChannelName) channelNames.push(data.subChannelName);
813
+ const repoId = isNaN(Number(data.id)) ? data.id : Number(data.id);
814
+ return {
815
+ type: "gitcode",
816
+ repo_id: repoId,
817
+ dest_url: data.web_url,
818
+ strategy: channelNames.join("、") || "",
819
+ // 官方项目
820
+ repo_index: data.index,
821
+ page: data.pageIndex || data.p || 0,
822
+ per_page: data.pageSize || data.pp || 0,
823
+ q: data.keyword || ""
824
+ };
825
+ };
826
+ const doReport = debounce(() => {
827
+ if (list.value.length >= 1) {
828
+ const reportList = list.value.splice(0).map((item) => {
829
+ return formatItem(item);
830
+ });
831
+ const params = {
832
+ chat_title: "",
833
+ extend_json: {
834
+ key_words: keyword.value,
835
+ module_name: moduleName.value
836
+ },
837
+ related: {
838
+ list: reportList,
839
+ type: "repo"
840
+ }
841
+ };
842
+ viewReport(pageRef.value, locationHref.value, "expo", params);
843
+ }
844
+ }, 500, { leading: false });
845
+ watchEffect(() => {
846
+ if (list.value.length) {
847
+ doReport();
848
+ }
849
+ });
850
+ return {
851
+ triggerReport
852
+ };
853
+ };
854
854
  export {
855
855
  SearchRepoCard as S,
856
856
  formatNameSpace as f,
@@ -1,213 +0,0 @@
1
- import { defineComponent, inject, openBlock, createElementBlock, Fragment, createElementVNode, toDisplayString, unref, createVNode, renderList, withDirectives, createBlock, ref, watch, onMounted, createCommentVNode } from "vue";
2
- import { h as headRequest, R as REPO_MODULE, a as i18n, G as GIcon, v as vElementExposure, b as REPO_EVENT, _ as _export_sfc, c as REPO_TYPE, e as extractRepoInfoWithURL } from "./index-B06erXIQ.js";
3
- import "lodash/debounce";
4
- import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-CG_V0VzJ.js";
5
- import "./transWebUrl-DSuwNHaC.js";
6
- import "vue-devui-lal/tooltip";
7
- import "vue-devui-lal/tooltip/style.css";
8
- import "vue-router";
9
- import "vue-devui-lal/grid";
10
- import "vue-devui-lal/skeleton";
11
- import "vue-devui-lal/grid/style.css";
12
- import "vue-devui-lal/skeleton/style.css";
13
- import "vue-devui-lal/popover";
14
- import "vue-devui-lal/popover/style.css";
15
- import "vue-devui-lal/icon";
16
- import "vue-devui-lal/icon/style.css";
17
- const _hoisted_1$1 = { class: "search-repo-list-header" };
18
- const _hoisted_2$1 = { class: "title" };
19
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
20
- __name: "SearchRepoCardList",
21
- props: {
22
- dataList: {
23
- type: Array,
24
- default: () => []
25
- },
26
- searchStr: {
27
- type: String,
28
- default: ""
29
- },
30
- type: {
31
- type: String,
32
- default: ""
33
- },
34
- name: {
35
- type: String,
36
- default: ""
37
- }
38
- },
39
- emits: ["report"],
40
- setup(__props, { emit: __emit }) {
41
- const API = headRequest(inject("request"));
42
- const { triggerReport } = useReportRepo({ moduleName: REPO_MODULE.SEARCH_SUGGESTION_CARD }, API.viewReport);
43
- const { t: $t } = i18n.global;
44
- const useReport = inject("useReport");
45
- const emits = __emit;
46
- const handleReport = (item) => {
47
- useReport(REPO_EVENT.CLICK, { module_name: REPO_MODULE.SEARCH_SUGGESTION_CARD, repo_id: item.id });
48
- };
49
- const handleMore = () => {
50
- emits("more");
51
- };
52
- return (_ctx, _cache) => {
53
- return openBlock(), createElementBlock(Fragment, null, [
54
- createElementVNode("div", _hoisted_1$1, [
55
- createElementVNode("p", _hoisted_2$1, toDisplayString(__props.name), 1),
56
- createElementVNode("a", {
57
- class: "more-btn",
58
- onClick: handleMore
59
- }, [
60
- createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.common.more")), 1),
61
- createVNode(GIcon, {
62
- name: "gt-line-right",
63
- color: "var(--theme-placeholder)"
64
- })
65
- ])
66
- ]),
67
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.dataList, (item, index) => {
68
- return withDirectives((openBlock(), createBlock(SearchRepoCard, {
69
- key: item.id,
70
- class: "search-repo-list-card",
71
- info: { ...item, index },
72
- keyword: __props.searchStr,
73
- hover: "",
74
- hideTopicTags: "",
75
- hideStarBtn: "",
76
- hideFooter: "",
77
- hideDescription: "",
78
- onReport: () => handleReport(item),
79
- cardType: __props.type,
80
- "url-params": { source_module: "search_project" }
81
- }, null, 8, ["info", "keyword", "onReport", "cardType"])), [
82
- [unref(vElementExposure), { trigger: (type) => unref(triggerReport)(type, item) }]
83
- ]);
84
- }), 128))
85
- ], 64);
86
- };
87
- }
88
- });
89
- const SearchRepoCardList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-vue-layout-gitcode"]]);
90
- const _hoisted_1 = {
91
- key: 0,
92
- class: "history-list-project history-list-project--padded"
93
- };
94
- const _hoisted_2 = {
95
- key: 1,
96
- class: "history-list-project history-list-project--padded"
97
- };
98
- const _hoisted_3 = {
99
- key: 2,
100
- class: "history-list-project history-list-project--padded"
101
- };
102
- const _sfc_main = {
103
- __name: "GloabarSearch",
104
- props: ["searchStr"],
105
- emits: ["searchMore"],
106
- setup(__props, { emit: __emit }) {
107
- const emits = __emit;
108
- const { t: $t } = i18n.global;
109
- const API = headRequest(inject("request"));
110
- const useReport = inject("useReport");
111
- const projectList = ref([]);
112
- const datasetList = ref([]);
113
- const modelList = ref([]);
114
- const origin = window.location.origin;
115
- const props = __props;
116
- let timer = null;
117
- const convertDataList = (dataList) => {
118
- return dataList == null ? void 0 : dataList.slice(0, 5).map((item) => {
119
- const isGitcodeRepo = REPO_TYPE.GITCODE === item.is_mirrors;
120
- const repoName = (!isGitcodeRepo ? extractRepoInfoWithURL(item.import_url) : item.name_with_namespace) || item.name_with_namespace;
121
- const displayName = formatNameSpace(repoName).join("/");
122
- return {
123
- ...item,
124
- path: `${origin}/${item.path_with_namespace}`,
125
- displayName,
126
- web_url: `${origin}/${item.path_with_namespace}`
127
- };
128
- });
129
- };
130
- const handleMore = (type) => {
131
- emits("searchMore", type);
132
- };
133
- const getData = async () => {
134
- if (!props.searchStr) {
135
- return;
136
- }
137
- try {
138
- useReport("search-project", {});
139
- const res = await API.getGloabarSearchKeyLink({ q: props.searchStr });
140
- const { recommend_project = [], recommend_model = [], recommend_dataset = [] } = res.data || {};
141
- projectList.value = convertDataList(recommend_project);
142
- modelList.value = convertDataList(recommend_model);
143
- datasetList.value = convertDataList(recommend_dataset);
144
- } catch (error) {
145
- console.error("Failed to fetch search results:", error);
146
- projectList.value = [];
147
- modelList.value = [];
148
- datasetList.value = [];
149
- }
150
- };
151
- if (props.searchStr) {
152
- getData();
153
- }
154
- watch(
155
- () => props.searchStr,
156
- () => {
157
- if (timer) {
158
- clearTimeout(timer);
159
- }
160
- timer = setTimeout(() => {
161
- getData();
162
- }, 300);
163
- }
164
- );
165
- onMounted(() => {
166
- });
167
- return (_ctx, _cache) => {
168
- return openBlock(), createElementBlock(Fragment, null, [
169
- createElementVNode("button", {
170
- type: "button",
171
- class: "global-search-all",
172
- onClick: _cache[0] || (_cache[0] = ($event) => handleMore("all"))
173
- }, [
174
- createVNode(GIcon, {
175
- name: "gt-search",
176
- color: "var(--theme-placeholder)"
177
- }),
178
- createElementVNode("span", null, toDisplayString(unref($t)("gitCodeLayout.header.searchAll", { keyword: __props.searchStr })), 1)
179
- ]),
180
- projectList.value.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
181
- createVNode(SearchRepoCardList, {
182
- "data-list": projectList.value,
183
- "search-str": __props.searchStr,
184
- name: unref($t)("gitCodeLayout.header.repo"),
185
- type: "repo",
186
- onMore: _cache[1] || (_cache[1] = () => handleMore("repo"))
187
- }, null, 8, ["data-list", "search-str", "name"])
188
- ])) : createCommentVNode("", true),
189
- modelList.value.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
190
- createVNode(SearchRepoCardList, {
191
- "data-list": modelList.value,
192
- "search-str": __props.searchStr,
193
- name: unref($t)("gitCodeLayout.aihub.model"),
194
- type: "model",
195
- onMore: _cache[2] || (_cache[2] = () => handleMore("model"))
196
- }, null, 8, ["data-list", "search-str", "name"])
197
- ])) : createCommentVNode("", true),
198
- datasetList.value.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
199
- createVNode(SearchRepoCardList, {
200
- "data-list": datasetList.value,
201
- "search-str": __props.searchStr,
202
- name: unref($t)("gitCodeLayout.aihub.dataSet"),
203
- type: "dataset",
204
- onMore: _cache[3] || (_cache[3] = () => handleMore("dataset"))
205
- }, null, 8, ["data-list", "search-str", "name"])
206
- ])) : createCommentVNode("", true)
207
- ], 64);
208
- };
209
- }
210
- };
211
- export {
212
- _sfc_main as default
213
- };