@node-projects/web-component-designer 0.0.183 → 0.0.184
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/helper/Helper.d.ts +2 -0
- package/dist/elements/helper/Helper.js +10 -0
- package/dist/elements/services/elementsService/WebcomponentManifestElementsService.js +2 -1
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +2 -1
- package/package.json +1 -1
|
@@ -4,3 +4,5 @@ export declare function sleep(ms: any): Promise<unknown>;
|
|
|
4
4
|
export declare function exportData(blob: Blob, fileName: string): Promise<void>;
|
|
5
5
|
export declare function dataURItoBlob(dataURI: any): Blob;
|
|
6
6
|
export declare function pointInRect(point: IPoint, rect: IRect): boolean;
|
|
7
|
+
export declare function removeTrailing(text: string, char: string): string;
|
|
8
|
+
export declare function removeLeading(text: string, char: string): string;
|
|
@@ -24,3 +24,13 @@ export function dataURItoBlob(dataURI) {
|
|
|
24
24
|
export function pointInRect(point, rect) {
|
|
25
25
|
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
|
26
26
|
}
|
|
27
|
+
export function removeTrailing(text, char) {
|
|
28
|
+
if (text.endsWith('/'))
|
|
29
|
+
return text.substring(0, text.length - 1);
|
|
30
|
+
return text;
|
|
31
|
+
}
|
|
32
|
+
export function removeLeading(text, char) {
|
|
33
|
+
if (text.startsWith('/'))
|
|
34
|
+
return text.substring(1);
|
|
35
|
+
return text;
|
|
36
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removeLeading, removeTrailing } from "../../helper/Helper.js";
|
|
1
2
|
export class WebcomponentManifestElementsService {
|
|
2
3
|
_name;
|
|
3
4
|
get name() { return this._name; }
|
|
@@ -15,7 +16,7 @@ export class WebcomponentManifestElementsService {
|
|
|
15
16
|
for (let m of manifest.modules) {
|
|
16
17
|
for (let e of m.exports) {
|
|
17
18
|
if (e.kind == 'custom-element-definition') {
|
|
18
|
-
let elDef = { tag: e.name, import: this._importPrefix
|
|
19
|
+
let elDef = { tag: e.name, import: removeTrailing(this._importPrefix, '/') + '/' + removeLeading(e.declaration.module, '/'), defaultWidth: "200px", defaultHeight: "200px", className: e.declaration.name };
|
|
19
20
|
this._elementList.push(elDef);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -2,6 +2,7 @@ import { BindingTarget } from '../../item/BindingTarget.js';
|
|
|
2
2
|
import { RefreshMode } from '../propertiesService/IPropertiesService.js';
|
|
3
3
|
import { PropertyType } from '../propertiesService/PropertyType.js';
|
|
4
4
|
import { AbstractPropertiesService } from '../propertiesService/services/AbstractPropertiesService.js';
|
|
5
|
+
import { removeLeading, removeTrailing } from '../../helper/Helper.js';
|
|
5
6
|
export class WebcomponentManifestParserService extends AbstractPropertiesService {
|
|
6
7
|
getRefreshMode(designItem) {
|
|
7
8
|
return RefreshMode.none;
|
|
@@ -42,7 +43,7 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
|
|
|
42
43
|
for (let m of this._packageData.modules) {
|
|
43
44
|
for (let e of m.exports) {
|
|
44
45
|
if (e.kind == 'custom-element-definition') {
|
|
45
|
-
this._elementList.push({ tag: e.name, import: this._importPrefix
|
|
46
|
+
this._elementList.push({ tag: e.name, import: removeTrailing(this._importPrefix, '/') + '/' + removeLeading(e.declaration.module, '/') });
|
|
46
47
|
let properties = [];
|
|
47
48
|
let declaration = m.declarations.find(x => x.name == e.declaration.name);
|
|
48
49
|
for (let d of declaration.members) {
|