├── .gitignore ├── .npmrc ├── .npmignore ├── doc ├── 屏幕录制2024-09-10 14.28.10 (1).gif └── README_EN.md ├── src ├── dragv1 │ ├── index.ts │ ├── Draggable.js │ └── Draggable.ts ├── drag │ ├── index.ts │ ├── types.ts │ ├── utils.ts │ ├── createDraggable.ts │ ├── draggable.ts │ └── mobileDraggable.ts ├── App.vue ├── stores │ └── userTrackerStore.ts ├── styles │ └── reset.css └── components │ └── DraggableExample.vue ├── lib ├── types │ ├── utils.d.ts │ ├── createDraggable.d.ts │ ├── index.d.ts │ ├── types.d.ts │ ├── draggable.d.ts │ └── mobileDraggable.d.ts ├── drag-kit.umd.js └── drag-kit.mjs ├── main.ts ├── index.html ├── tsconfig.json ├── LICENSE ├── vite.config.ts ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | .history/ -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry="https://registry.npmmirror.com" -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .git 3 | .vscode 4 | **/*.test.ts 5 | -------------------------------------------------------------------------------- /doc/屏幕录制2024-09-10 14.28.10 (1).gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SailingCoder/drag-kit/HEAD/doc/屏幕录制2024-09-10 14.28.10 (1).gif -------------------------------------------------------------------------------- /src/dragv1/index.ts: -------------------------------------------------------------------------------- 1 | import { DraggableOptions, createDraggable } from './Draggable'; 2 | 3 | export { 4 | createDraggable 5 | } 6 | 7 | export type { 8 | DraggableOptions 9 | } 10 | -------------------------------------------------------------------------------- /lib/types/utils.d.ts: -------------------------------------------------------------------------------- 1 | export declare function savePosition(element: HTMLElement, shouldSave: boolean): void; 2 | export declare function restorePosition(element: HTMLElement, shouldSave: boolean, options: any): void; 3 | -------------------------------------------------------------------------------- /main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue'; 2 | import { createPinia } from 'pinia'; 3 | import App from './src/App.vue'; 4 | 5 | 6 | const app = createApp(App); 7 | const pinia = createPinia(); 8 | app.use(pinia) 9 | app.mount('#app'); 10 | -------------------------------------------------------------------------------- /lib/types/createDraggable.d.ts: -------------------------------------------------------------------------------- 1 | import { Draggable } from './draggable'; 2 | import { MobileDraggable } from './mobileDraggable'; 3 | import { DraggableOptions } from './types'; 4 | export declare function createDraggable(elementId: string, options?: DraggableOptions): Draggable | MobileDraggable | null; 5 | -------------------------------------------------------------------------------- /lib/types/index.d.ts: -------------------------------------------------------------------------------- 1 | import { createDraggable } from './createDraggable'; 2 | import { DraggableOptions } from './types'; 3 | import { Draggable } from './draggable'; 4 | import { MobileDraggable } from './mobileDraggable'; 5 | export { createDraggable, Draggable, MobileDraggable }; 6 | export type { DraggableOptions }; 7 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 |