@designcrowd/fe-shared-lib 1.5.1-icontranslation → 1.5.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/CLAUDE.md CHANGED
@@ -2,232 +2,70 @@
2
2
 
3
3
  This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
 
5
- ## Project Overview
6
-
7
- `@designcrowd/fe-shared-lib` is a Vue 3 component library and design system used across multiple DesignCrowd products: BrandCrowd, DesignCrowd, CrazyDomains, Design.com, and BrandPage. The library uses Tailwind CSS with a custom `tw-` prefix and features a sophisticated multi-theme system.
8
-
9
5
  ## Development Commands
10
6
 
11
- **Start Development:**
12
- ```bash
13
- npm start # Builds Tailwind for all themes + starts Storybook + watches translations
14
- ```
15
-
16
- **Storybook:**
17
- ```bash
18
- npm run storybook # Starts Storybook dev server on port 6006
19
- ```
20
-
21
- **Linting:**
22
- ```bash
23
- npm run lint # Lint Vue/JS files
24
- npm run lint:fix # Auto-fix linting issues
25
- ```
26
-
27
- **Translation Bundles:**
28
- ```bash
29
- npm run bundle-translation # Bundle translation files
30
- npm run watch:translation # Watch translation files for changes
31
- ```
32
-
33
- **Build CSS Only:**
34
- ```bash
35
- npm run build:css # Builds Tailwind CSS for all themes
36
- ```
37
-
38
- **Testing Single Components:**
39
- - Use Storybook to develop and test individual components
40
- - Run `npm start` and navigate to the component's story
41
-
42
- ## Architecture
43
-
44
- ### Component Structure
45
-
46
- The library follows atomic design principles:
47
-
48
- ```
49
- /src
50
- ├── atoms/components/ # Atomic, reusable components
51
- │ ├── Button/
52
- │ ├── Icon/
53
- │ ├── Modal/
54
- │ ├── design-com/ # Design.com-specific components (DcomIcon, etc.)
55
- │ └── [30+ other components]
56
- ├── experiences/ # Higher-level feature components
57
- │ ├── components/ # Auth flows, upload flows, payment config
58
- │ ├── mixins/
59
- │ ├── helpers/
60
- │ ├── clients/ # API clients
61
- │ └── constants/
62
- ├── themes/ # Theme configuration files
63
- ├── css/ # Base CSS and Tailwind setup
64
- └── bundles/ # i18n translation bundles
65
- ```
66
-
67
- ### Multi-Theme System
68
-
69
- The library supports 5 product themes, each extending `themes/base.js`:
70
-
71
- 1. **brandCrowd** (bc.js) - BrandCrowd
72
- 2. **brandPage** (bp.js) - BrandPage
73
- 3. **designCrowd** (dc.js) - DesignCrowd
74
- 4. **crazyDomains** (cd.js) - CrazyDomains
75
- 5. **designCom** (dcom.js) - Design.com
76
-
77
- **Theme Configuration:**
78
- - Each theme defines custom colors (primary, secondary, success, info, warning, error, grayscale, discount)
79
- - Custom fonts and spacing
80
- - Tailwind builds separate CSS files: `dist/css/tailwind-{themeName}.css`
81
-
82
- **Using Themes in Components:**
83
- - Components accept a `theme` prop (e.g., 'brandCrowd', 'designCom')
84
- - Use dynamic component selection: `:is="button-${theme}-${variant}"`
85
- - Ensure all theme variants are exported from component files
86
-
87
- ### Internationalization
88
-
89
- The library uses i18next with @nuxtjs/i18n for multi-language support:
90
-
91
- **Supported Locales:**
92
- - en-US, de-DE, fr-FR, fr-CA, es-ES, pt-PT, pt-BR
93
-
94
- **Usage Pattern:**
95
- ```javascript
96
- import { setSharedLibLocaleAsync, tr } from '@designcrowd/fe-shared-lib'
97
-
98
- // Set locale
99
- await setSharedLibLocaleAsync('en-US')
100
-
101
- // Translate
102
- const text = tr('translation.key')
103
- ```
104
-
105
- **Development Workflow:**
106
- 1. Edit translation files in appropriate directories
107
- 2. Run `npm run bundle-translation` or `npm run watch:translation`
108
- 3. Translations are bundled into `/src/bundles/`
109
-
110
- ### Component Development Patterns
111
-
112
- **Creating New Components:**
113
- 1. Add component to `/src/atoms/components/[ComponentName]/`
114
- 2. Create `[ComponentName].vue` with proper theme support
115
- 3. Create `[ComponentName].stories.js` for Storybook
116
- 4. Export from `/src/atoms/components/index.js`
117
- 5. If theme-specific, create variants in theme subdirectories
118
-
119
- **Component Guidelines:**
120
- - Use Tailwind classes with `tw-` prefix
121
- - Support all 5 themes or document theme restrictions
122
- - Include proper ARIA attributes for accessibility
123
- - Add `lang` prop to text-containing components for i18n
124
- - Follow variant patterns: primary, secondary, outlined, text, etc.
125
-
126
- **Icon System:**
127
- - Standard icons: Use `Icon.vue` component
128
- - Design.com specific: Use `design-com/DcomIcon.vue`
129
- - Icons defined in `Icon/icons/` and `design-com/icons/`
130
- - SVG icons should include `:lang` attribute when containing text
131
-
132
- ## Storybook
133
-
134
- **Running Storybook:**
135
- ```bash
136
- npm start # Includes Storybook + CSS build + translation watch
137
- ```
138
-
139
- **Story Files:**
140
- - Located alongside components: `ComponentName.stories.js`
141
- - Use `@storybook/vue3` format
142
- - Published to: https://brandcrowd-storybook.s3.amazonaws.com/fe-shared-lib/live/index.html
143
-
144
- **Writing Stories:**
145
- ```javascript
146
- export default {
147
- title: 'atoms/ComponentName',
148
- component: ComponentName,
149
- argTypes: {
150
- theme: {
151
- control: { type: 'select' },
152
- options: ['brandCrowd', 'designCom', ...]
153
- }
154
- }
155
- }
156
- ```
157
-
158
- ## Build & Publishing
159
-
160
- **Version Bump:**
161
- 1. Update version in `package.json`
162
- 2. Run `npm i` to update lock file
163
- 3. Commit changes
164
-
165
- **Publishing to NPM:**
166
- ```bash
167
- npm run docker:publish # Requires NPM_TOKEN environment variable
168
- ```
169
-
170
- **Testing Experimental Versions:**
171
- 1. Set version to `"[current]-[description]"` (e.g., "1.5.1-test-feature")
172
- 2. Build Docker image
173
- 3. Update consuming app's package.json reference
174
-
175
- **CI/CD:**
176
- - AWS CodeBuild auto-deploys Storybook to S3 on master commits
177
- - Uses Node 20.11.0
178
- - Configuration in `buildspec.yml`
179
-
180
- ## ESLint & Code Style
181
-
182
- **ESLint Configuration:**
183
- - Extends Vue recommended, Airbnb, Prettier, and Storybook recommended
184
- - Console statements allowed in development, error in production
185
- - Prettier: 120 character line width
186
-
187
- **Git Hooks (Husky):**
188
- - Pre-commit/pre-push runs `lint-staged`
189
- - Auto-lints and stages `*.{js,jsx,vue}` files
190
-
191
- ## Common Tasks
192
-
193
- **Adding a New Icon:**
194
- 1. Add SVG to `src/atoms/components/Icon/icons/` or `design-com/icons/`
195
- 2. Import in component's icon list
196
- 3. Add story to `Icon.stories.js` or `DcomIcon.stories.js`
197
- 4. If icon contains text, ensure `lang` attribute is properly bound
198
-
199
- **Adding a New Theme:**
200
- 1. Create `themes/{themeName}.js` extending `base.js`
201
- 2. Define color palette, fonts, spacing
202
- 3. Update `tailwind.build.js` to include new theme
203
- 4. Run `npm run build:css`
204
- 5. Test in Storybook
205
-
206
- **Working with Translations:**
207
- 1. Edit translation files in source directories
208
- 2. Run `npm run watch:translation` during development
209
- 3. Translations auto-bundle to `/src/bundles/`
210
- 4. Use `setSharedLibLocaleAsync()` and `tr()` in components
211
-
212
- **Debugging Theme Issues:**
213
- 1. Check that all theme variants exist for the component
214
- 2. Verify CSS was built: `npm run build:css`
215
- 3. Check component exports from `index.js`
216
- 4. Inspect Storybook controls for theme selection
217
-
218
- ## Technology Stack
219
-
220
- - **Framework:** Vue 3.5.15
221
- - **Build Tool:** Vite 6.3.5
222
- - **Styling:** TailwindCSS 3.4.1 (with `tw-` prefix)
223
- - **Documentation:** Storybook 9.0.4
224
- - **Internationalization:** i18next 25.2.1
225
- - **Linting:** ESLint (Airbnb + Vue + Prettier)
226
- - **Git Hooks:** Husky + lint-staged
227
-
228
- **Key Dependencies:**
229
- - Vue Router 4.5.0
230
- - axios (HTTP client)
231
- - cropperjs (image cropping)
232
- - swiper (carousels)
233
- - dropzone-vue3 (file uploads)
7
+ ### Starting Development
8
+ - `npm start` - Builds Tailwind CSS files for all themes and launches Storybook development server on port 6006
9
+ - `npm run storybook` - Same as `npm start` (alias)
10
+
11
+ ### Building
12
+ - `npm run build` - Builds production CSS using Tailwind
13
+ - `npm run build:css` - Builds CSS files using tailwind.build.js
14
+ - `npm run build:storybook` - Builds static Storybook for deployment
15
+
16
+ ### Code Quality
17
+ - `npm run lint` - Runs ESLint on TypeScript, JavaScript, and Vue files in src/
18
+ - `npm run lint:fix` - Automatically fixes linting issues where possible
19
+
20
+ ### Testing in UAT Environment
21
+ To test experimental versions without publishing to production:
22
+ 1. Update package.json version to `[current]-[description]`
23
+ 2. Run `docker build . --build-arg NPM_TOKEN=$NPM_TOKEN`
24
+ 3. Update consumer package reference to the new version
25
+
26
+ ## Architecture Overview
27
+
28
+ This is a shared component library and design system for DesignCrowd's frontend applications, published as `@designcrowd/fe-shared-lib`.
29
+
30
+ ### Project Structure
31
+ - **`src/atoms/`** - Reusable UI components (Button, Modal, Icon, etc.)
32
+ - **`src/experiences/`** - Complex, business-specific components (AuthFlow, PaymentConfig, etc.)
33
+ - **`src/themes/`** - Tailwind CSS theme configurations for different brands
34
+ - **`src/css/`** - Global CSS and Tailwind configuration
35
+ - **`public/css/`** - Generated CSS output files
36
+
37
+ ### Theme System
38
+ The library supports multiple brand themes through Tailwind CSS:
39
+ - **BrandCrowd** (`bc.js`)
40
+ - **BrandPage** (`bp.js`)
41
+ - **CrazyDomains** (`cd.js`)
42
+ - **DesignCrowd** (`dc.js`)
43
+ - **Design.com** (`dcom.js`)
44
+
45
+ Themes are built using `tailwind.themes.js` and exported via `src/themes/themes.js`.
46
+
47
+ ### Component Organization
48
+ - **Atoms**: Basic UI components with stories in Storybook
49
+ - **Experiences**: Complex components combining multiple atoms for specific workflows
50
+ - **Icons**: Extensive icon library with brand-specific variants
51
+ - **Mixins**: Reusable Vue.js mixins for common functionality
52
+
53
+ ### Key Files
54
+ - `index.js` - Main export file exposing all components
55
+ - `tailwind.config.js` - Tailwind CSS configuration
56
+ - `vite.config.ts` - Vite build configuration for development
57
+
58
+ ### Local Development Workflow
59
+ Use `npm link` in this directory and `npm link @designcrowd/fe-shared-lib` in consumer projects for local development.
60
+
61
+ ### Storybook
62
+ - Development server runs on port 6006
63
+ - Live Storybook: https://brandcrowd-storybook.s3.amazonaws.com/fe-shared-lib/live/index.html
64
+ - Stories are co-located with components (`.stories.js` files)
65
+
66
+ ### Brand Page Integration
67
+ For changes affecting BrandPage Tab in BC.NET:
68
+ 1. Update app.maker's reference to this library
69
+ 2. Bump app.maker version
70
+ 3. Run `npm run docker:publish:bp`
71
+ 4. Update BC.NET's reference to the new app.maker version