@node-projects/web-component-designer 0.0.255 → 0.0.257

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.
Files changed (34) hide show
  1. package/dist/elements/item/IDesignItem.d.ts +4 -4
  2. package/dist/elements/services/DefaultServiceBootstrap.js +2 -1
  3. package/dist/elements/services/ServiceContainer.d.ts +3 -0
  4. package/dist/elements/services/ServiceContainer.js +3 -0
  5. package/dist/elements/services/eventsService/EventsService.d.ts +17 -0
  6. package/dist/elements/services/eventsService/EventsService.js +91 -0
  7. package/dist/elements/services/eventsService/IEvent.d.ts +4 -0
  8. package/dist/elements/services/eventsService/IEvent.js +1 -0
  9. package/dist/elements/services/eventsService/IEventsService copy.d.ts +2 -0
  10. package/dist/elements/services/eventsService/IEventsService copy.js +1 -0
  11. package/dist/elements/services/eventsService/IEventsService.d.ts +6 -0
  12. package/dist/elements/services/eventsService/IEventsService.js +1 -0
  13. package/dist/elements/services/htmlWriterService/AbstractHtmlWriterService.d.ts +5 -3
  14. package/dist/elements/services/htmlWriterService/AbstractHtmlWriterService.js +14 -5
  15. package/dist/elements/services/htmlWriterService/FormatingHtmlWriterService.d.ts +3 -1
  16. package/dist/elements/services/htmlWriterService/FormatingHtmlWriterService.js +11 -2
  17. package/dist/elements/services/htmlWriterService/HtmlWriterOptions.d.ts +7 -0
  18. package/dist/elements/services/htmlWriterService/HtmlWriterOptions.js +7 -0
  19. package/dist/elements/services/htmlWriterService/HtmlWriterService.d.ts +1 -2
  20. package/dist/elements/services/htmlWriterService/HtmlWriterService.js +6 -6
  21. package/dist/elements/services/htmlWriterService/IHtmlWriterOptions.d.ts +6 -6
  22. package/dist/elements/services/htmlWriterService/IHtmlWriterOptions.js +1 -7
  23. package/dist/elements/services/htmlWriterService/IHtmlWriterService.d.ts +1 -2
  24. package/dist/elements/services/htmlWriterService/LitTsElementWriterService.d.ts +1 -2
  25. package/dist/elements/services/htmlWriterService/LitTsElementWriterService.js +1 -1
  26. package/dist/elements/services/htmlWriterService/SimpleHtmlWriterService.d.ts +4 -2
  27. package/dist/elements/services/htmlWriterService/SimpleHtmlWriterService.js +11 -2
  28. package/dist/elements/services/propertiesService/services/AbstractPropertiesService.d.ts +1 -1
  29. package/dist/elements/services/propertiesService/services/AttributesPropertiesService.d.ts +1 -1
  30. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.d.ts +1 -1
  31. package/dist/elements/widgets/designerView/DomConverter.js +3 -2
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.js +1 -0
  34. package/package.json +1 -1
@@ -52,8 +52,8 @@ export interface IDesignItem {
52
52
  getOrCreateDesignItem(node: Node): any;
53
53
  openGroup(title: string): ChangeGroup;
54
54
  styles(): Iterable<[name: string, value: string]>;
55
- getStyle(name: string): any;
56
- hasStyle(name: string): any;
55
+ getStyle(name: string): string;
56
+ hasStyle(name: string): boolean;
57
57
  setStyle(name: string, value?: string | null, important?: boolean): any;
58
58
  removeStyle(name: string): any;
59
59
  updateStyleInSheetOrLocal(name: string, value?: string | null, important?: boolean): any;
@@ -61,8 +61,8 @@ export interface IDesignItem {
61
61
  getStyleFromSheetOrLocalOrComputed(name: string, fallback?: string): any;
62
62
  getAllStyles(): IStyleRule[];
63
63
  attributes(): Iterable<[name: string, value: string]>;
64
- getAttribute(name: string): any;
65
- hasAttribute(name: string): any;
64
+ getAttribute(name: string): string;
65
+ hasAttribute(name: string): boolean;
66
66
  setAttribute(name: string, value?: string | null): any;
67
67
  removeAttribute(name: string): any;
68
68
  hideAtDesignTime: boolean;
@@ -83,6 +83,7 @@ import { DesignItemDocumentPositionService } from './designItemDocumentPositionS
83
83
  import { TransformToolButtonProvider } from '../widgets/designerView/tools/toolBar/buttons/TransformToolButtonProvider.js';
84
84
  import { MultipleSelectionRectExtensionProvider } from '../widgets/designerView/extensions/MultipleSelectionRectExtensionProvider.js';
85
85
  import { DragDropService } from './dragDropService/DragDropService.js';
86
+ import { EventsService } from './eventsService/EventsService.js';
86
87
  export function createDefaultServiceContainer() {
87
88
  let serviceContainer = new ServiceContainer();
88
89
  let defaultPlacementService = new DefaultPlacementService();
@@ -107,11 +108,11 @@ export function createDefaultServiceContainer() {
107
108
  serviceContainer.register("copyPasteService", new CopyPasteService());
108
109
  serviceContainer.register("modelCommandService", new DefaultModelCommandService());
109
110
  serviceContainer.register("demoProviderService", new DemoProviderService());
111
+ serviceContainer.register("eventsService", new EventsService());
110
112
  serviceContainer.register("undoService", (designerCanvas) => new UndoService(designerCanvas));
111
113
  serviceContainer.register("selectionService", (designerCanvas) => new SelectionService(designerCanvas, false));
112
114
  serviceContainer.register("contentService", (designerCanvas) => new ContentService(designerCanvas.rootDesignItem));
113
115
  serviceContainer.register("designItemDocumentPositionService", (designerCanvas) => new DesignItemDocumentPositionService(designerCanvas));
114
- //serviceContainer.register("stylesheetService", new DemoProviderService());
115
116
  serviceContainer.designerExtensions.set(ExtensionType.Permanent, [
116
117
  // new ResizeExtensionProvider(false),
117
118
  new InvisibleElementExtensionProvider(),
@@ -41,6 +41,7 @@ import { IDesignerCanvas } from '../widgets/designerView/IDesignerCanvas.js';
41
41
  import { IDesignItemDocumentPositionService } from './designItemDocumentPositionService/IDesignItemDocumentPositionService.js';
42
42
  import { IDragDropService } from './dragDropService/IDragDropService.js';
43
43
  import { IDesignItemService } from './designItemService/IDesignItemService.js';
44
+ import { IEventsService } from './eventsService/IEventsService.js';
44
45
  interface ServiceNameMap {
45
46
  "propertyService": IPropertiesService;
46
47
  "containerService": IPlacementService;
@@ -63,6 +64,7 @@ interface ServiceNameMap {
63
64
  "propertyGroupsService": IPropertyTabsService;
64
65
  "dragDropService": IDragDropService;
65
66
  "designItemService": IDesignItemService;
67
+ "eventsService": IEventsService;
66
68
  "undoService": (designerCanvas: IDesignerCanvas) => IUndoService;
67
69
  "selectionService": (designerCanvas: IDesignerCanvas) => ISelectionService;
68
70
  "contentService": (designerCanvas: IDesignerCanvas) => IContentService;
@@ -96,6 +98,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
96
98
  get containerServices(): IPlacementService[];
97
99
  get snaplinesProviderService(): ISnaplinesProviderService;
98
100
  get elementsServices(): IElementsService[];
101
+ get eventsService(): IEventsService[];
99
102
  get instanceServices(): IInstanceService[];
100
103
  get editorTypesServices(): IEditorTypesService[];
101
104
  get htmlWriterService(): IHtmlWriterService;
@@ -55,6 +55,9 @@ export class ServiceContainer extends BaseServiceContainer {
55
55
  get elementsServices() {
56
56
  return this.getServices('elementsService');
57
57
  }
58
+ get eventsService() {
59
+ return this.getServices('eventsService');
60
+ }
58
61
  get instanceServices() {
59
62
  return this.getServices('instanceService');
60
63
  }
@@ -0,0 +1,17 @@
1
+ import { IDesignItem } from "../../item/IDesignItem.js";
2
+ import { IEvent } from "./IEvent.js";
3
+ import { IEventsService } from "./IEventsService.js";
4
+ export declare class EventsService implements IEventsService {
5
+ protected _windowEvents: string[];
6
+ protected _allElements: string[];
7
+ protected _focusableEvents: string[];
8
+ protected _form: string[];
9
+ protected _mouseEvents: string[];
10
+ protected _pointerEvents: string[];
11
+ protected _touchEvents: string[];
12
+ protected _dragEvents: string[];
13
+ protected _clipboard: string[];
14
+ protected _details: string[];
15
+ isHandledElement(designItem: IDesignItem): boolean;
16
+ getPossibleEvents(designItem: IDesignItem): IEvent[];
17
+ }
@@ -0,0 +1,91 @@
1
+ export class EventsService {
2
+ _windowEvents = [
3
+ "afterprint",
4
+ "beforeprint",
5
+ "beforeunload",
6
+ "error",
7
+ "hashchange",
8
+ "load",
9
+ "message",
10
+ "offline",
11
+ "online",
12
+ "pageshow",
13
+ "popstate",
14
+ "resize",
15
+ "storage",
16
+ "unload"
17
+ ];
18
+ _allElements = [
19
+ "contextmenu",
20
+ ];
21
+ _focusableEvents = [
22
+ "blur",
23
+ "focus",
24
+ "keydown",
25
+ "keypress",
26
+ "keyup"
27
+ ];
28
+ _form = [
29
+ "change",
30
+ "input",
31
+ "invalid",
32
+ "reset",
33
+ "search",
34
+ "select",
35
+ "submit"
36
+ ];
37
+ _mouseEvents = [
38
+ "click",
39
+ "dblclick",
40
+ "mousedown",
41
+ "mouseup",
42
+ "mousemove",
43
+ "mouseover",
44
+ "mouseout",
45
+ "mousewheel",
46
+ "wheel"
47
+ ];
48
+ _pointerEvents = [
49
+ "pointerdown",
50
+ "pointerup",
51
+ "pointerenter",
52
+ "pointerleave",
53
+ "pointermove",
54
+ "pointerover",
55
+ "pointerout",
56
+ "pointercancel"
57
+ ];
58
+ _touchEvents = [
59
+ "touchstart",
60
+ "touchend",
61
+ "touchmove",
62
+ "touchcancel"
63
+ ];
64
+ _dragEvents = [
65
+ "drag",
66
+ "dragend",
67
+ "dragenter",
68
+ "dragleave",
69
+ "dragover",
70
+ "dragstart",
71
+ "drop",
72
+ "scroll"
73
+ ];
74
+ _clipboard = [
75
+ "copy",
76
+ "cut",
77
+ "paste"
78
+ ];
79
+ _details = [
80
+ "toggle"
81
+ ];
82
+ isHandledElement(designItem) {
83
+ return true;
84
+ }
85
+ getPossibleEvents(designItem) {
86
+ //Todo: create corret events list for all std. elements
87
+ let lst = [...this._mouseEvents, ...this._allElements, ...this._focusableEvents];
88
+ let events = lst.map(x => ({ name: x, propertyName: 'on' + x }));
89
+ return events;
90
+ }
91
+ }
@@ -0,0 +1,4 @@
1
+ export interface IEvent {
2
+ name: string;
3
+ propertyName: string;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export interface IEventsService {
2
+ }
@@ -0,0 +1,6 @@
1
+ import { IDesignItem } from "../../item/IDesignItem.js";
2
+ import { IEvent } from "./IEvent.js";
3
+ export interface IEventsService {
4
+ isHandledElement(designItem: IDesignItem): boolean;
5
+ getPossibleEvents(designItem: IDesignItem): IEvent[];
6
+ }
@@ -3,7 +3,9 @@ import { IHtmlWriterService } from './IHtmlWriterService.js';
3
3
  import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
4
4
  import { ITextWriter } from '../../helper/ITextWriter.js';
5
5
  export declare abstract class AbstractHtmlWriterService implements IHtmlWriterService {
6
- abstract write(indentedTextWriter: ITextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, updatePositions?: boolean): any;
7
- writeAttributes(indentedTextWriter: ITextWriter, designItem: IDesignItem, options: IHtmlWriterOptions): void;
8
- writeStyles(indentedTextWriter: ITextWriter, designItem: IDesignItem, options: IHtmlWriterOptions): void;
6
+ options: IHtmlWriterOptions;
7
+ constructor(options?: IHtmlWriterOptions);
8
+ abstract write(indentedTextWriter: ITextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, updatePositions?: boolean): any;
9
+ writeAttributes(indentedTextWriter: ITextWriter, designItem: IDesignItem): void;
10
+ writeStyles(indentedTextWriter: ITextWriter, designItem: IDesignItem): void;
9
11
  }
@@ -2,7 +2,16 @@ import { DomConverter } from '../../widgets/designerView/DomConverter.js';
2
2
  import { CssCombiner } from '../../helper/CssCombiner.js';
3
3
  import { PropertiesHelper } from '../propertiesService/services/PropertiesHelper.js';
4
4
  export class AbstractHtmlWriterService {
5
- writeAttributes(indentedTextWriter, designItem, options) {
5
+ options;
6
+ constructor(options) {
7
+ this.options = options ?? {};
8
+ this.options.beautifyOutput ??= true;
9
+ this.options.compressCssToShorthandProperties ??= true;
10
+ this.options.writeDesignerProperties ??= true;
11
+ this.options.parseJsonInAttributes ??= true;
12
+ this.options.jsonWriteMode ??= 'min';
13
+ }
14
+ writeAttributes(indentedTextWriter, designItem) {
6
15
  if (designItem.hasAttributes) {
7
16
  for (const a of designItem.attributes()) {
8
17
  indentedTextWriter.write(' ');
@@ -10,13 +19,13 @@ export class AbstractHtmlWriterService {
10
19
  if (a[1] === "")
11
20
  indentedTextWriter.write(a[0]);
12
21
  else {
13
- if (options.parseJsonInAttributes &&
22
+ if (this.options.parseJsonInAttributes &&
14
23
  ((a[1].startsWith('{') && !a[1].startsWith('{{') && a[1].endsWith('}')) ||
15
24
  (a[1].startsWith('[') && !a[1].startsWith('[[') && a[1].endsWith(']')))) {
16
25
  try {
17
26
  let j = JSON.parse(a[1]);
18
27
  let txt;
19
- if (options.jsonWriteMode == 'beauty')
28
+ if (this.options.jsonWriteMode == 'beauty')
20
29
  txt = JSON.stringify(j, null, 2);
21
30
  else
22
31
  txt = JSON.stringify(j);
@@ -45,11 +54,11 @@ export class AbstractHtmlWriterService {
45
54
  }
46
55
  }
47
56
  }
48
- writeStyles(indentedTextWriter, designItem, options) {
57
+ writeStyles(indentedTextWriter, designItem) {
49
58
  if (designItem.hasStyles) {
50
59
  indentedTextWriter.write(' style="');
51
60
  let styles = designItem.styles();
52
- if (options.compressCssToShorthandProperties)
61
+ if (this.options.compressCssToShorthandProperties)
53
62
  styles = CssCombiner.combine(new Map(styles));
54
63
  for (const s of styles) {
55
64
  if (s[0]) {
@@ -7,6 +7,8 @@ declare enum ElementContainerType {
7
7
  complex = 1
8
8
  }
9
9
  export declare class FormatingHtmlWriterService implements IHtmlWriterService {
10
+ options: IHtmlWriterOptions;
11
+ constructor(options?: IHtmlWriterOptions);
10
12
  private writeAttributes;
11
13
  private writeStyles;
12
14
  private _writeTextNode;
@@ -16,6 +18,6 @@ export declare class FormatingHtmlWriterService implements IHtmlWriterService {
16
18
  private _writeNewlineAndIntend;
17
19
  private _writeInternal;
18
20
  getContainerType(element: HTMLElement): ElementContainerType;
19
- write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions): void;
21
+ write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean): void;
20
22
  }
21
23
  export {};
@@ -10,6 +10,15 @@ var ElementContainerType;
10
10
  })(ElementContainerType || (ElementContainerType = {}));
11
11
  // const defaultDisplayNoneContainerDisplayType: ElementContainerType = ElementContainerType.complex;
12
12
  export class FormatingHtmlWriterService {
13
+ options;
14
+ constructor(options) {
15
+ this.options = options ?? {};
16
+ this.options.beautifyOutput ??= true;
17
+ this.options.compressCssToShorthandProperties ??= true;
18
+ this.options.writeDesignerProperties ??= true;
19
+ this.options.parseJsonInAttributes ??= true;
20
+ this.options.jsonWriteMode ??= 'min';
21
+ }
13
22
  writeAttributes(writeContext, designItem) {
14
23
  if (designItem.hasAttributes) {
15
24
  for (const a of designItem.attributes()) {
@@ -126,8 +135,8 @@ export class FormatingHtmlWriterService {
126
135
  return ElementContainerType.block;
127
136
  return ElementContainerType.complex;
128
137
  }
129
- write(indentedTextWriter, designItems, rootContainerKeepInline, options) {
130
- const context = { indentedTextWriter, options, lastElementDisplayType: null, containerDisplayType: ElementContainerType.block };
138
+ write(indentedTextWriter, designItems, rootContainerKeepInline) {
139
+ const context = { indentedTextWriter, options: this.options, lastElementDisplayType: null, containerDisplayType: ElementContainerType.block };
131
140
  this._writeDesignItemList(ElementDisplayType.inline, context, designItems);
132
141
  }
133
142
  }
@@ -0,0 +1,7 @@
1
+ export declare class HtmlWriterOptions {
2
+ beautifyOutput: boolean;
3
+ compressCssToShorthandProperties: boolean;
4
+ writeDesignerProperties: boolean;
5
+ parseJsonInAttributes: boolean;
6
+ jsonWriteMode: 'min' | 'beauty';
7
+ }
@@ -0,0 +1,7 @@
1
+ export class HtmlWriterOptions {
2
+ beautifyOutput = true;
3
+ compressCssToShorthandProperties = true;
4
+ writeDesignerProperties = true;
5
+ parseJsonInAttributes = true;
6
+ jsonWriteMode = 'min';
7
+ }
@@ -1,12 +1,11 @@
1
1
  import { IDesignItem } from '../../item/IDesignItem.js';
2
- import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
3
2
  import { IndentedTextWriter } from '../../helper/IndentedTextWriter.js';
4
3
  import { AbstractHtmlWriterService } from './AbstractHtmlWriterService.js';
5
4
  export declare class HtmlWriterService extends AbstractHtmlWriterService {
6
5
  private _conditionalyWriteIndent;
7
6
  private _conditionalyWriteIndentBefore;
8
7
  private _conditionalyWriteNewline;
9
- write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, updatePositions?: boolean): void;
8
+ write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, updatePositions?: boolean): void;
10
9
  private internalWrite;
11
10
  private writeTextNode;
12
11
  }
@@ -22,12 +22,12 @@ export class HtmlWriterService extends AbstractHtmlWriterService {
22
22
  (designItem.element instanceof SVGElement))
23
23
  indentedTextWriter.writeNewline();
24
24
  }
25
- write(indentedTextWriter, designItems, rootContainerKeepInline, options, updatePositions = false) {
25
+ write(indentedTextWriter, designItems, rootContainerKeepInline, updatePositions = false) {
26
26
  for (const d of designItems) {
27
- this.internalWrite(indentedTextWriter, d, options, updatePositions);
27
+ this.internalWrite(indentedTextWriter, d, updatePositions);
28
28
  }
29
29
  }
30
- internalWrite(indentedTextWriter, designItem, options, updatePositions) {
30
+ internalWrite(indentedTextWriter, designItem, updatePositions) {
31
31
  let start = indentedTextWriter.position;
32
32
  let end = indentedTextWriter.position;
33
33
  if (designItem.nodeType == NodeType.TextNode) {
@@ -50,8 +50,8 @@ export class HtmlWriterService extends AbstractHtmlWriterService {
50
50
  this._conditionalyWriteIndentBefore(indentedTextWriter, designItem);
51
51
  start = indentedTextWriter.position;
52
52
  indentedTextWriter.write('<' + designItem.name);
53
- this.writeAttributes(indentedTextWriter, designItem, options);
54
- this.writeStyles(indentedTextWriter, designItem, options);
53
+ this.writeAttributes(indentedTextWriter, designItem);
54
+ this.writeStyles(indentedTextWriter, designItem);
55
55
  indentedTextWriter.write('>');
56
56
  let contentSingleTextNode = false;
57
57
  if (designItem.hasChildren) {
@@ -66,7 +66,7 @@ export class HtmlWriterService extends AbstractHtmlWriterService {
66
66
  indentedTextWriter.levelRaise();
67
67
  }
68
68
  for (const c of children) {
69
- this.internalWrite(indentedTextWriter, c, options, updatePositions);
69
+ this.internalWrite(indentedTextWriter, c, updatePositions);
70
70
  let childSingleTextNode = c.childCount === 1 && c.firstChild.nodeType === NodeType.TextNode;
71
71
  if (childSingleTextNode)
72
72
  if (!indentedTextWriter.isLastCharNewline())
@@ -1,7 +1,7 @@
1
- export declare class IHtmlWriterOptions {
2
- beautifyOutput: boolean;
3
- compressCssToShorthandProperties: boolean;
4
- writeDesignerProperties: boolean;
5
- parseJsonInAttributes: boolean;
6
- jsonWriteMode: 'min' | 'beauty';
1
+ export interface IHtmlWriterOptions {
2
+ beautifyOutput?: boolean;
3
+ compressCssToShorthandProperties?: boolean;
4
+ writeDesignerProperties?: boolean;
5
+ parseJsonInAttributes?: boolean;
6
+ jsonWriteMode?: 'min' | 'beauty';
7
7
  }
@@ -1,7 +1 @@
1
- export class IHtmlWriterOptions {
2
- beautifyOutput = true;
3
- compressCssToShorthandProperties = true;
4
- writeDesignerProperties = true;
5
- parseJsonInAttributes = true;
6
- jsonWriteMode = 'min';
7
- }
1
+ export {};
@@ -1,6 +1,5 @@
1
1
  import { IDesignItem } from '../../item/IDesignItem.js';
2
- import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
3
2
  import { ITextWriter } from '../../helper/ITextWriter.js';
4
3
  export interface IHtmlWriterService {
5
- write(textWriter: ITextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions, updatePositions?: boolean): any;
4
+ write(textWriter: ITextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, updatePositions?: boolean): any;
6
5
  }
@@ -1,8 +1,7 @@
1
1
  import { IDesignItem } from '../../item/IDesignItem.js';
2
2
  import { IHtmlWriterService } from './IHtmlWriterService.js';
3
- import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
4
3
  import { IndentedTextWriter } from '../../helper/IndentedTextWriter.js';
5
4
  export declare class LitTsElementWriterService implements IHtmlWriterService {
6
- write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions): void;
5
+ write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean): void;
7
6
  static head: string;
8
7
  }
@@ -1,6 +1,6 @@
1
1
  //needs InternalBindinsgStorrageService -> keeps bindings
2
2
  export class LitTsElementWriterService {
3
- write(indentedTextWriter, designItems, rootContainerKeepInline, options) {
3
+ write(indentedTextWriter, designItems, rootContainerKeepInline) {
4
4
  throw new Error('Method not implemented.');
5
5
  }
6
6
  static head = `import { html, css, LitElement, CSSResultArray } from 'lit';
@@ -1,8 +1,8 @@
1
1
  import { IDesignItem } from '../../item/IDesignItem.js';
2
2
  import { IHtmlWriterService } from './IHtmlWriterService.js';
3
- import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
4
3
  import { IndentedTextWriter } from '../../helper/IndentedTextWriter.js';
5
4
  import { ElementDisplayType } from '../../helper/ElementHelper.js';
5
+ import { IHtmlWriterOptions } from './IHtmlWriterOptions.js';
6
6
  export declare enum ElementContainerType {
7
7
  block = 0,
8
8
  complex = 1
@@ -14,6 +14,8 @@ export interface IWriteContext {
14
14
  containerDisplayType: ElementContainerType;
15
15
  }
16
16
  export declare class SimpleHtmlWriterService implements IHtmlWriterService {
17
+ options: IHtmlWriterOptions;
18
+ constructor(options?: IHtmlWriterOptions);
17
19
  protected writeAttributes(writeContext: IWriteContext, designItem: IDesignItem): void;
18
20
  protected writeStyles(writeContext: IWriteContext, designItem: IDesignItem): void;
19
21
  private _writeTextNode;
@@ -21,5 +23,5 @@ export declare class SimpleHtmlWriterService implements IHtmlWriterService {
21
23
  private _writeElementNode;
22
24
  private _writeDesignItemList;
23
25
  private _writeInternal;
24
- write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean, options: IHtmlWriterOptions): void;
26
+ write(indentedTextWriter: IndentedTextWriter, designItems: IDesignItem[], rootContainerKeepInline: boolean): void;
25
27
  }
@@ -9,6 +9,15 @@ export var ElementContainerType;
9
9
  ElementContainerType[ElementContainerType["complex"] = 1] = "complex";
10
10
  })(ElementContainerType || (ElementContainerType = {}));
11
11
  export class SimpleHtmlWriterService {
12
+ options;
13
+ constructor(options) {
14
+ this.options = options ?? {};
15
+ this.options.beautifyOutput ??= true;
16
+ this.options.compressCssToShorthandProperties ??= true;
17
+ this.options.writeDesignerProperties ??= true;
18
+ this.options.parseJsonInAttributes ??= true;
19
+ this.options.jsonWriteMode ??= 'min';
20
+ }
12
21
  writeAttributes(writeContext, designItem) {
13
22
  if (designItem.hasAttributes) {
14
23
  for (const a of designItem.attributes()) {
@@ -82,8 +91,8 @@ export class SimpleHtmlWriterService {
82
91
  else if (designItem.nodeType === NodeType.Element)
83
92
  this._writeElementNode(writeContext, designItem);
84
93
  }
85
- write(indentedTextWriter, designItems, rootContainerKeepInline, options) {
86
- const context = { indentedTextWriter, options, lastElementDisplayType: null, containerDisplayType: ElementContainerType.block };
94
+ write(indentedTextWriter, designItems, rootContainerKeepInline) {
95
+ const context = { indentedTextWriter, options: this.options, lastElementDisplayType: null, containerDisplayType: ElementContainerType.block };
87
96
  this._writeDesignItemList(ElementDisplayType.inline, context, designItems);
88
97
  }
89
98
  }
@@ -15,7 +15,7 @@ export declare abstract class AbstractPropertiesService implements IPropertiesSe
15
15
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
16
16
  clearValue(designItems: IDesignItem[], property: IProperty): void;
17
17
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
18
- getValue(designItems: IDesignItem[], property: IProperty): any;
18
+ getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
19
19
  getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
20
20
  getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
21
21
  }
@@ -14,7 +14,7 @@ export declare class AttributesPropertiesService implements IPropertiesService {
14
14
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
15
15
  clearValue(designItems: IDesignItem[], property: IProperty): void;
16
16
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
17
- getValue(designItems: IDesignItem[], property: IProperty): any;
17
+ getValue(designItems: IDesignItem[], property: IProperty): string;
18
18
  getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
19
19
  getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
20
20
  }
@@ -22,7 +22,7 @@ export declare class CssCurrentPropertiesService extends CommonPropertiesService
22
22
  getValue(designItems: IDesignItem[], property: IProperty & {
23
23
  styleRule: IStyleRule;
24
24
  styleDeclaration: IStyleDeclaration;
25
- }): any;
25
+ }): string | boolean;
26
26
  getUnsetValue(designItems: IDesignItem[], property: IProperty & {
27
27
  styleRule: IStyleRule;
28
28
  styleDeclaration: IStyleDeclaration;
@@ -35,8 +35,9 @@ export class DomConverter {
35
35
  }
36
36
  static ConvertToString(designItems, beautifyOutput, updatePositions = false) {
37
37
  let itw = beautifyOutput !== false ? new IndentedTextWriter() : new SimpleTextWriter();
38
- let options = { beautifyOutput: beautifyOutput !== false, writeDesignerProperties: true, compressCssToShorthandProperties: true, parseJsonInAttributes: true, jsonWriteMode: 'beauty' };
39
- designItems[0].serviceContainer.htmlWriterService.write(itw, designItems, true, options, updatePositions);
38
+ //todo: check how we could support this beautify here, cause it's now a setting of the writer...
39
+ //let options: HtmlWriterOptions = { beautifyOutput: beautifyOutput !== false, writeDesignerProperties: true, compressCssToShorthandProperties: true, parseJsonInAttributes: true, jsonWriteMode: 'beauty' };
40
+ designItems[0].serviceContainer.htmlWriterService.write(itw, designItems, true, updatePositions);
40
41
  return itw.getString();
41
42
  }
42
43
  }
package/dist/index.d.ts CHANGED
@@ -58,6 +58,9 @@ export type { IElementsService } from "./elements/services/elementsService/IElem
58
58
  export * from "./elements/services/elementsService/JsonFileElementsService.js";
59
59
  export * from "./elements/services/elementsService/PreDefinedElementsService.js";
60
60
  export * from "./elements/services/elementsService/WebcomponentManifestElementsService.js";
61
+ export type { IEvent } from "./elements/services/eventsService/IEvent.js";
62
+ export type { IEventsService } from "./elements/services/eventsService/IEventsService.js";
63
+ export * from "./elements/services/eventsService/EventsService.js";
61
64
  export type { IHtmlWriterService } from "./elements/services/htmlWriterService/IHtmlWriterService.js";
62
65
  export type { IHtmlWriterOptions } from "./elements/services/htmlWriterService/IHtmlWriterOptions.js";
63
66
  export * from "./elements/services/htmlWriterService/AbstractHtmlWriterService.js";
package/dist/index.js CHANGED
@@ -35,6 +35,7 @@ export * from "./elements/services/dragDropService/DragDropService.js";
35
35
  export * from "./elements/services/elementsService/JsonFileElementsService.js";
36
36
  export * from "./elements/services/elementsService/PreDefinedElementsService.js";
37
37
  export * from "./elements/services/elementsService/WebcomponentManifestElementsService.js";
38
+ export * from "./elements/services/eventsService/EventsService.js";
38
39
  export * from "./elements/services/htmlWriterService/AbstractHtmlWriterService.js";
39
40
  export * from "./elements/services/htmlWriterService/FormatingHtmlWriterService.js";
40
41
  export * from "./elements/services/htmlWriterService/HtmlWriterService.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.255",
4
+ "version": "0.0.257",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",