@node-projects/web-component-designer 0.1.141 → 0.1.143

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.
@@ -94,12 +94,14 @@ import { ToolbarExtensionsDesignViewConfigButtons } from '../widgets/designerVie
94
94
  import { PaddingExtensionProvider } from '../widgets/designerView/extensions/PaddingExtensionProvider.js';
95
95
  import { GridChildResizeExtensionProvider } from '../widgets/designerView/extensions/grid/GridChildResizeExtensionProvider.js';
96
96
  import { AlignItemsContextMenu } from '../widgets/designerView/extensions/contextMenu/AlignItemsContextMenu.js';
97
+ import { BasicWebcomponentPropertiesService } from './propertiesService/services/BasicWebcomponentPropertiesService.js';
97
98
  export function createDefaultServiceContainer() {
98
99
  let serviceContainer = new ServiceContainer();
99
100
  let defaultPlacementService = new DefaultPlacementService();
100
101
  serviceContainer.register("containerService", defaultPlacementService);
101
102
  serviceContainer.register("containerService", new GridPlacementService(defaultPlacementService));
102
103
  serviceContainer.register("containerService", new FlexBoxPlacementService(defaultPlacementService));
104
+ serviceContainer.register("propertyService", new BasicWebcomponentPropertiesService());
103
105
  serviceContainer.register("propertyService", new PolymerPropertiesService());
104
106
  serviceContainer.register("propertyService", new LitElementPropertiesService());
105
107
  serviceContainer.register("propertyService", new NativeElementsPropertiesService());
@@ -38,7 +38,7 @@ export class BaseCustomWebcomponentBindingsService {
38
38
  bnd.expression = value.substring(2, value.length - 2);
39
39
  }
40
40
  else if (a[0].startsWith('.')) {
41
- bnd.targetName = name.substring(1);
41
+ bnd.targetName = PropertiesHelper.dashToCamelCase(name.substring(1));
42
42
  bnd.target = BindingTarget.explicitProperty;
43
43
  bnd.expression = value.substring(2, value.length - 2);
44
44
  }
@@ -0,0 +1,21 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
4
+ import { RefreshMode } from '../IPropertiesService.js';
5
+ import { IPropertyGroup } from '../IPropertyGroup.js';
6
+ export declare class NativeElementsPropertiesService extends CommonPropertiesService {
7
+ private inputProperties;
8
+ private textareaProperties;
9
+ private selectProperties;
10
+ private buttonProperties;
11
+ private anchorProperties;
12
+ private divProperties;
13
+ private imgProperties;
14
+ private iframeProperties;
15
+ private formElementProperties;
16
+ name: string;
17
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
18
+ isHandledElement(designItem: IDesignItem): boolean;
19
+ getProperty(designItem: IDesignItem, name: string): IProperty;
20
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
21
+ }
@@ -0,0 +1,243 @@
1
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
2
+ import { PropertyType } from '../PropertyType.js';
3
+ import { RefreshMode } from '../IPropertiesService.js';
4
+ export class NativeElementsPropertiesService extends CommonPropertiesService {
5
+ inputProperties = [
6
+ {
7
+ name: "type",
8
+ type: "list",
9
+ values: ["text", "number", "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "password", "radio", "range", "reset", "search", "submit", "tel", "time", "url", "week"],
10
+ service: this,
11
+ defaultValue: "text",
12
+ propertyType: PropertyType.propertyAndAttribute
13
+ }, {
14
+ name: "value",
15
+ type: "string",
16
+ service: this,
17
+ propertyType: PropertyType.propertyAndAttribute
18
+ }, {
19
+ name: "placeholder",
20
+ type: "string",
21
+ service: this,
22
+ propertyType: PropertyType.propertyAndAttribute
23
+ }, {
24
+ name: "checked",
25
+ type: "boolean",
26
+ service: this,
27
+ propertyType: PropertyType.propertyAndAttribute
28
+ }, {
29
+ name: "min",
30
+ type: "number",
31
+ service: this,
32
+ propertyType: PropertyType.propertyAndAttribute
33
+ }, {
34
+ name: "max",
35
+ type: "number",
36
+ service: this,
37
+ propertyType: PropertyType.propertyAndAttribute
38
+ }, {
39
+ name: "readonly",
40
+ type: "boolean",
41
+ service: this,
42
+ propertyType: PropertyType.propertyAndAttribute
43
+ }, {
44
+ name: "valueAsDate",
45
+ type: "string",
46
+ service: this,
47
+ propertyType: PropertyType.property
48
+ },
49
+ {
50
+ name: "valueAsNumber",
51
+ type: "string",
52
+ service: this,
53
+ propertyType: PropertyType.property
54
+ }
55
+ ];
56
+ textareaProperties = [
57
+ {
58
+ name: "value",
59
+ type: "string",
60
+ service: this,
61
+ propertyType: PropertyType.property
62
+ },
63
+ {
64
+ name: "placeholder",
65
+ type: "string",
66
+ service: this,
67
+ propertyType: PropertyType.propertyAndAttribute
68
+ }, {
69
+ name: "maxlength",
70
+ type: "number",
71
+ service: this,
72
+ propertyType: PropertyType.propertyAndAttribute
73
+ }, {
74
+ name: "cols",
75
+ type: "number",
76
+ service: this,
77
+ propertyType: PropertyType.propertyAndAttribute
78
+ }, {
79
+ name: "rows",
80
+ type: "number",
81
+ service: this,
82
+ propertyType: PropertyType.propertyAndAttribute
83
+ }, {
84
+ name: "readonly",
85
+ type: "boolean",
86
+ service: this,
87
+ propertyType: PropertyType.propertyAndAttribute
88
+ }, {
89
+ name: "resize",
90
+ type: "list",
91
+ values: ["both", "none", "horizontal", "vertical"],
92
+ service: this,
93
+ propertyType: PropertyType.cssValue
94
+ }
95
+ ];
96
+ selectProperties = [
97
+ {
98
+ name: "value",
99
+ type: "string",
100
+ service: this,
101
+ propertyType: PropertyType.property
102
+ },
103
+ {
104
+ name: "size",
105
+ type: "number",
106
+ service: this,
107
+ propertyType: PropertyType.propertyAndAttribute
108
+ }, {
109
+ name: "multiple",
110
+ type: "boolean",
111
+ service: this,
112
+ propertyType: PropertyType.propertyAndAttribute
113
+ }
114
+ ];
115
+ buttonProperties = [
116
+ {
117
+ name: "type",
118
+ type: "list",
119
+ values: ["button", "submit", "reset"],
120
+ service: this,
121
+ defaultValue: "button",
122
+ propertyType: PropertyType.propertyAndAttribute
123
+ }, {
124
+ name: "value",
125
+ type: "string",
126
+ service: this,
127
+ propertyType: PropertyType.propertyAndAttribute
128
+ }
129
+ ];
130
+ anchorProperties = [
131
+ {
132
+ name: "href",
133
+ type: "string",
134
+ service: this,
135
+ propertyType: PropertyType.propertyAndAttribute
136
+ }
137
+ ];
138
+ divProperties = [
139
+ {
140
+ name: "title",
141
+ type: "string",
142
+ service: this,
143
+ propertyType: PropertyType.propertyAndAttribute
144
+ }
145
+ ];
146
+ imgProperties = [
147
+ {
148
+ name: "src",
149
+ type: "string",
150
+ service: this,
151
+ propertyType: PropertyType.propertyAndAttribute
152
+ }
153
+ ];
154
+ iframeProperties = [
155
+ {
156
+ name: "src",
157
+ type: "string",
158
+ service: this,
159
+ propertyType: PropertyType.propertyAndAttribute
160
+ }
161
+ ];
162
+ formElementProperties = [
163
+ {
164
+ name: "autofocus",
165
+ type: "boolean",
166
+ service: this,
167
+ propertyType: PropertyType.propertyAndAttribute
168
+ },
169
+ {
170
+ name: "disabled",
171
+ type: "boolean",
172
+ service: this,
173
+ propertyType: PropertyType.propertyAndAttribute
174
+ },
175
+ {
176
+ name: "required",
177
+ type: "boolean",
178
+ service: this,
179
+ propertyType: PropertyType.propertyAndAttribute
180
+ }
181
+ ];
182
+ name = "native";
183
+ getRefreshMode(designItem) {
184
+ return RefreshMode.full;
185
+ }
186
+ isHandledElement(designItem) {
187
+ switch (designItem.element.localName) {
188
+ case 'input':
189
+ case 'textarea':
190
+ case 'select':
191
+ case 'button':
192
+ case 'a':
193
+ case 'div':
194
+ case 'span':
195
+ case 'br':
196
+ case 'img':
197
+ case 'iframe':
198
+ case 'h1':
199
+ case 'h2':
200
+ case 'h3':
201
+ case 'h4':
202
+ case 'h5':
203
+ case 'h6':
204
+ case 'p':
205
+ return true;
206
+ }
207
+ return false;
208
+ }
209
+ getProperty(designItem, name) {
210
+ return this.getProperties(designItem).find(x => x.name == name);
211
+ }
212
+ getProperties(designItem) {
213
+ if (!this.isHandledElement(designItem))
214
+ return null;
215
+ switch (designItem.element.localName) {
216
+ case 'input':
217
+ return [...this.inputProperties, ...this.formElementProperties];
218
+ case 'textarea':
219
+ return [...this.textareaProperties, ...this.formElementProperties];
220
+ case 'select':
221
+ return [...this.selectProperties, ...this.formElementProperties];
222
+ case 'button':
223
+ return [...this.buttonProperties, ...this.formElementProperties];
224
+ case 'a':
225
+ return this.anchorProperties;
226
+ case 'div':
227
+ return this.divProperties;
228
+ case 'img':
229
+ return this.imgProperties;
230
+ case 'iframe':
231
+ return this.iframeProperties;
232
+ case 'h1':
233
+ case 'h2':
234
+ case 'h3':
235
+ case 'h4':
236
+ case 'h5':
237
+ case 'h6':
238
+ case 'p':
239
+ return [];
240
+ }
241
+ return null;
242
+ }
243
+ }
@@ -0,0 +1,12 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { RefreshMode } from '../IPropertiesService.js';
4
+ import { IPropertyGroup } from '../IPropertyGroup.js';
5
+ import { AbstractPropertiesService } from './AbstractPropertiesService.js';
6
+ export declare class BasicWebcomponentPropertiesService extends AbstractPropertiesService {
7
+ name: string;
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
9
+ isHandledElement(designItem: IDesignItem): boolean;
10
+ getProperty(designItem: IDesignItem, name: string): IProperty;
11
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
12
+ }
@@ -0,0 +1,31 @@
1
+ import { PropertyType } from '../PropertyType.js';
2
+ import { RefreshMode } from '../IPropertiesService.js';
3
+ import { AbstractPropertiesService } from './AbstractPropertiesService.js';
4
+ import { PropertiesHelper } from './PropertiesHelper.js';
5
+ export class BasicWebcomponentPropertiesService extends AbstractPropertiesService {
6
+ name = "webcomponent";
7
+ getRefreshMode(designItem) {
8
+ return RefreshMode.full;
9
+ }
10
+ isHandledElement(designItem) {
11
+ //@ts-ignore
12
+ const attr = designItem.element.constructor?.observedAttributes;
13
+ if (attr && attr.length > 0) {
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+ getProperty(designItem, name) {
19
+ return this.getProperties(designItem).find(x => x.name == name);
20
+ }
21
+ getProperties(designItem) {
22
+ //@ts-ignore
23
+ const attr = designItem.element.constructor?.observedAttributes;
24
+ return attr.map(x => ({
25
+ name: PropertiesHelper.dashToCamelCase(x),
26
+ type: "string",
27
+ service: this,
28
+ propertyType: PropertyType.propertyAndAttribute
29
+ }));
30
+ }
31
+ }
@@ -0,0 +1,21 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
4
+ import { RefreshMode } from '../IPropertiesService.js';
5
+ import { IPropertyGroup } from '../IPropertyGroup.js';
6
+ export declare class NativeElementsPropertiesService extends CommonPropertiesService {
7
+ private inputProperties;
8
+ private textareaProperties;
9
+ private selectProperties;
10
+ private buttonProperties;
11
+ private anchorProperties;
12
+ private divProperties;
13
+ private imgProperties;
14
+ private iframeProperties;
15
+ private formElementProperties;
16
+ name: string;
17
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
18
+ isHandledElement(designItem: IDesignItem): boolean;
19
+ getProperty(designItem: IDesignItem, name: string): IProperty;
20
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
21
+ }
@@ -0,0 +1,243 @@
1
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
2
+ import { PropertyType } from '../PropertyType.js';
3
+ import { RefreshMode } from '../IPropertiesService.js';
4
+ export class NativeElementsPropertiesService extends CommonPropertiesService {
5
+ inputProperties = [
6
+ {
7
+ name: "type",
8
+ type: "list",
9
+ values: ["text", "number", "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "password", "radio", "range", "reset", "search", "submit", "tel", "time", "url", "week"],
10
+ service: this,
11
+ defaultValue: "text",
12
+ propertyType: PropertyType.propertyAndAttribute
13
+ }, {
14
+ name: "value",
15
+ type: "string",
16
+ service: this,
17
+ propertyType: PropertyType.propertyAndAttribute
18
+ }, {
19
+ name: "placeholder",
20
+ type: "string",
21
+ service: this,
22
+ propertyType: PropertyType.propertyAndAttribute
23
+ }, {
24
+ name: "checked",
25
+ type: "boolean",
26
+ service: this,
27
+ propertyType: PropertyType.propertyAndAttribute
28
+ }, {
29
+ name: "min",
30
+ type: "number",
31
+ service: this,
32
+ propertyType: PropertyType.propertyAndAttribute
33
+ }, {
34
+ name: "max",
35
+ type: "number",
36
+ service: this,
37
+ propertyType: PropertyType.propertyAndAttribute
38
+ }, {
39
+ name: "readonly",
40
+ type: "boolean",
41
+ service: this,
42
+ propertyType: PropertyType.propertyAndAttribute
43
+ }, {
44
+ name: "valueAsDate",
45
+ type: "string",
46
+ service: this,
47
+ propertyType: PropertyType.property
48
+ },
49
+ {
50
+ name: "valueAsNumber",
51
+ type: "string",
52
+ service: this,
53
+ propertyType: PropertyType.property
54
+ }
55
+ ];
56
+ textareaProperties = [
57
+ {
58
+ name: "value",
59
+ type: "string",
60
+ service: this,
61
+ propertyType: PropertyType.property
62
+ },
63
+ {
64
+ name: "placeholder",
65
+ type: "string",
66
+ service: this,
67
+ propertyType: PropertyType.propertyAndAttribute
68
+ }, {
69
+ name: "maxlength",
70
+ type: "number",
71
+ service: this,
72
+ propertyType: PropertyType.propertyAndAttribute
73
+ }, {
74
+ name: "cols",
75
+ type: "number",
76
+ service: this,
77
+ propertyType: PropertyType.propertyAndAttribute
78
+ }, {
79
+ name: "rows",
80
+ type: "number",
81
+ service: this,
82
+ propertyType: PropertyType.propertyAndAttribute
83
+ }, {
84
+ name: "readonly",
85
+ type: "boolean",
86
+ service: this,
87
+ propertyType: PropertyType.propertyAndAttribute
88
+ }, {
89
+ name: "resize",
90
+ type: "list",
91
+ values: ["both", "none", "horizontal", "vertical"],
92
+ service: this,
93
+ propertyType: PropertyType.cssValue
94
+ }
95
+ ];
96
+ selectProperties = [
97
+ {
98
+ name: "value",
99
+ type: "string",
100
+ service: this,
101
+ propertyType: PropertyType.property
102
+ },
103
+ {
104
+ name: "size",
105
+ type: "number",
106
+ service: this,
107
+ propertyType: PropertyType.propertyAndAttribute
108
+ }, {
109
+ name: "multiple",
110
+ type: "boolean",
111
+ service: this,
112
+ propertyType: PropertyType.propertyAndAttribute
113
+ }
114
+ ];
115
+ buttonProperties = [
116
+ {
117
+ name: "type",
118
+ type: "list",
119
+ values: ["button", "submit", "reset"],
120
+ service: this,
121
+ defaultValue: "button",
122
+ propertyType: PropertyType.propertyAndAttribute
123
+ }, {
124
+ name: "value",
125
+ type: "string",
126
+ service: this,
127
+ propertyType: PropertyType.propertyAndAttribute
128
+ }
129
+ ];
130
+ anchorProperties = [
131
+ {
132
+ name: "href",
133
+ type: "string",
134
+ service: this,
135
+ propertyType: PropertyType.propertyAndAttribute
136
+ }
137
+ ];
138
+ divProperties = [
139
+ {
140
+ name: "title",
141
+ type: "string",
142
+ service: this,
143
+ propertyType: PropertyType.propertyAndAttribute
144
+ }
145
+ ];
146
+ imgProperties = [
147
+ {
148
+ name: "src",
149
+ type: "string",
150
+ service: this,
151
+ propertyType: PropertyType.propertyAndAttribute
152
+ }
153
+ ];
154
+ iframeProperties = [
155
+ {
156
+ name: "src",
157
+ type: "string",
158
+ service: this,
159
+ propertyType: PropertyType.propertyAndAttribute
160
+ }
161
+ ];
162
+ formElementProperties = [
163
+ {
164
+ name: "autofocus",
165
+ type: "boolean",
166
+ service: this,
167
+ propertyType: PropertyType.propertyAndAttribute
168
+ },
169
+ {
170
+ name: "disabled",
171
+ type: "boolean",
172
+ service: this,
173
+ propertyType: PropertyType.propertyAndAttribute
174
+ },
175
+ {
176
+ name: "required",
177
+ type: "boolean",
178
+ service: this,
179
+ propertyType: PropertyType.propertyAndAttribute
180
+ }
181
+ ];
182
+ name = "native";
183
+ getRefreshMode(designItem) {
184
+ return RefreshMode.full;
185
+ }
186
+ isHandledElement(designItem) {
187
+ switch (designItem.element.localName) {
188
+ case 'input':
189
+ case 'textarea':
190
+ case 'select':
191
+ case 'button':
192
+ case 'a':
193
+ case 'div':
194
+ case 'span':
195
+ case 'br':
196
+ case 'img':
197
+ case 'iframe':
198
+ case 'h1':
199
+ case 'h2':
200
+ case 'h3':
201
+ case 'h4':
202
+ case 'h5':
203
+ case 'h6':
204
+ case 'p':
205
+ return true;
206
+ }
207
+ return false;
208
+ }
209
+ getProperty(designItem, name) {
210
+ return this.getProperties(designItem).find(x => x.name == name);
211
+ }
212
+ getProperties(designItem) {
213
+ if (!this.isHandledElement(designItem))
214
+ return null;
215
+ switch (designItem.element.localName) {
216
+ case 'input':
217
+ return [...this.inputProperties, ...this.formElementProperties];
218
+ case 'textarea':
219
+ return [...this.textareaProperties, ...this.formElementProperties];
220
+ case 'select':
221
+ return [...this.selectProperties, ...this.formElementProperties];
222
+ case 'button':
223
+ return [...this.buttonProperties, ...this.formElementProperties];
224
+ case 'a':
225
+ return this.anchorProperties;
226
+ case 'div':
227
+ return this.divProperties;
228
+ case 'img':
229
+ return this.imgProperties;
230
+ case 'iframe':
231
+ return this.iframeProperties;
232
+ case 'h1':
233
+ case 'h2':
234
+ case 'h3':
235
+ case 'h4':
236
+ case 'h5':
237
+ case 'h6':
238
+ case 'p':
239
+ return [];
240
+ }
241
+ return null;
242
+ }
243
+ }
@@ -1,9 +1,9 @@
1
1
  import { IProperty } from '../IProperty.js';
2
2
  import { IDesignItem } from '../../../item/IDesignItem.js';
3
- import { CommonPropertiesService } from './CommonPropertiesService.js';
4
3
  import { RefreshMode } from '../IPropertiesService.js';
5
4
  import { IPropertyGroup } from '../IPropertyGroup.js';
6
- export declare class NativeElementsPropertiesService extends CommonPropertiesService {
5
+ import { AbstractPropertiesService } from './AbstractPropertiesService.js';
6
+ export declare class NativeElementsPropertiesService extends AbstractPropertiesService {
7
7
  private inputProperties;
8
8
  private textareaProperties;
9
9
  private selectProperties;
@@ -1,7 +1,7 @@
1
- import { CommonPropertiesService } from './CommonPropertiesService.js';
2
1
  import { PropertyType } from '../PropertyType.js';
3
2
  import { RefreshMode } from '../IPropertiesService.js';
4
- export class NativeElementsPropertiesService extends CommonPropertiesService {
3
+ import { AbstractPropertiesService } from './AbstractPropertiesService.js';
4
+ export class NativeElementsPropertiesService extends AbstractPropertiesService {
5
5
  inputProperties = [
6
6
  {
7
7
  name: "type",
package/dist/index.d.ts CHANGED
@@ -110,6 +110,7 @@ export * from "./elements/services/propertiesService/propertyEditors/special/Gri
110
110
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
111
111
  export * from "./elements/services/propertiesService/services/AttachedPropertiesService.js";
112
112
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
113
+ export * from "./elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js";
113
114
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
114
115
  export * from "./elements/services/propertiesService/services/ContentAndIdPropertiesService.js";
115
116
  export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
package/dist/index.js CHANGED
@@ -69,6 +69,7 @@ export * from "./elements/services/propertiesService/propertyEditors/special/Gri
69
69
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
70
70
  export * from "./elements/services/propertiesService/services/AttachedPropertiesService.js";
71
71
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
72
+ export * from "./elements/services/propertiesService/services/BasicWebcomponentPropertiesService.js";
72
73
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
73
74
  export * from "./elements/services/propertiesService/services/ContentAndIdPropertiesService.js";
74
75
  export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.141",
4
+ "version": "0.1.143",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",