@firestitch/block-editor 12.3.29 → 12.3.31

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 (38) hide show
  1. package/app/components/artboard/artboard.component.d.ts +6 -5
  2. package/app/components/block/block.component.d.ts +6 -5
  3. package/app/components/block/index.d.ts +1 -0
  4. package/app/components/group/group-dialog.component.d.ts +17 -0
  5. package/app/components/group/index.d.ts +1 -0
  6. package/app/components/index.d.ts +1 -0
  7. package/app/components/layers-reorder-dialog/index.d.ts +1 -0
  8. package/app/components/sidebar/index.d.ts +1 -0
  9. package/app/components/sidebar/sidebar.component.d.ts +24 -6
  10. package/app/directives/index.d.ts +2 -0
  11. package/app/fs-block-editor.module.d.ts +20 -19
  12. package/app/interfaces/block-group.d.ts +5 -0
  13. package/app/interfaces/block.d.ts +1 -1
  14. package/app/interfaces/index.d.ts +1 -0
  15. package/app/services/block-editor.service.d.ts +13 -10
  16. package/app/services/blocks-store.service.d.ts +1 -9
  17. package/bundles/firestitch-block-editor.umd.js +398 -241
  18. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  19. package/esm2015/app/components/artboard/artboard.component.js +15 -6
  20. package/esm2015/app/components/block/block.component.js +23 -18
  21. package/esm2015/app/components/block/index.js +2 -0
  22. package/esm2015/app/components/block-editor/block-editor.component.js +1 -1
  23. package/esm2015/app/components/group/group-dialog.component.js +48 -0
  24. package/esm2015/app/components/group/index.js +2 -0
  25. package/esm2015/app/components/index.js +2 -1
  26. package/esm2015/app/components/layers-reorder-dialog/index.js +2 -0
  27. package/esm2015/app/components/sidebar/index.js +2 -0
  28. package/esm2015/app/components/sidebar/sidebar.component.js +124 -28
  29. package/esm2015/app/directives/index.js +3 -0
  30. package/esm2015/app/fs-block-editor.module.js +5 -3
  31. package/esm2015/app/interfaces/block-group.js +2 -0
  32. package/esm2015/app/interfaces/block.js +1 -1
  33. package/esm2015/app/interfaces/index.js +2 -1
  34. package/esm2015/app/services/block-editor.service.js +126 -35
  35. package/esm2015/app/services/blocks-store.service.js +9 -97
  36. package/fesm2015/firestitch-block-editor.js +316 -172
  37. package/fesm2015/firestitch-block-editor.js.map +1 -1
  38. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
- import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
1
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { FsZoomPanComponent } from '@firestitch/zoom-pan';
3
3
  import { FsBlockEditorMarginDirective } from '../../directives/block-editor-margin.directive';
4
4
  import { FsBlockEditorSidebarPanelDirective } from '../../directives/block-editor-sidebar-panel.directive';
5
5
  import { Block } from '../../interfaces/block';
6
6
  import { BlockEditorConfig } from '../../interfaces/block-editor-config';
7
- import { BlockEditorService } from '../../services/block-editor.service';
8
- import { FsBlockComponent } from '../block/block.component';
9
- import { SidebarComponent } from '../sidebar/sidebar.component';
7
+ import { BlockEditorService } from '../../services';
8
+ import { FsBlockComponent } from '../block';
9
+ import { SidebarComponent } from '../sidebar';
10
10
  import * as i0 from "@angular/core";
11
- export declare class ArtboardComponent implements OnInit, OnDestroy {
11
+ export declare class ArtboardComponent implements OnInit, OnDestroy, AfterViewInit {
12
12
  private _el;
13
13
  private _blockEditor;
14
14
  private _cdRef;
@@ -25,6 +25,7 @@ export declare class ArtboardComponent implements OnInit, OnDestroy {
25
25
  constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef);
26
26
  get el(): any;
27
27
  ngOnInit(): void;
28
+ ngAfterViewInit(): void;
28
29
  ngOnDestroy(): void;
29
30
  static ɵfac: i0.ɵɵFactoryDeclaration<ArtboardComponent, never>;
30
31
  static ɵcmp: i0.ɵɵComponentDeclaration<ArtboardComponent, "app-artboard", never, { "config": "config"; "zoompan": "zoompan"; }, {}, ["sidebarPanels"], never>;
@@ -1,11 +1,11 @@
1
- import { AfterContentInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
1
+ import { AfterContentInit, AfterViewInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { FsZoomPanComponent } from '@firestitch/zoom-pan';
3
3
  import Moveable from 'moveable';
4
4
  import { BlockType } from '../../enums';
5
- import { Block } from './../../interfaces';
6
- import { BlockEditorService, GoogleFontService } from './../../services';
5
+ import { Block } from '../../interfaces';
6
+ import { BlockEditorService, GoogleFontService } from '../../services';
7
7
  import * as i0 from "@angular/core";
8
- export declare class FsBlockComponent implements OnDestroy, AfterContentInit, OnInit {
8
+ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, OnInit, AfterViewInit {
9
9
  private _blockEditor;
10
10
  private _elementRef;
11
11
  private _cdRef;
@@ -54,6 +54,7 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
54
54
  set keepRatio(value: any);
55
55
  markForCheck(): void;
56
56
  ngOnInit(): void;
57
+ ngAfterViewInit(): void;
57
58
  ngAfterContentInit(): void;
58
59
  pxToIn(px: any): number;
59
60
  round(value: any, decimals: any): number;
@@ -64,8 +65,8 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
64
65
  ngOnDestroy(): void;
65
66
  private _setTransform;
66
67
  private _triggerChanged;
67
- private _updateElementGuidelines;
68
68
  private _updateMoveable;
69
+ private _initElementGuidelines;
69
70
  private _initMoveable;
70
71
  private _initEvents;
71
72
  private _initFonts;
@@ -0,0 +1 @@
1
+ export * from './block.component';
@@ -0,0 +1,17 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { MatDialogRef } from '@angular/material/dialog';
3
+ import { Observable } from 'rxjs';
4
+ import { Block, BlockGroup } from '../../interfaces';
5
+ import * as i0 from "@angular/core";
6
+ export declare class GroupDialogComponent implements OnInit {
7
+ private _data;
8
+ private _dialogRef;
9
+ block: Block;
10
+ blockGroup: BlockGroup;
11
+ private _blockEditor;
12
+ constructor(_data: any, _dialogRef: MatDialogRef<GroupDialogComponent>);
13
+ ngOnInit(): void;
14
+ save: () => Observable<any>;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<GroupDialogComponent, never>;
16
+ static ɵcmp: i0.ɵɵComponentDeclaration<GroupDialogComponent, "ng-component", never, {}, {}, never, never>;
17
+ }
@@ -0,0 +1 @@
1
+ export * from './group-dialog.component';
@@ -1 +1,2 @@
1
1
  export * from './font';
2
+ export * from './group';
@@ -0,0 +1 @@
1
+ export * from './layers-reorder-dialog.component';
@@ -0,0 +1 @@
1
+ export * from './sidebar.component';
@@ -1,11 +1,15 @@
1
1
  import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { Observable } from 'rxjs';
3
+ import { FsClipboard } from '@firestitch/clipboard';
3
4
  import { FsFile } from '@firestitch/file';
4
- import { FsPrompt } from '@firestitch/prompt';
5
5
  import { FormControl } from '@angular/forms';
6
- import { FsBlockEditorSidebarPanelDirective } from '../../directives/block-editor-sidebar-panel.directive';
6
+ import { MatDialog } from '@angular/material/dialog';
7
+ import { FsMessage } from '@firestitch/message';
8
+ import { FsPrompt } from '@firestitch/prompt';
9
+ import { FsZoomPanComponent } from '@firestitch/zoom-pan';
10
+ import { FsBlockEditorSidebarPanelDirective } from '../../directives';
7
11
  import { BlockType } from '../../enums';
8
- import { Block } from '../../interfaces/block';
12
+ import { Block, BlockGroup } from '../../interfaces';
9
13
  import { BlockEditorConfig } from '../../interfaces/block-editor-config';
10
14
  import { BlockEditorService, GoogleFontService } from '../../services';
11
15
  import * as i0 from "@angular/core";
@@ -13,12 +17,16 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
13
17
  private _el;
14
18
  private _blockEditor;
15
19
  private _cdRef;
16
- private _prompt;
17
20
  private _googleFontService;
21
+ private _clipboard;
22
+ private _message;
23
+ private _prompt;
24
+ private _dialog;
18
25
  private _document;
19
26
  sidebarPanels: QueryList<FsBlockEditorSidebarPanelDirective>;
20
27
  config: BlockEditorConfig;
21
28
  blocks: any;
29
+ zoompan: FsZoomPanComponent;
22
30
  zoomCenter: EventEmitter<any>;
23
31
  block: Block;
24
32
  BlockTypes: ({
@@ -38,12 +46,20 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
38
46
  blockTypeIcons: {};
39
47
  clippable: boolean;
40
48
  BlockType: typeof BlockType;
49
+ blockGroup: any;
41
50
  blocksReordered: () => void;
42
51
  formats: any[];
43
52
  private _destroy$;
44
- constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef, _prompt: FsPrompt, _googleFontService: GoogleFontService, _document: any);
53
+ constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef, _googleFontService: GoogleFontService, _clipboard: FsClipboard, _message: FsMessage, _prompt: FsPrompt, _dialog: MatDialog, _document: any);
45
54
  get el(): any;
55
+ get blockGroups(): BlockGroup[];
46
56
  ngOnInit(): void;
57
+ blockGroupChange(blockGroup: any): void;
58
+ blockRequired(value: any): void;
59
+ blockReadonly(value: any): void;
60
+ blockGroupEdit(event: MouseEvent): void;
61
+ blockGroupCreate(event: MouseEvent): void;
62
+ blockGroupDialog(blockGroup?: any): Observable<BlockGroup>;
47
63
  fontFetch: (value: any) => Observable<any>;
48
64
  fontDisplayWith: (value: any) => string;
49
65
  fontChanged(font: any): void;
@@ -71,6 +87,8 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
71
87
  blockUpload(block: Block, fsFile: FsFile): void;
72
88
  blockAdd(type: BlockType): void;
73
89
  layerMove(direction: any): void;
90
+ exportBlocks(): void;
91
+ importBlocks(): void;
74
92
  layerUp(): void;
75
93
  layerDown(): void;
76
94
  inputFocus(event: any): void;
@@ -78,5 +96,5 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
78
96
  ngOnDestroy(): void;
79
97
  validNumeric(value: any): boolean;
80
98
  static ɵfac: i0.ɵɵFactoryDeclaration<SidebarComponent, never>;
81
- static ɵcmp: i0.ɵɵComponentDeclaration<SidebarComponent, "sidebar", never, { "config": "config"; "blocks": "blocks"; }, { "zoomCenter": "zoomCenter"; }, ["sidebarPanels"], never>;
99
+ static ɵcmp: i0.ɵɵComponentDeclaration<SidebarComponent, "sidebar", never, { "config": "config"; "blocks": "blocks"; "zoompan": "zoompan"; }, { "zoomCenter": "zoomCenter"; }, ["sidebarPanels"], never>;
82
100
  }
@@ -0,0 +1,2 @@
1
+ export * from './block-editor-margin.directive';
2
+ export * from './block-editor-sidebar-panel.directive';
@@ -9,27 +9,28 @@ import * as i6 from "./components/artboard/artboard.component";
9
9
  import * as i7 from "./components/layers-reorder-dialog/layers-reorder-dialog.component";
10
10
  import * as i8 from "./components/font/font.component";
11
11
  import * as i9 from "./pipes/create-image-url.pipe";
12
- import * as i10 from "@angular/common";
13
- import * as i11 from "@angular/forms";
14
- import * as i12 from "@angular/material/icon";
15
- import * as i13 from "@angular/material/button";
16
- import * as i14 from "@angular/material/input";
17
- import * as i15 from "@angular/material/form-field";
18
- import * as i16 from "@angular/material/checkbox";
19
- import * as i17 from "@angular/material/tooltip";
20
- import * as i18 from "@angular/material/select";
21
- import * as i19 from "@angular/material/list";
22
- import * as i20 from "@angular/cdk/drag-drop";
23
- import * as i21 from "@firestitch/file";
24
- import * as i22 from "@firestitch/colorpicker";
25
- import * as i23 from "@firestitch/menu";
26
- import * as i24 from "@firestitch/zoom-pan";
27
- import * as i25 from "@firestitch/form";
28
- import * as i26 from "@firestitch/autocomplete";
29
- import * as i27 from "@firestitch/dialog";
12
+ import * as i10 from "./components/group/group-dialog.component";
13
+ import * as i11 from "@angular/common";
14
+ import * as i12 from "@angular/forms";
15
+ import * as i13 from "@angular/material/icon";
16
+ import * as i14 from "@angular/material/button";
17
+ import * as i15 from "@angular/material/input";
18
+ import * as i16 from "@angular/material/form-field";
19
+ import * as i17 from "@angular/material/checkbox";
20
+ import * as i18 from "@angular/material/tooltip";
21
+ import * as i19 from "@angular/material/select";
22
+ import * as i20 from "@angular/material/list";
23
+ import * as i21 from "@angular/cdk/drag-drop";
24
+ import * as i22 from "@firestitch/file";
25
+ import * as i23 from "@firestitch/colorpicker";
26
+ import * as i24 from "@firestitch/menu";
27
+ import * as i25 from "@firestitch/zoom-pan";
28
+ import * as i26 from "@firestitch/form";
29
+ import * as i27 from "@firestitch/autocomplete";
30
+ import * as i28 from "@firestitch/dialog";
30
31
  export declare class FsBlockEditorModule {
31
32
  static forRoot(): ModuleWithProviders<FsBlockEditorModule>;
32
33
  static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockEditorModule, never>;
33
- static ɵmod: i0.ɵɵNgModuleDeclaration<FsBlockEditorModule, [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective, typeof i4.FsBlockEditorMarginDirective, typeof i5.SidebarComponent, typeof i6.ArtboardComponent, typeof i7.LayersReorderDialogComponent, typeof i8.FontComponent, typeof i9.CreateImageUrlPipe], [typeof i10.CommonModule, typeof i11.FormsModule, typeof i12.MatIconModule, typeof i13.MatButtonModule, typeof i14.MatInputModule, typeof i15.MatFormFieldModule, typeof i16.MatCheckboxModule, typeof i17.MatTooltipModule, typeof i18.MatSelectModule, typeof i19.MatListModule, typeof i20.DragDropModule, typeof i21.FsFileModule, typeof i22.FsColorPickerModule, typeof i23.FsMenuModule, typeof i24.FsZoomPanModule, typeof i25.FsFormModule, typeof i26.FsAutocompleteModule, typeof i27.FsDialogModule], [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective]>;
34
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FsBlockEditorModule, [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective, typeof i4.FsBlockEditorMarginDirective, typeof i5.SidebarComponent, typeof i6.ArtboardComponent, typeof i7.LayersReorderDialogComponent, typeof i8.FontComponent, typeof i9.CreateImageUrlPipe, typeof i10.GroupDialogComponent], [typeof i11.CommonModule, typeof i12.FormsModule, typeof i13.MatIconModule, typeof i14.MatButtonModule, typeof i15.MatInputModule, typeof i16.MatFormFieldModule, typeof i17.MatCheckboxModule, typeof i18.MatTooltipModule, typeof i19.MatSelectModule, typeof i20.MatListModule, typeof i21.DragDropModule, typeof i22.FsFileModule, typeof i23.FsColorPickerModule, typeof i24.FsMenuModule, typeof i25.FsZoomPanModule, typeof i26.FsFormModule, typeof i27.FsAutocompleteModule, typeof i28.FsDialogModule], [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective]>;
34
35
  static ɵinj: i0.ɵɵInjectorDeclaration<FsBlockEditorModule>;
35
36
  }
@@ -0,0 +1,5 @@
1
+ export interface BlockGroup {
2
+ label?: string;
3
+ description?: string;
4
+ name?: string;
5
+ }
@@ -1,5 +1,5 @@
1
+ import { FsBlockComponent } from '../components/block/block.component';
1
2
  import { BlockType } from '../enums';
2
- import { FsBlockComponent } from './../components/block/block.component';
3
3
  export interface Block {
4
4
  width?: number;
5
5
  height?: number;
@@ -1,2 +1,3 @@
1
1
  export * from './block';
2
2
  export * from './block-editor-config';
3
+ export * from './block-group';
@@ -3,8 +3,8 @@ import { BehaviorSubject, Observable } from 'rxjs';
3
3
  import { FsDialog } from '@firestitch/dialog';
4
4
  import { FsFile } from '@firestitch/file';
5
5
  import { FsPrompt } from '@firestitch/prompt';
6
- import { FsBlockComponent } from '../components/block/block.component';
7
- import { BlockEditorConfig } from '../interfaces/block-editor-config';
6
+ import { FsBlockComponent } from '../components/block';
7
+ import { BlockEditorConfig, BlockGroup } from '../interfaces';
8
8
  import { Block } from './../interfaces/block';
9
9
  import { BlocksStore } from './blocks-store.service';
10
10
  import * as i0 from "@angular/core";
@@ -15,32 +15,34 @@ export declare class BlockEditorService implements OnDestroy {
15
15
  container: any;
16
16
  margin: any;
17
17
  config: BlockEditorConfig;
18
+ blockGroups: BlockGroup[];
18
19
  private _selectedBlocks$;
19
- private _selectionRange;
20
- private _blockComponents;
20
+ private _blockComponents$;
21
21
  private _blockClippable$;
22
22
  private _destroy$;
23
- private _blockInited$;
23
+ private _selectionRange;
24
24
  constructor(_store: BlocksStore, _dialog: FsDialog, _prompt: FsPrompt);
25
- get blockComponents(): FsBlockComponent[];
25
+ get blockComponents$(): Observable<FsBlockComponent[]>;
26
+ set blockComponents(blockComponents: any);
26
27
  init(config: BlockEditorConfig): void;
27
28
  blockAdd(block: Block): void;
28
29
  blockUpload(block: Block, fsFile: FsFile): Observable<Block>;
30
+ private _initBlock;
29
31
  blockRemove(block: Block): void;
30
- removeBlocks(blocks: Block[]): void;
31
32
  get blocks$(): Observable<Block[]>;
32
33
  get blockChanged$(): Observable<Block>;
33
34
  get blockUpdated$(): Observable<Block>;
34
35
  get blockClippable$(): BehaviorSubject<boolean>;
35
36
  set blockClippable(value: any);
36
37
  get blockAdded$(): Observable<Block>;
37
- get blockInited$(): Observable<Block>;
38
38
  get blockRemoved$(): Observable<Block>;
39
39
  get blocks(): Block[];
40
40
  blockChange(block: Block): void;
41
+ applyBlockGroup(block: Block, blockGroup: BlockGroup): void;
41
42
  isSelectedBlock(block: Block): boolean;
42
43
  indexOf(block: any): number;
43
44
  selectedBlockComponentChangeProperty(value: any, name: any): void;
45
+ blockGroupChangeProperty(blockGroup: any, name: any, value: any): void;
44
46
  get selectedBlocks$(): Observable<Block[]>;
45
47
  set selectedBlock(block: Block);
46
48
  set selectedBlocks(blocks: Block[]);
@@ -48,12 +50,13 @@ export declare class BlockEditorService implements OnDestroy {
48
50
  saveSelection(): void;
49
51
  restoreSelection(): void;
50
52
  hasSelectionRange(): boolean;
51
- initBlock(block: Block, blockComponent: FsBlockComponent): void;
52
- destroyBlock(block: Block): void;
53
53
  registerContainer(container: any): void;
54
54
  registerMargin(margin: any): void;
55
+ removeBlocks(blocks: Block[]): void;
55
56
  openReorderDialog(): void;
56
57
  ngOnDestroy(): void;
58
+ private _initBlockGroups;
59
+ private _initBlockChange;
57
60
  static ɵfac: i0.ɵɵFactoryDeclaration<BlockEditorService, never>;
58
61
  static ɵprov: i0.ɵɵInjectableDeclaration<BlockEditorService>;
59
62
  }
@@ -1,12 +1,8 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { FsFile } from '@firestitch/file';
3
2
  import { Observable } from 'rxjs';
4
3
  import { Block } from '../interfaces/block';
5
- import { BlockEditorConfig } from '../interfaces/block-editor-config';
6
4
  import * as i0 from "@angular/core";
7
5
  export declare class BlocksStore implements OnDestroy {
8
- private _config;
9
- private _lastTabIndex;
10
6
  private _eventBus$;
11
7
  private _blocks$;
12
8
  private _destroy$;
@@ -17,19 +13,15 @@ export declare class BlocksStore implements OnDestroy {
17
13
  get blockUpdated$(): Observable<Block>;
18
14
  get blockRemoved$(): Observable<Block>;
19
15
  ngOnDestroy(): void;
20
- init(config: BlockEditorConfig): void;
16
+ init(blocks: Block[]): void;
21
17
  blockExists(block: Block): boolean;
22
18
  blockAdd(block: Block): void;
23
- blockUpload(block: Block, fsFile: FsFile): Observable<Block>;
24
19
  blockChange(block: Block): void;
25
20
  blockUpdate(block: Block): void;
26
21
  blockRemove(targetBlocks: Block | Block[]): void;
27
- isReordableBlock(block: Block): boolean;
28
- updateTabIndex(index: number): void;
29
22
  private _setBlocks;
30
23
  private _appendBlock;
31
24
  private _dispatchEvent;
32
- private _createBlock;
33
25
  private _deduplicateIndexesFor;
34
26
  static ɵfac: i0.ɵɵFactoryDeclaration<BlocksStore, never>;
35
27
  static ɵprov: i0.ɵɵInjectableDeclaration<BlocksStore>;