Skip to content

Commit af65a50

Browse files
committed
Merge remote-tracking branch 'origin/repo-rename-for-npm-registry' into master
2 parents 1eb24f2 + 0fdb33b commit af65a50

File tree

8 files changed

+38
-49
lines changed

8 files changed

+38
-49
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
22
*.log
33
error_log
4-
/dist/*
4+
/dist

.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# ScrollPadlock
22

3-
![Node.js CI](https://github.com/memob0x/body-scroll-lock/workflows/Node.js%20CI/badge.svg)
3+
![Node.js CI](https://github.com/memob0x/scroll-padlock/workflows/Node.js%20CI/badge.svg)
44

55
A small "CSS helper" script (~4K gzipped) which relies on **CSS variables** in order to programmatically **prevent the ability to scroll** for any scrollable element avoiding "contents jump".
66

77
🙅 Without this library:
88

9-
![without scrollbar gap compensation](docs/without-gap-compensation.gif?raw=true)
9+
![without scrollbar gap compensation](https://github.com/[username]/[reponame]/blob/[branch]/docs/without-gap-compensation.gif?raw=true)
1010

1111
💁 With this library:
1212

13-
![with scrollbar gap compensation](docs/with-gap-compensation.gif?raw=true)
13+
![with scrollbar gap compensation](https://github.com/[username]/[reponame]/blob/[branch]/docs/with-gap-compensation.gif?raw=true)
1414

1515
## TL;TR: a body scroll overview
1616

@@ -30,7 +30,7 @@ to make things worse that technique just **doesn't work** on **iOS safari**: whe
3030
This library is downloadable via **npm**, which means you can enter the following command directly in your terminal:
3131

3232
```console
33-
$ npm install @memob0x/body-scroll-lock
33+
$ npm install scroll-padlock
3434
```
3535

3636
This library is entirely written in [standard ECMAScript](https://tc39.es/), this means that you can safely include **src/padlock.mjs** module in your es6 project without affecting your final bundle size.
@@ -181,7 +181,7 @@ html.scroll-padlock--locked aside {
181181

182182
There are some edge cases in which iOS doesn't play nice: when the page is scrolled the **system bars** become smaller, at that point when the keyboard tray is triggered they become larger again; that can cause visual artifacts as you can see the following gif.
183183

184-
![ios bug](docs/ios-bug.gif?raw=true)
184+
![ios bug](https://github.com/[username]/[reponame]/blob/[branch]/docs/ios-bug.gif?raw=true)
185185

186186
That's because the element on focus is an input element and iOS forces a scroll to that element (to enhance the accessibility) on an area which would be shortly resized because of the system bars getting bigger. Pretty weird, huh?
187187

@@ -197,16 +197,16 @@ document.documentElement.addEventListener("scrollpadlockresize", () => {
197197

198198
As you can see in the following gif, things are finally back in place.
199199

200-
![ios bug](docs/ios-fix.gif?raw=true)
200+
![ios bug](https://github.com/[username]/[reponame]/blob/[branch]/docs/ios-fix.gif?raw=true)
201201

202202
## Support
203203

204204
All [modern browsers](https://teamtreehouse.com/community/what-is-a-modern-browser) have been tested, but here's a list of dependencies that might be needed in order to support older ones:
205-
* 💥DOM API "[matches](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill)" method ([polyfill](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill))
206-
* 💥[WeakMap](https://caniuse.com/mdn-javascript_builtins_weakmap)
205+
* 💥 DOM API "[matches](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill)" method ([polyfill](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill))
206+
* 💥 [WeakMap](https://caniuse.com/mdn-javascript_builtins_weakmap)
207207
* [CustomEvent](https://caniuse.com/customevent) ([polyfill](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill)), only if library [events](#events) are being used
208208
* [CSS variables](https://caniuse.com/css-variables), only for scrollbar gaps compensation (since old browsers support _overflow: hidden;_), still the JS API and events can be used to reach a workaround
209209

210210
## Demo
211211

212-
Have a look at this [demo](https://memob0x.github.io/body-scroll-lock/demo/) to check if this is what you're looking for. 🤞
212+
Have a look at this [demo](https://memob0x.github.io/scroll-padlock/demo/) to check if this is what you're looking for. 🤞

ROADMAP.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
## v1.0
2-
* [] library: class based system (initializable to any scrollable element)
3-
* [] library: provide missing jsdocs
4-
* [] tests: complete unit tests (TODO notes across test modules)
5-
* [] build: provide separate .min files
6-
* [] docs: README.md specs update (also remember to add WeakMap to the required polyfills)
7-
* [ - ] demo: make it standalone using node_modules and such (now it's location-dependant), use Vue and its router in order to supply multiple examples
1+
# next minor
82

9-
## v1.1
103
* [ - ] library: optional CSS classes / remove CSS classes and make properties more reactive + provide more events
114
* [ - ] general: ditch prettier, adopt eslint
125
* [ - ] general: npm run lint command

build.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const buildBundle = async options => {
100100
]
101101
});
102102

103-
["amd", "iife", "system", "es", "cjs"].forEach(type => {
103+
["amd", "iife", "system", "es", "cjs", "umd"].forEach(type => {
104104
// non-minified version
105105
bundles.push(bundlify(type, false));
106106

demo/dist/main.css

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -146,23 +146,6 @@ html.scroll-padlock--locked {
146146
opacity: 1;
147147
visibility: visible; }
148148

149-
.scroller {
150-
border: 2px solid black; }
151-
.scroller__scrollable {
152-
overflow: auto;
153-
max-width: 100%;
154-
max-height: 100%; }
155-
.scroller__scrollable.scroll-padlock--locked {
156-
overflow: hidden;
157-
max-width: calc(100% - var(--scroll-padlock-vertical-scrollbar-gap));
158-
padding-bottom: var(--scroll-padlock-horizontal-scrollbar-gap); }
159-
.scroller__header {
160-
position: sticky;
161-
top: 0;
162-
left: 0;
163-
padding: 10px;
164-
background: white; }
165-
166149
.console {
167150
flex-wrap: wrap;
168151
white-space: pre-wrap;
@@ -180,6 +163,23 @@ html.scroll-padlock--locked {
180163
.console__list__item:before, .console__list__item--placeholder:before {
181164
content: "$: "; }
182165

166+
.scroller {
167+
border: 2px solid black; }
168+
.scroller__scrollable {
169+
overflow: auto;
170+
max-width: 100%;
171+
max-height: 100%; }
172+
.scroller__scrollable.scroll-padlock--locked {
173+
overflow: hidden;
174+
max-width: calc(100% - var(--scroll-padlock-vertical-scrollbar-gap));
175+
padding-bottom: var(--scroll-padlock-horizontal-scrollbar-gap); }
176+
.scroller__header {
177+
position: sticky;
178+
top: 0;
179+
left: 0;
180+
padding: 10px;
181+
background: white; }
182+
183183
.search {
184184
display: flex;
185185
flex-direction: column;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"name": "@memob0x/body-scroll-lock",
3-
"version": "1.0.0",
2+
"name": "scroll-padlock",
3+
"author": "Daniele Fioroni",
4+
"description": "Locks elements scroll handling scrollbar gaps and iOS Safari with CSS variables",
5+
"main": "dist/umd/scroll-padlock.min.js",
6+
"module": "dist/es/scroll-padlock.js",
7+
"version": "1.1.1",
48
"license": "MIT",
5-
"repository": {
6-
"type": "git",
7-
"url": "ssh://git@github.com:memob0x/body-scroll-lock.git",
8-
"directory": "@memob0x/body-scroll-lock"
9-
},
10-
"publishConfig": {
11-
"registry": "https://npm.pkg.github.com/memob0x"
12-
},
9+
"repository": "https://github.com/memob0x/scroll-padlock.git",
1310
"scripts": {
1411
"build": "node ./build.mjs",
1512
"start": "node ./start.mjs",

0 commit comments

Comments
 (0)