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

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/README.md CHANGED
@@ -40,7 +40,6 @@ repository: https://github.com/node-projects/web-component-designer-simple-demo
40
40
  ## What is needed
41
41
 
42
42
  - @node-projects/base-custom-webcomponent a very small basic webcomponent library (maybe this will be included directly later, to be dependecy free)
43
- - constructable-stylesheets-polyfill on browser not yet supporting these (for Safari & Firefox)
44
43
  - optional - ace code editor
45
44
  - optional - monaco code editor (if you use code-view-monaco)
46
45
  - optional - code mirror code editor (if you use code-view-codemirror) (workin but buggy)
@@ -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/dist/index.d.ts CHANGED
@@ -261,4 +261,7 @@ export type { IPoint } from "./interfaces/IPoint.js";
261
261
  export type { IRect } from "./interfaces/IRect.js";
262
262
  export type { ISize } from "./interfaces/ISize.js";
263
263
  export type { ICommandHandler } from "./interfaces/ICommandHandler.js";
264
+ export * from "./commandHandling/CommandType.js";
265
+ export type { IUiCommand } from "./commandHandling/IUiCommand.js";
266
+ export type { IUiCommandHandler } from "./commandHandling/IUiCommandHandler.js";
264
267
  export * from './Constants.js';
package/dist/index.js CHANGED
@@ -199,4 +199,5 @@ export * from "./elements/widgets/codeView/code-view-simple.js";
199
199
  export * from "./elements/documentContainer.js";
200
200
  export * from "./enums/EventNames.js";
201
201
  export * from "./enums/PointerActionType.js";
202
+ export * from "./commandHandling/CommandType.js";
202
203
  export * from './Constants.js';
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.247",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",