@opentiny/tiny-robot 0.5.2-alpha.16 → 0.5.2-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,172 +1,303 @@
1
- import * as G from "vue";
2
- import { cloneVNode as U, Comment as q, Text as J, Fragment as $, isVNode as Q, Teleport as X, Suspense as Y, ref as E, watch as Z, nextTick as ee, defineComponent as S, onMounted as te, toRef as ne, computed as _, useSlots as V, openBlock as i, createElementBlock as p, createBlock as k, resolveDynamicComponent as P, renderSlot as A, withDirectives as oe, createElementVNode as h, normalizeStyle as W, vShow as ae, createVNode as H, withCtx as R, renderList as z, normalizeClass as x, createCommentVNode as g, toDisplayString as C, unref as j, withModifiers as D, createSlots as se, normalizeProps as ie, guardReactiveProps as re, createTextVNode as le, mergeProps as ce } from "vue";
3
- import { IconMore as de } from "@opentiny/tiny-robot-svgs";
4
- import { g as L } from "../index4.js";
5
- import { _ as T } from "../_plugin-vue_export-helper.js";
6
- const K = /* @__PURE__ */ new WeakMap();
7
- function ue() {
8
- const t = G.useId;
9
- if (t)
10
- return t();
11
- const u = G.getCurrentInstance();
12
- if (!u)
13
- return "";
14
- const o = u.appContext, m = K.get(o) ?? 0;
15
- return K.set(o, m + 1), `tr-${m}`;
16
- }
17
- const F = (t) => t.flatMap((u) => u.type === q ? [] : u.type === J && typeof u.children == "string" && u.children.trim() === "" ? [] : u.type !== $ || !Array.isArray(u.children) ? [u] : F(u.children.filter(Q))), pe = (t) => t.type === X || t.type === Y ? !1 : typeof t.type == "string" || typeof t.type == "object" || typeof t.type == "function";
18
- function me({ getSlot: t, componentName: u }) {
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: (m, d = {}) => {
21
- var a;
22
- const l = F(((a = t()) == null ? void 0 : a(m)) ?? []);
23
- return l.length !== 1 || !pe(l[0]) ? null : U(l[0], d, !0);
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 ve = ({
28
- triggerRef: t,
29
- popoverRef: u,
30
- open: o,
31
- placement: m
158
+ const et = ({
159
+ triggerRef: e,
160
+ popoverRef: o,
161
+ open: t,
162
+ placement: i
32
163
  }) => {
33
- const d = E(), l = () => {
34
- if (!o.value || !t.value || !u.value) return;
35
- const a = t.value.getBoundingClientRect(), s = u.value.getBoundingClientRect(), n = 8, e = 8, c = Math.max(
36
- n,
37
- document.documentElement.clientWidth - s.width - n
38
- ), b = Math.max(
39
- n,
40
- document.documentElement.clientHeight - s.height - n
41
- ), y = Math.min(c, Math.max(n, a.right - s.width)), w = a.bottom + e, M = a.top - s.height - e, f = w + s.height <= document.documentElement.clientHeight - n, r = M >= n;
42
- let v = m.value;
43
- v === "bottom-end" && !f && r ? v = "top-end" : v === "top-end" && !r && f && (v = "bottom-end");
44
- const O = Math.min(b, Math.max(n, v === "bottom-end" ? w : M));
45
- d.value = {
46
- x: y,
47
- y: O,
48
- placement: v
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 Z(
52
- [o, m],
53
- async ([a]) => {
54
- a && (await ee(), l());
182
+ return D(
183
+ [t, i],
184
+ async ([l]) => {
185
+ l && (await ue(), d());
55
186
  },
56
187
  { flush: "post" }
57
- ), L("resize", l, { passive: !0 }), L("scroll", l, {
188
+ ), Q("resize", d, { passive: !0 }), Q("scroll", d, {
58
189
  capture: !0,
59
190
  passive: !0
60
191
  }), {
61
- position: d
192
+ position: r
62
193
  };
63
- }, fe = ["aria-expanded"], he = ["popover"], ye = /* @__PURE__ */ S({
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(t) {
71
- const u = t, o = `tr-extension-card-popover-${ue()}`, m = E(null), d = E(null), l = E(!1), a = E(!1);
72
- te(() => {
73
- a.value = typeof HTMLElement.prototype.showPopover == "function" && typeof HTMLElement.prototype.hidePopover == "function";
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: s } = ve({
76
- triggerRef: m,
77
- popoverRef: d,
78
- open: l,
79
- placement: ne(u, "placement")
80
- }), n = _(() => {
81
- if (s.value)
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: `${s.value.x}px`,
84
- top: `${s.value.y}px`
214
+ left: `${v.value.x}px`,
215
+ top: `${v.value.y}px`
85
216
  };
86
- }), e = V(), c = (r) => {
87
- const v = r instanceof Element ? r : r == null ? void 0 : r.$el;
88
- m.value = v instanceof HTMLElement ? v : null;
89
- }, b = () => {
90
- var r;
91
- if (!a.value) {
92
- l.value = !1;
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
- (r = d.value) != null && r.matches(":popover-open") && d.value.hidePopover();
96
- }, y = () => {
97
- if (!a.value) {
98
- l.value = !l.value;
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
- d.value && (d.value.matches(":popover-open") ? d.value.hidePopover() : d.value.showPopover());
232
+ r.value && (r.value.matches(":popover-open") ? r.value.hidePopover() : r.value.showPopover());
102
233
  };
103
- L("click", (r) => {
104
- var v, N;
105
- a.value || !l.value || !(r.target instanceof Node) || (v = m.value) != null && v.contains(r.target) || (N = d.value) != null && N.contains(r.target) || b();
106
- }), L("keydown", (r) => {
107
- var v;
108
- a.value || !l.value || r.key !== "Escape" || (b(), (v = m.value) == null || v.focus());
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: w } = me({
111
- getSlot: () => e.trigger,
241
+ const { renderAsChild: k } = Ze({
242
+ getSlot: () => n.trigger,
112
243
  componentName: "ExtensionCardPopover"
113
- }), M = () => w(
244
+ }), m = () => k(
114
245
  {
115
- popoverId: o,
116
- open: l.value
246
+ popoverId: t,
247
+ open: d.value
117
248
  },
118
249
  {
119
- ref: c,
120
- ...a.value ? {
121
- popovertarget: o,
250
+ ref: u,
251
+ ...l.value ? {
252
+ popovertarget: t,
122
253
  popovertargetaction: "toggle"
123
- } : { onClick: y }
254
+ } : { onClick: w }
124
255
  }
125
- ), f = (r) => {
126
- l.value = r.newState === "open";
256
+ ), f = (s) => {
257
+ d.value = s.newState === "open";
127
258
  };
128
- return (r, v) => (i(), p($, null, [
129
- t.asChild ? (i(), k(P(M()), { key: 0 })) : (i(), p("button", {
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: m,
263
+ ref: i,
133
264
  type: "button",
134
265
  class: "tr-extension-card-popover__trigger",
135
- "aria-controls": o,
136
- "aria-expanded": l.value,
137
- onClick: y
266
+ "aria-controls": t,
267
+ "aria-expanded": d.value,
268
+ onClick: w
138
269
  }, [
139
- A(r.$slots, "trigger", {
140
- popoverId: o,
141
- open: l.value
270
+ M(s.$slots, "trigger", {
271
+ popoverId: t,
272
+ open: d.value
142
273
  }, void 0, !0)
143
- ], 8, fe)),
144
- oe(h("div", {
145
- id: o,
274
+ ], 8, tt)),
275
+ ae(T("div", {
276
+ id: t,
146
277
  ref_key: "popoverRef",
147
- ref: d,
148
- popover: a.value ? "auto" : void 0,
278
+ ref: r,
279
+ popover: l.value ? "auto" : void 0,
149
280
  class: "tr-extension-card-popover__content",
150
- style: W(n.value),
281
+ style: ie(a.value),
151
282
  onToggle: f
152
283
  }, [
153
- A(r.$slots, "content", { close: b }, void 0, !0)
154
- ], 44, he), [
155
- [ae, a.value || l.value]
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
- }), be = /* @__PURE__ */ T(ye, [["__scopeId", "data-v-6dbac593"]]), _e = {
290
+ }), ot = /* @__PURE__ */ L(at, [["__scopeId", "data-v-6dbac593"]]), st = {
160
291
  key: 0,
161
292
  class: "tr-extension-card__more-action"
162
- }, ge = ["title", "aria-label", "aria-expanded"], ke = { class: "tr-extension-card__more-menu" }, xe = ["disabled", "aria-pressed", "onClick"], Ce = {
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
- }, we = {
296
+ }, dt = {
166
297
  key: 1,
167
298
  class: "tr-extension-card__more-menu-item-icon-placeholder",
168
299
  "aria-hidden": "true"
169
- }, Me = /* @__PURE__ */ S({
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(t, { emit: u }) {
179
- const o = t, m = u, d = _(() => o.showIcons && o.actions.some((a) => !!a.icon)), l = (a, s) => {
180
- a.disabled || (s(), m("action", {
181
- id: a.id,
182
- type: a.type,
183
- ...a.type === "switch" ? { checked: !a.checked } : {}
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 (a, s) => o.actions.length ? (i(), p("div", _e, [
187
- H(be, {
317
+ return (l, v) => t.actions.length ? (c(), p("div", st, [
318
+ j(ot, {
188
319
  "as-child": "",
189
- placement: o.placement
320
+ placement: t.placement
190
321
  }, {
191
- trigger: R(({ open: n }) => [
192
- h("button", {
322
+ trigger: O(({ open: a }) => [
323
+ T("button", {
193
324
  class: "tr-extension-card__icon-button",
194
325
  type: "button",
195
- title: o.label,
196
- "aria-label": o.label,
197
- "aria-expanded": n
326
+ title: t.label,
327
+ "aria-label": t.label,
328
+ "aria-expanded": a
198
329
  }, [
199
- H(j(de), { class: "tr-extension-card__action-icon" })
200
- ], 8, ge)
330
+ j($(Fe), { class: "tr-extension-card__action-icon" })
331
+ ], 8, it)
201
332
  ]),
202
- content: R(({ close: n }) => [
203
- h("ul", ke, [
204
- (i(!0), p($, null, z(o.actions, (e) => (i(), p("li", {
205
- key: e.id
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
- h("button", {
208
- class: x(["tr-extension-card__more-menu-item", { "is-danger": e.danger }]),
338
+ T("button", {
339
+ class: R(["tr-extension-card__more-menu-item", { "is-danger": n.danger }]),
209
340
  type: "button",
210
- disabled: e.disabled,
211
- "aria-pressed": e.type === "switch" ? e.checked : void 0,
212
- onClick: (c) => l(e, n)
341
+ disabled: n.disabled,
342
+ "aria-pressed": n.type === "switch" ? n.checked : void 0,
343
+ onClick: (u) => d(n, a)
213
344
  }, [
214
- d.value ? (i(), p("span", Ce, [
215
- e.icon ? (i(), k(P(e.icon), {
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
- })) : (i(), p("span", we))
219
- ])) : g("", !0),
220
- h("span", null, C(e.label), 1)
221
- ], 10, xe)
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
- ])) : g("", !0);
358
+ ])) : S("", !0);
228
359
  }
229
- }), $e = /* @__PURE__ */ T(Me, [["__scopeId", "data-v-8d00263e"]]), Ae = { class: "tr-extension-card-primary-actions" }, Ee = ["checked", "disabled", "aria-label", "onChange"], Pe = ["aria-label", "disabled", "onClick"], Ie = ["aria-label", "disabled", "onClick"], Se = /* @__PURE__ */ S({
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(t, { emit: u }) {
236
- const o = t, m = u, d = (s, n) => {
237
- if (s.disabled) return;
238
- const e = n.currentTarget, c = e.checked;
239
- e.checked = !!s.checked, m("action", {
240
- id: s.id,
241
- type: s.type,
242
- checked: c
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
- }, l = (s) => {
245
- s.disabled || m("action", { id: s.id, type: s.type });
246
- }, a = (s, n) => {
247
- if (s.disabled) return;
248
- const e = { id: s.id, type: s.type };
249
- n !== void 0 && (e.payload = n), m("action", e);
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 (s, n) => (i(), p("div", Ae, [
252
- (i(!0), p($, null, z(o.actions, (e) => (i(), p($, {
253
- key: e.id
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
- e.type === "switch" ? (i(), p("label", {
386
+ n.type === "switch" ? (c(), p("label", {
256
387
  key: 0,
257
- class: x(["tr-extension-card-primary-actions__switch", { "is-disabled": e.disabled, "is-danger": e.danger }])
388
+ class: R(["tr-extension-card-primary-actions__switch", { "is-disabled": n.disabled, "is-danger": n.danger }])
258
389
  }, [
259
- h("input", {
390
+ T("input", {
260
391
  type: "checkbox",
261
392
  role: "switch",
262
- checked: e.checked,
263
- disabled: e.disabled,
264
- "aria-label": e.label,
265
- onChange: (c) => d(e, c)
266
- }, null, 40, Ee),
267
- n[0] || (n[0] = h("span", { class: "tr-extension-card-primary-actions__switch-track" }, null, -1))
268
- ], 2)) : e.type === "button" ? (i(), p("button", {
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: x(["tr-extension-card-primary-actions__button", { "is-danger": e.danger }]),
401
+ class: R(["tr-extension-card-primary-actions__button", { "is-danger": n.danger }]),
271
402
  type: "button",
272
- "aria-label": e.label,
273
- disabled: e.disabled,
274
- onClick: (c) => l(e)
403
+ "aria-label": n.label,
404
+ disabled: n.disabled,
405
+ onClick: (u) => d(n)
275
406
  }, [
276
- e.icon ? (i(), k(P(e.icon), {
407
+ n.icon ? (c(), A(K(n.icon), {
277
408
  key: 0,
278
409
  class: "tr-extension-card-primary-actions__button-icon"
279
- })) : g("", !0),
280
- h("span", null, C(e.label), 1)
281
- ], 10, Pe)) : s.$slots["primary-action"] ? (i(), p("span", {
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: x(["tr-extension-card-primary-actions__custom-action", { "is-disabled": e.disabled, "is-danger": e.danger }])
414
+ class: R(["tr-extension-card-primary-actions__custom-action", { "is-disabled": n.disabled, "is-danger": n.danger }])
284
415
  }, [
285
- A(s.$slots, "primary-action", {
286
- action: e,
287
- trigger: (c) => a(e, c)
416
+ M(v.$slots, "primary-action", {
417
+ action: n,
418
+ trigger: (u) => l(n, u)
288
419
  }, void 0, !0)
289
- ], 2)) : (i(), p("button", {
420
+ ], 2)) : (c(), p("button", {
290
421
  key: 3,
291
- class: x(["tr-extension-card-primary-actions__button", { "is-danger": e.danger }]),
422
+ class: R(["tr-extension-card-primary-actions__button", { "is-danger": n.danger }]),
292
423
  type: "button",
293
- "aria-label": e.label,
294
- disabled: e.disabled,
295
- onClick: (c) => a(e)
424
+ "aria-label": n.label,
425
+ disabled: n.disabled,
426
+ onClick: (u) => l(n)
296
427
  }, [
297
- e.icon ? (i(), k(P(e.icon), {
428
+ n.icon ? (c(), A(K(n.icon), {
298
429
  key: 0,
299
430
  class: "tr-extension-card-primary-actions__button-icon"
300
- })) : g("", !0),
301
- h("span", null, C(e.label), 1)
302
- ], 10, Ie))
431
+ })) : S("", !0),
432
+ T("span", null, I(n.label), 1)
433
+ ], 10, gt))
303
434
  ], 64))), 128))
304
435
  ]));
305
436
  }
306
- }), Te = /* @__PURE__ */ T(Se, [["__scopeId", "data-v-7f997e75"]]), Le = { class: "tr-extension-card" }, Be = { class: "tr-extension-card__icon-region" }, Ne = ["src", "alt"], Re = {
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
- }, Ve = { class: "tr-extension-card__content" }, ze = ["role", "tabindex", "title"], Ge = ["title"], He = ["aria-label", "aria-valuenow"], De = /* @__PURE__ */ S({
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(t, { emit: u }) {
325
- const o = t, m = V(), d = u, l = _(() => o.actions.filter((f) => !f.hidden)), a = _(() => Math.max(0, Math.floor(o.primaryActionsLimit))), s = _(() => l.value.slice(0, a.value)), n = _(() => l.value.slice(a.value)), e = _(() => s.value.length > 0 || n.value.length > 0), c = _(() => o.progress === "indeterminate" || o.progress === void 0 ? o.progress : Math.min(100, Math.max(0, o.progress))), b = _(() => !!m["primary-action"]), y = (f) => {
326
- d("action", f);
327
- }, w = (f) => {
328
- o.nameClickable && d("name-click", f);
329
- }, M = (f) => {
330
- !o.nameClickable || f.key !== "Enter" && f.key !== " " || (f.preventDefault(), d("name-click", f));
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, r) => (i(), p("div", Le, [
333
- h("div", Be, [
334
- typeof t.icon == "string" && t.icon ? (i(), p("img", {
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: t.icon,
337
- alt: t.name,
467
+ src: e.icon,
468
+ alt: e.name,
338
469
  class: "tr-extension-card__icon"
339
- }, null, 8, Ne)) : t.icon ? (i(), k(P(t.icon), {
470
+ }, null, 8, xt)) : e.icon ? (c(), A(K(e.icon), {
340
471
  key: 1,
341
472
  class: "tr-extension-card__icon"
342
- })) : (i(), p("div", Re, C(t.name.slice(0, 1)), 1))
473
+ })) : (c(), p("div", kt, I(e.name.slice(0, 1)), 1))
343
474
  ]),
344
- h("div", Ve, [
345
- h("div", {
346
- class: x(["tr-extension-card__name", { "is-clickable": t.nameClickable }]),
347
- role: t.nameClickable ? "button" : void 0,
348
- tabindex: t.nameClickable ? 0 : void 0,
349
- title: t.name,
350
- onClick: w,
351
- onKeydown: M
352
- }, C(t.name), 43, ze),
353
- t.description ? (i(), p("div", {
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: t.description
357
- }, C(t.description), 9, Ge)) : g("", !0)
487
+ title: e.description
488
+ }, I(e.description), 9, wt)) : S("", !0)
358
489
  ]),
359
- e.value ? (i(), p("div", {
490
+ n.value ? (c(), p("div", {
360
491
  key: 0,
361
492
  class: "tr-extension-card__actions",
362
- onClick: r[1] || (r[1] = D(() => {
493
+ onClick: s[1] || (s[1] = oe(() => {
363
494
  }, ["stop"])),
364
- onKeydown: r[2] || (r[2] = D(() => {
495
+ onKeydown: s[2] || (s[2] = oe(() => {
365
496
  }, ["stop"]))
366
497
  }, [
367
- s.value.length ? (i(), k(Te, {
498
+ v.value.length ? (c(), A(ht, {
368
499
  key: 0,
369
- actions: s.value,
370
- onAction: r[0] || (r[0] = (v) => d("action", v))
371
- }, se({ _: 2 }, [
372
- b.value ? {
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: R((v) => [
375
- A(f.$slots, "primary-action", ie(re(v)), void 0, !0)
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"])) : g("", !0),
380
- n.value.length ? (i(), k($e, {
510
+ ]), 1032, ["actions"])) : S("", !0),
511
+ a.value.length ? (c(), A(mt, {
381
512
  key: 1,
382
- actions: n.value,
383
- label: t.overflowMenuLabel,
384
- placement: t.overflowMenuPlacement,
385
- "show-icons": t.overflowMenuShowIcons,
386
- onAction: y
387
- }, null, 8, ["actions", "label", "placement", "show-icons"])) : g("", !0)
388
- ], 32)) : g("", !0),
389
- c.value !== void 0 ? (i(), p("div", {
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": t.name,
524
+ "aria-label": e.name,
394
525
  "aria-valuemin": "0",
395
526
  "aria-valuemax": "100",
396
- "aria-valuenow": c.value === "indeterminate" ? void 0 : c.value
527
+ "aria-valuenow": u.value === "indeterminate" ? void 0 : u.value
397
528
  }, [
398
- h("span", {
399
- class: x(["tr-extension-card__progress-bar", { "is-indeterminate": c.value === "indeterminate" }]),
400
- style: W(c.value === "indeterminate" ? void 0 : { width: `${c.value}%` })
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, He)) : g("", !0)
533
+ ], 8, $t)) : S("", !0)
403
534
  ]));
404
535
  }
405
- }), I = /* @__PURE__ */ T(De, [["__scopeId", "data-v-adf5e9c0"]]), Ke = { class: "tr-extension-card-grid" }, We = {
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
- }, je = ["data-card-id"], Fe = /* @__PURE__ */ S({
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(t, { emit: u }) {
421
- const o = t, m = V(), d = u, l = (n) => {
422
- const { id: e, ...c } = n;
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
- ...c,
425
- primaryActionsLimit: n.primaryActionsLimit ?? o.primaryActionsLimit,
426
- nameClickable: n.nameClickable ?? o.nameClickable,
427
- overflowMenuLabel: n.overflowMenuLabel ?? o.overflowMenuLabel,
428
- overflowMenuPlacement: n.overflowMenuPlacement ?? o.overflowMenuPlacement,
429
- overflowMenuShowIcons: n.overflowMenuShowIcons ?? o.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
- }, a = (n, e) => {
432
- d("action", { itemId: n, action: e });
433
- }, s = (n, e) => {
434
- d("name-click", { itemId: n, event: e });
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 (n, e) => (i(), p("ul", Ke, [
437
- t.items.length === 0 ? (i(), p("li", We, [
438
- A(n.$slots, "empty", {}, () => [
439
- le(C(t.emptyText), 1)
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
- ])) : (i(!0), p($, { key: 1 }, z(t.items, (c, b) => (i(), p("li", {
442
- key: c.id,
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": c.id
575
+ "data-card-id": u.id
445
576
  }, [
446
- j(m).item ? A(n.$slots, "item", {
447
- item: c,
448
- index: b
449
- }, void 0, !0, 0) : (i(), k(I, ce({
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
- }, l(c), {
453
- onAction: (y) => a(c.id, y),
454
- onNameClick: (y) => s(c.id, y)
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, je))), 128))
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
- }), B = /* @__PURE__ */ T(Fe, [["__scopeId", "data-v-b736eba6"]]);
460
- I.name = "TrExtensionCard";
461
- const Oe = function(t) {
462
- t.component(I.name, I);
463
- }, Ue = I;
464
- Ue.install = Oe;
465
- B.name = "TrExtensionCardGrid";
466
- const qe = function(t) {
467
- t.component(B.name, B);
468
- }, Je = B;
469
- Je.install = qe;
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
- Ue as ExtensionCard,
472
- Je as ExtensionCardGrid
991
+ ee as ExtensionCard,
992
+ te as ExtensionCardGrid,
993
+ mn as ExtensionManager,
994
+ mn as default
473
995
  };