@paprize/core 0.0.2 → 0.0.4

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.
@@ -36,6 +36,8 @@ export declare const currentElementClassName = "pz-current-element";
36
36
 
37
37
  export declare const currentTextClassName = "pz-current-text";
38
38
 
39
+ export declare const debugPlugin: PaginationPlugin;
40
+
39
41
  export declare const defaultPlugins: PaginationPlugin[];
40
42
 
41
43
  export declare class DomState {
@@ -124,6 +126,7 @@ declare class PageManager {
124
126
  markPageAsFull(): void;
125
127
  appendChild(node: PageElement, withChildren: boolean): PageElement;
126
128
  addTextNode(text: string): PageText;
129
+ getPageState(): PageState;
127
130
  }
128
131
 
129
132
  declare type PageNode = PageElement | PageText;
@@ -161,20 +164,22 @@ declare class PageText {
161
164
  export declare type PaginateResult = string[];
162
165
 
163
166
  export declare type PaginationConfig = Required<ConfigAttribute> & {
167
+ id: string;
164
168
  plugins: PaginationPlugin[];
165
169
  };
166
170
 
167
171
  export declare interface PaginationPlugin {
168
172
  readonly name: string;
169
- onVisitText?: (domState: DomState & {
173
+ readonly order: number;
174
+ onVisitText?: (id: string, domState: DomState & {
170
175
  currentNode: PageText;
171
176
  }, pageManager: PageManager, context: VisitContext) => void;
172
- onVisitElement?: (domState: DomState & {
177
+ onVisitElement?: (id: string, domState: DomState & {
173
178
  currentNode: PageElement;
174
179
  }, pageManager: PageManager, context: VisitContext) => void;
175
- afterVisitNode?: (domState: DomState, pageManager: PageManager) => void;
176
- onNewPage?: (newPageState: PageState) => void;
177
- onClone?: (source: Element, cloned: PageElement) => void;
180
+ afterVisitNode?: (id: string, domState: DomState, pageManager: PageManager) => void;
181
+ onNewPage?: (id: string, pageManager: PageManager) => void;
182
+ onClone?: (id: string, source: Element, cloned: PageElement) => void;
178
183
  }
179
184
 
180
185
  export declare class Paginator {
@@ -193,6 +198,10 @@ export declare class Paginator {
193
198
  private processCurrentNode;
194
199
  }
195
200
 
201
+ export declare const paprize_isReady = "__PAPRIZE_IS_READY";
202
+
203
+ export declare const paprize_readJsonDataFile = "__PAPRIZE_READ_JSON_DATA_FILE";
204
+
196
205
  declare type PluginHookNames = NonNullable<PluginKeys>;
197
206
 
198
207
  declare type PluginKeys = {
@@ -203,6 +212,25 @@ declare type SafeElement = Omit<Element, 'removeChild' | 'appendChild' | 'replac
203
212
 
204
213
  declare type SafeText = Omit<Text, 'remove'>;
205
214
 
215
+ export declare const sectionTocName = "sectionToc";
216
+
217
+ export declare class SectionTocPlugin implements PaginationPlugin {
218
+ readonly state: SectionTocState[];
219
+ readonly name = "sectionToc";
220
+ readonly order = 1;
221
+ onVisitElement: (id: string, domState: DomState & {
222
+ currentNode: PageElement;
223
+ }, pageManager: PageManager) => void;
224
+ getHeadingLevel(node: SafeElement): number | null;
225
+ }
226
+
227
+ export declare type SectionTocState = {
228
+ sectionId: string;
229
+ pageNumber: number;
230
+ title: string;
231
+ level: number;
232
+ };
233
+
206
234
  export declare const SplitResult: {
207
235
  readonly None: 0;
208
236
  readonly FullNodePlaced: 1;
@@ -230,3 +258,11 @@ export declare interface VisitContext {
230
258
  }
231
259
 
232
260
  export { }
261
+
262
+
263
+ declare global {
264
+ interface Window {
265
+ [paprize_isReady]?: boolean;
266
+ [paprize_readJsonDataFile]?: () => Promise<string>;
267
+ }
268
+ }