wi-chat 0.6.2 → 0.7.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/dist/core/index.cjs +1 -1
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.js +921 -342
- package/dist/core/useAnswerActions.d.ts +61 -0
- package/dist/core/useChat.d.ts +29 -3
- package/dist/core/useChatAuth.d.ts +175 -0
- package/dist/core/useChatRooms.d.ts +66 -0
- package/dist/core/useKeepAlive.d.ts +41 -0
- package/dist/core/useLlm.d.ts +73 -0
- package/dist/core/useRunningGroups.d.ts +58 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +119 -108
- package/dist/mobile-ui/chat/ChatContainer.vue.d.ts +3 -3
- package/dist/mobile-ui/inputbox/Inputbox.vue.d.ts +1 -1
- package/dist/parser/answerCom/generic/parseGeneric.d.ts +52 -0
- package/dist/parser/answerCom/generic/types.d.ts +75 -0
- package/dist/parser/answerCom/outputFile/parseOutputFile.d.ts +7 -6
- package/dist/parser/answerCom/outputFile/types.d.ts +15 -5
- package/dist/parser/answerCom/presentFiles/parsePresentFiles.d.ts +58 -0
- package/dist/parser/answerCom/presentFiles/types.d.ts +27 -0
- package/dist/parser/answerMeta.d.ts +71 -0
- package/dist/parser/deepThinking/parseDeepThinking.d.ts +8 -0
- package/dist/parser/history/history.d.ts +9 -0
- package/dist/parser/history/index.d.ts +1 -1
- package/dist/parser/index.cjs +6 -2
- package/dist/parser/index.d.ts +11 -2
- package/dist/parser/index.js +591 -366
- package/dist/parser/message.d.ts +9 -0
- package/dist/parser/runTime.d.ts +29 -0
- package/dist/renderers/TextAnswer-BgKGvG_o.cjs +2 -0
- package/dist/renderers/TextAnswer-PQwV3K7v.js +5 -0
- package/dist/renderers/answerCard/AnswerCard.vue.d.ts +65 -0
- package/dist/renderers/answerCard/AnswerToolbar.vue.d.ts +42 -0
- package/dist/renderers/answerConfig.d.ts +33 -0
- package/dist/renderers/deviceLastValue/DeviceLastValue.vue.d.ts +37 -0
- package/dist/renderers/index.cjs +6 -1
- package/dist/renderers/index.d.ts +14 -0
- package/dist/renderers/index.js +1485 -574
- package/dist/renderers/media/MediaAnswer.vue.d.ts +19 -0
- package/dist/renderers/outputFile/OutputFileLink.vue.d.ts +19 -0
- package/dist/renderers/outputFile/localFile.d.ts +46 -0
- package/dist/renderers/outputFile/useOutputFile.d.ts +32 -3
- package/dist/renderers/presentFiles/PresentFiles.vue.d.ts +19 -0
- package/dist/renderers/recordset/RecordsetView.vue.d.ts +19 -0
- package/dist/renderers/sqlQuery/SqlQuery.vue.d.ts +19 -0
- package/dist/renderers/style.css +1 -1
- package/dist/renderers/text/TextAnswer.vue.d.ts +19 -0
- package/dist/request/api.d.ts +121 -1
- package/dist/request/client.d.ts +12 -0
- package/dist/request/index.cjs +4 -2
- package/dist/request/index.d.ts +6 -4
- package/dist/request/index.js +780 -179
- package/dist/request/login.d.ts +36 -0
- package/dist/request/ws.d.ts +11 -86
- package/dist/request/wsCore.d.ts +104 -0
- package/dist/request/wsSession.d.ts +353 -0
- package/dist/right-panel/RightPanelTabs.vue.d.ts +4 -0
- package/dist/right-panel/index.cjs +1 -1
- package/dist/right-panel/index.d.ts +1 -1
- package/dist/right-panel/index.js +598 -499
- package/dist/right-panel/style.css +1 -1
- package/dist/right-panel/types.d.ts +10 -0
- package/dist/tools/index.cjs +5 -5
- package/dist/tools/index.d.ts +2 -2
- package/dist/tools/index.js +323 -208
- package/dist/tools/markdown/index.d.ts +2 -0
- package/dist/tools/markdown/interactions.d.ts +39 -0
- package/dist/tools/markdown/sanitize.d.ts +6 -0
- package/dist/tools/style.css +1 -1
- package/dist/web-ui/attach/AttachmentCard.vue.d.ts +1 -1
- package/dist/web-ui/attach/AttachmentList.vue.d.ts +1 -1
- package/dist/web-ui/chat/ChatContainer.vue.d.ts +5 -5
- package/dist/web-ui/envswitch/EnvSwitch.vue.d.ts +1 -1
- package/dist/web-ui/index.cjs +1 -1
- package/dist/web-ui/index.js +1 -1
- package/dist/web-ui/inputbox/Inputbox.vue.d.ts +5 -5
- package/dist/web-ui/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as K, computed as $, openBlock as h, createElementBlock as f, Fragment as G, renderList as X, ref as P, reactive as ce, onBeforeUnmount as We, createElementVNode as b, withModifiers as Q, normalizeClass as ue, createVNode as z, toDisplayString as W, createCommentVNode as D, createBlock as de, Teleport as De, normalizeStyle as pe, nextTick as _e, watch as q, withDirectives as we, vModelText as Ne, unref as ye, createTextVNode as Oe, onMounted as Te, onUnmounted as ke, shallowReactive as Ue, resolveDynamicComponent as Be, vShow as Ve } from "vue";
|
|
2
|
+
const fe = {
|
|
3
3
|
/** 地球:网页标签页与推荐站点缺省图标 */
|
|
4
4
|
globe: [
|
|
5
5
|
"M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18",
|
|
@@ -47,15 +47,15 @@ const pe = {
|
|
|
47
47
|
maximize: ["M4 9V4h5", "M20 9V4h-5", "M4 15v5h5", "M20 15v5h-5"],
|
|
48
48
|
/** 还原(四角向内) */
|
|
49
49
|
restore: ["M9 4v5H4", "M15 4v5h5", "M9 20v-5H4", "M15 20v-5h5"]
|
|
50
|
-
},
|
|
50
|
+
}, Fe = ["width", "height"], Ge = ["d"], He = /* @__PURE__ */ K({
|
|
51
51
|
__name: "RightPanelIcon",
|
|
52
52
|
props: {
|
|
53
53
|
name: { default: "globe" },
|
|
54
54
|
size: { default: 16 }
|
|
55
55
|
},
|
|
56
56
|
setup(t) {
|
|
57
|
-
const e = t, n =
|
|
58
|
-
return (
|
|
57
|
+
const e = t, n = $(() => fe[e.name] ?? fe.globe);
|
|
58
|
+
return (s, i) => (h(), f("svg", {
|
|
59
59
|
class: "wi-right-panel__icon",
|
|
60
60
|
width: t.size,
|
|
61
61
|
height: t.size,
|
|
@@ -67,207 +67,296 @@ const pe = {
|
|
|
67
67
|
"stroke-linejoin": "round",
|
|
68
68
|
"aria-hidden": "true"
|
|
69
69
|
}, [
|
|
70
|
-
(h(!0),
|
|
71
|
-
key:
|
|
72
|
-
d:
|
|
73
|
-
}, null, 8,
|
|
74
|
-
], 8,
|
|
70
|
+
(h(!0), f(G, null, X(n.value, (o, m) => (h(), f("path", {
|
|
71
|
+
key: m,
|
|
72
|
+
d: o
|
|
73
|
+
}, null, 8, Ge))), 128))
|
|
74
|
+
], 8, Fe));
|
|
75
75
|
}
|
|
76
|
-
}),
|
|
76
|
+
}), j = (t, e) => {
|
|
77
77
|
const n = t.__vccOpts || t;
|
|
78
|
-
for (const [
|
|
79
|
-
n[
|
|
78
|
+
for (const [s, i] of e)
|
|
79
|
+
n[s] = i;
|
|
80
80
|
return n;
|
|
81
|
-
},
|
|
81
|
+
}, S = /* @__PURE__ */ j(He, [["__scopeId", "data-v-5a35fd97"]]), Ke = { class: "wi-right-panel__tabs-list" }, je = ["title", "onClick", "onContextmenu"], Xe = { class: "wi-right-panel__tab-title" }, qe = {
|
|
82
82
|
key: 0,
|
|
83
83
|
class: "wi-right-panel__tab-loading"
|
|
84
|
-
},
|
|
84
|
+
}, Je = ["onClick"], Ye = ["title"], Qe = ["disabled", "aria-disabled", "onClick"], Ze = /* @__PURE__ */ K({
|
|
85
85
|
__name: "RightPanelTabs",
|
|
86
86
|
props: {
|
|
87
87
|
tabs: {},
|
|
88
88
|
activeId: {},
|
|
89
89
|
maximized: { type: Boolean }
|
|
90
90
|
},
|
|
91
|
-
emits: ["select", "close", "add", "toggle-maximize", "collapse"],
|
|
91
|
+
emits: ["select", "close", "close-left", "close-right", "add", "toggle-maximize", "collapse"],
|
|
92
92
|
setup(t, { emit: e }) {
|
|
93
|
-
const n = e
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
const n = t, s = e, i = ["--wi-chat-border", "--wi-chat-text", "--wi-chat-text-secondary"], o = P(null), m = P(null), v = ce({ visible: !1, x: 0, y: 0, tabId: "", themeVars: {} }), x = () => {
|
|
94
|
+
if (!o.value) return {};
|
|
95
|
+
const g = getComputedStyle(o.value);
|
|
96
|
+
return i.reduce((u, d) => {
|
|
97
|
+
const R = g.getPropertyValue(d).trim();
|
|
98
|
+
return R && (u[d] = R), u;
|
|
99
|
+
}, {});
|
|
100
|
+
}, M = () => {
|
|
101
|
+
var g;
|
|
102
|
+
return Array.from(((g = m.value) == null ? void 0 : g.querySelectorAll('[role="menuitem"]:not(:disabled)')) ?? []);
|
|
103
|
+
}, k = (g) => {
|
|
104
|
+
const u = M();
|
|
105
|
+
if (!u.length) return;
|
|
106
|
+
const d = u.indexOf(document.activeElement), R = d < 0 ? g > 0 ? 0 : u.length - 1 : (d + g + u.length) % u.length;
|
|
107
|
+
u[R].focus();
|
|
108
|
+
}, A = $(() => {
|
|
109
|
+
const g = n.tabs.findIndex((u) => u.id === v.tabId);
|
|
110
|
+
return [
|
|
111
|
+
{ key: "close", label: "关闭当前标签页", disabled: g < 0 },
|
|
112
|
+
{ key: "close-left", label: "关闭左侧标签页", disabled: g <= 0 },
|
|
113
|
+
{ key: "close-right", label: "关闭右侧标签页", disabled: g < 0 || g >= n.tabs.length - 1 }
|
|
114
|
+
];
|
|
115
|
+
}), w = () => {
|
|
116
|
+
v.visible && (v.visible = !1, document.removeEventListener("mousedown", T, !0), document.removeEventListener("keydown", N, !0), window.removeEventListener("blur", w), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0));
|
|
117
|
+
}, T = (g) => {
|
|
118
|
+
var u;
|
|
119
|
+
(u = m.value) != null && u.contains(g.target) || w();
|
|
120
|
+
}, N = (g) => {
|
|
121
|
+
var u, d;
|
|
122
|
+
switch (g.key) {
|
|
123
|
+
case "Escape":
|
|
124
|
+
g.preventDefault(), g.stopPropagation(), w();
|
|
125
|
+
break;
|
|
126
|
+
case "ArrowDown":
|
|
127
|
+
g.preventDefault(), k(1);
|
|
128
|
+
break;
|
|
129
|
+
case "ArrowUp":
|
|
130
|
+
g.preventDefault(), k(-1);
|
|
131
|
+
break;
|
|
132
|
+
case "Home":
|
|
133
|
+
g.preventDefault(), (u = M()[0]) == null || u.focus();
|
|
134
|
+
break;
|
|
135
|
+
case "End": {
|
|
136
|
+
g.preventDefault();
|
|
137
|
+
const R = M();
|
|
138
|
+
(d = R[R.length - 1]) == null || d.focus();
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "Tab":
|
|
142
|
+
w();
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}, O = async (g, u) => {
|
|
146
|
+
var R, F;
|
|
147
|
+
w(), v.tabId = u, v.x = g.clientX, v.y = g.clientY, v.themeVars = x(), v.visible = !0, document.addEventListener("mousedown", T, !0), document.addEventListener("keydown", N, !0), window.addEventListener("blur", w), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), await _e();
|
|
148
|
+
const d = (R = m.value) == null ? void 0 : R.getBoundingClientRect();
|
|
149
|
+
d && (v.x = Math.max(4, Math.min(v.x, window.innerWidth - d.width - 4)), v.y = Math.max(4, Math.min(v.y, window.innerHeight - d.height - 4)), (F = M()[0]) == null || F.focus());
|
|
150
|
+
}, V = (g) => {
|
|
151
|
+
const u = v.tabId;
|
|
152
|
+
w(), s(g === "close" ? "close" : g === "close-left" ? "close-left" : "close-right", u);
|
|
153
|
+
};
|
|
154
|
+
return We(w), (g, u) => (h(), f("div", {
|
|
155
|
+
ref_key: "rootRef",
|
|
156
|
+
ref: o,
|
|
157
|
+
class: "wi-right-panel__tabs"
|
|
158
|
+
}, [
|
|
159
|
+
b("div", Ke, [
|
|
160
|
+
(h(!0), f(G, null, X(t.tabs, (d) => (h(), f("button", {
|
|
161
|
+
key: d.id,
|
|
98
162
|
type: "button",
|
|
99
|
-
class:
|
|
100
|
-
title:
|
|
101
|
-
onClick: (
|
|
163
|
+
class: ue(["wi-right-panel__tab", { "is-active": d.id === t.activeId }]),
|
|
164
|
+
title: d.title,
|
|
165
|
+
onClick: (R) => s("select", d.id),
|
|
166
|
+
onContextmenu: Q((R) => O(R, d.id), ["prevent"])
|
|
102
167
|
}, [
|
|
103
|
-
|
|
104
|
-
name:
|
|
168
|
+
z(S, {
|
|
169
|
+
name: d.icon || "globe",
|
|
105
170
|
size: 14
|
|
106
171
|
}, null, 8, ["name"]),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
172
|
+
b("span", Xe, W(d.title), 1),
|
|
173
|
+
d.loading ? (h(), f("span", qe)) : D("", !0),
|
|
174
|
+
b("span", {
|
|
110
175
|
class: "wi-right-panel__tab-close",
|
|
111
176
|
title: "关闭标签页",
|
|
112
|
-
onClick:
|
|
177
|
+
onClick: Q((R) => s("close", d.id), ["stop"])
|
|
113
178
|
}, [
|
|
114
|
-
|
|
179
|
+
z(S, {
|
|
115
180
|
name: "close",
|
|
116
181
|
size: 12
|
|
117
182
|
})
|
|
118
|
-
], 8,
|
|
119
|
-
],
|
|
183
|
+
], 8, Je)
|
|
184
|
+
], 42, je))), 128))
|
|
120
185
|
]),
|
|
121
|
-
|
|
186
|
+
b("button", {
|
|
122
187
|
type: "button",
|
|
123
188
|
class: "wi-right-panel__tab-action",
|
|
124
189
|
title: "新建标签页 Ctrl+Shift+B",
|
|
125
|
-
onClick:
|
|
190
|
+
onClick: u[0] || (u[0] = (d) => s("add"))
|
|
126
191
|
}, [
|
|
127
|
-
|
|
192
|
+
z(S, {
|
|
128
193
|
name: "plus",
|
|
129
194
|
size: 15
|
|
130
195
|
})
|
|
131
196
|
]),
|
|
132
|
-
|
|
197
|
+
b("button", {
|
|
133
198
|
type: "button",
|
|
134
199
|
class: "wi-right-panel__tab-action wi-right-panel__tab-action--maximize",
|
|
135
200
|
title: t.maximized ? "还原面板" : "最大化面板",
|
|
136
|
-
onClick:
|
|
201
|
+
onClick: u[1] || (u[1] = (d) => s("toggle-maximize"))
|
|
137
202
|
}, [
|
|
138
|
-
|
|
203
|
+
z(S, {
|
|
139
204
|
name: t.maximized ? "restore" : "maximize",
|
|
140
205
|
size: 15
|
|
141
206
|
}, null, 8, ["name"])
|
|
142
|
-
], 8,
|
|
143
|
-
|
|
207
|
+
], 8, Ye),
|
|
208
|
+
b("button", {
|
|
144
209
|
type: "button",
|
|
145
210
|
class: "wi-right-panel__tab-action wi-right-panel__tab-action--collapse",
|
|
146
211
|
title: "收起侧边栏",
|
|
147
|
-
onClick:
|
|
212
|
+
onClick: u[2] || (u[2] = (d) => s("collapse"))
|
|
148
213
|
}, [
|
|
149
|
-
|
|
214
|
+
z(S, {
|
|
150
215
|
name: "sidebar",
|
|
151
216
|
size: 15
|
|
152
217
|
})
|
|
153
|
-
])
|
|
154
|
-
|
|
218
|
+
]),
|
|
219
|
+
(h(), de(De, { to: "body" }, [
|
|
220
|
+
v.visible ? (h(), f("div", {
|
|
221
|
+
key: 0,
|
|
222
|
+
ref_key: "menuRef",
|
|
223
|
+
ref: m,
|
|
224
|
+
class: "wi-right-panel__tab-menu",
|
|
225
|
+
role: "menu",
|
|
226
|
+
"aria-label": "标签页操作",
|
|
227
|
+
style: pe({ ...v.themeVars, left: `${v.x}px`, top: `${v.y}px` }),
|
|
228
|
+
onContextmenu: u[3] || (u[3] = Q(() => {
|
|
229
|
+
}, ["prevent"]))
|
|
230
|
+
}, [
|
|
231
|
+
(h(!0), f(G, null, X(A.value, (d) => (h(), f("button", {
|
|
232
|
+
key: d.key,
|
|
233
|
+
type: "button",
|
|
234
|
+
role: "menuitem",
|
|
235
|
+
tabindex: "-1",
|
|
236
|
+
class: "wi-right-panel__tab-menu-item",
|
|
237
|
+
disabled: d.disabled,
|
|
238
|
+
"aria-disabled": d.disabled,
|
|
239
|
+
onClick: (R) => V(d.key)
|
|
240
|
+
}, W(d.label), 9, Qe))), 128))
|
|
241
|
+
], 36)) : D("", !0)
|
|
242
|
+
]))
|
|
243
|
+
], 512));
|
|
155
244
|
}
|
|
156
|
-
}),
|
|
245
|
+
}), et = /* @__PURE__ */ j(Ze, [["__scopeId", "data-v-03671384"]]), xe = () => typeof window > "u" ? {} : window, Me = () => {
|
|
157
246
|
var e;
|
|
158
|
-
const t =
|
|
247
|
+
const t = xe();
|
|
159
248
|
return !!((e = t.electronApp) != null && e.isElectron) || !!t.wiElectron || !!t.wiChatDesktop;
|
|
160
|
-
},
|
|
249
|
+
}, tt = { class: "wi-right-panel__toolbar" }, nt = ["disabled"], at = ["disabled"], it = {
|
|
161
250
|
key: 0,
|
|
162
251
|
class: "wi-right-panel__address-loading"
|
|
163
|
-
},
|
|
252
|
+
}, ot = ["disabled"], st = /* @__PURE__ */ K({
|
|
164
253
|
__name: "BrowserToolbar",
|
|
165
254
|
props: {
|
|
166
255
|
tab: {},
|
|
167
256
|
panel: {}
|
|
168
257
|
},
|
|
169
258
|
setup(t) {
|
|
170
|
-
const e = t, n =
|
|
171
|
-
|
|
259
|
+
const e = t, n = $(() => e.panel.canGoBack.value), s = $(() => e.panel.canGoForward.value), i = P(""), o = P();
|
|
260
|
+
q(
|
|
172
261
|
() => e.tab.url,
|
|
173
|
-
(
|
|
174
|
-
|
|
262
|
+
(x) => {
|
|
263
|
+
i.value = x ?? "";
|
|
175
264
|
},
|
|
176
265
|
{ immediate: !0 }
|
|
177
266
|
);
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
},
|
|
182
|
-
const
|
|
183
|
-
!
|
|
267
|
+
const m = () => {
|
|
268
|
+
const x = i.value.trim();
|
|
269
|
+
x && e.panel.navigate(x);
|
|
270
|
+
}, v = () => {
|
|
271
|
+
const x = e.tab.url;
|
|
272
|
+
!x || typeof window > "u" || window.open(x, "_blank", "noopener,noreferrer");
|
|
184
273
|
};
|
|
185
|
-
return (
|
|
186
|
-
|
|
274
|
+
return (x, M) => (h(), f("div", tt, [
|
|
275
|
+
b("button", {
|
|
187
276
|
type: "button",
|
|
188
277
|
class: "wi-right-panel__tool",
|
|
189
278
|
disabled: !n.value,
|
|
190
279
|
title: "后退",
|
|
191
|
-
onClick:
|
|
280
|
+
onClick: M[0] || (M[0] = (k) => t.panel.goBack())
|
|
192
281
|
}, [
|
|
193
|
-
|
|
282
|
+
z(S, {
|
|
194
283
|
name: "arrow-left",
|
|
195
284
|
size: 15
|
|
196
285
|
})
|
|
197
|
-
], 8,
|
|
198
|
-
|
|
286
|
+
], 8, nt),
|
|
287
|
+
b("button", {
|
|
199
288
|
type: "button",
|
|
200
289
|
class: "wi-right-panel__tool",
|
|
201
|
-
disabled: !
|
|
290
|
+
disabled: !s.value,
|
|
202
291
|
title: "前进",
|
|
203
|
-
onClick:
|
|
292
|
+
onClick: M[1] || (M[1] = (k) => t.panel.goForward())
|
|
204
293
|
}, [
|
|
205
|
-
|
|
294
|
+
z(S, {
|
|
206
295
|
name: "arrow-right",
|
|
207
296
|
size: 15
|
|
208
297
|
})
|
|
209
|
-
], 8,
|
|
210
|
-
|
|
298
|
+
], 8, at),
|
|
299
|
+
b("button", {
|
|
211
300
|
type: "button",
|
|
212
301
|
class: "wi-right-panel__tool",
|
|
213
302
|
title: "刷新",
|
|
214
|
-
onClick:
|
|
303
|
+
onClick: M[2] || (M[2] = (k) => t.panel.reload())
|
|
215
304
|
}, [
|
|
216
|
-
|
|
305
|
+
z(S, {
|
|
217
306
|
name: "reload",
|
|
218
307
|
size: 15
|
|
219
308
|
})
|
|
220
309
|
]),
|
|
221
|
-
|
|
310
|
+
b("form", {
|
|
222
311
|
class: "wi-right-panel__address",
|
|
223
|
-
onSubmit:
|
|
312
|
+
onSubmit: Q(m, ["prevent"])
|
|
224
313
|
}, [
|
|
225
|
-
|
|
314
|
+
z(S, {
|
|
226
315
|
class: "wi-right-panel__address-icon",
|
|
227
316
|
name: "search",
|
|
228
317
|
size: 13
|
|
229
318
|
}),
|
|
230
|
-
|
|
319
|
+
we(b("input", {
|
|
231
320
|
ref_key: "inputRef",
|
|
232
|
-
ref:
|
|
233
|
-
"onUpdate:modelValue":
|
|
321
|
+
ref: o,
|
|
322
|
+
"onUpdate:modelValue": M[3] || (M[3] = (k) => i.value = k),
|
|
234
323
|
class: "wi-right-panel__address-input",
|
|
235
324
|
type: "text",
|
|
236
325
|
placeholder: "搜索或输入网址",
|
|
237
326
|
spellcheck: "false",
|
|
238
327
|
autocomplete: "off"
|
|
239
328
|
}, null, 512), [
|
|
240
|
-
[
|
|
329
|
+
[Ne, i.value]
|
|
241
330
|
]),
|
|
242
|
-
t.tab.loading ? (h(),
|
|
331
|
+
t.tab.loading ? (h(), f("span", it)) : D("", !0)
|
|
243
332
|
], 32),
|
|
244
|
-
|
|
333
|
+
b("button", {
|
|
245
334
|
type: "button",
|
|
246
335
|
class: "wi-right-panel__tool",
|
|
247
336
|
disabled: !t.tab.url,
|
|
248
337
|
title: "在新窗口打开",
|
|
249
|
-
onClick:
|
|
338
|
+
onClick: v
|
|
250
339
|
}, [
|
|
251
|
-
|
|
340
|
+
z(S, {
|
|
252
341
|
name: "external",
|
|
253
342
|
size: 15
|
|
254
343
|
})
|
|
255
|
-
], 8,
|
|
344
|
+
], 8, ot)
|
|
256
345
|
]));
|
|
257
346
|
}
|
|
258
|
-
}),
|
|
347
|
+
}), Ee = /* @__PURE__ */ j(st, [["__scopeId", "data-v-89af1cad"]]), lt = {
|
|
259
348
|
key: 0,
|
|
260
349
|
class: "wi-right-panel__section"
|
|
261
|
-
},
|
|
350
|
+
}, rt = {
|
|
262
351
|
key: 0,
|
|
263
352
|
class: "wi-right-panel__section-title"
|
|
264
|
-
},
|
|
353
|
+
}, ct = ["title", "onClick"], ut = { class: "wi-right-panel__tool-card-label" }, dt = {
|
|
265
354
|
key: 0,
|
|
266
355
|
class: "wi-right-panel__tool-card-tag"
|
|
267
|
-
},
|
|
356
|
+
}, pt = {
|
|
268
357
|
key: 1,
|
|
269
358
|
class: "wi-right-panel__tool-card-shortcut"
|
|
270
|
-
},
|
|
359
|
+
}, ht = /* @__PURE__ */ K({
|
|
271
360
|
__name: "RightPanelToolList",
|
|
272
361
|
props: {
|
|
273
362
|
tools: {},
|
|
@@ -276,33 +365,33 @@ const pe = {
|
|
|
276
365
|
},
|
|
277
366
|
emits: ["tool-click"],
|
|
278
367
|
setup(t, { emit: e }) {
|
|
279
|
-
const n = e,
|
|
280
|
-
n("tool-click",
|
|
368
|
+
const n = e, s = (i) => {
|
|
369
|
+
n("tool-click", i);
|
|
281
370
|
};
|
|
282
|
-
return (
|
|
283
|
-
t.title ? (h(),
|
|
284
|
-
|
|
371
|
+
return (i, o) => t.tools.length ? (h(), f("section", lt, [
|
|
372
|
+
t.title ? (h(), f("h4", rt, W(t.title), 1)) : D("", !0),
|
|
373
|
+
b("div", {
|
|
285
374
|
class: "wi-right-panel__tools",
|
|
286
|
-
style:
|
|
375
|
+
style: pe({ gridTemplateColumns: `repeat(${t.columns}, minmax(0, 1fr))` })
|
|
287
376
|
}, [
|
|
288
|
-
(h(!0),
|
|
289
|
-
key:
|
|
377
|
+
(h(!0), f(G, null, X(t.tools, (m) => (h(), f("button", {
|
|
378
|
+
key: m.key,
|
|
290
379
|
type: "button",
|
|
291
|
-
class:
|
|
292
|
-
title:
|
|
293
|
-
onClick: (
|
|
380
|
+
class: ue(["wi-right-panel__tool-card", { "is-disabled": m.disabled }]),
|
|
381
|
+
title: m.description ?? m.label,
|
|
382
|
+
onClick: (v) => s(m)
|
|
294
383
|
}, [
|
|
295
|
-
|
|
296
|
-
name:
|
|
384
|
+
z(S, {
|
|
385
|
+
name: m.icon,
|
|
297
386
|
size: 16
|
|
298
387
|
}, null, 8, ["name"]),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
], 10,
|
|
388
|
+
b("span", ut, W(m.label), 1),
|
|
389
|
+
m.disabled ? (h(), f("span", dt, "即将支持")) : m.shortcut ? (h(), f("span", pt, W(m.shortcut), 1)) : D("", !0)
|
|
390
|
+
], 10, ct))), 128))
|
|
302
391
|
], 4)
|
|
303
|
-
])) :
|
|
392
|
+
])) : D("", !0);
|
|
304
393
|
}
|
|
305
|
-
}),
|
|
394
|
+
}), vt = /* @__PURE__ */ j(ht, [["__scopeId", "data-v-edb8e61a"]]), bt = [], gt = [
|
|
306
395
|
{
|
|
307
396
|
title: "地图 Demo · OpenLayers",
|
|
308
397
|
url: "https://openlayers.org/",
|
|
@@ -313,10 +402,10 @@ const pe = {
|
|
|
313
402
|
url: "http://127.0.0.1:8890",
|
|
314
403
|
description: "本机开发服务"
|
|
315
404
|
}
|
|
316
|
-
],
|
|
405
|
+
], ft = { class: "wi-right-panel__newtab" }, mt = { class: "wi-right-panel__newtab-body" }, _t = { class: "wi-right-panel__hero" }, wt = { class: "wi-right-panel__hero-title" }, yt = { class: "wi-right-panel__hero-desc" }, Tt = {
|
|
317
406
|
key: 0,
|
|
318
407
|
class: "wi-right-panel__section"
|
|
319
|
-
},
|
|
408
|
+
}, kt = { class: "wi-right-panel__recommendations" }, xt = ["title", "onClick"], Mt = { class: "wi-right-panel__recommendation-icon" }, Et = { class: "wi-right-panel__recommendation-title" }, It = /* @__PURE__ */ K({
|
|
320
409
|
__name: "NewTabPanel",
|
|
321
410
|
props: {
|
|
322
411
|
tab: {},
|
|
@@ -324,71 +413,71 @@ const pe = {
|
|
|
324
413
|
},
|
|
325
414
|
emits: ["tool-click"],
|
|
326
415
|
setup(t, { emit: e }) {
|
|
327
|
-
const n = t,
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
n.panel.navigate(
|
|
331
|
-
},
|
|
332
|
-
return (
|
|
333
|
-
|
|
416
|
+
const n = t, s = e, i = $(() => n.panel.options.tools ?? bt), o = $(() => n.panel.options.recommendations ?? gt), m = Me() ? "在这里打开网页或终端,与对话并行使用;每个标签页都会各自保留页面状态。" : "在这里打开网页,与对话并行使用;每个标签页都会各自保留页面状态。", v = (k) => {
|
|
417
|
+
s("tool-click", k);
|
|
418
|
+
}, x = (k) => {
|
|
419
|
+
n.panel.navigate(k.url, k.title);
|
|
420
|
+
}, M = (k) => k.trim().charAt(0).toUpperCase() || "·";
|
|
421
|
+
return (k, A) => (h(), f("div", ft, [
|
|
422
|
+
z(Ee, {
|
|
334
423
|
tab: t.tab,
|
|
335
424
|
panel: t.panel
|
|
336
425
|
}, null, 8, ["tab", "panel"]),
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
426
|
+
b("div", mt, [
|
|
427
|
+
b("section", _t, [
|
|
428
|
+
b("h3", wt, W(t.panel.options.newTabTitle), 1),
|
|
429
|
+
b("p", yt, W(ye(m)), 1)
|
|
341
430
|
]),
|
|
342
|
-
|
|
343
|
-
tools:
|
|
344
|
-
onToolClick:
|
|
431
|
+
z(vt, {
|
|
432
|
+
tools: i.value,
|
|
433
|
+
onToolClick: v
|
|
345
434
|
}, null, 8, ["tools"]),
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
(h(!0),
|
|
350
|
-
key:
|
|
435
|
+
o.value.length ? (h(), f("section", Tt, [
|
|
436
|
+
A[0] || (A[0] = b("h4", { class: "wi-right-panel__section-title" }, "推荐", -1)),
|
|
437
|
+
b("div", kt, [
|
|
438
|
+
(h(!0), f(G, null, X(o.value, (w) => (h(), f("button", {
|
|
439
|
+
key: w.url,
|
|
351
440
|
type: "button",
|
|
352
441
|
class: "wi-right-panel__recommendation",
|
|
353
|
-
title:
|
|
354
|
-
onClick: (
|
|
442
|
+
title: w.description ?? w.url,
|
|
443
|
+
onClick: (T) => x(w)
|
|
355
444
|
}, [
|
|
356
|
-
|
|
357
|
-
|
|
445
|
+
b("span", Mt, [
|
|
446
|
+
w.icon ? (h(), de(S, {
|
|
358
447
|
key: 0,
|
|
359
|
-
name:
|
|
448
|
+
name: w.icon,
|
|
360
449
|
size: 17
|
|
361
|
-
}, null, 8, ["name"])) : (h(),
|
|
362
|
-
|
|
450
|
+
}, null, 8, ["name"])) : (h(), f(G, { key: 1 }, [
|
|
451
|
+
Oe(W(M(w.title)), 1)
|
|
363
452
|
], 64))
|
|
364
453
|
]),
|
|
365
|
-
|
|
366
|
-
], 8,
|
|
454
|
+
b("span", Et, W(w.title), 1)
|
|
455
|
+
], 8, xt))), 128))
|
|
367
456
|
])
|
|
368
|
-
])) :
|
|
457
|
+
])) : D("", !0)
|
|
369
458
|
])
|
|
370
459
|
]));
|
|
371
460
|
}
|
|
372
|
-
}),
|
|
461
|
+
}), $t = /* @__PURE__ */ j(It, [["__scopeId", "data-v-1d433f71"]]), Rt = {
|
|
373
462
|
type: "newtab",
|
|
374
463
|
defaultTitle: "新建标签页",
|
|
375
464
|
icon: "newtab",
|
|
376
|
-
component:
|
|
377
|
-
},
|
|
378
|
-
var n,
|
|
465
|
+
component: $t
|
|
466
|
+
}, Lt = "persist:wi-right-panel", zt = () => {
|
|
467
|
+
var n, s, i;
|
|
379
468
|
if (typeof window > "u" || typeof document > "u") return !1;
|
|
380
|
-
const t =
|
|
381
|
-
return !!((n = t.electronApp) != null && n.isElectron) || !!t.wiElectron ? ((
|
|
382
|
-
},
|
|
469
|
+
const t = xe();
|
|
470
|
+
return !!((n = t.electronApp) != null && n.isElectron) || !!t.wiElectron ? ((s = t.wiElectron) == null ? void 0 : s.rightPanelWebviewEnabled) === !0 || ((i = t.electronApp) == null ? void 0 : i.rightPanelWebviewEnabled) === !0 : !1;
|
|
471
|
+
}, Ct = (t) => t || (zt() ? "webview" : "iframe"), Pt = (t, e = Lt) => {
|
|
383
472
|
const n = document.createElement("webview");
|
|
384
|
-
return n.className = "wi-right-panel__webview", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.background = "#fff", n.setAttribute("partition", e), t && n.setAttribute("src", t), n;
|
|
385
|
-
},
|
|
473
|
+
return n.className = "wi-right-panel__webview", n.style.display = "flex", n.style.width = "100%", n.style.height = "100%", n.style.border = "0", n.style.background = "#fff", n.setAttribute("partition", e), t && n.setAttribute("src", t), n;
|
|
474
|
+
}, St = { class: "wi-right-panel__web" }, At = {
|
|
386
475
|
key: 0,
|
|
387
476
|
class: "wi-right-panel__frame-hint"
|
|
388
|
-
},
|
|
477
|
+
}, Wt = { class: "wi-right-panel__web-body" }, Dt = ["src", "title"], Nt = {
|
|
389
478
|
key: 2,
|
|
390
479
|
class: "wi-right-panel__blocked"
|
|
391
|
-
},
|
|
480
|
+
}, Ot = { class: "wi-right-panel__blocked-title" }, Ut = { class: "wi-right-panel__blocked-desc" }, Bt = /* @__PURE__ */ K({
|
|
392
481
|
__name: "WebPanel",
|
|
393
482
|
props: {
|
|
394
483
|
tab: {},
|
|
@@ -396,138 +485,138 @@ const pe = {
|
|
|
396
485
|
runtime: {}
|
|
397
486
|
},
|
|
398
487
|
setup(t) {
|
|
399
|
-
const e = t, n =
|
|
400
|
-
|
|
401
|
-
},
|
|
402
|
-
const
|
|
403
|
-
!
|
|
404
|
-
},
|
|
405
|
-
let
|
|
406
|
-
const
|
|
407
|
-
|
|
488
|
+
const e = t, n = Ct(e.runtime) === "webview", s = $(() => `${e.tab.id}-${e.tab.reloadKey ?? 0}`), i = P(!1), o = () => {
|
|
489
|
+
i.value = !1, e.panel.reload(), n || k();
|
|
490
|
+
}, m = () => {
|
|
491
|
+
const p = e.tab.url;
|
|
492
|
+
!p || typeof window > "u" || window.open(p, "_blank", "noopener,noreferrer");
|
|
493
|
+
}, v = P(!1);
|
|
494
|
+
let x;
|
|
495
|
+
const M = () => {
|
|
496
|
+
x && clearTimeout(x), x = void 0;
|
|
408
497
|
};
|
|
409
|
-
function
|
|
410
|
-
|
|
411
|
-
|
|
498
|
+
function k() {
|
|
499
|
+
M(), v.value = !1, i.value = !1, x = setTimeout(() => {
|
|
500
|
+
v.value || (i.value = !0);
|
|
412
501
|
}, 8e3);
|
|
413
502
|
}
|
|
414
|
-
const
|
|
415
|
-
var
|
|
416
|
-
|
|
503
|
+
const A = (p) => {
|
|
504
|
+
var E, _;
|
|
505
|
+
v.value = !0, i.value = !1, M(), e.panel.updateTab(e.tab.id, { loading: !1 });
|
|
417
506
|
try {
|
|
418
|
-
const
|
|
419
|
-
|
|
507
|
+
const L = (_ = (E = p.target.contentDocument) == null ? void 0 : E.title) == null ? void 0 : _.trim();
|
|
508
|
+
L && e.panel.updateTab(e.tab.id, { title: L });
|
|
420
509
|
} catch {
|
|
421
510
|
}
|
|
422
511
|
};
|
|
423
|
-
|
|
512
|
+
q(
|
|
424
513
|
() => e.tab.url,
|
|
425
|
-
(
|
|
426
|
-
!
|
|
514
|
+
(p) => {
|
|
515
|
+
!p || n || (e.panel.updateTab(e.tab.id, { loading: !0 }), k());
|
|
427
516
|
}
|
|
428
517
|
);
|
|
429
|
-
const
|
|
430
|
-
let
|
|
431
|
-
const
|
|
432
|
-
let
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
if (!
|
|
436
|
-
|
|
518
|
+
const w = P();
|
|
519
|
+
let T = null;
|
|
520
|
+
const N = P(e.tab.url ?? "");
|
|
521
|
+
let O = "";
|
|
522
|
+
const V = (p) => {
|
|
523
|
+
if (p) {
|
|
524
|
+
if (!T) {
|
|
525
|
+
O = p;
|
|
437
526
|
return;
|
|
438
527
|
}
|
|
439
|
-
|
|
528
|
+
p !== N.value && (N.value = p, e.panel.updateTab(e.tab.id, { loading: !0 }), T.setAttribute("src", p));
|
|
440
529
|
}
|
|
441
|
-
},
|
|
442
|
-
|
|
443
|
-
},
|
|
530
|
+
}, g = () => {
|
|
531
|
+
i.value = !1, e.panel.updateTab(e.tab.id, { loading: !0 });
|
|
532
|
+
}, u = () => {
|
|
444
533
|
e.panel.updateTab(e.tab.id, { loading: !1 });
|
|
445
|
-
},
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
},
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
},
|
|
452
|
-
const
|
|
453
|
-
|
|
534
|
+
}, d = (p) => {
|
|
535
|
+
const E = p;
|
|
536
|
+
E.isMainFrame === !1 || !E.url || E.url === "about:blank" || (N.value = E.url, e.panel.recordNavigation(E.url, void 0, e.tab.id));
|
|
537
|
+
}, R = (p) => {
|
|
538
|
+
const E = p;
|
|
539
|
+
E.title && e.panel.updateTab(e.tab.id, { title: E.title });
|
|
540
|
+
}, F = (p) => {
|
|
541
|
+
const E = p;
|
|
542
|
+
E.isMainFrame === !1 || !E.errorCode || E.errorCode === -3 || (i.value = !0, e.panel.updateTab(e.tab.id, { loading: !1 }));
|
|
454
543
|
}, U = () => {
|
|
455
|
-
if (!
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
const
|
|
459
|
-
|
|
544
|
+
if (!T) return;
|
|
545
|
+
const p = typeof T.getURL == "function" ? T.getURL() : T.getAttribute("src") || "";
|
|
546
|
+
if (p && (N.value = p), e.panel.updateTab(e.tab.id, { loading: !1 }), O) {
|
|
547
|
+
const E = O;
|
|
548
|
+
O = "", V(E);
|
|
460
549
|
}
|
|
461
|
-
},
|
|
462
|
-
if (!n || !
|
|
463
|
-
const
|
|
464
|
-
|
|
550
|
+
}, Y = () => {
|
|
551
|
+
if (!n || !w.value) return;
|
|
552
|
+
const p = Pt(e.tab.url ?? "");
|
|
553
|
+
T = p, p.addEventListener("did-start-loading", g), p.addEventListener("did-stop-loading", u), p.addEventListener("did-navigate", d), p.addEventListener("did-navigate-in-page", d), p.addEventListener("page-title-updated", R), p.addEventListener("did-fail-load", F), p.addEventListener("dom-ready", U), w.value.replaceChildren(p);
|
|
465
554
|
};
|
|
466
|
-
return
|
|
555
|
+
return q(
|
|
467
556
|
() => e.tab.url,
|
|
468
|
-
(
|
|
469
|
-
!
|
|
557
|
+
(p) => {
|
|
558
|
+
!p || !n || V(p);
|
|
470
559
|
}
|
|
471
|
-
),
|
|
472
|
-
n ?
|
|
473
|
-
}),
|
|
474
|
-
|
|
475
|
-
}), (
|
|
476
|
-
|
|
560
|
+
), Te(() => {
|
|
561
|
+
n ? Y() : k();
|
|
562
|
+
}), ke(() => {
|
|
563
|
+
M(), T && (T.remove(), T = null);
|
|
564
|
+
}), (p, E) => (h(), f("div", St, [
|
|
565
|
+
z(Ee, {
|
|
477
566
|
tab: t.tab,
|
|
478
567
|
panel: t.panel
|
|
479
568
|
}, null, 8, ["tab", "panel"]),
|
|
480
|
-
n ?
|
|
481
|
-
|
|
569
|
+
n ? D("", !0) : (h(), f("div", At, [
|
|
570
|
+
z(S, {
|
|
482
571
|
name: "alert",
|
|
483
572
|
size: 12
|
|
484
573
|
}),
|
|
485
|
-
|
|
574
|
+
E[0] || (E[0] = b("span", null, "部分网站禁止被内嵌;若页面空白或显示禁止图标,请点右上角在新窗口打开。", -1))
|
|
486
575
|
])),
|
|
487
|
-
|
|
488
|
-
n ? (h(),
|
|
576
|
+
b("div", Wt, [
|
|
577
|
+
n ? (h(), f("div", {
|
|
489
578
|
key: 0,
|
|
490
579
|
ref_key: "webviewHostRef",
|
|
491
|
-
ref:
|
|
580
|
+
ref: w,
|
|
492
581
|
class: "wi-right-panel__webview-host"
|
|
493
|
-
}, null, 512)) : t.tab.url ? (h(),
|
|
494
|
-
key:
|
|
582
|
+
}, null, 512)) : t.tab.url ? (h(), f("iframe", {
|
|
583
|
+
key: s.value,
|
|
495
584
|
class: "wi-right-panel__iframe",
|
|
496
585
|
src: t.tab.url,
|
|
497
586
|
title: t.tab.title,
|
|
498
587
|
referrerpolicy: "no-referrer",
|
|
499
|
-
onLoad:
|
|
500
|
-
}, null, 40,
|
|
501
|
-
|
|
502
|
-
|
|
588
|
+
onLoad: A
|
|
589
|
+
}, null, 40, Dt)) : D("", !0),
|
|
590
|
+
i.value ? (h(), f("div", Nt, [
|
|
591
|
+
z(S, {
|
|
503
592
|
name: "alert",
|
|
504
593
|
size: 30
|
|
505
594
|
}),
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
595
|
+
b("p", Ot, W(n ? "页面加载失败" : "该页面可能不允许被嵌入"), 1),
|
|
596
|
+
b("p", Ut, W(n ? "请检查网络或地址是否正确,也可以在新窗口打开。" : "部分网站会通过 X-Frame-Options / CSP 禁止在 iframe 中打开,可在新窗口访问。"), 1),
|
|
597
|
+
b("div", { class: "wi-right-panel__blocked-actions" }, [
|
|
598
|
+
b("button", {
|
|
510
599
|
type: "button",
|
|
511
600
|
class: "wi-right-panel__ghost-button",
|
|
512
|
-
onClick:
|
|
601
|
+
onClick: o
|
|
513
602
|
}, "重试"),
|
|
514
|
-
|
|
603
|
+
b("button", {
|
|
515
604
|
type: "button",
|
|
516
605
|
class: "wi-right-panel__primary-button",
|
|
517
|
-
onClick:
|
|
606
|
+
onClick: m
|
|
518
607
|
}, "在新窗口打开")
|
|
519
608
|
])
|
|
520
|
-
])) :
|
|
609
|
+
])) : D("", !0)
|
|
521
610
|
])
|
|
522
611
|
]));
|
|
523
612
|
}
|
|
524
|
-
}),
|
|
613
|
+
}), Vt = /* @__PURE__ */ j(Bt, [["__scopeId", "data-v-4ee42504"]]), Ft = {
|
|
525
614
|
type: "web",
|
|
526
615
|
defaultTitle: "网页",
|
|
527
616
|
icon: "globe",
|
|
528
|
-
component:
|
|
529
|
-
},
|
|
530
|
-
const e =
|
|
617
|
+
component: Vt
|
|
618
|
+
}, Ie = [Rt, Ft], $e = (t = []) => {
|
|
619
|
+
const e = Ue(/* @__PURE__ */ new Map());
|
|
531
620
|
return t.forEach((n) => e.set(n.type, n)), {
|
|
532
621
|
register(n) {
|
|
533
622
|
return e.set(n.type, n), () => {
|
|
@@ -541,21 +630,21 @@ const pe = {
|
|
|
541
630
|
return Array.from(e.values());
|
|
542
631
|
}
|
|
543
632
|
};
|
|
544
|
-
},
|
|
633
|
+
}, he = $e(Ie), pn = (t, e = he) => e.register(t), hn = (t, e = he) => e.get(t), Re = "https://www.bing.com/search?q={q}", Gt = Math.random().toString(36).slice(2, 8), Ht = {
|
|
545
634
|
initialWidth: 480,
|
|
546
635
|
minWidth: 360,
|
|
547
636
|
maxWidth: 900,
|
|
548
637
|
maxTabs: 10,
|
|
549
|
-
searchUrlTemplate:
|
|
638
|
+
searchUrlTemplate: Re,
|
|
550
639
|
defaultTabType: "newtab",
|
|
551
640
|
newTabTitle: "新建标签页"
|
|
552
|
-
},
|
|
641
|
+
}, ne = (t) => {
|
|
553
642
|
try {
|
|
554
643
|
return new URL(t).host || t;
|
|
555
644
|
} catch {
|
|
556
645
|
return t;
|
|
557
646
|
}
|
|
558
|
-
},
|
|
647
|
+
}, se = (t, e = Re) => {
|
|
559
648
|
const n = (t ?? "").trim();
|
|
560
649
|
if (!n || /^(javascript|data|vbscript|file|about):/i.test(n)) return "";
|
|
561
650
|
if (/^https?:\/\//i.test(n)) return n;
|
|
@@ -566,146 +655,153 @@ const pe = {
|
|
|
566
655
|
if (/^([\w-]+\.)+[a-z]{2,}(:\d+)?(\/.*)?$/i.test(n)) return `https://${n}`;
|
|
567
656
|
}
|
|
568
657
|
return e.replace("{q}", encodeURIComponent(n));
|
|
569
|
-
},
|
|
570
|
-
const e =
|
|
571
|
-
...
|
|
658
|
+
}, Kt = (t = {}) => {
|
|
659
|
+
const e = ce({
|
|
660
|
+
...Ht,
|
|
572
661
|
...Object.fromEntries(Object.entries(t).filter(([a, r]) => a !== "registry" && r !== void 0))
|
|
573
|
-
}), n = t.registry ?? $e(
|
|
574
|
-
let
|
|
575
|
-
const
|
|
576
|
-
const r =
|
|
662
|
+
}), n = t.registry ?? $e(Ie), s = P(!1), i = P([]), o = P(""), m = P(!1), v = P(!1);
|
|
663
|
+
let x = 0;
|
|
664
|
+
const M = () => `right-panel-${++x}-${Gt}`, k = () => typeof window > "u" ? e.maxWidth : Math.min(e.maxWidth, Math.max(e.minWidth, window.innerWidth * 0.7)), A = (a) => {
|
|
665
|
+
const r = k();
|
|
577
666
|
return Math.round(Math.min(Math.max(a, e.minWidth), r));
|
|
578
|
-
},
|
|
667
|
+
}, w = P(A(t.initialWidth ?? e.initialWidth)), T = $(() => i.value.find((a) => a.id === o.value) ?? null), N = $(() => {
|
|
579
668
|
var a;
|
|
580
|
-
return (((a =
|
|
581
|
-
}),
|
|
582
|
-
const a =
|
|
669
|
+
return (((a = T.value) == null ? void 0 : a.historyIndex) ?? -1) > 0;
|
|
670
|
+
}), O = $(() => {
|
|
671
|
+
const a = T.value;
|
|
583
672
|
return !!a && a.historyIndex >= 0 && a.historyIndex < a.history.length - 1;
|
|
584
|
-
}),
|
|
585
|
-
|
|
586
|
-
},
|
|
587
|
-
|
|
588
|
-
},
|
|
589
|
-
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
},
|
|
593
|
-
|
|
673
|
+
}), V = () => {
|
|
674
|
+
s.value = !0;
|
|
675
|
+
}, g = () => {
|
|
676
|
+
s.value = !1, m.value = !1;
|
|
677
|
+
}, u = () => {
|
|
678
|
+
s.value = !s.value, s.value || (m.value = !1);
|
|
679
|
+
}, d = (a) => {
|
|
680
|
+
m.value = a, a && (s.value = !0);
|
|
681
|
+
}, R = () => d(!m.value), F = (a) => {
|
|
682
|
+
w.value = A(a);
|
|
594
683
|
}, U = (a) => {
|
|
595
|
-
var
|
|
596
|
-
const r = typeof a == "string" ? { type: a } : a ?? {},
|
|
597
|
-
if (
|
|
598
|
-
const
|
|
599
|
-
if (
|
|
600
|
-
return
|
|
684
|
+
var ge;
|
|
685
|
+
const r = typeof a == "string" ? { type: a } : a ?? {}, y = r.type ?? e.defaultTabType, l = n.get(y);
|
|
686
|
+
if (l != null && l.singleton) {
|
|
687
|
+
const oe = i.value.find((Ae) => Ae.type === y);
|
|
688
|
+
if (oe)
|
|
689
|
+
return o.value = oe.id, s.value = !0, oe;
|
|
601
690
|
}
|
|
602
|
-
if (
|
|
603
|
-
const
|
|
604
|
-
...
|
|
605
|
-
id:
|
|
606
|
-
type:
|
|
607
|
-
title: r.title ??
|
|
608
|
-
icon: r.icon ??
|
|
609
|
-
url:
|
|
691
|
+
if (i.value.length >= e.maxTabs) return null;
|
|
692
|
+
const c = ((ge = l == null ? void 0 : l.createTab) == null ? void 0 : ge.call(l, r)) ?? {}, C = r.url ?? c.url ?? "", te = M(), ie = {
|
|
693
|
+
...c,
|
|
694
|
+
id: te,
|
|
695
|
+
type: y,
|
|
696
|
+
title: r.title ?? c.title ?? (l == null ? void 0 : l.defaultTitle) ?? y,
|
|
697
|
+
icon: r.icon ?? c.icon ?? (l == null ? void 0 : l.icon) ?? (y === "newtab" ? "newtab" : "globe"),
|
|
698
|
+
url: C || void 0,
|
|
610
699
|
// 调用方传入的 data 优先于面板定义 createTab 的默认 data
|
|
611
|
-
data: r.data ??
|
|
612
|
-
history:
|
|
613
|
-
historyIndex:
|
|
700
|
+
data: r.data ?? c.data,
|
|
701
|
+
history: C ? [C] : [],
|
|
702
|
+
historyIndex: C ? 0 : -1,
|
|
614
703
|
loading: !1,
|
|
615
704
|
reloadKey: 0
|
|
616
705
|
};
|
|
617
|
-
return
|
|
618
|
-
},
|
|
619
|
-
const
|
|
620
|
-
return
|
|
621
|
-
},
|
|
622
|
-
const
|
|
623
|
-
if (!
|
|
624
|
-
const
|
|
625
|
-
if (!
|
|
626
|
-
U({ type: "web", url:
|
|
706
|
+
return C && !r.title && !c.title && (ie.title = ne(C)), i.value.push(ie), r.activate !== !1 && (o.value = te), s.value = !0, ie;
|
|
707
|
+
}, Y = (a, r) => {
|
|
708
|
+
const y = se(a, e.searchUrlTemplate);
|
|
709
|
+
return y ? U({ type: "web", url: y, title: r }) : null;
|
|
710
|
+
}, p = (a) => !!a && (a.type === "web" || a.type === "newtab"), E = (a, r) => {
|
|
711
|
+
const y = se(a, e.searchUrlTemplate);
|
|
712
|
+
if (!y) return;
|
|
713
|
+
const l = T.value;
|
|
714
|
+
if (!p(l)) {
|
|
715
|
+
U({ type: "web", url: y, title: r });
|
|
627
716
|
return;
|
|
628
717
|
}
|
|
629
|
-
if (
|
|
630
|
-
|
|
718
|
+
if (l.url === y) {
|
|
719
|
+
l.reloadKey = (l.reloadKey ?? 0) + 1, l.loading = !0;
|
|
631
720
|
return;
|
|
632
721
|
}
|
|
633
|
-
const
|
|
634
|
-
|
|
635
|
-
},
|
|
636
|
-
|
|
637
|
-
},
|
|
638
|
-
const r =
|
|
722
|
+
const c = l.history.slice(0, l.historyIndex + 1);
|
|
723
|
+
c.push(y), l.type = "web", l.icon = "globe", l.url = y, l.title = r ?? ne(y), l.history = c, l.historyIndex = c.length - 1, l.loading = !0;
|
|
724
|
+
}, _ = (a) => {
|
|
725
|
+
E(a);
|
|
726
|
+
}, I = (a) => {
|
|
727
|
+
const r = i.value.findIndex((l) => l.id === a);
|
|
639
728
|
if (r < 0) return;
|
|
640
|
-
if (
|
|
641
|
-
|
|
729
|
+
if (i.value.splice(r, 1), !i.value.length) {
|
|
730
|
+
o.value = "", g();
|
|
642
731
|
return;
|
|
643
732
|
}
|
|
644
|
-
if (
|
|
645
|
-
const
|
|
646
|
-
|
|
647
|
-
},
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
const
|
|
651
|
-
|
|
652
|
-
},
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
733
|
+
if (o.value !== a) return;
|
|
734
|
+
const y = i.value[r] ?? i.value[r - 1] ?? null;
|
|
735
|
+
o.value = (y == null ? void 0 : y.id) ?? "";
|
|
736
|
+
}, L = (a, r) => {
|
|
737
|
+
const y = i.value.findIndex((c) => c.id === a);
|
|
738
|
+
if (y < 0) return;
|
|
739
|
+
const l = r === "left" ? i.value.slice(y) : i.value.slice(0, y + 1);
|
|
740
|
+
l.length !== i.value.length && (i.value = l, l.some((c) => c.id === o.value) || (o.value = a));
|
|
741
|
+
}, H = (a) => L(a, "left"), ee = (a) => L(a, "right"), ae = (a) => {
|
|
742
|
+
i.value.some((r) => r.id === a) && (o.value = a);
|
|
743
|
+
}, Pe = (a, r) => {
|
|
744
|
+
const y = i.value.find((l) => l.id === a);
|
|
745
|
+
y && Object.assign(y, r);
|
|
746
|
+
}, Se = (a, r, y) => {
|
|
747
|
+
const l = se(a, e.searchUrlTemplate);
|
|
748
|
+
if (!l) return;
|
|
749
|
+
const c = y ? i.value.find((te) => te.id === y) : T.value;
|
|
750
|
+
if (!c || c.type !== "web" && c.type !== "newtab") return;
|
|
751
|
+
if (c.url === l) {
|
|
752
|
+
r && (c.title = r);
|
|
659
753
|
return;
|
|
660
754
|
}
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
},
|
|
664
|
-
const r =
|
|
665
|
-
!r || a < 0 || a >= r.history.length || (r.historyIndex = a, r.url = r.history[a], r.title =
|
|
755
|
+
const C = c.history.slice(0, c.historyIndex + 1);
|
|
756
|
+
C.push(l), c.type === "newtab" && (c.type = "web", c.icon = "globe"), c.url = l, c.title = r ?? ne(l), c.history = C, c.historyIndex = C.length - 1;
|
|
757
|
+
}, be = (a) => {
|
|
758
|
+
const r = T.value;
|
|
759
|
+
!r || a < 0 || a >= r.history.length || (r.historyIndex = a, r.url = r.history[a], r.title = ne(r.url), r.loading = !0);
|
|
666
760
|
};
|
|
667
761
|
return {
|
|
668
|
-
isOpen:
|
|
669
|
-
width:
|
|
670
|
-
maximized:
|
|
671
|
-
tabs:
|
|
672
|
-
activeTabId:
|
|
673
|
-
activeTab:
|
|
674
|
-
canGoBack:
|
|
675
|
-
canGoForward:
|
|
676
|
-
isRestoring:
|
|
762
|
+
isOpen: s,
|
|
763
|
+
width: w,
|
|
764
|
+
maximized: m,
|
|
765
|
+
tabs: i,
|
|
766
|
+
activeTabId: o,
|
|
767
|
+
activeTab: T,
|
|
768
|
+
canGoBack: N,
|
|
769
|
+
canGoForward: O,
|
|
770
|
+
isRestoring: v,
|
|
677
771
|
options: e,
|
|
678
772
|
registry: n,
|
|
679
|
-
open:
|
|
680
|
-
close:
|
|
681
|
-
toggle:
|
|
682
|
-
setMaximized:
|
|
683
|
-
toggleMaximized:
|
|
684
|
-
setWidth:
|
|
773
|
+
open: V,
|
|
774
|
+
close: g,
|
|
775
|
+
toggle: u,
|
|
776
|
+
setMaximized: d,
|
|
777
|
+
toggleMaximized: R,
|
|
778
|
+
setWidth: F,
|
|
685
779
|
addTab: U,
|
|
686
|
-
openInNewTab:
|
|
687
|
-
openInActiveTab:
|
|
688
|
-
closeTab:
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
780
|
+
openInNewTab: Y,
|
|
781
|
+
openInActiveTab: _,
|
|
782
|
+
closeTab: I,
|
|
783
|
+
closeTabsToLeft: H,
|
|
784
|
+
closeTabsToRight: ee,
|
|
785
|
+
activateTab: ae,
|
|
786
|
+
updateTab: Pe,
|
|
787
|
+
navigate: E,
|
|
788
|
+
recordNavigation: Se,
|
|
693
789
|
goBack: () => {
|
|
694
|
-
const a =
|
|
695
|
-
a &&
|
|
790
|
+
const a = T.value;
|
|
791
|
+
a && be(a.historyIndex - 1);
|
|
696
792
|
},
|
|
697
793
|
goForward: () => {
|
|
698
|
-
const a =
|
|
699
|
-
a &&
|
|
794
|
+
const a = T.value;
|
|
795
|
+
a && be(a.historyIndex + 1);
|
|
700
796
|
},
|
|
701
797
|
reload: () => {
|
|
702
|
-
const a =
|
|
798
|
+
const a = T.value;
|
|
703
799
|
a && (a.reloadKey = (a.reloadKey ?? 0) + 1, a.loading = !0);
|
|
704
800
|
},
|
|
705
801
|
reset: () => {
|
|
706
|
-
|
|
802
|
+
i.value = [], o.value = "", s.value = !1, m.value = !1, w.value = A(e.initialWidth);
|
|
707
803
|
},
|
|
708
|
-
snapshot: () =>
|
|
804
|
+
snapshot: () => i.value.map((a) => ({
|
|
709
805
|
id: a.id,
|
|
710
806
|
type: a.type,
|
|
711
807
|
title: a.title,
|
|
@@ -716,44 +812,44 @@ const pe = {
|
|
|
716
812
|
data: a.data ? { ...a.data } : void 0
|
|
717
813
|
})),
|
|
718
814
|
restore: (a, r) => {
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
var
|
|
815
|
+
var l;
|
|
816
|
+
v.value = !0, i.value = (a ?? []).map((c) => {
|
|
817
|
+
var C;
|
|
722
818
|
return {
|
|
723
|
-
...
|
|
724
|
-
history: [...
|
|
725
|
-
historyIndex: Math.min(Math.max(
|
|
726
|
-
data:
|
|
819
|
+
...c,
|
|
820
|
+
history: [...c.history ?? []],
|
|
821
|
+
historyIndex: Math.min(Math.max(c.historyIndex ?? -1, -1), (((C = c.history) == null ? void 0 : C.length) ?? 0) - 1),
|
|
822
|
+
data: c.data ? { ...c.data } : void 0,
|
|
727
823
|
loading: !1,
|
|
728
824
|
reloadKey: 0
|
|
729
825
|
};
|
|
730
|
-
}),
|
|
731
|
-
const
|
|
732
|
-
|
|
826
|
+
}), i.value.forEach((c) => {
|
|
827
|
+
const C = /^right-panel-(\d+)(?:-|$)/.exec(c.id);
|
|
828
|
+
C && (x = Math.max(x, Number(C[1])));
|
|
733
829
|
});
|
|
734
|
-
const
|
|
735
|
-
|
|
736
|
-
|
|
830
|
+
const y = r && i.value.some((c) => c.id === r) ? r : ((l = i.value[0]) == null ? void 0 : l.id) ?? "";
|
|
831
|
+
o.value = y, _e(() => {
|
|
832
|
+
v.value = !1;
|
|
737
833
|
});
|
|
738
834
|
}
|
|
739
835
|
};
|
|
740
836
|
};
|
|
741
|
-
let
|
|
742
|
-
const
|
|
743
|
-
const e =
|
|
837
|
+
let le;
|
|
838
|
+
const J = () => (le || (le = Kt({ registry: he })), le), vn = (t) => {
|
|
839
|
+
const e = J();
|
|
744
840
|
Object.assign(e.options, t), typeof t.initialWidth == "number" && e.setWidth(t.initialWidth);
|
|
745
|
-
},
|
|
746
|
-
|
|
747
|
-
},
|
|
841
|
+
}, bn = () => {
|
|
842
|
+
J().reset();
|
|
843
|
+
}, jt = { class: "wi-right-panel__body" }, Xt = {
|
|
748
844
|
key: 1,
|
|
749
845
|
class: "wi-right-panel__unknown"
|
|
750
|
-
},
|
|
846
|
+
}, qt = { class: "wi-right-panel__unknown-title" }, Jt = {
|
|
751
847
|
key: 1,
|
|
752
848
|
class: "wi-right-panel__lazy"
|
|
753
|
-
},
|
|
849
|
+
}, Yt = { class: "wi-right-panel__lazy-title" }, Qt = {
|
|
754
850
|
key: 0,
|
|
755
851
|
class: "wi-right-panel__empty"
|
|
756
|
-
},
|
|
852
|
+
}, Zt = { class: "wi-right-panel__empty-icon" }, en = { class: "wi-right-panel__empty-desc" }, tn = /* @__PURE__ */ K({
|
|
757
853
|
__name: "RightPanel",
|
|
758
854
|
props: {
|
|
759
855
|
panel: {},
|
|
@@ -761,106 +857,108 @@ const j = () => (ie || (ie = Bt({ registry: re })), ie), cn = (t) => {
|
|
|
761
857
|
},
|
|
762
858
|
emits: ["tool-click"],
|
|
763
859
|
setup(t, { expose: e, emit: n }) {
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
(
|
|
768
|
-
|
|
860
|
+
const s = t, i = n, o = $(() => s.panel ?? J()), m = Me() ? "在这里打开网页或终端,与对话并行使用。" : "在这里打开网页,与对话并行使用。", v = $(() => o.value.isOpen.value), x = $(() => o.value.width.value), M = $(() => o.value.maximized.value), k = $(() => o.value.tabs.value), A = $(() => o.value.activeTabId.value), w = $(() => k.value.map((_) => ({ tab: _, definition: o.value.registry.get(_.type) }))), T = ce(/* @__PURE__ */ new Set());
|
|
861
|
+
q(
|
|
862
|
+
A,
|
|
863
|
+
(_) => {
|
|
864
|
+
_ && T.add(_);
|
|
769
865
|
},
|
|
770
866
|
{ immediate: !0 }
|
|
771
|
-
),
|
|
772
|
-
() =>
|
|
867
|
+
), q(
|
|
868
|
+
() => k.value.map((_) => _.id).join("|"),
|
|
773
869
|
() => {
|
|
774
|
-
const
|
|
775
|
-
Array.from(
|
|
776
|
-
|
|
870
|
+
const _ = new Set(k.value.map((I) => I.id));
|
|
871
|
+
Array.from(T).forEach((I) => {
|
|
872
|
+
_.has(I) || T.delete(I);
|
|
777
873
|
});
|
|
778
874
|
}
|
|
779
875
|
);
|
|
780
|
-
const
|
|
876
|
+
const N = (_) => o.value.activateTab(_), O = (_) => o.value.closeTab(_), V = (_) => o.value.closeTabsToLeft(_), g = (_) => o.value.closeTabsToRight(_), u = () => o.value.addTab(), d = () => o.value.close(), R = () => o.value.toggleMaximized(), F = (_) => i("tool-click", _), U = P(!1), Y = (_) => {
|
|
781
877
|
if (typeof window > "u") return;
|
|
782
|
-
|
|
783
|
-
const
|
|
784
|
-
|
|
785
|
-
},
|
|
786
|
-
|
|
878
|
+
U.value = !0;
|
|
879
|
+
const I = _.clientX, L = x.value, H = (ae) => {
|
|
880
|
+
o.value.setWidth(L + (I - ae.clientX));
|
|
881
|
+
}, ee = () => {
|
|
882
|
+
U.value = !1, window.removeEventListener("pointermove", H), window.removeEventListener("pointerup", ee);
|
|
787
883
|
};
|
|
788
|
-
window.addEventListener("pointermove",
|
|
789
|
-
},
|
|
790
|
-
if (!
|
|
791
|
-
const
|
|
792
|
-
|
|
884
|
+
window.addEventListener("pointermove", H), window.addEventListener("pointerup", ee);
|
|
885
|
+
}, p = () => o.value.setWidth(o.value.options.initialWidth), E = (_) => {
|
|
886
|
+
if (!s.enableShortcut || !(_.ctrlKey || _.metaKey) || !_.shiftKey || _.key.toLowerCase() !== "b") return;
|
|
887
|
+
const I = _.target, L = I == null ? void 0 : I.tagName;
|
|
888
|
+
L === "INPUT" || L === "TEXTAREA" || I != null && I.isContentEditable || (_.preventDefault(), o.value.addTab());
|
|
793
889
|
};
|
|
794
|
-
return
|
|
890
|
+
return Te(() => window.addEventListener("keydown", E)), ke(() => window.removeEventListener("keydown", E)), e({ panel: o }), (_, I) => v.value ? (h(), f("aside", {
|
|
795
891
|
key: 0,
|
|
796
|
-
class:
|
|
797
|
-
style:
|
|
892
|
+
class: ue(["wi-right-panel", { "is-resizing": U.value, "is-maximized": M.value }]),
|
|
893
|
+
style: pe(M.value ? void 0 : { width: `${x.value}px` })
|
|
798
894
|
}, [
|
|
799
|
-
|
|
895
|
+
M.value ? D("", !0) : (h(), f("span", {
|
|
800
896
|
key: 0,
|
|
801
897
|
class: "wi-right-panel__resizer",
|
|
802
898
|
title: "拖拽调整宽度,双击恢复默认",
|
|
803
|
-
onPointerdown:
|
|
804
|
-
onDblclick:
|
|
899
|
+
onPointerdown: Q(Y, ["stop", "prevent"]),
|
|
900
|
+
onDblclick: p
|
|
805
901
|
}, null, 32)),
|
|
806
|
-
|
|
807
|
-
tabs:
|
|
808
|
-
"active-id":
|
|
809
|
-
maximized:
|
|
810
|
-
onSelect:
|
|
811
|
-
onClose:
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
902
|
+
z(et, {
|
|
903
|
+
tabs: k.value,
|
|
904
|
+
"active-id": A.value,
|
|
905
|
+
maximized: M.value,
|
|
906
|
+
onSelect: N,
|
|
907
|
+
onClose: O,
|
|
908
|
+
onCloseLeft: V,
|
|
909
|
+
onCloseRight: g,
|
|
910
|
+
onAdd: u,
|
|
911
|
+
onCollapse: d,
|
|
912
|
+
onToggleMaximize: R
|
|
815
913
|
}, null, 8, ["tabs", "active-id", "maximized"]),
|
|
816
|
-
|
|
817
|
-
(h(!0),
|
|
818
|
-
var
|
|
819
|
-
return
|
|
820
|
-
key:
|
|
914
|
+
b("div", jt, [
|
|
915
|
+
(h(!0), f(G, null, X(w.value, (L) => {
|
|
916
|
+
var H;
|
|
917
|
+
return we((h(), f("div", {
|
|
918
|
+
key: L.tab.id,
|
|
821
919
|
class: "wi-right-panel__view"
|
|
822
920
|
}, [
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
key: `${
|
|
826
|
-
tab:
|
|
827
|
-
panel:
|
|
828
|
-
onToolClick:
|
|
829
|
-
}, null, 40, ["tab", "panel"])) : (h(),
|
|
830
|
-
|
|
831
|
-
|
|
921
|
+
T.has(L.tab.id) ? (h(), f(G, { key: 0 }, [
|
|
922
|
+
L.definition ? (h(), de(Be((H = L.definition) == null ? void 0 : H.component), {
|
|
923
|
+
key: `${L.tab.id}-${L.tab.reloadKey ?? 0}`,
|
|
924
|
+
tab: L.tab,
|
|
925
|
+
panel: o.value,
|
|
926
|
+
onToolClick: F
|
|
927
|
+
}, null, 40, ["tab", "panel"])) : (h(), f("div", Xt, [
|
|
928
|
+
b("p", qt, "未注册的面板类型:" + W(L.tab.type), 1),
|
|
929
|
+
I[0] || (I[0] = b("p", { class: "wi-right-panel__unknown-desc" }, "请先通过 registerRightPanel 注册该类型的面板组件。", -1))
|
|
832
930
|
]))
|
|
833
|
-
], 64)) : (h(),
|
|
834
|
-
|
|
835
|
-
|
|
931
|
+
], 64)) : (h(), f("div", Jt, [
|
|
932
|
+
b("p", Yt, W(L.tab.title), 1),
|
|
933
|
+
I[1] || (I[1] = b("p", { class: "wi-right-panel__lazy-desc" }, "点击标签页加载内容", -1))
|
|
836
934
|
]))
|
|
837
935
|
])), [
|
|
838
|
-
[
|
|
936
|
+
[Ve, L.tab.id === A.value]
|
|
839
937
|
]);
|
|
840
938
|
}), 128)),
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
939
|
+
k.value.length ? D("", !0) : (h(), f("div", Qt, [
|
|
940
|
+
b("span", Zt, [
|
|
941
|
+
z(S, {
|
|
844
942
|
name: "newtab",
|
|
845
943
|
size: 30
|
|
846
944
|
})
|
|
847
945
|
]),
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
946
|
+
I[2] || (I[2] = b("p", { class: "wi-right-panel__empty-title" }, "还没有打开任何标签页", -1)),
|
|
947
|
+
b("p", en, W(ye(m)), 1),
|
|
948
|
+
b("button", {
|
|
851
949
|
type: "button",
|
|
852
950
|
class: "wi-right-panel__empty-button",
|
|
853
|
-
onClick:
|
|
951
|
+
onClick: u
|
|
854
952
|
}, "新建标签页")
|
|
855
953
|
]))
|
|
856
954
|
])
|
|
857
|
-
], 6)) :
|
|
955
|
+
], 6)) : D("", !0);
|
|
858
956
|
}
|
|
859
|
-
}),
|
|
957
|
+
}), gn = /* @__PURE__ */ j(tn, [["__scopeId", "data-v-161bae49"]]), re = "wi-chat:right-panel-scope:", nn = () => ({
|
|
860
958
|
load(t) {
|
|
861
959
|
if (typeof localStorage > "u") return null;
|
|
862
960
|
try {
|
|
863
|
-
const e = localStorage.getItem(
|
|
961
|
+
const e = localStorage.getItem(re + t);
|
|
864
962
|
if (!e) return null;
|
|
865
963
|
const n = JSON.parse(e);
|
|
866
964
|
return Array.isArray(n == null ? void 0 : n.tabs) ? n : null;
|
|
@@ -871,68 +969,68 @@ const j = () => (ie || (ie = Bt({ registry: re })), ie), cn = (t) => {
|
|
|
871
969
|
save(t, e) {
|
|
872
970
|
if (!(typeof localStorage > "u"))
|
|
873
971
|
try {
|
|
874
|
-
localStorage.setItem(
|
|
972
|
+
localStorage.setItem(re + t, JSON.stringify(e));
|
|
875
973
|
} catch {
|
|
876
974
|
}
|
|
877
975
|
},
|
|
878
976
|
clear(t) {
|
|
879
977
|
if (!(typeof localStorage > "u"))
|
|
880
978
|
try {
|
|
881
|
-
localStorage.removeItem(
|
|
979
|
+
localStorage.removeItem(re + t);
|
|
882
980
|
} catch {
|
|
883
981
|
}
|
|
884
982
|
}
|
|
885
|
-
}),
|
|
886
|
-
let
|
|
887
|
-
const
|
|
888
|
-
"storage" in t && (
|
|
889
|
-
},
|
|
890
|
-
const e =
|
|
891
|
-
if (!
|
|
983
|
+
}), Z = P("");
|
|
984
|
+
let B = nn(), ve = !0, me = !1;
|
|
985
|
+
const Le = /* @__PURE__ */ new Set(), fn = (t = {}) => {
|
|
986
|
+
"storage" in t && (B = t.storage ?? null), typeof t.persist == "boolean" && (ve = t.persist);
|
|
987
|
+
}, mn = () => Z.value, ze = (t) => {
|
|
988
|
+
const e = Z.value;
|
|
989
|
+
if (!ve || !B || !e) return;
|
|
892
990
|
const n = t.snapshot();
|
|
893
|
-
!n.length && !
|
|
991
|
+
!n.length && !Le.has(e) || B.save(e, {
|
|
894
992
|
scopeId: e,
|
|
895
993
|
tabs: n,
|
|
896
994
|
activeTabId: t.activeTabId.value,
|
|
897
995
|
savedAt: Date.now()
|
|
898
996
|
});
|
|
899
|
-
},
|
|
900
|
-
|
|
901
|
-
},
|
|
902
|
-
|
|
997
|
+
}, an = (t) => {
|
|
998
|
+
me || (me = !0, q([t.tabs, t.activeTabId], () => ze(t), { deep: !0, flush: "post" }));
|
|
999
|
+
}, _n = (t, e = J()) => {
|
|
1000
|
+
an(e);
|
|
903
1001
|
const n = String(t ?? "").trim();
|
|
904
|
-
if (n ===
|
|
905
|
-
if (
|
|
1002
|
+
if (n === Z.value) return;
|
|
1003
|
+
if (ze(e), Z.value = n, !n) {
|
|
906
1004
|
e.restore([]);
|
|
907
1005
|
return;
|
|
908
1006
|
}
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
},
|
|
912
|
-
!t || !(
|
|
913
|
-
},
|
|
1007
|
+
const s = ve && B ? B.load(n) : null;
|
|
1008
|
+
Le.add(n), e.restore((s == null ? void 0 : s.tabs) ?? [], s == null ? void 0 : s.activeTabId);
|
|
1009
|
+
}, wn = (t = Z.value) => {
|
|
1010
|
+
!t || !(B != null && B.clear) || B.clear(t);
|
|
1011
|
+
}, Ce = (t, e) => ({
|
|
914
1012
|
id: t.id,
|
|
915
1013
|
type: t.type,
|
|
916
1014
|
title: t.title,
|
|
917
1015
|
icon: t.icon,
|
|
918
1016
|
url: t.url,
|
|
919
1017
|
active: t.id === e
|
|
920
|
-
}),
|
|
921
|
-
const e = t.panel ??
|
|
922
|
-
const
|
|
923
|
-
return e.tabs.value.map((
|
|
924
|
-
}),
|
|
1018
|
+
}), yn = (t = {}) => {
|
|
1019
|
+
const e = t.panel ?? J(), n = $(() => {
|
|
1020
|
+
const v = e.activeTabId.value;
|
|
1021
|
+
return e.tabs.value.map((x) => Ce(x, v));
|
|
1022
|
+
}), s = $(() => n.value.length > 0), i = $(() => n.value.length), o = $(() => e.activeTabId.value), m = $(() => e.isOpen.value);
|
|
925
1023
|
return {
|
|
926
1024
|
tabs: n,
|
|
927
|
-
hasTabs:
|
|
928
|
-
tabCount:
|
|
929
|
-
activeTabId:
|
|
930
|
-
isOpen:
|
|
931
|
-
activateTab(
|
|
932
|
-
e.activateTab(
|
|
1025
|
+
hasTabs: s,
|
|
1026
|
+
tabCount: i,
|
|
1027
|
+
activeTabId: o,
|
|
1028
|
+
isOpen: m,
|
|
1029
|
+
activateTab(v) {
|
|
1030
|
+
e.activateTab(v), e.open();
|
|
933
1031
|
},
|
|
934
|
-
addTab(
|
|
935
|
-
e.addTab(
|
|
1032
|
+
addTab(v) {
|
|
1033
|
+
e.addTab(v);
|
|
936
1034
|
},
|
|
937
1035
|
open() {
|
|
938
1036
|
e.open();
|
|
@@ -941,45 +1039,46 @@ const Ie = /* @__PURE__ */ new Set(), pn = (t = {}) => {
|
|
|
941
1039
|
e.toggle();
|
|
942
1040
|
}
|
|
943
1041
|
};
|
|
944
|
-
},
|
|
1042
|
+
}, Tn = (t = J()) => {
|
|
945
1043
|
const e = t.activeTabId.value;
|
|
946
|
-
return t.tabs.value.map((n) =>
|
|
1044
|
+
return t.tabs.value.map((n) => Ce(n, e));
|
|
947
1045
|
};
|
|
948
1046
|
export {
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1047
|
+
Ie as BUILTIN_RIGHT_PANELS,
|
|
1048
|
+
Ee as BrowserToolbar,
|
|
1049
|
+
gt as DEFAULT_NEW_TAB_RECOMMENDATIONS,
|
|
1050
|
+
bt as DEFAULT_NEW_TAB_TOOLS,
|
|
1051
|
+
Re as DEFAULT_SEARCH_URL_TEMPLATE,
|
|
1052
|
+
fe as RIGHT_PANEL_ICONS,
|
|
1053
|
+
re as RIGHT_PANEL_SCOPE_STORAGE_PREFIX,
|
|
1054
|
+
gn as RightPanel,
|
|
1055
|
+
S as RightPanelIcon,
|
|
1056
|
+
et as RightPanelTabs,
|
|
1057
|
+
vt as RightPanelToolList,
|
|
1058
|
+
Lt as WEBVIEW_PARTITION,
|
|
1059
|
+
zt as canUseWebview,
|
|
1060
|
+
wn as clearRightPanelScope,
|
|
1061
|
+
vn as configureRightPanel,
|
|
1062
|
+
fn as configureRightPanelScope,
|
|
1063
|
+
nn as createLocalStorageRightPanelScopeStorage,
|
|
1064
|
+
Kt as createRightPanel,
|
|
967
1065
|
$e as createRightPanelRegistry,
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
hn as
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1066
|
+
Pt as createWebviewElement,
|
|
1067
|
+
he as defaultRightPanelRegistry,
|
|
1068
|
+
hn as getRightPanelDefinition,
|
|
1069
|
+
mn as getRightPanelScope,
|
|
1070
|
+
Me as isDesktopRuntime,
|
|
1071
|
+
Tn as listRightPanelTabs,
|
|
1072
|
+
Rt as newTabPanelDefinition,
|
|
1073
|
+
xe as readElectronBridge,
|
|
1074
|
+
pn as registerRightPanel,
|
|
1075
|
+
bn as resetRightPanel,
|
|
1076
|
+
ne as resolveRightPanelTitle,
|
|
1077
|
+
se as resolveRightPanelUrl,
|
|
1078
|
+
Ct as resolveWebRuntime,
|
|
1079
|
+
_n as setRightPanelScope,
|
|
1080
|
+
J as useRightPanel,
|
|
1081
|
+
yn as useRightPanelTabs,
|
|
1082
|
+
Ft as webPanelDefinition
|
|
984
1083
|
};
|
|
985
1084
|
//# sourceMappingURL=index.js.map
|