@node-projects/web-component-designer 0.0.106 → 0.0.109

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.
@@ -27,6 +27,7 @@ import { IDemoProviderService } from "./demoProviderService/IDemoProviderService
27
27
  import { IBindableObjectsService } from "./bindableObjectsService/IBindableObjectsService.js";
28
28
  import { IBindableObjectDragDropService } from "./bindableObjectsService/IBindableObjectDragDropService.js";
29
29
  import { IDesignViewToolbarButtonProvider } from "../widgets/designerView/tools/toolBar/IDesignViewToolbarButtonProvider.js";
30
+ import { IElementInteractionService } from './elementInteractionService/IElementInteractionService';
30
31
  interface ServiceNameMap {
31
32
  "propertyService": IPropertiesService;
32
33
  "containerService": IPlacementService;
@@ -45,6 +46,7 @@ interface ServiceNameMap {
45
46
  "copyPasteService": ICopyPasteService;
46
47
  "modelCommandService": IModelCommandService;
47
48
  "demoProviderService": IDemoProviderService;
49
+ "elementInteractionService": IElementInteractionService;
48
50
  }
49
51
  export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMap> {
50
52
  readonly config: {
@@ -62,6 +64,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
62
64
  get bindingService(): IBindingService;
63
65
  get bindableObjectsServices(): IBindableObjectsService[];
64
66
  get bindableObjectDragDropService(): IBindableObjectDragDropService;
67
+ get elementInteractionServices(): IElementInteractionService[];
65
68
  get propertiesServices(): IPropertiesService[];
66
69
  get containerServices(): IPlacementService[];
67
70
  get snaplinesProviderService(): ISnaplinesProviderService;
@@ -31,6 +31,9 @@ export class ServiceContainer extends BaseServiceContainer {
31
31
  get bindableObjectDragDropService() {
32
32
  return this.getLastService('bindableObjectDragDropService');
33
33
  }
34
+ get elementInteractionServices() {
35
+ return this.getServices('elementInteractionService');
36
+ }
34
37
  get propertiesServices() {
35
38
  return this.getServices('propertyService');
36
39
  }
@@ -0,0 +1,5 @@
1
+ import { IDesignerCanvas } from "../../widgets/designerView/IDesignerCanvas.js";
2
+ import { IService } from "../IService";
3
+ export interface IElementInteractionService extends IService {
4
+ stopEventHandling(designerCanvas: IDesignerCanvas, event: PointerEvent, currentElement: Element): boolean;
5
+ }
@@ -4,6 +4,7 @@ export interface IElementDefinition {
4
4
  name?: string;
5
5
  description?: string;
6
6
  import?: string;
7
+ className?: string;
7
8
  type?: string;
8
9
  defaultContent?: any;
9
10
  defaultAttributes?: {
@@ -15,7 +15,8 @@ export class WebcomponentManifestElementsService {
15
15
  for (let m of manifest.modules) {
16
16
  for (let e of m.exports) {
17
17
  if (e.kind == 'custom-element-definition') {
18
- this._elementList.push({ tag: e.name, import: this._importPrefix + '/' + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px" });
18
+ let elDef = { tag: e.name, import: this._importPrefix + '/' + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px", className: e.declaration.name };
19
+ this._elementList.push(elDef);
19
20
  }
20
21
  }
21
22
  if (this._resolveStored) {
@@ -10,12 +10,18 @@ export class DefaultInstanceService {
10
10
  //@ts-ignore
11
11
  if (importShim) {
12
12
  //@ts-ignore
13
- importShim(importUri).then(() => {
13
+ importShim(importUri).then((x) => {
14
+ let ctor = customElements.get(definition.tag);
15
+ if (!ctor && definition.className && x[definition.className])
16
+ customElements.define(definition.tag, x[definition.className]);
14
17
  //TODO: refresh all extensions
15
18
  });
16
19
  }
17
20
  else {
18
- import(importUri).then(() => {
21
+ import(importUri).then((x) => {
22
+ let ctor = customElements.get(definition.tag);
23
+ if (!ctor && definition.className && x[definition.className])
24
+ customElements.define(definition.tag, x[definition.className]);
19
25
  //TODO: refresh all extensions
20
26
  });
21
27
  }
@@ -12,15 +12,20 @@ export class WebcomponentManifestPropertiesService extends UnkownElementProperti
12
12
  }
13
13
  _parseManifest(manifest) {
14
14
  this._propertiesList = {};
15
+ let declarations = [];
16
+ for (let m of manifest.modules) {
17
+ if (m.declarations)
18
+ declarations.push(...m.declarations);
19
+ }
15
20
  for (let m of manifest.modules) {
16
21
  for (let e of m.exports) {
17
22
  if (e.kind == 'custom-element-definition') {
18
23
  let properties = [];
19
- let declaration = m.declarations.find(x => x.name == e.declaration.name);
24
+ let declaration = declarations.find(x => x.name == e.declaration.name);
20
25
  if (declaration) {
21
26
  if (declaration.members) {
22
27
  for (let d of declaration.members) {
23
- if (d.kind == 'field') {
28
+ if (d.kind == 'field' && d.privacy !== 'private' && d.privacy !== 'protected') {
24
29
  let pType = PropertyType.property;
25
30
  if (declaration.attributes)
26
31
  pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
@@ -38,6 +38,7 @@ export class BindableObjectsBrowser extends BaseCustomWebComponentLazyAppend {
38
38
  this._treeDiv.setAttribute('id', 'tree');
39
39
  this.shadowRoot.appendChild(this._treeDiv);
40
40
  $(this._treeDiv).fancytree({
41
+ debugLevel: 0,
41
42
  icon: false,
42
43
  extensions: ['dnd5'],
43
44
  quicksearch: true,
@@ -39,6 +39,12 @@ export class PointerTool {
39
39
  }
40
40
  }
41
41
  pointerEventHandler(designerCanvas, event, currentElement) {
42
+ const interactionServices = designerCanvas.serviceContainer.elementInteractionServices;
43
+ if (interactionServices)
44
+ for (let s of interactionServices) {
45
+ if (s.stopEventHandling(designerCanvas, event, currentElement))
46
+ return;
47
+ }
42
48
  if (event.button == 2) {
43
49
  this._showContextMenu(event, designerCanvas);
44
50
  return;
@@ -67,6 +67,7 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
67
67
  };
68
68
  this._treeDiv = this._getDomElement('treetable');
69
69
  $(this._treeDiv).fancytree({
70
+ debugLevel: 0,
70
71
  icon: true,
71
72
  extensions: ['childcounter', 'dnd5', 'filter'],
72
73
  quicksearch: true,
@@ -158,6 +158,7 @@ export class TreeViewExtended extends BaseCustomWebComponentConstructorAppend {
158
158
  async ready() {
159
159
  //this._treeDiv.classList.add('fancytree-connectors');
160
160
  $(this._treeDiv).fancytree({
161
+ debugLevel: 0,
161
162
  icon: true,
162
163
  extensions: ['childcounter', 'dnd5', 'multi', 'filter', 'table'],
163
164
  quicksearch: true,
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./elements/services/demoProviderService/DemoProviderService.js";
38
38
  export type { IDemoProviderService } from "./elements/services/demoProviderService/IDemoProviderService.js";
39
39
  export * from "./elements/services/dragDropService/DragDropService.js";
40
40
  export type { IDragDropService } from "./elements/services/dragDropService/IDragDropService.js";
41
+ export type { IElementInteractionService } from "./elements/services/elementInteractionService/IElementInteractionService.js";
41
42
  export type { IElementDefinition } from "./elements/services/elementsService/IElementDefinition.js";
42
43
  export type { IElementsJson } from "./elements/services/elementsService/IElementsJson.js";
43
44
  export type { IElementsService } from "./elements/services/elementsService/IElementsService.js";
package/package.json CHANGED
@@ -1,42 +1,42 @@
1
- {
2
- "description": "A UI designer for Polymer apps",
3
- "name": "@node-projects/web-component-designer",
4
- "version": "0.0.106",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "author": "",
8
- "license": "MIT",
9
- "scripts": {
10
- "tsc": "tsc",
11
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12
- "build": "tsc",
13
- "prepublishOnly": "npm run build"
14
- },
15
- "dependencies": {
16
- "@node-projects/base-custom-webcomponent": "^0.9.1",
17
- "construct-style-sheets-polyfill": "^3.1.0"
18
- },
19
- "devDependencies": {
20
- "@node-projects/lean-he-esm": "^3.3.0",
21
- "@node-projects/node-html-parser-esm": "^2.4.1",
22
- "@papyrs/stylo": "^0.0.30",
23
- "@types/codemirror": "^5.60.5",
24
- "@types/jquery": "^3.5.14",
25
- "@types/jquery.fancytree": "0.0.7",
26
- "ace-builds": "^1.7.1",
27
- "codemirror": "^6.0.1",
28
- "esprima-next": "^5.8.3",
29
- "html2canvas": "*",
30
- "jest": "^28.1.2",
31
- "jquery": "^3.6.0",
32
- "jquery.fancytree": "^2.38.2",
33
- "monaco-editor": "^0.33.0",
34
- "ts-jest": "^28.0.5",
35
- "typescript": "^4.7.4",
36
- "typescript-lit-html-plugin": "^0.9.0"
37
- },
38
- "repository": {
39
- "type": "git",
40
- "url": "git+https://github.com/node-projects/web-component-designer.git"
41
- }
42
- }
1
+ {
2
+ "description": "A UI designer for Polymer apps",
3
+ "name": "@node-projects/web-component-designer",
4
+ "version": "0.0.109",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "author": "",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "tsc": "tsc",
11
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12
+ "build": "tsc",
13
+ "prepublishOnly": "npm run build"
14
+ },
15
+ "dependencies": {
16
+ "@node-projects/base-custom-webcomponent": "^0.9.1",
17
+ "construct-style-sheets-polyfill": "^3.1.0"
18
+ },
19
+ "devDependencies": {
20
+ "@node-projects/lean-he-esm": "^3.3.0",
21
+ "@node-projects/node-html-parser-esm": "^2.4.1",
22
+ "@papyrs/stylo": "^0.0.34",
23
+ "@types/codemirror": "^5.60.5",
24
+ "@types/jquery": "^3.5.14",
25
+ "@types/jquery.fancytree": "0.0.7",
26
+ "ace-builds": "^1.7.1",
27
+ "codemirror": "^6.0.1",
28
+ "esprima-next": "^5.8.3",
29
+ "html2canvas": "*",
30
+ "jest": "^28.1.3",
31
+ "jquery": "^3.6.0",
32
+ "jquery.fancytree": "^2.38.2",
33
+ "monaco-editor": "^0.33.0",
34
+ "ts-jest": "^28.0.7",
35
+ "typescript": "^4.7.4",
36
+ "typescript-lit-html-plugin": "^0.9.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/node-projects/web-component-designer.git"
41
+ }
42
+ }