@pairdraw/design-jsx 0.16.2 → 0.18.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.
@@ -134,9 +134,13 @@ export function projectPreview(root: SyntaxNode, source: string): JSXPreviewSnap
134
134
  defer(opening, 'incomplete')
135
135
  return null
136
136
  }
137
- const tagName = opening.getChild('JSXIdentifier') ?? opening.getChild('JSXBuiltin')
137
+ // A Reka part such as `Switch.Root` is named by a member expression.
138
+ const tagName =
139
+ opening.getChild('JSXIdentifier') ??
140
+ opening.getChild('JSXBuiltin') ??
141
+ opening.getChild('JSXMemberExpression')
138
142
  const fragment = raw(opening) === '<>'
139
- const name = tagName ? raw(tagName) : ''
143
+ const name = tagName ? raw(tagName).replace(/\s+/g, '') : ''
140
144
  const type = fragment
141
145
  ? FRAGMENT
142
146
  : (ELEMENT_TYPES.get(name) ?? (/^[a-z][\w-]*$/.test(name) ? name : null))