@gospore/theme 1.0.146 → 1.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/theme.es.js CHANGED
@@ -1,71 +1,76 @@
1
- import { computed as e, createBlock as t, createElementBlock as n, createElementVNode as r, createVNode as i, inject as a, normalizeStyle as o, onBeforeUnmount as s, openBlock as c, provide as l, ref as u, renderSlot as d, unref as f, watch as p, withCtx as m } from "vue";
1
+ import { computed as e, createBlock as t, createElementBlock as n, createElementVNode as r, createVNode as i, defineComponent as a, inject as o, normalizeStyle as s, onBeforeUnmount as c, openBlock as l, provide as u, ref as d, renderSlot as f, unref as p, watch as m, withCtx as h } from "vue";
2
2
  import "what-input";
3
- import { DropdownItemGroup as h, DropdownItemRadio as g, DropdownMenu as _ } from "@gospore/dropdown-menu";
4
- //#region src/modeStorage.js
5
- var v = [
3
+ import { DropdownItemGroup as g, DropdownItemRadio as _, DropdownMenu as v } from "@gospore/dropdown-menu";
4
+ //#region src/modeStorage.ts
5
+ var y = [
6
6
  "auto",
7
7
  "light",
8
8
  "dark"
9
- ], y = "gospore-theme-mode", b = 3600 * 24 * 365, x = "(prefers-color-scheme: dark)";
10
- function S() {
9
+ ], b = "gospore-theme-mode", x = 3600 * 24 * 365, S = "(prefers-color-scheme: dark)";
10
+ function C() {
11
11
  if (typeof document > "u") return null;
12
- let e = T(y);
13
- return e && v.includes(e) ? e : null;
12
+ let e = E(b);
13
+ return k(e) ? e : null;
14
14
  }
15
- function C(e) {
16
- if (typeof document > "u" || !v.includes(e)) return;
17
- let t = typeof window < "u" ? window.location.hostname : "", n = typeof window < "u" ? window.location.protocol : "", r = E(t), i = n === "https:", a = [
15
+ function w(e) {
16
+ if (typeof document > "u" || !y.includes(e)) return;
17
+ let t = typeof window < "u" ? window.location.hostname : "", n = typeof window < "u" ? window.location.protocol : "", r = D(t), i = n === "https:", a = [
18
18
  "path=/",
19
- `max-age=${b}`,
19
+ `max-age=${x}`,
20
20
  "SameSite=Lax"
21
21
  ];
22
- r && a.push(`domain=${r}`), i && a.push("Secure"), document.cookie = [`${encodeURIComponent(y)}=${encodeURIComponent(e)}`, ...a].join("; ");
22
+ r && a.push(`domain=${r}`), i && a.push("Secure"), document.cookie = [`${encodeURIComponent(b)}=${encodeURIComponent(e)}`, ...a].join("; ");
23
23
  }
24
- function w(e) {
24
+ function T(e) {
25
25
  if (typeof document > "u") return;
26
- let t = typeof e == "string" && v.includes(e) ? e : S() ?? "auto";
26
+ let t = k(e) ? e : C() ?? "auto";
27
27
  console.log("Applying theme mode:", t);
28
- let n = D(t);
29
- document.documentElement.setAttribute("dark-mode", n);
28
+ let n = O(t);
29
+ document.documentElement.setAttribute("dark-mode", String(n));
30
30
  }
31
- function T(e) {
31
+ function E(e) {
32
32
  if (typeof document > "u" || !document.cookie) return null;
33
33
  let t = `${encodeURIComponent(e)}=`, n = document.cookie.split("; ");
34
34
  for (let e of n) if (e.startsWith(t)) return decodeURIComponent(e.slice(t.length));
35
35
  return null;
36
36
  }
37
- function E(e) {
37
+ function D(e) {
38
38
  if (!e || e === "localhost") return null;
39
39
  if (/^\d+(?:\.\d+){3}$/.test(e)) return e;
40
40
  let t = e.split(".");
41
41
  return t.length <= 1 ? null : t.length === 2 ? e : t.slice(-2).join(".");
42
42
  }
43
- function D(e) {
43
+ function O(e) {
44
44
  if (e === "dark") return !0;
45
45
  if (e === "light" || typeof window > "u") return !1;
46
46
  try {
47
- let e = typeof window.matchMedia == "function" ? window.matchMedia(x) : null;
47
+ let e = typeof window.matchMedia == "function" ? window.matchMedia(S) : null;
48
48
  return e ? e.matches : !1;
49
49
  } catch {
50
50
  return !1;
51
51
  }
52
52
  }
53
+ function k(e) {
54
+ return typeof e == "string" && y.includes(e);
55
+ }
53
56
  //#endregion
54
- //#region src/portalHost.js
55
- var O = Symbol.for("gospore.theme.portalHost");
56
- function k() {
57
- let t = a(O, null);
57
+ //#region src/portalHost.ts
58
+ var A = Symbol.for("gospore.theme.portalHost");
59
+ function j() {
60
+ let t = o(A, null);
58
61
  console.log("Using theme portal host:", t);
59
62
  let n = typeof document < "u" ? document.body : "body";
60
63
  return e(() => t?.value ?? n);
61
64
  }
62
65
  //#endregion
63
- //#region src/Theme.vue
64
- var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)", ne = 200, A = 3.8, j = 1.8, M = 1.15, N = 1.08, P = 2.5, F = 3, I = "#ffffff", L = "#1f2228", R = /* @__PURE__ */ Object.assign({ name: "Theme" }, {
66
+ //#region src/Theme.vue?vue&type=script&setup=true&lang.ts
67
+ var M = [], N = /* @__PURE__ */ new Set(), ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)", ne = 200, P = 3.8, F = 1.8, I = 1.15, L = 1.08, R = 2.5, z = 3, B = "#ffffff", V = "#1f2228", H = /* @__PURE__ */ a({
68
+ name: "Theme",
65
69
  __name: "Theme",
66
70
  props: {
67
71
  mode: {
68
72
  type: String,
73
+ default: void 0,
69
74
  validator: (e) => [
70
75
  "auto",
71
76
  "light",
@@ -83,51 +88,51 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
83
88
  }
84
89
  },
85
90
  setup(t) {
86
- let i = t, a = [], f = /* @__PURE__ */ new Set();
87
- function m() {
91
+ let i = t;
92
+ function a() {
88
93
  let e = document.documentElement;
89
94
  if (!e) return;
90
- f.forEach((t) => {
95
+ N.forEach((t) => {
91
96
  e.style.removeProperty(t);
92
- }), f.clear();
93
- let t = [...a].reverse().find((e) => e.enabled && e.vars && Object.keys(e.vars).length > 0);
97
+ }), N.clear();
98
+ let t = [...M].reverse().find((e) => e.enabled && e.vars && Object.keys(e.vars).length > 0);
94
99
  t && Object.entries(t.vars).forEach(([t, n]) => {
95
- e.style.setProperty(t, n), f.add(t);
100
+ e.style.setProperty(t, n), N.add(t);
96
101
  });
97
102
  }
98
- let h = window.matchMedia(ee), g = window.matchMedia(te), _ = k();
99
- w(_);
100
- let v = u(_), y = u({ darkMode: C(_) }), b = u(null);
101
- h.addEventListener("change", T), p(() => i.mode, () => {
102
- x();
103
- }, { immediate: !0 }), p(() => y.value.darkMode, (e, t) => {
103
+ let o = window.matchMedia(ee), p = window.matchMedia(te), h = E();
104
+ T(h);
105
+ let g = d(h), _ = d({ darkMode: b(h) }), v = d(null);
106
+ o.addEventListener("change", x), m(() => i.mode, () => {
107
+ y();
108
+ }, { immediate: !0 }), m(() => _.value.darkMode, (e, t) => {
104
109
  if (t === void 0) {
105
- E(e);
110
+ S(e);
106
111
  return;
107
112
  }
108
- D(() => {
109
- E(e);
113
+ w(() => {
114
+ S(e);
110
115
  });
111
- }, { immediate: !0 }), s(() => {
112
- h.removeEventListener("change", T);
113
- let e = a.indexOf($);
114
- e !== -1 && a.splice(e, 1), m();
116
+ }, { immediate: !0 }), c(() => {
117
+ o.removeEventListener("change", x);
118
+ let e = M.indexOf($);
119
+ e !== -1 && M.splice(e, 1), a();
115
120
  });
116
- function x() {
117
- let e = k();
118
- v.value = e, y.value.darkMode = C(e);
121
+ function y() {
122
+ let e = E();
123
+ g.value = e, _.value.darkMode = b(e);
119
124
  }
120
- function C(e) {
121
- return e === "dark" ? !0 : e === "light" ? !1 : h.matches;
125
+ function b(e) {
126
+ return e === "dark" ? !0 : e === "light" ? !1 : o.matches;
122
127
  }
123
- function T(e) {
124
- !e || v.value !== "auto" || (y.value.darkMode = e.matches);
128
+ function x(e) {
129
+ !e || g.value !== "auto" || (_.value.darkMode = e.matches);
125
130
  }
126
- function E(e) {
127
- document.documentElement.setAttribute("dark-mode", e);
131
+ function S(e) {
132
+ document.documentElement.setAttribute("dark-mode", String(e));
128
133
  }
129
- function D(e) {
130
- if (g.matches) {
134
+ function w(e) {
135
+ if (p.matches) {
131
136
  e();
132
137
  return;
133
138
  }
@@ -147,11 +152,11 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
147
152
  });
148
153
  });
149
154
  }
150
- function k() {
151
- return i.mode ?? S() ?? "auto";
155
+ function E() {
156
+ return i.mode ?? C() ?? "auto";
152
157
  }
153
- l("theme", y), l(O, b);
154
- function R(e) {
158
+ u("theme", _), u(A, v);
159
+ function D(e) {
155
160
  if (!e) return null;
156
161
  let t = e.trim().toLowerCase();
157
162
  if (!/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t)) return null;
@@ -161,26 +166,26 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
161
166
  }
162
167
  return t;
163
168
  }
164
- function z(e) {
165
- let t = R(e);
169
+ function O(e) {
170
+ let t = D(e);
166
171
  return t ? {
167
172
  r: parseInt(t.slice(1, 3), 16),
168
173
  g: parseInt(t.slice(3, 5), 16),
169
174
  b: parseInt(t.slice(5, 7), 16)
170
175
  } : null;
171
176
  }
172
- function B({ r: e, g: t, b: n }) {
177
+ function k({ r: e, g: t, b: n }) {
173
178
  let r = (e) => e.toString(16).padStart(2, "0");
174
179
  return `#${r(e)}${r(t)}${r(n)}`;
175
180
  }
176
- function V(e) {
181
+ function j(e) {
177
182
  return Math.max(0, Math.min(1, e));
178
183
  }
179
184
  function H(e) {
180
185
  return e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
181
186
  }
182
187
  function U(e) {
183
- let t = V(e);
188
+ let t = j(e);
184
189
  return t <= .0031308 ? 12.92 * t : 1.055 * t ** (1 / 2.4) - .055;
185
190
  }
186
191
  function W({ r: e, g: t, b: n }) {
@@ -192,12 +197,12 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
192
197
  };
193
198
  }
194
199
  function G(e, t, n, r = !1) {
195
- let i = n * Math.PI / 180, a = t * Math.cos(i), o = t * Math.sin(i), s = e + .3963377774 * a + .2158037573 * o, c = e - .1055613458 * a - .0638541728 * o, l = e - .0894841775 * a - 1.291485548 * o, u = r ? V(s) : s, d = r ? V(c) : c, f = r ? V(l) : l;
200
+ let i = n * Math.PI / 180, a = t * Math.cos(i), o = t * Math.sin(i), s = e + .3963377774 * a + .2158037573 * o, c = e - .1055613458 * a - .0638541728 * o, l = e - .0894841775 * a - 1.291485548 * o, u = r ? j(s) : s, d = r ? j(c) : c, f = r ? j(l) : l;
196
201
  if (!r && (u < -1e-4 || u > 1.0001 || d < -1e-4 || d > 1.0001 || f < -1e-4 || f > 1.0001)) return null;
197
202
  let p = u * u * u, m = d * d * d, h = f * f * f, g = 4.0767416621 * p - 3.3077115913 * m + .2309699292 * h, _ = -1.2684380046 * p + 2.6097574011 * m - .3413193965 * h, v = -.0041960863 * p - .7034186147 * m + 1.707614701 * h;
198
- if (r) g = V(g), _ = V(_), v = V(v);
203
+ if (r) g = j(g), _ = j(_), v = j(v);
199
204
  else if (g < -1e-4 || g > 1.0001 || _ < -1e-4 || _ > 1.0001 || v < -1e-4 || v > 1.0001) return null;
200
- let y = V(U(g)), b = V(U(_)), x = V(U(v));
205
+ let y = j(U(g)), b = j(U(_)), x = j(U(v));
201
206
  return {
202
207
  r: Math.round(y * 255),
203
208
  g: Math.round(b * 255),
@@ -211,14 +216,14 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
211
216
  if (t) return t;
212
217
  r *= .9;
213
218
  }
214
- return G(e, V(r), n, !0) || {
219
+ return G(e, j(r), n, !0) || {
215
220
  r: 0,
216
221
  g: 0,
217
222
  b: 0
218
223
  };
219
224
  }
220
225
  function q(e) {
221
- let t = z(e);
226
+ let t = O(e);
222
227
  if (!t) return 0;
223
228
  let n = H(t.r / 255), r = H(t.g / 255), i = H(t.b / 255);
224
229
  return .2126 * n + .7152 * r + .0722 * i;
@@ -228,17 +233,17 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
228
233
  return (i + .05) / (a + .05);
229
234
  }
230
235
  function re(e, t, n = {}) {
231
- let r = n.minContrast ?? A, i = n.preferDark !== !1, a = Math.max(.01, Math.min(.06, (e.c || .12) * (n.chromaScale ?? .25))), o = n.initialLightness ?? (i ? .24 : .94), s = i ? -1 : 1, c = n.step ?? .03, l = V(o), u = B(K(l, a, e.h)), d = J(t, u);
236
+ let r = n.minContrast ?? P, i = n.preferDark !== !1, a = Math.max(.01, Math.min(.06, (e.c || .12) * (n.chromaScale ?? .25))), o = n.initialLightness ?? (i ? .24 : .94), s = i ? -1 : 1, c = n.step ?? .03, l = j(o), u = k(K(l, a, e.h)), d = J(t, u);
232
237
  for (let n = 0; n < 48; n += 1) {
233
- let n = B(K(l, a, e.h)), i = J(t, n);
238
+ let n = k(K(l, a, e.h)), i = J(t, n);
234
239
  if (i > d && (d = i, u = n), i >= r) return n;
235
- if (l = V(l + s * c), l === 0 || l === 1) break;
240
+ if (l = j(l + s * c), l === 0 || l === 1) break;
236
241
  }
237
242
  let f = "#101214", p = "#ffffff", m = J(t, f), h = J(t, p);
238
243
  return m >= r || h >= r ? m >= h ? f : p : u;
239
244
  }
240
245
  function Y(e, t, n = {}) {
241
- let r = n.minContrast ?? A, i = n.darkCandidate ?? "#101214", a = n.lightCandidate ?? "#ffffff", o = n.preferredCandidate, s = n.preferredMinContrast ?? r, c = n.preferredSwitchDelta ?? 0, l = J(t, i), u = J(t, a), d = l >= r, f = u >= r, p = u >= s, m = l >= s;
246
+ let r = n.minContrast ?? P, i = n.darkCandidate ?? "#101214", a = n.lightCandidate ?? "#ffffff", o = n.preferredCandidate, s = n.preferredMinContrast ?? r, c = n.preferredSwitchDelta ?? 0, l = J(t, i), u = J(t, a), d = l >= r, f = u >= r, p = u >= s, m = l >= s;
242
247
  if (d || f) return o === "light" && p ? a : o === "dark" && m ? i : o === "light" && f ? !d || l - u <= c ? a : i : o === "dark" && d ? !f || u - l <= c ? i : a : d && f ? l >= u ? i : a : d ? i : a;
243
248
  let h = l >= u;
244
249
  return re(e, t, {
@@ -292,7 +297,7 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
292
297
  }
293
298
  function oe(e) {
294
299
  let t = e.l - X[5], n = e.c > .02 ? .02 : 0;
295
- return ie.reduce((r, i, a) => (r[i] = B(K(V(X[a] + t), Math.min(.4, Math.max(n, e.c * ae[a])), e.h)), r), {});
300
+ return ie.reduce((r, i, a) => (r[i] = k(K(j(X[a] + t), Math.min(.4, Math.max(n, e.c * ae[a])), e.h)), r), {});
296
301
  }
297
302
  function se(e, t) {
298
303
  let n = [
@@ -303,14 +308,14 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
303
308
  500,
304
309
  600,
305
310
  700
306
- ], r = Z(t, n, I, N), i = n.indexOf(r), a = n[Math.min(i + 1, n.length - 1)], o = n[Math.min(i + 2, n.length - 1)], s = [
311
+ ], r = Z(t, n, B, L), i = n.indexOf(r), a = n[Math.min(i + 1, n.length - 1)], o = n[Math.min(i + 2, n.length - 1)], s = [
307
312
  1e3,
308
313
  900,
309
314
  800,
310
315
  700,
311
316
  600,
312
317
  500
313
- ], c = Z(t, s, L, N), l = s.indexOf(c), u = s[Math.min(l + 1, s.length - 1)], d = s[Math.min(l + 2, s.length - 1)], f = Z(t, [
318
+ ], c = Z(t, s, V, L), l = s.indexOf(c), u = s[Math.min(l + 1, s.length - 1)], d = s[Math.min(l + 2, s.length - 1)], f = Z(t, [
314
319
  200,
315
320
  300,
316
321
  400,
@@ -318,25 +323,25 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
318
323
  600,
319
324
  700,
320
325
  800
321
- ], I, M), p = Z(t, [
326
+ ], B, I), p = Z(t, [
322
327
  900,
323
328
  800,
324
329
  700,
325
330
  600,
326
331
  500,
327
332
  400
328
- ], L, M), m = [
333
+ ], V, I), m = [
329
334
  600,
330
335
  700,
331
336
  800,
332
337
  900,
333
338
  1e3
334
- ], h = Z(t, m, I, j), g = m.indexOf(h), _ = m[Math.min(g + 1, m.length - 1)], v = m[Math.min(g + 2, m.length - 1)], y = [
339
+ ], h = Z(t, m, B, F), g = m.indexOf(h), _ = m[Math.min(g + 1, m.length - 1)], v = m[Math.min(g + 2, m.length - 1)], y = [
335
340
  400,
336
341
  300,
337
342
  200,
338
343
  100
339
- ], b = Z(t, y, L, j), x = y.indexOf(b), S = y[Math.min(x + 1, y.length - 1)], C = y[Math.min(x + 2, y.length - 1)], w = {
344
+ ], b = Z(t, y, V, F), x = y.indexOf(b), S = y[Math.min(x + 1, y.length - 1)], C = y[Math.min(x + 2, y.length - 1)], w = {
340
345
  "--color-brand-surface-soft-light": t[r],
341
346
  "--color-brand-surface-soft-hovered-light": t[a],
342
347
  "--color-brand-surface-soft-pressed-light": t[o],
@@ -352,22 +357,22 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
352
357
  "--color-brand-surface-strong-hovered-dark": t[S],
353
358
  "--color-brand-surface-strong-pressed-dark": t[C]
354
359
  }, T = t[600];
355
- return w["--color-brand-on-soft-light"] = J(w["--color-brand-surface-soft-light"], T) >= A ? T : Y(e, w["--color-brand-surface-soft-light"], { minContrast: A }), w["--color-brand-on-soft-dark"] = Y(e, w["--color-brand-surface-soft-dark"], { minContrast: A }), w["--color-brand-on-subtle-light"] = Y(e, w["--color-brand-surface-subtle-light"], {
356
- minContrast: P,
360
+ return w["--color-brand-on-soft-light"] = J(w["--color-brand-surface-soft-light"], T) >= P ? T : Y(e, w["--color-brand-surface-soft-light"], { minContrast: P }), w["--color-brand-on-soft-dark"] = Y(e, w["--color-brand-surface-soft-dark"], { minContrast: P }), w["--color-brand-on-subtle-light"] = Y(e, w["--color-brand-surface-subtle-light"], {
361
+ minContrast: R,
357
362
  preferredCandidate: "light",
358
- preferredMinContrast: P,
359
- preferredSwitchDelta: F
360
- }), w["--color-brand-on-subtle-dark"] = Y(e, w["--color-brand-surface-subtle-dark"], { minContrast: A }), w["--color-brand-on-strong-light"] = Y(e, w["--color-brand-surface-strong-light"], {
361
- minContrast: P,
363
+ preferredMinContrast: R,
364
+ preferredSwitchDelta: z
365
+ }), w["--color-brand-on-subtle-dark"] = Y(e, w["--color-brand-surface-subtle-dark"], { minContrast: P }), w["--color-brand-on-strong-light"] = Y(e, w["--color-brand-surface-strong-light"], {
366
+ minContrast: R,
362
367
  preferredCandidate: "light",
363
- preferredMinContrast: P,
364
- preferredSwitchDelta: F
365
- }), w["--color-brand-on-strong-dark"] = Y(e, w["--color-brand-surface-strong-dark"], { minContrast: A }), w["--color-brand-text-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-text-dark"] = w["--color-brand-surface-strong-dark"], w["--color-brand-icon-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-icon-dark"] = w["--color-brand-surface-strong-dark"], w["--color-brand-border-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-border-dark"] = w["--color-brand-surface-strong-dark"], w;
368
+ preferredMinContrast: R,
369
+ preferredSwitchDelta: z
370
+ }), w["--color-brand-on-strong-dark"] = Y(e, w["--color-brand-surface-strong-dark"], { minContrast: P }), w["--color-brand-text-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-text-dark"] = w["--color-brand-surface-strong-dark"], w["--color-brand-icon-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-icon-dark"] = w["--color-brand-surface-strong-dark"], w["--color-brand-border-light"] = w["--color-brand-surface-strong-light"], w["--color-brand-border-dark"] = w["--color-brand-surface-strong-dark"], w;
366
371
  }
367
372
  function ce(e) {
368
- let t = R(e);
373
+ let t = D(e);
369
374
  if (!t) return null;
370
- let n = z(t);
375
+ let n = O(t);
371
376
  if (!n) return null;
372
377
  let r = W(n), i = oe(r);
373
378
  return i[600] = t, {
@@ -389,24 +394,24 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
389
394
  vars: {},
390
395
  enabled: !!i.exposeGlobalAccent
391
396
  };
392
- return a.push($), p(() => i.exposeGlobalAccent, (e) => {
393
- $.enabled = !!e, m();
394
- }, { immediate: !0 }), p(Q, (e) => {
395
- e && Object.keys(e).length > 0 ? $.vars = { ...e } : $.vars = {}, m();
396
- }, { immediate: !0 }), (e, t) => (c(), n("div", {
397
+ return M.push($), m(() => i.exposeGlobalAccent, (e) => {
398
+ $.enabled = !!e, a();
399
+ }, { immediate: !0 }), m(Q, (e) => {
400
+ e && Object.keys(e).length > 0 ? $.vars = { ...e } : $.vars = {}, a();
401
+ }, { immediate: !0 }), (e, t) => (l(), n("div", {
397
402
  class: "theme",
398
- style: o(Q.value)
399
- }, [d(e.$slots, "default"), r("div", {
403
+ style: s(Q.value)
404
+ }, [f(e.$slots, "default"), r("div", {
400
405
  ref_key: "portalHost",
401
- ref: b,
406
+ ref: v,
402
407
  class: "theme__portal-host"
403
408
  }, null, 512)], 4));
404
409
  }
405
- }), z = /* @__PURE__ */ ((e, t) => {
410
+ }), U = /* @__PURE__ */ ((e, t) => {
406
411
  let n = e.__vccOpts || e;
407
412
  for (let [e, r] of t) n[e] = r;
408
413
  return n;
409
- })({
414
+ })(/* @__PURE__ */ a({
410
415
  __name: "ThemeSwitcher",
411
416
  props: { mode: {
412
417
  type: String,
@@ -418,8 +423,8 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
418
423
  ].includes(e)
419
424
  } },
420
425
  emits: ["update:mode"],
421
- setup(n, { emit: a }) {
422
- let o = [
426
+ setup(e, { emit: n }) {
427
+ let a = [
423
428
  {
424
429
  value: "auto",
425
430
  label: "System"
@@ -432,57 +437,57 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
432
437
  value: "dark",
433
438
  label: "Dark"
434
439
  }
435
- ].reduce((e, t) => (e[t.value] = t.label, e), {}), s = v, l = n, d = a;
436
- w();
437
- let y = u(!1), b = S() ?? l.mode, x = u(s.includes(b) ? b : "auto");
438
- return e(() => o[x.value] ?? o.auto), p(() => l.mode, (e) => {
439
- s.includes(e) && e !== x.value && (x.value = e);
440
- }), p(x, (e) => {
441
- if (!s.includes(e)) {
442
- x.value = "auto";
440
+ ].reduce((e, t) => (e[t.value] = t.label, e), {}), o = y, s = e, c = n;
441
+ T();
442
+ let u = d(!1), f = C() ?? s.mode, b = d(o.includes(f) ? f : "auto");
443
+ return m(() => s.mode, (e) => {
444
+ o.includes(e) && e !== b.value && (b.value = e);
445
+ }), m(b, (e) => {
446
+ if (!o.includes(e)) {
447
+ b.value = "auto";
443
448
  return;
444
449
  }
445
- y.value = !1, d("update:mode", e), C(e);
446
- }, { immediate: !0 }), (e, n) => (c(), t(f(_), {
447
- open: y.value,
448
- "onUpdate:open": n[3] ||= (e) => y.value = e,
450
+ u.value = !1, c("update:mode", e), w(e), T(e);
451
+ }, { immediate: !0 }), (e, n) => (l(), t(p(v), {
452
+ open: u.value,
453
+ "onUpdate:open": n[3] ||= (e) => u.value = e,
449
454
  text: "Theme",
450
455
  "aria-label": "Select theme mode"
451
456
  }, {
452
- default: m(() => [i(f(h), { title: "Theme" }, {
453
- default: m(() => [
454
- i(f(g), {
455
- checked: x.value,
456
- "onUpdate:checked": n[0] ||= (e) => x.value = e,
457
+ default: h(() => [i(p(g), {
458
+ title: "Theme",
459
+ "item-role": "menuitemradio"
460
+ }, {
461
+ default: h(() => [
462
+ i(p(_), {
463
+ checked: b.value,
464
+ "onUpdate:checked": n[0] ||= (e) => b.value = e,
457
465
  value: "auto",
458
- label: f(o).auto,
459
- "aria-label": `${f(o).auto} mode`
466
+ label: p(a).auto,
467
+ "aria-label": `${p(a).auto} mode`
460
468
  }, null, 8, [
461
469
  "checked",
462
470
  "label",
463
471
  "aria-label"
464
472
  ]),
465
- n[4] ||= r("hr", {
466
- class: "theme-switcher-divider",
467
- role: "separator"
468
- }, null, -1),
469
- i(f(g), {
470
- checked: x.value,
471
- "onUpdate:checked": n[1] ||= (e) => x.value = e,
473
+ n[4] ||= r("hr", { class: "theme-switcher-divider" }, null, -1),
474
+ i(p(_), {
475
+ checked: b.value,
476
+ "onUpdate:checked": n[1] ||= (e) => b.value = e,
472
477
  value: "light",
473
- label: f(o).light,
474
- "aria-label": `${f(o).light} mode`
478
+ label: p(a).light,
479
+ "aria-label": `${p(a).light} mode`
475
480
  }, null, 8, [
476
481
  "checked",
477
482
  "label",
478
483
  "aria-label"
479
484
  ]),
480
- i(f(g), {
481
- checked: x.value,
482
- "onUpdate:checked": n[2] ||= (e) => x.value = e,
485
+ i(p(_), {
486
+ checked: b.value,
487
+ "onUpdate:checked": n[2] ||= (e) => b.value = e,
483
488
  value: "dark",
484
- label: f(o).dark,
485
- "aria-label": `${f(o).dark} mode`
489
+ label: p(a).dark,
490
+ "aria-label": `${p(a).dark} mode`
486
491
  }, null, 8, [
487
492
  "checked",
488
493
  "label",
@@ -494,8 +499,8 @@ var ee = "(prefers-color-scheme: dark)", te = "(prefers-reduced-motion: reduce)"
494
499
  _: 1
495
500
  }, 8, ["open"]));
496
501
  }
497
- }, [["__scopeId", "data-v-bcbc87cb"]]);
502
+ }), [["__scopeId", "data-v-be9d7090"]]);
498
503
  //#endregion
499
- export { R as Theme, z as ThemeSwitcher, O as themePortalHostKey, k as useThemePortalTarget };
504
+ export { H as Theme, U as ThemeSwitcher, A as themePortalHostKey, j as useThemePortalTarget };
500
505
 
501
506
  //# sourceMappingURL=theme.es.js.map