@atlaskit/ads-mcp 0.10.1 → 0.11.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/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/cjs/tools/migration-guides/index.js +78 -0
- package/dist/cjs/tools/migration-guides/migrations/onboarding-to-spotlight.js +55 -0
- package/dist/cjs/tools/migration-guides/registry.js +36 -0
- package/dist/cjs/tools/migration-guides/types.js +1 -0
- package/dist/es2019/index.js +6 -0
- package/dist/es2019/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/es2019/tools/migration-guides/index.js +58 -0
- package/dist/es2019/tools/migration-guides/migrations/onboarding-to-spotlight.js +416 -0
- package/dist/es2019/tools/migration-guides/registry.js +30 -0
- package/dist/es2019/tools/migration-guides/types.js +0 -0
- package/dist/esm/index.js +6 -1
- package/dist/esm/tools/get-tokens/token-structured-content.codegen.js +101 -1
- package/dist/esm/tools/migration-guides/index.js +72 -0
- package/dist/esm/tools/migration-guides/migrations/onboarding-to-spotlight.js +49 -0
- package/dist/esm/tools/migration-guides/registry.js +29 -0
- package/dist/esm/tools/migration-guides/types.js +0 -0
- package/dist/types/tools/get-tokens/token-structured-content.codegen.d.ts +1 -1
- package/dist/types/tools/migration-guides/index.d.ts +16 -0
- package/dist/types/tools/migration-guides/migrations/onboarding-to-spotlight.d.ts +4 -0
- package/dist/types/tools/migration-guides/registry.d.ts +19 -0
- package/dist/types/tools/migration-guides/types.d.ts +23 -0
- package/dist/types-ts4.5/tools/get-tokens/token-structured-content.codegen.d.ts +1 -1
- package/dist/types-ts4.5/tools/migration-guides/index.d.ts +19 -0
- package/dist/types-ts4.5/tools/migration-guides/migrations/onboarding-to-spotlight.d.ts +4 -0
- package/dist/types-ts4.5/tools/migration-guides/registry.d.ts +19 -0
- package/dist/types-ts4.5/tools/migration-guides/types.d.ts +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zodToJsonSchema } from '../../helpers';
|
|
3
|
+
import { getAvailableMigrationIds, getAvailableMigrationsDescription, migrationRegistry } from './registry';
|
|
4
|
+
|
|
5
|
+
// Build the enum dynamically from the registry
|
|
6
|
+
const migrationIds = getAvailableMigrationIds();
|
|
7
|
+
export const migrationGuidesInputSchema = z.object({
|
|
8
|
+
migration: z.enum(migrationIds).describe(`The specific migration to perform.\n`)
|
|
9
|
+
});
|
|
10
|
+
export const listMigrationGuidesTool = {
|
|
11
|
+
name: 'ads_migration_guides',
|
|
12
|
+
description: `Provides migration guides for deprecated Atlassian Design System components. Returns before/after examples, best practices, and step-by-step migration instructions.
|
|
13
|
+
|
|
14
|
+
Available migrations:\n${getAvailableMigrationsDescription()}`,
|
|
15
|
+
annotations: {
|
|
16
|
+
title: 'ADS Migration Guides',
|
|
17
|
+
readOnlyHint: true,
|
|
18
|
+
destructiveHint: false,
|
|
19
|
+
idempotentHint: true,
|
|
20
|
+
openWorldHint: false
|
|
21
|
+
},
|
|
22
|
+
inputSchema: zodToJsonSchema(migrationGuidesInputSchema)
|
|
23
|
+
};
|
|
24
|
+
export const migrationGuidesTool = async params => {
|
|
25
|
+
const {
|
|
26
|
+
migration
|
|
27
|
+
} = params;
|
|
28
|
+
const guide = migrationRegistry[migration];
|
|
29
|
+
if (!guide) {
|
|
30
|
+
// This shouldn't happen if the schema validation works, but handle gracefully
|
|
31
|
+
return {
|
|
32
|
+
content: [{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({
|
|
35
|
+
error: `Unknown migration: ${migration}`,
|
|
36
|
+
availableMigrations: getAvailableMigrationIds(),
|
|
37
|
+
suggestion: 'Please use one of the available migration IDs listed above.'
|
|
38
|
+
}, null, 2)
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
content: [{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: JSON.stringify({
|
|
46
|
+
migration: guide.id,
|
|
47
|
+
title: guide.title,
|
|
48
|
+
description: guide.description,
|
|
49
|
+
fromPackage: guide.fromPackage,
|
|
50
|
+
toPackage: guide.toPackage,
|
|
51
|
+
examples: guide.examples,
|
|
52
|
+
bestPractices: guide.bestPractices,
|
|
53
|
+
additionalResources: guide.additionalResources,
|
|
54
|
+
nextSteps: ['Review the before/after examples to understand the migration pattern', 'Apply the migration pattern', 'Follow the best practices listed above', 'Test the migrated code thoroughly']
|
|
55
|
+
}, null, 2)
|
|
56
|
+
}]
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
const additionalResources = "Visit https://hello.atlassian.net/wiki/spaces/DST/pages/6069774593 or https://atlassian.design/components/spotlight for more context";
|
|
2
|
+
export const onboardingSingleStep = {
|
|
3
|
+
id: 'onboarding-single-step',
|
|
4
|
+
title: 'Single Step Spotlight Migration',
|
|
5
|
+
description: 'Migrate a single step spotlight from @atlaskit/onboarding to @atlaskit/spotlight',
|
|
6
|
+
fromPackage: '@atlaskit/onboarding',
|
|
7
|
+
toPackage: '@atlaskit/spotlight',
|
|
8
|
+
examples: [{
|
|
9
|
+
title: 'Migrate single step spotlight',
|
|
10
|
+
description: 'Replace SpotlightManager, SpotlightTarget, SpotlightTransition, and Spotlight with the new compositional @atlaskit/spotlight components',
|
|
11
|
+
before: `import React, { useState } from 'react';
|
|
12
|
+
import Button from '@atlaskit/button/new';
|
|
13
|
+
import {
|
|
14
|
+
Spotlight,
|
|
15
|
+
SpotlightManager,
|
|
16
|
+
SpotlightTarget,
|
|
17
|
+
SpotlightTransition,
|
|
18
|
+
} from '@atlaskit/onboarding';
|
|
19
|
+
|
|
20
|
+
const OnboardingSpotlight = () => {
|
|
21
|
+
const [isSpotlightActive, setIsSpotlightActive] = useState(false);
|
|
22
|
+
const start = () => setIsSpotlightActive(true);
|
|
23
|
+
const end = () => setIsSpotlightActive(false);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SpotlightManager>
|
|
27
|
+
<SpotlightTarget name="my-target">
|
|
28
|
+
<Button>Target Element</Button>
|
|
29
|
+
</SpotlightTarget>
|
|
30
|
+
<div>
|
|
31
|
+
<Button appearance="primary" onClick={start}>
|
|
32
|
+
Show spotlight
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
<SpotlightTransition>
|
|
36
|
+
{isSpotlightActive && (
|
|
37
|
+
<Spotlight
|
|
38
|
+
actions={[
|
|
39
|
+
{
|
|
40
|
+
onClick: end,
|
|
41
|
+
text: 'Got it',
|
|
42
|
+
},
|
|
43
|
+
]}
|
|
44
|
+
heading="Feature Heading"
|
|
45
|
+
target="my-target"
|
|
46
|
+
key="my-target"
|
|
47
|
+
>
|
|
48
|
+
This is the spotlight body content describing the feature.
|
|
49
|
+
</Spotlight>
|
|
50
|
+
)}
|
|
51
|
+
</SpotlightTransition>
|
|
52
|
+
</SpotlightManager>
|
|
53
|
+
);
|
|
54
|
+
};`,
|
|
55
|
+
after: `import React, { useState } from 'react';
|
|
56
|
+
import Button from '@atlaskit/button/new';
|
|
57
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
58
|
+
import {
|
|
59
|
+
PopoverContent,
|
|
60
|
+
PopoverProvider,
|
|
61
|
+
PopoverTarget,
|
|
62
|
+
SpotlightActions,
|
|
63
|
+
SpotlightBody,
|
|
64
|
+
SpotlightCard,
|
|
65
|
+
SpotlightControls,
|
|
66
|
+
SpotlightDismissControl,
|
|
67
|
+
SpotlightFooter,
|
|
68
|
+
SpotlightHeader,
|
|
69
|
+
SpotlightHeadline,
|
|
70
|
+
SpotlightPrimaryAction,
|
|
71
|
+
} from '@atlaskit/spotlight';
|
|
72
|
+
|
|
73
|
+
const Spotlight = () => {
|
|
74
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
75
|
+
const dismiss = () => setIsVisible(false);
|
|
76
|
+
const done = () => setIsVisible(false);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<PopoverProvider>
|
|
80
|
+
<PopoverTarget>
|
|
81
|
+
<Button onClick={() => setIsVisible(true)}>Target Element</Button>
|
|
82
|
+
</PopoverTarget>
|
|
83
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={isVisible}>
|
|
84
|
+
<SpotlightCard>
|
|
85
|
+
<SpotlightHeader>
|
|
86
|
+
<SpotlightHeadline>Feature Heading</SpotlightHeadline>
|
|
87
|
+
<SpotlightControls>
|
|
88
|
+
<SpotlightDismissControl />
|
|
89
|
+
</SpotlightControls>
|
|
90
|
+
</SpotlightHeader>
|
|
91
|
+
<SpotlightBody>
|
|
92
|
+
<Text>This is the spotlight body content describing the feature.</Text>
|
|
93
|
+
</SpotlightBody>
|
|
94
|
+
<SpotlightFooter>
|
|
95
|
+
<SpotlightActions>
|
|
96
|
+
<SpotlightPrimaryAction onClick={done}>Got it</SpotlightPrimaryAction>
|
|
97
|
+
</SpotlightActions>
|
|
98
|
+
</SpotlightFooter>
|
|
99
|
+
</SpotlightCard>
|
|
100
|
+
</PopoverContent>
|
|
101
|
+
</PopoverProvider>
|
|
102
|
+
);
|
|
103
|
+
};`,
|
|
104
|
+
explanation: `Key changes when migrating a single step spotlight:
|
|
105
|
+
1. Replace SpotlightManager with PopoverProvider - the new context provider
|
|
106
|
+
2. Replace SpotlightTarget with PopoverTarget - wraps the element to highlight
|
|
107
|
+
3. Replace SpotlightTransition and Spotlight with PopoverContent containing SpotlightCard - controls visibility and positioning
|
|
108
|
+
4. The 'heading' prop becomes SpotlightHeadline inside SpotlightHeader
|
|
109
|
+
5. The 'actions' array becomes SpotlightActions with SpotlightPrimaryAction (and optionally SpotlightSecondaryAction)
|
|
110
|
+
6. The children content moves into SpotlightBody wrapped with Text component
|
|
111
|
+
7. Add SpotlightDismissControl inside SpotlightControls for the close button
|
|
112
|
+
8. The 'target' prop is no longer needed - PopoverTarget automatically handles this
|
|
113
|
+
9. The 'dialogPlacement' prop becomes 'placement' on PopoverContent (e.g., 'bottom left' → 'bottom-start')`
|
|
114
|
+
}],
|
|
115
|
+
bestPractices: ['Use PopoverProvider as the root wrapper for spotlight functionality', 'PopoverTarget should wrap exactly one child element that will be highlighted', 'Always include SpotlightDismissControl for accessibility - allows users to dismiss via close button', 'Use SpotlightPrimaryAction for the main call-to-action button', 'Wrap body text content in the Text component from @atlaskit/primitives/compiled', 'Map old dialogPlacement values: "bottom left" → "bottom-start", "bottom center" → "bottom", "bottom right" → "bottom-end"'],
|
|
116
|
+
additionalResources
|
|
117
|
+
};
|
|
118
|
+
export const onboardingMultiStep = {
|
|
119
|
+
id: 'onboarding-multi-step',
|
|
120
|
+
title: 'Multi Step Spotlight Tour Migration',
|
|
121
|
+
description: 'Migrate a multi-step spotlight tour from @atlaskit/onboarding to @atlaskit/spotlight',
|
|
122
|
+
fromPackage: '@atlaskit/onboarding',
|
|
123
|
+
toPackage: '@atlaskit/spotlight',
|
|
124
|
+
examples: [{
|
|
125
|
+
title: 'Migrate multi step spotlight tour',
|
|
126
|
+
description: 'Replace the single SpotlightManager pattern with multiple PopoverProvider instances, one for each target in the tour',
|
|
127
|
+
before: `import React, { useState } from 'react';
|
|
128
|
+
import Button, { IconButton } from '@atlaskit/button/new';
|
|
129
|
+
import CommentAddIcon from '@atlaskit/icon/core/comment-add';
|
|
130
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
131
|
+
import {
|
|
132
|
+
Spotlight,
|
|
133
|
+
SpotlightManager,
|
|
134
|
+
SpotlightTarget,
|
|
135
|
+
SpotlightTransition,
|
|
136
|
+
} from '@atlaskit/onboarding';
|
|
137
|
+
|
|
138
|
+
const OnboardingTour = () => {
|
|
139
|
+
const [activeSpotlight, setActiveSpotlight] = useState<null | number>(null);
|
|
140
|
+
const start = () => setActiveSpotlight(0);
|
|
141
|
+
const next = () => setActiveSpotlight((activeSpotlight || 0) + 1);
|
|
142
|
+
const back = () => setActiveSpotlight((activeSpotlight || 1) - 1);
|
|
143
|
+
const end = () => setActiveSpotlight(null);
|
|
144
|
+
|
|
145
|
+
const renderActiveSpotlight = () => {
|
|
146
|
+
const spotlights = [
|
|
147
|
+
<Spotlight
|
|
148
|
+
actions={[
|
|
149
|
+
{ onClick: () => next(), text: 'Next' },
|
|
150
|
+
{ onClick: () => end(), text: 'Dismiss', appearance: 'subtle' },
|
|
151
|
+
]}
|
|
152
|
+
heading="Add a comment"
|
|
153
|
+
target="comment"
|
|
154
|
+
key="comment"
|
|
155
|
+
>
|
|
156
|
+
Quickly add a comment to the work item.
|
|
157
|
+
</Spotlight>,
|
|
158
|
+
<Spotlight
|
|
159
|
+
actions={[
|
|
160
|
+
{ onClick: () => end(), text: 'Done' },
|
|
161
|
+
{ onClick: () => back(), text: 'Back', appearance: 'subtle' },
|
|
162
|
+
]}
|
|
163
|
+
heading="Copy code"
|
|
164
|
+
target="copy"
|
|
165
|
+
key="copy"
|
|
166
|
+
>
|
|
167
|
+
Click to copy the example code to your clipboard.
|
|
168
|
+
</Spotlight>,
|
|
169
|
+
];
|
|
170
|
+
|
|
171
|
+
if (activeSpotlight === null) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
return spotlights[activeSpotlight];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<SpotlightManager>
|
|
179
|
+
<SpotlightTarget name="comment">
|
|
180
|
+
<IconButton icon={CommentAddIcon} label="comment" />
|
|
181
|
+
</SpotlightTarget>
|
|
182
|
+
<SpotlightTarget name="copy">
|
|
183
|
+
<IconButton icon={CopyIcon} label="Copy" />
|
|
184
|
+
</SpotlightTarget>
|
|
185
|
+
<Button appearance="primary" onClick={start}>
|
|
186
|
+
Start tour
|
|
187
|
+
</Button>
|
|
188
|
+
<SpotlightTransition>{renderActiveSpotlight()}</SpotlightTransition>
|
|
189
|
+
</SpotlightManager>
|
|
190
|
+
);
|
|
191
|
+
};`,
|
|
192
|
+
after: `import React, { useState } from 'react';
|
|
193
|
+
import Button, { IconButton } from '@atlaskit/button/new';
|
|
194
|
+
import CommentAddIcon from '@atlaskit/icon/core/comment-add';
|
|
195
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
196
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
197
|
+
import {
|
|
198
|
+
PopoverContent,
|
|
199
|
+
PopoverProvider,
|
|
200
|
+
PopoverTarget,
|
|
201
|
+
SpotlightActions,
|
|
202
|
+
SpotlightBody,
|
|
203
|
+
SpotlightCard,
|
|
204
|
+
SpotlightControls,
|
|
205
|
+
SpotlightDismissControl,
|
|
206
|
+
SpotlightFooter,
|
|
207
|
+
SpotlightHeader,
|
|
208
|
+
SpotlightHeadline,
|
|
209
|
+
SpotlightPrimaryAction,
|
|
210
|
+
SpotlightSecondaryAction,
|
|
211
|
+
SpotlightStepCount,
|
|
212
|
+
} from '@atlaskit/spotlight';
|
|
213
|
+
|
|
214
|
+
const SpotlightTour = () => {
|
|
215
|
+
const [currentStep, setCurrentStep] = useState<number>(0);
|
|
216
|
+
|
|
217
|
+
const dismiss = () => setCurrentStep(0);
|
|
218
|
+
const back = () => setCurrentStep(Math.max(currentStep - 1, 1));
|
|
219
|
+
const next = () => setCurrentStep(Math.min(currentStep + 1, 2));
|
|
220
|
+
const done = () => setCurrentStep(0);
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<>
|
|
224
|
+
<PopoverProvider>
|
|
225
|
+
<PopoverTarget>
|
|
226
|
+
<IconButton icon={CommentAddIcon} label="comment" />
|
|
227
|
+
</PopoverTarget>
|
|
228
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={currentStep === 1}>
|
|
229
|
+
<SpotlightCard>
|
|
230
|
+
<SpotlightHeader>
|
|
231
|
+
<SpotlightHeadline>Add a comment</SpotlightHeadline>
|
|
232
|
+
<SpotlightControls>
|
|
233
|
+
<SpotlightDismissControl onClick={dismiss} />
|
|
234
|
+
</SpotlightControls>
|
|
235
|
+
</SpotlightHeader>
|
|
236
|
+
<SpotlightBody>
|
|
237
|
+
<Text>Quickly add a comment to the work item.</Text>
|
|
238
|
+
</SpotlightBody>
|
|
239
|
+
<SpotlightFooter>
|
|
240
|
+
<SpotlightStepCount>1 of 2</SpotlightStepCount>
|
|
241
|
+
<SpotlightActions>
|
|
242
|
+
<SpotlightPrimaryAction onClick={next}>Next</SpotlightPrimaryAction>
|
|
243
|
+
</SpotlightActions>
|
|
244
|
+
</SpotlightFooter>
|
|
245
|
+
</SpotlightCard>
|
|
246
|
+
</PopoverContent>
|
|
247
|
+
</PopoverProvider>
|
|
248
|
+
|
|
249
|
+
<PopoverProvider>
|
|
250
|
+
<PopoverTarget>
|
|
251
|
+
<IconButton icon={CopyIcon} label="Copy" />
|
|
252
|
+
</PopoverTarget>
|
|
253
|
+
<PopoverContent dismiss={dismiss} placement="bottom-start" isVisible={currentStep === 2}>
|
|
254
|
+
<SpotlightCard>
|
|
255
|
+
<SpotlightHeader>
|
|
256
|
+
<SpotlightHeadline>Copy code</SpotlightHeadline>
|
|
257
|
+
<SpotlightControls>
|
|
258
|
+
<SpotlightDismissControl onClick={dismiss} />
|
|
259
|
+
</SpotlightControls>
|
|
260
|
+
</SpotlightHeader>
|
|
261
|
+
<SpotlightBody>
|
|
262
|
+
<Text>Click to copy the example code to your clipboard.</Text>
|
|
263
|
+
</SpotlightBody>
|
|
264
|
+
<SpotlightFooter>
|
|
265
|
+
<SpotlightStepCount>2 of 2</SpotlightStepCount>
|
|
266
|
+
<SpotlightActions>
|
|
267
|
+
<SpotlightSecondaryAction onClick={back}>Back</SpotlightSecondaryAction>
|
|
268
|
+
<SpotlightPrimaryAction onClick={done}>Done</SpotlightPrimaryAction>
|
|
269
|
+
</SpotlightActions>
|
|
270
|
+
</SpotlightFooter>
|
|
271
|
+
</SpotlightCard>
|
|
272
|
+
</PopoverContent>
|
|
273
|
+
</PopoverProvider>
|
|
274
|
+
|
|
275
|
+
<Button appearance="primary" onClick={() => setCurrentStep(1)}>
|
|
276
|
+
Start tour
|
|
277
|
+
</Button>
|
|
278
|
+
</>
|
|
279
|
+
);
|
|
280
|
+
};`,
|
|
281
|
+
explanation: `Key changes when migrating a multi-step spotlight tour:
|
|
282
|
+
1. Replace the single SpotlightManager with multiple PopoverProvider instances - one for each target element
|
|
283
|
+
2. Each target gets its own PopoverProvider > PopoverTarget > PopoverContent structure
|
|
284
|
+
3. The spotlight array pattern is replaced with individual SpotlightCard components per target
|
|
285
|
+
4. Use a single currentStep state (starting at 0 for hidden, 1+ for active steps) instead of null/index
|
|
286
|
+
5. Control visibility with isVisible={currentStep === n} on each PopoverContent
|
|
287
|
+
6. Add SpotlightStepCount component in SpotlightFooter to show progress (e.g., "1 of 3")
|
|
288
|
+
7. Use SpotlightSecondaryAction for "Back" buttons instead of appearance: 'subtle' in the actions array
|
|
289
|
+
8. Use SpotlightPrimaryAction for "Next" and "Done" buttons
|
|
290
|
+
9. The renderActiveSpotlight pattern is no longer needed - visibility is controlled declaratively
|
|
291
|
+
10. Navigation functions use Math.max/Math.min to bound the step range safely`
|
|
292
|
+
}],
|
|
293
|
+
bestPractices: ['Each target element in a tour needs its own PopoverProvider wrapper', 'Use a numeric currentStep state where 0 = hidden, 1+ = active step number', 'Always include SpotlightStepCount in multi-step tours for user orientation', 'First step should only have "Next" action, middle steps have "Back" and "Next", last step has "Back" and "Done"', 'Use SpotlightSecondaryAction for back/dismiss actions and SpotlightPrimaryAction for next/done', 'Include SpotlightDismissControl with onClick={dismiss} so users can exit the tour at any point', 'Bound navigation functions with Math.max/Math.min to prevent invalid step values', 'Preference duplicating Spotlight code instead of trying to have a single `@atlaskit/spotlight` instance that conditionally renders content based on step.'],
|
|
294
|
+
additionalResources
|
|
295
|
+
};
|
|
296
|
+
export const onboardingWithMotion = {
|
|
297
|
+
id: 'onboarding-with-motion',
|
|
298
|
+
title: 'Single Step Spotlight with Motion Migration',
|
|
299
|
+
description: 'Migrate a single step spotlight with entrance animation from @atlaskit/onboarding to @atlaskit/spotlight using @atlaskit/motion',
|
|
300
|
+
fromPackage: '@atlaskit/onboarding',
|
|
301
|
+
toPackage: '@atlaskit/spotlight',
|
|
302
|
+
examples: [{
|
|
303
|
+
title: 'Migrate spotlight with transition animation',
|
|
304
|
+
description: 'Replace SpotlightTransition with FadeIn from @atlaskit/motion wrapped around the SpotlightCard',
|
|
305
|
+
before: `import React, { useState } from 'react';
|
|
306
|
+
import Button from '@atlaskit/button/new';
|
|
307
|
+
import {
|
|
308
|
+
Spotlight,
|
|
309
|
+
SpotlightManager,
|
|
310
|
+
SpotlightTarget,
|
|
311
|
+
SpotlightTransition,
|
|
312
|
+
} from '@atlaskit/onboarding';
|
|
313
|
+
|
|
314
|
+
const OnboardingSpotlightWithTransition = () => {
|
|
315
|
+
const [isSpotlightActive, setIsSpotlightActive] = useState(false);
|
|
316
|
+
const start = () => setIsSpotlightActive(true);
|
|
317
|
+
const end = () => setIsSpotlightActive(false);
|
|
318
|
+
|
|
319
|
+
return (
|
|
320
|
+
<SpotlightManager>
|
|
321
|
+
<SpotlightTarget name="my-target">
|
|
322
|
+
<Button>Target Element</Button>
|
|
323
|
+
</SpotlightTarget>
|
|
324
|
+
<div>
|
|
325
|
+
<Button appearance="primary" onClick={start}>
|
|
326
|
+
Show spotlight
|
|
327
|
+
</Button>
|
|
328
|
+
</div>
|
|
329
|
+
<SpotlightTransition>
|
|
330
|
+
{isSpotlightActive && (
|
|
331
|
+
<Spotlight
|
|
332
|
+
actions={[
|
|
333
|
+
{
|
|
334
|
+
onClick: end,
|
|
335
|
+
text: 'Got it',
|
|
336
|
+
},
|
|
337
|
+
]}
|
|
338
|
+
heading="Feature Heading"
|
|
339
|
+
target="my-target"
|
|
340
|
+
key="my-target"
|
|
341
|
+
>
|
|
342
|
+
This is the spotlight body content describing the feature.
|
|
343
|
+
</Spotlight>
|
|
344
|
+
)}
|
|
345
|
+
</SpotlightTransition>
|
|
346
|
+
</SpotlightManager>
|
|
347
|
+
);
|
|
348
|
+
};`,
|
|
349
|
+
after: `import React, { useState } from 'react';
|
|
350
|
+
import Button from '@atlaskit/button/new';
|
|
351
|
+
import { FadeIn } from '@atlaskit/motion';
|
|
352
|
+
import { Text } from '@atlaskit/primitives/compiled';
|
|
353
|
+
import {
|
|
354
|
+
PopoverContent,
|
|
355
|
+
PopoverProvider,
|
|
356
|
+
PopoverTarget,
|
|
357
|
+
SpotlightActions,
|
|
358
|
+
SpotlightBody,
|
|
359
|
+
SpotlightCard,
|
|
360
|
+
SpotlightControls,
|
|
361
|
+
SpotlightDismissControl,
|
|
362
|
+
SpotlightFooter,
|
|
363
|
+
SpotlightHeader,
|
|
364
|
+
SpotlightHeadline,
|
|
365
|
+
SpotlightPrimaryAction,
|
|
366
|
+
} from '@atlaskit/spotlight';
|
|
367
|
+
|
|
368
|
+
const SpotlightWithMotion = () => {
|
|
369
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
370
|
+
const dismiss = () => setIsVisible(false);
|
|
371
|
+
const done = () => setIsVisible(false);
|
|
372
|
+
|
|
373
|
+
return (
|
|
374
|
+
<PopoverProvider>
|
|
375
|
+
<PopoverTarget>
|
|
376
|
+
<Button onClick={() => setIsVisible(true)}>Target Element</Button>
|
|
377
|
+
</PopoverTarget>
|
|
378
|
+
<PopoverContent done={done} dismiss={dismiss} placement="bottom-start" isVisible={isVisible}>
|
|
379
|
+
<FadeIn entranceDirection="left">
|
|
380
|
+
{(props) => (
|
|
381
|
+
<div {...props}>
|
|
382
|
+
<SpotlightCard>
|
|
383
|
+
<SpotlightHeader>
|
|
384
|
+
<SpotlightHeadline>Feature Heading</SpotlightHeadline>
|
|
385
|
+
<SpotlightControls>
|
|
386
|
+
<SpotlightDismissControl />
|
|
387
|
+
</SpotlightControls>
|
|
388
|
+
</SpotlightHeader>
|
|
389
|
+
<SpotlightBody>
|
|
390
|
+
<Text>This is the spotlight body content describing the feature.</Text>
|
|
391
|
+
</SpotlightBody>
|
|
392
|
+
<SpotlightFooter>
|
|
393
|
+
<SpotlightActions>
|
|
394
|
+
<SpotlightPrimaryAction onClick={done}>Got it</SpotlightPrimaryAction>
|
|
395
|
+
</SpotlightActions>
|
|
396
|
+
</SpotlightFooter>
|
|
397
|
+
</SpotlightCard>
|
|
398
|
+
</div>
|
|
399
|
+
)}
|
|
400
|
+
</FadeIn>
|
|
401
|
+
</PopoverContent>
|
|
402
|
+
</PopoverProvider>
|
|
403
|
+
);
|
|
404
|
+
};`,
|
|
405
|
+
explanation: `Key changes when migrating a spotlight with transition animation:
|
|
406
|
+
1. Replace SpotlightTransition with FadeIn from @atlaskit/motion
|
|
407
|
+
2. Import FadeIn from '@atlaskit/motion' instead of SpotlightTransition from '@atlaskit/onboarding'
|
|
408
|
+
3. FadeIn uses a render props pattern - wrap content in {(props) => <div {...props}>...</div>}
|
|
409
|
+
4. The entranceDirection prop controls animation direction: 'left', 'right', 'top', or 'bottom'
|
|
410
|
+
5. SpotlightCard must be wrapped in a div that receives the animation props
|
|
411
|
+
6. PopoverContent now accepts a 'done' prop in addition to 'dismiss' for completed actions
|
|
412
|
+
7. All other migration changes from single step spotlight apply (PopoverProvider, compositional components, etc.)`
|
|
413
|
+
}],
|
|
414
|
+
bestPractices: ['Use FadeIn from @atlaskit/motion to add entrance animations to spotlights', 'Choose entranceDirection based on spotlight placement (e.g., "left" for right-placed spotlights)', 'Always wrap SpotlightCard in a div that receives the animation props from FadeIn', 'FadeIn uses render props pattern: {(props) => <div {...props}>content</div>}', 'Pass both done and dismiss props to PopoverContent when using motion', 'Motion is optional - only add if the original onboarding spotlight used SpotlightTransition for entrance effects'],
|
|
415
|
+
additionalResources
|
|
416
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration registry - central place to register all available migrations
|
|
3
|
+
*
|
|
4
|
+
* To add a new migration:
|
|
5
|
+
* 1. Create a new file in ./migrations/ with your MigrationGuide(s)
|
|
6
|
+
* 2. Import and add to the registry below
|
|
7
|
+
* 3. The tool will automatically include it in the available options
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { onboardingMultiStep, onboardingSingleStep, onboardingWithMotion } from './migrations/onboarding-to-spotlight';
|
|
11
|
+
export const migrationRegistry = {
|
|
12
|
+
[onboardingSingleStep.id]: onboardingSingleStep,
|
|
13
|
+
[onboardingMultiStep.id]: onboardingMultiStep,
|
|
14
|
+
[onboardingWithMotion.id]: onboardingWithMotion
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get all available migration IDs for use in the tool schema
|
|
19
|
+
*/
|
|
20
|
+
export const getAvailableMigrationIds = () => {
|
|
21
|
+
return Object.keys(migrationRegistry);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get a formatted list of available migrations with descriptions
|
|
26
|
+
* Useful for tool descriptions and help text
|
|
27
|
+
*/
|
|
28
|
+
export const getAvailableMigrationsDescription = () => {
|
|
29
|
+
return Object.values(migrationRegistry).map(m => `- "${m.id}": ${m.description}`).join('\n');
|
|
30
|
+
};
|
|
File without changes
|
package/dist/esm/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { getAllTokensTool, listGetAllTokensTool } from './tools/get-all-tokens';
|
|
|
16
16
|
import { getComponentsTool, listGetComponentsTool } from './tools/get-components';
|
|
17
17
|
import { getIconsInputSchema, getIconsTool, listGetIconsTool } from './tools/get-icons';
|
|
18
18
|
import { getTokensInputSchema, getTokensTool, listGetTokensTool } from './tools/get-tokens';
|
|
19
|
+
import { listMigrationGuidesTool, migrationGuidesInputSchema, migrationGuidesTool } from './tools/migration-guides';
|
|
19
20
|
import { listPlanTool, planInputSchema, planTool } from './tools/plan';
|
|
20
21
|
import { listSuggestA11yFixesTool, suggestA11yFixesInputSchema, suggestA11yFixesTool } from './tools/suggest-a11y-fixes';
|
|
21
22
|
|
|
@@ -54,7 +55,7 @@ var generateLogger = function generateLogger(level) {
|
|
|
54
55
|
};
|
|
55
56
|
};
|
|
56
57
|
export var getToolRegistry = function getToolRegistry() {
|
|
57
|
-
var baseTools = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, listAnalyzeA11yTool.name, {
|
|
58
|
+
var baseTools = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, listAnalyzeA11yTool.name, {
|
|
58
59
|
handler: analyzeA11yTool,
|
|
59
60
|
inputSchema: analyzeA11yInputSchema,
|
|
60
61
|
tool: listAnalyzeA11yTool
|
|
@@ -78,6 +79,10 @@ export var getToolRegistry = function getToolRegistry() {
|
|
|
78
79
|
handler: suggestA11yFixesTool,
|
|
79
80
|
inputSchema: suggestA11yFixesInputSchema,
|
|
80
81
|
tool: listSuggestA11yFixesTool
|
|
82
|
+
}), listMigrationGuidesTool.name, {
|
|
83
|
+
handler: migrationGuidesTool,
|
|
84
|
+
inputSchema: migrationGuidesInputSchema,
|
|
85
|
+
tool: listMigrationGuidesTool
|
|
81
86
|
});
|
|
82
87
|
|
|
83
88
|
// Conditionally add token and icon tools based on feature flag
|