@node-projects/web-component-designer 0.0.245 → 0.0.246

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.
@@ -11,15 +11,16 @@ export declare class ContextMenu {
11
11
  static count: number;
12
12
  menu: IContextMenuItem[];
13
13
  options: IContextMenuOptions;
14
+ context: any;
14
15
  private num;
15
16
  private _menuElement;
16
- constructor(menu: IContextMenuItem[], options?: IContextMenuOptions);
17
+ constructor(menu: IContextMenuItem[], options?: IContextMenuOptions, context?: any);
17
18
  reload(): void;
18
19
  renderLevel(level: IContextMenuItem[]): HTMLUListElement;
19
20
  display(event: MouseEvent): void;
20
21
  _windowResize(): void;
21
22
  _windowDown(e: MouseEvent): boolean;
22
23
  _windowKeyUp(e: KeyboardEvent): void;
23
- static show(menu: IContextMenuItem[], event: MouseEvent, options?: IContextMenuOptions): ContextMenu;
24
+ static show(menu: IContextMenuItem[], event: MouseEvent, options?: IContextMenuOptions, context?: any): ContextMenu;
24
25
  close(): void;
25
26
  }
@@ -116,12 +116,14 @@ export class ContextMenu {
116
116
  static count = 0;
117
117
  menu;
118
118
  options;
119
+ context;
119
120
  num;
120
121
  _menuElement;
121
- constructor(menu, options) {
122
+ constructor(menu, options, context) {
122
123
  this.num = ContextMenu.count++;
123
124
  this.menu = menu;
124
125
  this.options = options;
126
+ this.context = context;
125
127
  this.reload();
126
128
  this._windowDown = this._windowDown.bind(this);
127
129
  this._windowKeyUp = this._windowKeyUp.bind(this);
@@ -181,12 +183,12 @@ export class ContextMenu {
181
183
  else {
182
184
  if (item.action)
183
185
  li.addEventListener('click', (e) => {
184
- item.action(e, item);
186
+ item.action(e, item, this.context);
185
187
  this.close();
186
188
  });
187
189
  if (this.options?.mode == 'undo') {
188
190
  li.addEventListener('mouseup', (e) => {
189
- item.action(e, item);
191
+ item.action(e, item, this.context);
190
192
  this.close();
191
193
  });
192
194
  }
@@ -293,8 +295,8 @@ export class ContextMenu {
293
295
  this.close();
294
296
  }
295
297
  }
296
- static show(menu, event, options) {
297
- let ctxMenu = new ContextMenu(menu, options);
298
+ static show(menu, event, options, context) {
299
+ let ctxMenu = new ContextMenu(menu, options, context);
298
300
  ctxMenu.display(event);
299
301
  return ctxMenu;
300
302
  }
@@ -5,5 +5,5 @@ export interface IContextMenuItem {
5
5
  readonly children?: IContextMenuItem[];
6
6
  readonly disabled?: boolean;
7
7
  readonly shortCut?: string;
8
- action?: (event: MouseEvent, item: IContextMenuItem) => void;
8
+ action?: (event: MouseEvent, item: IContextMenuItem, context?: any) => void;
9
9
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.245",
4
+ "version": "0.0.246",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",