vue-layout-gitcode 1.1.8 → 1.1.9

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,75 +0,0 @@
1
- import { ref, watchEffect } from "vue";
2
- import { k as debounce } from "./index-6fe144dc.js";
3
- const useReportRepo = (reportParams, viewReport) => {
4
- const list = ref([]);
5
- const pageRef = ref((window == null ? void 0 : window.page_ref) || "");
6
- const locationHref = ref((window == null ? void 0 : window.location.href) || "");
7
- const keyword = ref(reportParams == null ? void 0 : reportParams.keyword);
8
- const moduleName = ref(reportParams == null ? void 0 : reportParams.moduleName);
9
- const triggerReport = (type, data) => {
10
- if (type === "click") {
11
- const params = {
12
- chat_title: "",
13
- related: {
14
- list: [formatItem(data)],
15
- type: "repo"
16
- }
17
- };
18
- viewReport(pageRef.value, locationHref.value, "click", params);
19
- } else if (type === "expo") {
20
- list.value.push(data);
21
- }
22
- };
23
- const formatItem = (data) => {
24
- const channelNames = [];
25
- if (data.channelName)
26
- channelNames.push(data.channelName);
27
- if (data.subChannelName)
28
- channelNames.push(data.subChannelName);
29
- return {
30
- type: "gitcode",
31
- repo_id: data.id,
32
- dest_url: data.web_url,
33
- strategy: channelNames.join("、") || "",
34
- // 官方项目
35
- repo_index: data.index,
36
- page: data.pageIndex || data.p || 0,
37
- per_page: data.pageSize || data.pp || 0,
38
- q: data.keyword || ""
39
- };
40
- };
41
- const doReport = debounce(() => {
42
- if (list.value.length >= 1) {
43
- const reportList = list.value.splice(0).map((item) => {
44
- return formatItem(item);
45
- });
46
- const params = {
47
- chat_title: "",
48
- extend_json: {
49
- key_words: keyword.value,
50
- module_name: moduleName.value
51
- },
52
- related: {
53
- list: reportList,
54
- type: "repo"
55
- }
56
- };
57
- viewReport(pageRef.value, locationHref.value, "expo", params);
58
- }
59
- }, 500, { leading: false });
60
- watchEffect(() => {
61
- if (list.value.length) {
62
- doReport();
63
- }
64
- });
65
- return {
66
- triggerReport
67
- };
68
- };
69
- const formatNameSpace = (content) => {
70
- return content.trim().replace(/\s+/g, "").replace(/^(GitHub加速计划\/|HuggingFace镜像\/)/, "").split("/").filter(Boolean);
71
- };
72
- export {
73
- formatNameSpace as f,
74
- useReportRepo as u
75
- };