├── .gitignore ├── BottomSheet.svelte ├── CHANGELOG.md ├── README.md ├── SideSheet.svelte ├── index.js ├── package.json └── utils.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | example -------------------------------------------------------------------------------- /BottomSheet.svelte: -------------------------------------------------------------------------------- 1 |
open = false}/> 2 | 3 |
8 | 9 |
10 | 11 | 72 | 73 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | ## [Unreleased] 5 | 6 | ## [0.0.4] - 2020-02-20 7 | ### Added 8 | - BottomSheet can now scroll horizontally if an element overflows 9 | - SideSheet can now scroll vertically if an element overflows 10 | 11 | ## [0.0.3] - 2020-02-07 12 | ### Initial release -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | ``` 4 | npm i -D svelte-swipeable-sheets 5 | ``` 6 | 7 | ## [Changelog](https://github.com/kroniapp/svelte-swipeable-sheets/blob/master/CHANGELOG.md) 8 | 9 | # Example 10 | 11 | ## Bottom sheet 12 | ```html 13 | 16 | 17 | 18 | Content 19 | 20 | 21 | 26 | ``` 27 | 28 | ## Side sheet 29 | ```html 30 | 33 | 34 | 35 | Content 36 | 37 | 38 | 43 | ``` -------------------------------------------------------------------------------- /SideSheet.svelte: -------------------------------------------------------------------------------- 1 |
open = false}/> 2 | 3 |
8 | 9 |
10 | 11 | 60 | 61 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import BottomSheet from "./BottomSheet"; 2 | import SideSheet from "./SideSheet"; 3 | 4 | export { 5 | BottomSheet, 6 | SideSheet 7 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-swipeable-sheets", 3 | "description": "Svelte components for Material Design swipeable sheets", 4 | "version": "0.0.4", 5 | "main": "index.js", 6 | "author": "Kronia", 7 | "license": "MIT", 8 | "homepage": "https://github.com/kroniapp/svelte-swipeable-sheets", 9 | "peerDependencies": { 10 | "svelte": "3.x" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /utils.js: -------------------------------------------------------------------------------- 1 | export const touch = e => e.changedTouches ? e.changedTouches[0] : e; 2 | 3 | export const deltaX = (e, startX) => startX - touch(e).clientX; 4 | 5 | export const deltaY = (e, startY) => startY - touch(e).clientY; --------------------------------------------------------------------------------