@node-projects/web-component-designer 0.1.31 → 0.1.33

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.
@@ -46,9 +46,10 @@ export declare class DesignItem implements IDesignItem {
46
46
  get id(): string;
47
47
  set id(value: string);
48
48
  get isRootItem(): boolean;
49
+ childrenRect(selectors: string): Generator<IDesignItem, void, undefined>;
49
50
  _childArray: IDesignItem[];
50
51
  get hasChildren(): boolean;
51
- children(): IterableIterator<IDesignItem>;
52
+ children(recursive?: boolean): IterableIterator<IDesignItem>;
52
53
  get childCount(): number;
53
54
  get firstChild(): IDesignItem;
54
55
  private _parent;
@@ -151,13 +151,27 @@ export class DesignItem {
151
151
  get isRootItem() {
152
152
  return this.instanceServiceContainer.contentService.rootDesignItem === this;
153
153
  }
154
+ *childrenRect(selectors) {
155
+ if (this.hasChildren) {
156
+ for (let d of this.children()) {
157
+ if (d.nodeType == NodeType.Element && d.element.matches(selectors))
158
+ yield d;
159
+ yield* d.allMatching(selectors);
160
+ }
161
+ }
162
+ }
154
163
  _childArray = [];
155
164
  get hasChildren() {
156
165
  return this._childArray.length > 0;
157
166
  }
158
- *children() {
167
+ *children(recursive = false) {
159
168
  for (const e of this._childArray) {
160
169
  yield e;
170
+ if (recursive) {
171
+ for (const c of e.children(recursive)) {
172
+ yield c;
173
+ }
174
+ }
161
175
  }
162
176
  }
163
177
  get childCount() {
@@ -22,7 +22,7 @@ export interface IDesignItem {
22
22
  readonly hasAttributes: boolean;
23
23
  readonly hasStyles: boolean;
24
24
  readonly hasChildren: boolean;
25
- children(): IterableIterator<IDesignItem>;
25
+ children(recursive?: boolean): IterableIterator<IDesignItem>;
26
26
  allMatching(selectors: string): IterableIterator<IDesignItem>;
27
27
  readonly childCount: number;
28
28
  readonly firstChild: IDesignItem;
@@ -486,7 +486,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
486
486
  }
487
487
  /* --- end IUiCommandHandler --- */
488
488
  handleSelectAll() {
489
- const selection = Array.from(this.rootDesignItem.children());
489
+ const selection = Array.from(this.rootDesignItem.children(true));
490
490
  const primary = this.instanceServiceContainer.selectionService.primarySelection;
491
491
  if (primary) {
492
492
  const idx = selection.indexOf(primary);
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.1.31",
4
+ "version": "0.1.33",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",