Skip to content

Commit

Permalink
lazy eval + drawer no-animate
Browse files Browse the repository at this point in the history
  • Loading branch information
spck-io committed Apr 28, 2020
1 parent abf5e66 commit 7a63617
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 29 deletions.
2 changes: 1 addition & 1 deletion dist/spck-ui.css

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions dist/spck-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5958,7 +5958,8 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdownOptions: {
pos: "bottom-center",
marginX: 0,
marginY: 8
marginY: 8,
lazy: false
},
tooltipOptions: {
pos: "top-center",
Expand Down Expand Up @@ -6023,16 +6024,22 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdown: value
}, dropdownOptions);

var ui = self.dropdownPopup = exports.new(dropdown, document.body);
if (!dropdown.lazy) {
self.dropdownPopup = exports.new(dropdown, document.body);
}

config.on = config.on || {};
self.addListener(config.dropdownEvent, function (config, node) {
var relativeNode = $$(dropdown.relativeTo);
relativeNode = relativeNode ? relativeNode.el : node;
var bb = {left: 0, right: window.innerWidth, top: 0, bottom: window.innerHeight};
ui.open(config);
ui.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
ui.moveWithinBoundary(bb);
if (!self.dropdownPopup) {
self.dropdownPopup = exports.new(dropdown, document.body);
}
var popup = self.dropdownPopup
popup.open(config);
popup.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
popup.moveWithinBoundary(bb);
});
},
uploader: function (value) {
Expand Down Expand Up @@ -7190,7 +7197,7 @@ window.UI = window.ui = (function (exports, window, UIkit) {
if (!$this.openable()) return false;
if (this.beganPan) {
return true;
} else if ($this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
} else if (!exports.support.animation || $this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
return false;
} else {
var firstTouch = e.touches[0];
Expand Down Expand Up @@ -9510,12 +9517,14 @@ window.UI = window.ui = (function (exports, window, UIkit) {
}

if (!$this.closeInProgress && $this.onAnimate()) {
if (raf) {
if (exports.support.animation && raf) {
$this.closeInProgress = true;
raf(update);
}
else {
$this.onCompleteSwipe();
if (!reverse) {
$this.onCompleteSwipe();
}
$this.reset();
}
}
Expand Down
2 changes: 1 addition & 1 deletion dist/spck-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/spck-ui.css

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions docs/spck-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5958,7 +5958,8 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdownOptions: {
pos: "bottom-center",
marginX: 0,
marginY: 8
marginY: 8,
lazy: false
},
tooltipOptions: {
pos: "top-center",
Expand Down Expand Up @@ -6023,16 +6024,22 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdown: value
}, dropdownOptions);

var ui = self.dropdownPopup = exports.new(dropdown, document.body);
if (!dropdown.lazy) {
self.dropdownPopup = exports.new(dropdown, document.body);
}

config.on = config.on || {};
self.addListener(config.dropdownEvent, function (config, node) {
var relativeNode = $$(dropdown.relativeTo);
relativeNode = relativeNode ? relativeNode.el : node;
var bb = {left: 0, right: window.innerWidth, top: 0, bottom: window.innerHeight};
ui.open(config);
ui.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
ui.moveWithinBoundary(bb);
if (!self.dropdownPopup) {
self.dropdownPopup = exports.new(dropdown, document.body);
}
var popup = self.dropdownPopup
popup.open(config);
popup.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
popup.moveWithinBoundary(bb);
});
},
uploader: function (value) {
Expand Down Expand Up @@ -7190,7 +7197,7 @@ window.UI = window.ui = (function (exports, window, UIkit) {
if (!$this.openable()) return false;
if (this.beganPan) {
return true;
} else if ($this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
} else if (!exports.support.animation || $this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
return false;
} else {
var firstTouch = e.touches[0];
Expand Down Expand Up @@ -9510,12 +9517,14 @@ window.UI = window.ui = (function (exports, window, UIkit) {
}

if (!$this.closeInProgress && $this.onAnimate()) {
if (raf) {
if (exports.support.animation && raf) {
$this.closeInProgress = true;
raf(update);
}
else {
$this.onCompleteSwipe();
if (!reverse) {
$this.onCompleteSwipe();
}
$this.reset();
}
}
Expand Down
5 changes: 4 additions & 1 deletion less/core/offcanvas.less
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@
.hook-offcanvas;
}

.uk-offcanvas.uk-active { display: block; }
.uk-offcanvas.uk-active {
display: block;
background: rgba(0, 0, 0, 0.48);
}


/* Sub-object `uk-offcanvas-page`
Expand Down
4 changes: 3 additions & 1 deletion less/core/scroller.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
}

.uk-scroller-wrapper {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
overflow: hidden;
width: 100%;
height: inherit;
position: relative;
z-index: 1;
margin-right: -8px;
Expand Down
25 changes: 17 additions & 8 deletions src/spck-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,8 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdownOptions: {
pos: "bottom-center",
marginX: 0,
marginY: 8
marginY: 8,
lazy: false
},
tooltipOptions: {
pos: "top-center",
Expand Down Expand Up @@ -1559,16 +1560,22 @@ window.UI = window.ui = (function (exports, window, UIkit) {
dropdown: value
}, dropdownOptions);

var ui = self.dropdownPopup = exports.new(dropdown, document.body);
if (!dropdown.lazy) {
self.dropdownPopup = exports.new(dropdown, document.body);
}

config.on = config.on || {};
self.addListener(config.dropdownEvent, function (config, node) {
var relativeNode = $$(dropdown.relativeTo);
relativeNode = relativeNode ? relativeNode.el : node;
var bb = {left: 0, right: window.innerWidth, top: 0, bottom: window.innerHeight};
ui.open(config);
ui.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
ui.moveWithinBoundary(bb);
if (!self.dropdownPopup) {
self.dropdownPopup = exports.new(dropdown, document.body);
}
var popup = self.dropdownPopup
popup.open(config);
popup.positionNextTo(relativeNode, dropdown.pos, dropdown.marginX, dropdown.marginY);
popup.moveWithinBoundary(bb);
});
},
uploader: function (value) {
Expand Down Expand Up @@ -2726,7 +2733,7 @@ window.UI = window.ui = (function (exports, window, UIkit) {
if (!$this.openable()) return false;
if (this.beganPan) {
return true;
} else if ($this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
} else if (!exports.support.animation || $this.$blockDrawerOpen || exports.$scrollState == 'scroll') {
return false;
} else {
var firstTouch = e.touches[0];
Expand Down Expand Up @@ -5046,12 +5053,14 @@ window.UI = window.ui = (function (exports, window, UIkit) {
}

if (!$this.closeInProgress && $this.onAnimate()) {
if (raf) {
if (exports.support.animation && raf) {
$this.closeInProgress = true;
raf(update);
}
else {
$this.onCompleteSwipe();
if (!reverse) {
$this.onCompleteSwipe();
}
$this.reset();
}
}
Expand Down

0 comments on commit 7a63617

Please sign in to comment.