( component: DevComponent, indentLevel = 0, isInline?: (tag: string) => boolean )
| 323 | } |
| 324 | |
| 325 | function stringifyVueComponent( |
| 326 | component: DevComponent, |
| 327 | indentLevel = 0, |
| 328 | isInline?: (tag: string) => boolean |
| 329 | ) { |
| 330 | return stringifyBaseComponent( |
| 331 | component, |
| 332 | (key, value) => { |
| 333 | const eventName = getEventName(key) |
| 334 | if (eventName) { |
| 335 | const callback = typeof value === 'string' ? looseEscapeHTML(value) : '() => {}' |
| 336 | return `@${camelToKebab(eventName)}="${callback.trim()}"` |
| 337 | } |
| 338 | |
| 339 | const name = key === 'className' ? 'class' : camelToKebab(key) |
| 340 | |
| 341 | if (typeof value === 'string') { |
| 342 | return `${name}="${escapeHTML(value).trim()}"` |
| 343 | } |
| 344 | |
| 345 | if (typeof value === 'boolean') { |
| 346 | return value ? name : `:${name}="false"` |
| 347 | } |
| 348 | |
| 349 | if (typeof value === 'object' && value != null) { |
| 350 | const pruned = prune(value) |
| 351 | if (pruned == null) { |
| 352 | return '' |
| 353 | } |
| 354 | return `:${name}="${looseEscapeHTML(stringify(pruned)).trim()}"` |
| 355 | } |
| 356 | |
| 357 | return `:${name}="${looseEscapeHTML(stringify(value)).trim()}"` |
| 358 | }, |
| 359 | indentLevel, |
| 360 | isInline |
| 361 | ) |
| 362 | } |
| 363 | |
| 364 | function stringifyJSXComponent( |
| 365 | component: DevComponent, |
no test coverage detected