Skip to content

Commit

Permalink
enhance(core): fast initialization (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-rr committed Jun 24, 2023
1 parent 2f32800 commit b36600b
Show file tree
Hide file tree
Showing 23 changed files with 294 additions and 257 deletions.
6 changes: 3 additions & 3 deletions dist/core/index.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/cupertino-pane.esm.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* Cupertino Pane 1.3.21
* Cupertino Pane 1.3.3
* New generation interfaces for web3 progressive applications
* https://github.com/roman-rr/cupertino-pane/
*
* Copyright 2019-2023 Roman Antonov (roman-rr)
*
* Released under the MIT License
*
* Released on: June 19, 2023
* Released on: June 24, 2023
*/

/******************************************************************************
Expand Down Expand Up @@ -710,10 +710,10 @@ class Events {
*/
handleTopperLowerPositions(coords) {
// Disallow drag upper than top point
// And drag bottom when upper than top point
// And drag bottom when upper than top point (for zStack allowed)
if (!this.settings.upperThanTop
&& (coords.newVal <= this.breakpoints.topper
|| coords.clientY <= this.breakpoints.topper)) {
|| (coords.clientY <= this.breakpoints.topper && !this.settings.zStack))) {
this.steps = [];
return this.breakpoints.topper;
}
Expand Down Expand Up @@ -1046,6 +1046,7 @@ class Transitions {
this.isPaneHidden = true;
}
if (params.type === CupertinoTransition.Breakpoint
|| params.type === CupertinoTransition.Present
|| params.type === CupertinoTransition.TouchEnd) {
this.isPaneHidden = false;
}
Expand Down Expand Up @@ -2089,6 +2090,7 @@ class CupertinoPane {
console.warn('Cupertino Pane: specified selector or DOM element already in use', this.selector);
return;
}
console.time("Presenting time");
// Emit event
this.emit('onWillPresent');
this.updateScreenHeights();
Expand All @@ -2099,11 +2101,10 @@ class CupertinoPane {
// Custom transitions for present/destroy: set styles
Object.assign(this.paneEl.style, (_a = conf === null || conf === void 0 ? void 0 : conf.transition) === null || _a === void 0 ? void 0 : _a.from);
// Show elements
// For some reason need timeout after show wrapper to make
// For some reason need requestAnimationFrame after show wrapper to make
// initial transition works
// TODO: resolve 100ms timeout with some render callbacks
// TODO: resolve animation frame for transition on pane init
this.wrapperEl.style.display = 'block';
yield new Promise(resolve => setTimeout(resolve, 100));
this.contentEl.style.display = 'block';
this.wrapperEl.classList.add('rendered');
this.rendered = true;
Expand Down Expand Up @@ -2140,6 +2141,9 @@ class CupertinoPane {
}
// System event
this.emit('beforePresentTransition', { animate: conf.animate });
// One frame before transition
yield new Promise(resolve => requestAnimationFrame(resolve));
console.timeEnd("Presenting time");
if (conf.animate) {
yield this.transitions.doTransition({
type: 'present', conf,
Expand Down
6 changes: 3 additions & 3 deletions dist/cupertino-pane.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cupertino-pane.esm.min.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/cupertino-pane.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/cupertino-pane.js.map

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

6 changes: 3 additions & 3 deletions dist/cupertino-pane.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/modules/backdrop.js

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

Loading

0 comments on commit b36600b

Please sign in to comment.