@paprize/core 0.0.6 → 0.0.8
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/dist/paprize-core.d.ts +23 -3
- package/dist/paprize-core.js +261 -214
- package/dist/paprize-core.js.map +1 -1
- package/dist/paprize-core.umd.cjs +5 -5
- package/dist/paprize-core.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/paprize-core.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare class EventDispatcher<TEvents> {
|
|
|
50
50
|
private registry;
|
|
51
51
|
addEventListener<T extends keyof TEvents>(name: T, handler: EventHandler<T, TEvents>): () => void;
|
|
52
52
|
removeEventListener<T extends keyof TEvents>(name: T, handler: EventHandler<T, TEvents>): void;
|
|
53
|
-
dispatch<T extends keyof TEvents>(name: T, ...args: Parameters<EventHandler<T, TEvents>>): void
|
|
53
|
+
dispatch<T extends keyof TEvents>(name: T, ...args: Parameters<EventHandler<T, TEvents>>): Promise<void>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
declare type EventHandler<TKey extends keyof TEvents, TEvents> = TEvents[TKey] extends (...args: infer TArgs) => infer TReturn ? (...args: TArgs) => TReturn : never;
|
|
@@ -405,7 +405,7 @@ export declare class ReportBuilder {
|
|
|
405
405
|
* @param onPaginationCompleted - Callback invoked when pagination for the section is completed.
|
|
406
406
|
* @returns `true` if the section was added to the report’s section list, or `false` if it already exists.
|
|
407
407
|
*/
|
|
408
|
-
tryAddSection(options: SectionOptions, components: SectionComponents, onPaginationCompleted:
|
|
408
|
+
tryAddSection(options: SectionOptions, components: SectionComponents, onPaginationCompleted: SectionState['onPaginationCompleted']): Promise<boolean>;
|
|
409
409
|
/**
|
|
410
410
|
* Schedules a pagination operation.
|
|
411
411
|
*
|
|
@@ -422,6 +422,22 @@ export declare class ReportBuilder {
|
|
|
422
422
|
* `suspension` property of the returned result object.
|
|
423
423
|
*/
|
|
424
424
|
schedulePagination(): Promise<ScheduleResult>;
|
|
425
|
+
/**
|
|
426
|
+
* Retrieves JSON data injected by **@paprize/puppeteer** during server-side rendering (SSR).
|
|
427
|
+
*
|
|
428
|
+
* If no injected data is available, the function returns the provided `defaultData`, or `null` if none is given.
|
|
429
|
+
*
|
|
430
|
+
* ⚠️ **Important Notes:**
|
|
431
|
+
* - This function is **not type-safe** — it performs **no runtime type validation** on the returned data.
|
|
432
|
+
* - It is available **only during server-side rendering** when using **@paprize/puppeteer**.
|
|
433
|
+
* - When used in **client-side rendering** or **development** mode, you should provide a `defaultData` value for testing purposes.
|
|
434
|
+
*
|
|
435
|
+
* @template T - The expected type of the injected JSON data.
|
|
436
|
+
* @param defaultData - Optional fallback value to return if no injected data is found.
|
|
437
|
+
* @returns A promise resolving to the injected JSON data if available, otherwise the provided default value or `null`.
|
|
438
|
+
*/
|
|
439
|
+
getJsonData<T>(defaultData?: T): Promise<T | null>;
|
|
440
|
+
private _lazyJsonDataReader;
|
|
425
441
|
private _executePagination;
|
|
426
442
|
private _processPendingPagination;
|
|
427
443
|
private _injectStyle;
|
|
@@ -454,6 +470,10 @@ export declare interface ReportBuilderEvents {
|
|
|
454
470
|
paginationCycleCompleted: (event: PaginationCycleCompleted) => void;
|
|
455
471
|
}
|
|
456
472
|
|
|
473
|
+
export declare interface ReportContext {
|
|
474
|
+
jsonData: unknown | null;
|
|
475
|
+
}
|
|
476
|
+
|
|
457
477
|
export declare const reportStyles: {
|
|
458
478
|
globalStyle: string;
|
|
459
479
|
component: CSSProperties;
|
|
@@ -581,7 +601,7 @@ export declare interface SectionState {
|
|
|
581
601
|
options: SectionOptions;
|
|
582
602
|
context: SectionContext;
|
|
583
603
|
components: SectionComponents;
|
|
584
|
-
onPaginationCompleted: (pages: PageContext[]) => void;
|
|
604
|
+
onPaginationCompleted: (pages: PageContext[]) => Promise<unknown> | void;
|
|
585
605
|
}
|
|
586
606
|
|
|
587
607
|
export declare const sectionTocName = "sectionToc";
|