Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vbarbarosh/menu

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vbarbarosh/menu - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

package.json
{
"author": "Vladimir Barbarosh",
"name": "@vbarbarosh/menu",
"version": "0.0.4",
"version": "0.0.5",
"description": "A small js for making menus",

@@ -6,0 +6,0 @@ "license": "ISC",

@@ -9,7 +9,7 @@ A small js for making menus

<script src="https://unpkg.com/@vbarbarosh/menu@0.0.4/dist/menu.js"></script>
<script src="https://unpkg.com/@vbarbarosh/menu@0.0.5/dist/menu.js"></script>
## Usage in plain JavaScript
<link href="https://unpkg.com/@vbarbarosh/menu@0.0.4/dist/theme-flat.css" rel="stylesheet">
<link href="https://unpkg.com/@vbarbarosh/menu@0.0.5/dist/theme-flat.css" rel="stylesheet">

@@ -37,3 +37,3 @@ <ul id="main" class="menu-flat">

<script src="https://unpkg.com/jquery@3.5.1/dist/jquery.js"></script>
<script src="https://unpkg.com/@vbarbarosh/menu@0.0.4/dist/menu.js"></script>
<script src="https://unpkg.com/@vbarbarosh/menu@0.0.5/dist/menu.js"></script>
<script>

@@ -55,1 +55,2 @@ menu(document.getElementById('main'))

* [Dropdown Menus with More Forgiving Mouse Movement Paths](https://css-tricks.com/dropdown-menus-with-more-forgiving-mouse-movement-paths/)
* [vue-context](https://github.com/rawilk/vue-context)

@@ -97,2 +97,46 @@ function contextmenu(menu, client_x, client_y)

function elem_ancestors(elem)
{
const out = [];
for (let i = 0, p = elem?.parentElement; p && i < 100; ++i, p = p.parentElement) {
out.push(p);
}
return out;
}
function elem_move_root(elem, client_x, client_y)
{
const w = elem.offsetWidth;
const h = elem.offsetHeight;
const ww = window.innerWidth;
const hh = window.innerHeight;
if (client_x + w < ww) {
elem.style.left = Math.round(client_x) + 'px';
}
else {
elem.style.left = Math.round(Math.max(0, client_x - w)) + 'px';
}
if (client_y + h < hh) {
elem.style.top = Math.round(client_y) + 'px';
}
else {
elem.style.top = Math.round(Math.max(0, client_y - h)) + 'px';
}
}
function elem_move_submenu(elem, client_x, client_y)
{
const p = elem.parentElement;
const p_r = p.getBoundingClientRect();
const elem_w = elem.offsetWidth;
const window_w = window.innerWidth;
if (client_x + elem_w < window_w) {
elem.style.left = Math.round(client_x) + 'px';
}
else {
elem.style.left = Math.round(Math.max(0, p_r.left - elem_w)) + 'px'
}
elem.style.top = Math.round(Math.min(client_y, window.innerHeight - elem.offsetHeight)) + 'px';
}
export default contextmenu;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc