@node-projects/web-component-designer 0.1.3 → 0.1.5
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/NpmPackageLoader.js +1 -8
- package/dist/elements/services/DefaultServiceBootstrap.js +2 -2
- package/dist/elements/services/ServiceContainer.d.ts +3 -3
- package/dist/elements/services/propertiesService/IPropertyGroupsService.d.ts +8 -0
- package/dist/elements/services/propertiesService/IPropertyGroupsService.js +1 -0
- package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +27 -0
- package/dist/elements/services/propertiesService/PropertyGroupsService.js +53 -0
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.js +1 -8
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +1 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -5,14 +5,7 @@ import { removeLeading, removeTrailing } from "./Helper.js";
|
|
|
5
5
|
//TODO: remove this code when import asserts are supported
|
|
6
6
|
let packageHacks;
|
|
7
7
|
//@ts-ignore
|
|
8
|
-
|
|
9
|
-
const packageHacksUrl = import.meta.resolve('./NpmPackageHacks.json');
|
|
10
|
-
//@ts-ignore
|
|
11
|
-
packageHacks = await importShim(packageHacksUrl, { assert: { type: 'json' } });
|
|
12
|
-
}
|
|
13
|
-
else
|
|
14
|
-
//@ts-ignore
|
|
15
|
-
packageHacks = await import("./NpmPackageHacks.json", { assert: { type: 'json' } });
|
|
8
|
+
packageHacks = await import("./NpmPackageHacks.json", { assert: { type: 'json' } });
|
|
16
9
|
if (packageHacks.default)
|
|
17
10
|
packageHacks = packageHacks.default;
|
|
18
11
|
export class NpmPackageLoader {
|
|
@@ -65,7 +65,7 @@ import { GrayOutDragOverContainerExtensionProvider } from '../widgets/designerVi
|
|
|
65
65
|
import { LineExtensionProvider } from '../widgets/designerView/extensions/svg/LineExtensionProvider.js';
|
|
66
66
|
import { RectExtentionProvider } from '../widgets/designerView/extensions/svg/RectExtensionProvider.js';
|
|
67
67
|
import { EllipsisExtensionProvider } from '../widgets/designerView/extensions/svg/EllipsisExtensionProvider.js';
|
|
68
|
-
import {
|
|
68
|
+
import { PropertyGroupsService } from './propertiesService/PropertyGroupsService.js';
|
|
69
69
|
import { PlacementExtensionProvider } from '../widgets/designerView/extensions/PlacementExtensionProvider.js';
|
|
70
70
|
import { FlexboxExtensionProvider } from '../widgets/designerView/extensions/FlexboxExtensionProvider.js';
|
|
71
71
|
import { FlexboxExtensionDesignViewConfigButtons } from '../widgets/designerView/extensions/buttons/FlexboxExtensionDesignViewConfigButtons.js';
|
|
@@ -96,7 +96,7 @@ export function createDefaultServiceContainer() {
|
|
|
96
96
|
serviceContainer.register("propertyService", new SVGElementsPropertiesService());
|
|
97
97
|
serviceContainer.register("propertyService", new Lit2PropertiesService());
|
|
98
98
|
serviceContainer.register("propertyService", new BaseCustomWebComponentPropertiesService());
|
|
99
|
-
serviceContainer.register("propertyGroupsService", new
|
|
99
|
+
serviceContainer.register("propertyGroupsService", new PropertyGroupsService());
|
|
100
100
|
serviceContainer.register("instanceService", new DefaultInstanceService());
|
|
101
101
|
serviceContainer.register("editorTypesService", new DefaultEditorTypesService());
|
|
102
102
|
serviceContainer.register("htmlWriterService", new HtmlWriterService());
|
|
@@ -32,7 +32,7 @@ import { IProperty } from "./propertiesService/IProperty.js";
|
|
|
32
32
|
import { IDesignItem } from "../item/IDesignItem.js";
|
|
33
33
|
import { IBinding } from '../item/IBinding.js';
|
|
34
34
|
import { BindingTarget } from '../item/BindingTarget.js';
|
|
35
|
-
import {
|
|
35
|
+
import { IPropertyGroupsService } from './propertiesService/IPropertyGroupsService.js';
|
|
36
36
|
import { IUndoService } from './undoService/IUndoService.js';
|
|
37
37
|
import { ISelectionService } from './selectionService/ISelectionService.js';
|
|
38
38
|
import { IContentService } from './contentService/IContentService.js';
|
|
@@ -64,7 +64,7 @@ interface ServiceNameMap {
|
|
|
64
64
|
"modelCommandService": IModelCommandService;
|
|
65
65
|
"demoProviderService": IDemoProviderService;
|
|
66
66
|
"elementInteractionService": IElementInteractionService;
|
|
67
|
-
"propertyGroupsService":
|
|
67
|
+
"propertyGroupsService": IPropertyGroupsService;
|
|
68
68
|
"dragDropService": IDragDropService;
|
|
69
69
|
"designItemService": IDesignItemService;
|
|
70
70
|
"eventsService": IEventsService;
|
|
@@ -101,7 +101,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
|
|
|
101
101
|
get elementInteractionServices(): IElementInteractionService[];
|
|
102
102
|
get propertiesServices(): IPropertiesService[];
|
|
103
103
|
get attachedPropertyServices(): IPropertiesService[];
|
|
104
|
-
get propertyGroupService():
|
|
104
|
+
get propertyGroupService(): IPropertyGroupsService;
|
|
105
105
|
get containerServices(): IPlacementService[];
|
|
106
106
|
get snaplinesProviderService(): ISnaplinesProviderService;
|
|
107
107
|
get elementsServices(): IElementsService[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
2
|
+
import { IPropertiesService } from './IPropertiesService.js';
|
|
3
|
+
export interface IPropertyGroupsService {
|
|
4
|
+
getPropertygroups(designItems: IDesignItem[]): {
|
|
5
|
+
name: string;
|
|
6
|
+
propertiesService: IPropertiesService;
|
|
7
|
+
}[];
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IDesignItem } from '../../item/IDesignItem.js';
|
|
2
|
+
import { IPropertiesService } from './IPropertiesService.js';
|
|
3
|
+
import { IPropertyGroupsService } from './IPropertyGroupsService.js';
|
|
4
|
+
import { AttachedPropertiesService } from './services/AttachedPropertiesService.js';
|
|
5
|
+
export declare class PropertyGroupsService implements IPropertyGroupsService {
|
|
6
|
+
protected _attachedPropertiesService: AttachedPropertiesService;
|
|
7
|
+
protected _pgList: {
|
|
8
|
+
name: string;
|
|
9
|
+
propertiesService: IPropertiesService;
|
|
10
|
+
}[];
|
|
11
|
+
protected _svgPgList: {
|
|
12
|
+
name: string;
|
|
13
|
+
propertiesService: IPropertiesService;
|
|
14
|
+
}[];
|
|
15
|
+
protected _gridChild: {
|
|
16
|
+
name: string;
|
|
17
|
+
propertiesService: IPropertiesService;
|
|
18
|
+
}[];
|
|
19
|
+
protected _flexChild: {
|
|
20
|
+
name: string;
|
|
21
|
+
propertiesService: IPropertiesService;
|
|
22
|
+
}[];
|
|
23
|
+
getPropertygroups(designItems: IDesignItem[]): {
|
|
24
|
+
name: string;
|
|
25
|
+
propertiesService: IPropertiesService;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { NodeType } from '../../item/NodeType.js';
|
|
2
|
+
import { AttachedPropertiesService } from './services/AttachedPropertiesService.js';
|
|
3
|
+
import { AttributesPropertiesService } from './services/AttributesPropertiesService.js';
|
|
4
|
+
import { CommonPropertiesService } from './services/CommonPropertiesService.js';
|
|
5
|
+
import { CssCurrentPropertiesService } from './services/CssCurrentPropertiesService.js';
|
|
6
|
+
import { CssCustomPropertiesService } from './services/CssCustomPropertiesService.js';
|
|
7
|
+
import { CssPropertiesService } from './services/CssPropertiesService.js';
|
|
8
|
+
export class PropertyGroupsService {
|
|
9
|
+
_attachedPropertiesService = new AttachedPropertiesService();
|
|
10
|
+
_pgList = [
|
|
11
|
+
{ name: 'properties', propertiesService: null },
|
|
12
|
+
{ name: 'attached', propertiesService: this._attachedPropertiesService },
|
|
13
|
+
{ name: 'attributes', propertiesService: new AttributesPropertiesService() },
|
|
14
|
+
{ name: 'common', propertiesService: new CommonPropertiesService() },
|
|
15
|
+
{ name: 'styles', propertiesService: new CssCurrentPropertiesService() },
|
|
16
|
+
{ name: 'css vars', propertiesService: new CssCustomPropertiesService() },
|
|
17
|
+
{ name: 'layout', propertiesService: new CssPropertiesService("layout") },
|
|
18
|
+
{ name: 'flex', propertiesService: new CssPropertiesService("flex") },
|
|
19
|
+
{ name: 'grid', propertiesService: new CssPropertiesService("grid") },
|
|
20
|
+
];
|
|
21
|
+
_svgPgList = [
|
|
22
|
+
{ name: 'properties', propertiesService: null },
|
|
23
|
+
{ name: 'attached', propertiesService: this._attachedPropertiesService },
|
|
24
|
+
{ name: 'attributes', propertiesService: new AttributesPropertiesService() },
|
|
25
|
+
{ name: 'styles', propertiesService: new CssCurrentPropertiesService() },
|
|
26
|
+
{ name: 'css vars', propertiesService: new CssCustomPropertiesService() },
|
|
27
|
+
{ name: 'layout', propertiesService: new CssPropertiesService("layout") },
|
|
28
|
+
{ name: 'svg', propertiesService: new CssPropertiesService("svg") },
|
|
29
|
+
];
|
|
30
|
+
_gridChild = [
|
|
31
|
+
{ name: 'gridChild', propertiesService: new CssPropertiesService("gridChild") },
|
|
32
|
+
];
|
|
33
|
+
_flexChild = [
|
|
34
|
+
{ name: 'flexChild', propertiesService: new CssPropertiesService("flexChild") },
|
|
35
|
+
];
|
|
36
|
+
getPropertygroups(designItems) {
|
|
37
|
+
if (designItems == null || designItems.length == 0)
|
|
38
|
+
return [];
|
|
39
|
+
if (designItems[0].nodeType == NodeType.TextNode || designItems[0].nodeType == NodeType.Comment)
|
|
40
|
+
return [];
|
|
41
|
+
this._pgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
42
|
+
this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
43
|
+
let lst = this._pgList;
|
|
44
|
+
if (designItems[0].element instanceof SVGElement)
|
|
45
|
+
lst = this._svgPgList;
|
|
46
|
+
const parentStyle = getComputedStyle(designItems[0].element.parentElement);
|
|
47
|
+
if (parentStyle.display.includes('grid'))
|
|
48
|
+
lst = [...lst, this._gridChild[0]];
|
|
49
|
+
else if (parentStyle.display.includes('flex'))
|
|
50
|
+
lst = [...lst, this._flexChild[0]];
|
|
51
|
+
return lst;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -6,14 +6,7 @@ import { NodeType } from '../../../item/NodeType.js';
|
|
|
6
6
|
//TODO: remove this code when import asserts are supported
|
|
7
7
|
let cssProperties;
|
|
8
8
|
//@ts-ignore
|
|
9
|
-
|
|
10
|
-
const cssPropertiesUrl = import.meta.resolve('./CssProperties.json');
|
|
11
|
-
//@ts-ignore
|
|
12
|
-
cssProperties = await importShim(cssPropertiesUrl, { assert: { type: 'json' } });
|
|
13
|
-
}
|
|
14
|
-
else
|
|
15
|
-
//@ts-ignore
|
|
16
|
-
cssProperties = await import("./CssProperties.json", { assert: { type: 'json' } });
|
|
9
|
+
cssProperties = await import("./CssProperties.json", { assert: { type: 'json' } });
|
|
17
10
|
if (cssProperties.default)
|
|
18
11
|
cssProperties = cssProperties.default;
|
|
19
12
|
const localName = '<local>';
|
|
@@ -8,14 +8,7 @@ import { MetricsPropertyEditor } from '../propertyEditors/special/MetricsPropert
|
|
|
8
8
|
//TODO: remove this code when import asserts are supported
|
|
9
9
|
let cssProperties;
|
|
10
10
|
//@ts-ignore
|
|
11
|
-
|
|
12
|
-
const cssPropertiesUrl = import.meta.resolve('./CssProperties.json');
|
|
13
|
-
//@ts-ignore
|
|
14
|
-
cssProperties = await importShim(cssPropertiesUrl, { assert: { type: 'json' } });
|
|
15
|
-
}
|
|
16
|
-
else
|
|
17
|
-
//@ts-ignore
|
|
18
|
-
cssProperties = await import("./CssProperties.json", { assert: { type: 'json' } });
|
|
11
|
+
cssProperties = await import("./CssProperties.json", { assert: { type: 'json' } });
|
|
19
12
|
if (cssProperties.default)
|
|
20
13
|
cssProperties = cssProperties.default;
|
|
21
14
|
export class CssPropertiesService extends CommonPropertiesService {
|
package/dist/index.d.ts
CHANGED
|
@@ -85,7 +85,8 @@ export type { IPropertiesService } from "./elements/services/propertiesService/I
|
|
|
85
85
|
export type { IProperty } from "./elements/services/propertiesService/IProperty.js";
|
|
86
86
|
export type { IPropertyEditor } from "./elements/services/propertiesService/IPropertyEditor.js";
|
|
87
87
|
export type { IPropertyGroup } from "./elements/services/propertiesService/IPropertyGroup.js";
|
|
88
|
-
export type {
|
|
88
|
+
export type { IPropertyGroupsService } from './elements/services/propertiesService/IPropertyGroupsService.js';
|
|
89
|
+
export * from "./elements/services/propertiesService/PropertyGroupsService.js";
|
|
89
90
|
export * from "./elements/services/propertiesService/propertyEditors/BasePropertyEditor.js";
|
|
90
91
|
export * from "./elements/services/propertiesService/propertyEditors/BooleanPropertyEditor.js";
|
|
91
92
|
export * from "./elements/services/propertiesService/propertyEditors/ColorPropertyEditor.js";
|
|
@@ -118,7 +119,6 @@ export * from "./elements/services/propertiesService/services/CssCustomPropertie
|
|
|
118
119
|
export * from "./elements/services/propertiesService/services/UnkownElementsPropertiesService.js";
|
|
119
120
|
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
120
121
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
121
|
-
export * from "./elements/services/propertiesService/PropertyTabsService.js";
|
|
122
122
|
export type { ISelectionChangedEvent } from "./elements/services/selectionService/ISelectionChangedEvent.js";
|
|
123
123
|
export type { ISelectionService } from "./elements/services/selectionService/ISelectionService.js";
|
|
124
124
|
export * from "./elements/services/selectionService/SelectionService.js";
|
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ export * from "./elements/services/instanceService/DefaultInstanceService.js";
|
|
|
46
46
|
export * from "./elements/services/manifestParsers/WebcomponentManifestParserService.js";
|
|
47
47
|
export * from "./elements/services/modelCommandService/DefaultModelCommandService.js";
|
|
48
48
|
export * from "./elements/services/propertiesService/DefaultEditorTypesService.js";
|
|
49
|
+
export * from "./elements/services/propertiesService/PropertyGroupsService.js";
|
|
49
50
|
export * from "./elements/services/propertiesService/propertyEditors/BasePropertyEditor.js";
|
|
50
51
|
export * from "./elements/services/propertiesService/propertyEditors/BooleanPropertyEditor.js";
|
|
51
52
|
export * from "./elements/services/propertiesService/propertyEditors/ColorPropertyEditor.js";
|
|
@@ -78,7 +79,6 @@ export * from "./elements/services/propertiesService/services/CssCustomPropertie
|
|
|
78
79
|
export * from "./elements/services/propertiesService/services/UnkownElementsPropertiesService.js";
|
|
79
80
|
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
80
81
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
81
|
-
export * from "./elements/services/propertiesService/PropertyTabsService.js";
|
|
82
82
|
export * from "./elements/services/selectionService/SelectionService.js";
|
|
83
83
|
export * from "./elements/services/stylesheetService/AbstractStylesheetService.js";
|
|
84
84
|
export * from "./elements/services/undoService/ChangeGroup.js";
|