Skip to content

Commit 8652b2c

Browse files
authored
Merge pull request #1234 from basics/next
Typescript Support & Fallback Init 🎉
2 parents e0fa3bc + 130224e commit 8652b2c

File tree

205 files changed

+15805
-12440
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+15805
-12440
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Project Changelog
22

3+
# [3.2.0-next.1](https://github.com/basics/nuxt-booster/compare/v3.1.11...v3.2.0-next.1) (2025-03-04)
4+
5+
6+
### Bug Fixes
7+
8+
* **dependencies:** add sort-css-media-queries package and update imports ([a7aa6e2](https://github.com/basics/nuxt-booster/commit/a7aa6e20314b94c2fd3e58fab31995ebf684e4c1))
9+
* **experimental:** added init fallback ([73239d9](https://github.com/basics/nuxt-booster/commit/73239d9ca23e8164a741d23575f03e6c80534f82))
10+
11+
12+
### Features
13+
14+
* **typescript:** added typescript support ([f7c906a](https://github.com/basics/nuxt-booster/commit/f7c906a3016fb6283020cea6dd238a86b2167967))
15+
* **typescript:** imrpove typescript support ([9f839d3](https://github.com/basics/nuxt-booster/commit/9f839d390e4fb49f67c84ee8ce37caa9478fac76))
16+
* **typescript:** update components ([49cd8d7](https://github.com/basics/nuxt-booster/commit/49cd8d7a3ee32073474b7fe78f61dba0d826095e))
17+
318
## [3.1.11](https://github.com/basics/nuxt-booster/compare/v3.1.10...v3.1.11) (2025-02-20)
419

520

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Contributing to Nuxt-Booster
2+
23
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
34

45
- Reporting a bug
@@ -8,25 +9,30 @@ We love your input! We want to make contributing to this project as easy and tra
89
- Becoming a maintainer
910

1011
## We Develop with Github
12+
1113
We use github to host code, to track issues and feature requests, as well as accept pull requests.
1214

1315
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
16+
1417
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
1518

16-
1. Fork the repo and create your branch from `master`.
19+
1. Fork the repo and create your branch from `main`.
1720
2. If you've added code that should be tested, add tests.
1821
3. If you've changed APIs, update the documentation.
1922
4. Ensure the test suite passes.
2023
5. Make sure your code lints.
2124
6. Issue that pull request!
2225

2326
## Any contributions you make will be under the MIT Software License
27+
2428
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
2529

2630
## Report bugs using Github's [issues](https://github.com/basics/nuxt-booster/issues)
31+
2732
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/basics/nuxt-booster/issues/new/choose); it's that easy!
2833

2934
## Write bug reports with detail, background, and sample code
35+
3036
**Great Bug Reports** tend to have:
3137

3238
- A quick summary and/or background
@@ -40,7 +46,9 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
4046
People *love* thorough bug reports. I'm not even kidding.
4147

4248
## License
49+
4350
By contributing, you agree that your contributions will be licensed under its MIT License.
4451

4552
## References
53+
4654
This document was adapted from the open-source contribution guidelines from [Brian A. Danielak](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62)

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
[![npm version][npm-version-latest-src]][npm-version-latest-href]
3232
[![npm downloads][npm-downloads-src]][npm-downloads-href]
3333

34+
[![TypeScript][typescript-badge-src]](http://www.typescriptlang.org/)
3435
[![Renovate - Status][renovate-status-src]][renovate-status-href]
3536
[![License][license-src]][license-href]
3637

@@ -111,6 +112,8 @@ Do you need further support, a consultation or a code review for an appropriate
111112
[renovate-status-src]: <https://img.shields.io/badge/renovate-enabled-brightgreen>
112113
[renovate-status-href]: <https://renovate.whitesourcesoftware.com/>
113114

115+
[typescript-badge-src]: https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg
116+
114117
[github-workflow-main-src]: <https://github.com/basics/nuxt-booster/workflows/Main/badge.svg?branch=main>
115118
[github-workflow-main-href]: <https://github.com/basics/nuxt-booster/actions?query=workflow%3AMain>
116119
[github-workflow-next-src]: <https://github.com/basics/nuxt-booster/workflows/Next/badge.svg?branch=next>

build.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
export default {
1+
import { defineBuildConfig } from 'unbuild';
2+
3+
export default defineBuildConfig({
24
failOnWarn: false,
35
externals: [
4-
// package
6+
'vue-bundle-renderer',
57
'@nuxt/image',
68
'browserslist-useragent-regexp',
79
'cheerio',
@@ -12,7 +14,8 @@ export default {
1214
'image-meta',
1315
'pathe',
1416
'mime-types',
15-
'mime-db'
17+
'mime-db',
18+
'#build/types/booster'
1619
],
1720
hooks: {
1821
'build:done': async () => {
@@ -21,4 +24,4 @@ export default {
2124
await copy('src/assets', 'dist/assets');
2225
}
2326
}
24-
};
27+
});

docs/.vitepress/config.js renamed to docs/.vitepress/config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { fileURLToPath } from 'url';
2-
import { defineConfig } from 'vitepress';
2+
// import type { DefaultTheme, UserConfig } from 'vitepress';
3+
import { defineConfigWithTheme } from 'vitepress';
34
import markdownItInlineComments from 'markdown-it-inline-comments';
4-
import navigation from './navigation.js';
5+
import navigation from './navigation';
6+
7+
// 'UserConfig<Config>
58

69
// https://vitepress.dev/reference/site-config
7-
export default defineConfig(() => ({
10+
export default defineConfigWithTheme({
811
markdown: {
912
config: md => {
1013
md.use(markdownItInlineComments);
@@ -58,7 +61,7 @@ export default defineConfig(() => ({
5861
sitemap: {
5962
hostname: 'https://basics.github.io/nuxt-booster/'
6063
}
61-
}));
64+
});
6265

6366
function getBaseUrl() {
6467
return process.env.npm_config_base_url || process.env.BASE_URL || '/';

docs/.vitepress/navigation.js renamed to docs/.vitepress/navigation.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default {
6565
{ text: 'Setup', link: '/guide/setup' },
6666
{ text: 'Options', link: '/guide/options' },
6767
{ text: 'Usage', link: '/guide/usage' },
68+
{ text: 'Definitions', link: '/guide/definitions' },
6869
{ text: 'Caveats', link: '/guide/caveats' }
6970
]
7071
},
@@ -86,6 +87,10 @@ export default {
8687
text: 'useBoosterComponentObserver',
8788
link: '/composables/useBoosterComponentObserver'
8889
},
90+
{
91+
text: 'useBoosterProvide',
92+
link: '/composables/useBoosterProvide'
93+
},
8994
{ text: '⚠️ useBoosterHead', link: '/composables/useBoosterHead' }
9095
]
9196
},

docs/.vitepress/theme/index.js renamed to docs/.vitepress/theme/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,5 @@ export default {
1111
return h(DefaultTheme.Layout, null, {
1212
// https://vitepress.dev/guide/extending-default-theme#layout-slots
1313
});
14-
},
15-
// eslint-disable-next-line no-unused-vars
16-
enhanceApp({ app, router, siteData }) {
17-
// ...
1814
}
1915
};

docs/components/VPNavBarMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<script setup>
2-
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
1+
<script setup lang="ts">
2+
import { useData } from 'vitepress';
33
import VPNavBarMenuLink from 'vitepress/dist/client/theme-default/components/VPNavBarMenuLink.vue';
44
import VPNavBarMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavBarMenuGroup.vue';
5-
import { useVersion } from '../composables/version.js';
5+
import useVersion from '../composables/version';
66
77
const { theme } = useData();
88

docs/components/VPNavBarTitle.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<script setup>
2-
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
3-
import { useLangs } from 'vitepress/dist/client/theme-default/composables/langs';
4-
import { useSidebar } from 'vitepress/dist/client/theme-default/composables/sidebar';
5-
import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils';
1+
<script setup lang="ts">
2+
import { useData } from 'vitepress';
3+
import { useLangs } from 'vitepress/dist/client/theme-default/composables/langs.js';
4+
import { normalizeLink } from 'vitepress/dist/client/theme-default/support/utils.js';
65
import VPImage from 'vitepress/dist/client/theme-default/components/VPImage.vue';
76
import Logo from './Logo.vue';
7+
import { useSidebar } from 'vitepress/theme';
88
99
const { site, theme } = useData();
1010
const { hasSidebar } = useSidebar();

docs/components/VPNavScreenMenu.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<script lang="ts" setup>
2-
import { useData } from 'vitepress/dist/client/theme-default/composables/data';
1+
<script setup lang="ts">
2+
import { useData } from 'vitepress';
33
import VPNavScreenMenuLink from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuLink.vue';
44
import VPNavScreenMenuGroup from 'vitepress/dist/client/theme-default/components/VPNavScreenMenuGroup.vue';
5-
import { useVersion } from '../composables/version.js';
5+
import useVersion from '../composables/version';
66
77
const { theme } = useData();
88
const { nav: versionNav } = useVersion();

docs/composables/version.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

docs/composables/version.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { useData } from 'vitepress';
2+
import { computed } from 'vue';
3+
4+
export default function useVersion() {
5+
const { theme, page } = useData();
6+
7+
const defaultVersion = computed(
8+
() =>
9+
theme.value.version.find(
10+
({ isDefault }: { isDefault: boolean }) => isDefault
11+
)?.version
12+
);
13+
14+
const currentVersion = computed(() =>
15+
Number(
16+
(/v(\d+)\/.*/.test(page.value.relativePath) &&
17+
page.value.relativePath.replace(/v(\d+)\/.*/, '$1')) ||
18+
defaultVersion.value
19+
)
20+
);
21+
22+
const nav = computed(() => {
23+
return (
24+
theme.value.version?.length && [
25+
{
26+
text: `v${currentVersion.value}`,
27+
items: theme.value.version
28+
.filter(
29+
({ version }: { version: number }) =>
30+
version !== currentVersion.value
31+
)
32+
.map(
33+
({
34+
version,
35+
isDefault
36+
}: {
37+
version: number;
38+
isDefault: boolean;
39+
}) => {
40+
return {
41+
text: `v${version}`,
42+
link: isDefault ? '/' : `/v${version}/`
43+
};
44+
}
45+
)
46+
}
47+
]
48+
);
49+
});
50+
51+
return {
52+
defaultVersion,
53+
currentVersion,
54+
nav
55+
};
56+
}

docs/src/components/booster-iframe.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ The `BoosterIframe` is used like a normal [HTML Iframe](https://www.w3schools.co
4545

4646
````vue
4747
<template>
48-
<booster-iframe v-bind="iframe" @load="onLoadIframe" />
48+
<booster-iframe
49+
:src="src"
50+
:component-observer="componentObserver"
51+
@load="onLoadIframe"
52+
/>
4953
</template>
5054
51-
<script setup>
52-
const src = defineProps({
53-
src: String,
54-
componentObserver: {
55-
type: Object,
56-
default() {
57-
return { trackVisibility: true, delay: 350 };
58-
}
59-
}
60-
});
55+
<script setup lang="ts">
56+
import BoosterIframe from '#booster/components/BoosterIframe.vue';
57+
import { ref } from 'vue';
58+
59+
const src = ref('<url>');
60+
const componentObserver = ref({ trackVisibility: true, delay: 350 });
6161
6262
const onLoadIframe = () => console.log('iframe loaded!');
6363
</script>

docs/src/components/booster-image.md

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,28 @@ Important: For using `BoosterImage` do not disable `@nuxt/image` via `disableNux
3535
````vue
3636
<template>
3737
<div>
38-
<booster-image v-bind="{ source, title, alt }" @load="onLoadImage" />
38+
<booster-image
39+
:source="source"
40+
:title="title"
41+
:alt="alt"
42+
@load="onLoadImage"
43+
/>
3944
</div>
4045
</template>
4146
42-
<script setup>
43-
import BoosterImage from '#booster/components/BoosterImage';
44-
45-
defineProps({
46-
source: {
47-
type: Object,
48-
default() {
49-
return {
50-
format: 'jpg',
51-
src: '/img/image.jpg',
52-
sizes: {
53-
default: '100vw',
54-
xxs: '100vw',
55-
xs: '100vw',
56-
sm: '100vw',
57-
md: '100vw',
58-
lg: '100vw',
59-
xl: '100vw',
60-
xxl: '100vw'
61-
}
62-
};
63-
}
64-
},
65-
title: String,
66-
alt: String
47+
<script setup lang="ts">
48+
import BoosterImage from '#booster/components/BoosterImage.vue';
49+
import { ref } from 'vue';
50+
51+
const source = ref({
52+
format: 'jpg',
53+
src: '/img/image.jpg',
54+
sizes: {
55+
default: '1024px'
56+
}
6757
});
58+
const title = ref('Image title');
59+
const alt = ref('Image alt');
6860
6961
const onLoadImage = () => console.log('Image loaded!');
7062
</script>

0 commit comments

Comments
 (0)