Skip to content

Commit e4f6aa1

Browse files
authored
Merge pull request #3 from v-vibe/next
release: v1.0.0-beta.2
2 parents 807f97b + 4533261 commit e4f6aa1

File tree

19 files changed

+80
-52
lines changed

19 files changed

+80
-52
lines changed

.github/workflows/docs-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy docs site to Pages
22

33
on:
44
push:
5-
branches: [master]
5+
branches: [main, beta]
66

77
# workflow_dispatch:
88

.idea/codeStyles/Project.xml

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/markdown.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/prettier.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vue-styled-components.iml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"semi": false,
2+
"semi": true,
33
"singleQuote": true,
44
"trailingComma": "none",
55
"tabWidth": 2,

core/helper/is.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export function isTag(target: any) {
55
}
66

77
export function isStyledComponent(target: any) {
8-
return typeof target === 'object' && 'styled' in target
8+
return typeof target === 'object' && target?.name?.includes('styled')
99
}
1010

1111
export function isVueComponent(target: any) {

core/styled.ts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
import {
2-
defineComponent,
3-
DefineSetupFnComponent,
4-
h,
5-
inject,
6-
onMounted,
7-
PropType,
8-
PublicProps,
9-
reactive,
10-
SlotsType,
11-
useSlots,
12-
watchEffect
13-
} from 'vue'
1+
import { defineComponent, DefineSetupFnComponent, h, inject, onMounted, PropType, PublicProps, reactive, SlotsType, watchEffect } from 'vue'
142
import domElements, { type SupportedHTMLElements } from '@/constants/domElements'
153
import { type ExpressionsType, generateClassName, generateComponentName, insertExpressions } from '@/utils'
164
import { injectStyle } from '@/utils/injectStyle'
@@ -68,14 +56,13 @@ function baseStyled(target: string | InstanceType<any>, propsDefinition: Record<
6856
styledClassNameMap[componentName] = className
6957

7058
return defineComponent(
71-
(props) => {
59+
(props, { slots }) => {
7260
const myAttrs = { ...attributes }
7361
const theme = reactive(inject<Record<string, string | number>>('$theme', {}))
7462
let context = {
7563
theme,
7664
...props
7765
}
78-
7966
myAttrs.class = className
8067

8168
watchEffect(() => {
@@ -92,9 +79,8 @@ function baseStyled(target: string | InstanceType<any>, propsDefinition: Record<
9279

9380
// Return the render function
9481
return () => {
95-
const slots = useSlots()
9682
return h(
97-
isVueComponent(target) ? target : props?.as || target,
83+
isVueComponent(target) ? h(target, { as: props.as }) : props.as ?? target,
9884
{
9985
...myAttrs
10086
},
@@ -110,9 +96,8 @@ function baseStyled(target: string | InstanceType<any>, propsDefinition: Record<
11096
},
11197
...propsDefinition
11298
},
113-
inheritAttrs: true,
114-
styled: true
115-
} as any
99+
inheritAttrs: true
100+
}
116101
)
117102
}
118103

docs/guide/advances/theming.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ the `ThemeProvider`'s scope can access this theme object.
1717

1818
```vue
1919
<script setup lang="ts">
20-
import { styled, ThemeProvider } from '@vue-styled-components/core'
20+
import { styled, ThemeProvider } from '@vvibe/vue-styled-components'
2121
2222
const StyledWrapper = styled.div`
2323
display: flex;
@@ -54,7 +54,7 @@ and see the updates reflected in your styled components.
5454

5555
```vue
5656
<script setup lang="ts">
57-
import { styled, ThemeProvider } from '@vue-styled-components/core'
57+
import { styled, ThemeProvider } from '@vvibe/vue-styled-components'
5858
import { ref } from 'vue'
5959
6060
const theme = ref<Record<string, string>>({ primary: 'blue' })
@@ -112,7 +112,7 @@ and use properties defined in the theme for their styles.
112112

113113
```vue
114114
<script setup lang="ts">
115-
import { ThemeProvider } from '@vue-styled-components/core'
115+
import { ThemeProvider } from '@vvibe/vue-styled-components'
116116
import { defineComponent, h, inject } from 'vue'
117117
118118
const Link = defineComponent(() => {

docs/guide/api/core.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It is a factory function.
2121

2222
```vue
2323
<script setup lang="ts">
24-
import { styled } from '@vue-styled-components/core'
24+
import { styled } from '@vvibe/vue-styled-components'
2525
2626
const StyledDiv = styled('div', { color: String })`
2727
width: 100%;
@@ -50,7 +50,7 @@ const StyledDiv = styled('div', { color: String })`
5050

5151
```vue
5252
<script setup lang="ts">
53-
import { styled } from '@vue-styled-components/core'
53+
import { styled } from '@vvibe/vue-styled-components'
5454
5555
const StyledDiv = styled.div`
5656
width: 40px;
@@ -79,7 +79,7 @@ It is used for passing attributes to styled component.
7979

8080
```vue
8181
<script setup lang="ts">
82-
import { styled } from '@vue-styled-components/core'
82+
import { styled } from '@vvibe/vue-styled-components'
8383
8484
const InputWithValue = styled.input.attrs({ value: "I'm input with default value. 🥺" })`
8585
width: 100%;

0 commit comments

Comments
 (0)