0
Fork 0
mirror of https://github.com/penpot/penpot-exporter-figma-plugin.git synced 2025-01-20 06:22:38 -05:00
penpot-exporter-figma-plugin/ui-src/parser/creators/symbols/symbolTouched.ts
Alex Sánchez 303cc833a0
Fix component overrides (#200)
* wip

* wip

* wip

* wip

* wip

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes
2024-06-28 12:17:56 +02:00

35 lines
1.1 KiB
TypeScript

import { SyncGroups } from '@ui/lib/types/utils/syncGroups';
import { componentProperties } from '@ui/parser';
import { ComponentPropertyReference } from '@ui/types';
export const symbolTouched = (
visible: boolean | undefined,
characters: string | undefined,
touched: SyncGroups[] | undefined,
componentPropertyReferences: ComponentPropertyReference | undefined
): SyncGroups[] | undefined => {
if (!componentPropertyReferences) {
return touched;
}
const propertyReferenceVisible = componentPropertyReferences.visible;
const propertyReferenceCharacters = componentPropertyReferences.characters;
if (
propertyReferenceVisible &&
visible !== componentProperties.get(propertyReferenceVisible)?.defaultValue &&
!touched?.includes(':visibility-group')
) {
touched?.push(':visibility-group');
}
if (
propertyReferenceCharacters &&
characters !== componentProperties.get(propertyReferenceCharacters)?.defaultValue &&
!touched?.includes(':content-group')
) {
touched?.push(':content-group');
}
return touched;
};