Skip to content

Commit e789023

Browse files
committed
work on svghmi
1 parent 4de59f6 commit e789023

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@node-projects/svghmi.webcomponent",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "a svghmi webcomponent.",
55
"type": "module",
66
"main": "./dist/index.js",
@@ -22,7 +22,7 @@
2222
},
2323
"customElements": "custom-elements.json",
2424
"devDependencies": {
25-
"@node-projects/web-component-designer": "^0.1.253",
25+
"@node-projects/web-component-designer": "^0.1.254",
2626
"@web/dev-server": "^0.4.6",
2727
"typescript": "^5.8.3"
2828
},

sample/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
<body>
1313
<node-projects-svghmi src="./sample.svghmi" style="position: absolute; width: 500px; height: 300px;">
1414
</node-projects-svghmi>
15-
<!--<node-projects-svghmi FarbeKreis="0xFF334455" src="./sample.svghmi" style="position: absolute; width: 500px; height: 300px; top: 400px;">
15+
<node-projects-svghmi farbe-kreis="0xFF334455" src="./sample.svghmi" style="position: absolute; width: 500px; height: 300px; top: 400px;">
1616
</node-projects-svghmi>
1717
<node-projects-svghmi src="./BatteryCharge.svghmi" style="position: absolute; width: 500px; height: 300px; top: 800px;">
1818
</node-projects-svghmi>
1919
<node-projects-svghmi src="./RegenerativeBlower_WithBox.svghmi" style="position: absolute; width: 500px; height: 300px; top: 1200px;">
20-
</node-projects-svghmi>-->
20+
</node-projects-svghmi>
2121
</body>
2222
</html>

src/SvgHmi.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class SvgHmi extends BaseCustomWebComponentConstructorAppend {
7171
continue;
7272

7373
let name = n.getAttribute('name');
74-
let nm = name.toLocaleLowerCase(); //TODO, lowercase Name should be snake cased!
74+
let nm = SvgHmi.camelToDashCase(name);
7575
let tp = n.getAttribute('type');
7676
let d = n.getAttribute('default');
7777
this._svgHmiProperties.set(nm, { name: name, type: tp, default: d });
@@ -126,6 +126,10 @@ export class SvgHmi extends BaseCustomWebComponentConstructorAppend {
126126
}
127127
}
128128

129+
public static camelToDashCase(text: string) {
130+
return text[0].toLowerCase() + text.substring(1).replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`);
131+
}
132+
129133
/*private parseValue(value: string, type: string) {
130134
switch (type) {
131135
case "HmiColor": {
@@ -135,7 +139,7 @@ export class SvgHmi extends BaseCustomWebComponentConstructorAppend {
135139
136140
return value;
137141
}*/
138-
142+
139143
protected override _parseAttributesToProperties(noBindings?: boolean): void {
140144
super._parseAttributesToProperties();
141145
}

src/designer/SvgHmiPropertiesService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { IDesignItem, IProperty, IPropertyGroup, PropertyType } from "@node-projects/web-component-designer";
2-
import { AbstractPolymerLikePropertiesService } from "@node-projects/web-component-designer/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.js";
1+
import { AbstractPolymerLikePropertiesService, IDesignItem, IProperty, IPropertyGroup, PropertyType } from "@node-projects/web-component-designer";
32
import { SvgHmi } from "../SvgHmi.js";
43

54
export default class AttachedPropertiesService extends AbstractPolymerLikePropertiesService {

0 commit comments

Comments
 (0)