(node: SceneNode)
| 225 | } |
| 226 | |
| 227 | function composeDataHint(node: SceneNode): DataHint | undefined { |
| 228 | const hints: DataHint = {} |
| 229 | |
| 230 | if (node.type === 'INSTANCE') { |
| 231 | const instance = node as InstanceNode |
| 232 | const { mainComponent } = instance |
| 233 | const name = |
| 234 | mainComponent?.parent?.type === 'COMPONENT_SET' |
| 235 | ? mainComponent.parent.name |
| 236 | : (mainComponent?.name ?? node.name) |
| 237 | const props = summarizeComponentProperties(instance) ?? '' |
| 238 | if (name) { |
| 239 | hints['data-hint-design-component'] = `${toPascalCase(name)}${props}` |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | return Object.keys(hints).length ? hints : undefined |
| 244 | } |
| 245 | |
| 246 | function getComponentProperties( |
| 247 | node: InstanceNode |
no test coverage detected