@opentiny/tiny-robot 0.5.2-alpha.15 → 0.5.2-alpha.17
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/anchor/index.js +32 -32
- package/dist/container/index.js +16 -15
- package/dist/dropdown-menu/index.js +141 -97
- package/dist/extension-manager/index.js +814 -292
- package/dist/index.d.ts +402 -228
- package/dist/index.js +64 -61
- package/dist/index3.js +92 -95
- package/dist/index6.js +641 -622
- package/dist/index7.js +296 -186
- package/dist/model-selector/index.js +517 -522
- package/dist/sender/index.js +111 -111
- package/dist/style.css +1 -1
- package/dist/useStableId.js +15 -0
- package/package.json +3 -3
|
@@ -1,172 +1,303 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const o =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { ref as B, computed as x, watch as D, reactive as se, toValue as X, cloneVNode as we, Comment as $e, Text as Se, Fragment as P, isVNode as Me, Teleport as Ee, Suspense as Ie, nextTick as ue, defineComponent as V, onMounted as me, toRef as Ae, useSlots as G, openBlock as c, createElementBlock as p, createBlock as A, resolveDynamicComponent as K, renderSlot as M, withDirectives as ae, createElementVNode as T, normalizeStyle as ie, vShow as Pe, createVNode as j, withCtx as O, renderList as H, normalizeClass as R, createCommentVNode as S, toDisplayString as I, unref as $, withModifiers as oe, createSlots as J, normalizeProps as ve, guardReactiveProps as Ne, createTextVNode as re, mergeProps as pe, onBeforeUnmount as Ve, useModel as ce, vModelSelect as Le, vModelText as Be, mergeModels as Re } from "vue";
|
|
2
|
+
import { IconMore as Fe, IconArrowDown as fe, IconClose as De } from "@opentiny/tiny-robot-svgs";
|
|
3
|
+
import { g as Q } from "../index4.js";
|
|
4
|
+
import { u as ge } from "../useStableId.js";
|
|
5
|
+
import { _ as L } from "../_plugin-vue_export-helper.js";
|
|
6
|
+
const Y = (e, o) => Object.prototype.hasOwnProperty.call(e, o), U = () => /* @__PURE__ */ Object.create(null), z = (e, o, t) => {
|
|
7
|
+
Object.defineProperty(e, o, {
|
|
8
|
+
configurable: !0,
|
|
9
|
+
enumerable: !0,
|
|
10
|
+
value: t,
|
|
11
|
+
writable: !0
|
|
12
|
+
});
|
|
13
|
+
}, Oe = (e) => {
|
|
14
|
+
const o = U();
|
|
15
|
+
for (const [t, i] of Object.entries(e)) {
|
|
16
|
+
const r = U();
|
|
17
|
+
for (const [d, l] of Object.entries(i ?? {}))
|
|
18
|
+
(d === "installed" || d === "available") && z(r, d, l);
|
|
19
|
+
z(o, t, r);
|
|
20
|
+
}
|
|
21
|
+
return o;
|
|
22
|
+
}, je = (e, o, t) => {
|
|
23
|
+
if (!Y(e, o)) return;
|
|
24
|
+
const i = e[o];
|
|
25
|
+
if (!(i === void 0 || !Y(i, t)))
|
|
26
|
+
return i[t];
|
|
27
|
+
}, Ge = (e, o, t, i) => {
|
|
28
|
+
const r = Y(e, o) && e[o] !== void 0 ? e[o] : U();
|
|
29
|
+
Y(e, o) || z(e, o, r), z(r, t, i);
|
|
30
|
+
}, He = (e, o, t) => je(e, o, t) ?? !0, Ke = (e, o) => {
|
|
31
|
+
const t = B(e.defaultActiveTab), i = B(U()), r = x(() => e.tabs.map((m) => m.id)), d = x(() => r.value[0]);
|
|
32
|
+
D(
|
|
33
|
+
r,
|
|
34
|
+
(m) => {
|
|
35
|
+
const f = new Set(m), s = U();
|
|
36
|
+
for (const [g, h] of Object.entries(i.value))
|
|
37
|
+
f.has(g) && z(s, g, h);
|
|
38
|
+
i.value = s;
|
|
39
|
+
},
|
|
40
|
+
{ immediate: !0 }
|
|
41
|
+
);
|
|
42
|
+
const l = (m) => {
|
|
43
|
+
m.includes(t.value ?? "") || (t.value = m[0]);
|
|
44
|
+
};
|
|
45
|
+
D(
|
|
46
|
+
[r, () => e.activeTab],
|
|
47
|
+
([m, f]) => {
|
|
48
|
+
f === void 0 && l(m);
|
|
49
|
+
},
|
|
50
|
+
{ immediate: !0 }
|
|
51
|
+
);
|
|
52
|
+
const v = x(() => {
|
|
53
|
+
const m = e.activeTab ?? t.value, f = e.tabs.find((s) => s.id === m);
|
|
54
|
+
return (f == null ? void 0 : f.id) ?? d.value;
|
|
55
|
+
}), a = x(
|
|
56
|
+
() => v.value === void 0 ? void 0 : e.tabs.find((m) => m.id === v.value)
|
|
57
|
+
);
|
|
58
|
+
let n = e.activeTab;
|
|
59
|
+
const u = (m) => {
|
|
60
|
+
n = m, o("update:active-tab", m);
|
|
61
|
+
};
|
|
62
|
+
D(
|
|
63
|
+
v,
|
|
64
|
+
(m) => {
|
|
65
|
+
if (e.activeTab !== void 0 && m === e.activeTab) {
|
|
66
|
+
n = m;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
m !== n && u(m);
|
|
70
|
+
},
|
|
71
|
+
{ immediate: e.activeTab !== void 0 }
|
|
72
|
+
);
|
|
73
|
+
const y = (m, f) => He(i.value, m, f);
|
|
74
|
+
return {
|
|
75
|
+
activeTabId: v,
|
|
76
|
+
activeTab: a,
|
|
77
|
+
selectTab: (m) => {
|
|
78
|
+
const f = e.tabs.find((s) => s.id === m);
|
|
79
|
+
!f || v.value === f.id || (e.activeTab === void 0 && (t.value = f.id), u(f.id), o("tab-change", { tabId: f.id }));
|
|
80
|
+
},
|
|
81
|
+
isSectionExpanded: y,
|
|
82
|
+
toggleSection: (m, f) => {
|
|
83
|
+
if (!e.tabs.some((h) => h.id === m)) return;
|
|
84
|
+
const s = !y(m, f), g = Oe(i.value);
|
|
85
|
+
Ge(g, m, f, s), i.value = g, o("section-toggle", { tabId: m, sectionKey: f, expanded: s });
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}, Ue = () => /* @__PURE__ */ Object.create(null), de = () => se({ selectedTag: "", searchValue: "" }), ze = (e) => {
|
|
89
|
+
const o = se(Ue()), t = de();
|
|
90
|
+
return D(
|
|
91
|
+
() => X(e).map((r) => r.id),
|
|
92
|
+
(r) => {
|
|
93
|
+
const d = new Set(r);
|
|
94
|
+
for (const l of Object.keys(o))
|
|
95
|
+
d.has(l) || delete o[l];
|
|
96
|
+
},
|
|
97
|
+
{ immediate: !0 }
|
|
98
|
+
), { getFilterState: (r) => r === void 0 ? t : o[r] ?? (o[r] = de()) };
|
|
99
|
+
}, We = () => se({ selectedTag: "", searchValue: "" }), qe = (e) => {
|
|
100
|
+
const o = /* @__PURE__ */ new Set(), t = [];
|
|
101
|
+
for (const i of e)
|
|
102
|
+
!i.value || o.has(i.value) || (o.add(i.value), t.push(i));
|
|
103
|
+
return t;
|
|
104
|
+
}, Xe = (e) => {
|
|
105
|
+
const o = e.tags;
|
|
106
|
+
return Array.isArray(o) && o.every((t) => typeof t == "string") ? o : [];
|
|
107
|
+
}, Je = (e, o) => {
|
|
108
|
+
const t = e, i = typeof t.name == "string" ? t.name : "", r = typeof t.description == "string" ? t.description : "";
|
|
109
|
+
return `${i} ${r}`.toLowerCase().includes(o);
|
|
110
|
+
}, Qe = (e) => {
|
|
111
|
+
const o = We(), t = x(() => X(e.state) ?? o), i = x({
|
|
112
|
+
get: () => t.value.selectedTag,
|
|
113
|
+
set: (a) => {
|
|
114
|
+
t.value.selectedTag = a;
|
|
115
|
+
}
|
|
116
|
+
}), r = x({
|
|
117
|
+
get: () => t.value.searchValue,
|
|
118
|
+
set: (a) => {
|
|
119
|
+
t.value.searchValue = a;
|
|
120
|
+
}
|
|
121
|
+
}), d = x(() => qe(X(e.tags)));
|
|
122
|
+
D(
|
|
123
|
+
d,
|
|
124
|
+
(a) => {
|
|
125
|
+
i.value && !a.some((n) => n.value === i.value) && (i.value = "");
|
|
126
|
+
},
|
|
127
|
+
{ immediate: !0 }
|
|
128
|
+
);
|
|
129
|
+
const l = x(() => {
|
|
130
|
+
var y, w;
|
|
131
|
+
const a = r.value.trim().toLowerCase(), n = ((y = e.rules) == null ? void 0 : y.getItemTags) ?? Xe, u = ((w = e.rules) == null ? void 0 : w.search) ?? Je;
|
|
132
|
+
return X(e.items).filter((k) => {
|
|
133
|
+
const m = !i.value || n(k).includes(i.value), f = !a || u(k, a);
|
|
134
|
+
return m && f;
|
|
135
|
+
});
|
|
136
|
+
}), v = x(() => ({
|
|
137
|
+
tags: d.value,
|
|
138
|
+
selectedTag: i.value,
|
|
139
|
+
searchValue: r.value,
|
|
140
|
+
"onUpdate:selectedTag": (a) => {
|
|
141
|
+
i.value = a;
|
|
142
|
+
},
|
|
143
|
+
"onUpdate:searchValue": (a) => {
|
|
144
|
+
r.value = a;
|
|
145
|
+
}
|
|
146
|
+
}));
|
|
147
|
+
return { filteredItems: l, selectedTag: i, searchValue: r, controls: v };
|
|
148
|
+
}, be = (e) => e.flatMap((o) => o.type === $e ? [] : o.type === Se && typeof o.children == "string" && o.children.trim() === "" ? [] : o.type !== P || !Array.isArray(o.children) ? [o] : be(o.children.filter(Me))), Ye = (e) => e.type === Ee || e.type === Ie ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
|
|
149
|
+
function Ze({ getSlot: e, componentName: o }) {
|
|
19
150
|
return {
|
|
20
|
-
renderAsChild: (
|
|
21
|
-
var
|
|
22
|
-
const
|
|
23
|
-
return
|
|
151
|
+
renderAsChild: (i, r = {}) => {
|
|
152
|
+
var l;
|
|
153
|
+
const d = be(((l = e()) == null ? void 0 : l(i)) ?? []);
|
|
154
|
+
return d.length !== 1 || !Ye(d[0]) ? null : we(d[0], r, !0);
|
|
24
155
|
}
|
|
25
156
|
};
|
|
26
157
|
}
|
|
27
|
-
const
|
|
28
|
-
triggerRef:
|
|
29
|
-
popoverRef:
|
|
30
|
-
open:
|
|
31
|
-
placement:
|
|
158
|
+
const et = ({
|
|
159
|
+
triggerRef: e,
|
|
160
|
+
popoverRef: o,
|
|
161
|
+
open: t,
|
|
162
|
+
placement: i
|
|
32
163
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
document.documentElement.clientWidth -
|
|
38
|
-
),
|
|
39
|
-
|
|
40
|
-
document.documentElement.clientHeight -
|
|
41
|
-
),
|
|
42
|
-
let
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
x:
|
|
47
|
-
y:
|
|
48
|
-
placement:
|
|
164
|
+
const r = B(), d = () => {
|
|
165
|
+
if (!t.value || !e.value || !o.value) return;
|
|
166
|
+
const l = e.value.getBoundingClientRect(), v = o.value.getBoundingClientRect(), a = 8, n = 8, u = Math.max(
|
|
167
|
+
a,
|
|
168
|
+
document.documentElement.clientWidth - v.width - a
|
|
169
|
+
), y = Math.max(
|
|
170
|
+
a,
|
|
171
|
+
document.documentElement.clientHeight - v.height - a
|
|
172
|
+
), w = Math.min(u, Math.max(a, l.right - v.width)), k = l.bottom + n, m = l.top - v.height - n, f = k + v.height <= document.documentElement.clientHeight - a, s = m >= a;
|
|
173
|
+
let g = i.value;
|
|
174
|
+
g === "bottom-end" && !f && s ? g = "top-end" : g === "top-end" && !s && f && (g = "bottom-end");
|
|
175
|
+
const N = Math.min(y, Math.max(a, g === "bottom-end" ? k : m));
|
|
176
|
+
r.value = {
|
|
177
|
+
x: w,
|
|
178
|
+
y: N,
|
|
179
|
+
placement: g
|
|
49
180
|
};
|
|
50
181
|
};
|
|
51
|
-
return
|
|
52
|
-
[
|
|
53
|
-
async ([
|
|
54
|
-
|
|
182
|
+
return D(
|
|
183
|
+
[t, i],
|
|
184
|
+
async ([l]) => {
|
|
185
|
+
l && (await ue(), d());
|
|
55
186
|
},
|
|
56
187
|
{ flush: "post" }
|
|
57
|
-
),
|
|
188
|
+
), Q("resize", d, { passive: !0 }), Q("scroll", d, {
|
|
58
189
|
capture: !0,
|
|
59
190
|
passive: !0
|
|
60
191
|
}), {
|
|
61
|
-
position:
|
|
192
|
+
position: r
|
|
62
193
|
};
|
|
63
|
-
},
|
|
194
|
+
}, tt = ["aria-expanded"], nt = ["popover"], at = /* @__PURE__ */ V({
|
|
64
195
|
inheritAttrs: !1,
|
|
65
196
|
__name: "ExtensionCardPopover",
|
|
66
197
|
props: {
|
|
67
198
|
asChild: { type: Boolean, default: !1 },
|
|
68
199
|
placement: { default: "bottom-end" }
|
|
69
200
|
},
|
|
70
|
-
setup(
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
201
|
+
setup(e) {
|
|
202
|
+
const o = e, t = `tr-extension-card-popover-${ge()}`, i = B(null), r = B(null), d = B(!1), l = B(!1);
|
|
203
|
+
me(() => {
|
|
204
|
+
l.value = typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function";
|
|
74
205
|
});
|
|
75
|
-
const { position:
|
|
76
|
-
triggerRef:
|
|
77
|
-
popoverRef:
|
|
78
|
-
open:
|
|
79
|
-
placement:
|
|
80
|
-
}),
|
|
81
|
-
if (
|
|
206
|
+
const { position: v } = et({
|
|
207
|
+
triggerRef: i,
|
|
208
|
+
popoverRef: r,
|
|
209
|
+
open: d,
|
|
210
|
+
placement: Ae(o, "placement")
|
|
211
|
+
}), a = x(() => {
|
|
212
|
+
if (v.value)
|
|
82
213
|
return {
|
|
83
|
-
left: `${
|
|
84
|
-
top: `${
|
|
214
|
+
left: `${v.value.x}px`,
|
|
215
|
+
top: `${v.value.y}px`
|
|
85
216
|
};
|
|
86
|
-
}),
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
var
|
|
91
|
-
if (!
|
|
92
|
-
|
|
217
|
+
}), n = G(), u = (s) => {
|
|
218
|
+
const g = s instanceof Element ? s : s == null ? void 0 : s.$el;
|
|
219
|
+
i.value = g instanceof HTMLElement ? g : null;
|
|
220
|
+
}, y = () => {
|
|
221
|
+
var s;
|
|
222
|
+
if (!l.value) {
|
|
223
|
+
d.value = !1;
|
|
93
224
|
return;
|
|
94
225
|
}
|
|
95
|
-
(
|
|
96
|
-
},
|
|
97
|
-
if (!
|
|
98
|
-
|
|
226
|
+
(s = r.value) != null && s.matches(":popover-open") && r.value.hidePopover();
|
|
227
|
+
}, w = () => {
|
|
228
|
+
if (!l.value) {
|
|
229
|
+
d.value = !d.value;
|
|
99
230
|
return;
|
|
100
231
|
}
|
|
101
|
-
|
|
232
|
+
r.value && (r.value.matches(":popover-open") ? r.value.hidePopover() : r.value.showPopover());
|
|
102
233
|
};
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
var
|
|
108
|
-
|
|
234
|
+
Q("click", (s) => {
|
|
235
|
+
var g, h;
|
|
236
|
+
l.value || !d.value || !(s.target instanceof Node) || (g = i.value) != null && g.contains(s.target) || (h = r.value) != null && h.contains(s.target) || y();
|
|
237
|
+
}), Q("keydown", (s) => {
|
|
238
|
+
var g;
|
|
239
|
+
l.value || !d.value || s.key !== "Escape" || (y(), (g = i.value) == null || g.focus());
|
|
109
240
|
});
|
|
110
|
-
const { renderAsChild:
|
|
111
|
-
getSlot: () =>
|
|
241
|
+
const { renderAsChild: k } = Ze({
|
|
242
|
+
getSlot: () => n.trigger,
|
|
112
243
|
componentName: "ExtensionCardPopover"
|
|
113
|
-
}),
|
|
244
|
+
}), m = () => k(
|
|
114
245
|
{
|
|
115
|
-
popoverId:
|
|
116
|
-
open:
|
|
246
|
+
popoverId: t,
|
|
247
|
+
open: d.value
|
|
117
248
|
},
|
|
118
249
|
{
|
|
119
|
-
ref:
|
|
120
|
-
...
|
|
121
|
-
popovertarget:
|
|
250
|
+
ref: u,
|
|
251
|
+
...l.value ? {
|
|
252
|
+
popovertarget: t,
|
|
122
253
|
popovertargetaction: "toggle"
|
|
123
|
-
} : { onClick:
|
|
254
|
+
} : { onClick: w }
|
|
124
255
|
}
|
|
125
|
-
), f = (
|
|
126
|
-
|
|
256
|
+
), f = (s) => {
|
|
257
|
+
d.value = s.newState === "open";
|
|
127
258
|
};
|
|
128
|
-
return (
|
|
129
|
-
|
|
259
|
+
return (s, g) => (c(), p(P, null, [
|
|
260
|
+
e.asChild ? (c(), A(K(m()), { key: 0 })) : (c(), p("button", {
|
|
130
261
|
key: 1,
|
|
131
262
|
ref_key: "triggerRef",
|
|
132
|
-
ref:
|
|
263
|
+
ref: i,
|
|
133
264
|
type: "button",
|
|
134
265
|
class: "tr-extension-card-popover__trigger",
|
|
135
|
-
"aria-controls":
|
|
136
|
-
"aria-expanded":
|
|
137
|
-
onClick:
|
|
266
|
+
"aria-controls": t,
|
|
267
|
+
"aria-expanded": d.value,
|
|
268
|
+
onClick: w
|
|
138
269
|
}, [
|
|
139
|
-
|
|
140
|
-
popoverId:
|
|
141
|
-
open:
|
|
270
|
+
M(s.$slots, "trigger", {
|
|
271
|
+
popoverId: t,
|
|
272
|
+
open: d.value
|
|
142
273
|
}, void 0, !0)
|
|
143
|
-
], 8,
|
|
144
|
-
|
|
145
|
-
id:
|
|
274
|
+
], 8, tt)),
|
|
275
|
+
ae(T("div", {
|
|
276
|
+
id: t,
|
|
146
277
|
ref_key: "popoverRef",
|
|
147
|
-
ref:
|
|
148
|
-
popover:
|
|
278
|
+
ref: r,
|
|
279
|
+
popover: l.value ? "auto" : void 0,
|
|
149
280
|
class: "tr-extension-card-popover__content",
|
|
150
|
-
style:
|
|
281
|
+
style: ie(a.value),
|
|
151
282
|
onToggle: f
|
|
152
283
|
}, [
|
|
153
|
-
|
|
154
|
-
], 44,
|
|
155
|
-
[
|
|
284
|
+
M(s.$slots, "content", { close: y }, void 0, !0)
|
|
285
|
+
], 44, nt), [
|
|
286
|
+
[Pe, l.value || d.value]
|
|
156
287
|
])
|
|
157
288
|
], 64));
|
|
158
289
|
}
|
|
159
|
-
}),
|
|
290
|
+
}), ot = /* @__PURE__ */ L(at, [["__scopeId", "data-v-6dbac593"]]), st = {
|
|
160
291
|
key: 0,
|
|
161
292
|
class: "tr-extension-card__more-action"
|
|
162
|
-
},
|
|
293
|
+
}, it = ["title", "aria-label", "aria-expanded"], rt = { class: "tr-extension-card__more-menu" }, lt = ["disabled", "aria-pressed", "onClick"], ct = {
|
|
163
294
|
key: 0,
|
|
164
295
|
class: "tr-extension-card__more-menu-item-icon-slot"
|
|
165
|
-
},
|
|
296
|
+
}, dt = {
|
|
166
297
|
key: 1,
|
|
167
298
|
class: "tr-extension-card__more-menu-item-icon-placeholder",
|
|
168
299
|
"aria-hidden": "true"
|
|
169
|
-
},
|
|
300
|
+
}, ut = /* @__PURE__ */ V({
|
|
170
301
|
__name: "ExtensionCardMoreMenu",
|
|
171
302
|
props: {
|
|
172
303
|
actions: { default: () => [] },
|
|
@@ -175,138 +306,138 @@ const ve = ({
|
|
|
175
306
|
showIcons: { type: Boolean, default: !0 }
|
|
176
307
|
},
|
|
177
308
|
emits: ["action"],
|
|
178
|
-
setup(
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
id:
|
|
182
|
-
type:
|
|
183
|
-
...
|
|
309
|
+
setup(e, { emit: o }) {
|
|
310
|
+
const t = e, i = o, r = x(() => t.showIcons && t.actions.some((l) => !!l.icon)), d = (l, v) => {
|
|
311
|
+
l.disabled || (v(), i("action", {
|
|
312
|
+
id: l.id,
|
|
313
|
+
type: l.type,
|
|
314
|
+
...l.type === "switch" ? { checked: !l.checked } : {}
|
|
184
315
|
}));
|
|
185
316
|
};
|
|
186
|
-
return (
|
|
187
|
-
|
|
317
|
+
return (l, v) => t.actions.length ? (c(), p("div", st, [
|
|
318
|
+
j(ot, {
|
|
188
319
|
"as-child": "",
|
|
189
|
-
placement:
|
|
320
|
+
placement: t.placement
|
|
190
321
|
}, {
|
|
191
|
-
trigger:
|
|
192
|
-
|
|
322
|
+
trigger: O(({ open: a }) => [
|
|
323
|
+
T("button", {
|
|
193
324
|
class: "tr-extension-card__icon-button",
|
|
194
325
|
type: "button",
|
|
195
|
-
title:
|
|
196
|
-
"aria-label":
|
|
197
|
-
"aria-expanded":
|
|
326
|
+
title: t.label,
|
|
327
|
+
"aria-label": t.label,
|
|
328
|
+
"aria-expanded": a
|
|
198
329
|
}, [
|
|
199
|
-
|
|
200
|
-
], 8,
|
|
330
|
+
j($(Fe), { class: "tr-extension-card__action-icon" })
|
|
331
|
+
], 8, it)
|
|
201
332
|
]),
|
|
202
|
-
content:
|
|
203
|
-
|
|
204
|
-
(
|
|
205
|
-
key:
|
|
333
|
+
content: O(({ close: a }) => [
|
|
334
|
+
T("ul", rt, [
|
|
335
|
+
(c(!0), p(P, null, H(t.actions, (n) => (c(), p("li", {
|
|
336
|
+
key: n.id
|
|
206
337
|
}, [
|
|
207
|
-
|
|
208
|
-
class:
|
|
338
|
+
T("button", {
|
|
339
|
+
class: R(["tr-extension-card__more-menu-item", { "is-danger": n.danger }]),
|
|
209
340
|
type: "button",
|
|
210
|
-
disabled:
|
|
211
|
-
"aria-pressed":
|
|
212
|
-
onClick: (
|
|
341
|
+
disabled: n.disabled,
|
|
342
|
+
"aria-pressed": n.type === "switch" ? n.checked : void 0,
|
|
343
|
+
onClick: (u) => d(n, a)
|
|
213
344
|
}, [
|
|
214
|
-
|
|
215
|
-
|
|
345
|
+
r.value ? (c(), p("span", ct, [
|
|
346
|
+
n.icon ? (c(), A(K(n.icon), {
|
|
216
347
|
key: 0,
|
|
217
348
|
class: "tr-extension-card__more-menu-item-icon"
|
|
218
|
-
})) : (
|
|
219
|
-
])) :
|
|
220
|
-
|
|
221
|
-
], 10,
|
|
349
|
+
})) : (c(), p("span", dt))
|
|
350
|
+
])) : S("", !0),
|
|
351
|
+
T("span", null, I(n.label), 1)
|
|
352
|
+
], 10, lt)
|
|
222
353
|
]))), 128))
|
|
223
354
|
])
|
|
224
355
|
]),
|
|
225
356
|
_: 1
|
|
226
357
|
}, 8, ["placement"])
|
|
227
|
-
])) :
|
|
358
|
+
])) : S("", !0);
|
|
228
359
|
}
|
|
229
|
-
}),
|
|
360
|
+
}), mt = /* @__PURE__ */ L(ut, [["__scopeId", "data-v-657a919a"]]), vt = { class: "tr-extension-card-primary-actions" }, pt = ["checked", "disabled", "aria-label", "onChange"], ft = ["aria-label", "disabled", "onClick"], gt = ["aria-label", "disabled", "onClick"], bt = /* @__PURE__ */ V({
|
|
230
361
|
__name: "ExtensionCardActions",
|
|
231
362
|
props: {
|
|
232
363
|
actions: { default: () => [] }
|
|
233
364
|
},
|
|
234
365
|
emits: ["action"],
|
|
235
|
-
setup(
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
id:
|
|
241
|
-
type:
|
|
242
|
-
checked:
|
|
366
|
+
setup(e, { emit: o }) {
|
|
367
|
+
const t = e, i = o, r = (v, a) => {
|
|
368
|
+
if (v.disabled) return;
|
|
369
|
+
const n = a.currentTarget, u = n.checked;
|
|
370
|
+
n.checked = !!v.checked, i("action", {
|
|
371
|
+
id: v.id,
|
|
372
|
+
type: v.type,
|
|
373
|
+
checked: u
|
|
243
374
|
});
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
},
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
|
|
375
|
+
}, d = (v) => {
|
|
376
|
+
v.disabled || i("action", { id: v.id, type: v.type });
|
|
377
|
+
}, l = (v, a) => {
|
|
378
|
+
if (v.disabled) return;
|
|
379
|
+
const n = { id: v.id, type: v.type };
|
|
380
|
+
a !== void 0 && (n.payload = a), i("action", n);
|
|
250
381
|
};
|
|
251
|
-
return (
|
|
252
|
-
(
|
|
253
|
-
key:
|
|
382
|
+
return (v, a) => (c(), p("div", vt, [
|
|
383
|
+
(c(!0), p(P, null, H(t.actions, (n) => (c(), p(P, {
|
|
384
|
+
key: n.id
|
|
254
385
|
}, [
|
|
255
|
-
|
|
386
|
+
n.type === "switch" ? (c(), p("label", {
|
|
256
387
|
key: 0,
|
|
257
|
-
class:
|
|
388
|
+
class: R(["tr-extension-card-primary-actions__switch", { "is-disabled": n.disabled, "is-danger": n.danger }])
|
|
258
389
|
}, [
|
|
259
|
-
|
|
390
|
+
T("input", {
|
|
260
391
|
type: "checkbox",
|
|
261
392
|
role: "switch",
|
|
262
|
-
checked:
|
|
263
|
-
disabled:
|
|
264
|
-
"aria-label":
|
|
265
|
-
onChange: (
|
|
266
|
-
}, null, 40,
|
|
267
|
-
|
|
268
|
-
], 2)) :
|
|
393
|
+
checked: n.checked,
|
|
394
|
+
disabled: n.disabled,
|
|
395
|
+
"aria-label": n.label,
|
|
396
|
+
onChange: (u) => r(n, u)
|
|
397
|
+
}, null, 40, pt),
|
|
398
|
+
a[0] || (a[0] = T("span", { class: "tr-extension-card-primary-actions__switch-track" }, null, -1))
|
|
399
|
+
], 2)) : n.type === "button" ? (c(), p("button", {
|
|
269
400
|
key: 1,
|
|
270
|
-
class:
|
|
401
|
+
class: R(["tr-extension-card-primary-actions__button", { "is-danger": n.danger }]),
|
|
271
402
|
type: "button",
|
|
272
|
-
"aria-label":
|
|
273
|
-
disabled:
|
|
274
|
-
onClick: (
|
|
403
|
+
"aria-label": n.label,
|
|
404
|
+
disabled: n.disabled,
|
|
405
|
+
onClick: (u) => d(n)
|
|
275
406
|
}, [
|
|
276
|
-
|
|
407
|
+
n.icon ? (c(), A(K(n.icon), {
|
|
277
408
|
key: 0,
|
|
278
409
|
class: "tr-extension-card-primary-actions__button-icon"
|
|
279
|
-
})) :
|
|
280
|
-
|
|
281
|
-
], 10,
|
|
410
|
+
})) : S("", !0),
|
|
411
|
+
T("span", null, I(n.label), 1)
|
|
412
|
+
], 10, ft)) : v.$slots["primary-action"] ? (c(), p("span", {
|
|
282
413
|
key: 2,
|
|
283
|
-
class:
|
|
414
|
+
class: R(["tr-extension-card-primary-actions__custom-action", { "is-disabled": n.disabled, "is-danger": n.danger }])
|
|
284
415
|
}, [
|
|
285
|
-
|
|
286
|
-
action:
|
|
287
|
-
trigger: (
|
|
416
|
+
M(v.$slots, "primary-action", {
|
|
417
|
+
action: n,
|
|
418
|
+
trigger: (u) => l(n, u)
|
|
288
419
|
}, void 0, !0)
|
|
289
|
-
], 2)) : (
|
|
420
|
+
], 2)) : (c(), p("button", {
|
|
290
421
|
key: 3,
|
|
291
|
-
class:
|
|
422
|
+
class: R(["tr-extension-card-primary-actions__button", { "is-danger": n.danger }]),
|
|
292
423
|
type: "button",
|
|
293
|
-
"aria-label":
|
|
294
|
-
disabled:
|
|
295
|
-
onClick: (
|
|
424
|
+
"aria-label": n.label,
|
|
425
|
+
disabled: n.disabled,
|
|
426
|
+
onClick: (u) => l(n)
|
|
296
427
|
}, [
|
|
297
|
-
|
|
428
|
+
n.icon ? (c(), A(K(n.icon), {
|
|
298
429
|
key: 0,
|
|
299
430
|
class: "tr-extension-card-primary-actions__button-icon"
|
|
300
|
-
})) :
|
|
301
|
-
|
|
302
|
-
], 10,
|
|
431
|
+
})) : S("", !0),
|
|
432
|
+
T("span", null, I(n.label), 1)
|
|
433
|
+
], 10, gt))
|
|
303
434
|
], 64))), 128))
|
|
304
435
|
]));
|
|
305
436
|
}
|
|
306
|
-
}),
|
|
437
|
+
}), ht = /* @__PURE__ */ L(bt, [["__scopeId", "data-v-d5244352"]]), _t = { class: "tr-extension-card" }, yt = { class: "tr-extension-card__icon-region" }, xt = ["src", "alt"], kt = {
|
|
307
438
|
key: 2,
|
|
308
439
|
class: "tr-extension-card__icon tr-extension-card__icon--placeholder"
|
|
309
|
-
},
|
|
440
|
+
}, Tt = { class: "tr-extension-card__content" }, Ct = ["role", "tabindex", "title"], wt = ["title"], $t = ["aria-label", "aria-valuenow"], St = /* @__PURE__ */ V({
|
|
310
441
|
__name: "ExtensionCard",
|
|
311
442
|
props: {
|
|
312
443
|
name: {},
|
|
@@ -321,91 +452,91 @@ const ve = ({
|
|
|
321
452
|
overflowMenuShowIcons: { type: Boolean, default: !0 }
|
|
322
453
|
},
|
|
323
454
|
emits: ["name-click", "action"],
|
|
324
|
-
setup(
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
!
|
|
455
|
+
setup(e, { emit: o }) {
|
|
456
|
+
const t = e, i = G(), r = o, d = x(() => t.actions.filter((f) => !f.hidden)), l = x(() => Math.max(0, Math.floor(t.primaryActionsLimit))), v = x(() => d.value.slice(0, l.value)), a = x(() => d.value.slice(l.value)), n = x(() => v.value.length > 0 || a.value.length > 0), u = x(() => t.progress === "indeterminate" || t.progress === void 0 ? t.progress : Math.min(100, Math.max(0, t.progress))), y = x(() => !!i["primary-action"]), w = (f) => {
|
|
457
|
+
r("action", f);
|
|
458
|
+
}, k = (f) => {
|
|
459
|
+
t.nameClickable && r("name-click", f);
|
|
460
|
+
}, m = (f) => {
|
|
461
|
+
!t.nameClickable || f.key !== "Enter" && f.key !== " " || (f.preventDefault(), r("name-click", f));
|
|
331
462
|
};
|
|
332
|
-
return (f,
|
|
333
|
-
|
|
334
|
-
typeof
|
|
463
|
+
return (f, s) => (c(), p("div", _t, [
|
|
464
|
+
T("div", yt, [
|
|
465
|
+
typeof e.icon == "string" && e.icon ? (c(), p("img", {
|
|
335
466
|
key: 0,
|
|
336
|
-
src:
|
|
337
|
-
alt:
|
|
467
|
+
src: e.icon,
|
|
468
|
+
alt: e.name,
|
|
338
469
|
class: "tr-extension-card__icon"
|
|
339
|
-
}, null, 8,
|
|
470
|
+
}, null, 8, xt)) : e.icon ? (c(), A(K(e.icon), {
|
|
340
471
|
key: 1,
|
|
341
472
|
class: "tr-extension-card__icon"
|
|
342
|
-
})) : (
|
|
473
|
+
})) : (c(), p("div", kt, I(e.name.slice(0, 1)), 1))
|
|
343
474
|
]),
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
class:
|
|
347
|
-
role:
|
|
348
|
-
tabindex:
|
|
349
|
-
title:
|
|
350
|
-
onClick:
|
|
351
|
-
onKeydown:
|
|
352
|
-
},
|
|
353
|
-
|
|
475
|
+
T("div", Tt, [
|
|
476
|
+
T("div", {
|
|
477
|
+
class: R(["tr-extension-card__name", { "is-clickable": e.nameClickable }]),
|
|
478
|
+
role: e.nameClickable ? "button" : void 0,
|
|
479
|
+
tabindex: e.nameClickable ? 0 : void 0,
|
|
480
|
+
title: e.name,
|
|
481
|
+
onClick: k,
|
|
482
|
+
onKeydown: m
|
|
483
|
+
}, I(e.name), 43, Ct),
|
|
484
|
+
e.description ? (c(), p("div", {
|
|
354
485
|
key: 0,
|
|
355
486
|
class: "tr-extension-card__description",
|
|
356
|
-
title:
|
|
357
|
-
},
|
|
487
|
+
title: e.description
|
|
488
|
+
}, I(e.description), 9, wt)) : S("", !0)
|
|
358
489
|
]),
|
|
359
|
-
|
|
490
|
+
n.value ? (c(), p("div", {
|
|
360
491
|
key: 0,
|
|
361
492
|
class: "tr-extension-card__actions",
|
|
362
|
-
onClick:
|
|
493
|
+
onClick: s[1] || (s[1] = oe(() => {
|
|
363
494
|
}, ["stop"])),
|
|
364
|
-
onKeydown:
|
|
495
|
+
onKeydown: s[2] || (s[2] = oe(() => {
|
|
365
496
|
}, ["stop"]))
|
|
366
497
|
}, [
|
|
367
|
-
|
|
498
|
+
v.value.length ? (c(), A(ht, {
|
|
368
499
|
key: 0,
|
|
369
|
-
actions:
|
|
370
|
-
onAction:
|
|
371
|
-
},
|
|
372
|
-
|
|
500
|
+
actions: v.value,
|
|
501
|
+
onAction: s[0] || (s[0] = (g) => r("action", g))
|
|
502
|
+
}, J({ _: 2 }, [
|
|
503
|
+
y.value ? {
|
|
373
504
|
name: "primary-action",
|
|
374
|
-
fn:
|
|
375
|
-
|
|
505
|
+
fn: O((g) => [
|
|
506
|
+
M(f.$slots, "primary-action", ve(Ne(g)), void 0, !0)
|
|
376
507
|
]),
|
|
377
508
|
key: "0"
|
|
378
509
|
} : void 0
|
|
379
|
-
]), 1032, ["actions"])) :
|
|
380
|
-
|
|
510
|
+
]), 1032, ["actions"])) : S("", !0),
|
|
511
|
+
a.value.length ? (c(), A(mt, {
|
|
381
512
|
key: 1,
|
|
382
|
-
actions:
|
|
383
|
-
label:
|
|
384
|
-
placement:
|
|
385
|
-
"show-icons":
|
|
386
|
-
onAction:
|
|
387
|
-
}, null, 8, ["actions", "label", "placement", "show-icons"])) :
|
|
388
|
-
], 32)) :
|
|
389
|
-
|
|
513
|
+
actions: a.value,
|
|
514
|
+
label: e.overflowMenuLabel,
|
|
515
|
+
placement: e.overflowMenuPlacement,
|
|
516
|
+
"show-icons": e.overflowMenuShowIcons,
|
|
517
|
+
onAction: w
|
|
518
|
+
}, null, 8, ["actions", "label", "placement", "show-icons"])) : S("", !0)
|
|
519
|
+
], 32)) : S("", !0),
|
|
520
|
+
u.value !== void 0 ? (c(), p("div", {
|
|
390
521
|
key: 1,
|
|
391
522
|
class: "tr-extension-card__progress",
|
|
392
523
|
role: "progressbar",
|
|
393
|
-
"aria-label":
|
|
524
|
+
"aria-label": e.name,
|
|
394
525
|
"aria-valuemin": "0",
|
|
395
526
|
"aria-valuemax": "100",
|
|
396
|
-
"aria-valuenow":
|
|
527
|
+
"aria-valuenow": u.value === "indeterminate" ? void 0 : u.value
|
|
397
528
|
}, [
|
|
398
|
-
|
|
399
|
-
class:
|
|
400
|
-
style:
|
|
529
|
+
T("span", {
|
|
530
|
+
class: R(["tr-extension-card__progress-bar", { "is-indeterminate": u.value === "indeterminate" }]),
|
|
531
|
+
style: ie(u.value === "indeterminate" ? void 0 : { width: `${u.value}%` })
|
|
401
532
|
}, null, 6)
|
|
402
|
-
], 8,
|
|
533
|
+
], 8, $t)) : S("", !0)
|
|
403
534
|
]));
|
|
404
535
|
}
|
|
405
|
-
}),
|
|
536
|
+
}), W = /* @__PURE__ */ L(St, [["__scopeId", "data-v-c38268e3"]]), Mt = { class: "tr-extension-card-grid" }, Et = {
|
|
406
537
|
key: 0,
|
|
407
538
|
class: "tr-extension-card-grid__empty"
|
|
408
|
-
},
|
|
539
|
+
}, It = ["data-card-id"], At = /* @__PURE__ */ V({
|
|
409
540
|
__name: "ExtensionCardGrid",
|
|
410
541
|
props: {
|
|
411
542
|
items: {},
|
|
@@ -417,57 +548,448 @@ const ve = ({
|
|
|
417
548
|
overflowMenuShowIcons: { type: Boolean, default: void 0 }
|
|
418
549
|
},
|
|
419
550
|
emits: ["action", "name-click"],
|
|
420
|
-
setup(
|
|
421
|
-
const
|
|
422
|
-
const { id:
|
|
551
|
+
setup(e, { emit: o }) {
|
|
552
|
+
const t = e, i = G(), r = o, d = (a) => {
|
|
553
|
+
const { id: n, ...u } = a;
|
|
423
554
|
return {
|
|
424
|
-
...
|
|
425
|
-
primaryActionsLimit:
|
|
426
|
-
nameClickable:
|
|
427
|
-
overflowMenuLabel:
|
|
428
|
-
overflowMenuPlacement:
|
|
429
|
-
overflowMenuShowIcons:
|
|
555
|
+
...u,
|
|
556
|
+
primaryActionsLimit: a.primaryActionsLimit ?? t.primaryActionsLimit,
|
|
557
|
+
nameClickable: a.nameClickable ?? t.nameClickable,
|
|
558
|
+
overflowMenuLabel: a.overflowMenuLabel ?? t.overflowMenuLabel,
|
|
559
|
+
overflowMenuPlacement: a.overflowMenuPlacement ?? t.overflowMenuPlacement,
|
|
560
|
+
overflowMenuShowIcons: a.overflowMenuShowIcons ?? t.overflowMenuShowIcons
|
|
430
561
|
};
|
|
431
|
-
},
|
|
432
|
-
|
|
433
|
-
},
|
|
434
|
-
|
|
562
|
+
}, l = (a, n) => {
|
|
563
|
+
r("action", { itemId: a, action: n });
|
|
564
|
+
}, v = (a, n) => {
|
|
565
|
+
r("name-click", { itemId: a, event: n });
|
|
435
566
|
};
|
|
436
|
-
return (
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
567
|
+
return (a, n) => (c(), p("ul", Mt, [
|
|
568
|
+
e.items.length === 0 ? (c(), p("li", Et, [
|
|
569
|
+
M(a.$slots, "empty", {}, () => [
|
|
570
|
+
re(I(e.emptyText), 1)
|
|
440
571
|
], !0)
|
|
441
|
-
])) : (
|
|
442
|
-
key:
|
|
572
|
+
])) : (c(!0), p(P, { key: 1 }, H(e.items, (u, y) => (c(), p("li", {
|
|
573
|
+
key: u.id,
|
|
443
574
|
class: "tr-extension-card-grid__item",
|
|
444
|
-
"data-card-id":
|
|
575
|
+
"data-card-id": u.id
|
|
445
576
|
}, [
|
|
446
|
-
|
|
447
|
-
item:
|
|
448
|
-
index:
|
|
449
|
-
}, void 0, !0, 0) : (
|
|
577
|
+
$(i).item ? M(a.$slots, "item", {
|
|
578
|
+
item: u,
|
|
579
|
+
index: y
|
|
580
|
+
}, void 0, !0, 0) : (c(), A(W, pe({
|
|
450
581
|
key: 1,
|
|
451
582
|
ref_for: !0
|
|
452
|
-
},
|
|
453
|
-
onAction: (
|
|
454
|
-
onNameClick: (
|
|
583
|
+
}, d(u), {
|
|
584
|
+
onAction: (w) => l(u.id, w),
|
|
585
|
+
onNameClick: (w) => v(u.id, w)
|
|
455
586
|
}), null, 16, ["onAction", "onNameClick"]))
|
|
456
|
-
], 8,
|
|
587
|
+
], 8, It))), 128))
|
|
588
|
+
]));
|
|
589
|
+
}
|
|
590
|
+
}), q = /* @__PURE__ */ L(At, [["__scopeId", "data-v-b736eba6"]]), Pt = ["data-tab-id", "data-section-key"], Nt = { class: "extension-manager-section__header" }, Vt = ["aria-expanded"], Lt = {
|
|
591
|
+
key: 0,
|
|
592
|
+
class: "extension-manager-section__body"
|
|
593
|
+
}, Bt = {
|
|
594
|
+
key: 1,
|
|
595
|
+
class: "extension-manager-section__state"
|
|
596
|
+
}, Rt = /* @__PURE__ */ V({
|
|
597
|
+
name: "ExtensionManagerSection",
|
|
598
|
+
__name: "ExtensionManagerSection",
|
|
599
|
+
props: {
|
|
600
|
+
tabId: {},
|
|
601
|
+
section: {},
|
|
602
|
+
expanded: { type: Boolean }
|
|
603
|
+
},
|
|
604
|
+
emits: ["section-toggle", "action", "name-click"],
|
|
605
|
+
setup(e, { emit: o }) {
|
|
606
|
+
const t = e, i = G(), r = o, d = () => r("section-toggle", !t.expanded), l = (a) => r("action", a), v = (a) => r("name-click", a);
|
|
607
|
+
return (a, n) => (c(), p("section", {
|
|
608
|
+
class: "extension-manager-section",
|
|
609
|
+
"data-tab-id": t.tabId,
|
|
610
|
+
"data-section-key": t.section.key
|
|
611
|
+
}, [
|
|
612
|
+
T("div", Nt, [
|
|
613
|
+
T("button", {
|
|
614
|
+
class: "extension-manager-section__title",
|
|
615
|
+
type: "button",
|
|
616
|
+
"aria-expanded": t.expanded,
|
|
617
|
+
onClick: d
|
|
618
|
+
}, [
|
|
619
|
+
j($(fe), {
|
|
620
|
+
class: R(["extension-manager-section__arrow", { "is-expanded": t.expanded }])
|
|
621
|
+
}, null, 8, ["class"]),
|
|
622
|
+
T("span", null, I(t.section.title), 1)
|
|
623
|
+
], 8, Vt)
|
|
624
|
+
]),
|
|
625
|
+
t.expanded ? (c(), p("div", Lt, [
|
|
626
|
+
t.section.items.length > 0 ? (c(), A(q, {
|
|
627
|
+
key: 0,
|
|
628
|
+
items: t.section.items,
|
|
629
|
+
"primary-actions-limit": 1,
|
|
630
|
+
"name-clickable": !0,
|
|
631
|
+
onAction: l,
|
|
632
|
+
onNameClick: v
|
|
633
|
+
}, J({ _: 2 }, [
|
|
634
|
+
i.item ? {
|
|
635
|
+
name: "item",
|
|
636
|
+
fn: O(({ item: u, index: y }) => [
|
|
637
|
+
M(a.$slots, "item", {
|
|
638
|
+
item: u,
|
|
639
|
+
index: y
|
|
640
|
+
}, void 0, !0)
|
|
641
|
+
]),
|
|
642
|
+
key: "0"
|
|
643
|
+
} : void 0
|
|
644
|
+
]), 1032, ["items"])) : (c(), p("div", Bt, [
|
|
645
|
+
M(a.$slots, "empty", {}, () => [
|
|
646
|
+
n[0] || (n[0] = re("暂无内容", -1))
|
|
647
|
+
], !0)
|
|
648
|
+
]))
|
|
649
|
+
])) : S("", !0)
|
|
650
|
+
], 8, Pt));
|
|
651
|
+
}
|
|
652
|
+
}), Ft = /* @__PURE__ */ L(Rt, [["__scopeId", "data-v-89f78201"]]), Dt = {
|
|
653
|
+
class: "extension-manager-tabs",
|
|
654
|
+
role: "tablist",
|
|
655
|
+
"aria-orientation": "horizontal"
|
|
656
|
+
}, Ot = ["id", "aria-selected", "aria-controls", "tabindex", "onClick", "onKeydown"], jt = /* @__PURE__ */ V({
|
|
657
|
+
name: "ExtensionManagerTabs",
|
|
658
|
+
__name: "ExtensionManagerTabs",
|
|
659
|
+
props: {
|
|
660
|
+
tabs: {},
|
|
661
|
+
activeTabId: {},
|
|
662
|
+
idPrefix: {}
|
|
663
|
+
},
|
|
664
|
+
emits: ["select"],
|
|
665
|
+
setup(e, { emit: o }) {
|
|
666
|
+
const t = e, i = o, r = G(), d = (s) => `${s.length}:${s}`, l = (s) => `${t.idPrefix}-tab-${d(s)}`, v = (s) => `${t.idPrefix}-tabpanel-${d(s)}`, a = /* @__PURE__ */ new Map(), n = B();
|
|
667
|
+
let u;
|
|
668
|
+
const y = () => {
|
|
669
|
+
const s = t.activeTabId ? a.get(t.activeTabId) : void 0;
|
|
670
|
+
if (!s) {
|
|
671
|
+
n.value = void 0;
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
n.value = {
|
|
675
|
+
transform: `translateX(${s.offsetLeft}px)`,
|
|
676
|
+
width: `${s.offsetWidth}px`
|
|
677
|
+
};
|
|
678
|
+
}, w = (s, g) => {
|
|
679
|
+
const h = a.get(s);
|
|
680
|
+
h && h !== g && (u == null || u.unobserve(h)), g ? (a.set(s, g), u == null || u.observe(g)) : a.delete(s);
|
|
681
|
+
};
|
|
682
|
+
D([() => t.activeTabId, () => t.tabs.map((s) => s.id)], y, { flush: "post" }), me(() => {
|
|
683
|
+
typeof ResizeObserver < "u" && (u = new ResizeObserver(y), a.forEach((s) => u == null ? void 0 : u.observe(s))), y();
|
|
684
|
+
}), Ve(() => u == null ? void 0 : u.disconnect());
|
|
685
|
+
const k = (s) => i("select", s), m = (s) => {
|
|
686
|
+
ue(() => {
|
|
687
|
+
var g;
|
|
688
|
+
return (g = a.get(s)) == null ? void 0 : g.focus();
|
|
689
|
+
});
|
|
690
|
+
}, f = (s, g) => {
|
|
691
|
+
let h;
|
|
692
|
+
switch (g.key) {
|
|
693
|
+
case "ArrowLeft":
|
|
694
|
+
h = (s - 1 + t.tabs.length) % t.tabs.length;
|
|
695
|
+
break;
|
|
696
|
+
case "ArrowRight":
|
|
697
|
+
h = (s + 1) % t.tabs.length;
|
|
698
|
+
break;
|
|
699
|
+
case "Home":
|
|
700
|
+
h = 0;
|
|
701
|
+
break;
|
|
702
|
+
case "End":
|
|
703
|
+
h = t.tabs.length - 1;
|
|
704
|
+
break;
|
|
705
|
+
default:
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
const N = t.tabs[h];
|
|
709
|
+
N && (g.preventDefault(), k(N.id), m(N.id));
|
|
710
|
+
};
|
|
711
|
+
return (s, g) => (c(), p("div", Dt, [
|
|
712
|
+
(c(!0), p(P, null, H(t.tabs, (h, N) => (c(), p("button", {
|
|
713
|
+
key: h.id,
|
|
714
|
+
ref_for: !0,
|
|
715
|
+
ref: (F) => w(h.id, F),
|
|
716
|
+
class: "extension-manager-tabs__tab",
|
|
717
|
+
type: "button",
|
|
718
|
+
role: "tab",
|
|
719
|
+
id: l(h.id),
|
|
720
|
+
"aria-selected": h.id === t.activeTabId,
|
|
721
|
+
"aria-controls": h.id === t.activeTabId ? v(h.id) : void 0,
|
|
722
|
+
tabindex: h.id === t.activeTabId ? 0 : -1,
|
|
723
|
+
onClick: (F) => k(h.id),
|
|
724
|
+
onKeydown: (F) => f(N, F)
|
|
725
|
+
}, [
|
|
726
|
+
r.tab ? (c(), p("span", {
|
|
727
|
+
key: 0,
|
|
728
|
+
class: "extension-manager-tabs__slot",
|
|
729
|
+
onClick: g[0] || (g[0] = oe(() => {
|
|
730
|
+
}, ["stop"]))
|
|
731
|
+
}, [
|
|
732
|
+
M(s.$slots, "tab", {
|
|
733
|
+
tab: h,
|
|
734
|
+
active: h.id === t.activeTabId,
|
|
735
|
+
select: () => k(h.id)
|
|
736
|
+
}, void 0, !0)
|
|
737
|
+
])) : (c(), p(P, { key: 1 }, [
|
|
738
|
+
re(I(h.label), 1)
|
|
739
|
+
], 64))
|
|
740
|
+
], 40, Ot))), 128)),
|
|
741
|
+
n.value ? (c(), p("span", {
|
|
742
|
+
key: 0,
|
|
743
|
+
class: "extension-manager-tabs__indicator",
|
|
744
|
+
style: ie(n.value),
|
|
745
|
+
"aria-hidden": "true"
|
|
746
|
+
}, null, 4)) : S("", !0)
|
|
747
|
+
]));
|
|
748
|
+
}
|
|
749
|
+
}), Gt = /* @__PURE__ */ L(jt, [["__scopeId", "data-v-ce43701e"]]), Ht = {
|
|
750
|
+
class: "extension-filter-controls",
|
|
751
|
+
"data-testid": "extension-filter-controls"
|
|
752
|
+
}, Kt = {
|
|
753
|
+
"data-testid": "filter-root",
|
|
754
|
+
class: "extension-filter-controls__fields"
|
|
755
|
+
}, Ut = {
|
|
756
|
+
key: 0,
|
|
757
|
+
class: "extension-filter-controls__select-wrapper"
|
|
758
|
+
}, zt = ["value"], Wt = { class: "extension-filter-controls__input-wrapper" }, qt = /* @__PURE__ */ V({
|
|
759
|
+
name: "ExtensionFilterControls",
|
|
760
|
+
__name: "ExtensionFilterControls",
|
|
761
|
+
props: /* @__PURE__ */ Re({
|
|
762
|
+
tags: {}
|
|
763
|
+
}, {
|
|
764
|
+
selectedTag: { default: "" },
|
|
765
|
+
selectedTagModifiers: {},
|
|
766
|
+
searchValue: { default: "" },
|
|
767
|
+
searchValueModifiers: {}
|
|
768
|
+
}),
|
|
769
|
+
emits: ["update:selectedTag", "update:searchValue"],
|
|
770
|
+
setup(e) {
|
|
771
|
+
const o = e, t = ce(e, "selectedTag"), i = ce(e, "searchValue");
|
|
772
|
+
return (r, d) => (c(), p("div", Ht, [
|
|
773
|
+
T("div", Kt, [
|
|
774
|
+
o.tags.length > 0 ? (c(), p("div", Ut, [
|
|
775
|
+
ae(T("select", {
|
|
776
|
+
"data-testid": "filter-tag",
|
|
777
|
+
class: "extension-filter-controls__select",
|
|
778
|
+
"aria-label": "标签",
|
|
779
|
+
"onUpdate:modelValue": d[0] || (d[0] = (l) => t.value = l)
|
|
780
|
+
}, [
|
|
781
|
+
d[3] || (d[3] = T("option", { value: "" }, "全部标签", -1)),
|
|
782
|
+
(c(!0), p(P, null, H(o.tags, (l) => (c(), p("option", {
|
|
783
|
+
key: l.value,
|
|
784
|
+
value: l.value
|
|
785
|
+
}, I(l.label), 9, zt))), 128))
|
|
786
|
+
], 512), [
|
|
787
|
+
[Le, t.value]
|
|
788
|
+
]),
|
|
789
|
+
j($(fe), {
|
|
790
|
+
class: "extension-filter-controls__select-arrow",
|
|
791
|
+
"aria-hidden": "true"
|
|
792
|
+
})
|
|
793
|
+
])) : S("", !0),
|
|
794
|
+
T("div", Wt, [
|
|
795
|
+
ae(T("input", {
|
|
796
|
+
"data-testid": "filter-search",
|
|
797
|
+
class: "extension-filter-controls__input",
|
|
798
|
+
type: "search",
|
|
799
|
+
"aria-label": "搜索扩展",
|
|
800
|
+
placeholder: "请输入关键字搜索",
|
|
801
|
+
"onUpdate:modelValue": d[1] || (d[1] = (l) => i.value = l)
|
|
802
|
+
}, null, 512), [
|
|
803
|
+
[Be, i.value]
|
|
804
|
+
]),
|
|
805
|
+
i.value ? (c(), p("button", {
|
|
806
|
+
key: 0,
|
|
807
|
+
"data-testid": "filter-search-clear",
|
|
808
|
+
class: "extension-filter-controls__clear",
|
|
809
|
+
type: "button",
|
|
810
|
+
"aria-label": "清空搜索",
|
|
811
|
+
onClick: d[2] || (d[2] = (l) => i.value = "")
|
|
812
|
+
}, [
|
|
813
|
+
j($(De), {
|
|
814
|
+
class: "extension-filter-controls__clear-icon",
|
|
815
|
+
"aria-hidden": "true"
|
|
816
|
+
})
|
|
817
|
+
])) : S("", !0)
|
|
818
|
+
])
|
|
819
|
+
])
|
|
820
|
+
]));
|
|
821
|
+
}
|
|
822
|
+
}), Xt = /* @__PURE__ */ L(qt, [["__scopeId", "data-v-470772ce"]]), Jt = { class: "extension-manager" }, Qt = {
|
|
823
|
+
key: 0,
|
|
824
|
+
class: "extension-manager__header"
|
|
825
|
+
}, Yt = {
|
|
826
|
+
key: 0,
|
|
827
|
+
class: "extension-manager__title"
|
|
828
|
+
}, Zt = {
|
|
829
|
+
key: 1,
|
|
830
|
+
class: "extension-manager__header-actions"
|
|
831
|
+
}, en = ["id", "aria-labelledby"], tn = {
|
|
832
|
+
key: 3,
|
|
833
|
+
class: "extension-manager__empty"
|
|
834
|
+
}, nn = /* @__PURE__ */ V({
|
|
835
|
+
name: "ExtensionManager",
|
|
836
|
+
__name: "index",
|
|
837
|
+
props: {
|
|
838
|
+
tabs: {},
|
|
839
|
+
activeTab: {},
|
|
840
|
+
defaultActiveTab: {},
|
|
841
|
+
title: {},
|
|
842
|
+
emptyText: { default: "暂无内容" }
|
|
843
|
+
},
|
|
844
|
+
emits: ["update:active-tab", "tab-change", "section-toggle", "action", "name-click"],
|
|
845
|
+
setup(e, { emit: o }) {
|
|
846
|
+
const t = e, i = o, r = G(), d = [
|
|
847
|
+
{ key: "installed", title: "已安装" },
|
|
848
|
+
{ key: "available", title: "可安装" }
|
|
849
|
+
], l = (b) => b.length + ":" + b, v = (b, C) => "extension-manager/section/" + l(b) + "/" + l(C), n = "extension-manager-" + ge(), u = (b) => n + "-tab-" + l(b), y = (b) => n + "-tabpanel-" + l(b), w = (b, C) => {
|
|
850
|
+
switch (b) {
|
|
851
|
+
case "update:active-tab":
|
|
852
|
+
i("update:active-tab", C);
|
|
853
|
+
break;
|
|
854
|
+
case "tab-change":
|
|
855
|
+
i("tab-change", C);
|
|
856
|
+
break;
|
|
857
|
+
case "section-toggle":
|
|
858
|
+
i("section-toggle", C);
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
}, { activeTab: k, activeTabId: m, selectTab: f, isSectionExpanded: s, toggleSection: g } = Ke(
|
|
862
|
+
t,
|
|
863
|
+
w
|
|
864
|
+
), { getFilterState: h } = ze(() => t.tabs), N = (b) => [...new Set(b.flatMap((_) => _.tags ?? []))].map((_) => ({ value: _, label: _ })), F = Qe({
|
|
865
|
+
items: () => {
|
|
866
|
+
var b;
|
|
867
|
+
return ((b = k.value) == null ? void 0 : b.items) ?? [];
|
|
868
|
+
},
|
|
869
|
+
tags: () => {
|
|
870
|
+
var b;
|
|
871
|
+
return N(((b = k.value) == null ? void 0 : b.items) ?? []);
|
|
872
|
+
},
|
|
873
|
+
state: () => h(m.value)
|
|
874
|
+
}), le = x(() => k.value !== void 0), he = x(() => !!(t.title || r["header-actions"])), _e = (b) => {
|
|
875
|
+
const { installed: C, tags: _, ...E } = b;
|
|
876
|
+
return E;
|
|
877
|
+
}, ye = x(() => {
|
|
878
|
+
const b = F.filteredItems.value;
|
|
879
|
+
return d.map(({ key: C, title: _ }) => ({
|
|
880
|
+
key: C,
|
|
881
|
+
title: _,
|
|
882
|
+
items: b.filter((E) => (E.installed === !0 ? "installed" : "available") === C).map(_e)
|
|
883
|
+
}));
|
|
884
|
+
}), xe = (b, C) => s(b, C), ke = (b, C) => {
|
|
885
|
+
var _;
|
|
886
|
+
((_ = k.value) == null ? void 0 : _.id) === b && g(b, C);
|
|
887
|
+
}, Te = (b, C, _) => {
|
|
888
|
+
i("action", {
|
|
889
|
+
tabId: b,
|
|
890
|
+
sectionKey: C,
|
|
891
|
+
itemId: _.itemId,
|
|
892
|
+
action: _.action
|
|
893
|
+
});
|
|
894
|
+
}, Ce = (b, C, _) => {
|
|
895
|
+
i("name-click", {
|
|
896
|
+
tabId: b,
|
|
897
|
+
sectionKey: C,
|
|
898
|
+
itemId: _.itemId,
|
|
899
|
+
event: _.event
|
|
900
|
+
});
|
|
901
|
+
};
|
|
902
|
+
return (b, C) => (c(), p("div", Jt, [
|
|
903
|
+
he.value ? (c(), p("div", Qt, [
|
|
904
|
+
t.title ? (c(), p("div", Yt, I(t.title), 1)) : S("", !0),
|
|
905
|
+
r["header-actions"] ? (c(), p("div", Zt, [
|
|
906
|
+
M(b.$slots, "header-actions", {}, void 0, !0)
|
|
907
|
+
])) : S("", !0)
|
|
908
|
+
])) : S("", !0),
|
|
909
|
+
j(Gt, {
|
|
910
|
+
tabs: t.tabs,
|
|
911
|
+
"active-tab-id": $(m),
|
|
912
|
+
"id-prefix": n,
|
|
913
|
+
onSelect: $(f)
|
|
914
|
+
}, J({ _: 2 }, [
|
|
915
|
+
r.tab ? {
|
|
916
|
+
name: "tab",
|
|
917
|
+
fn: O(({ tab: _, active: E, select: ne }) => [
|
|
918
|
+
M(b.$slots, "tab", {
|
|
919
|
+
tab: _,
|
|
920
|
+
active: E,
|
|
921
|
+
select: ne
|
|
922
|
+
}, void 0, !0)
|
|
923
|
+
]),
|
|
924
|
+
key: "0"
|
|
925
|
+
} : void 0
|
|
926
|
+
]), 1032, ["tabs", "active-tab-id", "onSelect"]),
|
|
927
|
+
le.value ? (c(), A(Xt, ve(pe({ key: 1 }, $(F).controls.value)), null, 16)) : S("", !0),
|
|
928
|
+
le.value ? (c(), p("div", {
|
|
929
|
+
key: 2,
|
|
930
|
+
class: "extension-manager__sections",
|
|
931
|
+
role: "tabpanel",
|
|
932
|
+
id: y($(m)),
|
|
933
|
+
"aria-labelledby": u($(m))
|
|
934
|
+
}, [
|
|
935
|
+
(c(!0), p(P, null, H(ye.value, (_) => (c(), A(Ft, {
|
|
936
|
+
key: v($(m), _.key),
|
|
937
|
+
"tab-id": $(m),
|
|
938
|
+
section: _,
|
|
939
|
+
expanded: xe($(m), _.key),
|
|
940
|
+
onSectionToggle: (E) => ke($(m), _.key),
|
|
941
|
+
onAction: (E) => Te($(m), _.key, E),
|
|
942
|
+
onNameClick: (E) => Ce($(m), _.key, E)
|
|
943
|
+
}, J({ _: 2 }, [
|
|
944
|
+
r.item ? {
|
|
945
|
+
name: "item",
|
|
946
|
+
fn: O(({ item: E, index: ne }) => [
|
|
947
|
+
M(b.$slots, "item", {
|
|
948
|
+
tab: $(k),
|
|
949
|
+
sectionKey: _.key,
|
|
950
|
+
item: E,
|
|
951
|
+
index: ne
|
|
952
|
+
}, void 0, !0)
|
|
953
|
+
]),
|
|
954
|
+
key: "0"
|
|
955
|
+
} : void 0,
|
|
956
|
+
r.empty ? {
|
|
957
|
+
name: "empty",
|
|
958
|
+
fn: O(() => [
|
|
959
|
+
M(b.$slots, "empty", {
|
|
960
|
+
tab: $(k),
|
|
961
|
+
sectionKey: _.key,
|
|
962
|
+
title: _.title
|
|
963
|
+
}, void 0, !0)
|
|
964
|
+
]),
|
|
965
|
+
key: "1"
|
|
966
|
+
} : void 0
|
|
967
|
+
]), 1032, ["tab-id", "section", "expanded", "onSectionToggle", "onAction", "onNameClick"]))), 128))
|
|
968
|
+
], 8, en)) : (c(), p("div", tn, I(t.emptyText), 1))
|
|
457
969
|
]));
|
|
458
970
|
}
|
|
459
|
-
}),
|
|
460
|
-
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
},
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
},
|
|
469
|
-
|
|
971
|
+
}), Z = /* @__PURE__ */ L(nn, [["__scopeId", "data-v-de388c90"]]);
|
|
972
|
+
W.name = "TrExtensionCard";
|
|
973
|
+
const an = function(e) {
|
|
974
|
+
e.component(W.name, W);
|
|
975
|
+
}, ee = W;
|
|
976
|
+
ee.install = an;
|
|
977
|
+
q.name = "TrExtensionCardGrid";
|
|
978
|
+
const on = function(e) {
|
|
979
|
+
e.component(q.name, q);
|
|
980
|
+
}, te = q;
|
|
981
|
+
te.install = on;
|
|
982
|
+
Z.name = "TrExtensionManager";
|
|
983
|
+
const sn = function(e) {
|
|
984
|
+
e.component(Z.name, Z), e.component(ee.name, ee), e.component(te.name, te);
|
|
985
|
+
}, mn = Object.assign(Z, {
|
|
986
|
+
install: sn,
|
|
987
|
+
Card: ee,
|
|
988
|
+
CardGrid: te
|
|
989
|
+
});
|
|
470
990
|
export {
|
|
471
|
-
|
|
472
|
-
|
|
991
|
+
ee as ExtensionCard,
|
|
992
|
+
te as ExtensionCardGrid,
|
|
993
|
+
mn as ExtensionManager,
|
|
994
|
+
mn as default
|
|
473
995
|
};
|