@firestitch/block-editor 12.0.1 → 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 (33) hide show
  1. package/app/components/artboard/artboard.component.d.ts +35 -0
  2. package/app/components/block/block.component.d.ts +18 -33
  3. package/app/components/block-editor/block-editor.component.d.ts +8 -18
  4. package/app/components/sidebar/sidebar.component.d.ts +27 -13
  5. package/app/consts/block-types.const.d.ts +12 -0
  6. package/app/consts/index.d.ts +1 -0
  7. package/app/enums/block-type.enum.d.ts +11 -0
  8. package/app/enums/index.d.ts +1 -0
  9. package/app/fs-block-editor.module.d.ts +14 -9
  10. package/app/interfaces/block-editor-config.d.ts +9 -7
  11. package/app/interfaces/block.d.ts +12 -1
  12. package/app/services/block-editor.service.d.ts +31 -14
  13. package/app/services/index.d.ts +1 -0
  14. package/bundles/firestitch-block-editor.umd.js +593 -561
  15. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  16. package/esm2015/app/components/artboard/artboard.component.js +129 -0
  17. package/esm2015/app/components/block/block.component.js +135 -197
  18. package/esm2015/app/components/block-editor/block-editor.component.js +28 -89
  19. package/esm2015/app/components/sidebar/sidebar.component.js +109 -169
  20. package/esm2015/app/consts/block-types.const.js +13 -0
  21. package/esm2015/app/consts/index.js +2 -0
  22. package/esm2015/app/enums/block-type.enum.js +13 -0
  23. package/esm2015/app/enums/index.js +2 -0
  24. package/esm2015/app/fs-block-editor.module.js +22 -3
  25. package/esm2015/app/interfaces/block-editor-config.js +1 -1
  26. package/esm2015/app/interfaces/block.js +1 -1
  27. package/esm2015/app/services/block-editor.service.js +132 -25
  28. package/esm2015/app/services/index.js +2 -0
  29. package/esm2015/public_api.js +3 -4
  30. package/fesm2015/firestitch-block-editor.js +530 -457
  31. package/fesm2015/firestitch-block-editor.js.map +1 -1
  32. package/package.json +3 -2
  33. package/public_api.d.ts +2 -0
@@ -1,81 +1,181 @@
1
- import * as i9 from '@angular/forms';
1
+ import * as i12 from '@angular/forms';
2
2
  import { FormsModule } from '@angular/forms';
3
- import * as i8 from '@angular/material/input';
3
+ import * as i11 from '@angular/material/input';
4
4
  import { MatInputModule } from '@angular/material/input';
5
5
  import * as i0 from '@angular/core';
6
- import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, ViewChild, Input, Output, Directive, ContentChildren, ViewChildren, NgModule } from '@angular/core';
7
- import * as i7 from '@angular/common';
6
+ import { Injectable, Component, ChangeDetectionStrategy, ViewChild, Input, Directive, ContentChildren, ViewChildren, ElementRef, NgModule } from '@angular/core';
7
+ import * as i9 from '@angular/common';
8
8
  import { CommonModule } from '@angular/common';
9
- import * as i2 from '@angular/material/button';
9
+ import * as i4 from '@angular/material/button';
10
10
  import { MatButtonModule } from '@angular/material/button';
11
- import * as i4 from '@angular/material/form-field';
11
+ import * as i6 from '@angular/material/form-field';
12
12
  import { MatFormFieldModule } from '@angular/material/form-field';
13
- import * as i3 from '@angular/material/icon';
13
+ import * as i5 from '@angular/material/icon';
14
14
  import { MatIconModule } from '@angular/material/icon';
15
- import * as i5 from '@firestitch/colorpicker';
15
+ import * as i8 from '@firestitch/colorpicker';
16
16
  import { FsColorPickerModule } from '@firestitch/colorpicker';
17
- import * as i6 from '@firestitch/file';
17
+ import * as i3 from '@firestitch/file';
18
18
  import { FsFileModule } from '@firestitch/file';
19
- 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';
20
23
  import Moveable from 'moveable';
21
- import { BehaviorSubject, Subject, fromEvent } from 'rxjs';
22
- 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';
23
31
 
24
32
  class BlockEditorService {
25
33
  constructor() {
26
- this.blockComponents = [];
34
+ this._blockChanged$ = new Subject();
35
+ this._blockRemoved$ = new Subject();
36
+ this._blockAdded$ = new Subject();
27
37
  this._blocks$ = new BehaviorSubject([]);
28
- this._selectedBlockComponents$ = new BehaviorSubject([]);
38
+ this._selectedBlocks$ = new BehaviorSubject([]);
39
+ this._blockComponents = new Map();
40
+ this._destroy$ = new Subject();
29
41
  }
30
42
  get elementGuidelines() {
31
43
  return [
32
- ...this.blockComponents.map((block) => {
44
+ ...Array.from(this._blockComponents.values())
45
+ .map((block) => {
33
46
  return block.el;
34
47
  }),
35
48
  this.container,
36
49
  this.margin,
37
50
  ];
38
51
  }
39
- addBlock(block) {
40
- 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
+ }
41
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
+ // }
42
103
  removeBlock(block) {
43
104
  const index = this.indexOf(block);
44
105
  if (index !== -1) {
45
- this.blocks.splice(index, 1);
46
- this.blocks$.next(this.blocks);
106
+ const blocks = this.blocks;
107
+ blocks.splice(index, 1);
108
+ this.blocks = blocks;
109
+ this._blockRemoved$.next(block);
47
110
  }
48
111
  }
112
+ removeSelectedBlocks() {
113
+ this.selectedBlocks.forEach((block) => {
114
+ this.removeBlock(block);
115
+ });
116
+ this.selectedBlocks = [];
117
+ }
49
118
  get blocks$() {
50
119
  return this._blocks$;
51
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
+ }
52
136
  get blocks() {
53
- return this.blocks$.getValue();
137
+ return this._blocks$.getValue();
54
138
  }
55
139
  set blocks(blocks) {
56
140
  this._blocks$.next(blocks);
57
141
  }
58
142
  isSelectedBlock(block) {
59
- return this.selectedBlockComponents.indexOf(block) !== -1;
143
+ return this.selectedBlocks.indexOf(block) !== -1;
60
144
  }
61
145
  indexOf(block) {
62
146
  return this.blocks.map((e) => e.reference).indexOf(block.reference);
63
147
  }
64
- set selectedBlockComponents(blocks) {
65
- this.blockComponents.forEach((block) => {
66
- block.editable = false;
67
- block.transformable = blocks.indexOf(block) !== -1;
148
+ selectedBlockComponentChangeProperty(value, name) {
149
+ this.selectedBlocks
150
+ .forEach((block) => {
151
+ block[name] = value;
152
+ this.blockChange(block);
68
153
  });
69
- this._selectedBlockComponents$.next(blocks);
70
154
  }
71
- get selectedBlockComponents() {
72
- return this._selectedBlockComponents$.getValue();
155
+ get selectedBlocks$() {
156
+ return this._selectedBlocks$;
73
157
  }
74
- get selectedBlocks() {
75
- return this.selectedBlockComponents.map((blockComponent) => blockComponent.block);
158
+ set selectedBlock(block) {
159
+ this.selectedBlocks = [block];
76
160
  }
77
- get selectedBlockComponents$() {
78
- 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();
79
179
  }
80
180
  saveSelection() {
81
181
  const selection = window.getSelection();
@@ -91,7 +191,8 @@ class BlockEditorService {
91
191
  hasSelectionRange() {
92
192
  return this._selectionRange && (this._selectionRange.baseOffset - this._selectionRange.focusOffset) > 0;
93
193
  }
94
- registerBlock(block) {
194
+ registerBlock(block, blockComponent) {
195
+ this._blockComponents.set(block, blockComponent);
95
196
  this.blockComponents.push(block);
96
197
  this.blockComponents.forEach((item) => {
97
198
  const blocks = this.elementGuidelines
@@ -101,29 +202,55 @@ class BlockEditorService {
101
202
  item.elementGuidelines = blocks;
102
203
  });
103
204
  }
205
+ unregisterBlock(block) {
206
+ this._blockComponents.delete(block);
207
+ }
104
208
  registerContainer(container) {
105
209
  this.container = container;
106
210
  }
107
211
  registerMargin(margin) {
108
212
  this.margin = margin;
109
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
+ }
110
219
  sanitizeBlock(block) {
111
- 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() });
221
+ }
222
+ ngOnDestroy() {
223
+ this._destroy$.next();
224
+ this._destroy$.complete();
112
225
  }
113
226
  }
114
227
  BlockEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
115
228
  BlockEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService });
116
229
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: BlockEditorService, decorators: [{
117
230
  type: Injectable
118
- }], ctorParameters: function () { return []; } });
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 = {}));
119
245
 
120
246
  class FsBlockComponent {
121
- constructor(_service, _elementRef, _cdRef) {
122
- this._service = _service;
247
+ constructor(_blockEditor, _elementRef, _cdRef) {
248
+ this._blockEditor = _blockEditor;
123
249
  this._elementRef = _elementRef;
124
250
  this._cdRef = _cdRef;
125
- this.changed = new EventEmitter();
251
+ this.BlockType = BlockType;
126
252
  this._editable = false;
253
+ this._transformable = false;
127
254
  this._destroy$ = new Subject();
128
255
  }
129
256
  get el() {
@@ -136,7 +263,7 @@ class FsBlockComponent {
136
263
  return this._editable;
137
264
  }
138
265
  set elementGuidelines(value) {
139
- this._moveable.elementGuidelines = value;
266
+ this.moveable.elementGuidelines = value;
140
267
  }
141
268
  set editable(value) {
142
269
  this._editable = value;
@@ -145,7 +272,7 @@ class FsBlockComponent {
145
272
  }
146
273
  }
147
274
  set clippable(value) {
148
- this._moveable.clippable = value;
275
+ this.moveable.clippable = value;
149
276
  }
150
277
  get transformable() {
151
278
  return this._transformable;
@@ -154,198 +281,131 @@ class FsBlockComponent {
154
281
  this._transformable = value;
155
282
  this.moveable.draggable = value;
156
283
  this.moveable.resizable = value;
157
- this.moveable.draggable = value;
158
284
  this.moveable.roundable = value;
159
285
  this.moveable.rotatable = value;
160
286
  }
161
- set lineHeight(value) {
162
- this.block.lineHeight = value;
163
- this._triggerChanged();
164
- }
165
- set borderWidth(value) {
166
- this.block.borderWidth = value;
167
- this._triggerChanged();
168
- }
169
- set fontSize(value) {
170
- this.block.fontSize = value;
171
- this._triggerChanged();
172
- }
173
- set backgroundColor(value) {
174
- this.block.backgroundColor = value;
175
- this._triggerChanged();
176
- }
177
287
  set width(value) {
178
- this.block.width = parseFloat(value);
179
- this.element.nativeElement.style.width = `${this.block.width}${this.unit}`;
180
- this._moveable.updateRect();
181
- this._triggerChanged();
288
+ this.element.nativeElement.style.width = `${parseFloat(value)}${this.unit}`;
289
+ this.moveable.updateRect();
182
290
  }
183
291
  set height(value) {
184
- this.block.height = parseFloat(value);
185
- this.element.nativeElement.style.height = `${this.block.height}${this.unit}`;
186
- this._moveable.updateRect();
187
- this._triggerChanged();
292
+ this.element.nativeElement.style.height = `${parseFloat(value)}${this.unit}`;
293
+ this.moveable.updateRect();
188
294
  }
189
295
  set top(value) {
190
- this.block.top = parseFloat(value);
191
- this.element.nativeElement.style.top = `${this.block.top}${this.unit}`;
192
- this._moveable.updateRect();
193
- this._triggerChanged();
296
+ this.element.nativeElement.style.top = `${parseFloat(value)}${this.unit}`;
297
+ this.moveable.updateRect();
194
298
  }
195
299
  set left(value) {
196
- this.block.left = parseFloat(value);
197
- this.element.nativeElement.style.left = `${this.block.left}${this.unit}`;
198
- this._moveable.updateRect();
199
- this._triggerChanged();
300
+ this.element.nativeElement.style.left = `${parseFloat(value)}${this.unit}`;
301
+ this.moveable.updateRect();
200
302
  }
201
303
  set rotate(value) {
202
- this.block.rotate = parseFloat(value);
203
- this._moveable.request('rotatable', { rotate: this.block.rotate }, true);
204
- this._triggerChanged();
205
- }
206
- set shapeRadius(value) {
207
- this.block.shapeRadius = value;
208
- this._triggerChanged();
304
+ this.moveable.request('rotatable', { rotate: parseFloat(value) }, true);
305
+ this.moveable.updateRect();
209
306
  }
210
307
  set index(value) {
211
308
  this.block.index = value;
212
309
  }
213
- set borderColor(value) {
214
- this.block.borderColor = value;
215
- this._triggerChanged();
216
- }
217
- set paddingAll(value) {
218
- this.block.padding = value;
219
- this.block.paddingTop = null;
220
- this.block.paddingBottom = null;
221
- this.block.paddingLeft = null;
222
- this.block.paddingRight = null;
223
- this._triggerChanged();
224
- }
225
- padding(name, value) {
226
- this.block[name] = value;
227
- this.block.padding = null;
228
- this._triggerChanged();
229
- }
230
- set imageUrl(value) {
231
- this.block.imageUrl = value;
232
- this._triggerChanged();
233
- }
234
- set fontColor(value) {
235
- this.block.fontColor = value;
236
- this._triggerChanged();
310
+ set keepRatio(value) {
311
+ this.moveable.keepRatio = value;
237
312
  }
238
- set verticalAlign(value) {
239
- this.block.verticalAlign = value;
240
- this._triggerChanged();
241
- }
242
- shapeRound(name, value) {
243
- this.block[name] = value;
244
- this._triggerChanged();
313
+ markForCheck() {
314
+ this._cdRef.markForCheck();
245
315
  }
246
- set horizontalAlign(value) {
247
- this.block.horizontalAlign = value;
248
- this._triggerChanged();
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
+ });
249
329
  }
250
- set italic(value) {
251
- this.block.italic = value;
252
- 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
+ });
253
341
  }
254
- get italic() {
255
- return this.block.italic;
342
+ pxToIn(px) {
343
+ return this.round(px / 96, 2);
256
344
  }
257
- set bold(value) {
258
- this.block.bold = value;
259
- this._triggerChanged();
345
+ round(value, decimals) {
346
+ return parseFloat(value.toFixed(decimals));
260
347
  }
261
- get bold() {
262
- return this.block.bold;
348
+ deselect() {
349
+ this.transformable = false;
350
+ this.editable = false;
263
351
  }
264
- set underline(value) {
265
- this.block.underline = value;
266
- this._triggerChanged();
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
- get underline() {
269
- return this.block.underline;
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
- updateRect() {
272
- this.moveable.updateRect();
369
+ ngOnDestroy() {
370
+ this._blockEditor.unregisterBlock(this.block);
371
+ this._destroy$.next();
372
+ this._destroy$.complete();
273
373
  }
274
- markForCheck() {
275
- this._cdRef.markForCheck();
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(' ');
276
380
  }
277
- ngOnInit() {
278
- this.block = this._service.sanitizeBlock(this.block);
279
- this.unit = this._service.config.unit;
280
- this.content = this.block.content;
381
+ _triggerChanged() {
382
+ this._blockEditor.blockChange(this.block);
281
383
  }
282
- ngAfterContentInit() {
283
- this.el.style.width = this.block.width + this.unit;
284
- this.el.style.height = this.block.height + this.unit;
285
- this.el.style.top = this.block.top + this.unit;
286
- this.el.style.left = this.block.left + this.unit;
287
- this._setTransform();
288
- fromEvent(this.contentEditable.nativeElement, 'input')
289
- .pipe(takeUntil(this._destroy$)).subscribe((event) => {
290
- this.block.content = event.target.innerHTML;
291
- this._triggerChanged();
292
- });
293
- fromEvent(this.el, 'mousedown')
294
- .pipe(takeUntil(this._destroy$), filter(() => !this.block.readonly)).subscribe((event) => {
295
- if (this.editable) {
296
- if (this.contentElement.nativeElement.isSameNode(event.target)) {
297
- event.preventDefault();
298
- event.stopImmediatePropagation();
299
- event.stopPropagation();
300
- }
301
- }
302
- else {
303
- this._service.selectedBlockComponents = [this];
304
- }
305
- });
306
- fromEvent(this.el, 'dblclick')
307
- .pipe(filter(() => (!this.editable)), takeUntil(this._destroy$))
308
- .subscribe((event) => {
309
- if (this.block.readonly) {
310
- event.preventDefault();
311
- }
312
- else {
313
- this.editable = true;
314
- this._cdRef.markForCheck();
315
- setTimeout(() => {
316
- this.selectAll();
317
- });
318
- }
319
- });
384
+ _initMoveable() {
320
385
  this._moveable = new Moveable(this._elementRef.nativeElement, {
321
386
  target: this.el,
322
- container: this._service.container,
387
+ container: this._blockEditor.container,
323
388
  draggable: false,
324
389
  resizable: false,
325
390
  scalable: false,
326
391
  rotatable: false,
327
392
  warpable: false,
328
393
  origin: false,
329
- keepRatio: false,
394
+ keepRatio: this.block.keepRatio,
330
395
  snappable: true,
331
- snapHorizontal: true,
332
- snapVertical: true,
333
- snapCenter: true,
334
- snapElement: true,
335
396
  edge: false,
336
397
  throttleDrag: 1,
337
398
  throttleScale: 0.01,
338
399
  throttleRotate: 1,
339
400
  throttleResize: 1,
340
401
  });
341
- this._service.registerBlock(this);
342
- this._moveable
343
- .on('clip', e => {
402
+ this.moveable
403
+ .on('clip', (e) => {
344
404
  this.block.clipPath = e.clipStyle;
345
405
  e.target.style.clipPath = e.clipStyle;
346
406
  this._triggerChanged();
347
407
  });
348
- this._moveable.on('dragStart', ({ target, clientX, clientY }) => {
408
+ this.moveable.on('dragStart', ({ target, clientX, clientY }) => {
349
409
  this.editable = false;
350
410
  }).on('drag', ({ target, left, top }) => {
351
411
  target.style.left = this.pxToIn(left) + this.unit;
@@ -354,8 +414,9 @@ class FsBlockComponent {
354
414
  this.block.left = this.pxToIn(left);
355
415
  this._triggerChanged();
356
416
  });
357
- this._moveable.on('resizeStart', ({ target, clientX, clientY }) => {
417
+ this.moveable.on('resizeStart', ({ target, clientX, clientY }) => {
358
418
  this.editable = false;
419
+ this.zoompan.disable();
359
420
  }).on('resize', ({ target, width, height, dist, delta, direction }) => {
360
421
  width = this.pxToIn(width);
361
422
  height = this.pxToIn(height);
@@ -384,60 +445,61 @@ class FsBlockComponent {
384
445
  target.style.left = this.block.left + this.unit;
385
446
  this._setTransform();
386
447
  this._triggerChanged();
448
+ this.zoompan.enable();
387
449
  });
388
- this._moveable.on('rotateStart', ({ target, clientX, clientY }) => {
450
+ this.moveable.on('rotateStart', ({ target, clientX, clientY }) => {
451
+ this.zoompan.disable();
389
452
  this.editable = false;
390
453
  this._rotateStart = this.block.rotate || 0;
391
454
  }).on('rotate', ({ rotate, transform }) => {
392
455
  this.block.rotate = this._rotateStart + rotate;
393
456
  this.el.style.transform = transform;
394
457
  this._triggerChanged();
458
+ this.zoompan.enable();
395
459
  });
396
460
  }
397
- pxToIn(px) {
398
- return this.round(px / 96, 2);
399
- }
400
- round(value, decimals) {
401
- return parseFloat(value.toFixed(decimals));
402
- }
403
- deselect() {
404
- this.transformable = false;
405
- this.editable = false;
406
- }
407
- deselectContent() {
408
- if (window.getSelection) {
409
- if (window.getSelection().empty) {
410
- 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
+ }
411
476
  }
412
- else if (window.getSelection().removeAllRanges) {
413
- window.getSelection().removeAllRanges();
477
+ else {
478
+ this._blockEditor.selectedBlock = this.block;
414
479
  }
415
- }
416
- }
417
- selectAll() {
418
- const range = document.createRange();
419
- range.selectNodeContents(this.contentEditable.nativeElement);
420
- const sel = window.getSelection();
421
- sel.removeAllRanges();
422
- sel.addRange(range);
423
- }
424
- ngOnDestroy() {
425
- this._destroy$.next();
426
- this._destroy$.complete();
427
- }
428
- _setTransform(transforms = []) {
429
- transforms = transforms !== null && transforms !== void 0 ? transforms : [];
430
- if (this.block.rotate) {
431
- transforms.push(`rotate(${this.block.rotate}deg)`);
432
- }
433
- this.el.style.transform = transforms.join(' ');
434
- }
435
- _triggerChanged() {
436
- this.changed.emit(this.block);
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
+ });
437
499
  }
438
500
  }
439
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 });
440
- FsBlockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockComponent, selector: "fs-block", inputs: { block: "block", html: "html" }, outputs: { changed: "changed" }, 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\"\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", styles: [".block{position:absolute;display:block;outline:none;-webkit-user-select:none;user-select:none}.block:not(.readonly){cursor:pointer}.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: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
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 });
441
503
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockComponent, decorators: [{
442
504
  type: Component,
443
505
  args: [{
@@ -459,8 +521,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
459
521
  type: Input
460
522
  }], html: [{
461
523
  type: Input
462
- }], changed: [{
463
- type: Output
524
+ }], zoompan: [{
525
+ type: Input
464
526
  }] } });
465
527
 
466
528
  class FsBlockEditorSidebarPanelDirective {
@@ -482,248 +544,179 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
482
544
  type: Input
483
545
  }] } });
484
546
 
485
- class FsBlockEditorMarginDirective {
486
- constructor(_elementRef) {
487
- this._elementRef = _elementRef;
488
- }
489
- get element() {
490
- return this._elementRef.nativeElement;
491
- }
492
- }
493
- FsBlockEditorMarginDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
494
- FsBlockEditorMarginDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorMarginDirective, selector: "[fsBlockEditorMargin]", ngImport: i0 });
495
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorMarginDirective, decorators: [{
496
- type: Directive,
497
- args: [{
498
- selector: '[fsBlockEditorMargin]'
499
- }]
500
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; } });
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
+ ];
501
558
 
502
559
  class SidebarComponent {
503
- constructor(_el, _service, _cdRef) {
560
+ constructor(_el, _blockEditor, _cdRef, _prompt) {
504
561
  this._el = _el;
505
- this._service = _service;
562
+ this._blockEditor = _blockEditor;
506
563
  this._cdRef = _cdRef;
564
+ this._prompt = _prompt;
565
+ this.BlockTypes = BlockTypes;
566
+ this.blockTypeNames = index(BlockTypes, 'value', 'name');
567
+ this.BlockType = BlockType;
507
568
  this._destroy$ = new Subject();
508
569
  }
509
- get changeDetector() {
510
- return this._cdRef;
511
- }
512
570
  get el() {
513
571
  return this._el.nativeElement;
514
572
  }
515
573
  ngOnInit() {
516
- this._service.selectedBlockComponents$
574
+ this._blockEditor.selectedBlocks$
517
575
  .pipe(takeUntil(this._destroy$))
518
576
  .subscribe((blocks) => {
519
577
  this.clippable = false;
520
- this.block = blocks[0] ? blocks[0].block : null;
521
- this.changeDetector.markForCheck();
522
- if (this.config.blocksSelected) {
523
- this.config.blocksSelected(blocks.map((block) => block.block));
524
- }
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();
525
585
  });
526
586
  }
527
587
  verticalAlignClick(value) {
528
- this._service.selectedBlockComponents.forEach((block) => {
529
- block.verticalAlign = value;
530
- });
588
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'verticalAlign');
531
589
  }
532
590
  boldClick() {
533
- this._service.selectedBlockComponents.forEach((block) => {
534
- block.bold = !block.bold;
535
- });
591
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.bold, 'bold');
536
592
  }
537
593
  fontColorChange(value) {
538
- this._service.selectedBlockComponents.forEach((block) => {
539
- block.fontColor = value;
540
- });
594
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontColor');
541
595
  }
542
596
  lineHeightChange(value) {
543
- this._service.selectedBlockComponents.forEach((block) => {
544
- if (this.validNumeric(value)) {
545
- block.lineHeight = value || null;
546
- }
547
- });
597
+ value = this.validNumeric(value) ? value : null;
598
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'lineHeight');
548
599
  }
549
600
  fontSizeChange(value) {
550
- this._service.selectedBlockComponents.forEach((block) => {
551
- if (this.validNumeric(value)) {
552
- block.fontSize = value || null;
553
- }
554
- });
601
+ value = this.validNumeric(value) ? value : null;
602
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'fontSize');
555
603
  }
556
604
  borderWidthChange(value) {
557
- this._service.selectedBlockComponents.forEach((block) => {
558
- if (this.validNumeric(value)) {
559
- block.borderWidth = value || null;
560
- }
561
- });
605
+ value = this.validNumeric(value) ? value : null;
606
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderWidth');
562
607
  }
563
608
  italicClick() {
564
- this._service.selectedBlockComponents.forEach((block) => {
565
- block.italic = !block.italic;
566
- });
609
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.italic, 'italic');
567
610
  }
568
611
  underlineClick() {
569
- this._service.selectedBlockComponents.forEach((block) => {
570
- block.underline = !block.underline;
571
- });
612
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.underline, 'underline');
572
613
  }
573
614
  backgroundColorChange(value) {
574
- this._service.selectedBlockComponents.forEach((block) => {
575
- block.backgroundColor = value;
576
- });
615
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'backgroundColor');
577
616
  }
578
617
  widthChange(value) {
579
- this._service.selectedBlockComponents.forEach((block) => {
580
- if (this.validNumeric(value)) {
581
- block.width = value;
582
- }
583
- });
618
+ value = this.validNumeric(value) ? value : null;
619
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'width');
584
620
  }
585
621
  heightChange(value) {
586
- this._service.selectedBlockComponents.forEach((block) => {
587
- if (this.validNumeric(value)) {
588
- block.height = value;
589
- }
590
- });
622
+ value = this.validNumeric(value) ? value : null;
623
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'height');
591
624
  }
592
625
  topChange(value) {
593
- this._service.selectedBlockComponents.forEach((block) => {
594
- if (this.validNumeric(value)) {
595
- block.top = value;
596
- }
597
- });
626
+ value = this.validNumeric(value) ? value : null;
627
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'top');
598
628
  }
599
629
  leftChange(value) {
600
- this._service.selectedBlockComponents.forEach((block) => {
601
- if (this.validNumeric(value)) {
602
- block.left = value;
603
- }
604
- });
630
+ value = this.validNumeric(value) ? value : null;
631
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'left');
605
632
  }
606
633
  rotateChange(value) {
607
- this._service.selectedBlockComponents.forEach((block) => {
608
- if (this.validNumeric(value)) {
609
- block.rotate = value;
610
- }
611
- });
634
+ value = this.validNumeric(value) ? value : null;
635
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'rotate');
612
636
  }
613
637
  paddingChange(name, value) {
614
- this._service.selectedBlockComponents.forEach((block) => {
615
- if (this.validNumeric(value)) {
616
- block.padding(name, value || null);
617
- }
618
- });
638
+ value = this.validNumeric(value) ? value : null;
639
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'padding');
619
640
  }
620
641
  paddingAllChange(value) {
621
- this._service.selectedBlockComponents.forEach((block) => {
622
- if (this.validNumeric(value)) {
623
- block.paddingAll = value;
624
- }
625
- });
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);
626
651
  }
627
652
  borderColorChange(value) {
628
- this._service.selectedBlockComponents.forEach((block) => {
629
- block.borderColor = value;
630
- });
653
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'borderColor');
654
+ }
655
+ toggleKeepRatio() {
656
+ this._blockEditor.selectedBlockComponentChangeProperty(!this.block.keepRatio, 'keepRatio');
631
657
  }
632
658
  horizontalAlignClick(value) {
633
- this._service.selectedBlockComponents.forEach((block) => {
634
- block.horizontalAlign = value;
635
- });
659
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'horizontalAlign');
636
660
  }
637
- shapeRound(value) {
638
- this._service.selectedBlockComponents.forEach((block) => {
639
- block.shapeRound(value, block.block[value] === 'round' ? 'square' : 'round');
640
- });
661
+ shapeRound(name) {
662
+ const value = this.block[name] === 'round' ? 'square' : 'round';
663
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
641
664
  }
642
665
  imageRemove() {
643
- this._service.selectedBlockComponents.forEach((block) => {
644
- block.imageUrl = null;
645
- });
666
+ this._blockEditor.selectedBlockComponentChangeProperty(null, 'imageUrl');
646
667
  }
647
668
  imageClip() {
648
669
  this.clippable = !this.clippable;
649
- this._service.selectedBlockComponents.forEach((block) => {
650
- block.clippable = this.clippable;
651
- });
670
+ this._blockEditor.selectedBlockComponentChangeProperty(this.clippable, 'clippable');
652
671
  }
653
672
  shapeRadiusChange(value) {
654
- this._service.selectedBlockComponents.forEach((block) => {
655
- block.shapeRadius = value;
656
- });
673
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'shapeRadius');
674
+ }
675
+ blockChangeProperty(value, name) {
676
+ this._blockEditor.selectedBlockComponentChangeProperty(value, name);
657
677
  }
658
- fileSelect(fsFile) {
659
- if (this.config.fileUpload) {
660
- this.config.fileUpload(fsFile.file)
678
+ imageSelect(fsFile) {
679
+ if (this.config.imageUpload) {
680
+ this.config.imageUpload(fsFile.file)
661
681
  .subscribe((value) => {
662
- this._service.selectedBlockComponents.forEach((block) => {
663
- block.imageUrl = value;
664
- });
682
+ this._blockEditor.selectedBlockComponentChangeProperty(value, 'imageUrl');
665
683
  });
666
684
  }
667
685
  }
668
686
  blockRemoveClick() {
669
- if (this.config.blocksRemoved) {
670
- this.config.blocksRemoved(this._service.selectedBlocks)
671
- .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$))
672
693
  .subscribe(() => {
673
- this._service.selectedBlocks.forEach((block) => {
674
- this._service.removeBlock(block);
675
- });
676
- this._service.selectedBlockComponents = [];
694
+ this._blockEditor.removeSelectedBlocks();
677
695
  });
678
696
  }
679
697
  }
680
- blockAddClick() {
681
- const width = (this.config.width * .333).toFixed(2);
682
- const height = (this.config.height * .333).toFixed(2);
683
- const reference = guid();
684
- const block = {
685
- type: 'text',
686
- reference,
687
- top: height,
688
- left: width,
689
- width: width,
690
- height: height,
691
- };
692
- if (this.config.blockAdded) {
693
- this.config.blockAdded(block)
694
- .pipe(takeUntil(this._destroy$))
695
- .subscribe((block) => {
696
- this.addBlock(block);
697
- this.changeDetector.markForCheck();
698
- this.blockAdded
699
- .pipe(take(1), takeUntil(this._destroy$))
700
- .subscribe((blockComponent) => {
701
- this._service.selectedBlockComponents = [blockComponent];
702
- });
703
- });
704
- }
705
- }
706
- addBlock(block) {
707
- this._service.addBlock(block);
708
- this._updateIndexes();
709
- }
710
- _updateIndexes() {
711
- const sort = this.blocks.slice().sort((a, b) => {
712
- return a.index > b.index ? 1 : -1;
698
+ blockUpload(blockType, fsFile) {
699
+ const block = this._blockEditor.sanitizeNewBlock({
700
+ type: blockType,
713
701
  });
714
- sort.forEach((block, index) => {
715
- this.blocks.find((item) => {
716
- return block.reference === item.reference;
717
- }).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,
718
710
  });
711
+ this._blockEditor.blockAdd(block);
719
712
  }
720
713
  layerMove(direction) {
721
- this._service.blockComponents.forEach((blockComponent) => {
722
- if (this._service.isSelectedBlock(blockComponent)) {
714
+ this._blockEditor.blockComponents.forEach((blockComponent) => {
715
+ if (this._blockEditor.isSelectedBlock(blockComponent)) {
723
716
  blockComponent.block.index + (999 * direction);
724
717
  }
725
718
  });
726
- const sorted = this._service.blockComponents.sort((a, b) => {
719
+ const sorted = this._blockEditor.blockComponents.sort((a, b) => {
727
720
  return a.index > b.index ? 1 : -1;
728
721
  });
729
722
  sorted.forEach((item, index) => {
@@ -741,7 +734,7 @@ class SidebarComponent {
741
734
  this.layerMove(-1);
742
735
  }
743
736
  getBlock(reference) {
744
- return this._service.blocks.find((block) => {
737
+ return this._blockEditor.blocks.find((block) => {
745
738
  return block.reference === reference;
746
739
  });
747
740
  }
@@ -761,8 +754,8 @@ class SidebarComponent {
761
754
  return !value || !!String(value).match(/^\d*\.?\d*$/);
762
755
  }
763
756
  }
764
- 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 }], target: i0.ɵɵFactoryTarget.Component });
765
- SidebarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SidebarComponent, selector: "sidebar", inputs: { config: "config", blocks: "blocks", blockAdded: "blockAdded" }, queries: [{ propertyName: "sidebarPanels", predicate: FsBlockEditorSidebarPanelDirective }], ngImport: i0, 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", 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 .mat-form-field-prefix,.sidebar .sidebar-row ::ng-deep .field-label{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-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(.6);top:-6px;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;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}\n"], components: [{ type: i2.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: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i4.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { type: i5.FsColorPickerChipComponent, selector: "fs-color-picker-chip", inputs: ["color"], outputs: ["changed"] }, { type: i6.FsFileComponent, selector: "fs-file", inputs: ["minHeight", "minWidth", "multiple", "capture", "allowClick", "allowDrop", "accept", "disabled", "imageWidth", "imageHeight", "imageQuality"], outputs: ["select", "error", "clicked", "declined"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i8.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: i9.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: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i4.MatPrefix, selector: "[matPrefix]" }, { type: i7.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
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 });
766
759
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SidebarComponent, decorators: [{
767
760
  type: Component,
768
761
  args: [{
@@ -771,25 +764,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
771
764
  styleUrls: ['sidebar.component.scss'],
772
765
  changeDetection: ChangeDetectionStrategy.OnPush,
773
766
  }]
774
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { sidebarPanels: [{
767
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i2.FsPrompt }]; }, propDecorators: { sidebarPanels: [{
775
768
  type: ContentChildren,
776
769
  args: [FsBlockEditorSidebarPanelDirective]
777
770
  }], config: [{
778
771
  type: Input
779
772
  }], blocks: [{
780
773
  type: Input
781
- }], blockAdded: [{
782
- type: Input
783
774
  }] } });
784
775
 
785
- class FsBlockEditorComponent {
786
- constructor(_el, _service, _cdRef, _differs) {
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 }]; } });
792
+
793
+ class ArtboardComponent {
794
+ constructor(_el, _blockEditor, _cdRef, _differs) {
787
795
  this._el = _el;
788
- this._service = _service;
796
+ this._blockEditor = _blockEditor;
789
797
  this._cdRef = _cdRef;
790
798
  this._differs = _differs;
791
- this.blockAdded = new EventEmitter();
792
- this.blockRemoved = new EventEmitter();
799
+ this.blocks = [];
793
800
  this._destroy$ = new Subject();
794
801
  this._differ = _differs.find([]).create(null);
795
802
  }
@@ -798,23 +805,29 @@ class FsBlockEditorComponent {
798
805
  }
799
806
  ngOnInit() {
800
807
  this.config = Object.assign(Object.assign({}, this.config), { unit: 'in' });
801
- this._service.registerContainer(this.artboard.nativeElement);
802
- this._service.registerMargin(this.marginContainer.nativeElement);
803
- this._service.blocks = this.config.blocks;
804
- this._service.config = this.config;
805
- this._service.blocks$
808
+ this._blockEditor.registerContainer(this.artboard.nativeElement);
809
+ this._blockEditor.registerMargin(this.marginContainer.nativeElement);
810
+ this._blockEditor.blocks$
806
811
  .pipe(takeUntil(this._destroy$))
807
812
  .subscribe((blocks) => {
808
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();
809
821
  });
810
822
  fromEvent(window, 'keydown')
811
823
  .pipe(takeUntil(this._destroy$), filter((event) => {
812
- return !!event.key.match(/^Arrow/) && !!this._service.selectedBlockComponents.length;
824
+ return !!event.key.match(/^Arrow/) && !!this._blockEditor.selectedBlocks.length;
813
825
  }))
814
826
  .subscribe((event) => {
815
827
  event.preventDefault();
816
828
  const inchPixel = 1 / 100;
817
- this._service.selectedBlockComponents.forEach((blockComponent) => {
829
+ this._blockEditor.selectedComponentBlocks
830
+ .forEach((blockComponent) => {
818
831
  switch (event.key) {
819
832
  case 'ArrowUp':
820
833
  blockComponent.top = blockComponent.block.top - inchPixel;
@@ -832,54 +845,42 @@ class FsBlockEditorComponent {
832
845
  });
833
846
  });
834
847
  }
835
- artboardClick(event) {
836
- if (event.target.isSameNode(this.artboard.nativeElement) ||
837
- event.target.isSameNode(this.artboardContainer.nativeElement)) {
838
- this._service.selectedBlockComponents.forEach((block) => {
839
- block.deselect();
840
- block.markForCheck();
841
- });
842
- this._service.selectedBlockComponents = [];
843
- }
844
- }
845
848
  blockChanged(block) {
846
- this.sidebar.changeDetector.markForCheck();
847
849
  if (this.config.blockChanged) {
848
850
  this.config.blockChanged(block);
849
851
  }
850
852
  }
851
853
  ngAfterViewInit() {
852
- this.blockComponents.changes.subscribe((changes) => {
853
- const changeDiff = this._differ.diff(changes);
854
- if (changeDiff) {
855
- changeDiff.forEachAddedItem((change) => {
856
- this.blockAdded.emit(change.item);
857
- });
858
- changeDiff.forEachRemovedItem((change) => {
859
- this.blockRemoved.emit(change.item);
860
- });
861
- }
862
- });
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
+ // });
863
869
  }
864
870
  ngOnDestroy() {
865
871
  this._destroy$.next();
866
872
  this._destroy$.complete();
867
873
  }
868
874
  }
869
- FsBlockEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, deps: [{ token: i0.ElementRef }, { token: BlockEditorService }, { token: i0.ChangeDetectorRef }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
870
- FsBlockEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsBlockEditorComponent, selector: "fs-block-editor", inputs: { config: "config" }, outputs: { blockAdded: "blockAdded", blockRemoved: "blockRemoved" }, providers: [
871
- BlockEditorService,
872
- ], 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: "artboardContainer", first: true, predicate: ["artboardContainer"], 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 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", 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-color:#ff85bd5e;border-style:dashed;border-width:0px}.editor-container .artboard-container .artboard .margin.margin-top,.editor-container .artboard-container .artboard .margin.margin-bottom{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}\n"], components: [{ type: FsBlockComponent, selector: "fs-block", inputs: ["block", "html"], outputs: ["changed"] }, { type: SidebarComponent, selector: "sidebar", inputs: ["config", "blocks", "blockAdded"] }], directives: [{ type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
873
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorComponent, decorators: [{
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: [{
874
878
  type: Component,
875
879
  args: [{
876
- selector: 'fs-block-editor',
877
- templateUrl: 'block-editor.component.html',
878
- styleUrls: ['block-editor.component.scss'],
880
+ selector: 'app-artboard',
881
+ templateUrl: 'artboard.component.html',
882
+ styleUrls: ['artboard.component.scss'],
879
883
  changeDetection: ChangeDetectionStrategy.OnPush,
880
- providers: [
881
- BlockEditorService,
882
- ]
883
884
  }]
884
885
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: BlockEditorService }, { type: i0.ChangeDetectorRef }, { type: i0.IterableDiffers }]; }, propDecorators: { sidebarPanels: [{
885
886
  type: ContentChildren,
@@ -896,18 +897,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
896
897
  }], margins: [{
897
898
  type: ViewChildren,
898
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 });
929
+ });
930
+ }
931
+ artboardClick(event) {
932
+ if (event.target.classList.contains('deselectable')) {
933
+ this.zoompan.enable();
934
+ this._blockEditor.selectedBlocks = [];
935
+ }
936
+ }
937
+ ngOnDestroy() {
938
+ this._destroy$.next();
939
+ this._destroy$.complete();
940
+ }
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: [
944
+ BlockEditorService,
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 }]
899
963
  }], artboardContainer: [{
900
964
  type: ViewChild,
901
965
  args: ['artboardContainer', { static: true }]
902
966
  }], sidebar: [{
903
967
  type: ViewChild,
904
968
  args: [SidebarComponent, { static: true }]
969
+ }], artboard: [{
970
+ type: ViewChild,
971
+ args: [ArtboardComponent, { read: ElementRef }]
905
972
  }], config: [{
906
973
  type: Input
907
- }], blockAdded: [{
908
- type: Output
909
- }], blockRemoved: [{
910
- type: Output
911
974
  }] } });
912
975
 
913
976
  class FsBlockEditorModule {
@@ -922,14 +985,19 @@ FsBlockEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
922
985
  FsBlockEditorComponent,
923
986
  FsBlockEditorSidebarPanelDirective,
924
987
  FsBlockEditorMarginDirective,
925
- SidebarComponent], imports: [CommonModule,
988
+ SidebarComponent,
989
+ ArtboardComponent], imports: [CommonModule,
926
990
  FormsModule,
927
991
  MatIconModule,
928
992
  MatButtonModule,
929
993
  MatInputModule,
930
994
  MatFormFieldModule,
995
+ MatCheckboxModule,
996
+ MatTooltipModule,
931
997
  FsFileModule,
932
- FsColorPickerModule], exports: [FsBlockComponent,
998
+ FsColorPickerModule,
999
+ FsMenuModule,
1000
+ FsZoomPanModule], exports: [FsBlockComponent,
933
1001
  FsBlockEditorComponent,
934
1002
  FsBlockEditorSidebarPanelDirective] });
935
1003
  FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, imports: [[
@@ -939,8 +1007,12 @@ FsBlockEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
939
1007
  MatButtonModule,
940
1008
  MatInputModule,
941
1009
  MatFormFieldModule,
1010
+ MatCheckboxModule,
1011
+ MatTooltipModule,
942
1012
  FsFileModule,
943
1013
  FsColorPickerModule,
1014
+ FsMenuModule,
1015
+ FsZoomPanModule,
944
1016
  ]] });
945
1017
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsBlockEditorModule, decorators: [{
946
1018
  type: NgModule,
@@ -952,8 +1024,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
952
1024
  MatButtonModule,
953
1025
  MatInputModule,
954
1026
  MatFormFieldModule,
1027
+ MatCheckboxModule,
1028
+ MatTooltipModule,
955
1029
  FsFileModule,
956
1030
  FsColorPickerModule,
1031
+ FsMenuModule,
1032
+ FsZoomPanModule,
957
1033
  ],
958
1034
  exports: [
959
1035
  FsBlockComponent,
@@ -966,17 +1042,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
966
1042
  FsBlockEditorSidebarPanelDirective,
967
1043
  FsBlockEditorMarginDirective,
968
1044
  SidebarComponent,
1045
+ ArtboardComponent,
969
1046
  ],
970
1047
  }]
971
1048
  }] });
972
1049
 
973
- /*
974
- * Public API Surface of fs-menu
975
- */
976
-
977
1050
  /**
978
1051
  * Generated bundle index. Do not edit.
979
1052
  */
980
1053
 
981
- export { FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
1054
+ export { BlockType, BlockTypes, FsBlockComponent, FsBlockEditorComponent, FsBlockEditorModule, FsBlockEditorSidebarPanelDirective };
982
1055
  //# sourceMappingURL=firestitch-block-editor.js.map