@node-projects/web-component-designer-zpl 0.1.20 → 0.1.22
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseCustomWebComponentConstructorAppend, css, html } from '@node-projects/base-custom-webcomponent';
|
|
2
2
|
export class ZplDemoView extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
-
static template = html `<
|
|
3
|
+
static template = html `<h2>Label generated via http://api.labelary.com/</h2><br><img id="image">`;
|
|
4
4
|
static style = css `
|
|
5
5
|
:host {
|
|
6
6
|
display: block;
|
|
@@ -10,9 +10,8 @@ export class ZplDemoView extends BaseCustomWebComponentConstructorAppend {
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
position: relative;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
width: 100%;
|
|
13
|
+
#image {
|
|
14
|
+
border: solid 1px black;
|
|
16
15
|
}`;
|
|
17
16
|
constructor() {
|
|
18
17
|
super();
|
|
@@ -21,8 +20,19 @@ export class ZplDemoView extends BaseCustomWebComponentConstructorAppend {
|
|
|
21
20
|
canExecuteCommand;
|
|
22
21
|
dispose() { }
|
|
23
22
|
async display(serviceContainer, instanceServiceContainer, code, style) {
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
const width = 4;
|
|
24
|
+
const height = 6;
|
|
25
|
+
const dpmm = '24dpmm';
|
|
26
|
+
const response = await fetch(`https://api.labelary.com/v1/printers/${dpmm}/labels/${width}x${height}/${0}`, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: code,
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
31
|
+
'Accept': 'image/png'
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
this._getDomElement('image').src = URL.createObjectURL(await response.blob());
|
|
35
|
+
;
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
customElements.define('node-projects-zpl-demo-view', ZplDemoView);
|
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.22",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "jochen.kuehner@gmx.de",
|