Skip to content

Revert "chore: use vue-demi for backward compat with vue2 (#70)" #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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