mui-sass 0.9.6 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 611f5bb7db3d89f99ea3570b356d32d8df107219
4
- data.tar.gz: 017f19e6cf0aef2bc414a5e357276acde6f4d645
3
+ metadata.gz: 91a5cebca7469d407e8a6be7552bf98821f14c9c
4
+ data.tar.gz: 25ad2199a8d4a469cd2ed7568b8e384be0d0f19d
5
5
  SHA512:
6
- metadata.gz: 887aa81ffb2778dd2927c2a4c50de61c8941aa06056d3f2bfa93855c05fef8533245f92365d62156d17e6c1980e8a0c2a421f54f4288c164237fb8947342d69b
7
- data.tar.gz: 2ae48990a5eb3d48b211c96046274f218047dc37d8ffec4e6e1e164d1f903fa1aa114502acf68dde772648c3a99ed6e61f233935e86ecf819e757881ac6060fc
6
+ metadata.gz: 19707a144ac4038997d2df51b4dd81b5c146b6671aa572f8c60961094e7c76eb1895e8ac487f078daf54e596631aa6bea0cc028a01e27123397c6ca5ef2332ef
7
+ data.tar.gz: 97b03aa65eef7516759b672d843dae3e8a9666c6b7377cc942998736aeca8384b92b604033edc4efe59d6dbe93a17c937b24c65ff7270c1946028e32c26a1ba3
@@ -3,7 +3,7 @@ language: ruby
3
3
  rvm:
4
4
  - 2.2.6
5
5
  - 2.3.3
6
- - 2.4.0-preview3
6
+ - 2.4.0
7
7
 
8
8
  before_install: gem install bundler
9
9
 
@@ -1,3 +1,7 @@
1
+ ## 0.9.8 (2017-01-13)
2
+
3
+ - Update assets to match upstream version
4
+
1
5
  ## 0.9.6 (2016-12-20)
2
6
 
3
7
  - Update assets to match upstream version
@@ -1,5 +1,5 @@
1
1
  module Mui
2
2
  module Sass
3
- VERSION = '0.9.6'
3
+ VERSION = '0.9.8'
4
4
  end
5
5
  end
@@ -625,8 +625,10 @@ var config = require('../config'),
625
625
  jqLite = require('./jqLite'),
626
626
  scrollLock = 0,
627
627
  scrollLockCls = 'mui-scroll-lock',
628
+ scrollLockPos,
628
629
  scrollStyleEl,
629
630
  scrollEventHandler,
631
+ _scrollBarWidth,
630
632
  _supportsPointerEvents;
631
633
 
632
634
 
@@ -766,29 +768,30 @@ function enableScrollLockFn() {
766
768
 
767
769
  // add lock
768
770
  if (scrollLock === 1) {
769
- var htmlEl = document.documentElement,
770
- top = jqLite.scrollTop(window),
771
- left = jqLite.scrollLeft(window),
771
+ var doc = document,
772
+ win = window,
773
+ htmlEl = doc.documentElement,
774
+ bodyEl = doc.body,
775
+ scrollBarWidth = getScrollBarWidth(),
772
776
  cssProps,
773
- cssStr;
777
+ cssStr,
778
+ x;
774
779
 
775
780
  // define scroll lock class dynamically
776
- cssProps = [
777
- 'position:fixed',
778
- 'top:' + -top + 'px',
779
- 'right:0',
780
- 'bottom:0',
781
- 'left:' + -left + 'px'
782
- ];
783
-
784
- // scrollbar-y
785
- if (htmlEl.scrollHeight > htmlEl.clientHeight) {
786
- cssProps.push('overflow-y:scroll');
787
- }
781
+ cssProps = ['overflow:hidden'];
782
+
783
+ if (scrollBarWidth) {
784
+ // scrollbar-y
785
+ if (htmlEl.scrollHeight > htmlEl.clientHeight) {
786
+ x = parseInt(jqLite.css(bodyEl, 'padding-right')) + scrollBarWidth;
787
+ cssProps.push('padding-right:' + x + 'px');
788
+ }
788
789
 
789
- // scrollbar-x
790
- if (htmlEl.scrollWidth > htmlEl.clientWidth) {
791
- cssProps.push('overflow-x:scroll');
790
+ // scrollbar-x
791
+ if (htmlEl.scrollWidth > htmlEl.clientWidth) {
792
+ x = parseInt(jqLite.css(bodyEl, 'padding-bottom')) + scrollBarWidth;
793
+ cssProps.push('padding-bottom:' + x + 'px');
794
+ }
792
795
  }
793
796
 
794
797
  // define css class dynamically
@@ -797,10 +800,11 @@ function enableScrollLockFn() {
797
800
  scrollStyleEl = loadStyleFn(cssStr);
798
801
 
799
802
  // cancel 'scroll' event listener callbacks
800
- jqLite.on(window, 'scroll', scrollEventHandler, true);
803
+ jqLite.on(win, 'scroll', scrollEventHandler, true);
801
804
 
802
805
  // add scroll lock
803
- jqLite.addClass(htmlEl, scrollLockCls);
806
+ scrollLockPos = {left: jqLite.scrollLeft(win), top: jqLite.scrollTop(win)};
807
+ jqLite.addClass(bodyEl, scrollLockCls);
804
808
  }
805
809
  }
806
810
 
@@ -818,22 +822,42 @@ function disableScrollLockFn(resetPos) {
818
822
 
819
823
  // remove lock
820
824
  if (scrollLock === 0) {
821
- var htmlEl = document.documentElement,
822
- top = parseInt(jqLite.css(htmlEl, 'top')),
823
- left = parseInt(jqLite.css(htmlEl, 'left'));
824
-
825
825
  // remove scroll lock and delete style element
826
- jqLite.removeClass(htmlEl, scrollLockCls);
826
+ jqLite.removeClass(document.body, scrollLockCls);
827
827
  scrollStyleEl.parentNode.removeChild(scrollStyleEl);
828
828
 
829
829
  // restore scroll position
830
- window.scrollTo(-left, -top);
830
+ if (resetPos) window.scrollTo(scrollLockPos.left, scrollLockPos.top);
831
831
 
832
832
  // restore scroll event listeners
833
833
  jqLite.off(window, 'scroll', scrollEventHandler, true);
834
834
  }
835
835
  }
836
836
 
837
+ /**
838
+ * Return scroll bar width.
839
+ */
840
+ var getScrollBarWidth = function() {
841
+ // check cache
842
+ if (_scrollBarWidth !== undefined) return _scrollBarWidth;
843
+
844
+ // calculate scroll bar width
845
+ var doc = document,
846
+ bodyEl = doc.body,
847
+ el = doc.createElement('div');
848
+
849
+ el.innerHTML = '<div style="width:50px;height:50px;position:absolute;' +
850
+ 'left:-50px;top:-50px;overflow:auto;"><div style="width:1px;' +
851
+ 'height:100px;"></div></div>';
852
+ el = el.firstChild;
853
+ bodyEl.appendChild(el);
854
+ _scrollBarWidth = el.offsetWidth - el.clientWidth;
855
+ bodyEl.removeChild(el);
856
+
857
+ return _scrollBarWidth;
858
+ }
859
+
860
+
837
861
  /**
838
862
  * requestAnimationFrame polyfilled
839
863
  * @param {Function} callback - The callback function
@@ -1931,6 +1955,9 @@ function initialize(inputEl) {
1931
1955
 
1932
1956
  // add dirty class on focus
1933
1957
  jqLite.on(inputEl, 'focus', function() {jqLite.addClass(this, dirtyClass);});
1958
+
1959
+ // add dirty class if element is currently focused
1960
+ if (document.activeElement === inputEl) jqLite.addClass(inputEl, dirtyClass);
1934
1961
  }
1935
1962
 
1936
1963
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mui-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Tarasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2017-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass