-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8114a01
commit c909164
Showing
14 changed files
with
302 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'vue-types-nuxt': major | ||
--- | ||
|
||
- Remove Nuxt@2 support | ||
- Update vue-types dependency to v6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,61 @@ | ||
--- | ||
'vue-types': major | ||
'vue-types-nuxt': major | ||
--- | ||
|
||
## Major changes: | ||
|
||
### Drop Vue 2 support | ||
#### Drop Vue 2 support | ||
|
||
Vue 2 reached End of Life (EOL) on December 31st, 2023. By dropping Vue 2 compatibility we can deliver a smaller package and make the source code more maintainable. | ||
|
||
If you're unable to update to Vue 3, please use vue-types@5.x | ||
|
||
### Package format review: | ||
#### Removed `VueTypes.extend` method | ||
|
||
`VueTypes.extend` was deprecated in v5. In v6 this method has been removed. Please migrate your code to use ES6+ `extends` feature. | ||
|
||
Example: | ||
|
||
Using `VueTypes.extend` (old): | ||
|
||
```js | ||
import VueTypes from 'vue-types'; | ||
|
||
export const VueTypesProject = VueTypes.extend([ | ||
{ | ||
name: 'maxLength', | ||
type: String, | ||
validator: (max, v) => v.length <= max, | ||
}, | ||
{ | ||
name: 'positive', | ||
getter: true, | ||
type: Number, | ||
validator: (v) => v > 0, | ||
}, | ||
]) | ||
``` | ||
|
||
Using ES6+ `extends` (new): | ||
|
||
```js | ||
import VueTypes, { toType } from 'vue-types' | ||
|
||
export class VueTypesProject extends VueTypes { | ||
static maxLength(max) { | ||
return toType('maxLength', { | ||
type: String, | ||
validator: (v) => String(v).length <= max, | ||
}) | ||
} | ||
|
||
static get positive() { | ||
return toType('positive', { | ||
type: Number, | ||
validator: (v) => v > 0, | ||
}) | ||
} | ||
} | ||
``` | ||
|
||
#### Package format review: | ||
* ESM and CJS builds target is ESNext (browsers with support for the latest JavaScript features). | ||
* UMD builds target is ES2016 (aligned with [Vue 3 browser support](https://vuejs.org/about/faq#what-browsers-does-vue-support)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' | ||
import './index.css' | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
enhanceApp({ app }) { | ||
enhanceAppWithTabs(app) | ||
}, | ||
} satisfies Theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<script lang="ts"> | ||
import { defineComponent, h, resolveComponent, useSlots } from 'vue' | ||
export default defineComponent({ | ||
setup() { | ||
const slots = useSlots() | ||
const PluginTabs = resolveComponent('PluginTabs') | ||
const PluginTabsTab = resolveComponent('PluginTabsTab') | ||
const [options, _hr, setup] = slots.default() | ||
return () => | ||
setup | ||
? h( | ||
PluginTabs, | ||
{ | ||
sharedStateKey: 'code', | ||
}, | ||
[ | ||
h(PluginTabsTab, { label: 'Options API' }, options), | ||
h(PluginTabsTab, { label: 'Setup API' }, setup), | ||
], | ||
) | ||
: h(options) | ||
}, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.