MCPcopy Create free account
hub / github.com/ecomfe/tempad-dev / composeDataHint

Function composeDataHint

packages/extension/mcp/tools/code/tree.ts:227–244  ·  view source on GitHub ↗
(node: SceneNode)

Source from the content-addressed store, hash-verified

225}
226
227function 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
246function getComponentProperties(
247 node: InstanceNode

Callers 1

visitFunction · 0.70

Calls 2

toPascalCaseFunction · 0.90

Tested by

no test coverage detected