@evermade/overflow-slider 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +22 -0
- package/.github/workflows/npm-publish.yml +33 -0
- package/.nvmrc +1 -0
- package/LICENSE +21 -0
- package/README.md +104 -0
- package/changelog.md +5 -0
- package/dist/index.esm.js +694 -0
- package/dist/index.esm.min.js +2 -0
- package/dist/index.js +709 -0
- package/dist/index.min.js +2 -0
- package/dist/overflow-slider.css +1 -0
- package/docs/assets/demo.css +513 -0
- package/docs/assets/demo.js +113 -0
- package/docs/dist/overflow-slider.css +1 -0
- package/docs/dist/overflow-slider.esm.js +694 -0
- package/docs/index.html +230 -0
- package/package.json +55 -0
- package/rollup.config.js +45 -0
- package/src/core/details.ts +43 -0
- package/src/core/slider.ts +234 -0
- package/src/core/types.ts +41 -0
- package/src/core/utils.ts +24 -0
- package/src/index.ts +18 -0
- package/src/overflow-slider.scss +213 -0
- package/src/overflow-slider.ts +40 -0
- package/src/plugins/arrows.ts +107 -0
- package/src/plugins/dots.ts +129 -0
- package/src/plugins/drag-scrolling.ts +78 -0
- package/src/plugins/scroll-indicator.ts +152 -0
- package/src/plugins/skip-links.ts +61 -0
- package/tsconfig.json +6 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file is for unifying the coding style for different editors and IDEs
|
|
2
|
+
# editorconfig.org
|
|
3
|
+
|
|
4
|
+
# top-most EditorConfig file
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
charset = utf-8
|
|
9
|
+
end_of_line = lf
|
|
10
|
+
indent_size = 2
|
|
11
|
+
indent_style = tab
|
|
12
|
+
insert_final_newline = true
|
|
13
|
+
|
|
14
|
+
# Get rid of whitespace to avoid diffs with a bunch of EOL changes
|
|
15
|
+
trim_trailing_whitespace = true
|
|
16
|
+
|
|
17
|
+
[*.md]
|
|
18
|
+
max_line_length = 0
|
|
19
|
+
trim_trailing_whitespace = false
|
|
20
|
+
|
|
21
|
+
[{*.css,*.scss}]
|
|
22
|
+
indent_size = 4
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
+
|
|
4
|
+
name: Publish to NPM
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
release:
|
|
8
|
+
types: [created]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v3
|
|
15
|
+
- uses: actions/setup-node@v3
|
|
16
|
+
with:
|
|
17
|
+
node-version: 16
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm test
|
|
20
|
+
|
|
21
|
+
publish-npm:
|
|
22
|
+
needs: build
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v3
|
|
26
|
+
- uses: actions/setup-node@v3
|
|
27
|
+
with:
|
|
28
|
+
node-version: 16
|
|
29
|
+
registry-url: https://registry.npmjs.org/
|
|
30
|
+
- run: npm ci
|
|
31
|
+
- run: npm publish
|
|
32
|
+
env:
|
|
33
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v16.16.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Evermade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Overflow Slider
|
|
2
|
+
|
|
3
|
+
This is slider library that is based on CSS overflow and progressive enhancements via JavaScript. The library is written in TypeScript but it requires no dependencies.
|
|
4
|
+
|
|
5
|
+
This library is heavily inspired by [Keen Slider](https://keen-slider.io/) and provides somewhat similar programming interface but with different engine running under the hood – CSS overflow.
|
|
6
|
+
|
|
7
|
+
Overflow Slider aims to be lightweight, mobile-first and accessible. It is designed to be used in modern web projects and is very customizable and extendable via plugins and CSS.
|
|
8
|
+
|
|
9
|
+
## Demos
|
|
10
|
+
|
|
11
|
+
* [Example and demos](https://evermade.github.io/overflow-slider/)
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
If you’re using a bundler (such as Webpack or Rollup), you can install through npm:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @evermade/oveflow-slider
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Import the `OverflowSlider` along with plugins you want to use.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import {
|
|
25
|
+
OverflowSlider,
|
|
26
|
+
DragScrollingPlugin,
|
|
27
|
+
SkipLinksPlugin,
|
|
28
|
+
ArrowsPlugin,
|
|
29
|
+
ScrollIndicatorPlugin,
|
|
30
|
+
DotsPlugin
|
|
31
|
+
} from "@evermade/overflow-slider";
|
|
32
|
+
|
|
33
|
+
// minimal example
|
|
34
|
+
const minimalSlider = new OverflowSlider(
|
|
35
|
+
document.querySelector( '.slider-container-here' ),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
// example with plugins
|
|
39
|
+
const slider = new OverflowSlider(
|
|
40
|
+
document.querySelector( '.slider-container-here' ),
|
|
41
|
+
{
|
|
42
|
+
// options here
|
|
43
|
+
},
|
|
44
|
+
[
|
|
45
|
+
DragScrollingPlugin(),
|
|
46
|
+
ArrowsPlugin(),
|
|
47
|
+
ScrollIndicatorPlugin(),
|
|
48
|
+
DotsPlugin(),
|
|
49
|
+
SkipLinksPlugin(),
|
|
50
|
+
]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// note that many plugins have their own settings so you can pass them as an object
|
|
54
|
+
|
|
55
|
+
const slider = new OverflowSlider(
|
|
56
|
+
document.querySelector( '.slider-container-here' ),
|
|
57
|
+
{
|
|
58
|
+
// options here
|
|
59
|
+
},
|
|
60
|
+
[
|
|
61
|
+
ArrowsPlugin({
|
|
62
|
+
texts: {
|
|
63
|
+
buttonPrevious: 'Previous',
|
|
64
|
+
buttonNext: 'Next',
|
|
65
|
+
},
|
|
66
|
+
icons: {
|
|
67
|
+
prev: '<svg>...</svg>',
|
|
68
|
+
next: '<svg>...</svg>',
|
|
69
|
+
},
|
|
70
|
+
classNames: {
|
|
71
|
+
navContainer: 'my-nav-container',
|
|
72
|
+
prevButton: 'my-prev-button',
|
|
73
|
+
nextButton: 'my-next-button',
|
|
74
|
+
},
|
|
75
|
+
container: document.querySelector( '.my-nav-container' ),
|
|
76
|
+
}),
|
|
77
|
+
]
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Styles
|
|
83
|
+
|
|
84
|
+
You can import base styles from the library to get started. The base styles include basic styles for the slider and some plugins.
|
|
85
|
+
|
|
86
|
+
```scss
|
|
87
|
+
@import "@evermade/overflow-slider/dist/overflow-slider.css";
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
You can use the CSS variables to override some values easily.
|
|
91
|
+
|
|
92
|
+
Note that you can easily write styles from scratch if you want to. See source code from `src/overflow-slider.scss` for reference.
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
Install tools `npm install` and build `npm run build` or develop with `npm run watch`.
|
|
97
|
+
|
|
98
|
+
Releasing new version:
|
|
99
|
+
|
|
100
|
+
* Update version in `package.json`
|
|
101
|
+
* Commit to master
|
|
102
|
+
* Set tag with version number to git
|
|
103
|
+
* Create new release in GitHub
|
|
104
|
+
* NPM package is automatically published from GitHub
|