@node-projects/web-component-designer 0.1.180 → 0.1.181

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.
@@ -9,6 +9,7 @@ export interface IContextMenuOptions {
9
9
  export declare class ContextMenu implements IContextMenu {
10
10
  private static _contextMenuCss;
11
11
  static count: number;
12
+ private static _openedContextMenus;
12
13
  menu: IContextMenuItem[];
13
14
  options: IContextMenuOptions;
14
15
  context: any;
@@ -23,4 +24,5 @@ export declare class ContextMenu implements IContextMenu {
23
24
  _windowKeyUp(e: KeyboardEvent): void;
24
25
  static show(menu: IContextMenuItem[], event: MouseEvent, options?: IContextMenuOptions, context?: any): ContextMenu;
25
26
  close(): void;
27
+ static closeAll(): void;
26
28
  }
@@ -121,6 +121,7 @@ export class ContextMenu {
121
121
  background-color: #5ebdec;
122
122
  }`;
123
123
  static count = 0;
124
+ static _openedContextMenus = new Set();
124
125
  menu;
125
126
  options;
126
127
  context;
@@ -292,6 +293,7 @@ export class ContextMenu {
292
293
  window.addEventListener("mousedown", this._windowDown);
293
294
  window.addEventListener("resize", this._windowResize);
294
295
  setTimeout(() => window.addEventListener("contextmenu", this._windowDown), 100);
296
+ ContextMenu._openedContextMenus.add(this);
295
297
  }
296
298
  _windowResize() {
297
299
  this.close();
@@ -319,6 +321,11 @@ export class ContextMenu {
319
321
  window.removeEventListener("mousedown", this._windowDown);
320
322
  window.removeEventListener("resize", this._windowResize);
321
323
  setTimeout(() => window.removeEventListener("contextmenu", this._windowDown), 10);
324
+ ContextMenu._openedContextMenus.delete(this);
325
+ }
326
+ static closeAll() {
327
+ for (const c of ContextMenu._openedContextMenus.values())
328
+ c.close();
322
329
  }
323
330
  }
324
331
  class ContextUtil {
@@ -24,7 +24,7 @@ export declare class DesignItem implements IDesignItem {
24
24
  nodeReplaced: TypedEvent<void>;
25
25
  get window(): Window & typeof globalThis;
26
26
  get document(): Document;
27
- get usableContainer(): Element | Document | ShadowRoot;
27
+ get usableContainer(): ShadowRoot | Document | Element;
28
28
  clone(): Promise<IDesignItem>;
29
29
  allMatching(selectors: string): Generator<IDesignItem, void, undefined>;
30
30
  replaceNode(newNode: Node): void;
package/jsr.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@node-projects/web-component-designer",
3
+ "version": "0.1.180",
4
+ "exports": "./src/index.ts"
5
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.180",
4
+ "version": "0.1.181",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M280-80v-640h120v640H280Zm280-240v-400h120v400H560ZM80-800v-80h800v80H80Z"/></svg>