@embedpdf-editor/vue3-chapter-viewer 1.0.5 → 1.0.7-beta.1

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/index.d.ts CHANGED
@@ -158,7 +158,10 @@ declare interface ChapterManagerCapability {
158
158
  setManifest(manifest: ChapterManifest, strategy?: OverlapOwnerStrategy): void;
159
159
  getManifest(): ChapterManifest;
160
160
  getVirtualPageMap(): VirtualPageMap;
161
- /** ChapterScrollPlugin 在可见页位变化时调用,用以驱动按需加载 */
161
+ /**
162
+ * ChapterScroll 在可见区变化时调用,用以驱动按需加载。
163
+ * 索引含上下 buffer(与 layout.items 范围一致),不仅是严格视口内页。
164
+ */
162
165
  setVisibleGlobalPages(visiblePageIndices: number[]): void;
163
166
  /** 显式触发某章节加载(分段章节仅加载第 0 段) */
164
167
  ensureChapterLoaded(chapterId: string): Promise<ChapterLoadStatus>;
@@ -210,6 +213,11 @@ export declare class ChapterManagerPlugin extends BasePlugin<ChapterManagerPlugi
210
213
  private readonly pendingChapterUrlsPromises;
211
214
  private unloadTimer;
212
215
  private documentManagerUnsubs;
216
+ private segmentScheduler;
217
+ /** 视口内下一段预取,优先级 = 视口距离 + 该值 */
218
+ private readonly SEG_PRIO_PREFETCH_NEXT;
219
+ /** 相邻章仅预取第 0 段 */
220
+ private readonly SEG_PRIO_CHAPTER_PREFETCH_BASE;
213
221
  constructor(id: string, registry: PluginRegistry);
214
222
  initialize(config: ChapterManagerPluginConfig): Promise<void>;
215
223
  protected buildCapability(): ChapterManagerCapability;
@@ -218,15 +226,19 @@ export declare class ChapterManagerPlugin extends BasePlugin<ChapterManagerPlugi
218
226
  private eagerPrefetchFromManifest;
219
227
  private findChapter;
220
228
  private getSegmentPlanForChapter;
229
+ private anySegmentOpen;
221
230
  private isSegmentDocumentOpen;
222
231
  private resolveSegmentDocumentId;
223
232
  private isSegmentLoadPending;
224
233
  private syncChapterStatusFromDocuments;
234
+ private lastVisibleIndicesKey;
225
235
  private handleVisibleChange;
226
236
  private collectIdleChapters;
227
237
  ensureChapterLoaded(chapterId: string): Promise<ChapterLoadStatus>;
228
238
  ensureAllSegmentsLoaded(chapterId: string): Promise<ChapterLoadStatus>;
239
+ /** 显式加载(跳转/导出等),不走可见区调度队列 */
229
240
  ensureSegmentLoaded(chapterId: string, segmentIndex: number): Promise<ChapterLoadStatus>;
241
+ private loadSegmentNow;
230
242
  private ensureSingleDocumentChapter;
231
243
  private resolveChapterUrls;
232
244
  private openPayloadFromUrl;
@@ -246,6 +258,8 @@ declare interface ChapterManagerPluginConfig extends BasePluginConfig {
246
258
  chapterPdfLoader?: IChapterPdfLoader;
247
259
  /** 视口前后预取多少章节,默认 1 */
248
260
  prefetchChapters?: number;
261
+ /** 同时 open 的分段 PDF 上限,默认 2(避免多段并行 WASM 卡主线程) */
262
+ maxConcurrentSegmentLoads?: number;
249
263
  /** 章节空闲多久后卸载(毫秒),默认 60s。设为 0 关闭卸载 */
250
264
  unloadTimeoutMs?: number;
251
265
  /** 第一个加载的章节是否自动设为 active,默认 true */
@@ -545,6 +559,8 @@ export declare interface CreatePdfChapterEditorOptions {
545
559
  toolbar?: PdfChapterEditorToolbarConfig;
546
560
  /** 传给 chapter-manager;manifest 就绪后预取前 N 章 */
547
561
  prefetchChapters?: number;
562
+ /** 同时 open 的分段 PDF 数,默认 2 */
563
+ maxConcurrentSegmentLoads?: number;
548
564
  /** 为 false 时不拉取 CDN 默认图章库(@embedpdf/default-stamps) */
549
565
  loadDefaultStampLibrary?: boolean;
550
566
  unloadTimeoutMs?: number;