@node-projects/web-component-designer 0.1.30 → 0.1.32
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/elements/helper/ElementHelper.js +3 -0
- package/dist/elements/item/DesignItem.d.ts +2 -1
- package/dist/elements/item/DesignItem.js +15 -1
- package/dist/elements/item/IDesignItem.d.ts +1 -1
- package/dist/elements/services/refactorService/BindingsRefactorService.d.ts +2 -1
- package/dist/elements/services/refactorService/TextRefactorService.d.ts +2 -1
- package/dist/elements/widgets/designerView/designerCanvas.js +10 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeType } from '../item/NodeType.js';
|
|
1
2
|
export function inDesigner(element) {
|
|
2
3
|
let node = element.getRootNode();
|
|
3
4
|
if (node?.host?.localName == "node-projects-designer-canvas")
|
|
@@ -136,6 +137,8 @@ export function calculateOuterRect(designItems, designerCanvas) {
|
|
|
136
137
|
let max = { x: Number.MIN_VALUE, y: Number.MIN_VALUE };
|
|
137
138
|
let elementRect;
|
|
138
139
|
for (let s of designItems) {
|
|
140
|
+
if (s.nodeType == NodeType.TextNode || s.nodeType == NodeType.Comment)
|
|
141
|
+
continue;
|
|
139
142
|
elementRect = {
|
|
140
143
|
x: designerCanvas.getNormalizedElementCoordinates(s.element).x,
|
|
141
144
|
y: designerCanvas.getNormalizedElementCoordinates(s.element).y,
|
|
@@ -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()) {
|
|
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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IDesignItem } from "../../item/IDesignItem.js";
|
|
2
|
+
import { IRefactorService } from "./IRefactorService.js";
|
|
2
3
|
import { IRefactoring } from "./IRefactoring.js";
|
|
3
|
-
export declare class BindingsRefactorService {
|
|
4
|
+
export declare class BindingsRefactorService implements IRefactorService {
|
|
4
5
|
getRefactorings(designItems: IDesignItem[]): IRefactoring[];
|
|
5
6
|
refactor(refactoring: IRefactoring, oldValue: string, newValue: string): void;
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IDesignItem } from "../../item/IDesignItem.js";
|
|
2
|
+
import { IRefactorService } from "./IRefactorService.js";
|
|
2
3
|
import { IRefactoring } from "./IRefactoring.js";
|
|
3
|
-
export declare class TextRefactorService {
|
|
4
|
+
export declare class TextRefactorService implements IRefactorService {
|
|
4
5
|
getRefactorings(designItems: IDesignItem[]): IRefactoring[];
|
|
5
6
|
refactor(refactoring: IRefactoring, oldValue: string, newValue: string): void;
|
|
6
7
|
}
|
|
@@ -486,7 +486,16 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
486
486
|
}
|
|
487
487
|
/* --- end IUiCommandHandler --- */
|
|
488
488
|
handleSelectAll() {
|
|
489
|
-
|
|
489
|
+
const selection = Array.from(this.rootDesignItem.children(true));
|
|
490
|
+
const primary = this.instanceServiceContainer.selectionService.primarySelection;
|
|
491
|
+
if (primary) {
|
|
492
|
+
const idx = selection.indexOf(primary);
|
|
493
|
+
if (idx >= 0) {
|
|
494
|
+
selection.splice(idx, 1);
|
|
495
|
+
selection.unshift(primary);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
this.instanceServiceContainer.selectionService.setSelectedElements(selection);
|
|
490
499
|
}
|
|
491
500
|
async handleCopyCommand() {
|
|
492
501
|
this._currentPasteOffset = this.pasteOffset;
|