Skip to content

Commit d5c6c1f

Browse files
Convert style into scss
1 parent 4396352 commit d5c6c1f

14 files changed

+195
-52
lines changed

dist/scroller.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
[data-scroller="true"] {
1+
[data-scroller=true] {
22
overflow: hidden;
33
}
4+
45
.scroller-scrollbar {
56
display: none;
67
position: absolute;
@@ -35,6 +36,7 @@
3536
.scroller-scrollbar.scroller-active {
3637
display: block;
3738
}
39+
3840
.scroller-scrollbar {
3941
background-color: #000;
4042
opacity: 0.32;

dist/scroller.js

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
var FxpScroller = (function (exports, $$1) {
22
'use strict';
33

4-
$$1 = $$1 && $$1.hasOwnProperty('default') ? $$1['default'] : $$1;
4+
$$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
55

66
function _typeof(obj) {
7+
"@babel/helpers - typeof";
8+
79
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
810
_typeof = function (obj) {
911
return typeof obj;
@@ -70,6 +72,19 @@ var FxpScroller = (function (exports, $$1) {
7072
return _setPrototypeOf(o, p);
7173
}
7274

75+
function _isNativeReflectConstruct() {
76+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77+
if (Reflect.construct.sham) return false;
78+
if (typeof Proxy === "function") return true;
79+
80+
try {
81+
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
82+
return true;
83+
} catch (e) {
84+
return false;
85+
}
86+
}
87+
7388
function _assertThisInitialized(self) {
7489
if (self === void 0) {
7590
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -86,6 +101,25 @@ var FxpScroller = (function (exports, $$1) {
86101
return _assertThisInitialized(self);
87102
}
88103

104+
function _createSuper(Derived) {
105+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
106+
107+
return function _createSuperInternal() {
108+
var Super = _getPrototypeOf(Derived),
109+
result;
110+
111+
if (hasNativeReflectConstruct) {
112+
var NewTarget = _getPrototypeOf(this).constructor;
113+
114+
result = Reflect.construct(Super, arguments, NewTarget);
115+
} else {
116+
result = Super.apply(this, arguments);
117+
}
118+
119+
return _possibleConstructorReturn(this, result);
120+
};
121+
}
122+
89123
function _superPropBase(object, property) {
90124
while (!Object.prototype.hasOwnProperty.call(object, property)) {
91125
object = _getPrototypeOf(object);
@@ -196,9 +230,7 @@ var FxpScroller = (function (exports, $$1) {
196230
* Base class for plugin.
197231
*/
198232

199-
var BasePlugin =
200-
/*#__PURE__*/
201-
function () {
233+
var BasePlugin = /*#__PURE__*/function () {
202234
/**
203235
* Constructor.
204236
*
@@ -236,21 +268,21 @@ var FxpScroller = (function (exports, $$1) {
236268

237269
}], [{
238270
key: "defaultOptions",
239-
set: function set(options) {
240-
DEFAULT_OPTIONS[this.name] = $$1.extend(true, {}, DEFAULT_OPTIONS[this.name], options);
241-
}
271+
get:
242272
/**
243273
* Get the default options.
244274
*
245275
* @return {object}
246276
*/
247-
,
248-
get: function get() {
277+
function get() {
249278
if (undefined === DEFAULT_OPTIONS[this.name]) {
250279
DEFAULT_OPTIONS[this.name] = {};
251280
}
252281

253282
return DEFAULT_OPTIONS[this.name];
283+
},
284+
set: function set(options) {
285+
DEFAULT_OPTIONS[this.name] = $$1.extend(true, {}, DEFAULT_OPTIONS[this.name], options);
254286
}
255287
}]);
256288

@@ -549,11 +581,11 @@ var FxpScroller = (function (exports, $$1) {
549581
* Scroller class.
550582
*/
551583

552-
var Scroller =
553-
/*#__PURE__*/
554-
function (_BasePlugin) {
584+
var Scroller = /*#__PURE__*/function (_BasePlugin) {
555585
_inherits(Scroller, _BasePlugin);
556586

587+
var _super = _createSuper(Scroller);
588+
557589
/**
558590
* Constructor.
559591
*
@@ -567,22 +599,22 @@ var FxpScroller = (function (exports, $$1) {
567599

568600
_classCallCheck(this, Scroller);
569601

570-
_this = _possibleConstructorReturn(this, _getPrototypeOf(Scroller).call(this, element, options));
602+
_this = _super.call(this, element, options);
571603
_this.nativeScrollbarSize = getNativeScrollWidth();
572-
validateOptions(_assertThisInitialized(_assertThisInitialized(_this)), _this.options);
604+
validateOptions(_assertThisInitialized(_this), _this.options);
573605
_this.isVertical = _this.options.direction === DIRECTION_VERTICAL;
574-
_this.$content = wrapContent(_assertThisInitialized(_assertThisInitialized(_this)));
606+
_this.$content = wrapContent(_assertThisInitialized(_this));
575607

576608
if (_this.options.preventMouseScroll) {
577-
_this.$element.on('DOMMouseScroll.fxp.scroller mousewheel.fxp.scroller', null, _assertThisInitialized(_assertThisInitialized(_this)), onPreventMouseScroll);
609+
_this.$element.on('DOMMouseScroll.fxp.scroller mousewheel.fxp.scroller', null, _assertThisInitialized(_this), onPreventMouseScroll);
578610
}
579611

580612
if (_this.options.scrollbar) {
581-
_this.$scrollbar = generateScrollbar(_assertThisInitialized(_assertThisInitialized(_this)), _this.options.direction);
582-
$$1(window).on('resize.fxp.scroller-bar' + _this.guid, null, _assertThisInitialized(_assertThisInitialized(_this)), _this.resizeScrollbar);
613+
_this.$scrollbar = generateScrollbar(_assertThisInitialized(_this), _this.options.direction);
614+
$$1(window).on('resize.fxp.scroller-bar' + _this.guid, null, _assertThisInitialized(_this), _this.resizeScrollbar);
583615
}
584616

585-
_this.$content.on('scroll.fxp.scroller', null, _assertThisInitialized(_assertThisInitialized(_this)), onScrolling);
617+
_this.$content.on('scroll.fxp.scroller', null, _assertThisInitialized(_this), onScrolling);
586618

587619
if (_this.options.scrollerStickyHeader && $$1.fn.stickyHeader) {
588620
_this.stickyHeader = _this.$element.stickyHeader(_this.options.stickyOptions).data('fxp.stickyheader');

dist/scroller.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sticky-header.js

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
var FxpStickyHeader = (function (exports, $$1) {
22
'use strict';
33

4-
$$1 = $$1 && $$1.hasOwnProperty('default') ? $$1['default'] : $$1;
4+
$$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
55

66
function _typeof(obj) {
7+
"@babel/helpers - typeof";
8+
79
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
810
_typeof = function (obj) {
911
return typeof obj;
@@ -70,6 +72,19 @@ var FxpStickyHeader = (function (exports, $$1) {
7072
return _setPrototypeOf(o, p);
7173
}
7274

75+
function _isNativeReflectConstruct() {
76+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
77+
if (Reflect.construct.sham) return false;
78+
if (typeof Proxy === "function") return true;
79+
80+
try {
81+
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
82+
return true;
83+
} catch (e) {
84+
return false;
85+
}
86+
}
87+
7388
function _assertThisInitialized(self) {
7489
if (self === void 0) {
7590
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -86,6 +101,25 @@ var FxpStickyHeader = (function (exports, $$1) {
86101
return _assertThisInitialized(self);
87102
}
88103

104+
function _createSuper(Derived) {
105+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
106+
107+
return function _createSuperInternal() {
108+
var Super = _getPrototypeOf(Derived),
109+
result;
110+
111+
if (hasNativeReflectConstruct) {
112+
var NewTarget = _getPrototypeOf(this).constructor;
113+
114+
result = Reflect.construct(Super, arguments, NewTarget);
115+
} else {
116+
result = Super.apply(this, arguments);
117+
}
118+
119+
return _possibleConstructorReturn(this, result);
120+
};
121+
}
122+
89123
function _superPropBase(object, property) {
90124
while (!Object.prototype.hasOwnProperty.call(object, property)) {
91125
object = _getPrototypeOf(object);
@@ -196,9 +230,7 @@ var FxpStickyHeader = (function (exports, $$1) {
196230
* Base class for plugin.
197231
*/
198232

199-
var BasePlugin =
200-
/*#__PURE__*/
201-
function () {
233+
var BasePlugin = /*#__PURE__*/function () {
202234
/**
203235
* Constructor.
204236
*
@@ -236,21 +268,21 @@ var FxpStickyHeader = (function (exports, $$1) {
236268

237269
}], [{
238270
key: "defaultOptions",
239-
set: function set(options) {
240-
DEFAULT_OPTIONS[this.name] = $$1.extend(true, {}, DEFAULT_OPTIONS[this.name], options);
241-
}
271+
get:
242272
/**
243273
* Get the default options.
244274
*
245275
* @return {object}
246276
*/
247-
,
248-
get: function get() {
277+
function get() {
249278
if (undefined === DEFAULT_OPTIONS[this.name]) {
250279
DEFAULT_OPTIONS[this.name] = {};
251280
}
252281

253282
return DEFAULT_OPTIONS[this.name];
283+
},
284+
set: function set(options) {
285+
DEFAULT_OPTIONS[this.name] = $$1.extend(true, {}, DEFAULT_OPTIONS[this.name], options);
254286
}
255287
}]);
256288

@@ -330,11 +362,11 @@ var FxpStickyHeader = (function (exports, $$1) {
330362
* Sticky Header class.
331363
*/
332364

333-
var StickyHeader =
334-
/*#__PURE__*/
335-
function (_BasePlugin) {
365+
var StickyHeader = /*#__PURE__*/function (_BasePlugin) {
336366
_inherits(StickyHeader, _BasePlugin);
337367

368+
var _super = _createSuper(StickyHeader);
369+
338370
/**
339371
* Constructor.
340372
*
@@ -348,9 +380,9 @@ var FxpStickyHeader = (function (exports, $$1) {
348380

349381
_classCallCheck(this, StickyHeader);
350382

351-
_this = _possibleConstructorReturn(this, _getPrototypeOf(StickyHeader).call(this, element, options));
383+
_this = _super.call(this, element, options);
352384

353-
_this.$element.on('scroll.fxp.stickyheader', $$1.proxy(_this.checkPosition, _assertThisInitialized(_assertThisInitialized(_this))));
385+
_this.$element.on('scroll.fxp.stickyheader', $$1.proxy(_this.checkPosition, _assertThisInitialized(_this)));
354386

355387
_this.refresh();
356388

dist/sticky-header.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
import '../less/scroller.less';
10+
import '../scss/scroller.scss';
1111
import '../js/scroller';
1212
import '../js/sticky-header';

0 commit comments

Comments
 (0)