Skip to content

Commit

Permalink
Vue clean-ups / Drop support for Vue 2 (#502)
Browse files Browse the repository at this point in the history
Vue Clean-ups / Drop support for Vue 2
  • Loading branch information
paescuj authored Dec 20, 2024
1 parent 1ac85cc commit 60cd60b
Show file tree
Hide file tree
Showing 15 changed files with 241 additions and 319 deletions.
5 changes: 1 addition & 4 deletions bin/build/targets/vue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,9 @@ export default async (ctx, target) => {
formats: ['cjs', 'es'],
},
rollupOptions: {
external: ['vue-demi', 'vue'],
external: ['vue'],
},
},
optimizeDeps: {
exclude: ['vue-demi'],
},
plugins: [
vue({
isProduction: true,
Expand Down
14 changes: 8 additions & 6 deletions bin/build/targets/vue/template.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
function template(svg) {
return `<script lang="ts">
import { defineComponent, inject } from "vue-demi";
import type { SVGAttributes } from "vue-demi";
import providerKey from "../providerKey";
import type { SVGAttributes } from 'vue';
import { defineComponent, inject } from 'vue';
import providerKey from '../providerKey';
export default defineComponent<SVGAttributes>(() => {
const context = inject(providerKey);
return { context };
export default defineComponent<SVGAttributes>({
setup() {
const context = inject(providerKey);
return { context };
},
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion examples/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lint": "next lint"
},
"dependencies": {
"next": "15.1.1",
"next": "15.1.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions examples/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"devDependencies": {
"@iconoir/vue": "workspace:*",
"@tsconfig/node22": "^22.0.0",
"@types/node": "^22.9.3",
"@types/node": "^22.10.2",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/tsconfig": "^0.7.0",
"npm-run-all2": "^7.0.1",
"npm-run-all2": "^7.0.2",
"typescript": "~5.7.2",
"vite": "^6.0.1",
"vite-plugin-vue-devtools": "^7.6.5",
"vite": "^6.0.4",
"vite-plugin-vue-devtools": "^7.6.8",
"vue-tsc": "^2.1.10"
}
}
4 changes: 1 addition & 3 deletions examples/vue/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import {
'height': '2em',
}"
>
<SomeOtherContainer>
<Check />
</SomeOtherContainer>
<Check />
</IconoirProvider>
</template>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"semver": "^7.6.3",
"types-tsconfig": "2.1.1",
"typescript": "~5.7.2",
"vite": "^6.0.3",
"vite-plugin-dts": "^4.3.0"
"vite": "^6.0.4",
"vite-plugin-dts": "^4.4.0"
},
"pnpm": {
"packageExtensions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/iconoir-flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ Default values for the most common props are given below:
| width | "1.5em" |
| height | "1.5em" |

## Icon names
## Icon Names

The Flutter widges are named as PascalCase variations of their reference names (i.e. `airplane-helix-45deg` becomes `AirplaneHelix45deg`).
2 changes: 1 addition & 1 deletion packages/iconoir-react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ return (
);
```

## Icon names
## Icon Names

The React components are named as PascalCase variations of their reference names (i.e. `airplane-helix-45deg` becomes `AirplaneHelix45deg`).
2 changes: 1 addition & 1 deletion packages/iconoir-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ return (
);
```

## Icon names
## Icon Names

The React components are named as PascalCase variations of their reference names (i.e. `airplane-helix-45deg` becomes `AirplaneHelix45deg`).
22 changes: 1 addition & 21 deletions packages/iconoir-vue/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

## Usage

### Vue 3

```html
<script setup>
import { Iconoir } from '@iconoir/vue';
Expand All @@ -28,24 +26,6 @@
</template>
```

### Vue 2

```html
<script>
import { Iconoir } from '@iconoir/vue';
export default
components: {
Iconoir
}
}
</script>

<template>
<Iconoir />
</template>
```

### Properties

Icons can take any standard SVG properties as optional props, e.g.
Expand Down Expand Up @@ -88,6 +68,6 @@ Tired of specifying the same props for every single icon, every time you use the
</template>
```

## Icon names
## Icon Names

The Vue components are named as PascalCase variations of their reference names (i.e. `airplane-helix-45deg` becomes `AirplaneHelix45deg`).
16 changes: 3 additions & 13 deletions packages/iconoir-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"default": "./dist/index.js"
}
}
},
"main": "./dist/index.js",
Expand All @@ -40,18 +39,9 @@
"dist"
],
"peerDependencies": {
"@vue/composition-api": ">=1.0.0-rc.1",
"vue": "^2.6.11 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
},
"dependencies": {
"vue-demi": "^0.14.6"
"vue": "3"
},
"devDependencies": {
"vue": "^3.3.12"
"@vue/tsconfig": "^0.7.0"
}
}
14 changes: 8 additions & 6 deletions packages/iconoir-vue/src/IconoirProvider.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<script setup lang="ts">
import type { SVGAttributes } from 'vue-demi';
import { provide } from 'vue-demi';
import type { SVGAttributes } from 'vue';
import { provide, toRef } from 'vue';
import providerKey from './providerKey';
interface Props {
const props = defineProps<{
iconProps: SVGAttributes;
}
const props = defineProps<Props>();
provide(providerKey, props.iconProps);
}>();
const iconProps = toRef(props, 'iconProps');
provide(providerKey, iconProps);
</script>

<template>
Expand Down
4 changes: 2 additions & 2 deletions packages/iconoir-vue/src/providerKey.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { InjectionKey, SVGAttributes } from 'vue-demi';
import type { InjectionKey, Ref, SVGAttributes } from 'vue';

const providerKey = Symbol('IconoirProvider') as InjectionKey<SVGAttributes>;
const providerKey = Symbol('IconoirProvider') as InjectionKey<Ref<SVGAttributes>>;
export default providerKey;
27 changes: 1 addition & 26 deletions packages/iconoir-vue/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
{
"compilerOptions": {
"target": "es2018",
"jsx": "preserve",
"lib": [
"esnext",
"dom",
"dom.iterable"
],
"baseUrl": ".",
"rootDir": "src",
"module": "esnext",
"moduleResolution": "node",
// "isolatedModules": true,
"types": [
"vite/client"
],
"strict": true,
"declarationMap": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"include": [
"src/**/*.ts",
"src/**/*.vue"
]
"extends": "@vue/tsconfig/tsconfig.dom.json"
}
Loading

0 comments on commit 60cd60b

Please sign in to comment.