@lemonadejs/contextmenu 5.8.0 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare namespace Contextmenu {
13
13
  disabled?: boolean;
14
14
  tooltip?: string;
15
15
  shortcut?: string;
16
- type: 'line' | undefined;
16
+ type?: 'line' | 'default';
17
17
  onclick?: (e: MouseEvent, element: HTMLElement) => void;
18
18
  icon?: string;
19
19
  render?: (e: MouseEvent, element: HTMLElement) => void;
@@ -31,6 +31,10 @@ declare namespace Contextmenu {
31
31
  interface Instance {
32
32
  options: boolean;
33
33
  open: (options: Options, x: number, y: number, e: MouseEvent) => void;
34
+ openAt: {
35
+ (event: MouseEvent | { clientX: number; clientY: number }): void;
36
+ (x: number, y: number): void;
37
+ };
34
38
  close: () => void;
35
39
  }
36
40
  }
package/dist/index.js CHANGED
@@ -321,6 +321,20 @@ if (! Modal && typeof (require) === 'function') {
321
321
  return self.modals[0].modal.closed === true;
322
322
  }
323
323
 
324
+ self.openAt = function(a, b) {
325
+ let x, y;
326
+ if (a instanceof Event || (a && a.clientX !== undefined)) {
327
+ // openAt(event)
328
+ x = a.clientX;
329
+ y = a.clientY;
330
+ } else {
331
+ // openAt(x, y)
332
+ x = a;
333
+ y = b;
334
+ }
335
+ self.open(self.options, x, y, true);
336
+ };
337
+
324
338
  self.open = function(options, x, y, adjust) {
325
339
  // Get the main modal
326
340
  let menu = self.modals[0];
package/package.json CHANGED
@@ -14,10 +14,10 @@
14
14
  "build": "webpack --config webpack.config.js"
15
15
  },
16
16
  "dependencies": {
17
- "lemonadejs": "^5.3.2",
18
- "@lemonadejs/modal": "^5.8.0"
17
+ "lemonadejs": "^5.3.6",
18
+ "@lemonadejs/modal": "^5.8.2"
19
19
  },
20
20
  "main": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
22
- "version": "5.8.0"
22
+ "version": "5.8.1"
23
23
  }