vue-layout-gitcode 1.7.3 → 1.7.5

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,10 +1,10 @@
1
1
  import { defineComponent, inject, createElementBlock, openBlock, Fragment, createElementVNode, toDisplayString, createVNode, unref, renderList, withDirectives, createBlock, ref, watch, onMounted, createCommentVNode } from "vue";
2
2
  import "vue-devui-lal/icon";
3
3
  import "vue-devui-lal/icon/style.css";
4
- 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-Cb7tqq6l.js";
4
+ 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-EVcYEXJG.js";
5
5
  import "lodash/debounce";
6
- import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-CVWIlvsn.js";
7
- import "./transWebUrl-BChMu1HZ.js";
6
+ import { u as useReportRepo, S as SearchRepoCard, f as formatNameSpace } from "./index-heJJmvdb.js";
7
+ import "./transWebUrl-CtGzCYga.js";
8
8
  import "vue-devui-lal/tooltip";
9
9
  import "vue-devui-lal/tooltip/style.css";
10
10
  import "vue-router";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, inject, useSlots, ref, computed, createBlock, openBlock, unref, withCtx, createElementVNode, normalizeClass, createElementBlock, createTextVNode, createCommentVNode, toDisplayString, renderSlot } from "vue";
2
- import { q as useLayoutConfig, w as ThemeType, x as currentTheme, g as LANG_ZH, y as LANG_EN, z as getLocaleLang, G as GIcon, A as emitEvent, B as isHttps, b as REPO_EVENT, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { q as useLayoutConfig, x as ThemeType, y as currentTheme, g as LANG_ZH, z as LANG_EN, w as getLocaleLang, G as GIcon, A as emitEvent, B as isHttps, b as REPO_EVENT, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import { useRouter } from "vue-router";
4
4
  import { Popover } from "vue-devui-lal/popover";
5
5
  import "vue-devui-lal/popover/style.css";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, ref, reactive, watch, computed, createElementBlock, openBlock, createCommentVNode, createBlock, withDirectives, Fragment, createElementVNode, createVNode, toDisplayString, unref, withModifiers, normalizeClass, withCtx, renderList, createTextVNode, vShow } from "vue";
2
- import { a as i18n, q as useLayoutConfig, G as GIcon, C as _sfc_main$1, D as loadAsideData, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, F as asideRequest, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, q as useLayoutConfig, G as GIcon, C as _sfc_main$1, D as loadAsideData, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, F as asideRequest, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-BChMu1HZ.js";
4
+ import { t as transWebUrl } from "./transWebUrl-CtGzCYga.js";
5
5
  import { Select, Option } from "vue-devui-lal/select";
6
6
  import { Input } from "vue-devui-lal/input";
7
7
  import { Skeleton } from "vue-devui-lal/skeleton";
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, inject, ref, reactive, computed, watch, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withDirectives, toDisplayString, unref, withModifiers, normalizeClass, withCtx, Fragment, renderList, createTextVNode, vShow } from "vue";
2
- import { a as i18n, q as useLayoutConfig, G as GIcon, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, q as useLayoutConfig, G as GIcon, A as emitEvent, s as setLoginTriggerSource, d as useRequestReport, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import { useRouter } from "vue-router";
4
- import { t as transWebUrl } from "./transWebUrl-BChMu1HZ.js";
4
+ import { t as transWebUrl } from "./transWebUrl-CtGzCYga.js";
5
5
  import { Input } from "vue-devui-lal/input";
6
6
  import { Skeleton } from "vue-devui-lal/skeleton";
7
7
  import { MenuItem } from "vue-devui-lal/menu";
@@ -1,5 +1,5 @@
1
1
  import { ref, inject, computed, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
2
- import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, h as headRequest, G as GIcon, r as reqCatch } from "./index-EVcYEXJG.js";
3
3
  import { useRoute, useRouter } from "vue-router";
4
4
  import "vue-devui-lal/icon";
5
5
  import "vue-devui-lal/icon/style.css";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, createElementBlock, openBlock, createCommentVNode, Fragment, renderList, normalizeClass, createElementVNode, createVNode, toDisplayString, withModifiers } from "vue";
2
- import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "history-list" };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createElementBlock, openBlock, createElementVNode, withDirectives, toDisplayString, withModifiers, createVNode, vShow } from "vue";
2
- import { G as GIcon, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { G as GIcon, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "ellipsis" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, inject, ref, onMounted, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, renderSlot, createBlock, createVNode, withCtx } from "vue";
2
- import { u as useReportRepo, S as SearchRepoCard } from "./index-CVWIlvsn.js";
3
- import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { u as useReportRepo, S as SearchRepoCard } from "./index-heJJmvdb.js";
3
+ import { a as i18n, h as headRequest, R as REPO_MODULE, b as REPO_EVENT, l as localStorage, _ as _export_sfc } from "./index-EVcYEXJG.js";
4
4
  import { Row, Col } from "vue-devui-lal/grid";
5
5
  import { SkeletonItem } from "vue-devui-lal/skeleton";
6
6
  import "vue-devui-lal/grid/style.css";
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, createElementBlock, openBlock, Fragment, renderList, createElementVNode, createVNode, createCommentVNode, toDisplayString, unref } from "vue";
2
- import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, G as GIcon, _ as _export_sfc } from "./index-EVcYEXJG.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = ["onClick"];
@@ -1,5 +1,5 @@
1
1
  import { inject, ref, watch, withDirectives, createElementBlock, openBlock, createElementVNode, toDisplayString, unref, Fragment, renderList, createVNode, vShow } from "vue";
2
- import { a as i18n, h as headRequest, G as GIcon } from "./index-Cb7tqq6l.js";
2
+ import { a as i18n, h as headRequest, G as GIcon } from "./index-EVcYEXJG.js";
3
3
  import "vue-devui-lal/icon";
4
4
  import "vue-devui-lal/icon/style.css";
5
5
  const _hoisted_1 = { class: "px-[8px] history-list-project pl-[8px]" };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, onMounted, createBlock, openBlock, unref, withCtx, createElementVNode } from "vue";
2
2
  import { FixedOverlay } from "vue-devui-lal/overlay";
3
- import { q as useLayoutConfig, _ as _export_sfc } from "./index-Cb7tqq6l.js";
3
+ import { q as useLayoutConfig, _ as _export_sfc } from "./index-EVcYEXJG.js";
4
4
  import "vue-devui-lal/overlay/style.css";
5
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
6
6
  __name: "index",
@@ -49,8 +49,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
49
  default: withCtx(() => _cache[0] || (_cache[0] = [
50
50
  createElementVNode("div", { id: "captcha-box" }, null, -1)
51
51
  ])),
52
- _: 1,
53
- __: [0]
52
+ _: 1
54
53
  });
55
54
  };
56
55
  }
@@ -0,0 +1,265 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { defineComponent, ref, onMounted, onBeforeUnmount, createBlock, openBlock, unref, withCtx, createElementVNode, withDirectives, createVNode, vShow, nextTick } from "vue";
5
+ import { Button } from "vue-devui-lal/button";
6
+ import "vue-devui-lal/button/style.css";
7
+ import { Message } from "vue-devui-lal/message";
8
+ import "vue-devui-lal/message/style.css";
9
+ import { FixedOverlay } from "vue-devui-lal/overlay";
10
+ import "vue-devui-lal/overlay/style.css";
11
+ import { a as i18n, j as usePageResize, w as getLocaleLang, g as LANG_ZH, _ as _export_sfc } from "./index-EVcYEXJG.js";
12
+ const _YunpianCaptchaManager = class _YunpianCaptchaManager {
13
+ constructor() {
14
+ __publicField(this, "ypRiddlerInstance", null);
15
+ __publicField(this, "isScriptLoaded", false);
16
+ }
17
+ static getInstance() {
18
+ if (!_YunpianCaptchaManager.instance) {
19
+ _YunpianCaptchaManager.instance = new _YunpianCaptchaManager();
20
+ }
21
+ return _YunpianCaptchaManager.instance;
22
+ }
23
+ /**
24
+ * 加载 YpRiddler 脚本
25
+ */
26
+ loadYpRiddlerScript(retryCount = 0) {
27
+ return new Promise((resolve, reject) => {
28
+ if (this.isScriptLoaded && window.YpRiddler) {
29
+ resolve();
30
+ return;
31
+ }
32
+ const script = document.createElement("script");
33
+ script.type = "text/javascript";
34
+ script.src = "https://cdn-static.gitcode.com/js/yunpian/riddler-sdk-0.2.2.js";
35
+ script.onload = () => {
36
+ setTimeout(() => {
37
+ if (window.YpRiddler) {
38
+ this.isScriptLoaded = true;
39
+ resolve();
40
+ } else {
41
+ reject(new Error("YpRiddler 初始化失败"));
42
+ }
43
+ }, 200);
44
+ };
45
+ script.onerror = () => {
46
+ if (retryCount < 2) {
47
+ console.warn(`YpRiddler 脚本加载失败,正在重试 (${retryCount + 1}/2)`);
48
+ setTimeout(() => {
49
+ this.loadYpRiddlerScript(retryCount + 1).then(resolve).catch(reject);
50
+ }, 1e3);
51
+ } else {
52
+ reject(new Error("脚本加载失败,已达到最大重试次数"));
53
+ }
54
+ };
55
+ document.head.appendChild(script);
56
+ });
57
+ }
58
+ /**
59
+ * 初始化 YpRiddler 实例
60
+ */
61
+ async initYpRiddler(config) {
62
+ if (this.ypRiddlerInstance) {
63
+ console.log("YpRiddler 实例已存在,无需重复初始化");
64
+ return;
65
+ }
66
+ if (!config.container) {
67
+ throw new Error("YpRiddler 配置缺少必需的 container 元素");
68
+ }
69
+ if (!config.appId) {
70
+ throw new Error("YpRiddler 配置缺少必需的 appId");
71
+ }
72
+ if (!window.YpRiddler) {
73
+ try {
74
+ await this.loadYpRiddlerScript();
75
+ } catch (error) {
76
+ console.error("加载 YpRiddler 脚本失败:", error);
77
+ throw error;
78
+ }
79
+ }
80
+ try {
81
+ if (!window.YpRiddler) {
82
+ throw new Error("YpRiddler 构造函数不可用");
83
+ }
84
+ this.ypRiddlerInstance = new window.YpRiddler(config);
85
+ console.log("YpRiddler 全局实例创建成功");
86
+ } catch (error) {
87
+ console.error("创建 YpRiddler 实例失败:", error);
88
+ this.ypRiddlerInstance = null;
89
+ throw error;
90
+ }
91
+ }
92
+ /**
93
+ * 销毁 YpRiddler 实例
94
+ */
95
+ destroyYpRiddler() {
96
+ if (this.ypRiddlerInstance) {
97
+ try {
98
+ if (typeof this.ypRiddlerInstance.destroy === "function") {
99
+ this.ypRiddlerInstance.destroy();
100
+ }
101
+ this.ypRiddlerInstance = null;
102
+ console.log("YpRiddler 实例已销毁");
103
+ } catch (error) {
104
+ console.error("销毁 YpRiddler 实例失败:", error);
105
+ }
106
+ }
107
+ }
108
+ /**
109
+ * 获取当前实例状态
110
+ */
111
+ hasInstance() {
112
+ return !!this.ypRiddlerInstance;
113
+ }
114
+ /**
115
+ * 重新初始化(用于更新配置)
116
+ */
117
+ async reinitialize(config) {
118
+ this.destroyYpRiddler();
119
+ await this.initYpRiddler(config);
120
+ }
121
+ };
122
+ __publicField(_YunpianCaptchaManager, "instance");
123
+ let YunpianCaptchaManager = _YunpianCaptchaManager;
124
+ const yunpianCaptchaManager = YunpianCaptchaManager.getInstance();
125
+ const _hoisted_1 = { id: "captcha-box" };
126
+ const _sfc_main = /* @__PURE__ */ defineComponent({
127
+ ...{ name: "YunpianCaptcha" },
128
+ __name: "index",
129
+ emits: ["close", "success", "fallback"],
130
+ setup(__props, { emit: __emit }) {
131
+ const { t } = i18n.global;
132
+ const { isMobile } = usePageResize();
133
+ const isZh = getLocaleLang() === LANG_ZH;
134
+ const emits = __emit;
135
+ const showCloseBtn = ref(false);
136
+ const yunpianConfig = {
137
+ APP_ID: "52d567a6a5b0423b98e072724f620578",
138
+ // 云片行为验证,appId
139
+ EXPIRED_TIME: 15
140
+ // 过期时间,单位为秒
141
+ };
142
+ const captchaInit = async () => {
143
+ const config = {
144
+ appId: yunpianConfig["APP_ID"],
145
+ expired: yunpianConfig["EXPIRED_TIME"],
146
+ version: "v1",
147
+ mode: "flat",
148
+ winWidth: isMobile.value ? "90%" : 420,
149
+ container: document.getElementById("captcha-box"),
150
+ lang: isZh ? "zh-cn" : "en",
151
+ onSuccess: function(validInfo, close, useDefaultSuccess) {
152
+ useDefaultSuccess.call(null, true);
153
+ emits("success", validInfo);
154
+ yunpianCaptchaManager.destroyYpRiddler();
155
+ close();
156
+ },
157
+ onFail: function(code, msg, _retry) {
158
+ console.error("出错啦:" + msg + " code: " + code);
159
+ let resultElement = document.querySelector(".yp-riddler-result");
160
+ if (!resultElement) {
161
+ const container = document.querySelector(".yp-riddler-slide-img-container");
162
+ if (container) {
163
+ resultElement = document.createElement("div");
164
+ resultElement.className = "yp-riddler-result";
165
+ container.appendChild(resultElement);
166
+ }
167
+ }
168
+ if (resultElement) {
169
+ resultElement.classList.add("yp-riddler-result-error");
170
+ resultElement.textContent = isZh ? "验证错误,请重试" : "Verification failed, please try again";
171
+ setTimeout(() => {
172
+ resultElement.classList.remove("yp-riddler-result-error");
173
+ resultElement.textContent = "";
174
+ yunpianCaptchaManager.destroyYpRiddler();
175
+ }, 1500);
176
+ } else {
177
+ Message.info(isZh ? "验证失败" : "Verification failed");
178
+ }
179
+ },
180
+ onError: function(param) {
181
+ console.error("出错啦:" + param);
182
+ yunpianCaptchaManager.destroyYpRiddler();
183
+ emits("fallback");
184
+ if (!param.code) {
185
+ console.error("错误请求");
186
+ } else if (parseInt(String(param.code), 10) / 100 === 5) {
187
+ console.error("验证服务暂不可用");
188
+ } else if (param.code === 429) {
189
+ console.warn("请求过于频繁,请稍后再试");
190
+ } else if (param.code == 403) {
191
+ console.warn("请求受限,请稍后再试");
192
+ } else if (param.code == 400) {
193
+ console.warn("非法请求,请检查参数");
194
+ } else if (param.code == 531) {
195
+ yunpianCaptchaManager.destroyYpRiddler();
196
+ emits("fallback");
197
+ }
198
+ }
199
+ };
200
+ try {
201
+ await yunpianCaptchaManager.initYpRiddler(config);
202
+ nextTick(() => {
203
+ const checkCaptchaLoaded = () => {
204
+ const captchaContent = document.querySelector(".yp-riddler");
205
+ if (captchaContent) {
206
+ showCloseBtn.value = true;
207
+ } else {
208
+ setTimeout(checkCaptchaLoaded, 100);
209
+ }
210
+ };
211
+ setTimeout(checkCaptchaLoaded, 300);
212
+ setTimeout(() => {
213
+ showCloseBtn.value = true;
214
+ }, 3e3);
215
+ });
216
+ } catch (error) {
217
+ console.error("初始化 YpRiddler 失败:", error);
218
+ emits("close");
219
+ }
220
+ };
221
+ onMounted(() => {
222
+ captchaInit();
223
+ });
224
+ onBeforeUnmount(() => {
225
+ const captchaBox = document.getElementById("captcha-box");
226
+ if (captchaBox) {
227
+ const children = Array.from(captchaBox.children);
228
+ children.forEach((child) => {
229
+ if (!child.classList.contains("close-btn")) {
230
+ child.remove();
231
+ }
232
+ });
233
+ }
234
+ });
235
+ const closeOverlay = () => {
236
+ yunpianCaptchaManager.destroyYpRiddler();
237
+ emits("close");
238
+ };
239
+ return (_ctx, _cache) => {
240
+ return openBlock(), createBlock(unref(FixedOverlay), {
241
+ class: "captcha-overlay",
242
+ "close-on-click-overlay": ""
243
+ }, {
244
+ default: withCtx(() => [
245
+ createElementVNode("div", _hoisted_1, [
246
+ withDirectives(createVNode(unref(Button), {
247
+ class: "close-btn",
248
+ variant: "text",
249
+ icon: "close",
250
+ onClick: closeOverlay,
251
+ title: unref(t)("gitCodeLayout.common.close")
252
+ }, null, 8, ["title"]), [
253
+ [vShow, showCloseBtn.value]
254
+ ])
255
+ ])
256
+ ]),
257
+ _: 1
258
+ });
259
+ };
260
+ }
261
+ });
262
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-vue-layout-gitcode"]]);
263
+ export {
264
+ index as default
265
+ };