@firestitch/block-editor 9.0.11 → 12.1.0

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 (55) hide show
  1. package/app/components/artboard/artboard.component.d.ts +35 -0
  2. package/app/components/block/block.component.d.ts +20 -38
  3. package/app/components/block-editor/block-editor.component.d.ts +10 -17
  4. package/app/components/sidebar/sidebar.component.d.ts +29 -12
  5. package/app/consts/block-types.const.d.ts +12 -0
  6. package/app/consts/index.d.ts +1 -0
  7. package/app/directives/block-editor-margin.directive.d.ts +3 -0
  8. package/app/directives/block-editor-sidebar-panel.directive.d.ts +3 -0
  9. package/app/enums/block-type.enum.d.ts +11 -0
  10. package/app/enums/index.d.ts +1 -0
  11. package/app/fs-block-editor.module.d.ts +22 -0
  12. package/app/interfaces/block-editor-config.d.ts +9 -7
  13. package/app/interfaces/block.d.ts +12 -1
  14. package/app/services/block-editor.service.d.ts +34 -14
  15. package/app/services/index.d.ts +1 -0
  16. package/bundles/firestitch-block-editor.umd.js +966 -838
  17. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  18. package/esm2015/app/components/artboard/artboard.component.js +129 -0
  19. package/esm2015/app/components/block/block.component.js +162 -254
  20. package/esm2015/app/components/block-editor/block-editor.component.js +55 -131
  21. package/esm2015/app/components/sidebar/sidebar.component.js +128 -192
  22. package/esm2015/app/consts/block-types.const.js +13 -0
  23. package/esm2015/app/consts/index.js +2 -0
  24. package/esm2015/app/directives/block-editor-margin.directive.js +13 -15
  25. package/esm2015/app/directives/block-editor-sidebar-panel.directive.js +16 -22
  26. package/esm2015/app/enums/block-type.enum.js +13 -0
  27. package/esm2015/app/enums/index.js +2 -0
  28. package/esm2015/app/fs-block-editor.module.js +68 -27
  29. package/esm2015/app/interfaces/block-editor-config.js +2 -1
  30. package/esm2015/app/interfaces/block.js +2 -1
  31. package/esm2015/app/services/block-editor.service.js +140 -33
  32. package/esm2015/app/services/index.js +2 -0
  33. package/esm2015/firestitch-block-editor.js +1 -4
  34. package/esm2015/public_api.js +3 -4
  35. package/fesm2015/firestitch-block-editor.js +665 -626
  36. package/fesm2015/firestitch-block-editor.js.map +1 -1
  37. package/firestitch-block-editor.d.ts +1 -3
  38. package/package.json +6 -12
  39. package/public_api.d.ts +2 -0
  40. package/bundles/firestitch-block-editor.umd.min.js +0 -2
  41. package/bundles/firestitch-block-editor.umd.min.js.map +0 -1
  42. package/esm5/app/components/block/block.component.js +0 -498
  43. package/esm5/app/components/block-editor/block-editor.component.js +0 -163
  44. package/esm5/app/components/sidebar/sidebar.component.js +0 -329
  45. package/esm5/app/directives/block-editor-margin.directive.js +0 -26
  46. package/esm5/app/directives/block-editor-sidebar-panel.directive.js +0 -28
  47. package/esm5/app/fs-block-editor.module.js +0 -57
  48. package/esm5/app/interfaces/block-editor-config.js +0 -1
  49. package/esm5/app/interfaces/block.js +0 -1
  50. package/esm5/app/services/block-editor.service.js +0 -124
  51. package/esm5/firestitch-block-editor.js +0 -8
  52. package/esm5/public_api.js +0 -8
  53. package/fesm5/firestitch-block-editor.js +0 -1198
  54. package/fesm5/firestitch-block-editor.js.map +0 -1
  55. package/firestitch-block-editor.metadata.json +0 -1
@@ -1,74 +1,181 @@
1
- import { __decorate, __metadata } from 'tslib';
1
+ import * as i12 from '@angular/forms';
2
2
  import { FormsModule } from '@angular/forms';
3
+ import * as i11 from '@angular/material/input';
3
4
  import { MatInputModule } from '@angular/material/input';
4
- import { Injectable, EventEmitter, ElementRef, ChangeDetectorRef, ViewChild, Input, Output, Component, ChangeDetectionStrategy, TemplateRef, Directive, ContentChildren, QueryList, IterableDiffers, ViewChildren, NgModule } from '@angular/core';
5
+ import * as i0 from '@angular/core';
6
+ import { Injectable, Component, ChangeDetectionStrategy, ViewChild, Input, Directive, ContentChildren, ViewChildren, ElementRef, NgModule } from '@angular/core';
7
+ import * as i9 from '@angular/common';
5
8
  import { CommonModule } from '@angular/common';
9
+ import * as i4 from '@angular/material/button';
6
10
  import { MatButtonModule } from '@angular/material/button';
11
+ import * as i6 from '@angular/material/form-field';
7
12
  import { MatFormFieldModule } from '@angular/material/form-field';
13
+ import * as i5 from '@angular/material/icon';
8
14
  import { MatIconModule } from '@angular/material/icon';
9
- import { FsHtmlEditorComponent, FsHtmlEditorModule } from '@firestitch/html-editor';
15
+ import * as i8 from '@firestitch/colorpicker';
10
16
  import { FsColorPickerModule } from '@firestitch/colorpicker';
17
+ import * as i3 from '@firestitch/file';
11
18
  import { FsFileModule } from '@firestitch/file';
12
- import { takeUntil, filter, take } from 'rxjs/operators';
19
+ import { FsMenuModule } from '@firestitch/menu';
20
+ import * as i2$1 from '@firestitch/zoom-pan';
21
+ import { FsZoomPanComponent, FsZoomPanModule } from '@firestitch/zoom-pan';
22
+ import { takeUntil, filter, switchMap, delay } from 'rxjs/operators';
13
23
  import Moveable from 'moveable';
14
- import { BehaviorSubject, Subject, fromEvent } from 'rxjs';
15
- import { guid } from '@firestitch/common';
24
+ import { Subject, BehaviorSubject, fromEvent } from 'rxjs';
25
+ import { guid, index } from '@firestitch/common';
26
+ import * as i2 from '@firestitch/prompt';
27
+ import * as i7 from '@angular/material/checkbox';
28
+ import { MatCheckboxModule } from '@angular/material/checkbox';
29
+ import * as i10 from '@angular/material/tooltip';
30
+ import { MatTooltipModule } from '@angular/material/tooltip';
16
31
 
17
- let BlockEditorService = class BlockEditorService {
32
+ class BlockEditorService {
18
33
  constructor() {
19
- this.blockComponents = [];
34
+ this._blockChanged$ = new Subject();
35
+ this._blockRemoved$ = new Subject();
36
+ this._blockAdded$ = new Subject();
20
37
  this._blocks$ = new BehaviorSubject([]);
21
- this._selectedBlockComponents$ = new BehaviorSubject([]);
38
+ this._selectedBlocks$ = new BehaviorSubject([]);
39
+ this._blockComponents = new Map();
40
+ this._destroy$ = new Subject();
22
41
  }
23
42
  get elementGuidelines() {
24
43
  return [
25
- ...this.blockComponents.map((block) => {
44
+ ...Array.from(this._blockComponents.values())
45
+ .map((block) => {
26
46
  return block.el;
27
47
  }),
28
48
  this.container,
29
49
  this.margin,
30
50
  ];
31
51
  }
32
- addBlock(block) {
33
- this.blocks$.next([...this.blocks, this.sanitizeBlock(block)]);
52
+ get blockComponents() {
53
+ return Array.from(this._blockComponents.values());
54
+ }
55
+ get selectedComponentBlocks() {
56
+ return this.blockComponents
57
+ .filter((blockComponent) => this.selectedBlocks.indexOf(blockComponent.block) !== -1);
58
+ }
59
+ blockUpload(block, fsFile) {
60
+ if (this.config.blockUpload) {
61
+ this.config.blockUpload(block, fsFile.file)
62
+ .pipe(takeUntil(this._destroy$))
63
+ .subscribe((block) => {
64
+ this.blocks = [
65
+ ...this.blocks,
66
+ block,
67
+ ];
68
+ this._blockAdded$.next(block);
69
+ if (this.config.blockAdded) {
70
+ this.config.blockAdded(block);
71
+ }
72
+ //this._updateIndexes();
73
+ });
74
+ }
34
75
  }
76
+ blockAdd(block) {
77
+ if (this.config.blockAdd) {
78
+ this.config.blockAdd(block)
79
+ .pipe(takeUntil(this._destroy$))
80
+ .subscribe((block) => {
81
+ this.blocks = [
82
+ ...this.blocks,
83
+ block,
84
+ ];
85
+ this._blockAdded$.next(block);
86
+ if (this.config.blockAdded) {
87
+ this.config.blockAdded(block);
88
+ }
89
+ //this._updateIndexes();
90
+ });
91
+ }
92
+ }
93
+ // private _updateIndexes(): void {
94
+ // const sort = this.blocks.slice().sort((a, b) => {
95
+ // return a.index > b.index ? 1 : -1;
96
+ // })
97
+ // sort.forEach((block, index) => {
98
+ // this.blocks.find((item) => {
99
+ // return block.reference === item.reference;
100
+ // }).index = index;
101
+ // });
102
+ // }
35
103
  removeBlock(block) {
36
104
  const index = this.indexOf(block);
37
105
  if (index !== -1) {
38
- this.blocks.splice(index, 1);
39
- this.blocks$.next(this.blocks);
106
+ const blocks = this.blocks;
107
+ blocks.splice(index, 1);
108
+ this.blocks = blocks;
109
+ this._blockRemoved$.next(block);
40
110
  }
41
111
  }
112
+ removeSelectedBlocks() {
113
+ this.selectedBlocks.forEach((block) => {
114
+ this.removeBlock(block);
115
+ });
116
+ this.selectedBlocks = [];
117
+ }
42
118
  get blocks$() {
43
119
  return this._blocks$;
44
120
  }
121
+ get blockChanged$() {
122
+ return this._blockChanged$;
123
+ }
124
+ get blockRemoved$() {
125
+ return this._blockRemoved$;
126
+ }
127
+ get blockAdded$() {
128
+ return this._blockAdded$;
129
+ }
130
+ blockChange(block) {
131
+ this._blockChanged$.next(block);
132
+ if (this.config.blockChanged) {
133
+ this.config.blockChanged(block);
134
+ }
135
+ }
45
136
  get blocks() {
46
- return this.blocks$.getValue();
137
+ return this._blocks$.getValue();
47
138
  }
48
139
  set blocks(blocks) {
49
140
  this._blocks$.next(blocks);
50
141
  }
51
142
  isSelectedBlock(block) {
52
- return this.selectedBlockComponents.indexOf(block) !== -1;
143
+ return this.selectedBlocks.indexOf(block) !== -1;
53
144
  }
54
145
  indexOf(block) {
55
146
  return this.blocks.map((e) => e.reference).indexOf(block.reference);
56
147
  }
57
- set selectedBlockComponents(blocks) {
58
- this.blockComponents.forEach((block) => {
59
- block.editable = false;
60
- block.transformable = blocks.indexOf(block) !== -1;
148
+ selectedBlockComponentChangeProperty(value, name) {
149
+ this.selectedBlocks
150
+ .forEach((block) => {
151
+ block[name] = value;
152
+ this.blockChange(block);
61
153
  });
62
- this._selectedBlockComponents$.next(blocks);
63
154
  }
64
- get selectedBlockComponents() {
65
- return this._selectedBlockComponents$.getValue();
155
+ get selectedBlocks$() {
156
+ return this._selectedBlocks$;
66
157
  }
67
- get selectedBlocks() {
68
- return this.selectedBlockComponents.map((blockComponent) => blockComponent.block);
158
+ set selectedBlock(block) {
159
+ this.selectedBlocks = [block];
69
160
  }
70
- get selectedBlockComponents$() {
71
- return this._selectedBlockComponents$;
161
+ set selectedBlocks(blocks) {
162
+ this.blockComponents
163
+ .forEach((blockComponent) => {
164
+ blockComponent.editable = false;
165
+ if (blocks.indexOf(blockComponent.block) !== -1) {
166
+ blockComponent.transformable = true;
167
+ }
168
+ else {
169
+ blockComponent.deselect();
170
+ }
171
+ });
172
+ this._selectedBlocks$.next(blocks);
173
+ if (this.config.blocksSelected) {
174
+ this.config.blocksSelected(blocks);
175
+ }
176
+ }
177
+ get selectedBlocks() {
178
+ return this._selectedBlocks$.getValue();
72
179
  }
73
180
  saveSelection() {
74
181
  const selection = window.getSelection();
@@ -84,7 +191,8 @@ let BlockEditorService = class BlockEditorService {
84
191
  hasSelectionRange() {
85
192
  return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
86
193
  }
87
- registerBlock(block) {
194
+ registerBlock(block, blockComponent) {
195
+ this._blockComponents.set(block, blockComponent);
88
196
  this.blockComponents.push(block);
89
197
  this.blockComponents.forEach((item) => {
90
198
  const blocks = this.elementGuidelines
@@ -94,30 +202,55 @@ let BlockEditorService = class BlockEditorService {
94
202
  item.elementGuidelines = blocks;
95
203
  });
96
204
  }
205
+ unregisterBlock(block) {
206
+ this._blockComponents.delete(block);
207
+ }
97
208
  registerContainer(container) {
98
209
  this.container = container;
99
210
  }
100
211
  registerMargin(margin) {
101
212
  this.margin = margin;
102
213
  }
214
+ sanitizeNewBlock(block) {
215
+ const width = (this.config.width * .333).toFixed(2);
216
+ const height = (this.config.height * .333).toFixed(2);
217
+ return this.sanitizeBlock(Object.assign({ top: height, left: width, width: height, height: width }, block));
218
+ }
103
219
  sanitizeBlock(block) {
104
- return Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block);
220
+ return Object.assign(Object.assign({ shapeBottomLeft: 'round', shapeTopLeft: 'round', shapeTopRight: 'round', shapeBottomRight: 'round', verticalAlign: 'top', horizontalAlign: 'left' }, block), { guid: block.guid || guid() });
105
221
  }
106
- };
107
- BlockEditorService = __decorate([
108
- Injectable(),
109
- __metadata("design:paramtypes", [])
110
- ], BlockEditorService);
222
+ ngOnDestroy() {
223
+ this._destroy$.next();
224
+ this._destroy$.complete();
225
+ }
226
+ }
227
+ BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
228
+ BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
229
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
230
+ type: Injectable
231
+ }] });
232
+
233
+ var BlockType;
234
+ (function (BlockType) {
235
+ BlockType["Rectangle"] = "rectangle";
236
+ BlockType["ShortText"] = "shorttext";
237
+ BlockType["LongText"] = "longtext";
238
+ BlockType["Image"] = "image";
239
+ BlockType["RadioButton"] = "radiobutton";
240
+ BlockType["Checkbox"] = "checkbox";
241
+ BlockType["Signature"] = "signature";
242
+ BlockType["Pdf"] = "pdf";
243
+ BlockType["Date"] = "date";
244
+ })(BlockType || (BlockType = {}));
111
245
 
112
- let FsBlockComponent = class FsBlockComponent {
113
- constructor(_service, _elementRef, _cdRef) {
114
- this._service = _service;
246
+ class FsBlockComponent {
247
+ constructor(_blockEditor, _elementRef, _cdRef) {
248
+ this._blockEditor = _blockEditor;
115
249
  this._elementRef = _elementRef;
116
250
  this._cdRef = _cdRef;
117
- this.changed = new EventEmitter();
118
- this.htmlConfig = {};
251
+ this.BlockType = BlockType;
119
252
  this._editable = false;
120
- this._selectedElements = [];
253
+ this._transformable = false;
121
254
  this._destroy$ = new Subject();
122
255
  }
123
256
  get el() {
@@ -130,7 +263,7 @@ let FsBlockComponent = class FsBlockComponent {
130
263
  return this._editable;
131
264
  }
132
265
  set elementGuidelines(value) {
133
- this._moveable.elementGuidelines = value;
266
+ this.moveable.elementGuidelines = value;
134
267
  }
135
268
  set editable(value) {
136
269
  this._editable = value;
@@ -139,7 +272,7 @@ let FsBlockComponent = class FsBlockComponent {
139
272
  }
140
273
  }
141
274
  set clippable(value) {
142
- this._moveable.clippable = value;
275
+ this.moveable.clippable = value;
143
276
  }
144
277
  get transformable() {
145
278
  return this._transformable;
@@ -148,208 +281,131 @@ let FsBlockComponent = class FsBlockComponent {
148
281
  this._transformable = value;
149
282
  this.moveable.draggable = value;
150
283
  this.moveable.resizable = value;
151
- this.moveable.draggable = value;
152
284
  this.moveable.roundable = value;
153
285
  this.moveable.rotatable = value;
154
286
  }
155
- set lineHeight(value) {
156
- this.block.lineHeight = value;
157
- this._triggerChanged();
158
- }
159
- set borderWidth(value) {
160
- this.block.borderWidth = value;
161
- this._triggerChanged();
162
- }
163
- set fontSize(value) {
164
- this.block.fontSize = value;
165
- this._triggerChanged();
166
- }
167
- set backgroundColor(value) {
168
- this.block.backgroundColor = value;
169
- this._triggerChanged();
170
- }
171
287
  set width(value) {
172
- this.block.width = parseFloat(value);
173
- this.element.nativeElement.style.width = `${this.block.width}${this.unit}`;
174
- this._moveable.updateRect();
175
- this._triggerChanged();
288
+ this.element.nativeElement.style.width = `${parseFloat(value)}${this.unit}`;
289
+ this.moveable.updateRect();
176
290
  }
177
291
  set height(value) {
178
- this.block.height = parseFloat(value);
179
- this.element.nativeElement.style.height = `${this.block.height}${this.unit}`;
180
- this._moveable.updateRect();
181
- this._triggerChanged();
292
+ this.element.nativeElement.style.height = `${parseFloat(value)}${this.unit}`;
293
+ this.moveable.updateRect();
182
294
  }
183
295
  set top(value) {
184
- this.block.top = parseFloat(value);
185
- this.element.nativeElement.style.top = `${this.block.top}${this.unit}`;
186
- this._moveable.updateRect();
187
- this._triggerChanged();
296
+ this.element.nativeElement.style.top = `${parseFloat(value)}${this.unit}`;
297
+ this.moveable.updateRect();
188
298
  }
189
299
  set left(value) {
190
- this.block.left = parseFloat(value);
191
- this.element.nativeElement.style.left = `${this.block.left}${this.unit}`;
192
- this._moveable.updateRect();
193
- this._triggerChanged();
300
+ this.element.nativeElement.style.left = `${parseFloat(value)}${this.unit}`;
301
+ this.moveable.updateRect();
194
302
  }
195
303
  set rotate(value) {
196
- this.block.rotate = parseFloat(value);
197
- this._moveable.request('rotatable', { rotate: this.block.rotate }, true);
198
- this._triggerChanged();
199
- }
200
- set shapeRadius(value) {
201
- this.block.shapeRadius = value;
202
- this._triggerChanged();
304
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
305
+ this.moveable.updateRect();
203
306
  }
204
307
  set index(value) {
205
308
  this.block.index = value;
206
309
  }
207
- set borderColor(value) {
208
- this.block.borderColor = value;
209
- this._triggerChanged();
210
- }
211
- set paddingAll(value) {
212
- this.block.padding = value;
213
- this.block.paddingTop = null;
214
- this.block.paddingBottom = null;
215
- this.block.paddingLeft = null;
216
- this.block.paddingRight = null;
217
- this._triggerChanged();
218
- }
219
- padding(name, value) {
220
- this.block[name] = value;
221
- this.block.padding = null;
222
- this._triggerChanged();
223
- }
224
- set imageUrl(value) {
225
- this.block.imageUrl = value;
226
- this._triggerChanged();
227
- }
228
- set fontColor(value) {
229
- this.block.fontColor = value;
230
- this._triggerChanged();
231
- }
232
- set verticalAlign(value) {
233
- this.block.verticalAlign = value;
234
- this._triggerChanged();
310
+ set keepRatio(value) {
311
+ this.moveable.keepRatio = value;
235
312
  }
236
- shapeRound(name, value) {
237
- this.block[name] = value;
238
- this._triggerChanged();
239
- }
240
- set horizontalAlign(value) {
241
- this.block.horizontalAlign = value;
242
- this._triggerChanged();
243
- }
244
- set italic(value) {
245
- this.block.italic = value;
246
- this._triggerChanged();
313
+ markForCheck() {
314
+ this._cdRef.markForCheck();
247
315
  }
248
- get italic() {
249
- return this.block.italic;
316
+ ngOnInit() {
317
+ this.unit = this._blockEditor.config.unit;
318
+ this.content = this.block.content;
319
+ this._blockEditor.blockChanged$
320
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
321
+ .subscribe((block) => {
322
+ this.keepRatio = block.keepRatio;
323
+ this.width = block.width;
324
+ this.height = block.height;
325
+ this.top = block.top;
326
+ this.left = block.left;
327
+ this._cdRef.markForCheck();
328
+ });
250
329
  }
251
- set bold(value) {
252
- this.block.bold = value;
253
- this._triggerChanged();
330
+ ngAfterContentInit() {
331
+ setTimeout(() => {
332
+ this._initEvents();
333
+ this._initMoveable();
334
+ this._setTransform();
335
+ this.width = this.block.width;
336
+ this.height = this.block.height;
337
+ this.top = this.block.top;
338
+ this.left = this.block.left;
339
+ this._blockEditor.registerBlock(this.block, this);
340
+ });
254
341
  }
255
- get bold() {
256
- return this.block.bold;
342
+ pxToIn(px) {
343
+ return this.round(px / 96, 2);
257
344
  }
258
- set underline(value) {
259
- this.block.underline = value;
260
- this._triggerChanged();
345
+ round(value, decimals) {
346
+ return parseFloat(value.toFixed(decimals));
261
347
  }
262
- get underline() {
263
- return this.block.underline;
348
+ deselect() {
349
+ this.transformable = false;
350
+ this.editable = false;
264
351
  }
265
- updateRect() {
266
- this.moveable.updateRect();
352
+ deselectContent() {
353
+ if (window.getSelection) {
354
+ if (window.getSelection().empty) {
355
+ window.getSelection().empty();
356
+ }
357
+ else if (window.getSelection().removeAllRanges) {
358
+ window.getSelection().removeAllRanges();
359
+ }
360
+ }
267
361
  }
268
- markForCheck() {
269
- this._cdRef.markForCheck();
362
+ selectAll() {
363
+ const range = document.createRange();
364
+ range.selectNodeContents(this.contentEditable.nativeElement);
365
+ const sel = window.getSelection();
366
+ sel.removeAllRanges();
367
+ sel.addRange(range);
270
368
  }
271
- ngOnInit() {
272
- this.block = this._service.sanitizeBlock(this.block);
273
- this.unit = this._service.config.unit;
274
- this.content = this.block.content;
275
- this.htmlConfig = {
276
- autofocus: false,
277
- froalaConfig: {}
278
- };
369
+ ngOnDestroy() {
370
+ this._blockEditor.unregisterBlock(this.block);
371
+ this._destroy$.next();
372
+ this._destroy$.complete();
279
373
  }
280
- saveSelectedElements() {
281
- this._selectedElements = this.htmlEditor.editor.selection.blocks();
374
+ _setTransform(transforms = []) {
375
+ transforms = transforms !== null && transforms !== void 0 ? transforms : [];
376
+ if (this.block.rotate) {
377
+ transforms.push(`rotate(${this.block.rotate}deg)`);
378
+ }
379
+ this.el.style.transform = transforms.join(' ');
282
380
  }
283
- clearSelectedElements() {
284
- this._selectedElements = [];
381
+ _triggerChanged() {
382
+ this._blockEditor.blockChange(this.block);
285
383
  }
286
- ngAfterContentInit() {
287
- this.el.style.width = this.block.width + this.unit;
288
- this.el.style.height = this.block.height + this.unit;
289
- this.el.style.top = this.block.top + this.unit;
290
- this.el.style.left = this.block.left + this.unit;
291
- this._setTransform();
292
- fromEvent(this.contentEditable.nativeElement, 'input')
293
- .pipe(takeUntil(this._destroy$)).subscribe((event) => {
294
- this.block.content = event.target.innerHTML;
295
- this._triggerChanged();
296
- });
297
- fromEvent(this.el, 'mousedown')
298
- .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe((event) => {
299
- if (this.editable) {
300
- if (this.contentElement.nativeElement.isSameNode(event.target)) {
301
- event.preventDefault();
302
- event.stopImmediatePropagation();
303
- event.stopPropagation();
304
- }
305
- }
306
- else {
307
- this._service.selectedBlockComponents = [this];
308
- }
309
- });
310
- fromEvent(this.el, 'dblclick')
311
- .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
312
- .subscribe((event) => {
313
- if (this.block.readonly) {
314
- event.preventDefault();
315
- }
316
- else {
317
- this.editable = true;
318
- this._cdRef.markForCheck();
319
- setTimeout(() => {
320
- this.selectAll();
321
- });
322
- }
323
- });
384
+ _initMoveable() {
324
385
  this._moveable = new Moveable(this._elementRef.nativeElement, {
325
386
  target: this.el,
326
- container: this._service.container,
387
+ container: this._blockEditor.container,
327
388
  draggable: false,
328
389
  resizable: false,
329
390
  scalable: false,
330
391
  rotatable: false,
331
392
  warpable: false,
332
393
  origin: false,
333
- keepRatio: false,
394
+ keepRatio: this.block.keepRatio,
334
395
  snappable: true,
335
- snapHorizontal: true,
336
- snapVertical: true,
337
- snapCenter: true,
338
- snapElement: true,
339
396
  edge: false,
340
397
  throttleDrag: 1,
341
398
  throttleScale: 0.01,
342
399
  throttleRotate: 1,
343
400
  throttleResize: 1,
344
401
  });
345
- this._service.registerBlock(this);
346
- this._moveable
347
- .on('clip', e => {
402
+ this.moveable
403
+ .on('clip', (e) => {
348
404
  this.block.clipPath = e.clipStyle;
349
405
  e.target.style.clipPath = e.clipStyle;
350
406
  this._triggerChanged();
351
407
  });
352
- this._moveable.on('dragStart', ({ target, clientX, clientY }) => {
408
+ this.moveable.on('dragStart', ({ target, clientX, clientY }) => {
353
409
  this.editable = false;
354
410
  }).on('drag', ({ target, left, top }) => {
355
411
  target.style.left = this.pxToIn(left) + this.unit;
@@ -358,8 +414,9 @@ let FsBlockComponent = class FsBlockComponent {
358
414
  this.block.left = this.pxToIn(left);
359
415
  this._triggerChanged();
360
416
  });
361
- this._moveable.on('resizeStart', ({ target, clientX, clientY }) => {
417
+ this.moveable.on('resizeStart', ({ target, clientX, clientY }) => {
362
418
  this.editable = false;
419
+ this.zoompan.disable();
363
420
  }).on('resize', ({ target, width, height, dist, delta, direction }) => {
364
421
  width = this.pxToIn(width);
365
422
  height = this.pxToIn(height);
@@ -388,370 +445,278 @@ let FsBlockComponent = class FsBlockComponent {
388
445
  target.style.left = this.block.left + this.unit;
389
446
  this._setTransform();
390
447
  this._triggerChanged();
448
+ this.zoompan.enable();
391
449
  });
392
- this._moveable.on('rotateStart', ({ target, clientX, clientY }) => {
450
+ this.moveable.on('rotateStart', ({ target, clientX, clientY }) => {
451
+ this.zoompan.disable();
393
452
  this.editable = false;
394
453
  this._rotateStart = this.block.rotate || 0;
395
454
  }).on('rotate', ({ rotate, transform }) => {
396
455
  this.block.rotate = this._rotateStart + rotate;
397
456
  this.el.style.transform = transform;
398
457
  this._triggerChanged();
458
+ this.zoompan.enable();
399
459
  });
400
460
  }
401
- pxToIn(px) {
402
- return this.round(px / 96, 2);
403
- }
404
- round(value, decimals) {
405
- return parseFloat(value.toFixed(decimals));
406
- }
407
- deselect() {
408
- this.transformable = false;
409
- this.editable = false;
410
- }
411
- deselectContent() {
412
- if (window.getSelection) {
413
- if (window.getSelection().empty) {
414
- window.getSelection().empty();
461
+ _initEvents() {
462
+ fromEvent(this.contentEditable.nativeElement, 'input')
463
+ .pipe(takeUntil(this._destroy$)).subscribe((event) => {
464
+ this.block.content = event.target.innerHTML;
465
+ this._triggerChanged();
466
+ });
467
+ fromEvent(this.el, 'mousedown')
468
+ .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe((event) => {
469
+ this.zoompan.disable();
470
+ if (this.editable) {
471
+ if (this.contentElement.nativeElement.isSameNode(event.target)) {
472
+ event.preventDefault();
473
+ event.stopImmediatePropagation();
474
+ event.stopPropagation();
475
+ }
415
476
  }
416
- else if (window.getSelection().removeAllRanges) {
417
- window.getSelection().removeAllRanges();
477
+ else {
478
+ this._blockEditor.selectedBlock = this.block;
418
479
  }
419
- }
420
- }
421
- selectAll() {
422
- const range = document.createRange();
423
- range.selectNodeContents(this.contentEditable.nativeElement);
424
- const sel = window.getSelection();
425
- sel.removeAllRanges();
426
- sel.addRange(range);
427
- }
428
- ngOnDestroy() {
429
- this._destroy$.next();
430
- this._destroy$.complete();
431
- }
432
- _setTransform(transforms = []) {
433
- transforms = (transforms !== null && transforms !== void 0 ? transforms : []);
434
- if (this.block.rotate) {
435
- transforms.push(`rotate(${this.block.rotate}deg)`);
436
- }
437
- this.el.style.transform = transforms.join(' ');
480
+ });
481
+ fromEvent(this.el, 'mouseup')
482
+ .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe(() => {
483
+ this.zoompan.enable();
484
+ });
485
+ fromEvent(this.el, 'dblclick')
486
+ .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
487
+ .subscribe((event) => {
488
+ if (this.block.readonly) {
489
+ event.preventDefault();
490
+ }
491
+ else {
492
+ this.editable = true;
493
+ this._cdRef.markForCheck();
494
+ setTimeout(() => {
495
+ this.selectAll();
496
+ });
497
+ }
498
+ });
438
499
  }
439
- _triggerChanged() {
440
- this.changed.emit(this.block);
441
- }
442
- };
443
- FsBlockComponent.ctorParameters = () => [
444
- { type: BlockEditorService },
445
- { type: ElementRef },
446
- { type: ChangeDetectorRef }
447
- ];
448
- __decorate([
449
- ViewChild('element', { static: true }),
450
- __metadata("design:type", ElementRef)
451
- ], FsBlockComponent.prototype, "element", void 0);
452
- __decorate([
453
- ViewChild('contentElement', { static: true }),
454
- __metadata("design:type", ElementRef)
455
- ], FsBlockComponent.prototype, "contentElement", void 0);
456
- __decorate([
457
- ViewChild('contentEditable', { static: true }),
458
- __metadata("design:type", ElementRef)
459
- ], FsBlockComponent.prototype, "contentEditable", void 0);
460
- __decorate([
461
- ViewChild(FsHtmlEditorComponent),
462
- __metadata("design:type", FsHtmlEditorComponent)
463
- ], FsBlockComponent.prototype, "htmlEditor", void 0);
464
- __decorate([
465
- Input(),
466
- __metadata("design:type", Object)
467
- ], FsBlockComponent.prototype, "block", void 0);
468
- __decorate([
469
- Input(),
470
- __metadata("design:type", String)
471
- ], FsBlockComponent.prototype, "html", void 0);
472
- __decorate([
473
- Output(),
474
- __metadata("design:type", Object)
475
- ], FsBlockComponent.prototype, "changed", void 0);
476
- FsBlockComponent = __decorate([
477
- Component({
478
- selector: 'fs-block',
479
- template: "<div\n #element\n class=\"block\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n",
480
- changeDetection: ChangeDetectionStrategy.OnPush,
481
- styles: [".block{position:absolute;display:block;outline:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block .content-editable{outline:0;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:0 0!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:0 0!important}"]
482
- }),
483
- __metadata("design:paramtypes", [BlockEditorService,
484
- ElementRef,
485
- ChangeDetectorRef])
486
- ], FsBlockComponent);
500
+ }
501
+ FsBlockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, deps: [{ token: BlockEditorService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
502
+ FsBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html", zoompan: "zoompan" }, viewQueries: [{ propertyName: "element", first: true, predicate: ["element"], descendants: true, static: true }, { propertyName: "contentElement", first: true, predicate: ["contentElement"], descendants: true, static: true }, { propertyName: "contentEditable", first: true, predicate: ["contentEditable"], descendants: true, static: true }], ngImport: i0, template: "<div\n #element\n [class]=\"'block ' + 'block-' + block.type\"\n [ngClass]=\"{ editable: editable, readonly: block.readonly }\">\n <div\n #contentElement\n class=\"content\"\n [style.zIndex]=\"block.index\"\n [style.borderColor]=\"block.borderColor\"\n [style.borderWidth]=\"block.borderWidth ? block.borderWidth + 'pt' : ''\"\n [style.borderStyle]=\"block.borderColor ? 'solid' : 'dashed'\"\n [style.textAlign]=\"block.horizontalAlign\"\n [style.fontStyle]=\"block.italic ? 'italic' : ''\"\n [style.fontSize]=\"block.fontSize ? block.fontSize + 'pt' : ''\"\n [style.lineHeight]=\"block.lineHeight ? block.lineHeight + 'pt' : ''\"\n [style.color]=\"block.fontColor\"\n [style.fontWeight]=\"block.bold ? 'bold' : ''\"\n [style.textDecoration]=\"block.underline ? 'underline' : ''\"\n [style.paddingTop]=\"block.paddingTop ? block.paddingTop + unit : ''\"\n [style.paddingBottom]=\"block.paddingBottom ? block.paddingBottom + unit : ''\"\n [style.paddingLeft]=\"block.paddingLeft ? block.paddingLeft + unit : ''\"\n [style.paddingRight]=\"block.paddingRight ? block.paddingRight + unit : ''\"\n [style.padding]=\"block.padding ? block.padding + unit : ''\"\n [style.clipPath]=\"block.clipPath\"\n [style.backgroundColor]=\"block.backgroundColor\"\n [style.borderBottomLeftRadius]=\"block.shapeRadius && block.shapeBottomLeft === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderBottomRightRadius]=\"block.shapeRadius && block.shapeBottomRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopRightRadius]=\"block.shapeRadius && block.shapeTopRight === 'round' ? block.shapeRadius + unit : ''\"\n [style.borderTopLeftRadius]=\"block.shapeRadius && block.shapeTopLeft === 'round' ? block.shapeRadius + unit : ''\"\n [ngClass]=\"{\n 'editable': editable,\n 'vertical-align-center': block.verticalAlign === 'center',\n 'vertical-align-bottom': block.verticalAlign === 'bottom'\n }\">\n <ng-container [ngSwitch]=\"block.type\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <img [src]=\"block.imageUrl\">\n </ng-container>\n <img [src]=\"block.imageUrl\" *ngIf=\"block.imageUrl\">\n </ng-container>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n {{block.name}}\n </ng-container>\n <div\n #contentEditable\n [contentEditable]=\"editable\"\n class=\"content-editable\"\n [innerHTML]=\"content\">\n </div>\n </div>\n</div>\n", styles: [":host ::ng-deep .moveable-control{width:10px!important;height:10px!important;margin-top:-5px!important;margin-left:-5px!important}.block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.block.block-shorttext,.block.block-longtext,.block.block-date,.block.block-radiobutton,.block.block-signature,.block.block-checkbox{background-color:#aab5e1cc;color:#585555;font-size:12px}.block .content-editable{outline:none;position:relative}.block.editable .content-editable{cursor:text}.block .content{flex-direction:column;height:100%;display:flex;border:1px dashed #c5c5c5;position:relative;box-sizing:border-box;overflow:hidden}.block .content fs-html-editor{width:100%}.block .content.vertical-align-center{justify-content:center}.block .content.vertical-align-bottom{justify-content:flex-end}.block .content img{width:100%;height:100%;position:absolute}:host ::ng-deep fs-html-editor .bottom-line,:host ::ng-deep fs-html-editor .fr-toolbar{display:none!important}:host ::ng-deep fs-html-editor .fr-wrapper{background:none!important;border:none!important}:host ::ng-deep .moveable-line:not(.moveable-rotation-line):not(.moveable-guideline){background:transparent!important}\n"], directives: [{ type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
504
+ type: Component,
505
+ args: [{
506
+ selector: 'fs-block',
507
+ templateUrl: 'block.component.html',
508
+ styleUrls: ['block.component.scss'],
509
+ changeDetection: ChangeDetectionStrategy.OnPush,
510
+ }]
511
+ }], ctorParameters: function () { return [{ type: BlockEditorService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { element: [{
512
+ type: ViewChild,
513
+ args: ['element', { static: true }]
514
+ }], contentElement: [{
515
+ type: ViewChild,
516
+ args: ['contentElement', { static: true }]
517
+ }], contentEditable: [{
518
+ type: ViewChild,
519
+ args: ['contentEditable', { static: true }]
520
+ }], block: [{
521
+ type: Input
522
+ }], html: [{
523
+ type: Input
524
+ }], zoompan: [{
525
+ type: Input
526
+ }] } });
487
527
 
488
- let FsBlockEditorSidebarPanelDirective = class FsBlockEditorSidebarPanelDirective {
528
+ class FsBlockEditorSidebarPanelDirective {
489
529
  constructor(templateRef) {
490
530
  this.templateRef = templateRef;
491
531
  this.show = true;
492
532
  }
493
- };
494
- FsBlockEditorSidebarPanelDirective.ctorParameters = () => [
495
- { type: TemplateRef }
496
- ];
497
- __decorate([
498
- Input(),
499
- __metadata("design:type", String)
500
- ], FsBlockEditorSidebarPanelDirective.prototype, "label", void 0);
501
- __decorate([
502
- Input(),
503
- __metadata("design:type", Object)
504
- ], FsBlockEditorSidebarPanelDirective.prototype, "show", void 0);
505
- FsBlockEditorSidebarPanelDirective = __decorate([
506
- Directive({
507
- selector: '[fsBlockEditorSidebarPanel]'
508
- }),
509
- __metadata("design:paramtypes", [TemplateRef])
510
- ], FsBlockEditorSidebarPanelDirective);
533
+ }
534
+ FsBlockEditorSidebarPanelDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
535
+ FsBlockEditorSidebarPanelDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorSidebarPanelDirective, selector: "[fsBlockEditorSidebarPanel]", inputs: { label: "label", show: "show" }, ngImport: i0 });
536
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorSidebarPanelDirective, decorators: [{
537
+ type: Directive,
538
+ args: [{
539
+ selector: '[fsBlockEditorSidebarPanel]'
540
+ }]
541
+ }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { label: [{
542
+ type: Input
543
+ }], show: [{
544
+ type: Input
545
+ }] } });
511
546
 
512
- let FsBlockEditorMarginDirective = class FsBlockEditorMarginDirective {
513
- constructor(_elementRef) {
514
- this._elementRef = _elementRef;
515
- }
516
- get element() {
517
- return this._elementRef.nativeElement;
518
- }
519
- };
520
- FsBlockEditorMarginDirective.ctorParameters = () => [
521
- { type: ElementRef }
522
- ];
523
- FsBlockEditorMarginDirective = __decorate([
524
- Directive({
525
- selector: '[fsBlockEditorMargin]'
526
- }),
527
- __metadata("design:paramtypes", [ElementRef])
528
- ], FsBlockEditorMarginDirective);
547
+ const BlockTypes = [
548
+ { value: BlockType.Rectangle, name: 'Rectangle', icon: 'crop_5_4' },
549
+ { value: BlockType.ShortText, name: 'Short Text', icon: 'short_text' },
550
+ { value: BlockType.LongText, name: 'Long Text', icon: 'subject' },
551
+ { value: BlockType.RadioButton, name: 'Radio Button', icon: 'radio_button_checked' },
552
+ { value: BlockType.Checkbox, name: 'Checkbox', icon: 'check_box' },
553
+ { value: BlockType.Date, name: 'Date', icon: 'calendar_today' },
554
+ { value: BlockType.Signature, name: 'Signature', icon: 'draw' },
555
+ { value: BlockType.Image, name: 'Image', icon: 'image', accept: 'image/*' },
556
+ { value: BlockType.Pdf, name: 'Pdf', icon: 'picture_as_pdf', accept: 'application/pdf' },
557
+ ];
529
558
 
530
- let SidebarComponent = class SidebarComponent {
531
- constructor(_el, _service, _cdRef) {
559
+ class SidebarComponent {
560
+ constructor(_el, _blockEditor, _cdRef, _prompt) {
532
561
  this._el = _el;
533
- this._service = _service;
562
+ this._blockEditor = _blockEditor;
534
563
  this._cdRef = _cdRef;
564
+ this._prompt = _prompt;
565
+ this.BlockTypes = BlockTypes;
566
+ this.blockTypeNames = index(BlockTypes, 'value', 'name');
567
+ this.BlockType = BlockType;
535
568
  this._destroy$ = new Subject();
536
569
  }
537
- get changeDetector() {
538
- return this._cdRef;
539
- }
540
570
  get el() {
541
571
  return this._el.nativeElement;
542
572
  }
543
573
  ngOnInit() {
544
- this._service.selectedBlockComponents$
574
+ this._blockEditor.selectedBlocks$
545
575
  .pipe(takeUntil(this._destroy$))
546
576
  .subscribe((blocks) => {
547
577
  this.clippable = false;
548
- this.block = blocks[0] ? blocks[0].block : null;
549
- this.changeDetector.markForCheck();
550
- if (this.config.blocksSelected) {
551
- this.config.blocksSelected(blocks.map((block) => block.block));
552
- }
578
+ this.block = blocks[0] ? blocks[0] : null;
579
+ this._cdRef.markForCheck();
580
+ });
581
+ this._blockEditor.blockChanged$
582
+ .pipe(filter((block) => block === this.block), takeUntil(this._destroy$))
583
+ .subscribe(() => {
584
+ this._cdRef.markForCheck();
553
585
  });
554
586
  }
555
587
  verticalAlignClick(value) {
556
- this._service.selectedBlockComponents.forEach((block) => {
557
- block.verticalAlign = value;
558
- });
588
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
559
589
  }
560
590
  boldClick() {
561
- this._service.selectedBlockComponents.forEach((block) => {
562
- block.bold = !block.bold;
563
- });
591
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
564
592
  }
565
593
  fontColorChange(value) {
566
- this._service.selectedBlockComponents.forEach((block) => {
567
- block.fontColor = value;
568
- });
594
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
569
595
  }
570
596
  lineHeightChange(value) {
571
- this._service.selectedBlockComponents.forEach((block) => {
572
- if (this.validNumeric(value)) {
573
- block.lineHeight = value || null;
574
- }
575
- });
597
+ value = this.validNumeric(value) ? value : null;
598
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
576
599
  }
577
600
  fontSizeChange(value) {
578
- this._service.selectedBlockComponents.forEach((block) => {
579
- if (this.validNumeric(value)) {
580
- block.fontSize = value || null;
581
- }
582
- });
601
+ value = this.validNumeric(value) ? value : null;
602
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
583
603
  }
584
604
  borderWidthChange(value) {
585
- this._service.selectedBlockComponents.forEach((block) => {
586
- if (this.validNumeric(value)) {
587
- block.borderWidth = value || null;
588
- }
589
- });
605
+ value = this.validNumeric(value) ? value : null;
606
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
590
607
  }
591
608
  italicClick() {
592
- this._service.selectedBlockComponents.forEach((block) => {
593
- block.italic = !block.italic;
594
- });
609
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
595
610
  }
596
611
  underlineClick() {
597
- this._service.selectedBlockComponents.forEach((block) => {
598
- block.underline = !block.underline;
599
- });
612
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
600
613
  }
601
614
  backgroundColorChange(value) {
602
- this._service.selectedBlockComponents.forEach((block) => {
603
- block.backgroundColor = value;
604
- });
615
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
605
616
  }
606
617
  widthChange(value) {
607
- this._service.selectedBlockComponents.forEach((block) => {
608
- if (this.validNumeric(value)) {
609
- block.width = value;
610
- }
611
- });
618
+ value = this.validNumeric(value) ? value : null;
619
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
612
620
  }
613
621
  heightChange(value) {
614
- this._service.selectedBlockComponents.forEach((block) => {
615
- if (this.validNumeric(value)) {
616
- block.height = value;
617
- }
618
- });
622
+ value = this.validNumeric(value) ? value : null;
623
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
619
624
  }
620
625
  topChange(value) {
621
- this._service.selectedBlockComponents.forEach((block) => {
622
- if (this.validNumeric(value)) {
623
- block.top = value;
624
- }
625
- });
626
+ value = this.validNumeric(value) ? value : null;
627
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
626
628
  }
627
629
  leftChange(value) {
628
- this._service.selectedBlockComponents.forEach((block) => {
629
- if (this.validNumeric(value)) {
630
- block.left = value;
631
- }
632
- });
630
+ value = this.validNumeric(value) ? value : null;
631
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
633
632
  }
634
633
  rotateChange(value) {
635
- this._service.selectedBlockComponents.forEach((block) => {
636
- if (this.validNumeric(value)) {
637
- block.rotate = value;
638
- }
639
- });
634
+ value = this.validNumeric(value) ? value : null;
635
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
640
636
  }
641
637
  paddingChange(name, value) {
642
- this._service.selectedBlockComponents.forEach((block) => {
643
- if (this.validNumeric(value)) {
644
- block.padding(name, value || null);
645
- }
646
- });
638
+ value = this.validNumeric(value) ? value : null;
639
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
647
640
  }
648
641
  paddingAllChange(value) {
649
- this._service.selectedBlockComponents.forEach((block) => {
650
- if (this.validNumeric(value)) {
651
- block.paddingAll = value;
652
- }
653
- });
642
+ value = this.validNumeric(value) ? value : null;
643
+ this.block.paddingTop = value;
644
+ this.block.paddingLeft = value;
645
+ this.block.paddingBottom = value;
646
+ this.block.paddingRight = value;
647
+ this.paddingChange('top', value);
648
+ this.paddingChange('left', value);
649
+ this.paddingChange('right', value);
650
+ this.paddingChange('bottom', value);
654
651
  }
655
652
  borderColorChange(value) {
656
- this._service.selectedBlockComponents.forEach((block) => {
657
- block.borderColor = value;
658
- });
653
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
654
+ }
655
+ toggleKeepRatio() {
656
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
659
657
  }
660
658
  horizontalAlignClick(value) {
661
- this._service.selectedBlockComponents.forEach((block) => {
662
- block.horizontalAlign = value;
663
- });
659
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
664
660
  }
665
- shapeRound(value) {
666
- this._service.selectedBlockComponents.forEach((block) => {
667
- block.shapeRound(value, block.block[value] === 'round' ? 'square' : 'round');
668
- });
661
+ shapeRound(name) {
662
+ const value = this.block[name] === 'round' ? 'square' : 'round';
663
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
669
664
  }
670
665
  imageRemove() {
671
- this._service.selectedBlockComponents.forEach((block) => {
672
- block.imageUrl = null;
673
- });
666
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
674
667
  }
675
668
  imageClip() {
676
669
  this.clippable = !this.clippable;
677
- this._service.selectedBlockComponents.forEach((block) => {
678
- block.clippable = this.clippable;
679
- });
670
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
680
671
  }
681
672
  shapeRadiusChange(value) {
682
- this._service.selectedBlockComponents.forEach((block) => {
683
- block.shapeRadius = value;
684
- });
673
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
674
+ }
675
+ blockChangeProperty(value, name) {
676
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
685
677
  }
686
- fileSelect(fsFile) {
687
- if (this.config.fileUpload) {
688
- this.config.fileUpload(fsFile.file)
678
+ imageSelect(fsFile) {
679
+ if (this.config.imageUpload) {
680
+ this.config.imageUpload(fsFile.file)
689
681
  .subscribe((value) => {
690
- this._service.selectedBlockComponents.forEach((block) => {
691
- block.imageUrl = value;
692
- });
682
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
693
683
  });
694
684
  }
695
685
  }
696
686
  blockRemoveClick() {
697
- if (this.config.blocksRemoved) {
698
- this.config.blocksRemoved(this._service.selectedBlocks)
699
- .pipe(takeUntil(this._destroy$))
687
+ if (this.config.blocksRemove) {
688
+ this._prompt.confirm({
689
+ title: 'Confirm',
690
+ template: 'Are you sure your would like to delete this block?',
691
+ })
692
+ .pipe(switchMap(() => this.config.blocksRemove(this._blockEditor.selectedBlocks)), takeUntil(this._destroy$))
700
693
  .subscribe(() => {
701
- this._service.selectedBlocks.forEach((block) => {
702
- this._service.removeBlock(block);
703
- });
704
- this._service.selectedBlockComponents = [];
705
- });
706
- }
707
- }
708
- blockAddClick() {
709
- const width = (this.config.width * .333).toFixed(2);
710
- const height = (this.config.height * .333).toFixed(2);
711
- const reference = guid();
712
- const block = {
713
- type: 'text',
714
- reference,
715
- top: height,
716
- left: width,
717
- width: width,
718
- height: height,
719
- };
720
- if (this.config.blockAdded) {
721
- this.config.blockAdded(block)
722
- .pipe(takeUntil(this._destroy$))
723
- .subscribe((block) => {
724
- this.addBlock(block);
725
- this.changeDetector.markForCheck();
726
- this.blockAdded
727
- .pipe(take(1), takeUntil(this._destroy$))
728
- .subscribe((blockComponent) => {
729
- this._service.selectedBlockComponents = [blockComponent];
730
- });
694
+ this._blockEditor.removeSelectedBlocks();
731
695
  });
732
696
  }
733
697
  }
734
- addBlock(block) {
735
- this._service.addBlock(block);
736
- this._updateIndexes();
737
- }
738
- _updateIndexes() {
739
- const sort = this.blocks.slice().sort((a, b) => {
740
- return a.index > b.index ? 1 : -1;
698
+ blockUpload(blockType, fsFile) {
699
+ const block = this._blockEditor.sanitizeNewBlock({
700
+ type: blockType,
741
701
  });
742
- sort.forEach((block, index) => {
743
- this.blocks.find((item) => {
744
- return block.reference === item.reference;
745
- }).index = index;
702
+ this._blockEditor.blockUpload(block, fsFile);
703
+ }
704
+ blockAdd(type) {
705
+ if (type === BlockType.Pdf || type === BlockType.Image) {
706
+ return;
707
+ }
708
+ const block = this._blockEditor.sanitizeNewBlock({
709
+ type,
746
710
  });
711
+ this._blockEditor.blockAdd(block);
747
712
  }
748
713
  layerMove(direction) {
749
- this._service.blockComponents.forEach((blockComponent) => {
750
- if (this._service.isSelectedBlock(blockComponent)) {
714
+ this._blockEditor.blockComponents.forEach((blockComponent) => {
715
+ if (this._blockEditor.isSelectedBlock(blockComponent)) {
751
716
  blockComponent.block.index + (999 * direction);
752
717
  }
753
718
  });
754
- const sorted = this._service.blockComponents.sort((a, b) => {
719
+ const sorted = this._blockEditor.blockComponents.sort((a, b) => {
755
720
  return a.index > b.index ? 1 : -1;
756
721
  });
757
722
  sorted.forEach((item, index) => {
@@ -769,7 +734,7 @@ let SidebarComponent = class SidebarComponent {
769
734
  this.layerMove(-1);
770
735
  }
771
736
  getBlock(reference) {
772
- return this._service.blocks.find((block) => {
737
+ return this._blockEditor.blocks.find((block) => {
773
738
  return block.reference === reference;
774
739
  });
775
740
  }
@@ -788,48 +753,50 @@ let SidebarComponent = class SidebarComponent {
788
753
  validNumeric(value) {
789
754
  return !value || !!String(value).match(/^\d*\.?\d*$/);
790
755
  }
791
- };
792
- SidebarComponent.ctorParameters = () => [
793
- { type: ElementRef },
794
- { type: BlockEditorService },
795
- { type: ChangeDetectorRef }
796
- ];
797
- __decorate([
798
- ContentChildren(FsBlockEditorSidebarPanelDirective),
799
- __metadata("design:type", QueryList)
800
- ], SidebarComponent.prototype, "sidebarPanels", void 0);
801
- __decorate([
802
- Input(),
803
- __metadata("design:type", Object)
804
- ], SidebarComponent.prototype, "config", void 0);
805
- __decorate([
806
- Input(),
807
- __metadata("design:type", Object)
808
- ], SidebarComponent.prototype, "blocks", void 0);
809
- __decorate([
810
- Input(),
811
- __metadata("design:type", EventEmitter)
812
- ], SidebarComponent.prototype, "blockAdded", void 0);
813
- SidebarComponent = __decorate([
814
- Component({
815
- selector: 'sidebar',
816
- template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockAddClick()\">\n <mat-icon>add</mat-icon>\n </button>\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n </div>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"fileSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n",
817
- changeDetection: ChangeDetectionStrategy.OnPush,
818
- styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .field-label,.sidebar .sidebar-row ::ng-deep .mat-form-field-prefix{color:#a5a5a5;font-size:11px;margin-right:2px}.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-down ::ng-deep .mat-button-wrapper,.sidebar .layer-up ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.6);top:-6px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .border-width,.sidebar .font-size,.sidebar .line-height,.sidebar .padding{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:-ms-grid;display:grid;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;-moz-column-gap:1px;column-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px;border-bottom:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row{justify-content:space-evenly}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.info-panel .sidebar-row>{margin:0}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}"]
819
- }),
820
- __metadata("design:paramtypes", [ElementRef,
821
- BlockEditorService,
822
- ChangeDetectorRef])
823
- ], SidebarComponent);
756
+ }
757
+ SidebarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i2.FsPrompt }], target: i0.ɵɵFactoryTarget.Component });
758
+ SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, template: "<div class=\"sidebar mat-elevation-z2\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Add</div>\n <div class=\"sidebar-row\">\n <ng-container *ngFor=\"let blockType of BlockTypes\">\n <ng-container [ngSwitch]=\"blockType.value\">\n <ng-container *ngSwitchCase=\"BlockType.Pdf\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container>\n <ng-container *ngSwitchCase=\"BlockType.Image\">\n <ng-container *ngTemplateOutlet=\"addFile\"></ng-container>\n </ng-container> \n <ng-container *ngSwitchDefault>\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </ng-container>\n </ng-container>\n\n <ng-template #addFile>\n <fs-file (select)=\"blockUpload(blockType.value, $event)\" [accept]=\"blockType.accept\">\n <ng-container *ngTemplateOutlet=\"addButton\"></ng-container>\n </fs-file>\n </ng-template>\n\n <ng-template #addButton>\n <button \n type=\"button\"\n mat-icon-button\n [matTooltip]=\"'Add ' + blockType.name\"\n (click)=\"blockAdd(blockType.value)\">\n <mat-icon>{{blockType.icon}}</mat-icon>\n </button>\n </ng-template>\n </ng-container>\n </div>\n </div>\n <ng-container *ngIf=\"block\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Tools</div>\n <div class=\"sidebar-row\">\n <ng-container *ngIf=\"block\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"blockRemoveClick()\">\n <mat-icon>delete_outline</mat-icon>\n </button>\n <button\n class=\"layer-up\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerUp()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n <button\n class=\"layer-down\"\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"layerDown()\">\n <mat-icon>arrow_back</mat-icon>\n <mat-icon>layers</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n <div class=\"sidebar-panel info-panel\">\n <div class=\"sidebar-label\">Info</div>\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.left\"\n name=\"left\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"leftChange($event)\">\n <span matPrefix>X</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.top\"\n name=\"top\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"topChange($event)\">\n <span matPrefix>Y</span>\n </mat-form-field>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.rotate || 0\"\n name=\"rotate\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"rotateChange($event)\">\n <span matPrefix>R</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row\">\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.width\"\n name=\"width\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"widthChange($event)\">\n <span matPrefix>W</span>\n </mat-form-field>\n\n <div>\n <a (click)=\"toggleKeepRatio()\" class=\"keep-ratio\">\n <mat-icon>{{block.keepRatio ? 'lock_outline' : 'lock_open'}}</mat-icon>\n </a>\n </div>\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.height\"\n name=\"height\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"heightChange($event)\">\n <span matPrefix>H</span>\n </mat-form-field>\n </div>\n </div>\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.RadioButton || block.type === BlockType.Checkbox || block.type === BlockType.Date\">\n <div class=\"sidebar-panel form-field-panel\">\n <div class=\"sidebar-label\">{{blockTypeNames[block.type]}} Field</div>\n <div class=\"sidebar-row\">\n\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.name\"\n name=\"name\"\n placeholder=\"Name\"\n (ngModelChange)=\"blockChangeProperty($event, 'name')\">\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <input\n matInput\n [ngModel]=\"block.format\"\n name=\"format\"\n placeholder=\"Format\"\n (ngModelChange)=\"blockChangeProperty($event, 'format')\">\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.formula\"\n name=\"formula\"\n placeholder=\"Formula\"\n (ngModelChange)=\"blockChangeProperty($event, 'formula')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <ng-container *ngIf=\"block.type === BlockType.LongText || block.type === BlockType.ShortText || block.type === BlockType.Date\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.default\"\n name=\"default\"\n placeholder=\"Default\"\n (ngModelChange)=\"blockChangeProperty($event, 'default')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.description\"\n name=\"description\"\n placeholder=\"Description\"\n (ngModelChange)=\"blockChangeProperty($event, 'description')\">\n </textarea>\n </mat-form-field>\n\n <ng-container *ngIf=\"block.type === BlockType.RadioButton || block.type === BlockType.Checkbox\">\n <mat-form-field class=\"form-field-padless full-width\">\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupLabel\"\n name=\"groupLabel\"\n placeholder=\"Group Label\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupLabel')\">\n </textarea>\n </mat-form-field>\n \n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Group Description</mat-label>\n <textarea\n matInput\n [matTextareaAutosize]=\"true\"\n [ngModel]=\"block.groupDescription\"\n name=\"groupDescription\"\n (ngModelChange)=\"blockChangeProperty($event, 'groupDescription')\">\n </textarea>\n </mat-form-field>\n </ng-container>\n\n <mat-form-field class=\"form-field-padless full-width\">\n <mat-label>Index</mat-label>\n <input\n matInput\n [(ngModel)]=\"block.index\"\n name=\"index\"\n (ngModelChange)=\"blockChangeProperty($event, 'index')\">\n </mat-form-field>\n\n <div class=\"form-field-options\">\n <mat-checkbox \n name=\"required\" \n [(ngModel)]=\"block.required\"\n (ngModelChange)=\"blockChangeProperty($event, 'required')\">\n Required\n </mat-checkbox>\n </div>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel typography-panel\">\n <div class=\"sidebar-label\">Typography</div>\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"fontColorChange($event)\"\n [color]=\"block.fontColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless font-size\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.fontSize\"\n name=\"fontSize\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"fontSizeChange($event)\"\n placeholder=\"Size\">\n <span matPrefix *ngIf=\"block.fontSize\">S</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless line-height\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.lineHeight\"\n name=\"lineHeight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"lineHeightChange($event)\"\n placeholder=\"Line\">\n <span matPrefix *ngIf=\"block.lineHeight\">L</span>\n </mat-form-field>\n </div>\n\n <div class=\"sidebar-row style-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.bold }\"\n (click)=\"boldClick()\">\n <mat-icon>format_bold</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.italic }\"\n (click)=\"italicClick()\">\n <mat-icon>format_italic</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.underline }\"\n (click)=\"underlineClick()\">\n <mat-icon>format_underline</mat-icon>\n </button>\n </div>\n\n <div class=\"sidebar-row align-row\">\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'left' }\"\n (click)=\"horizontalAlignClick('left')\">\n <mat-icon>format_align_left</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'center' }\"\n (click)=\"horizontalAlignClick('center')\">\n <mat-icon>format_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.horizontalAlign === 'right' }\"\n (click)=\"horizontalAlignClick('right')\">\n <mat-icon>format_align_right</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'top' }\"\n (click)=\"verticalAlignClick('top')\">\n <mat-icon>vertical_align_top</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'center' }\"\n (click)=\"verticalAlignClick('center')\">\n <mat-icon>vertical_align_center</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: block.verticalAlign === 'bottom' }\"\n (click)=\"verticalAlignClick('bottom')\">\n <mat-icon>vertical_align_bottom</mat-icon>\n </button>\n </div>\n </div>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Border</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"borderColorChange($event)\"\n [color]=\"block.borderColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless border-width\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.borderWidth\"\n name=\"borderWidth\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"borderWidthChange($event)\"\n placeholder=\"Width\">\n <span matPrefix *ngIf=\"block.borderWidth\">W</span>\n </mat-form-field>\n </div>\n </div>\n\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Shape</div>\n\n <div class=\"sidebar-row\">\n <fs-color-picker-chip\n (changed)=\"backgroundColorChange($event)\"\n [color]=\"block.backgroundColor\">\n </fs-color-picker-chip>\n\n <mat-form-field class=\"form-field-padless shape-radius\" floatLabel=\"never\">\n <input\n matInput\n [(ngModel)]=\"block.shapeRadius\"\n name=\"shapeRadius\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"shapeRadiusChange($event)\"\n placeholder=\"Radius\">\n <span matPrefix *ngIf=\"block.shapeRadius\">R</span>\n </mat-form-field>\n\n <div class=\"shape-corners\">\n <div\n class=\"shape-corner shape-corner-top-left\"\n [ngClass]=\"{ round: block.shapeTopLeft === 'round' }\"\n (click)=\"shapeRound('shapeTopLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-top-right\"\n [ngClass]=\"{ round: block.shapeTopRight === 'round' }\"\n (click)=\"shapeRound('shapeTopRight')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-left\"\n [ngClass]=\"{ round: block.shapeBottomLeft === 'round' }\"\n (click)=\"shapeRound('shapeBottomLeft')\"></div>\n <div\n class=\"shape-corner shape-corner-bottom-right\"\n [ngClass]=\"{ round: block.shapeBottomRight === 'round' }\"\n (click)=\"shapeRound('shapeBottomRight')\"></div>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"block.type !== BlockType.Pdf\">\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Image</div>\n <div class=\"sidebar-row image-row\">\n <fs-file (select)=\"imageSelect($event)\">\n <button type=\"button\" mat-icon-button><mat-icon>cloud_upload</mat-icon></button>\n </fs-file>\n <ng-container *ngIf=\"block.imageUrl\">\n <button\n mat-icon-button\n color=\"basic\"\n type=\"button\"\n (click)=\"imageRemove()\">\n <mat-icon>clear</mat-icon>\n </button>\n <button\n mat-icon-button\n class=\"toggle-button\"\n color=\"basic\"\n type=\"button\"\n [ngClass]=\"{ selected: clippable }\"\n (click)=\"imageClip()\">\n <mat-icon>crop</mat-icon>\n </button>\n </ng-container>\n </div>\n </div>\n </ng-container>\n <div class=\"sidebar-panel\">\n <div class=\"sidebar-label\">Padding</div>\n <div class=\"sidebar-row padding-row\">\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.padding\"\n name=\"padding\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingAllChange($event)\"\n placeholder=\"All\">\n <span matPrefix *ngIf=\"block.padding\">A</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingTop\"\n name=\"paddingTop\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingTop',$event)\"\n placeholder=\"Top\">\n <span matPrefix *ngIf=\"block.paddingTop\">T</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingBottom\"\n name=\"paddingBottom\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingBottom',$event)\"\n placeholder=\"Bottom\">\n <span matPrefix *ngIf=\"block.paddingBottom\">B</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingLeft\"\n name=\"paddingLeft\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingLeft',$event)\"\n placeholder=\"Left\">\n <span matPrefix *ngIf=\"block.paddingLeft\">L</span>\n </mat-form-field>\n\n <mat-form-field class=\"form-field-padless\" floatLabel=\"never\">\n <input\n matInput\n [ngModel]=\"block.paddingRight\"\n name=\"paddingRight\"\n (focus)=\"inputFocus($event)\"\n (ngModelChange)=\"paddingChange('paddingRight',$event)\"\n placeholder=\"Right\">\n <span matPrefix *ngIf=\"block.paddingRight\">R</span>\n </mat-form-field>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngFor=\"let sidebarPanel of sidebarPanels\">\n <div div class=\"sidebar-panel\" *ngIf=\"sidebarPanel.show\">\n <div class=\"sidebar-label\">{{sidebarPanel.label}}</div>\n <ng-container\n [ngTemplateOutlet]=\"sidebarPanel.templateRef\"\n [ngTemplateOutletContext]=\"{ block: block }\"></ng-container>\n </div>\n </ng-container>\n</div>\n\n", styles: [".sidebar{width:285px;font-size:14px;height:100%}.sidebar .sidebar-row{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center}.sidebar .sidebar-row fs-color-picker-chip{margin-left:6px}.sidebar .sidebar-row.padding-row{flex-wrap:unset}.sidebar .sidebar-row.padding-row ::ng-deep .mat-form-field{width:20%;min-width:0}.sidebar .sidebar-row.image-row{margin-bottom:-5px}.sidebar .sidebar-row ::ng-deep .mat-checkbox,.sidebar .sidebar-row ::ng-deep .mat-form-field{font-size:12px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file){margin-right:11px}.sidebar .sidebar-row>*:not(.mat-icon-button):not(fs-file):last-child{margin-right:0}.sidebar .layer-up ::ng-deep .mat-button-wrapper,.sidebar .layer-down ::ng-deep .mat-button-wrapper{position:relative}.sidebar .layer-up ::ng-deep .mat-button-wrapper mat-icon:first-child,.sidebar .layer-down ::ng-deep .mat-button-wrapper mat-icon:first-child{position:absolute;transform:rotate(90deg) scale(.5);top:-7px;color:#fff}.sidebar .layer-down mat-icon:first-child{transform:rotate(270deg) scale(.6)}.sidebar .padding{width:45px}.sidebar .line-height,.sidebar .font-size,.sidebar .border-width{width:45px}.sidebar .shape-radius{width:50px}.sidebar .shape-corners{display:grid;grid-template-columns:1fr 1fr;grid-column-gap:1px;column-gap:1px;grid-row-gap:1px;row-gap:1px}.sidebar .shape-corners .shape-corner{height:13px;width:13px;background-color:#ccc;cursor:pointer}.sidebar .shape-corners .shape-corner.round.shape-corner-top-right{border-top-right-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-top-left{border-top-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-left{border-bottom-left-radius:50%}.sidebar .shape-corners .shape-corner.round.shape-corner-bottom-right{border-bottom-right-radius:50%}.sidebar button.toggle-button:not(.selected) mat-icon{color:#ccc}.sidebar .sidebar-panel{padding:10px}.sidebar .sidebar-panel+.sidebar-panel{border-top:1px solid #dadada}.sidebar .sidebar-panel.info-panel .sidebar-row .mat-form-field{width:41px}.sidebar .sidebar-panel.typography-panel .style-row{margin-bottom:-10px}.sidebar .sidebar-panel.typography-panel .align-row{margin-bottom:-5px}.sidebar .sidebar-panel .sidebar-label{font-size:11px;margin-bottom:3px;color:#9e9e9e}.sidebar .sidebar-panel .keep-ratio{color:inherit;transform:scale(.85);display:block}.full-width{width:100%}\n"], components: [{ type: i3.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }, { type: i4.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex", "aria-label", "aria-labelledby", "id", "labelPosition", "name", "required", "checked", "disabled", "indeterminate", "aria-describedby", "value"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { type: i8.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }], directives: [{ type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i9.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i9.NgSwitchDefault, selector: "[ngSwitchDefault]" }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i12.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i6.MatPrefix, selector: "[matPrefix]" }, { type: i11.MatTextareaAutosize, selector: "textarea[mat-autosize], textarea[matTextareaAutosize]", inputs: ["cdkAutosizeMinRows", "cdkAutosizeMaxRows", "matAutosizeMinRows", "matAutosizeMaxRows", "mat-autosize", "matTextareaAutosize"], exportAs: ["matTextareaAutosize"] }, { type: i6.MatLabel, selector: "mat-label" }, { type: i9.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
760
+ type: Component,
761
+ args: [{
762
+ selector: 'sidebar',
763
+ templateUrl: 'sidebar.component.html',
764
+ styleUrls: ['sidebar.component.scss'],
765
+ changeDetection: ChangeDetectionStrategy.OnPush,
766
+ }]
767
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
768
+ type: ContentChildren,
769
+ args: [FsBlockEditorSidebarPanelDirective]
770
+ }], config: [{
771
+ type: Input
772
+ }], blocks: [{
773
+ type: Input
774
+ }] } });
775
+
776
+ class FsBlockEditorMarginDirective {
777
+ constructor(_elementRef) {
778
+ this._elementRef = _elementRef;
779
+ }
780
+ get element() {
781
+ return this._elementRef.nativeElement;
782
+ }
783
+ }
784
+ FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
785
+ FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
786
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
787
+ type: Directive,
788
+ args: [{
789
+ selector: '[fsBlockEditorMargin]'
790
+ }]
791
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
824
792
 
825
- let FsBlockEditorComponent = class FsBlockEditorComponent {
826
- constructor(_el, _service, _cdRef, _differs) {
793
+ class ArtboardComponent {
794
+ constructor(_el, _blockEditor, _cdRef, _differs) {
827
795
  this._el = _el;
828
- this._service = _service;
796
+ this._blockEditor = _blockEditor;
829
797
  this._cdRef = _cdRef;
830
798
  this._differs = _differs;
831
- this.blockAdded = new EventEmitter();
832
- this.blockRemoved = new EventEmitter();
799
+ this.blocks = [];
833
800
  this._destroy$ = new Subject();
834
801
  this._differ = _differs.find([]).create(null);
835
802
  }
@@ -838,23 +805,29 @@ let FsBlockEditorComponent = class FsBlockEditorComponent {
838
805
  }
839
806
  ngOnInit() {
840
807
  this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
841
- this._service.registerContainer(this.artboard.nativeElement);
842
- this._service.registerMargin(this.marginContainer.nativeElement);
843
- this._service.blocks = this.config.blocks;
844
- this._service.config = this.config;
845
- this._service.blocks$
808
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
809
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
810
+ this._blockEditor.blocks$
846
811
  .pipe(takeUntil(this._destroy$))
847
812
  .subscribe((blocks) => {
848
813
  this.blocks = blocks;
814
+ this._cdRef.markForCheck();
815
+ });
816
+ this._blockEditor.blockAdded$
817
+ .pipe(delay(300), takeUntil(this._destroy$))
818
+ .subscribe((block) => {
819
+ this._blockEditor.selectedBlocks = [block];
820
+ this._cdRef.markForCheck();
849
821
  });
850
822
  fromEvent(window, 'keydown')
851
823
  .pipe(takeUntil(this._destroy$), filter((event) => {
852
- return !!event.key.match(/^Arrow/) && !!this._service.selectedBlockComponents.length;
824
+ return !!event.key.match(/^Arrow/) && !!this._blockEditor.selectedBlocks.length;
853
825
  }))
854
826
  .subscribe((event) => {
855
827
  event.preventDefault();
856
828
  const inchPixel = 1 / 100;
857
- this._service.selectedBlockComponents.forEach((blockComponent) => {
829
+ this._blockEditor.selectedComponentBlocks
830
+ .forEach((blockComponent) => {
858
831
  switch (event.key) {
859
832
  case 'ArrowUp':
860
833
  blockComponent.top = blockComponent.block.top - inchPixel;
@@ -872,145 +845,211 @@ let FsBlockEditorComponent = class FsBlockEditorComponent {
872
845
  });
873
846
  });
874
847
  }
875
- artboardClick(event) {
876
- if (event.target.isSameNode(this.artboard.nativeElement) ||
877
- event.target.isSameNode(this.artboardContainer.nativeElement)) {
878
- this._service.selectedBlockComponents.forEach((block) => {
879
- block.deselect();
880
- block.markForCheck();
881
- });
882
- this._service.selectedBlockComponents = [];
883
- }
884
- }
885
848
  blockChanged(block) {
886
- this.sidebar.changeDetector.markForCheck();
887
849
  if (this.config.blockChanged) {
888
850
  this.config.blockChanged(block);
889
851
  }
890
852
  }
891
853
  ngAfterViewInit() {
892
- this.blockComponents.changes.subscribe((changes) => {
893
- const changeDiff = this._differ.diff(changes);
894
- if (changeDiff) {
895
- changeDiff.forEachAddedItem((change) => {
896
- this.blockAdded.emit(change.item);
897
- });
898
- changeDiff.forEachRemovedItem((change) => {
899
- this.blockRemoved.emit(change.item);
900
- });
901
- }
854
+ // this.blockComponents.changes
855
+ // .pipe(
856
+ // takeUntil(this._destroy$),
857
+ // )
858
+ // .subscribe((changes) => {
859
+ // const changeDiff = this._differ.diff(changes);
860
+ // if (changeDiff) {
861
+ // changeDiff.forEachAddedItem((change) => {
862
+ // //this.blockAdded.emit(change.item);
863
+ // });
864
+ // changeDiff.forEachRemovedItem((change) => {
865
+ // //this.blockRemoved.emit(change.item);
866
+ // });
867
+ // }
868
+ // });
869
+ }
870
+ ngOnDestroy() {
871
+ this._destroy$.next();
872
+ this._destroy$.complete();
873
+ }
874
+ }
875
+ ArtboardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
876
+ ArtboardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ArtboardComponent, selector: "app-artboard", inputs: { config: "config", zoompan: "zoompan" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "artboard", first: true, predicate: ["artboard"], descendants: true, static: true }, { propertyName: "marginContainer", first: true, predicate: ["marginContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "blockComponents", predicate: FsBlockComponent, descendants: true }, { propertyName: "margins", predicate: FsBlockEditorMarginDirective, descendants: true }], ngImport: i0, template: "<div\n #artboard\n class=\"artboard mat-elevation-z4 deselectable\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks\"\n [zoompan]=\"zoompan\"\n [block]=\"block\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\">\n </div>\n</div> \n\n", styles: [".artboard{position:relative;display:inline-flex}.artboard .margin-container{position:absolute;z-index:-1}.artboard .margin{position:absolute;border-color:#ff85bd5e;border-style:dashed;border-width:0px}.artboard .margin.margin-top,.artboard .margin.margin-bottom{width:100%;border-top-width:1px}.artboard .margin.margin-left,.artboard .margin.margin-right{height:100%;border-left-width:1px}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html", "zoompan"] }], directives: [{ type: i9.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i9.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
877
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ArtboardComponent, decorators: [{
878
+ type: Component,
879
+ args: [{
880
+ selector: 'app-artboard',
881
+ templateUrl: 'artboard.component.html',
882
+ styleUrls: ['artboard.component.scss'],
883
+ changeDetection: ChangeDetectionStrategy.OnPush,
884
+ }]
885
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
886
+ type: ContentChildren,
887
+ args: [FsBlockEditorSidebarPanelDirective]
888
+ }], blockComponents: [{
889
+ type: ViewChildren,
890
+ args: [FsBlockComponent]
891
+ }], artboard: [{
892
+ type: ViewChild,
893
+ args: ['artboard', { static: true }]
894
+ }], marginContainer: [{
895
+ type: ViewChild,
896
+ args: ['marginContainer', { static: true }]
897
+ }], margins: [{
898
+ type: ViewChildren,
899
+ args: [FsBlockEditorMarginDirective]
900
+ }], sidebar: [{
901
+ type: ViewChild,
902
+ args: [SidebarComponent, { static: true }]
903
+ }], config: [{
904
+ type: Input
905
+ }], zoompan: [{
906
+ type: Input
907
+ }] } });
908
+
909
+ class FsBlockEditorComponent {
910
+ constructor(_el, _blockEditor) {
911
+ this._el = _el;
912
+ this._blockEditor = _blockEditor;
913
+ this._destroy$ = new Subject();
914
+ }
915
+ get el() {
916
+ return this._el.nativeElement;
917
+ }
918
+ ngOnInit() {
919
+ this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
920
+ this._blockEditor.blocks = this.config.blocks;
921
+ this._blockEditor.config = this.config;
922
+ this._blockEditor.blocks$
923
+ .pipe(takeUntil(this._destroy$))
924
+ .subscribe((blocks) => {
925
+ this.blocks = blocks;
926
+ });
927
+ setTimeout(() => {
928
+ this.zoompan.center(this.artboard.nativeElement, { vertical: false });
902
929
  });
903
930
  }
931
+ artboardClick(event) {
932
+ if (event.target.classList.contains('deselectable')) {
933
+ this.zoompan.enable();
934
+ this._blockEditor.selectedBlocks = [];
935
+ }
936
+ }
904
937
  ngOnDestroy() {
905
938
  this._destroy$.next();
906
939
  this._destroy$.complete();
907
940
  }
908
- };
909
- FsBlockEditorComponent.ctorParameters = () => [
910
- { type: ElementRef },
911
- { type: BlockEditorService },
912
- { type: ChangeDetectorRef },
913
- { type: IterableDiffers }
914
- ];
915
- __decorate([
916
- ContentChildren(FsBlockEditorSidebarPanelDirective),
917
- __metadata("design:type", QueryList)
918
- ], FsBlockEditorComponent.prototype, "sidebarPanels", void 0);
919
- __decorate([
920
- ViewChildren(FsBlockComponent),
921
- __metadata("design:type", QueryList)
922
- ], FsBlockEditorComponent.prototype, "blockComponents", void 0);
923
- __decorate([
924
- ViewChild('artboard', { static: true }),
925
- __metadata("design:type", ElementRef)
926
- ], FsBlockEditorComponent.prototype, "artboard", void 0);
927
- __decorate([
928
- ViewChild('marginContainer', { static: true }),
929
- __metadata("design:type", ElementRef)
930
- ], FsBlockEditorComponent.prototype, "marginContainer", void 0);
931
- __decorate([
932
- ViewChildren(FsBlockEditorMarginDirective),
933
- __metadata("design:type", QueryList)
934
- ], FsBlockEditorComponent.prototype, "margins", void 0);
935
- __decorate([
936
- ViewChild('artboardContainer', { static: true }),
937
- __metadata("design:type", ElementRef)
938
- ], FsBlockEditorComponent.prototype, "artboardContainer", void 0);
939
- __decorate([
940
- ViewChild(SidebarComponent, { static: true }),
941
- __metadata("design:type", SidebarComponent)
942
- ], FsBlockEditorComponent.prototype, "sidebar", void 0);
943
- __decorate([
944
- Input(),
945
- __metadata("design:type", Object)
946
- ], FsBlockEditorComponent.prototype, "config", void 0);
947
- __decorate([
948
- Output(),
949
- __metadata("design:type", Object)
950
- ], FsBlockEditorComponent.prototype, "blockAdded", void 0);
951
- __decorate([
952
- Output(),
953
- __metadata("design:type", Object)
954
- ], FsBlockEditorComponent.prototype, "blockRemoved", void 0);
955
- FsBlockEditorComponent = __decorate([
956
- Component({
957
- selector: 'fs-block-editor',
958
- template: "<div class=\"editor-container\">\n <div\n #artboardContainer\n class=\"artboard-container\"\n (click)=\"artboardClick($event)\">\n <div\n #artboard\n class=\"artboard mat-elevation-z2\"\n [style.width]=\"config.width + config.unit\"\n [style.height]=\"config.height + config.unit\">\n <fs-block\n *ngFor=\"let block of blocks; trackBy\"\n [block]=\"block\"\n (changed)=\"blockChanged($event)\">\n </fs-block>\n <div class=\"margin margin-top\" *ngIf=\"config.marginTop\" [style.top]=\"config.marginTop + 'in'\"></div>\n <div class=\"margin margin-left\" *ngIf=\"config.marginLeft\" [style.left]=\"config.marginLeft + 'in'\"></div>\n <div class=\"margin margin-bottom\" *ngIf=\"config.marginBottom\" [style.bottom]=\"config.marginBottom + 'in'\"></div>\n <div class=\"margin margin-right\" *ngIf=\"config.marginRight\" [style.right]=\"config.marginRight + 'in'\"></div>\n <div\n #marginContainer\n class=\"margin-container\"\n [style.top]=\"config.marginTop + 'in'\"\n [style.right]=\"config.marginRight + 'in'\"\n [style.bottom]=\"config.marginBottom + 'in'\"\n [style.left]=\"config.marginLeft + 'in'\"></div>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\"\n [blockAdded]=\"blockAdded\">\n </sidebar>\n</div>\n",
959
- changeDetection: ChangeDetectionStrategy.OnPush,
960
- providers: [
961
- BlockEditorService,
962
- ],
963
- styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;justify-content:center;padding:25px;overflow:auto;min-width:0}.editor-container .artboard-container .artboard{position:relative}.editor-container .artboard-container .artboard .margin-container{position:absolute;z-index:-1}.editor-container .artboard-container .artboard .margin{position:absolute;border:0 dashed #ff85bd5e}.editor-container .artboard-container .artboard .margin.margin-bottom,.editor-container .artboard-container .artboard .margin.margin-top{width:100%;border-top-width:1px}.editor-container .artboard-container .artboard .margin.margin-left,.editor-container .artboard-container .artboard .margin.margin-right{height:100%;border-left-width:1px}"]
964
- }),
965
- __metadata("design:paramtypes", [ElementRef,
941
+ }
942
+ FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }], target: i0.ɵɵFactoryTarget.Component });
943
+ FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, providers: [
966
944
  BlockEditorService,
967
- ChangeDetectorRef,
968
- IterableDiffers])
969
- ], FsBlockEditorComponent);
945
+ ], queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], viewQueries: [{ propertyName: "zoompan", first: true, predicate: FsZoomPanComponent, descendants: true, static: true }, { propertyName: "artboardContainer", first: true, predicate: ["artboardContainer"], descendants: true, static: true }, { propertyName: "sidebar", first: true, predicate: SidebarComponent, descendants: true, static: true }, { propertyName: "artboard", first: true, predicate: ArtboardComponent, descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"editor-container deselectable\">\n <div\n #artboardContainer\n class=\"artboard-container deselectable\"\n (mousedown)=\"artboardClick($event)\">\n <div #zoomPanContaner class=\"zoom-pan-container deselectable\">\n <fs-zoom-pan \n [zoomMax]=\"5\"\n [top]=\"10\">\n <ng-template fsZoomPanContent>\n <app-artboard \n [zoompan]=\"zoompan\"\n [config]=\"config\">\n </app-artboard>\n </ng-template>\n </fs-zoom-pan>\n </div>\n </div>\n <sidebar\n [config]=\"config\"\n [blocks]=\"blocks\">\n </sidebar>\n</div>\n", styles: [".editor-container{display:flex;flex-direction:row;position:relative}.editor-container .artboard-container{display:flex;flex-grow:1;min-width:0}.editor-container .zoom-pan-container{flex:1}\n"], components: [{ type: i2$1.FsZoomPanComponent, selector: "fs-zoom-pan", inputs: ["zoomMax", "zoomMin", "zoomDefault", "top", "left"], outputs: ["moved", "zoomed"] }, { type: ArtboardComponent, selector: "app-artboard", inputs: ["config", "zoompan"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks"] }], directives: [{ type: i2$1.FsZoomPanContentDirective, selector: "[fsZoomPanContent]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
946
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
947
+ type: Component,
948
+ args: [{
949
+ selector: 'fs-block-editor',
950
+ templateUrl: 'block-editor.component.html',
951
+ styleUrls: ['block-editor.component.scss'],
952
+ changeDetection: ChangeDetectionStrategy.OnPush,
953
+ providers: [
954
+ BlockEditorService,
955
+ ]
956
+ }]
957
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }]; }, propDecorators: { sidebarPanels: [{
958
+ type: ContentChildren,
959
+ args: [FsBlockEditorSidebarPanelDirective]
960
+ }], zoompan: [{
961
+ type: ViewChild,
962
+ args: [FsZoomPanComponent, { static: true }]
963
+ }], artboardContainer: [{
964
+ type: ViewChild,
965
+ args: ['artboardContainer', { static: true }]
966
+ }], sidebar: [{
967
+ type: ViewChild,
968
+ args: [SidebarComponent, { static: true }]
969
+ }], artboard: [{
970
+ type: ViewChild,
971
+ args: [ArtboardComponent, { read: ElementRef }]
972
+ }], config: [{
973
+ type: Input
974
+ }] } });
970
975
 
971
- var FsBlockEditorModule_1;
972
- let FsBlockEditorModule = FsBlockEditorModule_1 = class FsBlockEditorModule {
976
+ class FsBlockEditorModule {
973
977
  static forRoot() {
974
978
  return {
975
- ngModule: FsBlockEditorModule_1,
979
+ ngModule: FsBlockEditorModule,
976
980
  };
977
981
  }
978
- };
979
- FsBlockEditorModule = FsBlockEditorModule_1 = __decorate([
980
- NgModule({
981
- imports: [
982
+ }
983
+ FsBlockEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
984
+ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, declarations: [FsBlockComponent,
985
+ FsBlockEditorComponent,
986
+ FsBlockEditorSidebarPanelDirective,
987
+ FsBlockEditorMarginDirective,
988
+ SidebarComponent,
989
+ ArtboardComponent], imports: [CommonModule,
990
+ FormsModule,
991
+ MatIconModule,
992
+ MatButtonModule,
993
+ MatInputModule,
994
+ MatFormFieldModule,
995
+ MatCheckboxModule,
996
+ MatTooltipModule,
997
+ FsFileModule,
998
+ FsColorPickerModule,
999
+ FsMenuModule,
1000
+ FsZoomPanModule], exports: [FsBlockComponent,
1001
+ FsBlockEditorComponent,
1002
+ FsBlockEditorSidebarPanelDirective] });
1003
+ FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, imports: [[
982
1004
  CommonModule,
983
1005
  FormsModule,
984
1006
  MatIconModule,
985
1007
  MatButtonModule,
986
1008
  MatInputModule,
987
1009
  MatFormFieldModule,
988
- FsHtmlEditorModule,
1010
+ MatCheckboxModule,
1011
+ MatTooltipModule,
989
1012
  FsFileModule,
990
1013
  FsColorPickerModule,
991
- ],
992
- exports: [
993
- FsBlockComponent,
994
- FsBlockEditorComponent,
995
- FsBlockEditorSidebarPanelDirective,
996
- ],
997
- declarations: [
998
- FsBlockComponent,
999
- FsBlockEditorComponent,
1000
- FsBlockEditorSidebarPanelDirective,
1001
- FsBlockEditorMarginDirective,
1002
- SidebarComponent,
1003
- ],
1004
- })
1005
- ], FsBlockEditorModule);
1006
-
1007
- /*
1008
- * Public API Surface of fs-menu
1009
- */
1014
+ FsMenuModule,
1015
+ FsZoomPanModule,
1016
+ ]] });
1017
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
1018
+ type: NgModule,
1019
+ args: [{
1020
+ imports: [
1021
+ CommonModule,
1022
+ FormsModule,
1023
+ MatIconModule,
1024
+ MatButtonModule,
1025
+ MatInputModule,
1026
+ MatFormFieldModule,
1027
+ MatCheckboxModule,
1028
+ MatTooltipModule,
1029
+ FsFileModule,
1030
+ FsColorPickerModule,
1031
+ FsMenuModule,
1032
+ FsZoomPanModule,
1033
+ ],
1034
+ exports: [
1035
+ FsBlockComponent,
1036
+ FsBlockEditorComponent,
1037
+ FsBlockEditorSidebarPanelDirective,
1038
+ ],
1039
+ declarations: [
1040
+ FsBlockComponent,
1041
+ FsBlockEditorComponent,
1042
+ FsBlockEditorSidebarPanelDirective,
1043
+ FsBlockEditorMarginDirective,
1044
+ SidebarComponent,
1045
+ ArtboardComponent,
1046
+ ],
1047
+ }]
1048
+ }] });
1010
1049
 
1011
1050
  /**
1012
1051
  * Generated bundle index. Do not edit.
1013
1052
  */
1014
1053
 
1015
- export { FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective, BlockEditorService as ɵa, FsBlockEditorMarginDirective as ɵb, SidebarComponent as ɵc };
1054
+ export { BlockType, BlockTypes, FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
1016
1055
  //# sourceMappingURL=firestitch-block-editor.js.map