@node-projects/web-component-designer 0.0.78 → 0.0.82
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/.github/FUNDING.yml +1 -0
- package/dist/elements/helper/ElementHelper.d.ts +6 -0
- package/dist/elements/helper/ElementHelper.js +10 -0
- package/dist/elements/helper/PathDataPolyfill.d.ts +11 -10
- package/dist/elements/helper/PathDataPolyfill.js +36 -1
- package/dist/elements/services/DefaultServiceBootstrap.js +6 -2
- package/dist/elements/services/ServiceContainer.d.ts +1 -1
- package/dist/elements/services/ServiceContainer.js +2 -2
- package/dist/elements/services/htmlWriterService/AbstractHtmlWriterService.d.ts +10 -0
- package/dist/elements/services/htmlWriterService/AbstractHtmlWriterService.js +62 -0
- package/dist/elements/services/htmlWriterService/FormatingHtmlWriterService.d.ts +22 -0
- package/dist/elements/services/htmlWriterService/FormatingHtmlWriterService.js +133 -0
- package/dist/elements/services/htmlWriterService/HtmlWriterService copy.d.ts +2 -2
- package/dist/elements/services/htmlWriterService/HtmlWriterService copy.js +34 -19
- package/dist/elements/services/htmlWriterService/HtmlWriterService.d.ts +8 -8
- package/dist/elements/services/htmlWriterService/HtmlWriterService.js +13 -42
- package/dist/elements/services/htmlWriterService/IHtmlWriterOptions.d.ts +2 -0
- package/dist/elements/services/htmlWriterService/IHtmlWriterOptions.js +5 -3
- package/dist/elements/services/htmlWriterService/IHtmlWriterService.d.ts +5 -6
- package/dist/elements/services/htmlWriterService/LitTsElementWriterService.d.ts +9 -0
- package/dist/elements/services/htmlWriterService/LitTsElementWriterService.js +43 -0
- package/dist/elements/services/htmlWriterService/SimpleHtmlWriterService.d.ts +27 -0
- package/dist/elements/services/htmlWriterService/SimpleHtmlWriterService.js +93 -0
- package/dist/elements/services/initializationService/DefaultIntializationService.d.ts +6 -0
- package/dist/elements/services/initializationService/DefaultIntializationService.js +22 -0
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.d.ts +3 -1
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +42 -28
- package/dist/elements/widgets/codeView/code-view-ace.js +1 -1
- package/dist/elements/widgets/codeView/code-view-code-mirror.js +1 -1
- package/dist/elements/widgets/designerView/DomConverter.d.ts +3 -3
- package/dist/elements/widgets/designerView/DomConverter.js +8 -11
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +2 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +6 -0
- package/dist/elements/widgets/designerView/designerView.js +21 -6
- package/dist/elements/widgets/designerView/extensions/PathExtension.d.ts +0 -1
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +104 -12
- package/dist/elements/widgets/designerView/extensions/contextMenu/CopyPasteContextMenu.js +0 -1
- package/dist/elements/widgets/designerView/extensions/contextMenu/PathContextMenu.d.ts +8 -0
- package/dist/elements/widgets/designerView/extensions/contextMenu/PathContextMenu.js +31 -0
- package/dist/elements/widgets/designerView/extensions/contextMenu/RectContextMenu.d.ts +8 -0
- package/dist/elements/widgets/designerView/extensions/contextMenu/RectContextMenu.js +34 -0
- package/dist/elements/widgets/designerView/overlayLayerView.js +1 -2
- package/dist/elements/widgets/designerView/tools/DrawEllipsisTool.js +1 -0
- package/dist/elements/widgets/designerView/tools/DrawLineTool.js +1 -0
- package/dist/elements/widgets/designerView/tools/DrawPathTool.d.ts +0 -1
- package/dist/elements/widgets/designerView/tools/DrawPathTool.js +17 -9
- package/dist/elements/widgets/designerView/tools/DrawRectTool.js +1 -0
- package/dist/elements/widgets/treeView/treeViewExtended.js +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/package.json +9 -9
- package/dist/elements/services/htmlWriterService/LitElementWriterService.d.ts +0 -12
- package/dist/elements/services/htmlWriterService/LitElementWriterService.js +0 -107
- package/dist/elements/services/manifestLoaders/WebcomponentManifestParserService.d.ts +0 -26
- package/dist/elements/services/manifestLoaders/WebcomponentManifestParserService.js +0 -69
- package/dist/elements/services/webcomponentManifestParserService/WebcomponentManifestParserService.1.d.ts +0 -0
- package/dist/elements/services/webcomponentManifestParserService/WebcomponentManifestParserService.1.js +0 -1
- package/dist/elements/services/webcomponentManifestParserService/webcomponentManifestParserService.d.ts +0 -26
- package/dist/elements/services/webcomponentManifestParserService/webcomponentManifestParserService.js +0 -69
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export class IHtmlWriterOptions {
|
|
2
|
-
beautifyOutput;
|
|
3
|
-
compressCssToShorthandProperties;
|
|
4
|
-
writeDesignerProperties;
|
|
2
|
+
beautifyOutput = true;
|
|
3
|
+
compressCssToShorthandProperties = true;
|
|
4
|
+
writeDesignerProperties = true;
|
|
5
|
+
parseJsonInAttributes = true;
|
|
6
|
+
jsonWriteMode = 'min';
|
|
5
7
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { IDesignItem } from '../../item/IDesignItem';
|
|
2
|
-
import { IHtmlWriterOptions } from './IHtmlWriterOptions';
|
|
3
|
-
import { IndentedTextWriter } from '../../helper/IndentedTextWriter';
|
|
4
|
-
import { IStringPosition } from './IStringPosition';
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
2
|
+
import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
|
|
3
|
+
import { IndentedTextWriter } from '../../helper/IndentedTextWriter.js';
|
|
4
|
+
import { IStringPosition } from './IStringPosition.js';
|
|
5
5
|
export interface IHtmlWriterService {
|
|
6
|
-
|
|
7
|
-
write(indentedTextWriter: IndentedTextWriter, designItem: IDesignItem, options: IHtmlWriterOptions, designItemsAssignmentList?: Map<IDesignItem, IStringPosition>): any;
|
|
6
|
+
write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, designItemsAssignmentList?: Map<IDesignItem, IStringPosition>): any;
|
|
8
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
2
|
+
import { IHtmlWriterService } from './IHtmlWriterService';
|
|
3
|
+
import { IHtmlWriterOptions } from './IHtmlWriterOptions';
|
|
4
|
+
import { IndentedTextWriter } from '../../helper/IndentedTextWriter';
|
|
5
|
+
import { IStringPosition } from './IStringPosition';
|
|
6
|
+
export declare class LitTsElementWriterService implements IHtmlWriterService {
|
|
7
|
+
write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, designItemsAssignmentList?: Map<IDesignItem, IStringPosition>): void;
|
|
8
|
+
static head: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//needs InternalBindinsgStorrageService -> keeps bindings
|
|
2
|
+
export class LitTsElementWriterService {
|
|
3
|
+
write(indentedTextWriter, designItems, rootContainerKeepInline, options, designItemsAssignmentList) {
|
|
4
|
+
throw new Error('Method not implemented.');
|
|
5
|
+
}
|
|
6
|
+
static head = `import { html, css, LitElement, CSSResultArray } from 'lit';
|
|
7
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
8
|
+
|
|
9
|
+
@customElement('$$elementName')
|
|
10
|
+
class $$className extends LitElement {
|
|
11
|
+
static get styles(): CSSResultArray {
|
|
12
|
+
return [
|
|
13
|
+
css\`
|
|
14
|
+
$$css
|
|
15
|
+
\`,
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//@property({ type: String }) btnStyle: QingButtonStyle = '';
|
|
20
|
+
//@property({ type: Boolean, reflect: true }) selected = false;
|
|
21
|
+
|
|
22
|
+
//private buttonElement: HTMLButtonElement | null = null;
|
|
23
|
+
|
|
24
|
+
/*firstUpdated() {
|
|
25
|
+
if (!this.shadowRoot) {
|
|
26
|
+
throw new Error('Unexpected undefined shadowRoot');
|
|
27
|
+
}
|
|
28
|
+
this.buttonElement = this.shadowRoot.querySelector('button');
|
|
29
|
+
}*/
|
|
30
|
+
|
|
31
|
+
render() {
|
|
32
|
+
return html\`$$html\`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default $$className;
|
|
37
|
+
|
|
38
|
+
declare global {
|
|
39
|
+
interface HTMLElementTagNameMap {
|
|
40
|
+
'$$elementName': $$className;
|
|
41
|
+
}
|
|
42
|
+
}`;
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
2
|
+
import { IHtmlWriterService } from './IHtmlWriterService';
|
|
3
|
+
import { IHtmlWriterOptions } from './IHtmlWriterOptions';
|
|
4
|
+
import { IndentedTextWriter } from '../../helper/IndentedTextWriter';
|
|
5
|
+
import { IStringPosition } from './IStringPosition';
|
|
6
|
+
import { ElementDisplayType } from '../../helper/ElementHelper.js';
|
|
7
|
+
export declare enum ElementContainerType {
|
|
8
|
+
block = 0,
|
|
9
|
+
complex = 1
|
|
10
|
+
}
|
|
11
|
+
export interface IWriteContext {
|
|
12
|
+
options: IHtmlWriterOptions;
|
|
13
|
+
indentedTextWriter: IndentedTextWriter;
|
|
14
|
+
lastElementDisplayType: ElementDisplayType | null;
|
|
15
|
+
containerDisplayType: ElementContainerType;
|
|
16
|
+
designItemsAssignmentList?: Map<IDesignItem, IStringPosition>;
|
|
17
|
+
}
|
|
18
|
+
export declare class SimpleHtmlWriterService implements IHtmlWriterService {
|
|
19
|
+
protected writeAttributes(writeContext: IWriteContext, designItem: IDesignItem): void;
|
|
20
|
+
protected writeStyles(writeContext: IWriteContext, designItem: IDesignItem): void;
|
|
21
|
+
private _writeTextNode;
|
|
22
|
+
private _writeCommentNode;
|
|
23
|
+
private _writeElementNode;
|
|
24
|
+
private _writeDesignItemList;
|
|
25
|
+
private _writeInternal;
|
|
26
|
+
write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, designItemsAssignmentList?: Map<IDesignItem, IStringPosition>): void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DomConverter } from '../../widgets/designerView/DomConverter';
|
|
2
|
+
import { CssCombiner } from '../../helper/CssCombiner';
|
|
3
|
+
import { NodeType } from '../../item/NodeType';
|
|
4
|
+
import { PropertiesHelper } from '../propertiesService/services/PropertiesHelper';
|
|
5
|
+
import { ElementDisplayType, getElementDisplaytype } from '../../helper/ElementHelper.js';
|
|
6
|
+
export var ElementContainerType;
|
|
7
|
+
(function (ElementContainerType) {
|
|
8
|
+
ElementContainerType[ElementContainerType["block"] = 0] = "block";
|
|
9
|
+
ElementContainerType[ElementContainerType["complex"] = 1] = "complex";
|
|
10
|
+
})(ElementContainerType || (ElementContainerType = {}));
|
|
11
|
+
export class SimpleHtmlWriterService {
|
|
12
|
+
writeAttributes(writeContext, designItem) {
|
|
13
|
+
if (designItem.hasAttributes) {
|
|
14
|
+
for (const a of designItem.attributes) {
|
|
15
|
+
writeContext.indentedTextWriter.write(' ');
|
|
16
|
+
if (typeof a[1] === 'string') {
|
|
17
|
+
if (a[1] === "")
|
|
18
|
+
writeContext.indentedTextWriter.write(a[0]);
|
|
19
|
+
else
|
|
20
|
+
writeContext.indentedTextWriter.write(a[0] + '="' + DomConverter.normalizeAttributeValue(a[1]) + '"');
|
|
21
|
+
}
|
|
22
|
+
else if (!a[1])
|
|
23
|
+
writeContext.indentedTextWriter.write(a[0]);
|
|
24
|
+
else {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
writeStyles(writeContext, designItem) {
|
|
30
|
+
if (designItem.hasStyles) {
|
|
31
|
+
writeContext.indentedTextWriter.write(' style="');
|
|
32
|
+
let styles = designItem.styles;
|
|
33
|
+
if (writeContext.options.compressCssToShorthandProperties)
|
|
34
|
+
styles = CssCombiner.combine(styles);
|
|
35
|
+
for (const s of styles) {
|
|
36
|
+
if (s[0]) {
|
|
37
|
+
writeContext.indentedTextWriter.write(PropertiesHelper.camelToDashCase(s[0]) + ':' + DomConverter.normalizeAttributeValue(s[1]) + ';');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
writeContext.indentedTextWriter.write('"');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
_writeTextNode(writeContext, designItem) {
|
|
44
|
+
writeContext.lastElementDisplayType = ElementDisplayType.inline;
|
|
45
|
+
let content = DomConverter.normalizeContentValue(designItem.content);
|
|
46
|
+
writeContext.indentedTextWriter.write(content);
|
|
47
|
+
}
|
|
48
|
+
_writeCommentNode(writeContext, designItem) {
|
|
49
|
+
writeContext.indentedTextWriter.write('<!--' + designItem.content + '-->');
|
|
50
|
+
}
|
|
51
|
+
_writeElementNode(writeContext, designItem) {
|
|
52
|
+
const currentElementDisplayType = getElementDisplaytype(designItem.element);
|
|
53
|
+
writeContext.lastElementDisplayType = currentElementDisplayType;
|
|
54
|
+
writeContext.indentedTextWriter.write('<' + designItem.name);
|
|
55
|
+
this.writeAttributes(writeContext, designItem);
|
|
56
|
+
this.writeStyles(writeContext, designItem);
|
|
57
|
+
writeContext.indentedTextWriter.write('>');
|
|
58
|
+
if (designItem.hasChildren) {
|
|
59
|
+
const children = designItem.children();
|
|
60
|
+
this._writeDesignItemList(currentElementDisplayType, writeContext, children);
|
|
61
|
+
}
|
|
62
|
+
else if (designItem.hasContent) {
|
|
63
|
+
writeContext.indentedTextWriter.write(DomConverter.normalizeContentValue(designItem.content));
|
|
64
|
+
}
|
|
65
|
+
if (!DomConverter.IsSelfClosingElement(designItem.name)) {
|
|
66
|
+
writeContext.indentedTextWriter.write('</' + designItem.name + '>');
|
|
67
|
+
if (currentElementDisplayType !== ElementDisplayType.none) {
|
|
68
|
+
writeContext.lastElementDisplayType = currentElementDisplayType;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_writeDesignItemList(currentElementDisplayType, writeContext, children) {
|
|
73
|
+
for (const c of children) {
|
|
74
|
+
this._writeInternal(writeContext, c);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
_writeInternal(writeContext, designItem) {
|
|
78
|
+
const start = writeContext.indentedTextWriter.position;
|
|
79
|
+
if (designItem.nodeType === NodeType.TextNode)
|
|
80
|
+
this._writeTextNode(writeContext, designItem);
|
|
81
|
+
else if (designItem.nodeType === NodeType.Comment)
|
|
82
|
+
this._writeCommentNode(writeContext, designItem);
|
|
83
|
+
else if (designItem.nodeType === NodeType.Element)
|
|
84
|
+
this._writeElementNode(writeContext, designItem);
|
|
85
|
+
if (writeContext.designItemsAssignmentList) {
|
|
86
|
+
writeContext.designItemsAssignmentList.set(designItem, { start: start, length: writeContext.indentedTextWriter.position - start - 1 });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
write(indentedTextWriter, designItems, rootContainerKeepInline, options, designItemsAssignmentList) {
|
|
90
|
+
const context = { indentedTextWriter, options, lastElementDisplayType: null, containerDisplayType: ElementContainerType.block, designItemsAssignmentList };
|
|
91
|
+
this._writeDesignItemList(ElementDisplayType.inline, context, designItems);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
2
|
+
import { IIntializationService } from './IIntializationService';
|
|
3
|
+
export declare class DefaultIntializationService implements IIntializationService {
|
|
4
|
+
init(designItem: IDesignItem): void;
|
|
5
|
+
initializeIframe(iframe: HTMLIFrameElement): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class DefaultIntializationService {
|
|
2
|
+
init(designItem) {
|
|
3
|
+
if (designItem.name == 'iframe') {
|
|
4
|
+
this.initializeIframe(designItem.element);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
initializeIframe(iframe) {
|
|
8
|
+
iframe.contentDocument.body.style.pointerEvents = 'none';
|
|
9
|
+
function cloneIframeEvent(event) {
|
|
10
|
+
var clRect = iframe.getBoundingClientRect();
|
|
11
|
+
let data = { ...event };
|
|
12
|
+
data.clientX = event.clientX + clRect.left;
|
|
13
|
+
data.clientY = event.clientY + clRect.top;
|
|
14
|
+
var evt = new PointerEvent(event.type, data); //new CustomEvent('pointerdown', {bubbles: true, cancelable: false});
|
|
15
|
+
iframe.dispatchEvent(evt);
|
|
16
|
+
}
|
|
17
|
+
iframe.contentWindow.addEventListener('pointerdown', cloneIframeEvent);
|
|
18
|
+
iframe.contentWindow.addEventListener('pointermove', cloneIframeEvent);
|
|
19
|
+
iframe.contentWindow.addEventListener('pointerup', cloneIframeEvent);
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
}
|
|
@@ -13,7 +13,9 @@ export declare class WebcomponentManifestParserService extends UnkownElementProp
|
|
|
13
13
|
private _propertiesList;
|
|
14
14
|
private _resolveStored;
|
|
15
15
|
private _rejectStored;
|
|
16
|
-
|
|
16
|
+
private _importPrefix;
|
|
17
|
+
constructor(name: string, fileOrObject: string | object, importPrefix?: string);
|
|
18
|
+
private _parseManifest;
|
|
17
19
|
private manifestClassPropertyTypeToEditorPropertyType;
|
|
18
20
|
getElements(): Promise<IElementDefinition[]>;
|
|
19
21
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
@@ -9,43 +9,55 @@ export class WebcomponentManifestParserService extends UnkownElementPropertiesSe
|
|
|
9
9
|
_propertiesList;
|
|
10
10
|
_resolveStored;
|
|
11
11
|
_rejectStored;
|
|
12
|
-
|
|
12
|
+
_importPrefix = '';
|
|
13
|
+
constructor(name, fileOrObject, importPrefix = '') {
|
|
13
14
|
super();
|
|
14
15
|
this._name = name;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
this._importPrefix = importPrefix;
|
|
17
|
+
if (typeof fileOrObject === 'string') {
|
|
18
|
+
this._importPrefix = this._importPrefix ?? fileOrObject.split('/').slice(0, -1).join('/');
|
|
19
|
+
import(fileOrObject, { assert: { type: 'json' } }).then(module => {
|
|
20
|
+
this._packageData = module.default;
|
|
21
|
+
this._parseManifest();
|
|
22
|
+
}).catch(err => {
|
|
23
|
+
if (this._rejectStored) {
|
|
24
|
+
this._rejectStored.forEach(x => x(err));
|
|
25
|
+
this._resolveStored = null;
|
|
26
|
+
this._rejectStored = null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this._packageData = fileOrObject;
|
|
32
|
+
this._parseManifest();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
_parseManifest() {
|
|
36
|
+
this._elementList = [];
|
|
37
|
+
this._propertiesList = {};
|
|
38
|
+
for (let m of this._packageData.modules) {
|
|
39
|
+
for (let e of m.exports) {
|
|
40
|
+
if (e.kind == 'custom-element-definition') {
|
|
41
|
+
this._elementList.push({ tag: e.name, import: this._importPrefix + '/' + e.declaration.module });
|
|
42
|
+
let properties = [];
|
|
43
|
+
let declaration = m.declarations.find(x => x.name == e.declaration.name);
|
|
44
|
+
for (let d of declaration.members) {
|
|
45
|
+
if (d.kind == 'field') {
|
|
46
|
+
let pType = PropertyType.property;
|
|
47
|
+
if (declaration.attributes)
|
|
29
48
|
pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
|
|
30
|
-
|
|
31
|
-
}
|
|
49
|
+
properties.push({ name: d.name, service: this, propertyType: pType, type: this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text) });
|
|
32
50
|
}
|
|
33
|
-
this._propertiesList[e.name] = properties;
|
|
34
51
|
}
|
|
35
|
-
|
|
36
|
-
if (this._resolveStored) {
|
|
37
|
-
this._resolveStored.forEach(x => x(this._elementList));
|
|
38
|
-
this._resolveStored = null;
|
|
39
|
-
this._rejectStored = null;
|
|
52
|
+
this._propertiesList[e.name] = properties;
|
|
40
53
|
}
|
|
41
54
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this._rejectStored.forEach(x => x(err));
|
|
55
|
+
if (this._resolveStored) {
|
|
56
|
+
this._resolveStored.forEach(x => x(this._elementList));
|
|
45
57
|
this._resolveStored = null;
|
|
46
58
|
this._rejectStored = null;
|
|
47
59
|
}
|
|
48
|
-
}
|
|
60
|
+
}
|
|
49
61
|
}
|
|
50
62
|
manifestClassPropertyTypeToEditorPropertyType(type) {
|
|
51
63
|
if (type) {
|
|
@@ -66,7 +78,9 @@ export class WebcomponentManifestParserService extends UnkownElementPropertiesSe
|
|
|
66
78
|
return new Promise((resolve, reject) => { this._resolveStored.push(resolve); this._rejectStored.push(reject); });
|
|
67
79
|
}
|
|
68
80
|
isHandledElement(designItem) {
|
|
69
|
-
|
|
81
|
+
if (this._elementList)
|
|
82
|
+
return this._elementList.find(x => x.tag == designItem.name) != null;
|
|
83
|
+
return false;
|
|
70
84
|
}
|
|
71
85
|
getProperties(designItem) {
|
|
72
86
|
return this._propertiesList[designItem.name];
|
|
@@ -95,7 +95,7 @@ export class CodeViewAce extends BaseCustomWebComponentLazyAppend {
|
|
|
95
95
|
this._aceEditor = ace.edit(this._editor, {
|
|
96
96
|
theme: "ace/theme/chrome",
|
|
97
97
|
mode: "ace/mode/html",
|
|
98
|
-
value: "
|
|
98
|
+
value: "",
|
|
99
99
|
autoScrollEditorIntoView: true,
|
|
100
100
|
fontSize: "14px",
|
|
101
101
|
showPrintMargin: false,
|
|
@@ -20,7 +20,7 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
22
|
//@ts-ignore
|
|
23
|
-
import("codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
23
|
+
import("/codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
24
24
|
this.style.display = 'block';
|
|
25
25
|
this._editor = this._getDomElement('textarea');
|
|
26
26
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IDesignItem } from "../../item/IDesignItem";
|
|
2
|
-
import { IStringPosition } from "../../services/htmlWriterService/IStringPosition";
|
|
1
|
+
import { IDesignItem } from "../../item/IDesignItem.js";
|
|
2
|
+
import { IStringPosition } from "../../services/htmlWriterService/IStringPosition.js";
|
|
3
3
|
export declare class DomConverter {
|
|
4
|
-
static normalizeAttributeValue(value: string | number): string;
|
|
4
|
+
static normalizeAttributeValue(value: string | number, useSingleQuotes?: boolean): string;
|
|
5
5
|
static normalizeContentValue(value: string): string;
|
|
6
6
|
static IsSelfClosingElement(tag: string): boolean;
|
|
7
7
|
static ConvertToString(designItems: IDesignItem[], designItemsAssignmentList?: Map<IDesignItem, IStringPosition>): string;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { IndentedTextWriter } from "../../helper/IndentedTextWriter";
|
|
1
|
+
import { IndentedTextWriter } from "../../helper/IndentedTextWriter.js";
|
|
2
2
|
export class DomConverter {
|
|
3
|
-
static normalizeAttributeValue(value) {
|
|
3
|
+
static normalizeAttributeValue(value, useSingleQuotes = false) {
|
|
4
4
|
if (typeof value === 'number')
|
|
5
5
|
value = value.toString();
|
|
6
|
-
if (value)
|
|
6
|
+
if (value) {
|
|
7
|
+
if (useSingleQuotes)
|
|
8
|
+
return value.replaceAll('\'', ''');
|
|
7
9
|
return value.replaceAll('"', '"');
|
|
10
|
+
}
|
|
8
11
|
return value;
|
|
9
12
|
}
|
|
10
13
|
static normalizeContentValue(value) {
|
|
@@ -19,7 +22,6 @@ export class DomConverter {
|
|
|
19
22
|
tag === 'col' ||
|
|
20
23
|
tag === 'embed' ||
|
|
21
24
|
tag === 'hr' ||
|
|
22
|
-
tag === 'iframe' ||
|
|
23
25
|
tag === 'img' ||
|
|
24
26
|
tag === 'input' ||
|
|
25
27
|
tag === 'keygen' ||
|
|
@@ -32,13 +34,8 @@ export class DomConverter {
|
|
|
32
34
|
}
|
|
33
35
|
static ConvertToString(designItems, designItemsAssignmentList) {
|
|
34
36
|
let itw = new IndentedTextWriter();
|
|
35
|
-
let options = { beautifyOutput: true, writeDesignerProperties: true, compressCssToShorthandProperties: true };
|
|
36
|
-
|
|
37
|
-
d.serviceContainer.forSomeServicesTillResult('htmlWriterService', (s) => {
|
|
38
|
-
if (s.canWrite(d))
|
|
39
|
-
s.write(itw, d, options, designItemsAssignmentList);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
37
|
+
let options = { beautifyOutput: true, writeDesignerProperties: true, compressCssToShorthandProperties: true, parseJsonInAttributes: true, jsonWriteMode: 'beauty' };
|
|
38
|
+
designItems[0].serviceContainer.htmlWriterService.write(itw, designItems, true, options, designItemsAssignmentList);
|
|
42
39
|
return itw.getString();
|
|
43
40
|
}
|
|
44
41
|
}
|
|
@@ -53,6 +53,8 @@ export declare class DesignerCanvas extends BaseCustomWebComponentLazyAppend imp
|
|
|
53
53
|
set designerWidth(value: string);
|
|
54
54
|
get designerHeight(): string;
|
|
55
55
|
set designerHeight(value: string);
|
|
56
|
+
get designerOffsetWidth(): number;
|
|
57
|
+
get designerOffsetHeight(): number;
|
|
56
58
|
set additionalStyle(value: CSSStyleSheet);
|
|
57
59
|
executeCommand(command: IUiCommand): Promise<void>;
|
|
58
60
|
canExecuteCommand(command: IUiCommand): boolean;
|
|
@@ -163,6 +163,12 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
163
163
|
this._canvasContainer.style.height = value;
|
|
164
164
|
this.zoomFactorChanged();
|
|
165
165
|
}
|
|
166
|
+
get designerOffsetWidth() {
|
|
167
|
+
return this._canvasContainer.offsetWidth;
|
|
168
|
+
}
|
|
169
|
+
get designerOffsetHeight() {
|
|
170
|
+
return this._canvasContainer.offsetHeight;
|
|
171
|
+
}
|
|
166
172
|
set additionalStyle(value) {
|
|
167
173
|
if (value) {
|
|
168
174
|
for (let r of value.rules) {
|
|
@@ -201,17 +201,27 @@ export class DesignerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
201
201
|
this._lowertoolbar = this._getDomElement('lowertoolbar');
|
|
202
202
|
this._sVert = this._getDomElement('s-vert');
|
|
203
203
|
this._sHor = this._getDomElement('s-hor');
|
|
204
|
-
this._sVert.addEventListener('scrollbar-input', () => this._onScrollbar());
|
|
205
|
-
this._sHor.addEventListener('scrollbar-input', () => this._onScrollbar());
|
|
204
|
+
this._sVert.addEventListener('scrollbar-input', (e) => this._onScrollbar(e));
|
|
205
|
+
this._sHor.addEventListener('scrollbar-input', (e) => this._onScrollbar(e));
|
|
206
206
|
}
|
|
207
|
-
_onScrollbar() {
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
_onScrollbar(e) {
|
|
208
|
+
if (e?.detail == 'incrementLarge')
|
|
209
|
+
e.target.value += 0.25;
|
|
210
|
+
else if (e?.detail == 'decrementLarge')
|
|
211
|
+
e.target.value -= 0.25;
|
|
212
|
+
else if (e?.detail == 'incrementSmall')
|
|
213
|
+
e.target.value += 0.05;
|
|
214
|
+
else if (e?.detail == 'decrementSmall')
|
|
215
|
+
e.target.value -= 0.05;
|
|
216
|
+
const w = this.designerCanvas.designerOffsetWidth > this.designerCanvas.offsetWidth ? this.designerCanvas.designerOffsetWidth : this.designerCanvas.offsetWidth;
|
|
217
|
+
const h = this.designerCanvas.designerOffsetHeight > this.designerCanvas.offsetHeight ? this.designerCanvas.designerOffsetHeight : this.designerCanvas.offsetHeight;
|
|
218
|
+
const x = w * (this._sHor.value - 0.5) * -2;
|
|
219
|
+
const y = h * (this._sVert.value - 0.5) * -2;
|
|
210
220
|
this.designerCanvas.canvasOffset = { x, y };
|
|
211
221
|
}
|
|
212
222
|
_onWheel(event) {
|
|
223
|
+
event.preventDefault();
|
|
213
224
|
if (event.ctrlKey) {
|
|
214
|
-
event.preventDefault();
|
|
215
225
|
let zf = this._designerCanvas.zoomFactor;
|
|
216
226
|
zf += event.deltaY * -0.001; //deltamode = 0
|
|
217
227
|
if (zf < 0.02)
|
|
@@ -220,6 +230,11 @@ export class DesignerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
220
230
|
this._zoomInput.value = Math.round(zf * 100) + '%';
|
|
221
231
|
//TODO: we should zoom on the current cursor position, so it stays the center
|
|
222
232
|
}
|
|
233
|
+
else {
|
|
234
|
+
this._sHor.value += event.deltaX / 1000;
|
|
235
|
+
this._sVert.value += event.deltaY / 1000;
|
|
236
|
+
this._onScrollbar(null);
|
|
237
|
+
}
|
|
223
238
|
}
|
|
224
239
|
get designerWidth() {
|
|
225
240
|
return this._designerCanvas.designerWidth;
|
|
@@ -14,7 +14,6 @@ export declare class PathExtension extends AbstractExtension {
|
|
|
14
14
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
15
15
|
extend(): void;
|
|
16
16
|
pointerEvent(event: PointerEvent, circle: SVGCircleElement, p: PathData, index: number): void;
|
|
17
|
-
_drawPath(path: PathData[], index: number): void;
|
|
18
17
|
_drawPathCircle(x: number, y: number, p: PathData, index: number): void;
|
|
19
18
|
_drawPathLine(x1: number, y1: number, x2: number, y2: number): void;
|
|
20
19
|
refresh(): void;
|