@node-projects/web-component-designer 0.0.251 → 0.0.252
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/propertiesService/PropertyTabsService.js +1 -0
- package/dist/elements/services/propertiesService/services/CssProperties.json +39 -6
- package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +2 -1
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +9 -0
- package/dist/elements/widgets/designerView/tools/DrawEllipsisTool.js +4 -0
- package/dist/elements/widgets/designerView/tools/DrawLineTool.js +4 -0
- package/dist/elements/widgets/designerView/tools/DrawPathTool.js +4 -0
- package/dist/elements/widgets/designerView/tools/DrawRectTool.js +4 -0
- package/dist/index.d.ts +0 -1
- package/package.json +4 -4
- package/dist/elements/services/dragDropService/ExternalDragDropService copy.d.ts +0 -6
- package/dist/elements/services/dragDropService/ExternalDragDropService copy.js +0 -28
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.d.ts +0 -5
- package/dist/elements/services/dragDropService/IExternalDragDropService copy.js +0 -1
- package/dist/elements/services/htmlParserService/AbstractClassElementParserService.d.ts +0 -9
- package/dist/elements/services/htmlParserService/AbstractClassElementParserService.js +0 -46
- package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService copy.d.ts +0 -11
- package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService copy.js +0 -90
- package/dist/elements/services/propertiesService/DefaultEditorTypesService copy.d.ts +0 -6
- package/dist/elements/services/propertiesService/DefaultEditorTypesService copy.js +0 -64
- package/dist/elements/services/propertiesService/GridEditorTypesService.d.ts +0 -6
- package/dist/elements/services/propertiesService/GridEditorTypesService.js +0 -64
- package/dist/elements/services/propertiesService/propertyEditors/GridCellPropertyEditor.d.ts +0 -9
- package/dist/elements/services/propertiesService/propertyEditors/GridCellPropertyEditor.js +0 -16
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.d.ts +0 -9
- package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.js +0 -21
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.d.ts +0 -15
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.js +0 -70
- package/dist/elements/services/undoService/transactionItems/ContentChangeAction.d.ts +0 -13
- package/dist/elements/services/undoService/transactionItems/ContentChangeAction.js +0 -38
- package/dist/elements/services/undoService/transactionItems/CssStyleChangeAction copy.d.ts +0 -14
- package/dist/elements/services/undoService/transactionItems/CssStyleChangeAction copy.js +0 -44
- package/dist/elements/services/undoService/transactionItems/InsertChildAction copy.d.ts +0 -16
- package/dist/elements/services/undoService/transactionItems/InsertChildAction copy.js +0 -37
- package/dist/elements/services/undoService/transactionItems/StylesheetStyleChangeAction.d.ts +0 -17
- package/dist/elements/services/undoService/transactionItems/StylesheetStyleChangeAction.js +0 -28
- package/dist/elements/widgets/codeView/code-view-ace copy.d.ts +0 -24
- package/dist/elements/widgets/codeView/code-view-ace copy.js +0 -133
- package/dist/elements/widgets/codeView/code-view-code-mirror copy.d.ts +0 -25
- package/dist/elements/widgets/codeView/code-view-code-mirror copy.js +0 -106
- package/dist/elements/widgets/codeView/code-view-code-mirror-6.d.ts +0 -25
- package/dist/elements/widgets/codeView/code-view-code-mirror-6.js +0 -102
- package/dist/elements/widgets/codeView/code-view-jar.d.ts +0 -23
- package/dist/elements/widgets/codeView/code-view-jar.js +0 -121
- package/dist/elements/widgets/designerView/extensions/GridExtension.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/GridExtension.js +0 -346
- package/dist/elements/widgets/designerView/extensions/GridExtensionProvider.d.ts +0 -11
- package/dist/elements/widgets/designerView/extensions/GridExtensionProvider.js +0 -22
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension copy 2.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension copy 2.js +0 -346
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension copy.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension copy.js +0 -346
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension.d.ts +0 -16
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtension.js +0 -71
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtensionProvider copy.d.ts +0 -10
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtensionProvider copy.js +0 -22
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtensionProvider.d.ts +0 -10
- package/dist/elements/widgets/designerView/extensions/grid/EditGridExtensionProvider.js +0 -18
- package/dist/elements/widgets/designerView/extensions/grid/GridExtension copy.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/grid/GridExtension copy.js +0 -346
- package/dist/elements/widgets/designerView/extensions/grid/GridExtension.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/grid/GridExtension.js +0 -346
- package/dist/elements/widgets/designerView/extensions/grid/GridExtensionProvider copy.d.ts +0 -11
- package/dist/elements/widgets/designerView/extensions/grid/GridExtensionProvider copy.js +0 -22
- package/dist/elements/widgets/designerView/extensions/grid/GridExtensionProvider.d.ts +0 -11
- package/dist/elements/widgets/designerView/extensions/grid/GridExtensionProvider.js +0 -22
- package/dist/elements/widgets/designerView/extensions/grid/NewEditGridExtensionProvider.d.ts +0 -10
- package/dist/elements/widgets/designerView/extensions/grid/NewEditGridExtensionProvider.js +0 -22
- package/dist/elements/widgets/designerView/extensions/grid/OldEditGridExtension.d.ts +0 -51
- package/dist/elements/widgets/designerView/extensions/grid/OldEditGridExtension.js +0 -346
- package/dist/elements/widgets/designerView/extensions/grid/OldEditGridExtensionProvider.d.ts +0 -10
- package/dist/elements/widgets/designerView/extensions/grid/OldEditGridExtensionProvider.js +0 -22
- package/dist/elements/widgets/designerView/extensions/logic/ApplyFirstExtensionProvider.d.ts +0 -12
- package/dist/elements/widgets/designerView/extensions/logic/ApplyFirstExtensionProvider.js +0 -17
- package/dist/elements/widgets/designerView/extensions/logic/DisplayGridExtensionProvider.d.ts +0 -11
- package/dist/elements/widgets/designerView/extensions/logic/DisplayGridExtensionProvider.js +0 -23
- package/dist/elements/widgets/designerView/extensions/logic/OrCombineContainerProvider.d.ts +0 -12
- package/dist/elements/widgets/designerView/extensions/logic/OrCombineContainerProvider.js +0 -17
- package/dist/interfaces/ICommandHandler.d.ts +0 -5
- package/dist/interfaces/ICommandHandler.js +0 -1
- package/dist/polyfill/mobileDragDrop.d.ts +0 -2
- package/dist/polyfill/mobileDragDrop.js +0 -32
|
@@ -17,6 +17,7 @@ export class PropertyTabsService {
|
|
|
17
17
|
{ name: 'attributes', propertiesService: new AttributesPropertiesService() },
|
|
18
18
|
{ name: 'styles', propertiesService: new CssCurrentPropertiesService() },
|
|
19
19
|
{ name: 'layout', propertiesService: new CssPropertiesService("layout") },
|
|
20
|
+
{ name: 'svg', propertiesService: new CssPropertiesService("svg") },
|
|
20
21
|
];
|
|
21
22
|
getPropertygroups(designItems) {
|
|
22
23
|
if (designItems == null || designItems.length == 0)
|
|
@@ -242,7 +242,9 @@
|
|
|
242
242
|
"dominantBaseline": {},
|
|
243
243
|
"emptyCells": {},
|
|
244
244
|
"fallback": {},
|
|
245
|
-
"fill": {
|
|
245
|
+
"fill": {
|
|
246
|
+
"type": "color"
|
|
247
|
+
},
|
|
246
248
|
"fillOpacity": {},
|
|
247
249
|
"fillRule": {},
|
|
248
250
|
"filter": {},
|
|
@@ -413,12 +415,39 @@
|
|
|
413
415
|
"outlineOffset": {},
|
|
414
416
|
"outlineStyle": {},
|
|
415
417
|
"outlineWidth": {},
|
|
416
|
-
"overflow": {
|
|
418
|
+
"overflow": {
|
|
419
|
+
"type": "list",
|
|
420
|
+
"values": [
|
|
421
|
+
"visible",
|
|
422
|
+
"hidden",
|
|
423
|
+
"clip",
|
|
424
|
+
"scoll",
|
|
425
|
+
"auto"
|
|
426
|
+
]
|
|
427
|
+
},
|
|
417
428
|
"overflowAnchor": {},
|
|
418
429
|
"overflowClipMargin": {},
|
|
419
430
|
"overflowWrap": {},
|
|
420
|
-
"overflowX": {
|
|
421
|
-
|
|
431
|
+
"overflowX": {
|
|
432
|
+
"type": "list",
|
|
433
|
+
"values": [
|
|
434
|
+
"visible",
|
|
435
|
+
"hidden",
|
|
436
|
+
"clip",
|
|
437
|
+
"scoll",
|
|
438
|
+
"auto"
|
|
439
|
+
]
|
|
440
|
+
},
|
|
441
|
+
"overflowY": {
|
|
442
|
+
"type": "list",
|
|
443
|
+
"values": [
|
|
444
|
+
"visible",
|
|
445
|
+
"hidden",
|
|
446
|
+
"clip",
|
|
447
|
+
"scoll",
|
|
448
|
+
"auto"
|
|
449
|
+
]
|
|
450
|
+
},
|
|
422
451
|
"overrideColors": {},
|
|
423
452
|
"overscrollBehavior": {},
|
|
424
453
|
"overscrollBehaviorBlock": {},
|
|
@@ -509,14 +538,18 @@
|
|
|
509
538
|
"type": "color"
|
|
510
539
|
},
|
|
511
540
|
"stopOpacity": {},
|
|
512
|
-
"stroke": {
|
|
541
|
+
"stroke": {
|
|
542
|
+
"type": "color"
|
|
543
|
+
},
|
|
513
544
|
"strokeDasharray": {},
|
|
514
545
|
"strokeDashoffset": {},
|
|
515
546
|
"strokeLinecap": {},
|
|
516
547
|
"strokeLinejoin": {},
|
|
517
548
|
"strokeMiterlimit": {},
|
|
518
549
|
"strokeOpacity": {},
|
|
519
|
-
"strokeWidth": {
|
|
550
|
+
"strokeWidth": {
|
|
551
|
+
"type": "number"
|
|
552
|
+
},
|
|
520
553
|
"suffix": {},
|
|
521
554
|
"symbols": {},
|
|
522
555
|
"syntax": {},
|
|
@@ -9,7 +9,8 @@ export declare class CssPropertiesService extends CommonPropertiesService {
|
|
|
9
9
|
layout: string[];
|
|
10
10
|
grid: string[];
|
|
11
11
|
flex: string[];
|
|
12
|
-
|
|
12
|
+
svg: string[];
|
|
13
|
+
constructor(name: 'layout' | 'grid' | 'flex' | 'svg');
|
|
13
14
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
14
15
|
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
15
16
|
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
@@ -59,6 +59,15 @@ export class CssPropertiesService extends CommonPropertiesService {
|
|
|
59
59
|
"justify-content",
|
|
60
60
|
"align-items"
|
|
61
61
|
];
|
|
62
|
+
svg = [
|
|
63
|
+
"fill",
|
|
64
|
+
"fill-rule",
|
|
65
|
+
"fill-opacity",
|
|
66
|
+
"stroke",
|
|
67
|
+
"stroke-width",
|
|
68
|
+
"stroke-dash-array",
|
|
69
|
+
"stroke-opacity"
|
|
70
|
+
];
|
|
62
71
|
constructor(name) {
|
|
63
72
|
super();
|
|
64
73
|
this.name = name;
|
|
@@ -77,12 +77,16 @@ export class DrawEllipsisTool {
|
|
|
77
77
|
svg.appendChild(this._path);
|
|
78
78
|
this._path.setAttribute("cx", (this._cx - mvX).toString());
|
|
79
79
|
this._path.setAttribute("cy", (this._cy - mvY).toString());
|
|
80
|
+
this._path.removeAttribute("stroke");
|
|
81
|
+
this._path.removeAttribute("stroke-width");
|
|
80
82
|
svg.style.left = (mvX) + 'px';
|
|
81
83
|
svg.style.top = (mvY) + 'px';
|
|
82
84
|
svg.style.position = 'absolute';
|
|
83
85
|
svg.style.width = Math.round(coords.width + 2 * offset) + 'px';
|
|
84
86
|
svg.style.height = Math.round(coords.height + 2 * offset) + 'px';
|
|
85
87
|
svg.style.overflow = 'visible';
|
|
88
|
+
svg.style.stroke = designerCanvas.serviceContainer.globalContext.strokeColor;
|
|
89
|
+
svg.style.strokeWidth = designerCanvas.serviceContainer.globalContext.strokeThickness;
|
|
86
90
|
this._path = null;
|
|
87
91
|
const di = DesignItem.createDesignItemFromInstance(svg, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer);
|
|
88
92
|
designerCanvas.instanceServiceContainer.undoService.execute(new InsertAction(designerCanvas.rootDesignItem, designerCanvas.rootDesignItem.childCount, di));
|
|
@@ -61,6 +61,8 @@ export class DrawLineTool {
|
|
|
61
61
|
this._path.setAttribute("y1", (this._startPoint.y - mvY).toString());
|
|
62
62
|
this._path.setAttribute("x2", (this._endPoint.x - mvX).toString());
|
|
63
63
|
this._path.setAttribute("y2", (this._endPoint.y - mvY).toString());
|
|
64
|
+
this._path.removeAttribute("stroke");
|
|
65
|
+
this._path.removeAttribute("stroke-width");
|
|
64
66
|
svg.appendChild(this._path);
|
|
65
67
|
svg.style.left = (mvX) + 'px';
|
|
66
68
|
svg.style.top = (mvY) + 'px';
|
|
@@ -68,6 +70,8 @@ export class DrawLineTool {
|
|
|
68
70
|
svg.style.width = Math.round(coords.width + 2 * offset) + 'px';
|
|
69
71
|
svg.style.height = Math.round(coords.height + 2 * offset) + 'px';
|
|
70
72
|
svg.style.overflow = 'visible';
|
|
73
|
+
svg.style.stroke = designerCanvas.serviceContainer.globalContext.strokeColor;
|
|
74
|
+
svg.style.strokeWidth = designerCanvas.serviceContainer.globalContext.strokeThickness;
|
|
71
75
|
this._path = null;
|
|
72
76
|
const di = DesignItem.createDesignItemFromInstance(svg, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer);
|
|
73
77
|
designerCanvas.instanceServiceContainer.undoService.execute(new InsertAction(designerCanvas.rootDesignItem, designerCanvas.rootDesignItem.childCount, di));
|
|
@@ -103,6 +103,8 @@ export class DrawPathTool {
|
|
|
103
103
|
const mvY = coords.y - offset;
|
|
104
104
|
const d = moveSVGPath(this._path, mvX, mvY);
|
|
105
105
|
this._path.setAttribute("d", d);
|
|
106
|
+
this._path.removeAttribute("stroke");
|
|
107
|
+
this._path.removeAttribute("stroke-width");
|
|
106
108
|
svg.appendChild(this._path);
|
|
107
109
|
svg.style.left = (mvX) + 'px';
|
|
108
110
|
svg.style.top = (mvY) + 'px';
|
|
@@ -110,6 +112,8 @@ export class DrawPathTool {
|
|
|
110
112
|
svg.style.width = Math.round(coords.width + 2 * offset) + 'px';
|
|
111
113
|
svg.style.height = Math.round(coords.height + 2 * offset) + 'px';
|
|
112
114
|
svg.style.overflow = 'visible';
|
|
115
|
+
svg.style.stroke = designerCanvas.serviceContainer.globalContext.strokeColor;
|
|
116
|
+
svg.style.strokeWidth = designerCanvas.serviceContainer.globalContext.strokeThickness;
|
|
113
117
|
//designerView.rootDesignItem.element.appendChild(svg);
|
|
114
118
|
this._path = null;
|
|
115
119
|
this._pathD = null;
|
|
@@ -91,6 +91,8 @@ export class DrawRectTool {
|
|
|
91
91
|
const mvY = coords.y - offset;
|
|
92
92
|
this._path.setAttribute("x", (this._px - mvX).toString());
|
|
93
93
|
this._path.setAttribute("y", (this._py - mvY).toString());
|
|
94
|
+
this._path.removeAttribute("stroke");
|
|
95
|
+
this._path.removeAttribute("stroke-width");
|
|
94
96
|
svg.appendChild(this._path);
|
|
95
97
|
svg.style.left = (mvX) + 'px';
|
|
96
98
|
svg.style.top = (mvY) + 'px';
|
|
@@ -98,6 +100,8 @@ export class DrawRectTool {
|
|
|
98
100
|
svg.style.width = Math.round(coords.width + 2 * offset) + 'px';
|
|
99
101
|
svg.style.height = Math.round(coords.height + 2 * offset) + 'px';
|
|
100
102
|
svg.style.overflow = 'visible';
|
|
103
|
+
svg.style.stroke = designerCanvas.serviceContainer.globalContext.strokeColor;
|
|
104
|
+
svg.style.strokeWidth = designerCanvas.serviceContainer.globalContext.strokeThickness;
|
|
101
105
|
this._path = null;
|
|
102
106
|
const di = DesignItem.createDesignItemFromInstance(svg, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer);
|
|
103
107
|
designerCanvas.instanceServiceContainer.undoService.execute(new InsertAction(designerCanvas.rootDesignItem, designerCanvas.rootDesignItem.childCount, di));
|
package/dist/index.d.ts
CHANGED
|
@@ -260,7 +260,6 @@ export type { IDisposable } from "./interfaces/IDisposable.js";
|
|
|
260
260
|
export type { IPoint } from "./interfaces/IPoint.js";
|
|
261
261
|
export type { IRect } from "./interfaces/IRect.js";
|
|
262
262
|
export type { ISize } from "./interfaces/ISize.js";
|
|
263
|
-
export type { ICommandHandler } from "./interfaces/ICommandHandler.js";
|
|
264
263
|
export * from "./commandHandling/CommandType.js";
|
|
265
264
|
export type { IUiCommand } from "./commandHandling/IUiCommand.js";
|
|
266
265
|
export type { IUiCommandHandler } from "./commandHandling/IUiCommandHandler.js";
|
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.0.
|
|
4
|
+
"version": "0.0.252",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@node-projects/base-custom-webcomponent": "^0.13.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@adobe/css-tools": "4.3.0
|
|
19
|
+
"@adobe/css-tools": "4.3.0",
|
|
20
20
|
"@node-projects/lean-he-esm": "^3.3.0",
|
|
21
21
|
"@node-projects/node-html-parser-esm": "^6.1.5",
|
|
22
22
|
"@papyrs/stylo": "^0.0.45",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@types/css-tree": "^2.3.1",
|
|
25
25
|
"@types/jquery": "^3.5.16",
|
|
26
26
|
"@types/jquery.fancytree": "0.0.7",
|
|
27
|
-
"@types/node": "^20.4.
|
|
27
|
+
"@types/node": "^20.4.8",
|
|
28
28
|
"ace-builds": "^1.23.4",
|
|
29
29
|
"codemirror": "^5.0.0",
|
|
30
30
|
"css-tree": "^2.3.1",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jquery": "^3.7.0",
|
|
35
35
|
"jquery.fancytree": "^2.38.3",
|
|
36
36
|
"mdn-data": "^2.0.32",
|
|
37
|
-
"monaco-editor": "^0.
|
|
37
|
+
"monaco-editor": "^0.41.0",
|
|
38
38
|
"ts-jest": "^29.1.1",
|
|
39
39
|
"typescript": "^5.1.6",
|
|
40
40
|
"typescript-lit-html-plugin": "^0.9.0"
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IDesignerCanvas } from "../../widgets/designerView/IDesignerCanvas.js";
|
|
2
|
-
import { IExternalDragDropService } from "./IExternalDragDropService.js";
|
|
3
|
-
export declare class ExternalDragDropService implements IExternalDragDropService {
|
|
4
|
-
dragOver(event: DragEvent): 'none' | 'copy' | 'link' | 'move';
|
|
5
|
-
drop(designerView: IDesignerCanvas, event: DragEvent): void;
|
|
6
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { DesignItem } from '../../item/DesignItem.js';
|
|
2
|
-
import { InsertAction } from "../undoService/transactionItems/InsertAction.js";
|
|
3
|
-
export class ExternalDragDropService {
|
|
4
|
-
dragOver(event) {
|
|
5
|
-
if (event.dataTransfer.items[0].type.startsWith('image/'))
|
|
6
|
-
return 'copy';
|
|
7
|
-
return 'none';
|
|
8
|
-
}
|
|
9
|
-
drop(designerView, event) {
|
|
10
|
-
if (event.dataTransfer.files[0].type.startsWith('image/')) {
|
|
11
|
-
let reader = new FileReader();
|
|
12
|
-
reader.onloadend = () => {
|
|
13
|
-
const img = document.createElement('img');
|
|
14
|
-
img.src = reader.result;
|
|
15
|
-
const di = DesignItem.createDesignItemFromInstance(img, designerView.serviceContainer, designerView.instanceServiceContainer);
|
|
16
|
-
let grp = di.openGroup("Insert of <img>");
|
|
17
|
-
di.setStyle('position', 'absolute');
|
|
18
|
-
const targetRect = event.target.getBoundingClientRect();
|
|
19
|
-
di.setStyle('top', event.offsetY + targetRect.top - designerView.containerBoundingRect.y + 'px');
|
|
20
|
-
di.setStyle('left', event.offsetX + targetRect.left - designerView.containerBoundingRect.x + 'px');
|
|
21
|
-
designerView.instanceServiceContainer.undoService.execute(new InsertAction(designerView.rootDesignItem, designerView.rootDesignItem.childCount, di));
|
|
22
|
-
grp.commit();
|
|
23
|
-
requestAnimationFrame(() => designerView.instanceServiceContainer.selectionService.setSelectedElements([di]));
|
|
24
|
-
};
|
|
25
|
-
reader.readAsDataURL(event.dataTransfer.files[0]);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { InstanceServiceContainer } from '../InstanceServiceContainer.js';
|
|
2
|
-
import { ServiceContainer } from '../ServiceContainer.js';
|
|
3
|
-
import { IHtmlParserService } from './IHtmlParserService.js';
|
|
4
|
-
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
5
|
-
export declare class AbstractClassElementParserService implements IHtmlParserService {
|
|
6
|
-
private htmlParser;
|
|
7
|
-
constructor(htmlParser: IHtmlParserService);
|
|
8
|
-
parse(code: string, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer, parseSnippet: boolean): Promise<IDesignItem[]>;
|
|
9
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
function* findAllNodesOfKind(node, kind) {
|
|
2
|
-
if (node.kind == kind)
|
|
3
|
-
yield node;
|
|
4
|
-
for (const c of node.getChildren())
|
|
5
|
-
yield* findAllNodesOfKind(c, kind);
|
|
6
|
-
}
|
|
7
|
-
export class AbstractClassElementParserService {
|
|
8
|
-
htmlParser;
|
|
9
|
-
constructor(htmlParser) {
|
|
10
|
-
this.htmlParser = htmlParser;
|
|
11
|
-
}
|
|
12
|
-
async parse(code, serviceContainer, instanceServiceContainer, parseSnippet) {
|
|
13
|
-
const compilerHost /*: ts.CompilerHost*/ = {
|
|
14
|
-
fileExists: () => true,
|
|
15
|
-
getCanonicalFileName: filename => filename,
|
|
16
|
-
getCurrentDirectory: () => '',
|
|
17
|
-
getDefaultLibFileName: () => 'lib.d.ts',
|
|
18
|
-
getNewLine: () => '\n',
|
|
19
|
-
getSourceFile: filename => {
|
|
20
|
-
//@ts-ignore
|
|
21
|
-
return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true);
|
|
22
|
-
},
|
|
23
|
-
readFile: () => null,
|
|
24
|
-
useCaseSensitiveFileNames: () => true,
|
|
25
|
-
writeFile: () => null,
|
|
26
|
-
};
|
|
27
|
-
const filename = 'aa.ts';
|
|
28
|
-
//@ts-ignore
|
|
29
|
-
const program = ts.createProgram([filename], {
|
|
30
|
-
noResolve: true,
|
|
31
|
-
//@ts-ignore
|
|
32
|
-
target: ts.ScriptTarget.Latest,
|
|
33
|
-
}, compilerHost);
|
|
34
|
-
const sourceFile = program.getSourceFile(filename);
|
|
35
|
-
let htmlCode = "";
|
|
36
|
-
let cssStyle = "";
|
|
37
|
-
const nodes = findAllNodesOfKind(sourceFile, 212);
|
|
38
|
-
for (let nd of nodes) {
|
|
39
|
-
if (nd.tag.escapedText == 'html' && nd.parent.name.escapedText == "template")
|
|
40
|
-
htmlCode = nd.template.rawText;
|
|
41
|
-
if (nd.tag.escapedText == 'css' && nd.parent.name.escapedText == "style")
|
|
42
|
-
cssStyle = nd.template.rawText;
|
|
43
|
-
}
|
|
44
|
-
return this.htmlParser.parse(htmlCode, serviceContainer, instanceServiceContainer, parseSnippet);
|
|
45
|
-
}
|
|
46
|
-
}
|
package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService copy.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InstanceServiceContainer } from '../InstanceServiceContainer.js';
|
|
2
|
-
import { ServiceContainer } from '../ServiceContainer.js';
|
|
3
|
-
import { IHtmlParserService } from './IHtmlParserService.js';
|
|
4
|
-
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
5
|
-
export declare class BaseCustomWebcomponentParserService implements IHtmlParserService {
|
|
6
|
-
private htmlParser;
|
|
7
|
-
constructor(htmlParser: IHtmlParserService);
|
|
8
|
-
parse(code: string, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer, parseSnippet: boolean): Promise<IDesignItem[]>;
|
|
9
|
-
writeBack(code: string, html: string, css: string, newLineCrLf: boolean): string;
|
|
10
|
-
private parseTypescriptFile;
|
|
11
|
-
}
|
package/dist/elements/services/htmlParserService/BaseCustomWebcomponentParserService copy.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
function* findAllNodesOfKind(node, kind) {
|
|
2
|
-
if (node.kind == kind)
|
|
3
|
-
yield node;
|
|
4
|
-
for (const c of node.getChildren())
|
|
5
|
-
yield* findAllNodesOfKind(c, kind);
|
|
6
|
-
}
|
|
7
|
-
export class BaseCustomWebcomponentParserService {
|
|
8
|
-
htmlParser;
|
|
9
|
-
constructor(htmlParser) {
|
|
10
|
-
this.htmlParser = htmlParser;
|
|
11
|
-
}
|
|
12
|
-
async parse(code, serviceContainer, instanceServiceContainer, parseSnippet) {
|
|
13
|
-
const sourceFile = this.parseTypescriptFile(code);
|
|
14
|
-
let htmlCode = "";
|
|
15
|
-
let cssStyle = "";
|
|
16
|
-
//@ts-ignore
|
|
17
|
-
const nodes = findAllNodesOfKind(sourceFile, ts.SyntaxKind.TaggedTemplateExpression);
|
|
18
|
-
for (let nd of nodes) {
|
|
19
|
-
if (nd.tag.escapedText == 'html' && nd.parent.name.escapedText == "template")
|
|
20
|
-
htmlCode = nd.template.rawText;
|
|
21
|
-
if (nd.tag.escapedText == 'css' && nd.parent.name.escapedText == "style")
|
|
22
|
-
cssStyle = nd.template.rawText;
|
|
23
|
-
}
|
|
24
|
-
if (cssStyle)
|
|
25
|
-
instanceServiceContainer.stylesheetService.setStylesheets([{ name: 'css', content: cssStyle }]);
|
|
26
|
-
return this.htmlParser.parse(htmlCode, serviceContainer, instanceServiceContainer, parseSnippet);
|
|
27
|
-
}
|
|
28
|
-
writeBack(code, html, css, newLineCrLf) {
|
|
29
|
-
const sourceFile = this.parseTypescriptFile(code);
|
|
30
|
-
const transformTemplateLiterals = (context) => (rootNode) => {
|
|
31
|
-
function visit(node) {
|
|
32
|
-
//@ts-ignore
|
|
33
|
-
if (ts.isTemplateLiteral(node) &&
|
|
34
|
-
//@ts-ignore
|
|
35
|
-
ts.isTaggedTemplateExpression(node.parent) &&
|
|
36
|
-
node.parent.tag.escapedText == 'html' &&
|
|
37
|
-
node.parent.parent.name.escapedText == "template") {
|
|
38
|
-
//@ts-ignore
|
|
39
|
-
return ts.factory.createNoSubstitutionTemplateLiteral(html.replaceAll('\n', '\r\n'), html.replaceAll('\n', '\r\n'));
|
|
40
|
-
}
|
|
41
|
-
else if (css &&
|
|
42
|
-
//@ts-ignore
|
|
43
|
-
ts.isTemplateLiteral(node) &&
|
|
44
|
-
//@ts-ignore
|
|
45
|
-
ts.isTaggedTemplateExpression(node.parent) &&
|
|
46
|
-
node.parent.tag.escapedText == 'css' &&
|
|
47
|
-
node.parent.parent.name.escapedText == "style") {
|
|
48
|
-
//@ts-ignore
|
|
49
|
-
return ts.factory.createNoSubstitutionTemplateLiteral(css.replaceAll('\n', '\r\n'), css.replaceAll('\n', '\r\n'));
|
|
50
|
-
}
|
|
51
|
-
//@ts-ignore
|
|
52
|
-
return ts.visitEachChild(node, visit, context);
|
|
53
|
-
}
|
|
54
|
-
//@ts-ignore
|
|
55
|
-
return ts.visitNode(rootNode, visit);
|
|
56
|
-
};
|
|
57
|
-
//@ts-ignore
|
|
58
|
-
let transformed = ts.transform(sourceFile, [transformTemplateLiterals]).transformed[0];
|
|
59
|
-
//@ts-ignore
|
|
60
|
-
const printer = ts.createPrinter({ newLine: newLineCrLf ? ts.NewLineKind.CarriageReturnLineFeed : ts.NewLineKind.LineFeed });
|
|
61
|
-
//@ts-ignore
|
|
62
|
-
const result = printer.printNode(ts.EmitHint.Unspecified, transformed, transformed);
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
parseTypescriptFile(code) {
|
|
66
|
-
const compilerHost = {
|
|
67
|
-
fileExists: () => true,
|
|
68
|
-
getCanonicalFileName: filename => filename,
|
|
69
|
-
getCurrentDirectory: () => '',
|
|
70
|
-
getDefaultLibFileName: () => 'lib.d.ts',
|
|
71
|
-
getNewLine: () => '\n',
|
|
72
|
-
getSourceFile: filename => {
|
|
73
|
-
//@ts-ignore
|
|
74
|
-
return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, true);
|
|
75
|
-
},
|
|
76
|
-
readFile: () => null,
|
|
77
|
-
useCaseSensitiveFileNames: () => true,
|
|
78
|
-
writeFile: () => null,
|
|
79
|
-
};
|
|
80
|
-
const filename = 'aa.ts';
|
|
81
|
-
//@ts-ignore
|
|
82
|
-
const program = ts.createProgram([filename], {
|
|
83
|
-
noResolve: true,
|
|
84
|
-
//@ts-ignore
|
|
85
|
-
target: ts.ScriptTarget.Latest,
|
|
86
|
-
}, compilerHost);
|
|
87
|
-
const sourceFile = program.getSourceFile(filename);
|
|
88
|
-
return sourceFile;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IEditorTypesService } from './IEditorTypesService.js';
|
|
2
|
-
import { IProperty } from './IProperty.js';
|
|
3
|
-
import { IPropertyEditor } from './IPropertyEditor.js';
|
|
4
|
-
export declare class DefaultEditorTypesService implements IEditorTypesService {
|
|
5
|
-
getEditorForProperty(property: IProperty): IPropertyEditor;
|
|
6
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ColorPropertyEditor } from './propertyEditors/ColorPropertyEditor.js';
|
|
2
|
-
import { DatePropertyEditor } from './propertyEditors/DatePropertyEditor.js';
|
|
3
|
-
import { JsonPropertyEditor } from './propertyEditors/JsonPropertyEditor.js';
|
|
4
|
-
import { NumberPropertyEditor } from './propertyEditors/NumberPropertyEditor.js';
|
|
5
|
-
import { SelectPropertyEditor } from './propertyEditors/SelectPropertyEditor.js';
|
|
6
|
-
import { TextPropertyEditor } from './propertyEditors/TextPropertyEditor.js';
|
|
7
|
-
import { BooleanPropertyEditor } from './propertyEditors/BooleanPropertyEditor.js';
|
|
8
|
-
import { ImageButtonListPropertyEditor } from './propertyEditors/ImageButtonListPropertyEditor.js';
|
|
9
|
-
import { ThicknessPropertyEditor } from "./propertyEditors/ThicknessPropertyEditor.js";
|
|
10
|
-
import { MetricsPropertyEditor } from './propertyEditors/MetricsPropertyEditor.js';
|
|
11
|
-
export class DefaultEditorTypesService {
|
|
12
|
-
getEditorForProperty(property) {
|
|
13
|
-
if (property.createEditor)
|
|
14
|
-
return property.createEditor(property);
|
|
15
|
-
switch (property.type) {
|
|
16
|
-
case "json":
|
|
17
|
-
{
|
|
18
|
-
return new JsonPropertyEditor(property);
|
|
19
|
-
}
|
|
20
|
-
case "color":
|
|
21
|
-
{
|
|
22
|
-
return new ColorPropertyEditor(property);
|
|
23
|
-
}
|
|
24
|
-
case "date":
|
|
25
|
-
{
|
|
26
|
-
return new DatePropertyEditor(property);
|
|
27
|
-
}
|
|
28
|
-
case "number":
|
|
29
|
-
{
|
|
30
|
-
return new NumberPropertyEditor(property);
|
|
31
|
-
}
|
|
32
|
-
case "list":
|
|
33
|
-
{
|
|
34
|
-
return new SelectPropertyEditor(property);
|
|
35
|
-
}
|
|
36
|
-
case "enum":
|
|
37
|
-
{
|
|
38
|
-
return new SelectPropertyEditor(property);
|
|
39
|
-
}
|
|
40
|
-
case "boolean":
|
|
41
|
-
{
|
|
42
|
-
return new BooleanPropertyEditor(property);
|
|
43
|
-
}
|
|
44
|
-
case "img-list":
|
|
45
|
-
{
|
|
46
|
-
return new ImageButtonListPropertyEditor(property);
|
|
47
|
-
}
|
|
48
|
-
case "thickness":
|
|
49
|
-
{
|
|
50
|
-
return new ThicknessPropertyEditor(property);
|
|
51
|
-
}
|
|
52
|
-
case "metrics":
|
|
53
|
-
{
|
|
54
|
-
return new MetricsPropertyEditor(property);
|
|
55
|
-
}
|
|
56
|
-
case "css-length":
|
|
57
|
-
case "string":
|
|
58
|
-
default:
|
|
59
|
-
{
|
|
60
|
-
return new TextPropertyEditor(property);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { IEditorTypesService } from './IEditorTypesService.js';
|
|
2
|
-
import { IProperty } from './IProperty.js';
|
|
3
|
-
import { IPropertyEditor } from './IPropertyEditor.js';
|
|
4
|
-
export declare class DefaultEditorTypesService implements IEditorTypesService {
|
|
5
|
-
getEditorForProperty(property: IProperty): IPropertyEditor;
|
|
6
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ColorPropertyEditor } from './propertyEditors/ColorPropertyEditor.js';
|
|
2
|
-
import { DatePropertyEditor } from './propertyEditors/DatePropertyEditor.js';
|
|
3
|
-
import { JsonPropertyEditor } from './propertyEditors/JsonPropertyEditor.js';
|
|
4
|
-
import { NumberPropertyEditor } from './propertyEditors/NumberPropertyEditor.js';
|
|
5
|
-
import { SelectPropertyEditor } from './propertyEditors/SelectPropertyEditor.js';
|
|
6
|
-
import { TextPropertyEditor } from './propertyEditors/TextPropertyEditor.js';
|
|
7
|
-
import { BooleanPropertyEditor } from './propertyEditors/BooleanPropertyEditor.js';
|
|
8
|
-
import { ImageButtonListPropertyEditor } from './propertyEditors/ImageButtonListPropertyEditor.js';
|
|
9
|
-
import { ThicknessPropertyEditor } from "./propertyEditors/ThicknessPropertyEditor.js";
|
|
10
|
-
import { MetricsPropertyEditor } from './propertyEditors/MetricsPropertyEditor.js';
|
|
11
|
-
export class DefaultEditorTypesService {
|
|
12
|
-
getEditorForProperty(property) {
|
|
13
|
-
if (property.createEditor)
|
|
14
|
-
return property.createEditor(property);
|
|
15
|
-
switch (property.type) {
|
|
16
|
-
case "json":
|
|
17
|
-
{
|
|
18
|
-
return new JsonPropertyEditor(property);
|
|
19
|
-
}
|
|
20
|
-
case "color":
|
|
21
|
-
{
|
|
22
|
-
return new ColorPropertyEditor(property);
|
|
23
|
-
}
|
|
24
|
-
case "date":
|
|
25
|
-
{
|
|
26
|
-
return new DatePropertyEditor(property);
|
|
27
|
-
}
|
|
28
|
-
case "number":
|
|
29
|
-
{
|
|
30
|
-
return new NumberPropertyEditor(property);
|
|
31
|
-
}
|
|
32
|
-
case "list":
|
|
33
|
-
{
|
|
34
|
-
return new SelectPropertyEditor(property);
|
|
35
|
-
}
|
|
36
|
-
case "enum":
|
|
37
|
-
{
|
|
38
|
-
return new SelectPropertyEditor(property);
|
|
39
|
-
}
|
|
40
|
-
case "boolean":
|
|
41
|
-
{
|
|
42
|
-
return new BooleanPropertyEditor(property);
|
|
43
|
-
}
|
|
44
|
-
case "img-list":
|
|
45
|
-
{
|
|
46
|
-
return new ImageButtonListPropertyEditor(property);
|
|
47
|
-
}
|
|
48
|
-
case "thickness":
|
|
49
|
-
{
|
|
50
|
-
return new ThicknessPropertyEditor(property);
|
|
51
|
-
}
|
|
52
|
-
case "metrics":
|
|
53
|
-
{
|
|
54
|
-
return new MetricsPropertyEditor(property);
|
|
55
|
-
}
|
|
56
|
-
case "css-length":
|
|
57
|
-
case "string":
|
|
58
|
-
default:
|
|
59
|
-
{
|
|
60
|
-
return new TextPropertyEditor(property);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
package/dist/elements/services/propertiesService/propertyEditors/GridCellPropertyEditor.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IProperty } from '../IProperty.js';
|
|
2
|
-
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
|
-
import { ValueType } from '../ValueType.js';
|
|
4
|
-
export declare class GridCellPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
-
static template: HTMLTemplateElement;
|
|
6
|
-
_input: HTMLInputElement;
|
|
7
|
-
constructor(property: IProperty);
|
|
8
|
-
refreshValue(valueType: ValueType, value: any): void;
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
|
-
import { html } from '@node-projects/base-custom-webcomponent';
|
|
3
|
-
export class GridCellPropertyEditor extends BasePropertyEditor {
|
|
4
|
-
static template = html `
|
|
5
|
-
<div style="display: flex;">
|
|
6
|
-
|
|
7
|
-
</div>
|
|
8
|
-
`;
|
|
9
|
-
_input;
|
|
10
|
-
constructor(property) {
|
|
11
|
-
super(property);
|
|
12
|
-
}
|
|
13
|
-
refreshValue(valueType, value) {
|
|
14
|
-
debugger;
|
|
15
|
-
}
|
|
16
|
-
}
|
package/dist/elements/services/propertiesService/propertyEditors/JsonPropertyEditor copy.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IProperty } from '../IProperty.js';
|
|
2
|
-
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
3
|
-
import { ValueType } from '../ValueType.js';
|
|
4
|
-
export declare class JsonPropertyEditor extends BasePropertyEditor<HTMLDivElement> {
|
|
5
|
-
static template: HTMLTemplateElement;
|
|
6
|
-
_input: HTMLInputElement;
|
|
7
|
-
constructor(property: IProperty);
|
|
8
|
-
refreshValue(valueType: ValueType, value: any): void;
|
|
9
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BasePropertyEditor } from './BasePropertyEditor.js';
|
|
2
|
-
import { html } from '@node-projects/base-custom-webcomponent';
|
|
3
|
-
export class JsonPropertyEditor extends BasePropertyEditor {
|
|
4
|
-
static template = html `
|
|
5
|
-
<div style="display: flex;">
|
|
6
|
-
<input id="input" type="text">
|
|
7
|
-
<button style="width: 30px;">...</button>
|
|
8
|
-
</div>
|
|
9
|
-
`;
|
|
10
|
-
_input;
|
|
11
|
-
constructor(property) {
|
|
12
|
-
super(property);
|
|
13
|
-
let el = JsonPropertyEditor.template.content.cloneNode(true);
|
|
14
|
-
this._input = el.getElementById('input');
|
|
15
|
-
this._input.onchange = (e) => this._valueChanged(this._input.value);
|
|
16
|
-
this.element = el;
|
|
17
|
-
}
|
|
18
|
-
refreshValue(valueType, value) {
|
|
19
|
-
this._input.value = value;
|
|
20
|
-
}
|
|
21
|
-
}
|