Skip to content

Commit

Permalink
feat: global refactor: make api more consistent & reliable
Browse files Browse the repository at this point in the history
using external API also for internal processes to add possibility to override some of them

BREAKING CHANGE: .updateStyles method got renamed into .update, also - first argument type now is supposed to be a partial of configuration object
BREAKING CHANGE: createNewChild is no longer exposed - it's part of an private, internal API
BREAKING CHANGE: there is no longer any css file to be included - whole styling is being generated by JS
  • Loading branch information
Jakub Freisler committed Feb 6, 2020
1 parent 53c7d17 commit 7522a9f
Show file tree
Hide file tree
Showing 28 changed files with 910 additions and 861 deletions.
11 changes: 0 additions & 11 deletions .postcssrc

This file was deleted.

8 changes: 6 additions & 2 deletions README.md
Expand Up @@ -11,6 +11,10 @@
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Bundle size](https://img.shields.io/bundlephobia/minzip/frs-hide-scrollbar)](https://bundlephobia.com/result?p=frs-hide-scrollbar)

FRS-hide-scrollbar is cross-browser (supports both desktop & mobile devices), simple & lightweight library for hiding both horizontal & vertical scrollbars!
FRS-hide-scrollbar is a cross-browser (supports both desktop & mobile devices), simple & lightweight library for hiding both horizontal & vertical scrollbars!

For more information, please see [docs](https://frsource.github.io/FRS-hide-scrollbar/).
## Table of contents

* [Installation](https://frsource.github.io/FRS-hide-scrollbar/installation)
* [Usage](https://frsource.github.io/FRS-hide-scrollbar/usage)
* [Example](https://frsource.github.io/FRS-hide-scrollbar/example)
1 change: 0 additions & 1 deletion dist/FRS-hide-scrollbar.css

This file was deleted.

2 changes: 1 addition & 1 deletion dist/FRS-hide-scrollbar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/FRS-hide-scrollbar.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/FRS-hide-scrollbar.mjs
@@ -1,2 +1,2 @@
var e,t=window.FRSHideScrollbar||{},i=t.config=t.config||{};function l(){var e=n("div",document.body);e.style.position="absolute",e.style["z-index"]="-1",e.style.width="100px",e.style.overflow="scroll";var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t!==i.scrollWidth&&(i.scrollWidth=t,s()),t}function n(e,t){return t.appendChild(document.createElement(e))}function s(t,l){if(void 0===t&&(t=i.styleElement),void 0===l&&(l=e),l){var n=l.styleElement,s=n.innerText.lastIndexOf("."+l.className+"{margin-right:-");n.innerText=n.innerText.substring(0,s)}0!==i.scrollWidth&&(e=Object.assign({},i),t.innerText+="."+i.className+"{margin-right:-"+(i.scrollWidth+.5)+"px;height:calc(100% + "+i.scrollWidth+"px)}")}t.refreshScrollWidth=l,t.createNewChild=n,t.updateStyles=s,i.className=i.className||"frs-hide-scroll",i.wrapperClassName=i.wrapperClassName||"frs-hide-scroll-wrapper",i.styleElement=i.styleElement||document.getElementsByTagName("style")[0]||n("style",document.head),i.autoInit=void 0===i.autoInit||i.autoInit,i.autoInit&&(document.readyState&&"loading"!==document.readyState?l():window.addEventListener("load",l,{passive:!0}),window.addEventListener("resize",l,{passive:!0}));export{t as FRSHideScrollbar};
var e=window.FRSHideScrollbar&&window.FRSHideScrollbar.FRSHideScrollbar,t=Object.assign({className:"frs-hide-scroll",wrapperClassName:"frs-hide-scroll-wrapper",autoInit:!0},e&&e.config||{}),l={refreshScrollWidth:function(){var e=r("div",document.body);e.style.position="absolute",e.style["z-index"]="-1",e.style.width="100px",e.style.overflow="scroll";var n=e.offsetWidth-e.clientWidth;document.body.removeChild(e),n!==t.scrollWidth&&(t.scrollWidth=n,l.update())},update:function(e,l){if(void 0===e&&(e=t),void 0===l&&(l=o),l){var n=l.styleElement,r=n.textContent.lastIndexOf("."+l.wrapperClassName+"{overflow:hidden;height:100%}");n.textContent=n.textContent.substring(0,r)}Object.assign(t,e);var i="height:",s=t.scrollWidth;i+=0===s?"100%":"calc(100% + "+s+"px);margin-right:-"+(s+.5)+"px",o=Object.assign({},t),t.styleElement.textContent+="."+t.wrapperClassName+"{overflow:hidden;height:100%}."+t.className+"{overflow:scroll;"+i+"}"},config:t};t.styleElement=t.styleElement||r("style",document.head);var n,o=Object.assign({},t);function r(e,t){return t.appendChild(document.createElement(e))}t.autoInit&&(n=function(){return l.refreshScrollWidth()},document.readyState&&"loading"!==document.readyState?n():window.addEventListener("load",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0}));export{l as FRSHideScrollbar};
//# sourceMappingURL=FRS-hide-scrollbar.mjs.map

0 comments on commit 7522a9f

Please sign in to comment.