@salesforce/afv-skills 1.5.2 → 1.6.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.
Files changed (34) hide show
  1. package/README.md +5 -6
  2. package/package.json +3 -3
  3. package/skills/generating-apex/SKILL.md +16 -9
  4. package/skills/generating-apex/assets/abstract.cls +0 -1
  5. package/skills/generating-apex/assets/batch.cls +0 -1
  6. package/skills/generating-apex/assets/domain.cls +0 -1
  7. package/skills/generating-apex/assets/dto.cls +0 -1
  8. package/skills/generating-apex/assets/exception.cls +0 -1
  9. package/skills/generating-apex/assets/interface.cls +0 -1
  10. package/skills/generating-apex/assets/invocable.cls +0 -1
  11. package/skills/generating-apex/assets/queueable.cls +0 -1
  12. package/skills/generating-apex/assets/schedulable.cls +0 -1
  13. package/skills/generating-apex/assets/selector.cls +0 -1
  14. package/skills/generating-apex/assets/service.cls +0 -1
  15. package/skills/generating-apex/assets/trigger.cls +1 -1
  16. package/skills/generating-apex/assets/utility.cls +0 -1
  17. package/skills/generating-apex/references/AccountDeduplicationBatch.cls +0 -1
  18. package/skills/generating-apex/references/AccountSelector.cls +0 -1
  19. package/skills/generating-apex/references/AccountService.cls +0 -1
  20. package/skills/generating-apex-test/assets/test-class-template.cls +3 -3
  21. package/skills/generating-apex-test/references/assertion-patterns.md +1 -1
  22. package/skills/generating-apex-test/references/async-testing.md +1 -1
  23. package/skills/generating-experience-lwr-site/SKILL.md +1 -2
  24. package/skills/generating-experience-lwr-site/docs/configure-content-themeLayout.md +8 -5
  25. package/skills/uplifting-components-to-slds2/SKILL.md +236 -0
  26. package/skills/uplifting-components-to-slds2/references/color-hooks-decision-guide.md +438 -0
  27. package/skills/uplifting-components-to-slds2/references/common-patterns.md +87 -0
  28. package/skills/uplifting-components-to-slds2/references/examples.md +443 -0
  29. package/skills/uplifting-components-to-slds2/references/migration-checklist.md +67 -0
  30. package/skills/uplifting-components-to-slds2/references/non-color-hooks-decision-guide.md +333 -0
  31. package/skills/uplifting-components-to-slds2/references/rule-lwc-token-to-slds-hook.md +135 -0
  32. package/skills/uplifting-components-to-slds2/references/rule-no-deprecated-tokens-slds1.md +211 -0
  33. package/skills/uplifting-components-to-slds2/references/rule-no-hardcoded-values.md +160 -0
  34. package/skills/uplifting-components-to-slds2/references/rule-no-slds-class-overrides.md +126 -0
@@ -0,0 +1,443 @@
1
+ # SLDS Migration Examples
2
+
3
+ Before/after examples organized by violation type.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Class Override Example](#class-override-example)
8
+ - [LWC Token Example](#lwc-token-example)
9
+ - [Hardcoded Value Examples](#hardcoded-value-examples)
10
+ - [Aura t() Token Migration](#aura-t-token-migration)
11
+ - [Deprecated Class Removal](#deprecated-class-removal)
12
+ - [Color-Mix with Transparency](#color-mix-with-transparency)
13
+ - [calc() with Legacy Tokens](#calc-with-legacy-tokens)
14
+ - [Tokens with No SLDS 2 Equivalent](#tokens-with-no-slds-2-equivalent)
15
+ - [Multi-File End-to-End (Aura)](#multi-file-end-to-end-aura)
16
+
17
+ ---
18
+
19
+ ## Class Override Example
20
+
21
+ **Violation:**
22
+ ```
23
+ dataTable.css
24
+ 5:1 warning Overriding slds-table isn't supported. To differentiate SLDS and
25
+ custom classes, create a CSS class in your namespace.
26
+ Examples: myapp-input, myapp-button. slds/no-slds-class-overrides
27
+ 12:1 warning Overriding slds-button isn't supported... slds/no-slds-class-overrides
28
+ ```
29
+
30
+ **Before:**
31
+ ```css
32
+ .slds-table {
33
+ border-collapse: separate;
34
+ border-spacing: 0;
35
+ }
36
+
37
+ .slds-table .slds-button {
38
+ padding: 0.5rem 1rem;
39
+ }
40
+ ```
41
+
42
+ ```html
43
+ <table class="slds-table">
44
+ <tr><td><button class="slds-button">Edit</button></td></tr>
45
+ </table>
46
+ ```
47
+
48
+ **After:**
49
+ ```css
50
+ .dataTable-table {
51
+ border-collapse: separate;
52
+ border-spacing: 0;
53
+ }
54
+
55
+ .dataTable-table .dataTable-button {
56
+ padding: 0.5rem 1rem;
57
+ }
58
+ ```
59
+
60
+ ```html
61
+ <table class="slds-table dataTable-table">
62
+ <tr><td><button class="slds-button dataTable-button">Edit</button></td></tr>
63
+ </table>
64
+ ```
65
+
66
+ ---
67
+
68
+ ## LWC Token Example
69
+
70
+ **Violation:**
71
+ ```
72
+ panelHeader.css
73
+ 3:3 error The '--lwc-colorBackgroundAlt' design token is deprecated. Replace it with
74
+ the SLDS 2 styling hook and set the fallback to '--lwc-colorBackgroundAlt'.
75
+ 1. --slds-g-color-surface-2
76
+ 2. --slds-g-color-surface-container-2 slds/lwc-token-to-slds-hook
77
+ ```
78
+
79
+ **Before:**
80
+ ```css
81
+ .header-bar {
82
+ background-color: var(--lwc-colorBackgroundAlt);
83
+ }
84
+ ```
85
+
86
+ ```html
87
+ <div class="THIS">
88
+ <div class="header-bar">Settings</div>
89
+ <div class="panel-content">...</div>
90
+ </div>
91
+ ```
92
+
93
+ **Context:** `.header-bar` is a section within the component → choose container.
94
+
95
+ **After:**
96
+ ```css
97
+ .header-bar {
98
+ background-color: var(--slds-g-color-surface-container-2, var(--lwc-colorBackgroundAlt));
99
+ }
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Hardcoded Value Examples
105
+
106
+ ### Tile with Border and Spacing
107
+
108
+ **Violation:**
109
+ ```
110
+ tile.css
111
+ 2:20 warning Consider replacing the #ffffff static value with an SLDS 2 styling hook
112
+ that has a similar value:
113
+ 1. --slds-g-color-surface-1
114
+ 2. --slds-g-color-surface-container-1
115
+ 3. --slds-g-color-on-accent-1
116
+ 4. --slds-g-color-on-accent-2
117
+ 5. --slds-g-color-on-accent-3 slds/no-hardcoded-values-slds2
118
+ ```
119
+
120
+ **Before:**
121
+ ```css
122
+ .info-tile {
123
+ background-color: #ffffff;
124
+ border: 1px solid #e5e5e5;
125
+ padding: 1rem;
126
+ }
127
+ ```
128
+
129
+ **Context:** Tile is a container sitting on a page surface → choose `surface-container-1` from the list.
130
+
131
+ **After:**
132
+ ```css
133
+ .info-tile {
134
+ background-color: var(--slds-g-color-surface-container-1, #ffffff);
135
+ border: var(--slds-g-sizing-border-1, 1px) solid var(--slds-g-color-border-1, #e5e5e5);
136
+ padding: var(--slds-g-spacing-4, 1rem);
137
+ }
138
+ ```
139
+
140
+ ### Link Colors
141
+
142
+ **Before:**
143
+ ```css
144
+ .nav-link {
145
+ color: #0176d3;
146
+ }
147
+
148
+ .nav-link:hover {
149
+ color: #014486;
150
+ }
151
+ ```
152
+
153
+ **Context:** Links are interactive → accent family. Default = accent-2 (accessible). Hover goes one up: accent-3.
154
+
155
+ **After:**
156
+ ```css
157
+ .nav-link {
158
+ color: var(--slds-g-color-accent-2, #0176d3);
159
+ }
160
+
161
+ .nav-link:hover {
162
+ color: var(--slds-g-color-accent-3, #014486);
163
+ }
164
+ ```
165
+
166
+ ### Alert Validation States
167
+
168
+ **Before:**
169
+ ```css
170
+ .alert-error {
171
+ border-color: #c23934;
172
+ background: #fddde3;
173
+ }
174
+
175
+ .alert-error-text {
176
+ color: #c23934;
177
+ font-size: 12px;
178
+ }
179
+
180
+ .alert-success {
181
+ border-color: #4bca81;
182
+ }
183
+ ```
184
+
185
+ **After:**
186
+ ```css
187
+ .alert-error {
188
+ border-color: var(--slds-g-color-border-error-1, #c23934);
189
+ background: var(--slds-g-color-error-container-1, #fddde3);
190
+ }
191
+
192
+ .alert-error-text {
193
+ color: var(--slds-g-color-on-error-1, #c23934);
194
+ font-size: var(--slds-g-font-scale-neg-1, 12px);
195
+ }
196
+
197
+ .alert-success {
198
+ border-color: var(--slds-g-color-border-success-1, #4bca81);
199
+ }
200
+ ```
201
+
202
+ ### Brand Icon with Accent Background
203
+
204
+ **Before:**
205
+ ```css
206
+ .icon-container {
207
+ width: 2rem;
208
+ height: 2rem;
209
+ background-color: #066AFE;
210
+ }
211
+
212
+ .account-icon {
213
+ fill: #FFFFFF;
214
+ }
215
+ ```
216
+
217
+ **Context:** Blue background with white icon = brand element → accent family. `on-accent` pairs with `accent-container`.
218
+
219
+ **After:**
220
+ ```css
221
+ .icon-container {
222
+ width: var(--slds-g-sizing-9, 2rem);
223
+ height: var(--slds-g-sizing-9, 2rem);
224
+ background-color: var(--slds-g-color-accent-container-1, #066AFE);
225
+ }
226
+
227
+ .account-icon {
228
+ fill: var(--slds-g-color-on-accent-1, #FFFFFF);
229
+ }
230
+ ```
231
+
232
+ ### Profile Header — Spacing, Typography, and Shadow
233
+
234
+ **Before:**
235
+ ```css
236
+ .profile-header {
237
+ padding: 1.5rem;
238
+ border-radius: 0.75rem;
239
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
240
+ }
241
+
242
+ .profile-name {
243
+ font-size: 18px;
244
+ font-weight: 700;
245
+ line-height: 1.25;
246
+ margin-bottom: 0.5rem;
247
+ }
248
+
249
+ .profile-role {
250
+ font-size: 14px;
251
+ font-weight: 400;
252
+ line-height: 1.5;
253
+ }
254
+ ```
255
+
256
+ **After:**
257
+ ```css
258
+ .profile-header {
259
+ padding: var(--slds-g-spacing-5, 1.5rem);
260
+ border-radius: var(--slds-g-radius-border-3, 0.75rem);
261
+ box-shadow: var(--slds-g-shadow-1, 0 2px 4px rgba(0,0,0,0.1));
262
+ }
263
+
264
+ .profile-name {
265
+ font-size: var(--slds-g-font-scale-4, 18px);
266
+ font-weight: var(--slds-g-font-weight-7, 700);
267
+ line-height: var(--slds-g-font-lineheight-2, 1.25);
268
+ margin-bottom: var(--slds-g-spacing-2, 0.5rem);
269
+ }
270
+
271
+ .profile-role {
272
+ font-size: var(--slds-g-font-scale-1, 14px);
273
+ font-weight: var(--slds-g-font-weight-4, 400);
274
+ line-height: var(--slds-g-font-lineheight-4, 1.5);
275
+ }
276
+ ```
277
+
278
+ ### Search Input — Border and Focus
279
+
280
+ **Before:**
281
+ ```css
282
+ .search-input {
283
+ border: 1px solid #ccc;
284
+ border-radius: 0.5rem;
285
+ padding: 0.5rem 0.75rem;
286
+ font-size: 14px;
287
+ }
288
+
289
+ .search-input:focus {
290
+ border-width: 3px;
291
+ }
292
+ ```
293
+
294
+ **After:**
295
+ ```css
296
+ .search-input {
297
+ border: var(--slds-g-sizing-border-1, 1px) solid var(--slds-g-color-border-2, #ccc);
298
+ border-radius: var(--slds-g-radius-border-2, 0.5rem);
299
+ padding: var(--slds-g-spacing-2, 0.5rem) var(--slds-g-spacing-3, 0.75rem);
300
+ font-size: var(--slds-g-font-scale-1, 14px);
301
+ }
302
+
303
+ .search-input:focus {
304
+ border-width: var(--slds-g-sizing-border-3, 3px);
305
+ }
306
+ ```
307
+
308
+ ### What NOT to Replace
309
+
310
+ Layout values (`100%`, `auto`, `0`, `flex: 1`, `none`), animation properties, opacity, and overlay alpha values (`rgba(0,0,0,0.5)`) should remain unchanged. See [rule-no-hardcoded-values.md](rule-no-hardcoded-values.md) for the full list.
311
+
312
+ ---
313
+
314
+ ## Aura t() Token Migration
315
+
316
+ **Before:**
317
+ ```css
318
+ .THIS .stepTitle {
319
+ color: t(colorTextPlaceholder);
320
+ font-size: t(fontSizeMedium);
321
+ padding: t(spacingSmall);
322
+ }
323
+ ```
324
+
325
+ **After:**
326
+ ```css
327
+ .THIS .stepTitle {
328
+ color: var(--slds-g-color-on-surface-2, var(--lwc-colorTextPlaceholder));
329
+ font-size: var(--slds-g-font-scale-2, var(--lwc-fontSizeMedium));
330
+ padding: var(--slds-g-spacing-3, var(--lwc-spacingSmall));
331
+ }
332
+ ```
333
+
334
+ **Why these hooks:** `colorTextPlaceholder` maps to `on-surface-2` (muted foreground text). `fontSizeMedium` maps to `font-scale-2` (1rem). `spacingSmall` maps to `spacing-3` (0.75rem). See [rule-no-deprecated-tokens-slds1.md](rule-no-deprecated-tokens-slds1.md) for all token mappings.
335
+
336
+ ---
337
+
338
+ ## Deprecated Class Removal
339
+
340
+ **Before (`.cmp`):**
341
+ ```html
342
+ <span class="slds-icon_container slds-icon-utility-error">
343
+ <lightning:icon iconName="utility:error" />
344
+ </span>
345
+ ```
346
+
347
+ **After:**
348
+ ```html
349
+ <span class="slds-icon_container">
350
+ <lightning:icon iconName="utility:error" />
351
+ </span>
352
+ ```
353
+
354
+ **Why remove:** `slds-icon-utility-*` classes are removed in SLDS 2. The `<lightning:icon>` component applies its own styling via `iconName`. Keeping the deprecated class causes linter errors and has no visual effect.
355
+
356
+ ---
357
+
358
+ ## Color-Mix with Transparency
359
+
360
+ **Before:**
361
+ ```css
362
+ .THIS .errorBorder { border: 2px solid rgba(186, 5, 23, 0.7); }
363
+ ```
364
+
365
+ **After:**
366
+ ```css
367
+ .THIS .errorBorder {
368
+ border: var(--slds-g-sizing-border-2, 2px) solid color-mix(in oklab, var(--slds-g-color-palette-red-40, rgb(181,54,45)), transparent 30%);
369
+ }
370
+ ```
371
+
372
+ **Why color-mix:** `rgba()` can't wrap a CSS variable for the color component alone. `color-mix(in oklab, ...)` lets you apply transparency to the hook's resolved value at runtime. Formula: X% opacity = (100-X)% transparent. Use opaque `rgb()` fallback to avoid double transparency when both `color-mix` and `rgba` are applied.
373
+
374
+ ---
375
+
376
+ ## calc() with Legacy Tokens
377
+
378
+ **Before:**
379
+ ```css
380
+ height: t('calc(' + lineHeightButton + ' + 2px)');
381
+ ```
382
+
383
+ **After (if calc needed):**
384
+ ```css
385
+ height: calc(var(--lwc-lineHeightButton) + 2px);
386
+ ```
387
+
388
+ **Simplified (try first):**
389
+ ```css
390
+ height: var(--lwc-lineHeightButton);
391
+ ```
392
+
393
+ **Why simplify:** The `+ 2px` in legacy `t()` calc expressions was often a workaround for rendering inconsistencies. Try without it first — if the component renders correctly, the simpler form is preferred.
394
+
395
+ ---
396
+
397
+ ## Tokens with No SLDS 2 Equivalent
398
+
399
+ ```css
400
+ /* Before */
401
+ z-index: var(--lwc-zIndexSticky);
402
+ transition: opacity var(--slds-g-duration-slowly, var(--lwc-durationSlowly)) ease-in-out;
403
+
404
+ /* After — z-index: hardcoded, duration: --lwc-* directly */
405
+ z-index: 9000;
406
+ transition: opacity var(--lwc-durationSlowly) ease-in-out;
407
+ ```
408
+
409
+ **Why:** Not every legacy token has an SLDS 2 equivalent. Z-index and duration are internal layout/animation concerns — hardcode z-index, use `--lwc-*` for duration. Inventing `--slds-g-duration-*` triggers `slds/no-slds-namespace-for-custom-hooks`.
410
+
411
+ ---
412
+
413
+ ## Multi-File End-to-End (Aura)
414
+
415
+ **CSS before:**
416
+ ```css
417
+ .THIS .slds-card__header {
418
+ background: var(--lwc-colorBackgroundAlt);
419
+ z-index: var(--lwc-zIndexSticky);
420
+ border-bottom: 1px solid #ddd;
421
+ }
422
+ ```
423
+
424
+ **CSS after:**
425
+ ```css
426
+ .THIS .relatedList-card-header {
427
+ background: var(--slds-g-color-surface-container-2, var(--lwc-colorBackgroundAlt));
428
+ z-index: 9000;
429
+ border-bottom: var(--slds-g-sizing-border-1, 1px) solid var(--slds-g-color-border-1, #ddd);
430
+ }
431
+ ```
432
+
433
+ **Markup before (`.cmp`):**
434
+ ```html
435
+ <h2 class="slds-card__header">Related Items</h2>
436
+ ```
437
+
438
+ **Markup after:**
439
+ ```html
440
+ <h2 class="slds-card__header relatedList-card-header">Related Items</h2>
441
+ ```
442
+
443
+ Three rules applied: token replacement, class override, hardcoded border. `slds-card__header` is a part within a card → choose `container`.
@@ -0,0 +1,67 @@
1
+ # SLDS 2 Uplift Checklist
2
+
3
+ Validation checklist for each CSS file after applying SLDS 2 uplift fixes.
4
+
5
+ ---
6
+
7
+ ## Per-Rule Checks
8
+
9
+ ### `slds/no-slds-class-overrides`
10
+
11
+ **CSS:**
12
+ - [ ] All `.slds-*` overrides reported by the linter are renamed to `{componentName}-{sldsElementPart}`
13
+ - [ ] Component name is camelCase
14
+ - [ ] SLDS element names preserved after prefix (e.g., `.slds-button` → `myComponent-button`)
15
+ - [ ] Each SLDS class in a compound selector gets its own component class
16
+
17
+ **HTML:**
18
+ - [ ] Original SLDS classes preserved (never removed)
19
+ - [ ] Component classes added alongside SLDS classes
20
+ - [ ] Every element in CSS selector chain updated in HTML
21
+
22
+ ### `slds/lwc-token-to-slds-hook`
23
+
24
+ - [ ] All `var(--lwc-*)` tokens replaced with SLDS 2 hooks
25
+ - [ ] Hooks chosen from linter's numbered suggestion list (not invented)
26
+ - [ ] Surface vs container choice matches DOM context
27
+ - [ ] Fallback includes original token: `var(--slds-g-[hook], var(--lwc-[token]))`
28
+
29
+ ### `slds/no-hardcoded-values-slds2`
30
+
31
+ - [ ] Color values replaced with context-appropriate hooks (surface, accent, feedback, etc.)
32
+ - [ ] Non-color values (spacing, sizing, typography, border, radius, shadow) replaced where exact match exists
33
+ - [ ] Hardcoded numerical values left unchanged — do not replace or remove values like `100%`, `50%`, `200px`, `1.5`, `auto`, `0`, `inherit`, `none`, `flex: 1`
34
+ - [ ] All replacements include original value as fallback: `var(--slds-g-[hook], originalValue)`
35
+ - [ ] Only numbered hooks used (no `spacing-medium`, `font-weight-bold`, etc.)
36
+
37
+ ---
38
+
39
+ ## Cross-Cutting Checks
40
+
41
+ ### Hook Selection
42
+ - [ ] Background-foreground hooks paired from same family (e.g., `surface-container-*` with `on-surface-*`)
43
+ - [ ] Spacing hooks for margin/padding/gap; sizing hooks for width/height
44
+ - [ ] Density-aware variants (`--slds-g-spacing-var-*`) used where component adapts to comfy/compact
45
+
46
+ ### Linter Validation
47
+ - [ ] `npx @salesforce-ux/slds-linter@latest lint .` — zero errors
48
+ - [ ] Warnings reviewed — remaining warnings are for values with no available hook
49
+
50
+ ---
51
+
52
+ ## Troubleshooting
53
+
54
+ ### Visual appearance changed
55
+ 1. Check fallback values match original hardcoded values exactly
56
+ 2. Verify correct hook family (surface vs container)
57
+ 3. Ensure background-foreground hooks properly paired
58
+
59
+ ### Linter still shows violations
60
+ 1. Verify hook names exactly match linter suggestions
61
+ 2. Check for missed CSS files in subdirectories
62
+ 3. Ensure all elements in selector chains updated in HTML
63
+
64
+ ### Functionality broken
65
+ 1. Check original SLDS classes preserved in HTML
66
+ 2. Verify JavaScript selectors updated if CSS classes changed (class overrides rule)
67
+ 3. Update tests that use class-based query selectors