vue3-router-tab 1.2.7 → 1.2.8

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