Skip to content

Commit

Permalink
Revert "chore: use vue-demi for backward compat with vue2 (#70)" (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLeiter authored Mar 31, 2023
1 parent 2fbcb53 commit d357443
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 48 deletions.
10 changes: 1 addition & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![GIF of the demo being used](./readme/demo.gif)

This is a thin wrapper around the great [SortableJS](https://github.com/SortableJS/Sortable) library for Vue 2 & 3. I had many issues migrating from Vue.Draggable to vue.draggable.next, and after briefly investigating I decided that it was too complicated and a smaller solution was the answer. This wrapper attempts to keep you as close to Sortable as possible.
This is a thin wrapper around the great [SortableJS](https://github.com/SortableJS/Sortable) library. I had many issues migrating from Vue.Draggable to vue.draggable.next, and after briefly investigating I decided that it was too complicated and a smaller solution was the answer. This wrapper attempts to keep you as close to Sortable as possible.

### Why not use \<other library\>?

Expand Down Expand Up @@ -124,14 +124,6 @@ onEnd(event) { moveItemInArray(store.state.items, event.oldIndex, event.newIndex

You may also want to see the SortableJS store documentation [here](https://github.com/SortableJS/Sortable#store).

## Vue 2 support

If you are using version prior to `[email protected]`, `@vue/composition-api` is required to be installed to use SortableJS-vue3 with Vue 2.

Everything else should be similar to the example above for Vue 3.

Under the hood, we use [Vue Demi](https://github.com/vueuse/vue-demi) a tool that allows us to write Universal Vue Libraries for Vue 2 & 3.

## Development

1. Run `yarn` to install dependencies
Expand Down
10 changes: 2 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@
},
"dependencies": {
"sortablejs": "^1.15.0",
"vue": "^3.2.37",
"vue-demi": "^0.13.11"
"vue": "^3.2.37"
},
"peerDependencies": {
"sortablejs": "^1.15.0",
"vue": "^2.0.0 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
"vue": "^3.2.25"
},
"devDependencies": {
"@types/node": "18.14.2",
Expand Down
41 changes: 16 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import Sortable from "./Sortable.vue";
import { computed, ref } from "vue-demi";
import { computed, ref } from "vue";
import type { SortableOptions } from "sortablejs";
import type { AutoScrollOptions } from "sortablejs/plugins";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Sortable.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, PropType, watch, onUnmounted, computed, useAttrs, Ref } from "vue-demi";
import { ref, PropType, watch, onUnmounted, computed, useAttrs, Ref } from "vue";
import Sortable, { SortableOptions } from "sortablejs";
import type { AutoScrollOptions } from "sortablejs/plugins";
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createApp } from "vue-demi";
import { createApp } from "vue";
import App from "./App.vue";

createApp(App).mount("#app");
3 changes: 0 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ export default defineConfig({
preserveSymlinks: false,
},
logLevel: "info",
optimizeDeps: {
exclude: ['vue-demi']
},
build: {
target: "esnext",
minify: "terser",
Expand Down

1 comment on commit d357443

@vercel
Copy link

@vercel vercel bot commented on d357443 Mar 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.