@solidpepper/solidpepper-flipbook 0.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.
package/index.d.ts
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, AfterViewInit, OnDestroy, ElementRef, EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { PageFlip } from 'page-flip';
|
|
5
|
+
import { HttpClient } from '@angular/common/http';
|
|
6
|
+
import { Observable, BehaviorSubject } from 'rxjs';
|
|
7
|
+
|
|
8
|
+
declare class TranslationService {
|
|
9
|
+
translate: TranslateService;
|
|
10
|
+
private defaultLanguage;
|
|
11
|
+
private availablelangs;
|
|
12
|
+
constructor(translate: TranslateService);
|
|
13
|
+
setDefaultLang(lang: string): void;
|
|
14
|
+
useLanguage(lang: string): void;
|
|
15
|
+
getAvailableLanguages(): {
|
|
16
|
+
code: string;
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TranslationService, never>;
|
|
20
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TranslationService>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare enum LoadingError {
|
|
24
|
+
NONE = "",
|
|
25
|
+
DOCUMENT = "LOADER.ERRORS.DOCUMENT",
|
|
26
|
+
PAGE = "LOADER.ERRORS.PAGE"
|
|
27
|
+
}
|
|
28
|
+
declare class LoadingService {
|
|
29
|
+
readonly isLoading: i0.WritableSignal<boolean>;
|
|
30
|
+
readonly hasError: i0.WritableSignal<boolean>;
|
|
31
|
+
readonly errorKey: i0.WritableSignal<LoadingError>;
|
|
32
|
+
readonly isCanvasLoading: i0.WritableSignal<boolean>;
|
|
33
|
+
readonly canvasHasError: i0.WritableSignal<boolean>;
|
|
34
|
+
readonly canvasErrorKey: i0.WritableSignal<LoadingError>;
|
|
35
|
+
showLoader(): void;
|
|
36
|
+
hideLoader(): void;
|
|
37
|
+
showError(error: LoadingError): void;
|
|
38
|
+
showCanvasLoader(): void;
|
|
39
|
+
hideCanvasLoader(): void;
|
|
40
|
+
showCanvasError(error: LoadingError): void;
|
|
41
|
+
reset(): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoadingService, never>;
|
|
43
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LoadingService>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface AppParams {
|
|
47
|
+
guid?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
apiUrl?: string;
|
|
50
|
+
language?: string;
|
|
51
|
+
alias?: string;
|
|
52
|
+
templateData?: any;
|
|
53
|
+
documentData?: any[];
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
isDemo?: boolean;
|
|
56
|
+
}
|
|
57
|
+
declare class AppParamsService {
|
|
58
|
+
readonly params: i0.WritableSignal<AppParams>;
|
|
59
|
+
readonly pageGuid: i0.WritableSignal<string>;
|
|
60
|
+
setParams(params: Partial<AppParams>): void;
|
|
61
|
+
updateTemplateName(newName: string): void;
|
|
62
|
+
get guid(): string | undefined;
|
|
63
|
+
get apiUrl(): string | undefined;
|
|
64
|
+
get language(): string | undefined;
|
|
65
|
+
get alias(): string | undefined;
|
|
66
|
+
get isPublication(): boolean;
|
|
67
|
+
get isDocument(): boolean;
|
|
68
|
+
get debug(): boolean;
|
|
69
|
+
get isDemo(): boolean;
|
|
70
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppParamsService, never>;
|
|
71
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AppParamsService>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
declare class FlipbookService {
|
|
75
|
+
private http;
|
|
76
|
+
private appParams;
|
|
77
|
+
constructor(http: HttpClient, appParams: AppParamsService);
|
|
78
|
+
getFlipbookInfo(): Observable<any>;
|
|
79
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlipbookService, never>;
|
|
80
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FlipbookService>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface InteractiveData {
|
|
84
|
+
type: 'link' | 'product';
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
width: number;
|
|
88
|
+
height: number;
|
|
89
|
+
tooltip?: string;
|
|
90
|
+
src?: string;
|
|
91
|
+
showBox?: boolean;
|
|
92
|
+
clickBox?: boolean;
|
|
93
|
+
showIcon?: boolean;
|
|
94
|
+
'icon-align'?: 'start' | 'center' | 'end';
|
|
95
|
+
'icon-justify'?: 'start' | 'center' | 'end';
|
|
96
|
+
}
|
|
97
|
+
interface PageData {
|
|
98
|
+
width: number;
|
|
99
|
+
height: number;
|
|
100
|
+
datas: InteractiveData[];
|
|
101
|
+
}
|
|
102
|
+
interface FlipbookPage {
|
|
103
|
+
pageNumber: number;
|
|
104
|
+
pageThumbnail: string;
|
|
105
|
+
pageImage: string;
|
|
106
|
+
pageDatasJson: string;
|
|
107
|
+
pageData?: PageData;
|
|
108
|
+
}
|
|
109
|
+
declare class FlipbookDataService {
|
|
110
|
+
private http;
|
|
111
|
+
private flipbookService;
|
|
112
|
+
private loadingService;
|
|
113
|
+
private _pages;
|
|
114
|
+
pages$: BehaviorSubject<FlipbookPage[]>;
|
|
115
|
+
constructor(http: HttpClient, flipbookService: FlipbookService, loadingService: LoadingService);
|
|
116
|
+
/**
|
|
117
|
+
* Fetch flipbook info and initialize pages
|
|
118
|
+
*/
|
|
119
|
+
loadFlipbookInfo(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Generates a set of test pages.
|
|
122
|
+
* @param count Number of pages to generate
|
|
123
|
+
*/
|
|
124
|
+
generateTestPages(count: number): FlipbookPage[];
|
|
125
|
+
get pages(): FlipbookPage[];
|
|
126
|
+
set pages(value: FlipbookPage[]);
|
|
127
|
+
/**
|
|
128
|
+
* Lazy loads page data from JSON
|
|
129
|
+
* @param pageIndex Index of the page (0-based)
|
|
130
|
+
*/
|
|
131
|
+
loadPageData(pageIndex: number): Promise<PageData | null>;
|
|
132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlipbookDataService, never>;
|
|
133
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FlipbookDataService>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare class FlipbookViewerComponent implements OnInit, AfterViewInit, OnDestroy {
|
|
137
|
+
private dataService;
|
|
138
|
+
private paramsService;
|
|
139
|
+
pages: any[];
|
|
140
|
+
images: string[];
|
|
141
|
+
flipbookRef: ElementRef<HTMLDivElement>;
|
|
142
|
+
bookContainer: ElementRef<HTMLDivElement>;
|
|
143
|
+
pagesLoaded: EventEmitter<{
|
|
144
|
+
src: string;
|
|
145
|
+
number: number;
|
|
146
|
+
}[]>;
|
|
147
|
+
pageChanged: EventEmitter<number>;
|
|
148
|
+
toggleSidebar: EventEmitter<void>;
|
|
149
|
+
toggleMap: EventEmitter<void>;
|
|
150
|
+
zoomChanged: EventEmitter<number>;
|
|
151
|
+
pageFlip: PageFlip | null;
|
|
152
|
+
private isInitializing;
|
|
153
|
+
isBookVisible: boolean;
|
|
154
|
+
isFlipping: boolean;
|
|
155
|
+
private resizeSubject;
|
|
156
|
+
scale: number;
|
|
157
|
+
offsetX: number;
|
|
158
|
+
offsetY: number;
|
|
159
|
+
private lastX;
|
|
160
|
+
private lastY;
|
|
161
|
+
isDragging: boolean;
|
|
162
|
+
isPinching: boolean;
|
|
163
|
+
private lastDistance;
|
|
164
|
+
private lastTapTime;
|
|
165
|
+
private touchStartX;
|
|
166
|
+
private touchStartY;
|
|
167
|
+
private readonly manualSwipeThreshold;
|
|
168
|
+
private readonly scaleStep;
|
|
169
|
+
private readonly scaleMin;
|
|
170
|
+
private readonly scaleMax;
|
|
171
|
+
get transformStyle(): string;
|
|
172
|
+
constructor(dataService: FlipbookDataService, paramsService: AppParamsService);
|
|
173
|
+
ngOnInit(): void;
|
|
174
|
+
ngAfterViewInit(): Promise<void>;
|
|
175
|
+
private getImageDimensions;
|
|
176
|
+
initBook(targetPage?: number): Promise<void>;
|
|
177
|
+
private loadImages;
|
|
178
|
+
onLinkClick(url: string | undefined): void;
|
|
179
|
+
onProductClick(sku: string | undefined): void;
|
|
180
|
+
flipPrev(): void;
|
|
181
|
+
flipNext(): void;
|
|
182
|
+
flip(page: number): void;
|
|
183
|
+
flipEnd(): void;
|
|
184
|
+
goToPage(pageNumber: number): void;
|
|
185
|
+
getCurrentPageIndex(): number;
|
|
186
|
+
get isDebugVisible(): boolean;
|
|
187
|
+
get debugInfo(): string;
|
|
188
|
+
get isZoomed(): boolean;
|
|
189
|
+
onWheelZoom(event: WheelEvent): void;
|
|
190
|
+
private lastFlipTime;
|
|
191
|
+
onDoubleClick(event: MouseEvent): void;
|
|
192
|
+
private handleDoubleTap;
|
|
193
|
+
resetZoom(): void;
|
|
194
|
+
onZoomIn(): void;
|
|
195
|
+
onZoomOut(): void;
|
|
196
|
+
private applyZoomAt;
|
|
197
|
+
startDrag(event: MouseEvent): void;
|
|
198
|
+
onDrag(event: MouseEvent): void;
|
|
199
|
+
stopDrag(): void;
|
|
200
|
+
startTouch(event: TouchEvent): void;
|
|
201
|
+
private getDistance;
|
|
202
|
+
onTouchMove(event: TouchEvent): void;
|
|
203
|
+
stopTouch(event: TouchEvent): void;
|
|
204
|
+
handleOverlayStart(event: MouseEvent | TouchEvent): void;
|
|
205
|
+
private isMouseEvent;
|
|
206
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
207
|
+
resize(): void;
|
|
208
|
+
ngOnDestroy(): void;
|
|
209
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FlipbookViewerComponent, never>;
|
|
210
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FlipbookViewerComponent, "app-flipbook-viewer", never, {}, { "pagesLoaded": "pagesLoaded"; "pageChanged": "pageChanged"; "toggleSidebar": "toggleSidebar"; "toggleMap": "toggleMap"; "zoomChanged": "zoomChanged"; }, never, never, true, never>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface PDFConversionProgress {
|
|
214
|
+
current: number;
|
|
215
|
+
total: number;
|
|
216
|
+
message: string;
|
|
217
|
+
}
|
|
218
|
+
declare class PDFService {
|
|
219
|
+
constructor();
|
|
220
|
+
/**
|
|
221
|
+
* Convertit un fichier PDF en un tableau de DataURLs d'images.
|
|
222
|
+
* @param file Le fichier PDF à convertir
|
|
223
|
+
* @param scale Le facteur d'échelle (1.5 par défaut pour la démo)
|
|
224
|
+
* @param onProgress Callback de progression
|
|
225
|
+
*/
|
|
226
|
+
convertPDFToImages(file: File, scale?: number, onProgress?: (progress: PDFConversionProgress) => void): Promise<string[]>;
|
|
227
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PDFService, never>;
|
|
228
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<PDFService>;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
declare class AppComponent implements OnInit, OnChanges {
|
|
232
|
+
private translationService;
|
|
233
|
+
private appParamsService;
|
|
234
|
+
loadingService: LoadingService;
|
|
235
|
+
private flipbookDataService;
|
|
236
|
+
private pdfService;
|
|
237
|
+
guid?: string;
|
|
238
|
+
alias?: string;
|
|
239
|
+
type?: string;
|
|
240
|
+
set apiUrl1(v: string);
|
|
241
|
+
set apiUrl2(v: string);
|
|
242
|
+
get apiUrl(): string;
|
|
243
|
+
private _apiUrl;
|
|
244
|
+
language: string;
|
|
245
|
+
set isDemo1(v: any);
|
|
246
|
+
set isDemo2(v: any);
|
|
247
|
+
set isDemo3(v: any);
|
|
248
|
+
set isDemoAlias(v: any);
|
|
249
|
+
get isDemo(): boolean;
|
|
250
|
+
private _isDemo;
|
|
251
|
+
private initializationCount;
|
|
252
|
+
exitEditor: EventEmitter<void>;
|
|
253
|
+
viewerRef: FlipbookViewerComponent;
|
|
254
|
+
isSafari: i0.WritableSignal<boolean>;
|
|
255
|
+
isMobile: i0.WritableSignal<boolean>;
|
|
256
|
+
isInitialized: boolean;
|
|
257
|
+
currentPageIndex: number;
|
|
258
|
+
showSidebar: boolean;
|
|
259
|
+
showMap: boolean;
|
|
260
|
+
scale: number;
|
|
261
|
+
showDemoModal: i0.WritableSignal<boolean>;
|
|
262
|
+
showPricingModal: i0.WritableSignal<boolean>;
|
|
263
|
+
isDemoLoading: i0.WritableSignal<boolean>;
|
|
264
|
+
conversionProgress: i0.WritableSignal<number>;
|
|
265
|
+
private pricingTimer;
|
|
266
|
+
constructor(translationService: TranslationService, appParamsService: AppParamsService, loadingService: LoadingService, flipbookDataService: FlipbookDataService, pdfService: PDFService);
|
|
267
|
+
ngOnInit(): void;
|
|
268
|
+
onResize(): void;
|
|
269
|
+
private checkMobile;
|
|
270
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
271
|
+
private tryInitialize;
|
|
272
|
+
onPDFSelected(file: File): Promise<void>;
|
|
273
|
+
onMockSelected(): Promise<void>;
|
|
274
|
+
private startPricingTimer;
|
|
275
|
+
openPricing(): void;
|
|
276
|
+
private checkBrowser;
|
|
277
|
+
onPageChanged(index: number): void;
|
|
278
|
+
onPageSelected(pageNumber: number): void;
|
|
279
|
+
onResetZoom(): void;
|
|
280
|
+
onZoomIn(): void;
|
|
281
|
+
onZoomOut(): void;
|
|
282
|
+
toggleSidebar(): void;
|
|
283
|
+
flipStart(): void;
|
|
284
|
+
flipPrev(): void;
|
|
285
|
+
flipNext(): void;
|
|
286
|
+
flipEnd(): void;
|
|
287
|
+
goToPage(page: number): void;
|
|
288
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppComponent, never>;
|
|
289
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AppComponent, "solidpepper-flipbook", never, { "guid": { "alias": "guid"; "required": false; }; "alias": { "alias": "alias"; "required": false; }; "type": { "alias": "type"; "required": false; }; "apiUrl1": { "alias": "apiurl"; "required": false; }; "apiUrl2": { "alias": "api-url"; "required": false; }; "language": { "alias": "language"; "required": false; }; "isDemo1": { "alias": "isDemo"; "required": false; }; "isDemo2": { "alias": "isdemo"; "required": false; }; "isDemo3": { "alias": "is-demo"; "required": false; }; }, { "exitEditor": "exitEditor"; }, never, never, true, never>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export { AppParamsService, AppComponent as FlipbookComponent, FlipbookDataService };
|
|
293
|
+
export type { AppParams, FlipbookPage, InteractiveData, PageData };
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solidpepper/solidpepper-flipbook",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Solidpepper - flipbook library",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@angular/common": "^20.1.6",
|
|
7
|
+
"@angular/core": "^20.1.6"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"tslib": "^2.3.0"
|
|
11
|
+
},
|
|
12
|
+
"sideEffects": false,
|
|
13
|
+
"module": "fesm2022/solidpepper-solidpepper-flipbook.mjs",
|
|
14
|
+
"typings": "index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"./package.json": {
|
|
17
|
+
"default": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./index.d.ts",
|
|
21
|
+
"default": "./fesm2022/solidpepper-solidpepper-flipbook.mjs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|