Skip to content

Commit 7512151

Browse files
committed
fix(update): replaced vue files
1 parent 973d89d commit 7512151

20 files changed

+179
-150
lines changed

docs/src/components/content-container.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ The appropriate HTML element for the page structure is determined based on the `
1818

1919
## Properties
2020

21-
### abstract
22-
23-
- Type: `Boolean`
24-
- Default: `false`
25-
26-
If set, the heading is rendered as an abstract heading. (e.g. `<slot />`)
27-
2821
### tag
2922

3023
- Type: `String`
@@ -35,7 +28,7 @@ Tag for the element.
3528
### rootTags
3629

3730
- Type: `Array`
38-
- Default: `inject('rootTags', ['main'])`
31+
- Default: `inject('semanticRelease_rootTags', ['main'])`
3932

4033
Available tags for the root structure.
4134

@@ -44,7 +37,7 @@ Available tags for the root structure.
4437
### contentTags
4538

4639
- Type: `Array`
47-
- Default: `inject('contentTags', ['article', 'section'])`
40+
- Default: `inject('semanticRelease_contentTags', ['article', 'section'])`
4841

4942
Available tags for the content structure.
5043

@@ -57,6 +50,13 @@ Available tags for the content structure.
5750

5851
Can be used to overwrite the level.
5952

53+
### debug
54+
55+
- Type: `Boolean`
56+
- Default: `inject('semanticRelease_debug', false)`
57+
58+
If set, the following attributes are set on the element: `data-current-tag`, `data-current-level` and `data-parent-level`.
59+
6060
## v-slot
6161

6262
### default
@@ -85,8 +85,7 @@ Can be used to overwrite the level.
8585
</template>
8686
8787
<script setup>
88-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
89-
import ContentHeadline from 'vue-semantic-structure/ContentHeadline.vue';
88+
import { ContentContainer, ContentHeadline } from 'vue-semantic-structure';
9089
</script>
9190
```
9291

docs/src/components/content-headline.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ The deeper the nesting, the smaller the heading.
2020

2121
## Properties
2222

23-
### abstract
24-
25-
- Type: `Boolean`
26-
- Default: `false`
27-
28-
If set, the heading is rendered as an abstract heading. (e.g. `<slot />`)
29-
3023
### tag
3124

3225
- Type: `String`
3326
- Default: `null`
3427

3528
Tag for the element.
3629

30+
### debug
31+
32+
- Type: `Boolean`
33+
- Default: `inject('semanticRelease_debug', false)`
34+
35+
If set, the following attributes are set on the element: `data-current-tag`, `data-current-level` and `data-parent-level`.
36+
3737
## v-slot
3838

3939
### default
@@ -62,8 +62,7 @@ Tag for the element.
6262
</template>
6363
6464
<script setup>
65-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
66-
import ContentHeadline from 'vue-semantic-structure/ContentHeadline.vue';
65+
import { ContentContainer, ContentHeadline } from 'vue-semantic-structure';
6766
</script>
6867
```
6968

docs/src/composables/use-content-container.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ const { currentTag } = useContentContainer()
3434

3535
## Options
3636

37-
| Property | Type | Description | Default Value |
38-
| ------------- | -------- | ----------------------------------------- | ------------------------ |
39-
| `tag` | `String` | Can be used to overwrite the tag. | `undefined` |
40-
| `contentTags` | `Array` | Available tags for the content structure. | `['section', 'article']` |
41-
| `rootTags` | `Array` | Available tags for the root structure. | `['main', undefined]` |
42-
| `level` | `Number` | Can be used to overwrite the level. | `undefined` |
37+
| Property | Type | Description | Default Value |
38+
| ------------- | -------- | ----------------------------------------- | --------------------------------------------------------------- |
39+
| `tag` | `String` | Can be used to overwrite the tag. | `undefined` |
40+
| `contentTags` | `Array` | Available tags for the content structure. | `inject('semanticRelease_contentTags', ['article', 'section'])` |
41+
| `rootTags` | `Array` | Available tags for the root structure. | `inject('semanticRelease_rootTags', ['main'])` |
42+
| `level` | `Number` | Can be used to overwrite the level. | `undefined` |
4343

4444
## Return
4545

docs/src/introduction.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ If `ContentContainer` is level 2, `ContentHeadline` level 2 is rendered as `h2`.
6060
</template>
6161
6262
<script setup>
63-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
64-
import ContentHeadline from 'vue-semantic-structure/ContentHeadline.vue';
63+
import { ContentContainer, ContentHeadline } from 'vue-semantic-structure';
6564
</script>
6665
```
6766

docs/src/usage.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The main structure is in the `<main>` tag, which contains the main components.
2222
</template>
2323
2424
<script setup>
25-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
25+
import { ContentContainer } from 'vue-semantic-structure';
2626
</script>
2727
```
2828

@@ -56,7 +56,7 @@ It is recommended to create a separate component that extends the `ContentContai
5656
</template>
5757
5858
<script setup>
59-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
59+
import { ContentContainer } from 'vue-semantic-structure';
6060
</script>
6161
```
6262

@@ -76,7 +76,7 @@ In comparison to the basic application, the entire content is enclosed in anothe
7676
</template>
7777
7878
<script setup>
79-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
79+
import { ContentContainer } from 'vue-semantic-structure';
8080
</script>
8181
```
8282

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
".": {
2323
"import": "./dist/index.js",
2424
"require": "./dist/index.cjs"
25-
},
26-
"./ContentContainer.vue": "./dist/ContentContainer.vue",
27-
"./ContentHeadline.vue": "./dist/ContentHeadline.vue"
25+
}
2826
},
2927
"main": "./dist/index.cjs",
3028
"files": [

playground/src/components/DebugArticleContentContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<script setup>
1717
import { inject, provide } from 'vue';
18-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
18+
import { ContentContainer } from 'vue-semantic-structure';
1919
2020
const props = defineProps({
2121
debug: {

playground/src/components/DebugContainer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<script setup>
1414
import { inject, provide } from 'vue';
15-
import ContentContainer from 'vue-semantic-structure/ContentContainer.vue';
15+
import { ContentContainer } from 'vue-semantic-structure';
1616
1717
const props = defineProps({
1818
debug: {

playground/src/components/DebugHeadline.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<script setup>
99
import { inject } from 'vue';
10-
import ContentHeadline from 'vue-semantic-structure/ContentHeadline.vue';
10+
import { ContentHeadline } from 'vue-semantic-structure';
1111
1212
const debug = inject('debugHeadings', false);
1313
</script>

src/ContentContainer.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { h, inject, provide } from 'vue';
2+
import useContentContainer from './useContentContainer';
3+
4+
const ContentContainer = {
5+
name: 'ContentContainer',
6+
props: {
7+
tag: {
8+
type: String,
9+
default: null
10+
},
11+
rootTags: {
12+
type: Array,
13+
default() {
14+
return inject('semanticRelease_rootTags', ['main']);
15+
}
16+
},
17+
contentTags: {
18+
type: Array,
19+
default() {
20+
return inject('semanticRelease_contentTags', ['article', 'section']);
21+
}
22+
},
23+
level: {
24+
type: Number,
25+
default: undefined
26+
},
27+
debug: {
28+
type: Boolean,
29+
default() {
30+
return inject('semanticRelease_debug', false);
31+
}
32+
}
33+
},
34+
35+
setup(props) {
36+
const { parentLevel, currentLevel, currentTag } = useContentContainer(props);
37+
provide('semanticRelease_debug', props.debug);
38+
return { parentLevel, currentLevel, currentTag };
39+
},
40+
41+
render() {
42+
const { currentTag, parentLevel, currentLevel } = this;
43+
return h(
44+
currentTag,
45+
{
46+
...this.$attrs,
47+
...getDebugAttrs(this)
48+
},
49+
{
50+
default: () =>
51+
this.$slots.default({
52+
currentTag,
53+
parentLevel,
54+
currentLevel
55+
})
56+
}
57+
);
58+
}
59+
};
60+
61+
const getDebugAttrs = context => {
62+
if (context.debug) {
63+
return {
64+
'data-current-tag': context.currentTag,
65+
'data-current-level': context.currentLevel,
66+
'data-parent-level': context.parentLevel
67+
};
68+
}
69+
return {};
70+
};
71+
72+
export default ContentContainer;

0 commit comments

Comments
 (0)