Skip to content

Commit 6128416

Browse files
author
Hamed
committed
first version
1 parent 593e020 commit 6128416

File tree

7 files changed

+2464
-0
lines changed

7 files changed

+2464
-0
lines changed

.babelrc

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"presets": [
3+
[
4+
"env",
5+
{
6+
"targets": {
7+
"browsers": [
8+
"last 4 versions",
9+
"safari >= 7"
10+
]
11+
},
12+
"modules": false
13+
}
14+
]
15+
],
16+
"plugins": [
17+
"transform-object-rest-spread"
18+
],
19+
"env": {
20+
"test": {
21+
"presets": [
22+
[
23+
"env",
24+
{
25+
"targets": {
26+
"node": 8
27+
}
28+
}
29+
]
30+
]
31+
}
32+
}
33+
}

.gitignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
3+
### Node template
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
11+
# Runtime data
12+
pids
13+
*.pid
14+
*.seed
15+
*.pid.lock
16+
17+
# Directory for instrumented libs generated by jscoverage/JSCover
18+
lib-cov
19+
20+
# Coverage directory used by tools like istanbul
21+
coverage
22+
23+
# nyc test coverage
24+
.nyc_output
25+
26+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
27+
.grunt
28+
29+
# Bower dependency directory (https://bower.io/)
30+
bower_components
31+
32+
# node-waf configuration
33+
.lock-wscript
34+
35+
# Compiled binary addons (https://nodejs.org/api/addons.html)
36+
build/Release
37+
38+
# Dependency directories
39+
node_modules/
40+
jspm_packages/
41+
42+
# Typescript v1 declaration files
43+
typings/
44+
45+
# Optional npm cache directory
46+
.npm
47+
48+
# Optional eslint cache
49+
.eslintcache
50+
51+
# Optional REPL history
52+
.node_repl_history
53+
54+
# Output of 'npm pack'
55+
*.tgz
56+
57+
# Yarn Integrity file
58+
.yarn-integrity
59+
60+
# dotenv environment variables file
61+
.env
62+
63+
# next.js build output
64+
.next
65+
66+
# IntelliJ project files
67+
.idea
68+
*.iml
69+
out
70+
gen
71+
72+
dist/

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,58 @@
11
# os-scroll-chain
22
OverlayScrollbars Extension to prevent scroll chaining
3+
4+
## Installation
5+
6+
```sh
7+
# with npm
8+
npm install --save os-scroll-chain
9+
10+
# with yarn
11+
yarn add os-scroll-chain
12+
```
13+
14+
### Module
15+
16+
```js
17+
// with es
18+
import 'os-scroll-chain';
19+
20+
// with commonjs
21+
require('os-scroll-chain');
22+
```
23+
24+
### Browser
25+
26+
Include the script file from node_modules directory:
27+
28+
```html
29+
<script type="text/javascript" src="node_modules/os-scroll-chain/dist/os-scroll-chain.min.js"></script>
30+
```
31+
32+
Or you can use CDN:
33+
34+
```html
35+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/os-scroll-chain@1/dist/os-scroll-chain.min.js"></script>
36+
```
37+
38+
## Usage
39+
40+
Once installed, it can be added to OverlayScrollbars like this:
41+
42+
```js
43+
instance.addExt('scroll-chain');
44+
instance.addExt('scroll-chain', {vertical: false});
45+
instance.addExt('scroll-chain', {vertical: true, horizontal: false});
46+
```
47+
48+
49+
### Options
50+
Option | Type | Default Value
51+
------------ | ------------- | -------------
52+
vertical | Boolean | true
53+
horizontal | Boolean | true
54+
55+
If you have discovered a 🐜 or have a feature suggestion, feel free to create an [issue](https://github.com/parsisolution/os-scroll-chain/issues) on Github.
56+
57+
# License
58+
Released under The MIT [License](https://github.com/parsisolution/os-scroll-chain/blob/master/LICENSE). Copyright (c) hamed-ehtesham.

package.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "os-scroll-chain",
3+
"version": "1.0.0",
4+
"description": "OverlayScrollbars Extension to prevent scroll chaining",
5+
"main": "dist/os-scroll-chain.min.js",
6+
"scripts": {
7+
"dev": "cross-env-shell \"rollup -c rollup.config.js\"",
8+
"build": "cross-env NODE_ENV=production npm run dev",
9+
"watch": "cross-env NODE_ENV=development npm run dev -- --watch",
10+
"release": "npm run build && standard-version"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "git+https://github.com/parsisolution/os-scroll-chain.git"
15+
},
16+
"files": [
17+
"src",
18+
"dist"
19+
],
20+
"keywords": [
21+
"OverlayScrollbars",
22+
"Extension",
23+
"Prevent",
24+
"Scroll-chain",
25+
"Scroll chaining"
26+
],
27+
"author": "Hamed Ehtesham",
28+
"license": "MIT",
29+
"bugs": {
30+
"url": "https://github.com/parsisolution/os-scroll-chain/issues"
31+
},
32+
"homepage": "https://github.com/parsisolution/os-scroll-chain#readme",
33+
"peerDependencies": {
34+
"overlayscrollbars": "^1.5.0"
35+
},
36+
"devDependencies": {
37+
"babel-core": "^6.26.0",
38+
"babel-plugin-external-helpers": "^6.22.0",
39+
"babel-plugin-transform-object-rest-spread": "^6.26.0",
40+
"babel-preset-env": "^1.7.0",
41+
"cross-env": "^5.2.0",
42+
"rollup": "^0.66.6",
43+
"rollup-plugin-babel": "3",
44+
"rollup-plugin-license": "^0.7.0",
45+
"rollup-plugin-node-resolve": "^3.4.0",
46+
"rollup-plugin-uglify": "^6.0.0",
47+
"standard-version": "^4.4.0"
48+
}
49+
}

rollup.config.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const babel = require('rollup-plugin-babel');
4+
import {uglify} from 'rollup-plugin-uglify';
5+
6+
const license = require('rollup-plugin-license');
7+
const {name} = require('./package.json');
8+
9+
const base = __dirname;
10+
const src = path.resolve(base, 'src');
11+
const dist = path.resolve(base, 'dist');
12+
13+
// Ensure dist directory exists
14+
if (!fs.existsSync(dist)) {
15+
fs.mkdirSync(dist)
16+
}
17+
18+
function defaultPlugins() {
19+
return [
20+
babel({
21+
plugins: ['external-helpers']
22+
}),
23+
uglify({
24+
sourcemap: true,
25+
// numWorkers: 1,
26+
}),
27+
license({
28+
// sourceMap: true,
29+
// cwd: '.', // Default is process.cwd()
30+
31+
banner: `<%= pkg.name %> v<%= pkg.version %>
32+
(c) <%= moment().format('YYYY') %> <%= pkg.author %>
33+
Released under the <%= pkg.license %> License.`,
34+
}),
35+
]
36+
}
37+
38+
let plugins = defaultPlugins();
39+
plugins.splice(1, 1);
40+
41+
let productionPlugins = defaultPlugins();
42+
43+
let configs = [
44+
{
45+
input: path.resolve(src, 'index.js'),
46+
// external: Object.keys(dependencies),
47+
plugins,
48+
output: {
49+
format: 'iife',
50+
file: path.resolve(dist, name + '.js'),
51+
sourcemap: true
52+
},
53+
}
54+
];
55+
56+
if (process.env.NODE_ENV === 'production') {
57+
let newConfigs = [
58+
{
59+
input: path.resolve(src, 'index.js'),
60+
plugins: productionPlugins,
61+
output: {
62+
format: 'iife',
63+
file: path.resolve(dist, name + '.min.js'),
64+
sourcemap: true
65+
},
66+
}
67+
];
68+
configs.push(...newConfigs);
69+
}
70+
71+
module.exports = configs;

0 commit comments

Comments
 (0)