@firestitch/block-editor 12.2.3 → 12.3.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 (35) hide show
  1. package/app/components/artboard/artboard.component.d.ts +3 -6
  2. package/app/components/block/block.component.d.ts +4 -2
  3. package/app/components/block-editor/block-editor.component.d.ts +1 -1
  4. package/app/components/font/font.component.d.ts +12 -0
  5. package/app/components/font/index.d.ts +1 -0
  6. package/app/components/index.d.ts +1 -0
  7. package/app/components/sidebar/sidebar.component.d.ts +12 -12
  8. package/app/fs-block-editor.module.d.ts +19 -17
  9. package/app/interfaces/block-editor-config.d.ts +1 -1
  10. package/app/interfaces/block.d.ts +11 -4
  11. package/app/interfaces/index.d.ts +2 -0
  12. package/app/services/block-editor.service.d.ts +9 -7
  13. package/app/services/google-font.service.d.ts +15 -0
  14. package/app/services/index.d.ts +1 -0
  15. package/bundles/firestitch-block-editor.umd.js +255 -139
  16. package/bundles/firestitch-block-editor.umd.js.map +1 -1
  17. package/esm2015/app/components/artboard/artboard.component.js +9 -24
  18. package/esm2015/app/components/block/block.component.js +53 -21
  19. package/esm2015/app/components/block-editor/block-editor.component.js +2 -2
  20. package/esm2015/app/components/font/font.component.js +32 -0
  21. package/esm2015/app/components/font/index.js +2 -0
  22. package/esm2015/app/components/index.js +2 -0
  23. package/esm2015/app/components/layers-reorder-dialog/layers-reorder-dialog.component.js +5 -6
  24. package/esm2015/app/components/sidebar/sidebar.component.js +59 -61
  25. package/esm2015/app/fs-block-editor.module.js +16 -3
  26. package/esm2015/app/interfaces/block-editor-config.js +1 -1
  27. package/esm2015/app/interfaces/block.js +1 -1
  28. package/esm2015/app/interfaces/index.js +3 -0
  29. package/esm2015/app/services/block-editor.service.js +15 -11
  30. package/esm2015/app/services/blocks-store.service.js +17 -7
  31. package/esm2015/app/services/google-font.service.js +38 -0
  32. package/esm2015/app/services/index.js +2 -1
  33. package/fesm2015/firestitch-block-editor.js +222 -123
  34. package/fesm2015/firestitch-block-editor.js.map +1 -1
  35. package/package.json +2 -3
@@ -1,4 +1,4 @@
1
- import { AfterViewInit, ChangeDetectorRef, ElementRef, IterableDiffers, OnDestroy, OnInit, QueryList } from '@angular/core';
1
+ import { ChangeDetectorRef, ElementRef, OnDestroy, OnInit, QueryList } from '@angular/core';
2
2
  import { FsZoomPanComponent } from '@firestitch/zoom-pan';
3
3
  import { BlockEditorConfig } from '../../interfaces/block-editor-config';
4
4
  import { FsBlockComponent } from '../block/block.component';
@@ -8,11 +8,10 @@ import { FsBlockEditorSidebarPanelDirective } from '../../directives/block-edito
8
8
  import { FsBlockEditorMarginDirective } from '../../directives/block-editor-margin.directive';
9
9
  import { SidebarComponent } from '../sidebar/sidebar.component';
10
10
  import * as i0 from "@angular/core";
11
- export declare class ArtboardComponent implements OnInit, AfterViewInit, OnDestroy {
11
+ export declare class ArtboardComponent implements OnInit, OnDestroy {
12
12
  private _el;
13
13
  private _blockEditor;
14
14
  private _cdRef;
15
- private _differs;
16
15
  sidebarPanels: QueryList<FsBlockEditorSidebarPanelDirective>;
17
16
  blockComponents: QueryList<FsBlockComponent>;
18
17
  artboard: ElementRef;
@@ -22,12 +21,10 @@ export declare class ArtboardComponent implements OnInit, AfterViewInit, OnDestr
22
21
  config: BlockEditorConfig;
23
22
  zoompan: FsZoomPanComponent;
24
23
  blocks: Block[];
25
- private _differ;
26
24
  private _destroy$;
27
- constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef, _differs: IterableDiffers);
25
+ constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef);
28
26
  get el(): any;
29
27
  ngOnInit(): void;
30
- ngAfterViewInit(): void;
31
28
  ngOnDestroy(): void;
32
29
  static ɵfac: i0.ɵɵFactoryDeclaration<ArtboardComponent, never>;
33
30
  static ɵcmp: i0.ɵɵComponentDeclaration<ArtboardComponent, "app-artboard", never, { "config": "config"; "zoompan": "zoompan"; }, {}, ["sidebarPanels"], never>;
@@ -2,7 +2,7 @@ import { AfterContentInit, ChangeDetectorRef, ElementRef, OnDestroy, OnInit } fr
2
2
  import { FsZoomPanComponent } from '@firestitch/zoom-pan';
3
3
  import Moveable from 'moveable';
4
4
  import { BlockEditorService } from './../../services';
5
- import { Block } from './../../interfaces/block';
5
+ import { Block } from './../../interfaces';
6
6
  import { BlockType } from '../../enums';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class FsBlockComponent implements OnDestroy, AfterContentInit, OnInit {
@@ -22,12 +22,12 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
22
22
  private _moveable;
23
23
  private _editable;
24
24
  private _transformable;
25
- private _rotateStart;
26
25
  private _destroy$;
27
26
  constructor(_blockEditor: BlockEditorService, _elementRef: ElementRef, _cdRef: ChangeDetectorRef);
28
27
  get el(): any;
29
28
  get moveable(): Moveable;
30
29
  get editable(): any;
30
+ get boxShadow(): string;
31
31
  set elementGuidelines(value: any);
32
32
  set editable(value: any);
33
33
  set clippable(value: any);
@@ -46,11 +46,13 @@ export declare class FsBlockComponent implements OnDestroy, AfterContentInit, On
46
46
  pxToIn(px: any): number;
47
47
  round(value: any, decimals: any): number;
48
48
  deselect(): void;
49
+ disableContentEdit(): void;
49
50
  deselectContent(): void;
50
51
  selectAll(): void;
51
52
  ngOnDestroy(): void;
52
53
  private _setTransform;
53
54
  private _triggerChanged;
55
+ private _updateElementGuidelines;
54
56
  private _initMoveable;
55
57
  private _initEvents;
56
58
  static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockComponent, never>;
@@ -15,7 +15,7 @@ export declare class FsBlockEditorComponent implements OnInit, OnDestroy {
15
15
  sidebar: SidebarComponent;
16
16
  artboard: ElementRef;
17
17
  config: BlockEditorConfig;
18
- blocks: Block<any>[];
18
+ blocks: Block[];
19
19
  private _destroy$;
20
20
  constructor(_el: ElementRef, _blockEditor: BlockEditorService);
21
21
  get el(): any;
@@ -0,0 +1,12 @@
1
+ import { ElementRef, OnInit } from '@angular/core';
2
+ import { GoogleFontService } from '../../services/google-font.service';
3
+ import * as i0 from "@angular/core";
4
+ export declare class FontComponent implements OnInit {
5
+ private _el;
6
+ private _googleFontService;
7
+ font: any;
8
+ constructor(_el: ElementRef, _googleFontService: GoogleFontService);
9
+ ngOnInit(): void;
10
+ static ɵfac: i0.ɵɵFactoryDeclaration<FontComponent, never>;
11
+ static ɵcmp: i0.ɵɵComponentDeclaration<FontComponent, "app-font", never, { "font": "font"; }, {}, never, never>;
12
+ }
@@ -0,0 +1 @@
1
+ export * from './font.component';
@@ -0,0 +1 @@
1
+ export * from './font';
@@ -1,8 +1,9 @@
1
1
  import { ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, OnInit, QueryList } from '@angular/core';
2
+ import { Observable } from 'rxjs';
2
3
  import { FsFile } from '@firestitch/file';
3
4
  import { FsPrompt } from '@firestitch/prompt';
4
5
  import { BlockEditorConfig } from '../../interfaces/block-editor-config';
5
- import { BlockEditorService } from '../../services/block-editor.service';
6
+ import { BlockEditorService, GoogleFontService } from '../../services';
6
7
  import { Block } from '../../interfaces/block';
7
8
  import { FsBlockEditorSidebarPanelDirective } from '../../directives/block-editor-sidebar-panel.directive';
8
9
  import { BlockType } from '../../enums';
@@ -12,6 +13,7 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
12
13
  private _blockEditor;
13
14
  private _cdRef;
14
15
  private _prompt;
16
+ private _googleFontService;
15
17
  private _document;
16
18
  sidebarPanels: QueryList<FsBlockEditorSidebarPanelDirective>;
17
19
  config: BlockEditorConfig;
@@ -35,32 +37,29 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
35
37
  BlockType: typeof BlockType;
36
38
  formats: any[];
37
39
  private _destroy$;
38
- constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef, _prompt: FsPrompt, _document: any);
40
+ constructor(_el: ElementRef, _blockEditor: BlockEditorService, _cdRef: ChangeDetectorRef, _prompt: FsPrompt, _googleFontService: GoogleFontService, _document: any);
39
41
  get el(): any;
40
42
  ngOnInit(): void;
43
+ fontFetch: (value: any) => Observable<any>;
44
+ fontDisplayWith: (value: any) => string;
45
+ fontChanged(font: any): void;
41
46
  verticalAlignClick(value: any): void;
42
47
  boldClick(): void;
43
48
  fontColorChange(value: any): void;
44
- lineHeightChange(value: any): void;
45
- fontSizeChange(value: any): void;
46
- borderWidthChange(value: any): void;
47
49
  italicClick(): void;
48
50
  underlineClick(): void;
49
51
  backgroundColorChange(value: any): void;
50
- widthChange(value: any): void;
51
- heightChange(value: any): void;
52
- topChange(value: any): void;
53
- leftChange(value: any): void;
54
- rotateChange(value: any): void;
55
- paddingChange(name: any, value: any): void;
52
+ shadowColorChange(value: any): void;
56
53
  paddingAllChange(value: any): void;
54
+ paddingKeypress(event: KeyboardEvent, name: any): void;
55
+ paddingAllKeypress(event: KeyboardEvent, unit?: number): void;
57
56
  borderColorChange(value: any): void;
58
57
  toggleKeepRatio(): void;
59
58
  horizontalAlignClick(value: any): void;
60
59
  shapeRound(name: any): void;
60
+ numberChange(value: any, name: any): void;
61
61
  imageRemove(): void;
62
62
  imageClip(): void;
63
- shapeRadiusChange(value: any): void;
64
63
  blockChangeProperty(value: any, name: any): void;
65
64
  imageSelect(fsFile: FsFile): void;
66
65
  blockRemoveClick(): void;
@@ -71,6 +70,7 @@ export declare class SidebarComponent implements OnInit, OnDestroy {
71
70
  layerDown(): void;
72
71
  reorderLayers(): void;
73
72
  inputFocus(event: any): void;
73
+ numericInputKeypress(event: KeyboardEvent, name: any, unit?: number): void;
74
74
  ngOnDestroy(): void;
75
75
  validNumeric(value: any): boolean;
76
76
  static ɵfac: i0.ɵɵFactoryDeclaration<SidebarComponent, never>;
@@ -7,25 +7,27 @@ import * as i4 from "./directives/block-editor-margin.directive";
7
7
  import * as i5 from "./components/sidebar/sidebar.component";
8
8
  import * as i6 from "./components/artboard/artboard.component";
9
9
  import * as i7 from "./components/layers-reorder-dialog/layers-reorder-dialog.component";
10
- import * as i8 from "@angular/common";
11
- import * as i9 from "@angular/forms";
12
- import * as i10 from "@angular/material/icon";
13
- import * as i11 from "@angular/material/button";
14
- import * as i12 from "@angular/material/input";
15
- import * as i13 from "@angular/material/form-field";
16
- import * as i14 from "@angular/material/checkbox";
17
- import * as i15 from "@angular/material/tooltip";
18
- import * as i16 from "@angular/material/select";
19
- import * as i17 from "@angular/material/list";
20
- import * as i18 from "@angular/cdk/drag-drop";
21
- import * as i19 from "@firestitch/file";
22
- import * as i20 from "@firestitch/colorpicker";
23
- import * as i21 from "@firestitch/menu";
24
- import * as i22 from "@firestitch/zoom-pan";
25
- import * as i23 from "@firestitch/dialog";
10
+ import * as i8 from "./components/font/font.component";
11
+ import * as i9 from "@angular/common";
12
+ import * as i10 from "@angular/forms";
13
+ import * as i11 from "@angular/material/icon";
14
+ import * as i12 from "@angular/material/button";
15
+ import * as i13 from "@angular/material/input";
16
+ import * as i14 from "@angular/material/form-field";
17
+ import * as i15 from "@angular/material/checkbox";
18
+ import * as i16 from "@angular/material/tooltip";
19
+ import * as i17 from "@angular/material/select";
20
+ import * as i18 from "@angular/material/list";
21
+ import * as i19 from "@angular/cdk/drag-drop";
22
+ import * as i20 from "@firestitch/file";
23
+ import * as i21 from "@firestitch/colorpicker";
24
+ import * as i22 from "@firestitch/menu";
25
+ import * as i23 from "@firestitch/zoom-pan";
26
+ import * as i24 from "@firestitch/autocomplete";
27
+ import * as i25 from "@firestitch/dialog";
26
28
  export declare class FsBlockEditorModule {
27
29
  static forRoot(): ModuleWithProviders<FsBlockEditorModule>;
28
30
  static ɵfac: i0.ɵɵFactoryDeclaration<FsBlockEditorModule, never>;
29
- 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.CommonModule, typeof i9.FormsModule, typeof i10.MatIconModule, typeof i11.MatButtonModule, typeof i12.MatInputModule, typeof i13.MatFormFieldModule, typeof i14.MatCheckboxModule, typeof i15.MatTooltipModule, typeof i16.MatSelectModule, typeof i17.MatListModule, typeof i18.DragDropModule, typeof i19.FsFileModule, typeof i20.FsColorPickerModule, typeof i21.FsMenuModule, typeof i22.FsZoomPanModule, typeof i23.FsDialogModule], [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective]>;
31
+ 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.CommonModule, typeof i10.FormsModule, typeof i11.MatIconModule, typeof i12.MatButtonModule, typeof i13.MatInputModule, typeof i14.MatFormFieldModule, typeof i15.MatCheckboxModule, typeof i16.MatTooltipModule, typeof i17.MatSelectModule, typeof i18.MatListModule, typeof i19.DragDropModule, typeof i20.FsFileModule, typeof i21.FsColorPickerModule, typeof i22.FsMenuModule, typeof i23.FsZoomPanModule, typeof i24.FsAutocompleteModule, typeof i25.FsDialogModule], [typeof i1.FsBlockComponent, typeof i2.FsBlockEditorComponent, typeof i3.FsBlockEditorSidebarPanelDirective]>;
30
32
  static ɵinj: i0.ɵɵInjectorDeclaration<FsBlockEditorModule>;
31
33
  }
@@ -13,7 +13,7 @@ export interface BlockEditorConfig {
13
13
  blockAdded?: (block: Block) => void;
14
14
  blockAdd?: (block: Block) => Observable<Block>;
15
15
  blockUpload?: (block: Block, file: Blob) => Observable<Block>;
16
- blocksRemove?: (block: Block[]) => Observable<Block>;
16
+ blocksRemove?: (block: Block[]) => Observable<any>;
17
17
  blocksLevelChanged?: (blocks: Block[]) => void;
18
18
  blocksSelected?: (blocks: Block[]) => void;
19
19
  imageUpload?: (file: Blob) => Observable<string>;
@@ -1,14 +1,13 @@
1
1
  import { BlockType } from '../enums';
2
2
  import { FsBlockComponent } from './../components/block/block.component';
3
- export declare type Block<T = any> = BlockBase & T;
4
- export interface BlockBase {
3
+ export interface Block {
5
4
  width?: number;
6
5
  height?: number;
7
6
  top?: number;
8
7
  left?: number;
9
8
  rotate?: number;
10
- horizontalAlign?: 'left' | 'right' | 'center';
11
- verticalAlign?: 'top' | 'center' | 'bottom';
9
+ horizontalAlign?: string;
10
+ verticalAlign?: string;
12
11
  borderColor?: string;
13
12
  borderWidth?: number;
14
13
  fontColor?: string;
@@ -46,4 +45,12 @@ export interface BlockBase {
46
45
  groupDescription?: string;
47
46
  guid?: string;
48
47
  type?: BlockType;
48
+ shadowX?: number;
49
+ shadowY?: number;
50
+ shadowBlur?: number;
51
+ shadowColor?: string;
52
+ shadowSpread?: number;
53
+ shadowOpacity?: number;
54
+ fontFamily?: string;
55
+ formula?: string;
49
56
  }
@@ -0,0 +1,2 @@
1
+ export * from './block';
2
+ export * from './block-editor-config';
@@ -17,6 +17,7 @@ export declare class BlockEditorService implements OnDestroy {
17
17
  private _selectionRange;
18
18
  private _blockComponents;
19
19
  private _destroy$;
20
+ private _blockInited$;
20
21
  constructor(_store: BlocksStore, _dialog: FsDialog);
21
22
  get blockComponents(): FsBlockComponent[];
22
23
  get selectedComponentBlocks(): FsBlockComponent[];
@@ -26,23 +27,24 @@ export declare class BlockEditorService implements OnDestroy {
26
27
  blockRemove(block: Block): void;
27
28
  removeSelectedBlocks(): void;
28
29
  get blocks$(): Observable<Block[]>;
29
- get blockChanged$(): Observable<any>;
30
+ get blockChanged$(): Observable<Block>;
30
31
  get blockAdded$(): Observable<Block>;
32
+ get blockInited$(): Observable<Block>;
31
33
  get blockRemoved$(): Observable<Block>;
32
34
  get blocks(): Block[];
33
35
  blockChange(block: Block): void;
34
36
  isSelectedBlock(block: any): boolean;
35
37
  indexOf(block: any): number;
36
38
  selectedBlockComponentChangeProperty(value: any, name: any): void;
37
- get selectedBlocks$(): Observable<Block<any>[]>;
38
- set selectedBlock(block: Block<any>);
39
- set selectedBlocks(blocks: Block<any>[]);
40
- get selectedBlocks(): Block<any>[];
39
+ get selectedBlocks$(): Observable<Block[]>;
40
+ set selectedBlock(block: Block);
41
+ set selectedBlocks(blocks: Block[]);
42
+ get selectedBlocks(): Block[];
41
43
  saveSelection(): void;
42
44
  restoreSelection(): void;
43
45
  hasSelectionRange(): boolean;
44
- registerBlock(block: Block, blockComponent: FsBlockComponent): void;
45
- unregisterBlock(block: Block): void;
46
+ initBlock(block: Block, blockComponent: FsBlockComponent): void;
47
+ destroyBlock(block: Block): void;
46
48
  registerContainer(container: any): void;
47
49
  registerMargin(margin: any): void;
48
50
  openReorderDialog(): void;
@@ -0,0 +1,15 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from "@angular/core";
4
+ export declare class GoogleFontService {
5
+ private httpClient;
6
+ private _fonts$;
7
+ private _apiKey;
8
+ constructor(httpClient: HttpClient);
9
+ loadFont(font: any): void;
10
+ getItems(): Observable<{
11
+ family: string;
12
+ }[]>;
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<GoogleFontService, never>;
14
+ static ɵprov: i0.ɵɵInjectableDeclaration<GoogleFontService>;
15
+ }
@@ -1 +1,2 @@
1
1
  export * from './block-editor.service';
2
+ export * from './google-font.service';