@club-employes/utopia

中文文档
4.463.0发布于 2026/11/09MITTypeScriptES Module近 30 天下载 4977

🎨 Modern Vue 3 design system with multi-brand theming, design tokens, and 30+ components. Supports Club Employés & Gifteo brands with light/dark modes.

原始使用文档
文档目录27 节
  1. ✨ Features
  2. 🚀 Quick Start
  3. Installation
  4. Basic Usage
  5. Import Styles
  6. 🎨 Available Themes
  7. 🧩 Components
  8. Atoms (Building Blocks)
  9. Molecules (Simple Combinations)
  10. Organisms (Complex Components)
  11. Layouts (Page Structures)
  12. 🔧 Composables
  13. 🎯 Design Tokens
  14. 🌈 Theme Switching
  15. 🌍 Domain-Based Theme Initialization (No FOUC)
  16. 📦 Package Exports
  17. 🏗️ Advanced Usage
  18. Custom Theme Configuration
  19. Tree Shaking
  20. 📱 Responsive Design
  21. ♿ Accessibility
  22. 🔧 TypeScript Support
  23. 📊 Bundle Size
  24. 🌐 Browser Support
  25. 📚 Documentation & Resources
  26. 🤝 Contributing
  27. 📄 License

🎨 Utopia Design System

npm version License: MIT Vue 3 TypeScript

Modern Vue 3 design system with multi-brand theming, design tokens, and 30+ production-ready components. Built for Club Employés & Gifteo with full TypeScript support.

✨ Features

  • 🧩 30+ Vue 3 Components - Atoms, Molecules, Organisms, Layouts
  • 🎨 Multi-brand Theming - Club Employés & Gifteo brands
  • 🌙 Dark Mode Support - Light/dark variants for all themes
  • 🎯 Design Tokens - CSS variables generated with Style Dictionary
  • 📱 Responsive - Mobile-first approach with breakpoint utilities
  • ♿ Accessible - WCAG 2.1 AA compliant components
  • 🔧 TypeScript - Full type definitions included
  • 🚀 Tree Shakeable - Import only what you need
  • 📦 Zero Config - Works out of the box

🚀 Quick Start

Installation

npm install @club-employes/utopia

Basic Usage

<template>
  <ThemeProvider :theme="clubEmployesLight">
    <div class="app">
      <Button variant="primary" size="medium" @click="handleClick">
        Get Started
      </Button>
      
      <Card variant="elevated">
        <Icon name="heart" size="large" />
        <h2>Welcome to Utopia</h2>
        <p>Modern design system for Vue 3</p>
      </Card>
    </div>
  </ThemeProvider>
</template>

<script setup lang="ts">
import { 
  Button, 
  Card, 
  Icon, 
  ThemeProvider, 
  clubEmployesLight 
} from '@club-employes/utopia'
import '@club-employes/utopia/styles'

const handleClick = () => {
  console.log('Button clicked!')
}
</script>

Import Styles

// Import all styles (recommended)
import '@club-employes/utopia/styles'

// Or import specific theme tokens
import '@club-employes/utopia/tokens/club-employes/light'
import '@club-employes/utopia/tokens/gifteo/dark'

🎨 Available Themes

import { 
  clubEmployesLight,   // Club Employés light theme
  clubEmployesDark,    // Club Employés dark theme
  gifteoLight,         // Gifteo light theme
  gifteoDark           // Gifteo dark theme
} from '@club-employes/utopia'

🧩 Components

Atoms (Building Blocks)

  • Button - Interactive buttons with variants
  • Icon - 1200+ Lucide icons
  • Logo - Multi-brand logos
  • Badge - Status indicators
  • Card - Content containers
  • Input - Form controls
  • Checkbox - Boolean inputs
  • Switch - Toggle controls

Molecules (Simple Combinations)

  • SearchBox - Search input with icon
  • InputSelect - Dropdown with filtering

Organisms (Complex Components)

  • DataTable - Advanced data tables
  • Header - Navigation headers
  • Menu - Sidebar navigation

Layouts (Page Structures)

  • DefaultLayout - Main application layout

🔧 Composables

import { useTheme, useFavicon, useScrollShadows } from '@club-employes/utopia'

// Theme management
const { theme, setTheme } = useTheme()
setTheme('club-employes', 'dark')

// Dynamic favicon
const { setFavicon } = useFavicon()

// Scroll shadows
const { shadowTop, shadowBottom } = useScrollShadows(containerRef)

🎯 Design Tokens

All components use CSS custom properties (design tokens):

.my-component {
  /* Colors */
  background: var(--utopia-color-surface);
  color: var(--utopia-color-text-primary);
  
  /* Spacing */
  padding: var(--utopia-space-md);
  margin: var(--utopia-space-lg);
  
  /* Typography */
  font-family: var(--utopia-font-family);
  font-size: var(--utopia-font-size-base);
  
  /* Borders */
  border-radius: var(--utopia-radius-md);
  border: 1px solid var(--utopia-color-border);
}

🌈 Theme Switching

<template>
  <div>
    <ThemeProvider :theme="currentTheme">
      <Button @click="toggleTheme">
        Switch to {{ isDark ? 'Light' : 'Dark' }} Mode
      </Button>
      <YourApp />
    </ThemeProvider>
  </div>
</template>

<script setup lang="ts">
import { ref, computed } from 'vue'
import { 
  ThemeProvider, 
  clubEmployesLight, 
  clubEmployesDark 
} from '@club-employes/utopia'

const isDark = ref(false)
const currentTheme = computed(() => 
  isDark.value ? clubEmployesDark : clubEmployesLight
)

const toggleTheme = () => {
  isDark.value = !isDark.value
}
</script>

🌍 Domain-Based Theme Initialization (No FOUC)

For multi-tenant applications with different domains, you can initialize the theme before Vue mounts to prevent Flash of Unstyled Content (FOUC):

// main.ts
import { createApp } from 'vue'
import { initializeTheme } from '@club-employes/utopia'
import '@club-employes/utopia/styles'
import App from './App.vue'

// Detect theme from domain
function getThemeFromDomain(): string {
  const hostname = window.location.hostname
  
  if (hostname.includes('gifteo')) {
    return 'gifteo-light'
  }
  
  if (hostname.includes('club-employes')) {
    return 'club-employes-light'
  }
  
  return 'club-employes-light' // Default
}

// Initialize theme BEFORE creating Vue app
async function bootstrap() {
  const themeName = getThemeFromDomain()
  
  try {
    await initializeTheme(themeName)
    console.log('✅ Theme initialized:', themeName)
  } catch (error) {
    console.error('❌ Failed to initialize theme:', error)
  }
  
  // Create Vue app (no FOUC!)
  const app = createApp(App)
  app.mount('#app')
}

bootstrap()

📖 See full documentation for advanced patterns and examples.

📦 Package Exports

// Main export
import { Button, Icon, ThemeProvider } from '@club-employes/utopia'

// Styles
import '@club-employes/utopia/styles'

// Specific theme tokens
import '@club-employes/utopia/tokens/club-employes/light'
import '@club-employes/utopia/tokens/club-employes/dark'
import '@club-employes/utopia/tokens/gifteo/light'
import '@club-employes/utopia/tokens/gifteo/dark'

// Icons list (JSON)
import iconsList from '@club-employes/utopia/icons'

🏗️ Advanced Usage

Custom Theme Configuration

<script setup lang="ts">
import { ThemeProvider } from '@club-employes/utopia'

const customTheme = {
  colors: {
    primary: '#your-brand-color',
    secondary: '#your-secondary-color'
  },
  // ... other theme properties
}
</script>

Tree Shaking

// Import only what you need
import { Button } from '@club-employes/utopia/components/Button'
import { Icon } from '@club-employes/utopia/components/Icon'

📱 Responsive Design

Components are mobile-first and responsive by default:

<template>
  <Button 
    size="small"        <!-- Mobile -->
    size-md="medium"    <!-- Tablet -->
    size-lg="large"     <!-- Desktop -->
  >
    Responsive Button
  </Button>
</template>

♿ Accessibility

All components follow WCAG 2.1 AA guidelines:

  • ✅ Keyboard navigation
  • ✅ Screen reader support
  • ✅ High contrast modes
  • ✅ Focus management
  • ✅ ARIA attributes

🔧 TypeScript Support

Full TypeScript definitions are automatically generated from source code via vite-plugin-dts:

import type { ButtonProps, IconProps, ThemeConfig } from '@club-employes/utopia'

const buttonProps: ButtonProps = {
  variant: 'primary',
  size: 'medium',
  disabled: false
}

How it works:

  • ✅ Component props are defined in local types.ts files (source of truth)
  • ✅ Types are automatically compiled to dist/index.d.ts during build
  • ✅ Full IntelliSense and autocompletion support
  • ✅ No manual type definitions needed

📊 Bundle Size

  • Full package: ~150KB (minified + gzipped)
  • Single component: ~5-15KB (tree-shaken)
  • Tokens only: ~10KB (CSS variables)

🌐 Browser Support

  • ✅ Chrome 90+
  • ✅ Firefox 88+
  • ✅ Safari 14+
  • ✅ Edge 90+

📚 Documentation & Resources

🤝 Contributing

We welcome contributions! Please see our Contributing Guide.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests and documentation
  5. Submit a pull request

📄 License

MIT © Club Employés


Made with ❤️ by the Club Employés team

Website • GitHub • NPM

版本与发布记录

@club-employes/utopia 共发布 474 个版本,首次发布于 2025/07/30;过去 12 个月发布了 423 个版本。

版本发布日期距今
4.463.0latest2026/11/09今天
4.462.02026/11/09今天
4.461.02026/11/081 天前
4.460.02026/11/064 天前
4.459.02026/11/045 天前
4.458.02026/10/2911 天前

关于 @club-employes/utopia 的常见问题

@club-employes/utopia 是什么?

🎨 Modern Vue 3 design system with multi-brand theming, design tokens, and 30+ components. Supports Club Employés & Gifteo brands with light/dark modes.

如何安装 @club-employes/utopia?

在项目目录运行 npm install @club-employes/utopia,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.5.33)、vue-router(^4.0.0)、@vueuse/core(^11.0.0)、@vueuse/integrations(^11.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 utopia-check-tokens、utopia-check-testids,可以用 npx utopia-check-tokens 直接运行。

@club-employes/utopia 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@club-employes/utopia 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@club-employes/utopia 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@club-employes/utopia 可以商用吗?

@club-employes/utopia 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@club-employes/utopia 的下载量有多少?

根据 npm 官方下载统计,@club-employes/utopia 在 2026/10/10 – 2026/11/08 这 30 天内被下载 4,977 次,日均约 166 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@club-employes/utopia 还在维护吗?

最新版本 4.463.0 发布于 2026/11/09(今天);至今共发布 474 个版本,其中过去 12 个月发布了 423 个;首次发布于 2025/07/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。