@node-projects/web-component-designer-zpl 0.1.17 → 0.1.19
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/services/ZplLayoutPlacementService.d.ts +2 -3
- package/dist/services/ZplLayoutPlacementService.js +2 -2
- package/dist/setupZplServiceContainer.js +2 -2
- package/package.json +4 -3
- package/dist/extensions/monaco/ZplLanguage.d.ts +0 -1
- package/dist/extensions/monaco/ZplLanguage.js +0 -28
- package/dist/widgets/zpl-text copy.d.ts +0 -25
- package/dist/widgets/zpl-text copy.js +0 -69
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { DefaultPlacementService, IDesignItem, IPoint } from '@node-projects/web-component-designer';
|
|
2
|
-
import { IPlacementView } from '@node-projects/web-component-designer/dist/elements/widgets/designerView/IPlacementView';
|
|
1
|
+
import { DefaultPlacementService, IDesignItem, IDesignerCanvas, IPoint } from '@node-projects/web-component-designer';
|
|
3
2
|
export declare class ZplLayoutPlacementService extends DefaultPlacementService {
|
|
4
3
|
constructor();
|
|
5
4
|
serviceForContainer(container: IDesignItem): boolean;
|
|
6
5
|
canEnter(container: IDesignItem, items: IDesignItem[]): boolean;
|
|
7
6
|
enterContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
8
7
|
leaveContainer(container: IDesignItem, items: IDesignItem[]): void;
|
|
9
|
-
finishPlace(event: MouseEvent,
|
|
8
|
+
finishPlace(event: MouseEvent, designerCanvas: IDesignerCanvas, container: IDesignItem, startPoint: IPoint, offsetInControl: IPoint, newPoint: IPoint, items: IDesignItem[]): void;
|
|
10
9
|
}
|
|
@@ -17,9 +17,9 @@ export class ZplLayoutPlacementService extends DefaultPlacementService {
|
|
|
17
17
|
}
|
|
18
18
|
leaveContainer(container, items) {
|
|
19
19
|
}
|
|
20
|
-
finishPlace(event,
|
|
20
|
+
finishPlace(event, designerCanvas, container, startPoint, offsetInControl, newPoint, items) {
|
|
21
21
|
{
|
|
22
|
-
super.finishPlace(event,
|
|
22
|
+
super.finishPlace(event, designerCanvas, container, startPoint, offsetInControl, newPoint, items);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExtensionType, DefaultModelCommandService, DefaultHtmlParserService, JsonFileElementsService, ServiceContainer,
|
|
1
|
+
import { ExtensionType, DefaultModelCommandService, DefaultHtmlParserService, JsonFileElementsService, ServiceContainer, PositionExtensionProvider, SelectionDefaultExtensionProvider, GrayOutExtensionProvider, AltToEnterContainerExtensionProvider, NamedTools, PointerTool, RectangleSelectorTool, ZoomTool, PanTool, MagicWandSelectorTool, ZMoveContextMenu, CopyPasteContextMenu, MultipleItemsSelectedContextMenu, ItemsBelowContextMenu, ElementDragTitleExtensionProvider, PointerToolButtonProvider, SeperatorToolProvider, SelectorToolButtonProvider, ZoomToolButtonProvider, HighlightElementExtensionProvider, ContentService, SelectionService, UndoService, GrayOutDragOverContainerExtensionProvider, ElementAtPointService, SnaplinesProviderService, DefaultInstanceService, PropertyGroupsService, DesignItemDocumentPositionService, DragDropService, BaseCustomWebComponentPropertiesService, DefaultEditorTypesService, TransformToolButtonProvider, DesignItemService } from '@node-projects/web-component-designer';
|
|
2
2
|
import { ZplLayoutPlacementService } from './services/ZplLayoutPlacementService.js';
|
|
3
3
|
import { ZplParserService } from './services/ZplParserService.js';
|
|
4
4
|
import { ZplImageDrop } from './services/ZplImageDrop.js';
|
|
@@ -21,6 +21,7 @@ export function createZplDesignerServiceContainer() {
|
|
|
21
21
|
serviceContainer.register('editorTypesService', new DefaultEditorTypesService());
|
|
22
22
|
serviceContainer.register("propertyGroupsService", new PropertyGroupsService());
|
|
23
23
|
serviceContainer.register("propertyService", new BaseCustomWebComponentPropertiesService(true));
|
|
24
|
+
serviceContainer.register("designItemService", new DesignItemService());
|
|
24
25
|
serviceContainer.register("undoService", (designerCanvas) => new UndoService(designerCanvas));
|
|
25
26
|
serviceContainer.register("selectionService", (designerCanvas) => new SelectionService(designerCanvas, false));
|
|
26
27
|
serviceContainer.register("contentService", (designerCanvas) => new ContentService(designerCanvas.rootDesignItem));
|
|
@@ -28,7 +29,6 @@ export function createZplDesignerServiceContainer() {
|
|
|
28
29
|
serviceContainer.designerExtensions.set(ExtensionType.Permanent, []);
|
|
29
30
|
serviceContainer.designerExtensions.set(ExtensionType.PrimarySelection, [
|
|
30
31
|
new ElementDragTitleExtensionProvider(),
|
|
31
|
-
new CanvasExtensionProvider(),
|
|
32
32
|
new PositionExtensionProvider(),
|
|
33
33
|
new ZplLayoutResizeExtensionProvider(true)
|
|
34
34
|
]);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "web-component-designer addon: Widgets and Services for creating a ZPL Designer",
|
|
3
3
|
"name": "@node-projects/web-component-designer-zpl",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"tsc": "tsc",
|
|
11
11
|
"build": "tsc",
|
|
12
|
+
"link": "npm link",
|
|
12
13
|
"prepublishOnly": "npm run build"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"@node-projects/base-custom-webcomponent": ">=0.
|
|
16
|
-
"@node-projects/web-component-designer": ">=0.1.
|
|
16
|
+
"@node-projects/base-custom-webcomponent": ">=0.27.8",
|
|
17
|
+
"@node-projects/web-component-designer": ">=0.1.224",
|
|
17
18
|
"jsbarcode": "^3.11.6"
|
|
18
19
|
},
|
|
19
20
|
"repository": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addZplLanguageToMonaco(monaco: any): void;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export function addZplLanguageToMonaco(monaco) {
|
|
2
|
-
//@ts-ignore
|
|
3
|
-
monaco.languages.register({ id: "zplLanguage" });
|
|
4
|
-
//@ts-ignore
|
|
5
|
-
monaco.languages.setMonarchTokensProvider("zplLanguage", {
|
|
6
|
-
tokenizer: {
|
|
7
|
-
root: [
|
|
8
|
-
// lookbehind seems not to work - [/(?<=\^FD)[^\^]*/, "text"],
|
|
9
|
-
[/\^FX[^\^]*/, "comment"],
|
|
10
|
-
[/\^FD[^\^]*/, "text"],
|
|
11
|
-
[/\^../, "command"],
|
|
12
|
-
],
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
//@ts-ignore
|
|
16
|
-
monaco.editor.defineTheme("zplTheme", {
|
|
17
|
-
base: "vs",
|
|
18
|
-
inherit: false,
|
|
19
|
-
rules: [
|
|
20
|
-
{ token: "text", foreground: "999999" },
|
|
21
|
-
{ token: "comment", foreground: "008000" },
|
|
22
|
-
{ token: "command", foreground: "0000FF", fontStyle: "bold" },
|
|
23
|
-
],
|
|
24
|
-
colors: {
|
|
25
|
-
"editor.foreground": "#000000",
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentConstructorAppend } from "@node-projects/base-custom-webcomponent";
|
|
2
|
-
declare enum FontNames {
|
|
3
|
-
Font_0 = "0",
|
|
4
|
-
Font_A = "A"
|
|
5
|
-
}
|
|
6
|
-
export declare class ZplText extends BaseCustomWebComponentConstructorAppend {
|
|
7
|
-
static readonly style: CSSStyleSheet;
|
|
8
|
-
static readonly template: HTMLTemplateElement;
|
|
9
|
-
static readonly is = "zpl-text";
|
|
10
|
-
content: string;
|
|
11
|
-
fontName: string;
|
|
12
|
-
fontHeight: number;
|
|
13
|
-
fontWidth: number;
|
|
14
|
-
private _text;
|
|
15
|
-
static readonly properties: {
|
|
16
|
-
content: StringConstructor;
|
|
17
|
-
fontName: typeof FontNames;
|
|
18
|
-
fontHeight: NumberConstructor;
|
|
19
|
-
fontWidth: NumberConstructor;
|
|
20
|
-
};
|
|
21
|
-
constructor();
|
|
22
|
-
ready(): Promise<void>;
|
|
23
|
-
createZpl(): string;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
|
|
2
|
-
import { getZplCoordinates } from "../zplHelper.js";
|
|
3
|
-
var FontNames;
|
|
4
|
-
(function (FontNames) {
|
|
5
|
-
FontNames["Font_0"] = "0";
|
|
6
|
-
FontNames["Font_A"] = "A";
|
|
7
|
-
})(FontNames || (FontNames = {}));
|
|
8
|
-
export class ZplText extends BaseCustomWebComponentConstructorAppend {
|
|
9
|
-
static style = css `
|
|
10
|
-
*{
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
static template = html `
|
|
15
|
-
<div id="text-div" style="width: 100%; height: 100%; pointer-events: none">
|
|
16
|
-
</div>
|
|
17
|
-
`;
|
|
18
|
-
static is = 'zpl-text';
|
|
19
|
-
content;
|
|
20
|
-
fontName;
|
|
21
|
-
fontHeight;
|
|
22
|
-
fontWidth;
|
|
23
|
-
_text;
|
|
24
|
-
static properties = {
|
|
25
|
-
content: String,
|
|
26
|
-
fontName: FontNames,
|
|
27
|
-
fontHeight: Number,
|
|
28
|
-
fontWidth: Number
|
|
29
|
-
};
|
|
30
|
-
constructor() {
|
|
31
|
-
super();
|
|
32
|
-
this._restoreCachedInititalValues();
|
|
33
|
-
this._text = this._getDomElement("text-div");
|
|
34
|
-
}
|
|
35
|
-
async ready() {
|
|
36
|
-
this._parseAttributesToProperties();
|
|
37
|
-
this._text.innerHTML = this.content;
|
|
38
|
-
this._text.style.transformOrigin = "0 0";
|
|
39
|
-
switch (this.fontName) {
|
|
40
|
-
case FontNames.Font_0:
|
|
41
|
-
this._text.style.fontSize = "9px";
|
|
42
|
-
this._text.style.fontFamily = "RobotoCn, Verdana";
|
|
43
|
-
this._text.style.fontKerning = "none";
|
|
44
|
-
this._text.style.transform = "scaleX(" + this.fontWidth / 9 + ") scaleY(" + this.fontHeight / 9 + ") translate(0px, -3px)";
|
|
45
|
-
break;
|
|
46
|
-
case FontNames.Font_A:
|
|
47
|
-
this._text.style.fontSize = "9px";
|
|
48
|
-
this._text.style.fontFamily = "monospace";
|
|
49
|
-
this._text.style.transform = "scaleX(" + this.fontWidth / 5 + ") scaleY(" + this.fontHeight / 8 + ") translate(0px, -3px)";
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
this.style.width = '';
|
|
53
|
-
this.style.height = '';
|
|
54
|
-
requestAnimationFrame(() => {
|
|
55
|
-
let rect = this._text.getBoundingClientRect();
|
|
56
|
-
this.style.width = rect.width + 'px';
|
|
57
|
-
this.style.height = rect.height / 2 + 'px';
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
createZpl() {
|
|
61
|
-
let zpl = "";
|
|
62
|
-
zpl += getZplCoordinates(this, 0);
|
|
63
|
-
zpl += "^CF" + this.fontName + "," + this.fontHeight + "," + this.fontWidth;
|
|
64
|
-
zpl += "^FD" + this.content;
|
|
65
|
-
zpl += "^FS";
|
|
66
|
-
return zpl;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
customElements.define(ZplText.is, ZplText);
|