@club-employes/utopia 4.22.0 → 4.25.0

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/README.md CHANGED
@@ -175,6 +175,53 @@ const toggleTheme = () => {
175
175
  </script>
176
176
  ```
177
177
 
178
+ ## 🌍 Domain-Based Theme Initialization (No FOUC)
179
+
180
+ For multi-tenant applications with different domains, you can initialize the theme **before** Vue mounts to prevent Flash of Unstyled Content (FOUC):
181
+
182
+ ```typescript
183
+ // main.ts
184
+ import { createApp } from 'vue'
185
+ import { initializeTheme } from '@club-employes/utopia'
186
+ import '@club-employes/utopia/styles'
187
+ import App from './App.vue'
188
+
189
+ // Detect theme from domain
190
+ function getThemeFromDomain(): string {
191
+ const hostname = window.location.hostname
192
+
193
+ if (hostname.includes('gifteo')) {
194
+ return 'gifteo-light'
195
+ }
196
+
197
+ if (hostname.includes('club-employes')) {
198
+ return 'club-employes-light'
199
+ }
200
+
201
+ return 'club-employes-light' // Default
202
+ }
203
+
204
+ // Initialize theme BEFORE creating Vue app
205
+ async function bootstrap() {
206
+ const themeName = getThemeFromDomain()
207
+
208
+ try {
209
+ await initializeTheme(themeName)
210
+ console.log('✅ Theme initialized:', themeName)
211
+ } catch (error) {
212
+ console.error('❌ Failed to initialize theme:', error)
213
+ }
214
+
215
+ // Create Vue app (no FOUC!)
216
+ const app = createApp(App)
217
+ app.mount('#app')
218
+ }
219
+
220
+ bootstrap()
221
+ ```
222
+
223
+ > 📖 **[See full documentation](./THEME_INITIALIZATION.md)** for advanced patterns and examples.
224
+
178
225
  ## 📦 Package Exports
179
226
 
180
227
  ```javascript
@@ -1,5 +1,5 @@
1
1
  {
2
- "generated": "2025-10-03T09:21:51.005Z",
2
+ "generated": "2025-10-17T08:53:22.219Z",
3
3
  "count": 1238,
4
4
  "icons": [
5
5
  "Accessibility",
package/dist/index.d.ts CHANGED
@@ -252,6 +252,11 @@ export declare const gifteoDark: ThemeConfig
252
252
  // Composable types
253
253
  export type BrandTheme = 'club-employes' | 'gifteo'
254
254
  export type ThemeMode = 'light' | 'dark'
255
+ export type ThemeName =
256
+ | 'club-employes-light'
257
+ | 'club-employes-dark'
258
+ | 'gifteo-light'
259
+ | 'gifteo-dark'
255
260
 
256
261
  export interface UseThemeReturn {
257
262
  currentTheme: ComputedRef<ThemeConfig>
@@ -259,10 +264,14 @@ export interface UseThemeReturn {
259
264
  currentMode: ComputedRef<ThemeMode>
260
265
  currentBrandName: ComputedRef<string>
261
266
  availableBrands: ComputedRef<Array<{ key: BrandTheme; name: string }>>
267
+ menuCollapsed: ComputedRef<boolean>
268
+ isBrandLocked: ComputedRef<boolean>
262
269
  toggleBrand: () => void
263
270
  toggleMode: () => void
264
271
  setBrand: (brand: BrandTheme) => void
265
272
  setMode: (mode: ThemeMode) => void
273
+ toggleMenuCollapsed: () => void
274
+ setMenuCollapsed: (collapsed: boolean) => void
266
275
  }
267
276
 
268
277
  export interface UseFaviconReturn {
@@ -275,6 +284,12 @@ export interface UseFaviconReturn {
275
284
  export declare function useTheme(): UseThemeReturn
276
285
  export declare function useFavicon(): UseFaviconReturn
277
286
 
287
+ // Theme initialization exports
288
+ export declare function initializeTheme(themeName: string): Promise<void>
289
+ export declare function getActiveTheme(): ThemeName | null
290
+ export declare function isValidThemeName(themeName: string): themeName is ThemeName
291
+ export declare function unlockBrand(): void
292
+
278
293
  // Type exports
279
294
  export type BadgeVariant = 'default' | 'success' | 'warning' | 'danger'
280
295
  export type BadgeSize = 'small' | 'medium'