Skip to content

Commit

Permalink
fix: Support components without a scope ID
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Dodier-Lazaro <[email protected]>
  • Loading branch information
Sidnioulz committed Dec 6, 2024
1 parent 737d09e commit dedbfa7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/components/StylelessButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script setup>
const emit = defineEmits(['click'])
const onClick = () => emit('click')
</script>

<template>
<button type="button" @click="onClick">
<slot />
</button>
</template>
3 changes: 3 additions & 0 deletions src/jsx-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ const isLikelyVueComponent = (nodeType: any) => {
if (!!nodeType.__name && !!nodeType.__scopeId) {
return true
}
if (!!nodeType.__name && !!nodeType.__hmrId) {
return true
}
if (!!nodeType.name && !!nodeType.setup) {
return true
}
Expand Down
11 changes: 11 additions & 0 deletions src/stories/VueComponentWithoutStyle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Meta } from '@storybook/blocks'

import DemoStylelessButton from '../components/StylelessButton.vue'
import { Fragment } from 'react'
import { Fragment as VueFragment } from 'vue'

<Meta title="Vue/Without style tag" />

# Vue component without style tag

<DemoStylelessButton>Click me</DemoStylelessButton>

0 comments on commit dedbfa7

Please sign in to comment.