Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const startup = async () => {
root.render(
<Sentry.ErrorBoundary fallback={ErrorFallback}>
<Provider store={store}>
<Tooltip.Provider>
<Tooltip.Provider skipDelayDuration={0}>
<StartupApp />
</Tooltip.Provider>
</Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export const DraggableWrapper: React.FC<React.PropsWithChildren<React.PropsWithC
const handleDragEnd = React.useCallback((e: React.DragEvent<HTMLDivElement>) => {
e.stopPropagation();
setDragOverToken(null);
// Restore pointer state: after drag ends, manually restore hover for the tooltip system
// The browser doesn't re-fire pointerenter after drag, so we trigger a synthetic pointerenter
const target = e.currentTarget;
if (target) {
const enterEvent = new PointerEvent('pointerenter', {
bubbles: true,
cancelable: true,
});
target.dispatchEvent(enterEvent);
}
}, [setDragOverToken]);

const handleDragOver = React.useCallback((e: React.DragEvent<HTMLDivElement>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export const TokenTooltip: React.FC<React.PropsWithChildren<React.PropsWithChild
children,
token,
}) => {
// When we open the token edit form we don't want tooltips to show through, which is happening sometimes
// When we open the token edit form, pass an empty but truthy label to keep tooltip mounted
// This prevents the remount issue where pointerenter doesn't fire after edit form closes
const showEditForm = useSelector(showEditFormSelector);

if (!children || !React.isValidElement(children)) {
Expand All @@ -23,11 +24,7 @@ export const TokenTooltip: React.FC<React.PropsWithChildren<React.PropsWithChild
return (
<Tooltip
side="bottom"
label={showEditForm ? '' : (
<TokenTooltipContent
token={token}
/>
)}
label={showEditForm ? <div /> : <TokenTooltipContent token={token} />}
>
{children}
</Tooltip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ export function useTokensStudioOAuth() {
return localTheme ? alignObjectKeys(remoteTheme, localTheme) : remoteTheme;
});


return {
status: 'success',
tokens: sortedTokens,
Expand Down Expand Up @@ -400,7 +399,6 @@ export function useTokensStudioOAuth() {
return localTheme ? alignObjectKeys(remoteTheme, localTheme) : remoteTheme;
});


dispatch.tokenState.setTokenData({
values: (newTokens || {}) as any,
themes: alignedNewThemes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ export default async function updateTokensOnSources({
? mergeServerResolvedTokens(locallyResolved, serverResolvedTokens)
: null;



const tokensSize = (compressedTokens.length / 1024) * 2; // UTF-16 uses 2 bytes per character
const themesSize = (compressedThemes.length / 1024) * 2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ describe('useChangedState', () => {
expect(mockUpdateCheckForChanges).toHaveBeenCalledWith(false);
expect(mockUpdateCheckForChanges).not.toHaveBeenCalledWith(true);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,15 @@ describe('Tokens Studio REST API Integration', () => {
if (skipIntegration) return;

const result = await batchCreateTokensRest(authToken, API_BASE_URL, projectId, [
{ name: 'color.brand', value: '#7B61FF', type: 'color', token_set_id: primitiveSetId, description: 'Imported from Figma variable' },
{ name: 'spacing.sm', value: '8', type: 'dimension', token_set_id: primitiveSetId },
{ name: 'color.bg', value: '{color.brand}', type: 'color', token_set_id: semanticSetId },
{
name: 'color.brand', value: '#7B61FF', type: 'color', token_set_id: primitiveSetId, description: 'Imported from Figma variable',
},
{
name: 'spacing.sm', value: '8', type: 'dimension', token_set_id: primitiveSetId,
},
{
name: 'color.bg', value: '{color.brand}', type: 'color', token_set_id: semanticSetId,
},
], changeSetId);
expect(result.data).toBeDefined();
expect(result.data.created_count).toBe(3);
Expand Down Expand Up @@ -312,9 +318,15 @@ describe('Tokens Studio REST API Integration', () => {
if (skipIntegration) return;

const result = await batchCreateTokensRest(authToken, API_BASE_URL, projectId, [
{ name: 'color.primary', value: '#0D99FF', type: 'color', token_set_id: styleSetId, description: 'Imported from Figma color style' },
{ name: 'typography.heading', value: { fontFamily: 'Inter', fontWeight: '700', fontSize: '32' }, type: 'typography', token_set_id: styleSetId, description: 'Imported from Figma text style' },
{ name: 'spacing.md', value: '16', type: 'dimension', token_set_id: styleSetId },
{
name: 'color.primary', value: '#0D99FF', type: 'color', token_set_id: styleSetId, description: 'Imported from Figma color style',
},
{
name: 'typography.heading', value: { fontFamily: 'Inter', fontWeight: '700', fontSize: '32' }, type: 'typography', token_set_id: styleSetId, description: 'Imported from Figma text style',
},
{
name: 'spacing.md', value: '16', type: 'dimension', token_set_id: styleSetId,
},
], changeSetId);
expect(result.data).toBeDefined();
expect(result.data.created_count).toBe(3);
Expand All @@ -326,7 +338,9 @@ describe('Tokens Studio REST API Integration', () => {

// Simulates createMultipleTokens reusing an existing set ID rather than re-creating it.
const result = await batchCreateTokensRest(authToken, API_BASE_URL, projectId, [
{ name: 'color.secondary', value: '#FF6250', type: 'color', token_set_id: styleSetId },
{
name: 'color.secondary', value: '#FF6250', type: 'color', token_set_id: styleSetId,
},
], changeSetId);
expect(result.data).toBeDefined();
expect(result.data.created_count).toBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ describe('fetchServerResolvedTokens', () => {

await fetchServerResolvedTokens(BASE_OPTIONS);

const expectedParams = new URLSearchParams({
change_set_id: 'cs-456',
const expectedParams = new URLSearchParams({
change_set_id: 'cs-456',
t: '1777406477644',
Mode: 'Dark',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function fetchServerResolvedTokens(
try {
// Build query string: change_set_id + each theme selection as a flat param
// e.g. ?change_set_id=abc&color-scheme=blue&foundation=base
const params = new URLSearchParams({
const params = new URLSearchParams({
change_set_id: changeSetId,
t: Date.now().toString(), // Cache buster
});
Expand All @@ -56,7 +56,6 @@ export async function fetchServerResolvedTokens(
);

if (!response.ok) {

return null;
}

Expand All @@ -70,14 +69,11 @@ export async function fetchServerResolvedTokens(
);

if (!flatMap) {

return null;
}


return flatMap;
} catch (error) {

return null;
}
}
Loading