vue3-router-tab 1.3.0 → 1.3.2

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,7 +1,7 @@
1
1
  import './vue3-router-tab.css';
2
- import { reactive as ge, ref as $, shallowRef as bt, computed as k, watch as A, nextTick as _, inject as Ae, getCurrentInstance as Oe, onMounted as me, defineComponent as Ue, provide as pt, onBeforeUnmount as gt, resolveComponent as mt, createElementBlock as I, openBlock as P, createElementVNode as O, createCommentVNode as U, normalizeClass as J, renderSlot as ue, createVNode as q, TransitionGroup as vt, mergeProps as Q, withCtx as Z, Fragment as ce, renderList as Ee, withModifiers as fe, toDisplayString as Ke, normalizeProps as yt, Transition as Ie, createBlock as de, KeepAlive as ht, resolveDynamicComponent as xe, normalizeStyle as Tt, isRef as kt, isReadonly as wt } from "vue";
3
- import { RouterView as Ct } from "vue-router";
4
- function Rt(e = {}) {
2
+ import { reactive as be, ref as $, shallowRef as dt, computed as k, watch as A, nextTick as j, inject as Re, getCurrentInstance as je, onMounted as pe, defineComponent as Oe, provide as bt, onBeforeUnmount as pt, resolveComponent as gt, createElementBlock as S, openBlock as P, createElementVNode as L, withDirectives as mt, normalizeClass as H, renderSlot as re, createVNode as Pe, TransitionGroup as vt, mergeProps as le, withCtx as se, Fragment as Ae, renderList as Ke, withModifiers as ue, createCommentVNode as Ee, toDisplayString as Ie, createBlock as J, normalizeProps as yt, Transition as ht, resolveDynamicComponent as ce, KeepAlive as Tt, normalizeStyle as kt, vShow as wt, isRef as Ct, isReadonly as Rt } from "vue";
3
+ import { RouterView as Pt } from "vue-router";
4
+ function At(e = {}) {
5
5
  return {
6
6
  initialTabs: e.initialTabs ?? [],
7
7
  keepAlive: e.keepAlive ?? !0,
@@ -17,7 +17,7 @@ function V(e, n) {
17
17
  throw new Error(`[RouterTabs] Unable to resolve route: ${String(n)}`);
18
18
  return o;
19
19
  }
20
- const Pt = {
20
+ const Kt = {
21
21
  path: (e) => e.path,
22
22
  fullpath: (e) => e.fullPath,
23
23
  fullname: (e) => e.fullPath,
@@ -30,39 +30,39 @@ function N(e) {
30
30
  const o = n(e);
31
31
  if (typeof o == "string" && o.length) return o;
32
32
  } else if (typeof n == "string" && n.length) {
33
- const o = Pt[n.toLowerCase()];
33
+ const o = Kt[n.toLowerCase()];
34
34
  return o ? o(e) : n;
35
35
  }
36
36
  return e.fullPath;
37
37
  }
38
- function ve(e, n) {
38
+ function ge(e, n) {
39
39
  const o = e.meta?.keepAlive;
40
40
  return typeof o == "boolean" ? o : n;
41
41
  }
42
- function ye(e, n) {
42
+ function me(e, n) {
43
43
  const o = e.meta?.reuse;
44
44
  return typeof o == "boolean" ? o : n;
45
45
  }
46
- function Ve(e) {
46
+ function Ue(e) {
47
47
  const n = e.meta ?? {}, o = {};
48
48
  return "title" in n && (o.title = n.title), "tips" in n && (o.tips = n.tips), "icon" in n && (o.icon = n.icon), "closable" in n && (o.closable = n.closable), "tabClass" in n && (o.tabClass = n.tabClass), "target" in n && (o.target = n.target), "href" in n && (o.href = n.href), o;
49
49
  }
50
- function ee(e, n, o) {
51
- const l = Ve(e);
50
+ function q(e, n, o) {
51
+ const l = Ue(e);
52
52
  return {
53
53
  id: N(e),
54
54
  to: e.fullPath,
55
55
  fullPath: e.fullPath,
56
56
  matched: e,
57
- alive: ve(e, o),
58
- reusable: ye(e, !1),
57
+ alive: ge(e, o),
58
+ reusable: me(e, !1),
59
59
  closable: l.closable ?? !0,
60
60
  renderKey: typeof n.renderKey == "number" ? n.renderKey : 0,
61
61
  ...l,
62
62
  ...n
63
63
  };
64
64
  }
65
- function be(e, n, o, l) {
65
+ function fe(e, n, o, l) {
66
66
  if (!e.find((p) => p.id === n.id)) {
67
67
  if (o === "next" && l) {
68
68
  const p = e.findIndex((T) => T.id === l);
@@ -74,17 +74,17 @@ function be(e, n, o, l) {
74
74
  e.push(n);
75
75
  }
76
76
  }
77
- function Se(e, n, o) {
77
+ function xe(e, n, o) {
78
78
  if (!n || n <= 0) return;
79
- const l = e.filter((r) => r.alive);
79
+ const l = e.filter((i) => i.alive);
80
80
  for (; l.length > n; ) {
81
- const r = l.shift();
82
- if (!r || r.id === o) continue;
83
- const p = e.findIndex((T) => T.id === r.id);
81
+ const i = l.shift();
82
+ if (!i || i.id === o) continue;
83
+ const p = e.findIndex((T) => T.id === i.id);
84
84
  p > -1 && (e[p].alive = !1);
85
85
  }
86
86
  }
87
- function At(e) {
87
+ function Et(e) {
88
88
  return {
89
89
  to: e.to,
90
90
  title: e.title,
@@ -95,95 +95,95 @@ function At(e) {
95
95
  renderKey: e.renderKey
96
96
  };
97
97
  }
98
- function Et(e) {
98
+ function It(e) {
99
99
  const n = {};
100
100
  return "title" in e && (n.title = e.title), "tips" in e && (n.tips = e.tips), "icon" in e && (n.icon = e.icon), "tabClass" in e && (n.tabClass = e.tabClass), "closable" in e && (n.closable = e.closable), "renderKey" in e && typeof e.renderKey == "number" && (n.renderKey = e.renderKey), n;
101
101
  }
102
- function Kt(e, n = {}) {
103
- const o = Rt(n), l = ge([]), r = $(null), p = bt(), T = $(null), s = k(
104
- () => l.filter((i) => i.alive).map((i) => `${i.id}::${i.renderKey ?? 0}`)
102
+ function xt(e, n = {}) {
103
+ const o = At(n), l = be([]), i = $(null), p = dt(), T = $(null), s = k(
104
+ () => l.filter((r) => r.alive).map((r) => `${r.id}::${r.renderKey ?? 0}`)
105
105
  );
106
106
  let c = !1;
107
- function g(i) {
108
- const b = typeof i.matched == "object" ? i : V(e, i);
107
+ function g(r) {
108
+ const b = typeof r.matched == "object" ? r : V(e, r);
109
109
  return {
110
110
  key: N(b),
111
111
  fullPath: b.fullPath,
112
- alive: ve(b, o.keepAlive),
113
- reusable: ye(b, !1),
112
+ alive: ge(b, o.keepAlive),
113
+ reusable: me(b, !1),
114
114
  matched: b
115
115
  };
116
116
  }
117
- function R(i) {
118
- const b = N(i);
117
+ function R(r) {
118
+ const b = N(r);
119
119
  let d = l.find((h) => h.id === b);
120
- return d ? (d.fullPath = i.fullPath, d.to = i.fullPath, d.matched = i, d.alive = ve(i, o.keepAlive), d.reusable = ye(i, d.reusable), typeof d.renderKey != "number" && (d.renderKey = 0), Object.assign(d, Ve(i)), d) : (d = ee(i, {}, o.keepAlive), be(l, d, o.appendPosition, r.value), Se(l, o.maxAlive, r.value), d);
120
+ return d ? (d.fullPath = r.fullPath, d.to = r.fullPath, d.matched = r, d.alive = ge(r, o.keepAlive), d.reusable = me(r, d.reusable), typeof d.renderKey != "number" && (d.renderKey = 0), Object.assign(d, Ue(r)), d) : (d = q(r, {}, o.keepAlive), fe(l, d, o.appendPosition, i.value), xe(l, o.maxAlive, i.value), d);
121
121
  }
122
- async function S(i, b = !1, d = !0) {
123
- const h = V(e, i), w = N(h), E = r.value === w;
124
- d === "sameTab" && (d = E), d && await L(w, !0), await e[b ? "replace" : "push"](h), E && await y();
122
+ async function x(r, b = !1, d = !0) {
123
+ const h = V(e, r), w = N(h), K = i.value === w;
124
+ d === "sameTab" && (d = K), d && await O(w, !0), await e[b ? "replace" : "push"](h), K && await y();
125
125
  }
126
- function B(i) {
127
- const b = l.findIndex((x) => x.id === i);
126
+ function B(r) {
127
+ const b = l.findIndex((I) => I.id === r);
128
128
  if (b === -1) return o.defaultRoute;
129
- const d = l[b + 1], h = l[b - 1], w = l.find((x) => x.id !== i), E = d || h || w;
130
- return E ? E.to : o.defaultRoute;
129
+ const d = l[b + 1], h = l[b - 1], w = l.find((I) => I.id !== r), K = d || h || w;
130
+ return K ? K.to : o.defaultRoute;
131
131
  }
132
- async function z(i = r.value, b = {}) {
133
- if (!i) return;
132
+ async function z(r = i.value, b = {}) {
133
+ if (!r) return;
134
134
  if (!b.force && o.keepLastTab && l.length === 1)
135
135
  throw new Error("[RouterTabs] Unable to close the final tab when keepLastTab is true.");
136
- const h = r.value === i && b.redirect !== null, w = h ? b.redirect ?? B(i) : null;
137
- await Y(i, { force: b.force }), b.redirect !== null && h && w && await e.replace(w);
136
+ const h = i.value === r && b.redirect !== null, w = h ? b.redirect ?? B(r) : null;
137
+ await _(r, { force: b.force }), b.redirect !== null && h && w && await e.replace(w);
138
138
  }
139
- async function Y(i, b = {}) {
140
- const d = l.findIndex((h) => h.id === i);
141
- d !== -1 && (l.splice(d, 1), T.value === i && (T.value = null), r.value === i && (r.value = null, p.value = void 0));
139
+ async function _(r, b = {}) {
140
+ const d = l.findIndex((h) => h.id === r);
141
+ d !== -1 && (l.splice(d, 1), T.value === r && (T.value = null), i.value === r && (i.value = null, p.value = void 0));
142
142
  }
143
- async function L(i = r.value ?? void 0, b = !1) {
144
- if (!i) return;
145
- const d = l.find((w) => w.id === i);
143
+ async function O(r = i.value ?? void 0, b = !1) {
144
+ if (!r) return;
145
+ const d = l.find((w) => w.id === r);
146
146
  if (!d) return;
147
147
  const h = o.keepAlive && d.alive;
148
- h && (d.alive = !1, await _()), d.renderKey = (d.renderKey ?? 0) + 1, h && (d.alive = !0), T.value = i, await _(), await _(), T.value = null;
148
+ h && (d.alive = !1, await j()), d.renderKey = (d.renderKey ?? 0) + 1, h && (d.alive = !0), T.value = r, await j(), b || await j(), T.value = null;
149
149
  }
150
- async function ae(i = !1) {
150
+ async function te(r = !1) {
151
151
  for (const b of l)
152
- await L(b.id, i);
152
+ await O(b.id, r);
153
153
  }
154
- async function re(i = o.defaultRoute) {
155
- l.splice(0, l.length), r.value = null, p.value = void 0;
154
+ async function ne(r = o.defaultRoute) {
155
+ l.splice(0, l.length), i.value = null, p.value = void 0;
156
156
  for (const b of o.initialTabs) {
157
- const d = V(e, b.to), h = ee(d, b, o.keepAlive);
157
+ const d = V(e, b.to), h = q(d, b, o.keepAlive);
158
158
  l.push(h);
159
159
  }
160
- await e.replace(i);
160
+ await e.replace(r);
161
161
  }
162
162
  async function y() {
163
- const i = r.value;
164
- i && await L(i, !0);
163
+ const r = i.value;
164
+ r && await O(r, !0);
165
165
  }
166
- function G(i) {
167
- return typeof i.matched == "object" ? N(i) : N(V(e, i));
166
+ function G(r) {
167
+ return typeof r.matched == "object" ? N(r) : N(V(e, r));
168
168
  }
169
169
  function M() {
170
- const i = l.find((b) => b.id === r.value);
170
+ const r = l.find((b) => b.id === i.value);
171
171
  return {
172
- tabs: l.map(At),
173
- active: i ? i.to : null
172
+ tabs: l.map(Et),
173
+ active: r ? r.to : null
174
174
  };
175
175
  }
176
- async function D(i) {
177
- c = !0, l.splice(0, l.length), r.value = null, p.value = void 0;
178
- const b = i?.tabs ?? [];
176
+ async function D(r) {
177
+ c = !0, l.splice(0, l.length), i.value = null, p.value = void 0;
178
+ const b = r?.tabs ?? [];
179
179
  for (const h of b)
180
180
  try {
181
- const w = V(e, h.to), E = Et(h), x = ee(w, E, o.keepAlive);
182
- be(l, x, "last", null);
181
+ const w = V(e, h.to), K = It(h), I = q(w, K, o.keepAlive);
182
+ fe(l, I, "last", null);
183
183
  } catch {
184
184
  }
185
185
  c = !1;
186
- const d = i?.active ?? b[b.length - 1]?.to ?? o.defaultRoute;
186
+ const d = r?.active ?? b[b.length - 1]?.to ?? o.defaultRoute;
187
187
  if (d)
188
188
  try {
189
189
  await e.replace(d);
@@ -192,28 +192,28 @@ function Kt(e, n = {}) {
192
192
  }
193
193
  return A(
194
194
  () => e.currentRoute.value,
195
- (i) => {
195
+ (r) => {
196
196
  if (c) return;
197
- const b = R(i);
198
- r.value = b.id, p.value = b, Se(l, o.maxAlive, r.value);
197
+ const b = R(r);
198
+ i.value = b.id, p.value = b, xe(l, o.maxAlive, i.value);
199
199
  },
200
200
  { immediate: !0 }
201
- ), o.initialTabs.length && o.initialTabs.forEach((i) => {
202
- const b = V(e, i.to), d = ee(b, i, o.keepAlive);
203
- be(l, d, "last", null);
201
+ ), o.initialTabs.length && o.initialTabs.forEach((r) => {
202
+ const b = V(e, r.to), d = q(b, r, o.keepAlive);
203
+ fe(l, d, "last", null);
204
204
  }), {
205
205
  options: o,
206
206
  tabs: l,
207
- activeId: r,
207
+ activeId: i,
208
208
  current: p,
209
209
  includeKeys: s,
210
210
  refreshingKey: T,
211
- openTab: S,
211
+ openTab: x,
212
212
  closeTab: z,
213
- removeTab: Y,
214
- refreshTab: L,
215
- refreshAll: ae,
216
- reset: re,
213
+ removeTab: _,
214
+ refreshTab: O,
215
+ refreshAll: te,
216
+ reset: ne,
217
217
  reload: y,
218
218
  getRouteKey: G,
219
219
  matchRoute: g,
@@ -224,20 +224,20 @@ function Kt(e, n = {}) {
224
224
  function De(e) {
225
225
  return e ? typeof e == "string" ? { name: e } : e : {};
226
226
  }
227
- const oe = Symbol("RouterTabsContext"), ne = "router-tabs:snapshot";
228
- function $e(e = {}) {
229
- const { optional: n = !1 } = e, o = Ae(oe, null);
227
+ const ee = Symbol("RouterTabsContext"), Z = "router-tabs:snapshot";
228
+ function Se(e = {}) {
229
+ const { optional: n = !1 } = e, o = Re(ee, null);
230
230
  if (o) return o;
231
- const l = Ae("$tabs", null);
231
+ const l = Re("$tabs", null);
232
232
  if (l) return l;
233
- const p = Oe()?.appContext.config.globalProperties.$tabs;
233
+ const p = je()?.appContext.config.globalProperties.$tabs;
234
234
  if (p) return p;
235
235
  if (!n)
236
236
  throw new Error("[RouterTabs] useRouterTabs must be used within <router-tab>.");
237
237
  return null;
238
238
  }
239
- const It = 864e5;
240
- function xt(e) {
239
+ const Dt = 864e5;
240
+ function St(e) {
241
241
  if (typeof document > "u") return null;
242
242
  const n = `${encodeURIComponent(e)}=`, o = document.cookie ? document.cookie.split("; ") : [];
243
243
  for (const l of o)
@@ -245,27 +245,27 @@ function xt(e) {
245
245
  return decodeURIComponent(l.slice(n.length));
246
246
  return null;
247
247
  }
248
- function Be(e, n, o) {
248
+ function $e(e, n, o) {
249
249
  if (typeof document > "u") return;
250
250
  const {
251
251
  expiresInDays: l = 7,
252
- path: r = "/",
252
+ path: i = "/",
253
253
  domain: p,
254
254
  secure: T,
255
255
  sameSite: s = "lax"
256
256
  } = o, c = [`${encodeURIComponent(e)}=${encodeURIComponent(n)}`];
257
257
  if (l !== 1 / 0) {
258
- const g = new Date(Date.now() + l * It).toUTCString();
258
+ const g = new Date(Date.now() + l * Dt).toUTCString();
259
259
  c.push(`Expires=${g}`);
260
260
  }
261
- r && c.push(`Path=${r}`), p && c.push(`Domain=${p}`), T && c.push("Secure"), s && c.push(`SameSite=${s.charAt(0).toUpperCase()}${s.slice(1)}`), document.cookie = c.join("; ");
261
+ i && c.push(`Path=${i}`), p && c.push(`Domain=${p}`), T && c.push("Secure"), s && c.push(`SameSite=${s.charAt(0).toUpperCase()}${s.slice(1)}`), document.cookie = c.join("; ");
262
262
  }
263
- function Me(e, n) {
263
+ function Be(e, n) {
264
264
  if (typeof document > "u") return;
265
- const { path: o = "/", domain: l } = n, r = [`${encodeURIComponent(e)}=`];
266
- r.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && r.push(`Path=${o}`), l && r.push(`Domain=${l}`), document.cookie = r.join("; ");
265
+ const { path: o = "/", domain: l } = n, i = [`${encodeURIComponent(e)}=`];
266
+ i.push("Expires=Thu, 01 Jan 1970 00:00:01 GMT"), o && i.push(`Path=${o}`), l && i.push(`Domain=${l}`), document.cookie = i.join("; ");
267
267
  }
268
- const St = (e) => JSON.stringify(e ?? null), Dt = (e) => {
268
+ const $t = (e) => JSON.stringify(e ?? null), Bt = (e) => {
269
269
  if (!e) return null;
270
270
  try {
271
271
  return JSON.parse(e);
@@ -273,19 +273,19 @@ const St = (e) => JSON.stringify(e ?? null), Dt = (e) => {
273
273
  return null;
274
274
  }
275
275
  };
276
- function Ne(e = {}) {
276
+ function Ve(e = {}) {
277
277
  const {
278
- cookieKey: n = ne,
279
- serialize: o = St,
280
- deserialize: l = Dt
281
- } = e, r = $e({ optional: !0 }), p = $(!0), T = (s) => {
282
- me(async () => {
283
- const c = l(xt(n));
278
+ cookieKey: n = Z,
279
+ serialize: o = $t,
280
+ deserialize: l = Bt
281
+ } = e, i = Se({ optional: !0 }), p = $(!0), T = (s) => {
282
+ pe(async () => {
283
+ const c = l(St(n));
284
284
  if (c && c.tabs?.length)
285
285
  try {
286
286
  if (p.value = !0, await s.hydrate(c), c.active) {
287
- await _();
288
- const R = s.tabs.find((S) => S.to === c.active);
287
+ await j();
288
+ const R = s.tabs.find((x) => x.to === c.active);
289
289
  R && (s.activeId.value = R.id, s.current.value = R);
290
290
  }
291
291
  } finally {
@@ -302,7 +302,7 @@ function Ne(e = {}) {
302
302
  else
303
303
  p.value = !1;
304
304
  const g = s.snapshot();
305
- g.tabs.length ? Be(n, o(g), e) : Me(n, e), p.value = !1;
305
+ g.tabs.length ? $e(n, o(g), e) : Be(n, e), p.value = !1;
306
306
  }), A(
307
307
  () => ({
308
308
  tabs: s.tabs.map((c) => ({
@@ -319,19 +319,19 @@ function Ne(e = {}) {
319
319
  () => {
320
320
  if (p.value) return;
321
321
  const c = s.snapshot();
322
- c.tabs.length ? Be(n, o(c), e) : Me(n, e);
322
+ c.tabs.length ? $e(n, o(c), e) : Be(n, e);
323
323
  },
324
324
  { deep: !0 }
325
325
  );
326
326
  };
327
- r ? T(r) : me(() => {
328
- const s = $e({ optional: !0 });
327
+ i ? T(i) : pe(() => {
328
+ const s = Se({ optional: !0 });
329
329
  s && T(s);
330
330
  });
331
331
  }
332
- const $t = Ue({
332
+ const Mt = Oe({
333
333
  name: "RouterTab",
334
- components: { RouterView: Ct },
334
+ components: { RouterView: Pt },
335
335
  props: {
336
336
  tabs: {
337
337
  type: Array,
@@ -371,7 +371,7 @@ const $t = Ue({
371
371
  },
372
372
  cookieKey: {
373
373
  type: String,
374
- default: ne
374
+ default: Z
375
375
  },
376
376
  persistence: {
377
377
  type: Object,
@@ -384,13 +384,13 @@ const $t = Ue({
384
384
  },
385
385
  emits: ["tab-sort", "tab-sorted"],
386
386
  setup(e, { emit: n }) {
387
- const o = Oe();
387
+ const o = je();
388
388
  if (!o)
389
389
  throw new Error("[RouterTab] component must be used within a Vue application context.");
390
390
  const l = o.appContext.app.config.globalProperties.$router;
391
391
  if (!l)
392
392
  throw new Error("[RouterTab] Vue Router is required. Make sure to call app.use(router) before RouterTab.");
393
- const r = Kt(l, {
393
+ const i = xt(l, {
394
394
  initialTabs: e.tabs,
395
395
  keepAlive: e.keepAlive,
396
396
  maxAlive: e.maxAlive,
@@ -398,23 +398,23 @@ const $t = Ue({
398
398
  appendPosition: e.append,
399
399
  defaultRoute: e.defaultPage
400
400
  });
401
- pt(oe, r), o.appContext.config.globalProperties.$tabs = r;
401
+ bt(ee, i), o.appContext.config.globalProperties.$tabs = i;
402
402
  const p = k(() => !!o?.slots?.default), T = k(() => !!o?.slots?.start), s = k(() => !!o?.slots?.end), c = $(0), g = k(() => {
403
403
  c.value;
404
404
  const t = {};
405
- return r.tabs.forEach((a) => {
406
- const f = typeof a.title == "string" ? a.title : String(a.title || ie(a));
405
+ return i.tabs.forEach((a) => {
406
+ const f = typeof a.title == "string" ? a.title : String(a.title || oe(a));
407
407
  t[a.id] = f;
408
408
  }), t;
409
409
  });
410
410
  function R() {
411
411
  c.value++;
412
412
  }
413
- const S = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
413
+ const x = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Map();
414
414
  function z(t, a) {
415
- if (!a || S.has(t)) return;
416
- S.set(t, a);
417
- const f = r.tabs.find((v) => r.getRouteKey(v.to) === t);
415
+ if (!a || x.has(t)) return;
416
+ x.set(t, a);
417
+ const f = i.tabs.find((v) => i.getRouteKey(v.to) === t);
418
418
  if (!f) return;
419
419
  const m = [];
420
420
  if (a.routeTabTitle !== void 0) {
@@ -425,8 +425,8 @@ const $t = Ue({
425
425
  },
426
426
  (u) => {
427
427
  if (u != null) {
428
- const j = String(u);
429
- f.title = j, R();
428
+ const U = String(u);
429
+ f.title = U, R();
430
430
  }
431
431
  },
432
432
  { immediate: !0 }
@@ -474,24 +474,24 @@ const $t = Ue({
474
474
  }
475
475
  B.set(t, m);
476
476
  }
477
- function Y(t) {
477
+ function _(t) {
478
478
  const a = B.get(t);
479
- a && (a.forEach((f) => f()), B.delete(t)), S.delete(t);
479
+ a && (a.forEach((f) => f()), B.delete(t)), x.delete(t);
480
480
  }
481
- function L(t, a) {
482
- t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? z(a, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && z(a, t.$) : t === null && Y(a);
481
+ function O(t, a) {
482
+ t ? t.routeTabTitle !== void 0 || t.routeTabIcon !== void 0 || t.routeTabClosable !== void 0 ? z(a, t) : t.$ && (t.$.routeTabTitle !== void 0 || t.$.routeTabIcon !== void 0 || t.$.routeTabClosable !== void 0) && z(a, t.$) : t === null && _(a);
483
483
  }
484
484
  if (e.cookieKey !== null || e.persistence) {
485
485
  const t = {
486
486
  ...e.persistence ?? {}
487
487
  };
488
- e.cookieKey !== null ? t.cookieKey = e.cookieKey || ne : t.cookieKey || (t.cookieKey = ne), Ne(t);
488
+ e.cookieKey !== null ? t.cookieKey = e.cookieKey || Z : t.cookieKey || (t.cookieKey = Z), Ve(t);
489
489
  }
490
- const ae = k(() => De(e.tabTransition)), re = k(() => De(e.pageTransition)), y = ge({
490
+ const te = k(() => De(e.tabTransition)), ne = k(() => De(e.pageTransition)), y = be({
491
491
  visible: !1,
492
492
  target: null,
493
493
  position: { x: 0, y: 0 }
494
- }), G = $(null), M = $([]), D = $(-1), i = ge({
494
+ }), G = $(null), M = $([]), D = $(-1), r = be({
495
495
  dragging: !1,
496
496
  dragIndex: -1,
497
497
  dropIndex: -1,
@@ -505,112 +505,114 @@ const $t = Ue({
505
505
  "closeOthers"
506
506
  ];
507
507
  function d(t) {
508
- return r.tabs.findIndex((a) => a.id === t);
508
+ return i.tabs.findIndex((a) => a.id === t);
509
509
  }
510
510
  function h(t) {
511
511
  const a = d(t.id);
512
- return a > 0 ? r.tabs.slice(0, a) : [];
512
+ return a > 0 ? i.tabs.slice(0, a) : [];
513
513
  }
514
514
  function w(t) {
515
515
  const a = d(t.id);
516
- return a > -1 ? r.tabs.slice(a + 1) : [];
516
+ return a > -1 ? i.tabs.slice(a + 1) : [];
517
517
  }
518
- function E(t) {
519
- return r.tabs.filter((a) => a.id !== t.id);
518
+ function K(t) {
519
+ return i.tabs.filter((a) => a.id !== t.id);
520
520
  }
521
- async function x(t, a) {
521
+ async function I(t, a) {
522
522
  const f = t.filter((m) => m.closable !== !1);
523
523
  if (f.length) {
524
524
  for (const m of f)
525
- r.activeId.value === m.id ? await r.closeTab(m.id, { redirect: a.to, force: !0 }) : await r.removeTab(m.id, { force: !0 });
526
- r.activeId.value !== a.id && await r.openTab(a.to, !0, !1);
525
+ i.activeId.value === m.id ? await i.closeTab(m.id, { redirect: a.to, force: !0 }) : await i.removeTab(m.id, { force: !0 });
526
+ i.activeId.value !== a.id && await i.openTab(a.to, !0, !1);
527
527
  }
528
528
  }
529
- const He = {
529
+ const Fe = {
530
530
  refresh: {
531
531
  label: "Refresh",
532
532
  handler: async ({ target: t }) => {
533
- await r.refreshTab(t.id, !0);
533
+ await i.refreshTab(t.id, !0);
534
534
  }
535
535
  },
536
536
  refreshAll: {
537
537
  label: "Refresh All",
538
538
  handler: async () => {
539
- await r.refreshAll(!0);
539
+ await i.refreshAll(!0);
540
540
  }
541
541
  },
542
542
  close: {
543
543
  label: "Close",
544
544
  handler: async ({ target: t }) => {
545
- await r.closeTab(t.id);
545
+ await i.closeTab(t.id);
546
546
  },
547
- enable: ({ target: t }) => le(t)
547
+ enable: ({ target: t }) => ae(t)
548
548
  },
549
549
  closeLefts: {
550
550
  label: "Close to the Left",
551
551
  handler: async ({ target: t }) => {
552
- await x(h(t), t);
552
+ await I(h(t), t);
553
553
  },
554
554
  enable: ({ target: t }) => h(t).some((a) => a.closable !== !1)
555
555
  },
556
556
  closeRights: {
557
557
  label: "Close to the Right",
558
558
  handler: async ({ target: t }) => {
559
- await x(w(t), t);
559
+ await I(w(t), t);
560
560
  },
561
561
  enable: ({ target: t }) => w(t).some((a) => a.closable !== !1)
562
562
  },
563
563
  closeOthers: {
564
564
  label: "Close Others",
565
565
  handler: async ({ target: t }) => {
566
- await x(E(t), t);
566
+ await I(K(t), t);
567
567
  },
568
- enable: ({ target: t }) => E(t).some((a) => a.closable !== !1)
568
+ enable: ({ target: t }) => K(t).some((a) => a.closable !== !1)
569
569
  }
570
570
  };
571
- function K() {
571
+ function E() {
572
572
  y.visible = !1, y.target = null, D.value = -1, M.value = [];
573
573
  }
574
- function Je(t, a) {
575
- e.contextmenu && (y.visible = !0, y.target = t, y.position.x = a.clientX, y.position.y = a.clientY, document.addEventListener("click", K, { once: !0 }), _(() => {
576
- Ge();
574
+ function He(t, a) {
575
+ e.contextmenu && (y.target = t, y.position.x = a.clientX, y.position.y = a.clientY, j(() => {
576
+ y.visible = !0, document.addEventListener("click", E, { once: !0 }), j(() => {
577
+ We();
578
+ });
577
579
  }));
578
580
  }
579
- function We(t, a) {
580
- const f = typeof t == "string" ? { id: t } : t, m = He[f.id], v = f.label ?? m?.label ?? String(f.id), u = f.visible ?? m?.visible ?? !0;
581
+ function Je(t, a) {
582
+ const f = typeof t == "string" ? { id: t } : t, m = Fe[f.id], v = f.label ?? m?.label ?? String(f.id), u = f.visible ?? m?.visible ?? !0;
581
583
  if (!(typeof u == "function" ? u(a) : u !== !1)) return null;
582
- const se = f.enable ?? m?.enable ?? !0, ft = typeof se == "function" ? se(a) : se !== !1, Pe = f.handler ?? m?.handler;
583
- if (!Pe) return null;
584
- const dt = async () => {
585
- await Promise.resolve(Pe(a));
584
+ const ie = f.enable ?? m?.enable ?? !0, ct = typeof ie == "function" ? ie(a) : ie !== !1, Ce = f.handler ?? m?.handler;
585
+ if (!Ce) return null;
586
+ const ft = async () => {
587
+ await Promise.resolve(Ce(a));
586
588
  };
587
589
  return {
588
590
  id: String(f.id),
589
591
  label: v,
590
- disabled: !ft,
591
- action: dt
592
+ disabled: !ct,
593
+ action: ft
592
594
  };
593
595
  }
594
- const F = k(() => {
596
+ const Y = k(() => {
595
597
  if (!y.visible || !y.target || e.contextmenu === !1) return [];
596
- const t = Array.isArray(e.contextmenu) ? e.contextmenu : b, a = { target: y.target, controller: r };
597
- return t.map((f) => We(f, a)).filter((f) => !!f);
598
+ const t = Array.isArray(e.contextmenu) ? e.contextmenu : b, a = { target: y.target, controller: i };
599
+ return t.map((f) => Je(f, a)).filter((f) => !!f);
598
600
  });
599
- function Ge() {
601
+ function We() {
600
602
  const t = G.value;
601
603
  if (!t) return;
602
604
  const a = 8, { innerWidth: f, innerHeight: m } = window, v = t.getBoundingClientRect();
603
- let u = y.position.x, j = y.position.y;
604
- v.right > f - a && (u = Math.max(a, f - v.width - a)), v.bottom > m - a && (j = Math.max(a, m - v.height - a)), (u !== y.position.x || j !== y.position.y) && (y.position.x = u, y.position.y = j);
605
+ let u = y.position.x, U = y.position.y;
606
+ v.right > f - a && (u = Math.max(a, f - v.width - a)), v.bottom > m - a && (U = Math.max(a, m - v.height - a)), (u !== y.position.x || U !== y.position.y) && (y.position.x = u, y.position.y = U);
605
607
  }
606
- function Xe(t, a) {
608
+ function Ge(t, a) {
607
609
  M.value[a] = t ?? null;
608
610
  }
609
- function qe(t) {
611
+ function Xe(t) {
610
612
  if (t < 0) return;
611
613
  M.value[t]?.focus({ preventScroll: !0 });
612
614
  }
613
- function X(t, a, f = F.value) {
615
+ function X(t, a, f = Y.value) {
614
616
  if (!f.length) return -1;
615
617
  const m = f.length;
616
618
  let v = t;
@@ -618,19 +620,19 @@ const $t = Ue({
618
620
  if (v = (v + a + m) % m, !f[v].disabled) return v;
619
621
  return -1;
620
622
  }
621
- function H(t) {
622
- D.value = t, !(t < 0) && _(() => qe(t));
623
+ function F(t) {
624
+ D.value = t, !(t < 0) && j(() => Xe(t));
623
625
  }
624
- function ke(t) {
626
+ function he(t) {
625
627
  const a = X(D.value, t);
626
- a !== -1 && H(a);
628
+ a !== -1 && F(a);
627
629
  }
628
- function Qe(t) {
630
+ function qe(t) {
629
631
  if (!y.visible) return;
630
- const a = t.key, f = F.value;
632
+ const a = t.key, f = Y.value;
631
633
  if (!f.length) return;
632
634
  if (a === "Tab") {
633
- K();
635
+ E();
634
636
  return;
635
637
  }
636
638
  if ([
@@ -648,17 +650,17 @@ const $t = Ue({
648
650
  switch (t.preventDefault(), a) {
649
651
  case "ArrowDown":
650
652
  case "ArrowRight":
651
- ke(1);
653
+ he(1);
652
654
  break;
653
655
  case "ArrowUp":
654
656
  case "ArrowLeft":
655
- ke(-1);
657
+ he(-1);
656
658
  break;
657
659
  case "Home":
658
- H(X(-1, 1));
660
+ F(X(-1, 1));
659
661
  break;
660
662
  case "End":
661
- H(X(f.length, -1));
663
+ F(X(f.length, -1));
662
664
  break;
663
665
  case "Enter":
664
666
  case " ":
@@ -666,191 +668,194 @@ const $t = Ue({
666
668
  const v = D.value;
667
669
  if (v > -1) {
668
670
  const u = f[v];
669
- u.disabled || we(u);
671
+ u.disabled || Te(u);
670
672
  }
671
673
  break;
672
674
  }
673
675
  case "Escape":
674
- K();
676
+ E();
675
677
  break;
676
678
  }
677
679
  }
678
- async function we(t) {
679
- t.disabled || (K(), await t.action());
680
+ async function Te(t) {
681
+ t.disabled || (E(), await t.action());
680
682
  }
681
- function ie(t) {
683
+ function oe(t) {
682
684
  return typeof t.title == "string" && t.title.trim() ? t.title : Array.isArray(t.title) && t.title.length && String(t.title[0]).trim() ? String(t.title[0]) : "Untitled";
683
685
  }
684
- function Ze(t) {
685
- return g.value[t.id] || ie(t);
686
+ function Qe(t) {
687
+ return g.value[t.id] || oe(t);
686
688
  }
687
- function Ce(t) {
688
- const a = r.getRouteKey(t), m = r.tabs.find((v) => v.id === a)?.renderKey ?? 0;
689
+ function ke(t) {
690
+ const a = i.getRouteKey(t), m = i.tabs.find((v) => v.id === a)?.renderKey ?? 0;
689
691
  return `${a}::${m}`;
690
692
  }
691
- function et(t) {
692
- return `${Ce(t)}::refresh`;
693
+ function Ze(t) {
694
+ return `${ke(t)}::refresh`;
693
695
  }
694
- function le(t) {
695
- return !(t.closable === !1 || r.options.keepLastTab && r.tabs.length <= 1);
696
+ function ae(t) {
697
+ return !(t.closable === !1 || i.options.keepLastTab && i.tabs.length <= 1);
696
698
  }
697
- async function tt(t) {
698
- await r.closeTab(t.id);
699
+ async function et(t) {
700
+ await i.closeTab(t.id);
699
701
  }
700
- function nt(t) {
702
+ function tt(t) {
701
703
  if (t.href && typeof window < "u") {
702
704
  t.target && t.target !== "_self" ? window.open(t.href, t.target) : window.location.assign(t.href);
703
705
  return;
704
706
  }
705
- r.activeId.value !== t.id && r.openTab(t.to, !1);
707
+ i.activeId.value !== t.id && i.openTab(t.to, !1);
706
708
  }
707
- function ot(t) {
709
+ function nt(t) {
708
710
  return [
709
711
  "router-tab__item",
710
712
  {
711
- "is-active": r.activeId.value === t.id,
712
- "is-closable": le(t),
713
- "is-dragging": i.dragging && i.dragTab?.id === t.id,
714
- "is-drag-over": i.dropIndex === d(t.id)
713
+ "is-active": i.activeId.value === t.id,
714
+ "is-closable": ae(t),
715
+ "is-dragging": r.dragging && r.dragTab?.id === t.id,
716
+ "is-drag-over": r.dropIndex === d(t.id)
715
717
  },
716
718
  t.tabClass
717
719
  ];
718
720
  }
719
- function at(t) {
720
- return r.refreshingKey.value === r.getRouteKey(t);
721
+ function ot(t) {
722
+ return i.refreshingKey.value === i.getRouteKey(t);
721
723
  }
722
- function rt(t, a, f) {
723
- e.sortable && (i.dragging = !0, i.dragIndex = a, i.dragTab = t, f.dataTransfer && (f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", t.id)), n("tab-sort", { tab: t, index: a }));
724
+ function at(t, a, f) {
725
+ e.sortable && (r.dragging = !0, r.dragIndex = a, r.dragTab = t, f.dataTransfer && (f.dataTransfer.effectAllowed = "move", f.dataTransfer.setData("text/plain", t.id)), n("tab-sort", { tab: t, index: a }));
724
726
  }
725
727
  function it(t, a) {
726
- !e.sortable || !i.dragging || (a.preventDefault(), a.dataTransfer && (a.dataTransfer.dropEffect = "move"));
728
+ !e.sortable || !r.dragging || (a.preventDefault(), a.dataTransfer && (a.dataTransfer.dropEffect = "move"));
727
729
  }
728
- function lt(t) {
729
- !e.sortable || !i.dragging || (i.dropIndex = t);
730
+ function rt(t) {
731
+ !e.sortable || !r.dragging || (r.dropIndex = t);
730
732
  }
731
- function st() {
732
- !e.sortable || i.dragging;
733
+ function lt() {
734
+ !e.sortable || r.dragging;
733
735
  }
734
- function ut(t, a) {
735
- if (!(!e.sortable || !i.dragging)) {
736
- if (a.preventDefault(), i.dragIndex !== -1 && i.dragIndex !== t) {
737
- const f = r.tabs.splice(i.dragIndex, 1)[0];
738
- r.tabs.splice(t, 0, f), n("tab-sorted", {
736
+ function st(t, a) {
737
+ if (!(!e.sortable || !r.dragging)) {
738
+ if (a.preventDefault(), r.dragIndex !== -1 && r.dragIndex !== t) {
739
+ const f = i.tabs.splice(r.dragIndex, 1)[0];
740
+ i.tabs.splice(t, 0, f), n("tab-sorted", {
739
741
  tab: f,
740
- fromIndex: i.dragIndex,
742
+ fromIndex: r.dragIndex,
741
743
  toIndex: t
742
744
  });
743
745
  }
744
- Re();
746
+ we();
745
747
  }
746
748
  }
747
- function Re() {
748
- i.dragging = !1, i.dragIndex = -1, i.dropIndex = -1, i.dragTab = null;
749
+ function we() {
750
+ r.dragging = !1, r.dragIndex = -1, r.dropIndex = -1, r.dragTab = null;
749
751
  }
750
- me(() => {
751
- document.addEventListener("keydown", K);
752
- }), gt(() => {
753
- document.removeEventListener("keydown", K), o.appContext.config.globalProperties.$tabs = null, B.forEach((t) => {
752
+ pe(() => {
753
+ document.addEventListener("keydown", E);
754
+ }), pt(() => {
755
+ document.removeEventListener("keydown", E), o.appContext.config.globalProperties.$tabs = null, B.forEach((t) => {
754
756
  t.forEach((a) => a());
755
- }), B.clear(), S.clear();
757
+ }), B.clear(), x.clear();
756
758
  }), A(
757
759
  () => e.keepAlive,
758
760
  (t) => {
759
- r.options.keepAlive = t;
761
+ i.options.keepAlive = t;
760
762
  }
761
763
  ), A(
762
- () => r.activeId.value,
763
- () => K()
764
+ () => i.activeId.value,
765
+ () => E()
764
766
  ), A(
765
767
  () => e.contextmenu,
766
768
  (t) => {
767
- t || K();
769
+ t || E();
768
770
  }
769
771
  ), A(
770
- () => F.value.length,
772
+ () => Y.value.length,
771
773
  (t) => {
772
- y.visible && t === 0 && K();
773
- }
774
- ), A(F, (t) => {
775
- if (M.value = new Array(t.length).fill(null), !y.visible) return;
774
+ y.visible && t === 0 && E();
775
+ },
776
+ { flush: "post" }
777
+ // Run after component updates to prevent blocking render
778
+ ), A(Y, (t) => {
779
+ if (!y.visible) return;
780
+ M.value = new Array(t.length).fill(null);
776
781
  const a = X(-1, 1, t);
777
- H(a);
778
- }), A(
782
+ F(a);
783
+ }, { flush: "post" }), A(
779
784
  () => y.visible,
780
785
  (t) => {
781
786
  t || (D.value = -1, M.value = []);
782
787
  }
783
788
  );
784
- const ct = r.includeKeys;
789
+ const ut = i.includeKeys;
785
790
  return {
786
- controller: r,
787
- tabs: r.tabs,
788
- includeKeys: ct,
789
- tabTransitionProps: ae,
790
- pageTransitionProps: re,
791
- buildTabClass: ot,
792
- activate: nt,
793
- close: tt,
791
+ controller: i,
792
+ tabs: i.tabs,
793
+ includeKeys: ut,
794
+ tabTransitionProps: te,
795
+ pageTransitionProps: ne,
796
+ buildTabClass: nt,
797
+ activate: tt,
798
+ close: et,
794
799
  context: y,
795
- menuItems: F,
796
- handleMenuAction: we,
797
- showContextMenu: Je,
798
- hideContextMenu: K,
799
- getTabTitle: ie,
800
- isClosable: le,
801
- isRefreshing: at,
800
+ menuItems: Y,
801
+ handleMenuAction: Te,
802
+ showContextMenu: He,
803
+ hideContextMenu: E,
804
+ getTabTitle: oe,
805
+ isClosable: ae,
806
+ isRefreshing: ot,
802
807
  hasCustomSlot: p,
803
808
  hasStartSlot: T,
804
809
  hasEndSlot: s,
805
- onDragStart: rt,
810
+ onDragStart: at,
806
811
  onDragOver: it,
807
- onDragEnter: lt,
808
- onDragLeave: st,
809
- onDrop: ut,
810
- onDragEnd: Re,
812
+ onDragEnter: rt,
813
+ onDragLeave: lt,
814
+ onDrop: st,
815
+ onDragEnd: we,
811
816
  setupComponentWatching: z,
812
- cleanupComponentWatching: Y,
813
- handleComponentRef: L,
814
- getReactiveTabTitle: Ze,
815
- getComponentCacheKey: Ce,
816
- getRefreshComponentKey: et,
817
+ cleanupComponentWatching: _,
818
+ handleComponentRef: O,
819
+ getReactiveTabTitle: Qe,
820
+ getComponentCacheKey: ke,
821
+ getRefreshComponentKey: Ze,
817
822
  triggerTabUpdate: R,
818
823
  menuRef: G,
819
824
  highlightedIndex: D,
820
- setMenuItemRef: Xe,
821
- onMenuKeydown: Qe,
822
- highlightMenuIndex: H
825
+ setMenuItemRef: Ge,
826
+ onMenuKeydown: qe,
827
+ highlightMenuIndex: F
823
828
  };
824
829
  }
825
- }), Bt = (e, n) => {
830
+ }), Lt = (e, n) => {
826
831
  const o = e.__vccOpts || e;
827
- for (const [l, r] of n)
828
- o[l] = r;
832
+ for (const [l, i] of n)
833
+ o[l] = i;
829
834
  return o;
830
- }, Mt = { class: "router-tab" }, Lt = { class: "router-tab__header" }, jt = { class: "router-tab__scroll" }, Ot = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], Ut = ["title"], Vt = ["onClick"], Nt = { class: "router-tab__container" }, _t = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
831
- function zt(e, n, o, l, r, p) {
832
- const T = mt("RouterView");
833
- return P(), I("div", Mt, [
834
- O("header", Lt, [
835
- O("div", {
836
- class: J(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
835
+ }, jt = { class: "router-tab" }, Ot = { class: "router-tab__header" }, Ut = { class: "router-tab__scroll" }, Vt = ["data-title", "draggable", "onClick", "onAuxclick", "onContextmenu", "onDragstart", "onDragover", "onDragenter", "onDrop"], Nt = ["title"], zt = ["onClick"], _t = { class: "router-tab__container" }, Yt = ["aria-disabled", "disabled", "tabindex", "onMouseenter", "onClick"];
836
+ function Ft(e, n, o, l, i, p) {
837
+ const T = gt("RouterView");
838
+ return P(), S("div", jt, [
839
+ L("header", Ot, [
840
+ L("div", {
841
+ class: H(["router-tab__slot-start", { "has-content": e.hasStartSlot }])
837
842
  }, [
838
- ue(e.$slots, "start")
843
+ re(e.$slots, "start")
839
844
  ], 2),
840
- O("div", jt, [
841
- q(vt, Q({
845
+ L("div", Ut, [
846
+ Pe(vt, le({
842
847
  tag: "ul",
843
848
  class: "router-tab__nav"
844
849
  }, e.tabTransitionProps), {
845
- default: Z(() => [
846
- (P(!0), I(ce, null, Ee(e.tabs, (s, c) => (P(), I("li", {
850
+ default: se(() => [
851
+ (P(!0), S(Ae, null, Ke(e.tabs, (s, c) => (P(), S("li", {
847
852
  key: s.id,
848
- class: J(e.buildTabClass(s)),
853
+ class: H(e.buildTabClass(s)),
849
854
  "data-title": e.getTabTitle(s),
850
855
  draggable: e.sortable,
851
856
  onClick: (g) => e.activate(s),
852
- onAuxclick: fe((g) => e.close(s), ["middle", "prevent"]),
853
- onContextmenu: fe((g) => e.showContextMenu(s, g), ["prevent"]),
857
+ onAuxclick: ue((g) => e.close(s), ["middle", "prevent"]),
858
+ onContextmenu: ue((g) => e.showContextMenu(s, g), ["prevent"]),
854
859
  onDragstart: (g) => e.onDragStart(s, c, g),
855
860
  onDragover: (g) => e.onDragOver(c, g),
856
861
  onDragenter: (g) => e.onDragEnter(c),
@@ -858,82 +863,77 @@ function zt(e, n, o, l, r, p) {
858
863
  onDrop: (g) => e.onDrop(c, g),
859
864
  onDragend: n[1] || (n[1] = (...g) => e.onDragEnd && e.onDragEnd(...g))
860
865
  }, [
861
- s.icon ? (P(), I("i", {
866
+ s.icon ? (P(), S("i", {
862
867
  key: 0,
863
- class: J(["router-tab__item-icon", s.icon])
864
- }, null, 2)) : U("", !0),
865
- O("span", {
868
+ class: H(["router-tab__item-icon", s.icon])
869
+ }, null, 2)) : Ee("", !0),
870
+ L("span", {
866
871
  class: "router-tab__item-title",
867
872
  title: e.getReactiveTabTitle(s)
868
- }, Ke(e.getReactiveTabTitle(s)), 9, Ut),
869
- e.isClosable(s) ? (P(), I("a", {
873
+ }, Ie(e.getReactiveTabTitle(s)), 9, Nt),
874
+ e.isClosable(s) ? (P(), S("a", {
870
875
  key: 1,
871
876
  class: "router-tab__item-close",
872
- onClick: fe((g) => e.close(s), ["stop"])
873
- }, null, 8, Vt)) : U("", !0)
874
- ], 42, Ot))), 128))
877
+ onClick: ue((g) => e.close(s), ["stop"])
878
+ }, null, 8, zt)) : Ee("", !0)
879
+ ], 42, Vt))), 128))
875
880
  ]),
876
881
  _: 1
877
882
  }, 16)
878
883
  ]),
879
- O("div", {
880
- class: J(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
884
+ L("div", {
885
+ class: H(["router-tab__slot-end", { "has-content": e.hasEndSlot }])
881
886
  }, [
882
- ue(e.$slots, "end")
887
+ re(e.$slots, "end")
883
888
  ], 2)
884
889
  ]),
885
- O("div", Nt, [
886
- q(T, null, {
887
- default: Z((s) => [
888
- e.hasCustomSlot ? ue(e.$slots, "default", yt(Q({ key: 0 }, {
890
+ L("div", _t, [
891
+ Pe(T, null, {
892
+ default: se((s) => [
893
+ e.hasCustomSlot ? re(e.$slots, "default", yt(le({ key: 0 }, {
889
894
  ...s,
890
895
  controller: e.controller,
891
896
  // Expose a ref binder so custom slots can keep reactivity
892
897
  pageRef: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route))
893
- }))) : (P(), I(ce, { key: 1 }, [
894
- q(Ie, Q(e.pageTransitionProps, { appear: "" }), {
895
- default: Z(() => [
896
- e.controller.options.keepAlive ? (P(), de(ht, {
897
- key: 0,
898
- include: e.includeKeys,
899
- max: e.controller.options.maxAlive || void 0
900
- }, [
901
- e.isRefreshing(s.route) ? U("", !0) : (P(), de(xe(s.Component), {
902
- key: e.getComponentCacheKey(s.route),
903
- ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
904
- class: "router-tab-page"
905
- }))
906
- ], 1032, ["include", "max"])) : U("", !0)
907
- ]),
908
- _: 2
909
- }, 1040),
910
- q(Ie, Q(e.pageTransitionProps, { appear: "" }), {
911
- default: Z(() => [
912
- !e.controller.options.keepAlive || e.isRefreshing(s.route) ? (P(), de(xe(s.Component), {
913
- key: e.getRefreshComponentKey(s.route),
898
+ }))) : (P(), J(ht, le({ key: 1 }, e.pageTransitionProps, { appear: "" }), {
899
+ default: se(() => [
900
+ e.isRefreshing(s.route) ? (P(), J(ce(s.Component), {
901
+ key: e.getRefreshComponentKey(s.route),
902
+ ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
903
+ class: "router-tab-page"
904
+ })) : e.controller.options.keepAlive ? (P(), J(Tt, {
905
+ key: 1,
906
+ include: e.includeKeys,
907
+ max: e.controller.options.maxAlive || void 0
908
+ }, [
909
+ (P(), J(ce(s.Component), {
910
+ key: e.getComponentCacheKey(s.route),
914
911
  ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
915
912
  class: "router-tab-page"
916
- })) : U("", !0)
917
- ]),
918
- _: 2
919
- }, 1040)
920
- ], 64))
913
+ }))
914
+ ], 1032, ["include", "max"])) : (P(), J(ce(s.Component), {
915
+ key: e.getComponentCacheKey(s.route),
916
+ ref: (c) => e.handleComponentRef(c, e.controller.getRouteKey(s.route)),
917
+ class: "router-tab-page"
918
+ }))
919
+ ]),
920
+ _: 2
921
+ }, 1040))
921
922
  ]),
922
923
  _: 3
923
924
  })
924
925
  ]),
925
- e.context.visible && e.context.target ? (P(), I("div", {
926
- key: 0,
926
+ mt(L("div", {
927
927
  ref: "menuRef",
928
928
  class: "router-tab__contextmenu",
929
929
  role: "menu",
930
930
  onKeydown: n[2] || (n[2] = (...s) => e.onMenuKeydown && e.onMenuKeydown(...s)),
931
- style: Tt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
931
+ style: kt({ left: e.context.position.x + "px", top: e.context.position.y + "px" })
932
932
  }, [
933
- (P(!0), I(ce, null, Ee(e.menuItems, (s, c) => (P(), I("a", {
933
+ (P(!0), S(Ae, null, Ke(e.menuItems, (s, c) => (P(), S("a", {
934
934
  key: s.id,
935
935
  role: "menuitem",
936
- class: J(["router-tab__contextmenu-item", { "is-focused": c === e.highlightedIndex }]),
936
+ class: H(["router-tab__contextmenu-item", { "is-focused": c === e.highlightedIndex }]),
937
937
  "aria-disabled": s.disabled,
938
938
  disabled: s.disabled,
939
939
  tabindex: s.disabled ? -1 : c === e.highlightedIndex ? 0 : -1,
@@ -941,14 +941,16 @@ function zt(e, n, o, l, r, p) {
941
941
  ref: (g) => e.setMenuItemRef(g, c),
942
942
  onMouseenter: (g) => !s.disabled && e.highlightMenuIndex(c),
943
943
  onClick: (g) => e.handleMenuAction(s)
944
- }, Ke(s.label), 43, _t))), 128))
945
- ], 36)) : U("", !0)
944
+ }, Ie(s.label), 43, Yt))), 128))
945
+ ], 36), [
946
+ [wt, e.context.visible && e.context.target]
947
+ ])
946
948
  ]);
947
949
  }
948
- const Le = /* @__PURE__ */ Bt($t, [["render", zt]]), Yt = {
950
+ const Me = /* @__PURE__ */ Lt(Mt, [["render", Ft]]), Ht = {
949
951
  class: "router-tabs",
950
952
  "aria-hidden": "true"
951
- }, pe = /* @__PURE__ */ Ue({
953
+ }, de = /* @__PURE__ */ Oe({
952
954
  name: "RouterTabs",
953
955
  __name: "RouterTabs",
954
956
  props: {
@@ -963,9 +965,9 @@ const Le = /* @__PURE__ */ Bt($t, [["render", zt]]), Yt = {
963
965
  fallbackRoute: {}
964
966
  },
965
967
  setup(e) {
966
- return Ne(e), (o, l) => (P(), I("span", Yt));
968
+ return Ve(e), (o, l) => (P(), S("span", Ht));
967
969
  }
968
- }), _e = "tab-theme-style", ze = "tab-theme-primary-color", Ft = "system", Ye = "(prefers-color-scheme: dark)";
970
+ }), Ne = "tab-theme-style", ze = "tab-theme-primary-color", Jt = "system", _e = "(prefers-color-scheme: dark)";
969
971
  let W = null;
970
972
  const C = {
971
973
  primary: "#034960",
@@ -981,7 +983,7 @@ const C = {
981
983
  activeButtonBackground: "#034960",
982
984
  activeButtonColor: "#ffffff",
983
985
  iconColor: "#475569"
984
- }, Ht = {
986
+ }, Wt = {
985
987
  primary: "#38bdf8",
986
988
  background: "#0f172a",
987
989
  text: "#f1f5f9",
@@ -997,7 +999,7 @@ const C = {
997
999
  activeButtonColor: "#0f172a",
998
1000
  iconColor: "#cbd5e1"
999
1001
  };
1000
- function Jt(e) {
1002
+ function Gt(e) {
1001
1003
  if (typeof window > "u") return null;
1002
1004
  const n = window.localStorage.getItem(e);
1003
1005
  if (!n) return null;
@@ -1008,50 +1010,50 @@ function Jt(e) {
1008
1010
  return null;
1009
1011
  }
1010
1012
  }
1011
- function he(e) {
1013
+ function ve(e) {
1012
1014
  typeof document > "u" || (document.documentElement.style.setProperty("--router-tab-primary", e.primary ?? C.primary), document.documentElement.style.setProperty("--router-tab-header-bg", e.headerBackground ?? C.headerBackground), document.documentElement.style.setProperty("--router-tab-background", e.background ?? C.background), document.documentElement.style.setProperty("--router-tab-active-background", e.activeBackground ?? C.activeBackground), document.documentElement.style.setProperty("--router-tab-text", e.text ?? C.text), document.documentElement.style.setProperty("--router-tab-active-text", e.activeText ?? C.activeText), document.documentElement.style.setProperty("--router-tab-border", e.border ?? C.border), document.documentElement.style.setProperty("--router-tab-active-border", e.activeBorder ?? C.activeBorder), document.documentElement.style.setProperty("--router-tab-button-color", e.buttonColor ?? C.buttonColor), document.documentElement.style.setProperty("--router-tab-active-button-color", e.activeButtonColor ?? C.activeButtonColor), document.documentElement.style.setProperty("--router-tab-button-background", e.buttonBackground ?? C.buttonBackground), document.documentElement.style.setProperty("--router-tab-active-button-background", e.activeButtonBackground ?? C.activeButtonBackground), document.documentElement.style.setProperty("--router-tab-icon-color", e.iconColor ?? C.iconColor));
1013
1015
  }
1014
- function Fe(e) {
1016
+ function Ye(e) {
1015
1017
  if (typeof document > "u") return;
1016
- const n = document.documentElement, o = window.matchMedia(Ye), l = () => {
1018
+ const n = document.documentElement, o = window.matchMedia(_e), l = () => {
1017
1019
  n.dataset.theme = o.matches ? "dark" : "light";
1018
1020
  };
1019
1021
  W && (o.removeEventListener("change", W), W = null), e === "system" ? (l(), W = () => l(), o.addEventListener("change", W)) : n.dataset.theme = e;
1020
1022
  }
1021
- function Wt(e = {}) {
1023
+ function Xt(e = {}) {
1022
1024
  if (typeof window > "u") return;
1023
1025
  const {
1024
- styleKey: n = _e,
1026
+ styleKey: n = Ne,
1025
1027
  primaryKey: o = ze,
1026
- defaultStyle: l = Ft,
1027
- defaultPrimary: r
1028
+ defaultStyle: l = Jt,
1029
+ defaultPrimary: i
1028
1030
  } = e, p = window.localStorage.getItem(n) ?? l;
1029
- Fe(p);
1030
- const s = p === "dark" || p === "system" && window.matchMedia(Ye).matches ? { ...Ht } : { ...C };
1031
- r && (s.primary = r);
1032
- const c = Jt(o);
1033
- he(c ? {
1031
+ Ye(p);
1032
+ const s = p === "dark" || p === "system" && window.matchMedia(_e).matches ? { ...Wt } : { ...C };
1033
+ i && (s.primary = i);
1034
+ const c = Gt(o);
1035
+ ve(c ? {
1034
1036
  ...s,
1035
1037
  ...c
1036
1038
  } : s);
1037
1039
  }
1038
- function qt(e, n) {
1040
+ function Zt(e, n) {
1039
1041
  if (typeof window > "u") return;
1040
- const o = n?.styleKey ?? _e;
1041
- window.localStorage.setItem(o, e), Fe(e);
1042
+ const o = n?.styleKey ?? Ne;
1043
+ window.localStorage.setItem(o, e), Ye(e);
1042
1044
  }
1043
- function Qt(e, n) {
1045
+ function en(e, n) {
1044
1046
  if (typeof window > "u") return;
1045
1047
  const o = n?.primaryKey ?? ze;
1046
- window.localStorage.setItem(o, JSON.stringify(e)), he(e);
1048
+ window.localStorage.setItem(o, JSON.stringify(e)), ve(e);
1047
1049
  }
1048
- function te(e, n) {
1049
- if (kt(e)) {
1050
- const l = !wt(e);
1050
+ function Q(e, n) {
1051
+ if (Ct(e)) {
1052
+ const l = !Rt(e);
1051
1053
  return {
1052
1054
  value: e,
1053
- update: l ? (r) => {
1054
- e.value = r;
1055
+ update: l ? (i) => {
1056
+ e.value = i;
1055
1057
  } : () => {
1056
1058
  }
1057
1059
  };
@@ -1072,80 +1074,80 @@ function te(e, n) {
1072
1074
  }
1073
1075
  };
1074
1076
  }
1075
- function Te(e = {}) {
1076
- const n = te(e.title, "Untitled"), o = te(e.icon, ""), l = te(e.closable, !0), r = te(e.meta, {});
1077
+ function ye(e = {}) {
1078
+ const n = Q(e.title, "Untitled"), o = Q(e.icon, ""), l = Q(e.closable, !0), i = Q(e.meta, {});
1077
1079
  return {
1078
1080
  routeTabTitle: n.value,
1079
1081
  routeTabIcon: o.value,
1080
1082
  routeTabClosable: l.value,
1081
- routeTabMeta: r.value,
1083
+ routeTabMeta: i.value,
1082
1084
  updateTitle: n.update,
1083
1085
  updateIcon: o.update,
1084
1086
  updateClosable: l.update,
1085
- updateMeta: r.update
1087
+ updateMeta: i.update
1086
1088
  };
1087
1089
  }
1088
- function Zt(e, n = "Page") {
1089
- return Te({
1090
+ function tn(e, n = "Page") {
1091
+ return ye({
1090
1092
  title: k(() => e.value ? "Loading..." : n),
1091
1093
  icon: k(() => e.value ? "mdi-loading mdi-spin" : "mdi-page"),
1092
1094
  closable: k(() => !e.value)
1093
1095
  });
1094
1096
  }
1095
- function en(e, n = "Page", o = "mdi-page") {
1096
- return Te({
1097
+ function nn(e, n = "Page", o = "mdi-page") {
1098
+ return ye({
1097
1099
  title: k(() => e.value > 0 ? `${n} (${e.value})` : n),
1098
1100
  icon: k(() => e.value > 0 ? "mdi-bell-badge" : o)
1099
1101
  });
1100
1102
  }
1101
- function tn(e, n = "Page") {
1103
+ function on(e, n = "Page") {
1102
1104
  const o = {
1103
1105
  normal: { suffix: "", icon: "mdi-page" },
1104
1106
  loading: { suffix: " - Loading", icon: "mdi-loading mdi-spin" },
1105
1107
  error: { suffix: " - Error", icon: "mdi-alert" },
1106
1108
  success: { suffix: " - Success", icon: "mdi-check-circle" }
1107
1109
  };
1108
- return Te({
1110
+ return ye({
1109
1111
  title: k(() => n + o[e.value].suffix),
1110
1112
  icon: k(() => o[e.value].icon),
1111
1113
  closable: k(() => e.value !== "loading")
1112
1114
  });
1113
1115
  }
1114
- let je = !1;
1115
- const nn = {
1116
+ let Le = !1;
1117
+ const an = {
1116
1118
  install(e, n) {
1117
- if (je) return;
1118
- je = !0;
1119
+ if (Le) return;
1120
+ Le = !0;
1119
1121
  const {
1120
1122
  initTheme: o = !0,
1121
1123
  themeOptions: l,
1122
- componentName: r = Le.name || "RouterTab",
1123
- tabsComponentName: p = pe.name || "RouterTabs"
1124
+ componentName: i = Me.name || "RouterTab",
1125
+ tabsComponentName: p = de.name || "RouterTabs"
1124
1126
  } = n ?? {};
1125
- o && Wt(l ?? {}), e.component(r, Le), e.component(p, pe), p.toLowerCase() !== "router-tabs" && e.component("router-tabs", pe), Object.defineProperty(e.config.globalProperties, "$tabs", {
1127
+ o && Xt(l ?? {}), e.component(i, Me), e.component(p, de), p.toLowerCase() !== "router-tabs" && e.component("router-tabs", de), Object.defineProperty(e.config.globalProperties, "$tabs", {
1126
1128
  configurable: !0,
1127
1129
  enumerable: !1,
1128
1130
  get() {
1129
- return e._context.provides[oe];
1131
+ return e._context.provides[ee];
1130
1132
  },
1131
1133
  set(T) {
1132
- T && e.provide(oe, T);
1134
+ T && e.provide(ee, T);
1133
1135
  }
1134
1136
  });
1135
1137
  }
1136
1138
  };
1137
1139
  export {
1138
- Le as RouterTab,
1139
- pe as RouterTabs,
1140
- nn as default,
1141
- Wt as initRouterTabsTheme,
1142
- oe as routerTabsKey,
1143
- Qt as setRouterTabsPrimary,
1144
- qt as setRouterTabsTheme,
1145
- Zt as useLoadingTab,
1146
- en as useNotificationTab,
1147
- Te as useReactiveTab,
1148
- $e as useRouterTabs,
1149
- Ne as useRouterTabsPersistence,
1150
- tn as useStatusTab
1140
+ Me as RouterTab,
1141
+ de as RouterTabs,
1142
+ an as default,
1143
+ Xt as initRouterTabsTheme,
1144
+ ee as routerTabsKey,
1145
+ en as setRouterTabsPrimary,
1146
+ Zt as setRouterTabsTheme,
1147
+ tn as useLoadingTab,
1148
+ nn as useNotificationTab,
1149
+ ye as useReactiveTab,
1150
+ Se as useRouterTabs,
1151
+ Ve as useRouterTabsPersistence,
1152
+ on as useStatusTab
1151
1153
  };