Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
cupertino-pane
Advanced tools
Cupertino Pane is great modern slide-over pane with touch technologies.
Right like in Apple Maps, Apple Stocks, Apple Music and other modern apps.
⭐ We appreciate your star, it helps!
We officially support the last two versions of every major browser. Specifically, we test on the following browsers
Browser | Operating system |
---|---|
Chrome | Android, Windows, macOS, and Linux |
Firefox | Windows, macOS, and Linux |
Safari | iOS |
WkWebView | iOS |
Android WebView | Android |
npm install cupertino-pane
If you don't want to include Cupertino Pane files in your project, you may use it from CDN. The following files are available:
<script src="https://unpkg.com/cupertino-pane/dist/cupertino-pane.js"></script>
<script src="https://unpkg.com/cupertino-pane/dist/cupertino-pane.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<body>
...
<script src="path/to/cupertino-pane.min.js"></script>
</body>
</html>
<div class="cupertino-pane">
<h1>Header</h1>
<div class="content">Content</div>
</div>
.cupertino-pane {
margin: 20px;
}
<body>
...
<script>
window.onload = function () {
var myPane = new CupertinoPane(
'.cupertino-pane', // Pane container selector
{
parentElement: 'body', // Parent container
breaks: {
middle: { enabled: true, height: 300, bounce: true },
bottom: { enabled: true, height: 80 },
},
onDrag: () => console.log('Drag event')
}
);
myPane.present({animate: true});
};
</script>
</body>
$(document).ready(function () {
//initialize pane when document ready
var myPane = new CupertinoPane('.cupertino-pane', { /* ... */ });
myPane.present({animate: true});
});
Cupertino Pane package comes with ES module version which can be used where supported or with bundlers like Webpack or Rollup:
import { CupertinoPane, CupertinoSettings } from 'cupertino-pane';
let settings: CupertinoSettings = { /* ... */ };
let myPane = new CupertinoPane('.cupertino-pane', settings);
myPane.present({animate: true});
You can pass html element or string selector to class constructor
// String selector
new CupertinoPane('.cupertino-pane');
// HTML element
let element = document.querySelector('.cupertino-pane');
new CupertinoPane(element); // HTMLElement
Property | Type | Default | Description |
---|---|---|---|
inverse | boolean | false | On true will change pane direction from bottom-to-top to top-to-bottom |
parentElement | string | Parent element selector | Element selector where pane will rendered |
followerElement | string | Follower element selector | Element with selector will following pane transitions |
pushElement | string | Push element selector | DOM Element will be pushed and scaled |
pushMinHeight | number | Most bottom available point | Height from which 3d push effect will be started |
pushYOffset | number | Negative margin value to place pushed element upper | |
initialBreak | 'top' | 'middle' | 'bottom' | 'middle' | Initial pane position |
darkMode | boolean | false | Initial pane styles |
backdrop | boolean | false | Dimmed overlay will rendered with pane if true |
backdropOpacity | number | 0.4 | Dimmed overlay opacity value |
animationType | string | 'ease' | Base transition timing function |
animationDuration | number | 300 | Transition property duration |
bottomClose | boolean | false | Close pane with drag to bottom breakpoint |
fastSwipeClose | boolean | false | Close pane with fast drag to bottom direction |
fastSwipeSensivity | number | 3 | Increase value and fast swipes become heavier |
freeMode | boolean | false | On true will remove automatical magnetic effects to near breakpoint |
lowerThanBottom | boolean | true | By default allow user to drag pane lower than bottom position. On false will automatically place pane to bottom position on lower than bottom attemption |
upperThanTop | boolean | false | Allow user to drag pane upper than maximum top position. Useful with bulletin style without overflow-y |
touchAngle | number | null | Allowable angle (in degrees) to trigger touch move |
buttonClose | boolean | true | Determinate whetever close button will render or not |
bottomOffset | number | 0 | Margin bottom for pane from screen bottom point |
topperOverflow | boolean | true | Ability to scroll content inside pane if topper point reached |
topperOverflowOffset | number | 0 | Offset from screen bottom to the end of overflow content |
showDraggable | boolean | true | Render rectangular shape on the top of pane |
draggableOver | boolean | true | Render rectangular shape over a pane |
clickBottomOpen | boolean | true | If bottom position reached, simple click to pane will open pane to the next upper point |
dragBy | string[] | null | Array of selectors for whom elements drag events will be attached. By default drag events attached to pane element. If you are about to drag only with draggable component set option to ['.pane .draggable'] |
preventClicks | boolean | true | Prevent accidental unwanted clicks events during move gestures |
handleKeyboard | boolean | true | Pane will be pushed up on open keyboard (only for cordova/capacitor/phonegap applications) |
touchMoveStopPropagation | boolean | false | If enabled, then propagation of "touchmove" will be stopped |
simulateTouch | boolean | true | Simulate touch events for Desktop |
passiveListeners | boolean | true | (Indicates that the function specified by listener will never call preventDefault()) |
Package now supports 3 base breakpoints
const pane = new CupertinoPane('.cupertino-pane', {
breaks: {
top: { // Topper point that pane can reach
enabled: true, // Enable or disable breakpoint
height: 700, // Pane breakpoint height
bounce: true // Bounce pane on transition
},
middle: { ... },
bottom: { ... }
}
});
Bottom and middle heights normalized accross devices by default
Default top height: window.screen.height - (135 * 0.35)
Add property bounce
to break and enjoy transitions in apple stocks style with cubic-bezier(0.175, 0.885, 0.370, 1.120)
The function that executes when the event fires.
Name | Type | Description |
---|---|---|
onDidDismiss | void: () => {} | Call after pane will dissapeared |
onWillDismiss | void: () => {} | Call before pane will dissapeared |
onDidPresent | void: () => {} | Call after pane will present |
onWillPresent | void: () => {} | Call before panel will present |
onDragStart | void: () => {} | Call when detect user drag event on pane |
onDrag | void: () => {} | Call executes on each new position of pane |
onDragEnd | void: () => {} | Executes when drag event complete |
onBackdropTap | void: () => {} | Call when user tap backdrop overlay |
onTransitionStart | void: () => {} | Executes before auto transition and animation start |
onTransitionEnd | void: () => {} | Executes when transition and animation complete |
Will render pane DOM and show pane with setted params.
myPane.present();
Will change pane position with animation to selected breakpoint.
myPane.moveToBreak('top');
Will move pane to exact height with animation. Breakpoints will saved.
myPane.moveToHeight(575);
Dissappear pane from screen, still keep pane in DOM.
myPane.hide();
Remove pane from DOM and clear styles
myPane.destroy();
Determinate if pane position was moved out of screen, but pane still exist in DOM. true - in DOM but not visible, false - in DOM and visible, null - not rendered
if (myPane.isHidden()) {
myPane.moveToBreak('top');
}
Method return current break position in text format ('top' | 'middle' | 'bottom)
if (myPane.currentBreak() === 'top') {
myPane.moveToBreak('bottom');
}
Method disable any drag actions for pane
myPane.disableDrag();
Method enable any drag actions for pane
myPane.enableDrag();
Show/Hide backdrop method
myPane.backdrop({show: true}); // show
myPane.backdrop({show: false}); // hide
Enable dark scheme color for some elements
myPane.setDarkMode({enable: true}); // enable darkmode
Method updates breakpoints configuration for rendered Pane
myPane.setBreakpoints({
top: {
enabled: true,
height: 700,
bounce: true
},
middle: { ... },
bottom: { ... }
});
Using in pair with onWillDismiss()
callback to prevent pane from destroy on custom conditions
const settings = {
...
onWillDismiss: () => {
if (disallowDismiss) {
drawer.preventDismiss();
}
}
}
Set for element to automaticaly hide on reach bottom breakpoint.
<div class="cupertino-pane">
<h1>Header</h1>
<div class="content" hide-on-bottom>Content</div>
</div>
Set for element with overflow ability. By default using for full pane area, but in some cases good useful with header.
<div class="cupertino-pane">
<h1>Header</h1>
<div class="content" overflow-y>Content</div>
</div>
Inputs and textareas in pane may push mobile keyboard on devices, and close pane visibility. Next cases describe how to proper handle this issues.
User's must use input focus/blur callback's to handle keyboard. Example:
<input onfocus="keyboardOpen()" onblur="keyboardClose()" />
function keyboardOpen () {
pane.moveToBreak('top'); // or moveToHeight(current + keyboardHeight);
}
function keyboardClose () {
pane.moveToBreak('middle'); // or moveToHeight(current - keyboardHeight);
}
By default, we are now handle keyboard in hybrid mobile applications and push pane to exact keyboard height.
If you would like handle this part by yourself, set option handleKeyboard: false
.
We are welcome contributions of all kinds from anyone. Please review the contributing guideline.
Licensed under the MIT License. View license.
[1.1.94] - 2020-11-15
handleKeyboard: false
.preventDismiss()
method. Using in pair with onWillDismiss()
callback to prevent pane from destroy on custom conditions #82const settings = {
...
onWillDismiss: () => {
if (disallowDismiss) {
drawer.preventDismiss();
}
}
}
FAQs
Cupertino Panes is multi-functional modals, cards & panes with touch technologies.
The npm package cupertino-pane receives a total of 5,161 weekly downloads. As such, cupertino-pane popularity was classified as popular.
We found that cupertino-pane demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.