@club-employes/utopia 2.11.0 → 2.11.1

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  // Type definitions for @club-employes/utopia
2
- import { DefineComponent } from 'vue'
2
+ import { ComputedRef, DefineComponent } from 'vue'
3
3
 
4
4
  // Component prop types
5
5
  export interface BadgeProps {
@@ -21,7 +21,10 @@ export interface IconProps {
21
21
 
22
22
  export interface LogoProps {
23
23
  variant?: 'auto' | 'default' | 'white' | 'small' | 'small-white'
24
- size?: 'small' | 'medium' | 'large'
24
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
25
+ brand?: 'club-employes' | 'gifteo'
26
+ alt?: string
27
+ class?: string
25
28
  }
26
29
 
27
30
  export interface ThemeConfig {
@@ -47,6 +50,32 @@ export declare const clubEmployesDark: ThemeConfig
47
50
  export declare const gifteoLight: ThemeConfig
48
51
  export declare const gifteoDark: ThemeConfig
49
52
 
53
+ // Composable types
54
+ export type BrandTheme = 'club-employes' | 'gifteo'
55
+ export type ThemeMode = 'light' | 'dark'
56
+
57
+ export interface UseThemeReturn {
58
+ currentTheme: ComputedRef<ThemeConfig>
59
+ currentBrand: ComputedRef<BrandTheme>
60
+ currentMode: ComputedRef<ThemeMode>
61
+ currentBrandName: ComputedRef<string>
62
+ availableBrands: ComputedRef<Array<{ key: BrandTheme; name: string }>>
63
+ toggleBrand: () => void
64
+ toggleMode: () => void
65
+ setBrand: (brand: BrandTheme) => void
66
+ setMode: (mode: ThemeMode) => void
67
+ }
68
+
69
+ export interface UseFaviconReturn {
70
+ faviconUrl: ComputedRef<string>
71
+ refreshFavicon: () => void
72
+ updateFavicon: (faviconUrl: string) => void
73
+ }
74
+
75
+ // Composable exports
76
+ export declare function useTheme(): UseThemeReturn
77
+ export declare function useFavicon(): UseFaviconReturn
78
+
50
79
  // Type exports
51
80
  export type BadgeVariant = 'default' | 'success' | 'warning' | 'danger'
52
81
  export type BadgeSize = 'small' | 'medium'
@@ -56,4 +85,5 @@ export type IconName = string
56
85
  export type IconSize = 'small' | 'medium' | 'large'
57
86
  export type IconColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'neutral' | 'current'
58
87
  export type LogoVariant = 'auto' | 'default' | 'white' | 'small' | 'small-white'
59
- export type LogoSize = 'small' | 'medium' | 'large'
88
+ export type LogoSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
89
+ export type LogoBrand = 'club-employes' | 'gifteo'
package/dist/index.js CHANGED
@@ -1,73 +1,144 @@
1
- import { defineComponent as h, computed as d, provide as $, onMounted as w, onBeforeUnmount as C, watch as k, createElementBlock as l, openBlock as c, renderSlot as p, normalizeClass as f, mergeProps as z, createCommentVNode as v, createElementVNode as m, ref as B, normalizeStyle as _ } from "vue";
2
- const I = ["data-theme"], L = /* @__PURE__ */ h({
1
+ import { defineComponent as w, computed as u, ref as C, provide as I, onMounted as z, onBeforeUnmount as L, watch as k, createElementBlock as g, openBlock as h, renderSlot as y, normalizeClass as $, mergeProps as D, createCommentVNode as T, createElementVNode as v, normalizeStyle as A, onUnmounted as F } from "vue";
2
+ const P = (n, t, o) => {
3
+ const r = n[t];
4
+ return r ? typeof r == "function" ? r() : Promise.resolve(r) : new Promise((l, d) => {
5
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(d.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
6
+ });
7
+ }, j = ["data-theme"], x = /* @__PURE__ */ w({
3
8
  __name: "ThemeProvider",
4
9
  props: {
5
10
  theme: {}
6
11
  },
7
- setup(r) {
8
- const e = r, t = d(() => e.theme.name);
9
- let o = null;
10
- const n = () => {
11
- o && document.head.removeChild(o), o = document.createElement("style"), o.setAttribute("data-theme-provider", t.value), o.textContent = e.theme.cssContent, document.head.appendChild(o);
12
- }, i = () => {
13
- o && document.head.contains(o) && (document.head.removeChild(o), o = null);
12
+ setup(n) {
13
+ const t = n, o = u(() => t.theme.name), r = /* @__PURE__ */ new Map(), l = C(!1), d = async (s) => {
14
+ if (r.has(s))
15
+ return r.get(s);
16
+ const c = s.lastIndexOf("-"), m = s.substring(0, c), p = s.substring(c + 1);
17
+ try {
18
+ const S = await P(/* @__PURE__ */ Object.assign({ "../tokens/generated/club-employes/dark.css": () => import("./dark-CJ1ivx_-.js"), "../tokens/generated/club-employes/light.css": () => import("./light-CXtMcqsV.js"), "../tokens/generated/gifteo/dark.css": () => import("./dark-CZ1KmhXy.js"), "../tokens/generated/gifteo/light.css": () => import("./light-BAFzIOTZ.js") }), `../tokens/generated/${m}/${p}.css`, 5), E = S.default || S;
19
+ return r.set(s, E), E;
20
+ } catch (S) {
21
+ return console.warn(`Failed to preload theme CSS for ${s}:`, S), "";
22
+ }
23
+ }, a = async () => {
24
+ if (!l.value) {
25
+ l.value = !0, console.log("🎨 Switching to theme:", o.value);
26
+ try {
27
+ const s = await d(o.value);
28
+ if (!s) {
29
+ console.warn("No CSS content found for theme:", o.value), l.value = !1;
30
+ return;
31
+ }
32
+ document.body.classList.add("theme-transition"), await new Promise((p) => setTimeout(p, 50)), document.querySelectorAll("style[data-theme-css]").forEach((p) => p.remove());
33
+ const m = document.createElement("style");
34
+ m.setAttribute("data-theme-css", "true"), m.textContent = s, document.head.appendChild(m), document.body.setAttribute("data-theme", o.value), setTimeout(() => {
35
+ document.body.classList.remove("theme-transition"), l.value = !1;
36
+ }, 300), console.log("✅ Theme CSS applied smoothly:", o.value);
37
+ } catch (s) {
38
+ console.warn("Failed to inject theme CSS:", s), document.body.classList.remove("theme-transition"), l.value = !1;
39
+ }
40
+ }
41
+ }, e = () => {
42
+ document.body.removeAttribute("data-theme");
43
+ const s = document.querySelector("style[data-theme-css]");
44
+ s && s.remove();
14
45
  };
15
- return $("theme", {
16
- name: t,
17
- config: e.theme
18
- }), w(() => {
19
- n();
20
- }), C(() => {
21
- i();
22
- }), k(() => e.theme, () => {
23
- n();
24
- }, { deep: !0 }), (s, a) => (c(), l("div", {
46
+ return I("theme", {
47
+ name: o,
48
+ config: t.theme
49
+ }), z(async () => {
50
+ const s = document.querySelector("style[data-default-theme]"), c = [
51
+ "club-employes-light",
52
+ "club-employes-dark",
53
+ "gifteo-light",
54
+ "gifteo-dark"
55
+ ];
56
+ if (Promise.all(
57
+ c.map((m) => d(m))
58
+ ).then(() => {
59
+ console.log("🚀 All themes preloaded in cache");
60
+ }), s && o.value === "club-employes-light") {
61
+ console.log("✅ Default theme already loaded, skipping initial injection");
62
+ return;
63
+ }
64
+ await a();
65
+ }), L(() => {
66
+ e();
67
+ }), k(() => t.theme, () => {
68
+ console.log("Theme changed to:", t.theme.name), a();
69
+ }, { deep: !0 }), (() => {
70
+ if (document.querySelector("style[data-theme-transitions]")) return;
71
+ const c = document.createElement("style");
72
+ c.setAttribute("data-theme-transitions", "true"), c.textContent = `
73
+ body.theme-transition {
74
+ transition: background-color 0.3s ease, color 0.3s ease;
75
+ }
76
+
77
+ body.theme-transition *,
78
+ body.theme-transition *::before,
79
+ body.theme-transition *::after {
80
+ transition: background-color 0.3s ease,
81
+ color 0.3s ease,
82
+ border-color 0.3s ease,
83
+ box-shadow 0.3s ease,
84
+ fill 0.3s ease,
85
+ stroke 0.3s ease !important;
86
+ }
87
+
88
+ /* Désactiver les transitions sur les éléments interactifs pour éviter les lags */
89
+ body.theme-transition button:hover,
90
+ body.theme-transition a:hover,
91
+ body.theme-transition [role="button"]:hover {
92
+ transition: none !important;
93
+ }
94
+ `, document.head.appendChild(c);
95
+ })(), (s, c) => (h(), g("div", {
25
96
  class: "theme-provider",
26
- "data-theme": t.value
97
+ "data-theme": o.value
27
98
  }, [
28
- p(s.$slots, "default", {}, void 0, !0)
29
- ], 8, I));
99
+ y(s.$slots, "default", {}, void 0, !0)
100
+ ], 8, j));
30
101
  }
31
- }), g = (r, e) => {
32
- const t = r.__vccOpts || r;
33
- for (const [o, n] of e)
34
- t[o] = n;
35
- return t;
36
- }, U = /* @__PURE__ */ g(L, [["__scopeId", "data-v-0be50703"]]), M = /* @__PURE__ */ h({
102
+ }), B = (n, t) => {
103
+ const o = n.__vccOpts || n;
104
+ for (const [r, l] of t)
105
+ o[r] = l;
106
+ return o;
107
+ }, ae = /* @__PURE__ */ B(x, [["__scopeId", "data-v-de954be9"]]), O = /* @__PURE__ */ w({
37
108
  __name: "Badge",
38
109
  props: {
39
110
  variant: { default: "default" },
40
111
  size: { default: "medium" }
41
112
  },
42
- setup(r) {
43
- const e = r, t = d(() => {
44
- const o = {
113
+ setup(n) {
114
+ const t = n, o = u(() => {
115
+ const r = {
45
116
  small: "sm",
46
117
  medium: "md"
47
118
  };
48
119
  return [
49
120
  "badge",
50
- `badge--${e.variant}`,
51
- `badge--${o[e.size]}`
121
+ `badge--${t.variant}`,
122
+ `badge--${r[t.size]}`
52
123
  ];
53
124
  });
54
- return (o, n) => (c(), l("span", {
55
- class: f(t.value)
125
+ return (r, l) => (h(), g("span", {
126
+ class: $(o.value)
56
127
  }, [
57
- p(o.$slots, "default", {}, void 0, !0)
128
+ y(r.$slots, "default", {}, void 0, !0)
58
129
  ], 2));
59
130
  }
60
- }), q = /* @__PURE__ */ g(M, [["__scopeId", "data-v-2a8fca7d"]]), S = ["disabled", "aria-disabled", "aria-label"], E = {
131
+ }), re = /* @__PURE__ */ B(O, [["__scopeId", "data-v-2a8fca7d"]]), q = ["disabled", "aria-disabled", "aria-label"], U = {
61
132
  key: 0,
62
133
  class: "button-spinner",
63
134
  "aria-hidden": "true"
64
- }, T = {
135
+ }, N = {
65
136
  key: 0,
66
137
  class: "button-icon button-icon--before"
67
- }, F = { class: "button-text" }, N = {
138
+ }, G = { class: "button-text" }, R = {
68
139
  key: 1,
69
140
  class: "button-icon button-icon--after"
70
- }, P = /* @__PURE__ */ h({
141
+ }, V = /* @__PURE__ */ w({
71
142
  __name: "Button",
72
143
  props: {
73
144
  variant: { default: "primary" },
@@ -78,38 +149,38 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
78
149
  ariaLabel: {}
79
150
  },
80
151
  emits: ["click"],
81
- setup(r, { emit: e }) {
82
- const t = r, o = e, n = d(() => {
83
- const s = {
152
+ setup(n, { emit: t }) {
153
+ const o = n, r = t, l = u(() => {
154
+ const a = {
84
155
  small: "sm",
85
156
  medium: "md",
86
157
  large: "lg"
87
158
  };
88
159
  return [
89
160
  "button",
90
- `button--${t.variant}`,
91
- `button--${s[t.size]}`,
161
+ `button--${o.variant}`,
162
+ `button--${a[o.size]}`,
92
163
  {
93
- "button--disabled": t.disabled,
94
- "button--loading": t.loading,
95
- "button--block": t.block
164
+ "button--disabled": o.disabled,
165
+ "button--loading": o.loading,
166
+ "button--block": o.block
96
167
  }
97
168
  ];
98
- }), i = (s) => {
99
- !t.disabled && !t.loading && o("click", s);
169
+ }), d = (a) => {
170
+ !o.disabled && !o.loading && r("click", a);
100
171
  };
101
- return (s, a) => (c(), l("button", z({
102
- class: n.value,
103
- disabled: s.disabled || s.loading,
104
- "aria-disabled": s.disabled || s.loading,
105
- "aria-label": s.ariaLabel
106
- }, s.$attrs, { onClick: i }), [
107
- s.loading ? (c(), l("span", E, a[0] || (a[0] = [
108
- m("svg", {
172
+ return (a, e) => (h(), g("button", D({
173
+ class: l.value,
174
+ disabled: a.disabled || a.loading,
175
+ "aria-disabled": a.disabled || a.loading,
176
+ "aria-label": a.ariaLabel
177
+ }, a.$attrs, { onClick: d }), [
178
+ a.loading ? (h(), g("span", U, e[0] || (e[0] = [
179
+ v("svg", {
109
180
  class: "spinner-icon",
110
181
  viewBox: "0 0 24 24"
111
182
  }, [
112
- m("circle", {
183
+ v("circle", {
113
184
  class: "spinner-path",
114
185
  cx: "12",
115
186
  cy: "12",
@@ -121,13 +192,13 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
121
192
  "stroke-dasharray": "31.416",
122
193
  "stroke-dashoffset": "31.416"
123
194
  }, [
124
- m("animate", {
195
+ v("animate", {
125
196
  attributeName: "stroke-dasharray",
126
197
  dur: "2s",
127
198
  values: "0 31.416;15.708 15.708;0 31.416",
128
199
  repeatCount: "indefinite"
129
200
  }),
130
- m("animate", {
201
+ v("animate", {
131
202
  attributeName: "stroke-dashoffset",
132
203
  dur: "2s",
133
204
  values: "0;-15.708;-31.416",
@@ -135,23 +206,23 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
135
206
  })
136
207
  ])
137
208
  ], -1)
138
- ]))) : v("", !0),
139
- m("span", {
140
- class: f(["button-content", { "button-content--hidden": s.loading }])
209
+ ]))) : T("", !0),
210
+ v("span", {
211
+ class: $(["button-content", { "button-content--hidden": a.loading }])
141
212
  }, [
142
- s.$slots.icon ? (c(), l("span", T, [
143
- p(s.$slots, "icon", {}, void 0, !0)
144
- ])) : v("", !0),
145
- m("span", F, [
146
- p(s.$slots, "default", {}, void 0, !0)
213
+ a.$slots.icon ? (h(), g("span", N, [
214
+ y(a.$slots, "icon", {}, void 0, !0)
215
+ ])) : T("", !0),
216
+ v("span", G, [
217
+ y(a.$slots, "default", {}, void 0, !0)
147
218
  ]),
148
- s.$slots.iconAfter ? (c(), l("span", N, [
149
- p(s.$slots, "iconAfter", {}, void 0, !0)
150
- ])) : v("", !0)
219
+ a.$slots.iconAfter ? (h(), g("span", R, [
220
+ y(a.$slots, "iconAfter", {}, void 0, !0)
221
+ ])) : T("", !0)
151
222
  ], 2)
152
- ], 16, S));
223
+ ], 16, q));
153
224
  }
154
- }), G = /* @__PURE__ */ g(P, [["__scopeId", "data-v-c5f4114b"]]), A = ["aria-label", "innerHTML"], D = /* @__PURE__ */ h({
225
+ }), le = /* @__PURE__ */ B(V, [["__scopeId", "data-v-c5f4114b"]]), H = ["aria-label", "innerHTML"], W = /* @__PURE__ */ w({
155
226
  __name: "Icon",
156
227
  props: {
157
228
  name: {},
@@ -160,17 +231,17 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
160
231
  alt: {},
161
232
  class: {}
162
233
  },
163
- setup(r) {
164
- const e = r, t = B(""), o = d(() => [
234
+ setup(n) {
235
+ const t = n, o = C(""), r = u(() => [
165
236
  "icon",
166
237
  `icon--${{
167
238
  small: "sm",
168
239
  medium: "md",
169
240
  large: "lg"
170
- }[e.size]}`,
171
- `icon--${e.color}`,
172
- e.class
173
- ].filter(Boolean)), n = d(() => ({
241
+ }[t.size]}`,
242
+ `icon--${t.color}`,
243
+ t.class
244
+ ].filter(Boolean)), l = u(() => ({
174
245
  color: {
175
246
  primary: "var(--theme-colors-brand-primary-600)",
176
247
  secondary: "var(--theme-colors-brand-secondary-600)",
@@ -179,16 +250,16 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
179
250
  danger: "var(--theme-colors-common-danger-600)",
180
251
  neutral: "var(--theme-colors-common-slate-600)",
181
252
  current: "currentColor"
182
- }[e.color]
183
- })), i = async (a) => {
253
+ }[t.color]
254
+ })), d = async (e) => {
184
255
  try {
185
- const u = `/src/assets/icons-processed/${a}.svg`, b = await fetch(u);
186
- if (!b.ok)
187
- throw new Error(`Icon not found: ${a}`);
188
- const y = (await b.text()).replace(/width="[^"]*"/g, "").replace(/height="[^"]*"/g, "").replace(/<svg([^>]*)>/g, '<svg$1 width="100%" height="100%">');
189
- t.value = y;
190
- } catch (u) {
191
- console.error(`Failed to load icon: ${a}`, u), t.value = `
256
+ const i = `/src/assets/icons-processed/${e}.svg`, s = await fetch(i);
257
+ if (!s.ok)
258
+ throw new Error(`Icon not found: ${e}`);
259
+ const m = (await s.text()).replace(/width="[^"]*"/g, "").replace(/height="[^"]*"/g, "").replace(/<svg([^>]*)>/g, '<svg$1 width="100%" height="100%">');
260
+ o.value = m;
261
+ } catch (i) {
262
+ console.error(`Failed to load icon: ${e}`, i), o.value = `
192
263
  <svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
193
264
  <circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/>
194
265
  <path d="M12 8v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
@@ -196,76 +267,167 @@ const I = ["data-theme"], L = /* @__PURE__ */ h({
196
267
  </svg>
197
268
  `;
198
269
  }
199
- }, s = (a) => a.includes("/") && a.split("/").pop() || a;
200
- return k(() => e.name, (a) => {
201
- const u = s(a);
202
- i(u);
203
- }, { immediate: !0 }), (a, u) => (c(), l("span", {
204
- class: f(o.value),
205
- style: _(n.value),
206
- "aria-label": a.alt || a.name,
270
+ }, a = (e) => e.includes("/") && e.split("/").pop() || e;
271
+ return k(() => t.name, (e) => {
272
+ const i = a(e);
273
+ d(i);
274
+ }, { immediate: !0 }), (e, i) => (h(), g("span", {
275
+ class: $(r.value),
276
+ style: A(l.value),
277
+ "aria-label": e.alt || e.name,
207
278
  role: "img",
208
- innerHTML: t.value
209
- }, null, 14, A));
279
+ innerHTML: o.value
280
+ }, null, 14, H));
210
281
  }
211
- }), J = /* @__PURE__ */ g(D, [["__scopeId", "data-v-8bcf9243"]]), H = ["aria-label"], V = /* @__PURE__ */ h({
282
+ }), ie = /* @__PURE__ */ B(W, [["__scopeId", "data-v-8bcf9243"]]), K = ["aria-label"], ce = /* @__PURE__ */ w({
212
283
  __name: "Logo",
213
284
  props: {
285
+ brand: {},
214
286
  variant: { default: "auto" },
215
287
  size: { default: "md" },
216
- alt: { default: "Logo" },
288
+ alt: {},
217
289
  class: {}
218
290
  },
219
- setup(r) {
220
- const e = r, t = d(() => [
221
- "logo",
222
- `logo--${e.size}`,
223
- `logo--${e.variant}`,
224
- e.class
225
- ].filter(Boolean)), o = d(() => {
226
- const n = {
227
- auto: "--theme-assets-logo-default",
228
- default: "--theme-assets-logo-default",
229
- white: "--theme-assets-logo-white",
230
- small: "--theme-assets-logo-small",
231
- "small-white": "--theme-assets-logo-small-white"
232
- };
233
- return {
234
- backgroundImage: `var(${e.variant === "auto" && (e.size === "xs" || e.size === "sm") ? "--theme-assets-logo-small" : n[e.variant]})`
235
- };
236
- });
237
- return (n, i) => (c(), l("div", {
238
- class: f(t.value),
239
- style: _(o.value),
240
- "aria-label": n.alt || "Logo",
291
+ setup(n) {
292
+ const t = n, o = u(() => {
293
+ const l = t.brand ? `logo--${t.brand}` : "logo--auto-brand";
294
+ return [
295
+ "logo",
296
+ `logo--${t.size}`,
297
+ `logo--${t.variant}`,
298
+ l,
299
+ t.class
300
+ ].filter(Boolean);
301
+ }), r = u(() => t.brand === "gifteo" ? "Gifteo" : t.brand === "club-employes" ? "Club Employés" : "Logo");
302
+ return (l, d) => (h(), g("div", {
303
+ class: $(o.value),
304
+ "aria-label": l.alt || `Logo ${r.value}`,
241
305
  role: "img"
242
- }, null, 14, H));
306
+ }, null, 10, K));
243
307
  }
244
- }), K = /* @__PURE__ */ g(V, [["__scopeId", "data-v-9417ac59"]]), Q = {
308
+ }), Y = {
245
309
  name: "club-employes-light",
246
- mode: "light",
247
- cssFile: "/src/tokens/generated/club-employes/light.css"
248
- }, R = {
310
+ mode: "light"
311
+ }, J = {
249
312
  name: "club-employes-dark",
250
- mode: "dark",
251
- cssFile: "/src/tokens/generated/club-employes/dark.css"
252
- }, W = {
313
+ mode: "dark"
314
+ }, Q = {
253
315
  name: "gifteo-light",
254
- mode: "light",
255
- cssFile: "/src/tokens/generated/gifteo/light.css"
316
+ mode: "light"
256
317
  }, X = {
257
318
  name: "gifteo-dark",
258
- mode: "dark",
259
- cssFile: "/src/tokens/generated/gifteo/dark.css"
319
+ mode: "dark"
320
+ }, M = {
321
+ BRAND: "utopia-theme-brand",
322
+ MODE: "utopia-theme-mode"
323
+ }, Z = () => {
324
+ if (typeof window > "u") return "club-employes";
325
+ const n = localStorage.getItem(M.BRAND);
326
+ return n === "club-employes" || n === "gifteo" ? n : "club-employes";
327
+ }, ee = () => {
328
+ if (typeof window > "u") return "light";
329
+ const n = localStorage.getItem(M.MODE);
330
+ return n === "light" || n === "dark" ? n : "light";
331
+ }, te = (n) => {
332
+ typeof window < "u" && localStorage.setItem(M.BRAND, n);
333
+ }, oe = (n) => {
334
+ typeof window < "u" && localStorage.setItem(M.MODE, n);
335
+ }, f = C(Z()), b = C(ee()), _ = {
336
+ "club-employes": {
337
+ light: Y,
338
+ dark: J,
339
+ name: "Club Employés"
340
+ },
341
+ gifteo: {
342
+ light: Q,
343
+ dark: X,
344
+ name: "Gifteo"
345
+ }
260
346
  };
347
+ function ne() {
348
+ const n = u(() => _[f.value][b.value]), t = u(() => _[f.value].name);
349
+ k(f, (e) => {
350
+ te(e);
351
+ }, { immediate: !1 }), k(b, (e) => {
352
+ oe(e);
353
+ }, { immediate: !1 });
354
+ const o = () => {
355
+ f.value = f.value === "club-employes" ? "gifteo" : "club-employes";
356
+ }, r = () => {
357
+ b.value = b.value === "light" ? "dark" : "light";
358
+ }, l = (e) => {
359
+ f.value = e;
360
+ }, d = (e) => {
361
+ b.value = e;
362
+ }, a = u(() => Object.keys(_).map((e) => ({
363
+ key: e,
364
+ name: _[e].name
365
+ })));
366
+ return {
367
+ // State
368
+ currentTheme: n,
369
+ currentBrand: u(() => f.value),
370
+ currentMode: u(() => b.value),
371
+ currentBrandName: t,
372
+ availableBrands: a,
373
+ // Actions
374
+ toggleBrand: o,
375
+ toggleMode: r,
376
+ setBrand: l,
377
+ setMode: d
378
+ };
379
+ }
380
+ function de() {
381
+ const { currentBrand: n, currentMode: t } = ne(), o = (i) => {
382
+ try {
383
+ const c = `--assets-logos-${i}-small`, p = getComputedStyle(document.documentElement).getPropertyValue(c).trim();
384
+ return p && p.startsWith("url(") && p.endsWith(")") ? p.slice(4, -1).replace(/['"`]/g, "") : null;
385
+ } catch (s) {
386
+ return console.warn("Erreur lors de la récupération du logo pour le favicon:", s), null;
387
+ }
388
+ }, r = (i) => i, l = (i) => {
389
+ try {
390
+ const s = document.querySelector('link[rel="icon"]');
391
+ s && s.remove();
392
+ const c = document.createElement("link");
393
+ c.rel = "icon", c.type = "image/svg+xml", c.href = i, document.head.appendChild(c);
394
+ } catch (s) {
395
+ console.warn("Erreur lors de la mise à jour du favicon:", s);
396
+ }
397
+ }, d = u(() => {
398
+ const i = o(n.value);
399
+ return i ? r(i) : "/favicon.ico";
400
+ }), a = () => {
401
+ const i = d.value;
402
+ i && l(i);
403
+ };
404
+ let e = null;
405
+ return z(() => {
406
+ setTimeout(a, 50), e = k(
407
+ [n, t],
408
+ () => {
409
+ a();
410
+ },
411
+ { immediate: !1 }
412
+ );
413
+ }), F(() => {
414
+ e && e();
415
+ }), {
416
+ faviconUrl: d,
417
+ refreshFavicon: a,
418
+ updateFavicon: l
419
+ };
420
+ }
261
421
  export {
262
- q as Badge,
263
- G as Button,
264
- J as Icon,
265
- K as Logo,
266
- U as ThemeProvider,
267
- R as clubEmployesDark,
268
- Q as clubEmployesLight,
422
+ re as Badge,
423
+ le as Button,
424
+ ie as Icon,
425
+ ce as Logo,
426
+ ae as ThemeProvider,
427
+ J as clubEmployesDark,
428
+ Y as clubEmployesLight,
269
429
  X as gifteoDark,
270
- W as gifteoLight
430
+ Q as gifteoLight,
431
+ de as useFavicon,
432
+ ne as useTheme
271
433
  };