@ngx-stoui/core 21.0.4 → 21.0.6
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 +148 -148
- package/fesm2022/ngx-stoui-core.mjs +1 -1
- package/fesm2022/ngx-stoui-core.mjs.map +1 -1
- package/ngx-stoui.css +4 -2
- package/package.json +4 -1
- package/styles/README.md +273 -273
- package/styles/toolbox-grid/_toolbox-grid.scss +789 -0
- package/toolbox-grid.css +741 -0
package/styles/README.md
CHANGED
|
@@ -1,273 +1,273 @@
|
|
|
1
|
-
# Styles Folder Architecture
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The new `styles/` directory provides a clean, intuitive structure that eliminates the complex import chains of the old `style/` folder. All CSS variables are centralized, and the import path is straightforward.
|
|
6
|
-
|
|
7
|
-
## Directory Structure
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
styles/
|
|
11
|
-
├── index.scss # Main entry point (import this!)
|
|
12
|
-
├── _tokens.scss # Design system tokens and CSS variables
|
|
13
|
-
├── _material-theme.scss # Material 3 theme configuration
|
|
14
|
-
├── _typography.scss # Typography scales (normal, small, large)
|
|
15
|
-
├── _utilities.scss # Utility classes (grid, helpers)
|
|
16
|
-
├── fonts/
|
|
17
|
-
│ └── _fonts.scss # Font loading from CDN
|
|
18
|
-
└── components/
|
|
19
|
-
├── _index.scss # Component barrel file
|
|
20
|
-
├── _action-footer.scss # Individual component styles
|
|
21
|
-
├── _appheader.scss
|
|
22
|
-
├── _card.scss
|
|
23
|
-
├── _datatable.scss
|
|
24
|
-
├── _daterange.scss
|
|
25
|
-
├── _dialog.scss
|
|
26
|
-
├── _drawer.scss
|
|
27
|
-
├── _filterpanel.scss
|
|
28
|
-
├── _input-overrides.scss
|
|
29
|
-
├── _message-panel.scss
|
|
30
|
-
├── _number-input.scss
|
|
31
|
-
├── _number-unit-input.scss
|
|
32
|
-
├── _preference-manager.scss
|
|
33
|
-
├── _select-filter.scss
|
|
34
|
-
├── _status-indicators.scss
|
|
35
|
-
└── _wysiwyg.scss
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Import Flow
|
|
39
|
-
|
|
40
|
-
### New Structure (Simplified)
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
ngx-stoui.scss
|
|
44
|
-
└─> styles/index.scss
|
|
45
|
-
├─> _tokens.scss (CSS variables)
|
|
46
|
-
├─> _material-theme.scss (Material 3)
|
|
47
|
-
├─> _typography.scss (Typography scales)
|
|
48
|
-
├─> _utilities.scss (Grid utilities)
|
|
49
|
-
├─> fonts/_fonts.scss (Font loading)
|
|
50
|
-
└─> components/_index.scss
|
|
51
|
-
└─> All component files
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Old Structure (Complex)
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
ngx-stoui.scss
|
|
58
|
-
└─> style/theme/_theme.scss
|
|
59
|
-
├─> _colors.scss (M2 palettes)
|
|
60
|
-
├─> _theme-variables.scss (M2 functions)
|
|
61
|
-
├─> components.scss
|
|
62
|
-
│ └─> 21 individual component imports
|
|
63
|
-
└─> Circular dependencies
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Key Files
|
|
67
|
-
|
|
68
|
-
### `index.scss` - Main Entry Point
|
|
69
|
-
|
|
70
|
-
Single file to import for all styles. Automatically includes:
|
|
71
|
-
|
|
72
|
-
- Design tokens
|
|
73
|
-
- Material theme
|
|
74
|
-
- Typography
|
|
75
|
-
- Utilities
|
|
76
|
-
- Component styles
|
|
77
|
-
|
|
78
|
-
**Usage:**
|
|
79
|
-
|
|
80
|
-
```scss
|
|
81
|
-
@use './styles' as *;
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### `_tokens.scss` - Design System Tokens
|
|
85
|
-
|
|
86
|
-
**Single source of truth** for all CSS variables:
|
|
87
|
-
|
|
88
|
-
- Light theme colors (`:root`, `body:not(.sto-dark-theme)`)
|
|
89
|
-
- Dark theme colors (`body.sto-dark-theme`)
|
|
90
|
-
- EDS (Equinor Design System) SCSS maps
|
|
91
|
-
- No dependencies
|
|
92
|
-
|
|
93
|
-
**Available CSS Variables:**
|
|
94
|
-
|
|
95
|
-
```scss
|
|
96
|
-
// Primary colors
|
|
97
|
-
--primary-resting, --primary-hover, --primary-text
|
|
98
|
-
|
|
99
|
-
// Accent colors
|
|
100
|
-
--accent-resting, --accent-hover, --accent-text
|
|
101
|
-
|
|
102
|
-
// Status colors
|
|
103
|
-
--success-*, --danger-*, --warning-*
|
|
104
|
-
|
|
105
|
-
// Text colors
|
|
106
|
-
--text, --text-secondary, --text-tertiary, --text-disabled
|
|
107
|
-
|
|
108
|
-
// Background colors
|
|
109
|
-
--bg-default, --bg-app, --bg-card, --bg-hover, --bg-focus
|
|
110
|
-
|
|
111
|
-
// UI elements
|
|
112
|
-
--divider, --border-disabled
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### `_material-theme.scss` - Material 3 Configuration
|
|
116
|
-
|
|
117
|
-
Material Design 3 theme setup with `mat.define-theme()`:
|
|
118
|
-
|
|
119
|
-
- Azure/blue color scheme
|
|
120
|
-
- Component theme includes
|
|
121
|
-
- CSS variable overrides for Material components
|
|
122
|
-
|
|
123
|
-
**Mixin:**
|
|
124
|
-
|
|
125
|
-
```scss
|
|
126
|
-
@include material-theme.apply-material-theme();
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### `_typography.scss` - Typography Scales
|
|
130
|
-
|
|
131
|
-
Three typography hierarchies:
|
|
132
|
-
|
|
133
|
-
- `$sto-typography` - Normal scale (13px base)
|
|
134
|
-
- `$sto-sm-typography` - Small scale (10px base)
|
|
135
|
-
- `$sto-l-typography` - Large scale (16px base)
|
|
136
|
-
|
|
137
|
-
**Mixin:**
|
|
138
|
-
|
|
139
|
-
```scss
|
|
140
|
-
@include typography.apply-typography();
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### `_utilities.scss` - Utility Classes
|
|
144
|
-
|
|
145
|
-
Flexible grid system and helper classes:
|
|
146
|
-
|
|
147
|
-
- `.sto-grid` - Responsive grid using CSS Container Queries (auto 1→2→4 columns based on container width)
|
|
148
|
-
- `.sto-grid--{n}` - Fixed column layouts (`--1`, `--2`, `--3`, `--4`, `--6`, `--12`) that override responsive behavior
|
|
149
|
-
- `.sto-grid__col` - Grid column with span modifiers (`--2`, `--3`, `--4`)
|
|
150
|
-
- `.sto-grid__col--spacer` - Hidden spacer column for layout alignment
|
|
151
|
-
|
|
152
|
-
### `components/_index.scss` - Component Barrel
|
|
153
|
-
|
|
154
|
-
Imports all component styles and provides single mixin:
|
|
155
|
-
|
|
156
|
-
```scss
|
|
157
|
-
@include components.apply-component-styles();
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
## Migration from Old Structure
|
|
161
|
-
|
|
162
|
-
### What Changed?
|
|
163
|
-
|
|
164
|
-
1. **Folder Name**: `style/` → `styles/` (avoids Windows permission issues)
|
|
165
|
-
|
|
166
|
-
2. **Import Chain**:
|
|
167
|
-
- Old: 4-5 levels deep with circular dependencies
|
|
168
|
-
- New: Flat structure, clear hierarchy
|
|
169
|
-
|
|
170
|
-
3. **CSS Variables**:
|
|
171
|
-
- Old: Duplicated in `ngx-stoui.scss` and `_colors.scss`
|
|
172
|
-
- New: Single source in `_tokens.scss`
|
|
173
|
-
|
|
174
|
-
4. **Material Theme**:
|
|
175
|
-
- Old: Material 2 with palette extraction
|
|
176
|
-
- New: Material 3 with direct theme definition
|
|
177
|
-
|
|
178
|
-
5. **Component Organization**:
|
|
179
|
-
- Old: Nested in `style/theme/` with barrel file
|
|
180
|
-
- New: Flat in `styles/components/` with barrel file
|
|
181
|
-
|
|
182
|
-
### Migration Status
|
|
183
|
-
|
|
184
|
-
✅ **Completed:**
|
|
185
|
-
|
|
186
|
-
- Created new `styles/` folder structure
|
|
187
|
-
- Migrated all 16 component files from `style/theme/`
|
|
188
|
-
- Migrated form styles from `style/form/`
|
|
189
|
-
- Migrated datatable styles from `style/datatable/`
|
|
190
|
-
- Centralized CSS variables in `_tokens.scss`
|
|
191
|
-
- Converted to Material 3 in `_material-theme.scss`
|
|
192
|
-
- Updated `ngx-stoui.scss` to use new structure
|
|
193
|
-
- Removed all legacy imports
|
|
194
|
-
- Build successful
|
|
195
|
-
- Lint passing
|
|
196
|
-
|
|
197
|
-
✅ **Migration Complete!** All files have been moved to the new structure. The old `style/` folder can now be removed.
|
|
198
|
-
|
|
199
|
-
### Old `style/` Folder (Deprecated)
|
|
200
|
-
|
|
201
|
-
The old `style/` folder is now deprecated and can be safely deleted. All styles have been migrated to the new `styles/` structure.
|
|
202
|
-
|
|
203
|
-
## Best Practices
|
|
204
|
-
|
|
205
|
-
### 1. Use CSS Variables Directly
|
|
206
|
-
|
|
207
|
-
```scss
|
|
208
|
-
// ✅ CORRECT
|
|
209
|
-
.my-component {
|
|
210
|
-
color: var(--text);
|
|
211
|
-
background: var(--bg-card);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// ❌ AVOID (old pattern)
|
|
215
|
-
.my-component {
|
|
216
|
-
color: $text-color; // SCSS variable wrapper
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### 2. Component Styles
|
|
221
|
-
|
|
222
|
-
Component files should export mixins:
|
|
223
|
-
|
|
224
|
-
```scss
|
|
225
|
-
@mixin my-component-theme() {
|
|
226
|
-
.my-component {
|
|
227
|
-
border: 1px solid var(--divider);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### 3. Import Order
|
|
233
|
-
|
|
234
|
-
When creating new files, follow this order:
|
|
235
|
-
|
|
236
|
-
```scss
|
|
237
|
-
// 1. Design tokens (if needed)
|
|
238
|
-
@use '../tokens';
|
|
239
|
-
|
|
240
|
-
// 2. Material dependencies (if needed)
|
|
241
|
-
@use '@angular/material' as mat;
|
|
242
|
-
|
|
243
|
-
// 3. Component styles
|
|
244
|
-
@mixin my-component-theme() {
|
|
245
|
-
// styles here
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### 4. Flat Structure
|
|
250
|
-
|
|
251
|
-
Keep component files flat - avoid nesting:
|
|
252
|
-
|
|
253
|
-
- `components/_my-component.scss` ✅
|
|
254
|
-
- `components/feature/_my-component.scss` ❌
|
|
255
|
-
|
|
256
|
-
## Benefits
|
|
257
|
-
|
|
258
|
-
1. **Discoverability**: Easy to find where styles are defined
|
|
259
|
-
2. **No Circular Dependencies**: Clear import hierarchy
|
|
260
|
-
3. **Single Source of Truth**: CSS variables in one place
|
|
261
|
-
4. **Modern Material**: Material 3 API
|
|
262
|
-
5. **Clean Separation**: Tokens, theme, typography, components
|
|
263
|
-
6. **Easy Debugging**: Flat structure, clear file names
|
|
264
|
-
7. **Performance**: Removed duplicate CSS variable definitions
|
|
265
|
-
|
|
266
|
-
## Future Improvements
|
|
267
|
-
|
|
268
|
-
1. Migrate `style/form/` to `styles/forms/`
|
|
269
|
-
2. Migrate `style/datatable/` to `styles/components/datatable/`
|
|
270
|
-
3. Convert remaining `@import` to `@use`/`@forward`
|
|
271
|
-
4. Remove old `style/` folder
|
|
272
|
-
5. Add Storybook integration for design tokens
|
|
273
|
-
6. Document CSS variable usage in component stories
|
|
1
|
+
# Styles Folder Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The new `styles/` directory provides a clean, intuitive structure that eliminates the complex import chains of the old `style/` folder. All CSS variables are centralized, and the import path is straightforward.
|
|
6
|
+
|
|
7
|
+
## Directory Structure
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
styles/
|
|
11
|
+
├── index.scss # Main entry point (import this!)
|
|
12
|
+
├── _tokens.scss # Design system tokens and CSS variables
|
|
13
|
+
├── _material-theme.scss # Material 3 theme configuration
|
|
14
|
+
├── _typography.scss # Typography scales (normal, small, large)
|
|
15
|
+
├── _utilities.scss # Utility classes (grid, helpers)
|
|
16
|
+
├── fonts/
|
|
17
|
+
│ └── _fonts.scss # Font loading from CDN
|
|
18
|
+
└── components/
|
|
19
|
+
├── _index.scss # Component barrel file
|
|
20
|
+
├── _action-footer.scss # Individual component styles
|
|
21
|
+
├── _appheader.scss
|
|
22
|
+
├── _card.scss
|
|
23
|
+
├── _datatable.scss
|
|
24
|
+
├── _daterange.scss
|
|
25
|
+
├── _dialog.scss
|
|
26
|
+
├── _drawer.scss
|
|
27
|
+
├── _filterpanel.scss
|
|
28
|
+
├── _input-overrides.scss
|
|
29
|
+
├── _message-panel.scss
|
|
30
|
+
├── _number-input.scss
|
|
31
|
+
├── _number-unit-input.scss
|
|
32
|
+
├── _preference-manager.scss
|
|
33
|
+
├── _select-filter.scss
|
|
34
|
+
├── _status-indicators.scss
|
|
35
|
+
└── _wysiwyg.scss
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Import Flow
|
|
39
|
+
|
|
40
|
+
### New Structure (Simplified)
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
ngx-stoui.scss
|
|
44
|
+
└─> styles/index.scss
|
|
45
|
+
├─> _tokens.scss (CSS variables)
|
|
46
|
+
├─> _material-theme.scss (Material 3)
|
|
47
|
+
├─> _typography.scss (Typography scales)
|
|
48
|
+
├─> _utilities.scss (Grid utilities)
|
|
49
|
+
├─> fonts/_fonts.scss (Font loading)
|
|
50
|
+
└─> components/_index.scss
|
|
51
|
+
└─> All component files
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Old Structure (Complex)
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
ngx-stoui.scss
|
|
58
|
+
└─> style/theme/_theme.scss
|
|
59
|
+
├─> _colors.scss (M2 palettes)
|
|
60
|
+
├─> _theme-variables.scss (M2 functions)
|
|
61
|
+
├─> components.scss
|
|
62
|
+
│ └─> 21 individual component imports
|
|
63
|
+
└─> Circular dependencies
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Key Files
|
|
67
|
+
|
|
68
|
+
### `index.scss` - Main Entry Point
|
|
69
|
+
|
|
70
|
+
Single file to import for all styles. Automatically includes:
|
|
71
|
+
|
|
72
|
+
- Design tokens
|
|
73
|
+
- Material theme
|
|
74
|
+
- Typography
|
|
75
|
+
- Utilities
|
|
76
|
+
- Component styles
|
|
77
|
+
|
|
78
|
+
**Usage:**
|
|
79
|
+
|
|
80
|
+
```scss
|
|
81
|
+
@use './styles' as *;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### `_tokens.scss` - Design System Tokens
|
|
85
|
+
|
|
86
|
+
**Single source of truth** for all CSS variables:
|
|
87
|
+
|
|
88
|
+
- Light theme colors (`:root`, `body:not(.sto-dark-theme)`)
|
|
89
|
+
- Dark theme colors (`body.sto-dark-theme`)
|
|
90
|
+
- EDS (Equinor Design System) SCSS maps
|
|
91
|
+
- No dependencies
|
|
92
|
+
|
|
93
|
+
**Available CSS Variables:**
|
|
94
|
+
|
|
95
|
+
```scss
|
|
96
|
+
// Primary colors
|
|
97
|
+
--primary-resting, --primary-hover, --primary-text
|
|
98
|
+
|
|
99
|
+
// Accent colors
|
|
100
|
+
--accent-resting, --accent-hover, --accent-text
|
|
101
|
+
|
|
102
|
+
// Status colors
|
|
103
|
+
--success-*, --danger-*, --warning-*
|
|
104
|
+
|
|
105
|
+
// Text colors
|
|
106
|
+
--text, --text-secondary, --text-tertiary, --text-disabled
|
|
107
|
+
|
|
108
|
+
// Background colors
|
|
109
|
+
--bg-default, --bg-app, --bg-card, --bg-hover, --bg-focus
|
|
110
|
+
|
|
111
|
+
// UI elements
|
|
112
|
+
--divider, --border-disabled
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `_material-theme.scss` - Material 3 Configuration
|
|
116
|
+
|
|
117
|
+
Material Design 3 theme setup with `mat.define-theme()`:
|
|
118
|
+
|
|
119
|
+
- Azure/blue color scheme
|
|
120
|
+
- Component theme includes
|
|
121
|
+
- CSS variable overrides for Material components
|
|
122
|
+
|
|
123
|
+
**Mixin:**
|
|
124
|
+
|
|
125
|
+
```scss
|
|
126
|
+
@include material-theme.apply-material-theme();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### `_typography.scss` - Typography Scales
|
|
130
|
+
|
|
131
|
+
Three typography hierarchies:
|
|
132
|
+
|
|
133
|
+
- `$sto-typography` - Normal scale (13px base)
|
|
134
|
+
- `$sto-sm-typography` - Small scale (10px base)
|
|
135
|
+
- `$sto-l-typography` - Large scale (16px base)
|
|
136
|
+
|
|
137
|
+
**Mixin:**
|
|
138
|
+
|
|
139
|
+
```scss
|
|
140
|
+
@include typography.apply-typography();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `_utilities.scss` - Utility Classes
|
|
144
|
+
|
|
145
|
+
Flexible grid system and helper classes:
|
|
146
|
+
|
|
147
|
+
- `.sto-grid` - Responsive grid using CSS Container Queries (auto 1→2→4 columns based on container width)
|
|
148
|
+
- `.sto-grid--{n}` - Fixed column layouts (`--1`, `--2`, `--3`, `--4`, `--6`, `--12`) that override responsive behavior
|
|
149
|
+
- `.sto-grid__col` - Grid column with span modifiers (`--2`, `--3`, `--4`)
|
|
150
|
+
- `.sto-grid__col--spacer` - Hidden spacer column for layout alignment
|
|
151
|
+
|
|
152
|
+
### `components/_index.scss` - Component Barrel
|
|
153
|
+
|
|
154
|
+
Imports all component styles and provides single mixin:
|
|
155
|
+
|
|
156
|
+
```scss
|
|
157
|
+
@include components.apply-component-styles();
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Migration from Old Structure
|
|
161
|
+
|
|
162
|
+
### What Changed?
|
|
163
|
+
|
|
164
|
+
1. **Folder Name**: `style/` → `styles/` (avoids Windows permission issues)
|
|
165
|
+
|
|
166
|
+
2. **Import Chain**:
|
|
167
|
+
- Old: 4-5 levels deep with circular dependencies
|
|
168
|
+
- New: Flat structure, clear hierarchy
|
|
169
|
+
|
|
170
|
+
3. **CSS Variables**:
|
|
171
|
+
- Old: Duplicated in `ngx-stoui.scss` and `_colors.scss`
|
|
172
|
+
- New: Single source in `_tokens.scss`
|
|
173
|
+
|
|
174
|
+
4. **Material Theme**:
|
|
175
|
+
- Old: Material 2 with palette extraction
|
|
176
|
+
- New: Material 3 with direct theme definition
|
|
177
|
+
|
|
178
|
+
5. **Component Organization**:
|
|
179
|
+
- Old: Nested in `style/theme/` with barrel file
|
|
180
|
+
- New: Flat in `styles/components/` with barrel file
|
|
181
|
+
|
|
182
|
+
### Migration Status
|
|
183
|
+
|
|
184
|
+
✅ **Completed:**
|
|
185
|
+
|
|
186
|
+
- Created new `styles/` folder structure
|
|
187
|
+
- Migrated all 16 component files from `style/theme/`
|
|
188
|
+
- Migrated form styles from `style/form/`
|
|
189
|
+
- Migrated datatable styles from `style/datatable/`
|
|
190
|
+
- Centralized CSS variables in `_tokens.scss`
|
|
191
|
+
- Converted to Material 3 in `_material-theme.scss`
|
|
192
|
+
- Updated `ngx-stoui.scss` to use new structure
|
|
193
|
+
- Removed all legacy imports
|
|
194
|
+
- Build successful
|
|
195
|
+
- Lint passing
|
|
196
|
+
|
|
197
|
+
✅ **Migration Complete!** All files have been moved to the new structure. The old `style/` folder can now be removed.
|
|
198
|
+
|
|
199
|
+
### Old `style/` Folder (Deprecated)
|
|
200
|
+
|
|
201
|
+
The old `style/` folder is now deprecated and can be safely deleted. All styles have been migrated to the new `styles/` structure.
|
|
202
|
+
|
|
203
|
+
## Best Practices
|
|
204
|
+
|
|
205
|
+
### 1. Use CSS Variables Directly
|
|
206
|
+
|
|
207
|
+
```scss
|
|
208
|
+
// ✅ CORRECT
|
|
209
|
+
.my-component {
|
|
210
|
+
color: var(--text);
|
|
211
|
+
background: var(--bg-card);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// ❌ AVOID (old pattern)
|
|
215
|
+
.my-component {
|
|
216
|
+
color: $text-color; // SCSS variable wrapper
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 2. Component Styles
|
|
221
|
+
|
|
222
|
+
Component files should export mixins:
|
|
223
|
+
|
|
224
|
+
```scss
|
|
225
|
+
@mixin my-component-theme() {
|
|
226
|
+
.my-component {
|
|
227
|
+
border: 1px solid var(--divider);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 3. Import Order
|
|
233
|
+
|
|
234
|
+
When creating new files, follow this order:
|
|
235
|
+
|
|
236
|
+
```scss
|
|
237
|
+
// 1. Design tokens (if needed)
|
|
238
|
+
@use '../tokens';
|
|
239
|
+
|
|
240
|
+
// 2. Material dependencies (if needed)
|
|
241
|
+
@use '@angular/material' as mat;
|
|
242
|
+
|
|
243
|
+
// 3. Component styles
|
|
244
|
+
@mixin my-component-theme() {
|
|
245
|
+
// styles here
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### 4. Flat Structure
|
|
250
|
+
|
|
251
|
+
Keep component files flat - avoid nesting:
|
|
252
|
+
|
|
253
|
+
- `components/_my-component.scss` ✅
|
|
254
|
+
- `components/feature/_my-component.scss` ❌
|
|
255
|
+
|
|
256
|
+
## Benefits
|
|
257
|
+
|
|
258
|
+
1. **Discoverability**: Easy to find where styles are defined
|
|
259
|
+
2. **No Circular Dependencies**: Clear import hierarchy
|
|
260
|
+
3. **Single Source of Truth**: CSS variables in one place
|
|
261
|
+
4. **Modern Material**: Material 3 API
|
|
262
|
+
5. **Clean Separation**: Tokens, theme, typography, components
|
|
263
|
+
6. **Easy Debugging**: Flat structure, clear file names
|
|
264
|
+
7. **Performance**: Removed duplicate CSS variable definitions
|
|
265
|
+
|
|
266
|
+
## Future Improvements
|
|
267
|
+
|
|
268
|
+
1. Migrate `style/form/` to `styles/forms/`
|
|
269
|
+
2. Migrate `style/datatable/` to `styles/components/datatable/`
|
|
270
|
+
3. Convert remaining `@import` to `@use`/`@forward`
|
|
271
|
+
4. Remove old `style/` folder
|
|
272
|
+
5. Add Storybook integration for design tokens
|
|
273
|
+
6. Document CSS variable usage in component stories
|