@node-projects/web-component-designer 0.0.73 → 0.0.74
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/services/placementService/SnaplinesProviderService.d.ts +2 -0
- package/dist/elements/services/placementService/SnaplinesProviderService.js +10 -0
- package/dist/elements/widgets/bindableObjectsBrowser/bindable-objects-browser.js +2 -3
- package/dist/elements/widgets/codeView/code-view-code-mirror.js +6 -7
- package/dist/elements/widgets/codeView/code-view-monaco.js +3 -1
- package/dist/elements/widgets/paletteView/paletteTreeView.js +2 -3
- package/dist/elements/widgets/treeView/treeViewExtended.js +2 -8
- package/dist/index.d.ts +1 -0
- package/dist/interfaces/ICommandHandler.d.ts +5 -0
- package/dist/interfaces/ICommandHandler.js +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IRect } from '../../../interfaces/IRect.js';
|
|
2
2
|
import type { IDesignItem } from '../../item/IDesignItem.js';
|
|
3
3
|
import { ISnaplinesProviderService } from './ISnaplinesProviderService.js';
|
|
4
|
+
export declare const provideSnaplinesWithDistance = "provideSnaplinesWithDistance";
|
|
5
|
+
export declare const provideSnaplinesWithDistanceDistance = "provideSnaplinesWithDistanceDistance";
|
|
4
6
|
export declare class SnaplinesProviderService implements ISnaplinesProviderService {
|
|
5
7
|
provideSnaplines(containerItem: IDesignItem, ignoredItems: IDesignItem[]): {
|
|
6
8
|
outerRect: DOMRect;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { DomHelper } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export const provideSnaplinesWithDistance = 'provideSnaplinesWithDistance';
|
|
3
|
+
export const provideSnaplinesWithDistanceDistance = 'provideSnaplinesWithDistanceDistance';
|
|
2
4
|
export class SnaplinesProviderService {
|
|
3
5
|
provideSnaplines(containerItem, ignoredItems) {
|
|
4
6
|
{
|
|
5
7
|
const canvas = containerItem.instanceServiceContainer.designerCanvas;
|
|
6
8
|
const ignMap = new Map(ignoredItems.map(i => [i.element, i]));
|
|
7
9
|
const outerRect = containerItem.element.getBoundingClientRect();
|
|
10
|
+
const provideWithDist = canvas.instanceServiceContainer.designContext.extensionOptions[provideSnaplinesWithDistance] !== false;
|
|
11
|
+
const provideWithDistDist = canvas.instanceServiceContainer.designContext.extensionOptions[provideSnaplinesWithDistanceDistance] ?? 5;
|
|
8
12
|
const positionsH = [];
|
|
9
13
|
const positionsMiddleH = [];
|
|
10
14
|
const positionsV = [];
|
|
@@ -20,16 +24,22 @@ export class SnaplinesProviderService {
|
|
|
20
24
|
const pMidV = (p.y - outerRect.y + p.height / 2) / canvas.scaleFactor;
|
|
21
25
|
const pBottom = (p.y - outerRect.y + p.height) / canvas.scaleFactor;
|
|
22
26
|
const transformedP = { x: pLeft + outerRect.x, y: pTop + outerRect.y, width: p.width / canvas.scaleFactor, height: p.height / canvas.scaleFactor };
|
|
27
|
+
if (provideWithDist)
|
|
28
|
+
positionsH.push([pLeft - provideWithDistDist, transformedP]);
|
|
23
29
|
positionsH.push([pLeft, transformedP]);
|
|
24
30
|
positionsMiddleH.push([pMidH, transformedP]);
|
|
25
31
|
positionsH.push([pRight, transformedP]);
|
|
32
|
+
if (provideWithDist)
|
|
33
|
+
positionsH.push([pRight + provideWithDistDist, transformedP]);
|
|
26
34
|
positionsV.push([pTop, transformedP]);
|
|
27
35
|
positionsMiddleV.push([pMidV, transformedP]);
|
|
28
36
|
positionsV.push([pBottom, transformedP]);
|
|
29
37
|
}
|
|
30
38
|
}
|
|
39
|
+
positionsH.push([0, { x: 0, y: 0, width: 0, height: 0 }]);
|
|
31
40
|
positionsH.sort((a, b) => a[0] - b[0]);
|
|
32
41
|
positionsMiddleH.sort((a, b) => a[0] - b[0]);
|
|
42
|
+
positionsV.push([0, { x: 0, y: 0, width: 0, height: 0 }]);
|
|
33
43
|
positionsV.sort((a, b) => a[0] - b[0]);
|
|
34
44
|
positionsMiddleV.sort((a, b) => a[0] - b[0]);
|
|
35
45
|
return { outerRect, positionsH, positionsMiddleH, positionsV, positionsMiddleV };
|
|
@@ -29,9 +29,8 @@ export class BindableObjectsBrowser extends BaseCustomWebComponentLazyAppend {
|
|
|
29
29
|
`;
|
|
30
30
|
constructor() {
|
|
31
31
|
super();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.shadowRoot.appendChild(externalCss);
|
|
32
|
+
//@ts-ignore
|
|
33
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
35
34
|
this._treeDiv = document.createElement('div');
|
|
36
35
|
this._treeDiv.style.height = '100%';
|
|
37
36
|
this._treeDiv.style.overflow = 'auto';
|
|
@@ -12,16 +12,15 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
|
12
12
|
display: block;
|
|
13
13
|
height: 100%;
|
|
14
14
|
width: 100%;
|
|
15
|
-
}
|
|
16
|
-
`;
|
|
15
|
+
}`;
|
|
17
16
|
static template = html `
|
|
18
|
-
<style
|
|
19
|
-
<div
|
|
20
|
-
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
17
|
+
<div style="width: 100%; height: 100%;">
|
|
18
|
+
<div id="textarea"></div>
|
|
19
|
+
</div>`;
|
|
23
20
|
constructor() {
|
|
24
21
|
super();
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
import("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
25
24
|
this.style.display = 'block';
|
|
26
25
|
this._editor = this._getDomElement('textarea');
|
|
27
26
|
}
|
|
@@ -18,7 +18,6 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
18
18
|
}
|
|
19
19
|
`;
|
|
20
20
|
static template = html `
|
|
21
|
-
<style>@import "./node_modules/monaco-editor/min/vs/editor/editor.main.css";</style>
|
|
22
21
|
<div id="container" style="width: 100%; height: 100%; position: absolute;"></div>
|
|
23
22
|
`;
|
|
24
23
|
executeCommand(command) {
|
|
@@ -54,6 +53,9 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
54
53
|
return false;
|
|
55
54
|
}
|
|
56
55
|
async ready() {
|
|
56
|
+
//@ts-ignore
|
|
57
|
+
const style = await import("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
58
|
+
this.shadowRoot.adoptedStyleSheets = [style.default, this.constructor.style];
|
|
57
59
|
this._editor = this._getDomElement('container');
|
|
58
60
|
//@ts-ignore
|
|
59
61
|
require.config({ paths: { 'vs': 'node_modules/monaco-editor/min/vs' } });
|
|
@@ -55,9 +55,8 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
|
|
|
55
55
|
</div>`;
|
|
56
56
|
constructor() {
|
|
57
57
|
super();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.shadowRoot.appendChild(externalCss);
|
|
58
|
+
//@ts-ignore
|
|
59
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
61
60
|
this._filter = this._getDomElement('input');
|
|
62
61
|
this._filter.onkeyup = () => {
|
|
63
62
|
let match = this._filter.value;
|
|
@@ -89,9 +89,8 @@ export class TreeViewExtended extends BaseCustomWebComponentConstructorAppend {
|
|
|
89
89
|
</div>`;
|
|
90
90
|
constructor() {
|
|
91
91
|
super();
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
this.shadowRoot.appendChild(externalCss);
|
|
92
|
+
//@ts-ignore
|
|
93
|
+
import("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
95
94
|
this._filter = this._getDomElement('input');
|
|
96
95
|
this._filter.onkeyup = () => {
|
|
97
96
|
let match = this._filter.value;
|
|
@@ -100,11 +99,6 @@ export class TreeViewExtended extends BaseCustomWebComponentConstructorAppend {
|
|
|
100
99
|
});
|
|
101
100
|
};
|
|
102
101
|
this._treeDiv = this._getDomElement('treetable');
|
|
103
|
-
/*this._treeDiv = document.createElement('div');
|
|
104
|
-
this._treeDiv.style.height = 'calc(100% - 21px)'
|
|
105
|
-
this._treeDiv.style.overflow = 'auto';
|
|
106
|
-
this._treeDiv.setAttribute('id', 'tree');
|
|
107
|
-
this.shadowRoot.appendChild(this._treeDiv);*/
|
|
108
102
|
}
|
|
109
103
|
_showHideAtDesignTimeState(img, designItem) {
|
|
110
104
|
if (designItem.hideAtDesignTime)
|
package/dist/index.d.ts
CHANGED
|
@@ -173,3 +173,4 @@ export type { IDisposable } from "./interfaces/IDisposable.js";
|
|
|
173
173
|
export type { IPoint } from "./interfaces/IPoint.js";
|
|
174
174
|
export type { IRect } from "./interfaces/IRect.js";
|
|
175
175
|
export type { ISize } from "./interfaces/ISize.js";
|
|
176
|
+
export type { ICommandHandler } from "./interfaces/ICommandHandler.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|