@worm-vue3-print/core 1.3.3 → 1.3.5

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.
@@ -1,3 +1,9 @@
1
+ /*!
2
+ * @worm-vue3-print/core v1.3.5
3
+ * Copyright (c) 2026 Worm Base AI
4
+ * SPDX-FileCopyrightText: 2026 Worm Base AI
5
+ * SPDX-License-Identifier: MIT
6
+ */
1
7
  /** 拼版配置(模板级,随模板保存) */
2
8
  interface TilingOptions {
3
9
  enabled: boolean;
@@ -200,10 +206,6 @@ interface TemplateData$1 {
200
206
  height: number;
201
207
  elements: TemplateElement$1[];
202
208
  };
203
- firstPageOverlay: {
204
- height: number;
205
- elements: TemplateElement$1[];
206
- };
207
209
  elements: TemplateElement$1[];
208
210
  /** 页面名称(多页面模板中用于设计器页签显示;渲染端忽略) */
209
211
  name?: string;
@@ -255,7 +257,7 @@ type TextFit = 'clip' | 'shrink' | 'autoHeight';
255
257
  type VerticalAlign = 'top' | 'middle' | 'bottom';
256
258
  /** 缩放手柄方向 */
257
259
  type ResizePoint = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
258
- /** 设计背景(定位底图):仅设计画布显示,预览/PDF/打印/截图均不输出 */
260
+ /** 设计背景(定位底图):仅设计画布显示,预览/PDF/打印均不输出 */
259
261
  interface DesignBackground {
260
262
  /** 宿主上传接口返回的完整图片路径,可直接用于 <img src> */
261
263
  src: string;
@@ -364,7 +366,7 @@ interface ElementFieldBinding {
364
366
  }
365
367
  /** 元素分边边框的边位 */
366
368
  type ElementBorderSide = 'top' | 'right' | 'bottom' | 'left';
367
- /** 元素单边边框规格(px 口径,与整圈 borderWidth 一致;区别于单元格的 pt 口径) */
369
+ /** 元素单边边框规格(pt 口径,与整圈 borderWidth 及单元格边框统一) */
368
370
  interface ElementBorderEdge {
369
371
  width: number;
370
372
  style?: string;
@@ -401,7 +403,7 @@ interface ElementOptions {
401
403
  borderWidth?: number;
402
404
  borderStyle?: string;
403
405
  borderColor?: string;
404
- /** 元素分边边框(px 口径):在整圈三字段之上逐边覆盖;未设整圈时仅这些边生效 */
406
+ /** 元素分边边框(pt 口径):在整圈三字段之上逐边覆盖;未设整圈时仅这些边生效 */
405
407
  borders?: Partial<Record<ElementBorderSide, ElementBorderEdge>>;
406
408
  contentPaddingLeft?: number;
407
409
  contentPaddingTop?: number;
@@ -527,13 +529,6 @@ interface BindingDescriptor {
527
529
  /** 是否允许清空 */
528
530
  clearable?: boolean;
529
531
  }
530
- /** 截图请求载荷(设计器叠层对比用) */
531
- interface ScreenshotRequest {
532
- templateJson: TemplateData$1;
533
- printData: Record<string, any>;
534
- }
535
- /** 截图适配器:宿主依据模板 + 数据返回 PNG Blob */
536
- type RequestScreenshotFn = (req: ScreenshotRequest) => Promise<Blob>;
537
532
  /** 图片上传适配器:宿主上传文件并返回可访问的图片 URL */
538
533
  type UploadImageFn = (file: File) => Promise<string>;
539
534
  /**
@@ -603,10 +598,6 @@ interface TemplateData {
603
598
  height: number;
604
599
  elements: TemplateElement[];
605
600
  };
606
- firstPageOverlay: {
607
- height: number;
608
- elements: TemplateElement[];
609
- };
610
601
  elements: TemplateElement[];
611
602
  }
612
603
  /** 元素分页属性(非表格元素) */
@@ -843,11 +834,6 @@ interface PdfTargetSpec {
843
834
  scale: number;
844
835
  preferCSSPageSize: boolean;
845
836
  }
846
- interface ScreenshotTargetSpec {
847
- type: 'png';
848
- fullPage: boolean;
849
- omitBackground: boolean;
850
- }
851
837
  /** 宿主回传的原始测量值(CSS px,不做任何业务换算) */
852
838
  interface RawMeasurement {
853
839
  id: string;
@@ -935,11 +921,10 @@ interface PageDriver {
935
921
  injectExecutor(bundle: ExecutorBundle): Promise<void>;
936
922
  evaluate<T>(method: ExecutorMethod, args?: unknown[]): Promise<T>;
937
923
  pdf?(html: string, spec: PdfTargetSpec): Promise<Uint8Array>;
938
- screenshot?(html: string, spec: ScreenshotTargetSpec): Promise<Uint8Array>;
939
924
  close(): Promise<void>;
940
925
  }
941
926
  interface DriverFactory {
942
927
  createDriver(): Promise<PageDriver>;
943
928
  }
944
929
 
945
- export { type ExecutorBundle as $, type AdsorbResult as A, type BindingDescriptor as B, type CodeRenderer as C, type DriverFactory as D, type ElementBorderSide as E, type TableSelection as F, type TemplateElement$1 as G, type TextAlign as H, type TextFit as I, type UploadImageFn as J, type MeasuredElement as K, type TemplateElement as L, type MultiPageTemplateData as M, type PaperMm as N, type ViewportPx as O, type PageLayout as P, type HeightSource as Q, type RawMeasurement as R, type ScreenshotRequest as S, type TemplateData as T, type UploadDesignBackgroundFn as U, type VerticalAlign as V, type WatermarkOptions as W, type MarginsMm as X, type PdfTargetSpec as Y, type ScreenshotTargetSpec as Z, type CodeRenderOptions as _, type CodeSpec as a, type TileLayout as a0, type PrintJob as a1, type PreparedDocument as a2, type RenderPdfResult as a3, type PrintFontDeclaration as a4, type ContinuousPaperSize as a5, EXECUTOR_TARGETS as a6, type ExecutorMethod as a7, type ExecutorTargetKind as a8, FALLBACK_FONT_STACK as a9, normalizePrintData as aA, normalizeTilingOptions as aB, resolveSheetMm as aC, roundMm as aD, tilePosition as aE, toFontFamilyStack as aF, validateTiling as aG, MAX_BATCH_COPIES as aa, type NormalizedPrintData as ab, PAPER_DIMENSIONS as ac, type PageDriver as ad, type PageSection as ae, type PaperSize as af, type PrintDataInput as ag, type PrintFontFile as ah, type RenderCell as ai, type RenderRequest as aj, type RenderRow as ak, type SheetPaperSize as al, TILE_DEFAULTS as am, TilingError as an, type TilingIssue as ao, type TilingIssueCode as ap, type TilingOptions as aq, type TilingResolveOptions as ar, type TilingTemplateInput as as, buildFontFaceCss as at, computeMaxColumns as au, computeTileLayout as av, escapeInlineStyleValue as aw, getPaperDimensions as ax, isContinuousPaper as ay, isContinuousPaperSize as az, type ElementOptions as b, type TemplateData$1 as c, type TableRow as d, type TableCellBorder as e, type TableCell as f, type TableRowType as g, type ElementType as h, type RuntimeElement as i, type ElementZone as j, type PrintBusinessField as k, type ElementRect as l, type ResizePoint as m, type AlignLine as n, type DesignBackground as o, type ElementBorderEdge as p, type ElementFieldBinding as q, type MultiPageTemplateData$1 as r, type PaginationConfig$1 as s, type PaperSize$1 as t, type PrintElementData as u, type PrintElementTypeMeta as v, type RequestScreenshotFn as w, type TableCellBorders as x, type TableCellType as y, type TablePaginationConfig$1 as z };
930
+ export { type PreparedDocument as $, type AdsorbResult as A, type BindingDescriptor as B, type CodeRenderer as C, type DriverFactory as D, type ElementBorderSide as E, type TemplateElement$1 as F, type TextAlign as G, type TextFit as H, type UploadImageFn as I, type MeasuredElement as J, type TemplateElement as K, type PaperMm as L, type MultiPageTemplateData as M, type ViewportPx as N, type HeightSource as O, type PageLayout as P, type MarginsMm as Q, type RawMeasurement as R, type PdfTargetSpec as S, type TemplateData as T, type UploadDesignBackgroundFn as U, type VerticalAlign as V, type WatermarkOptions as W, type CodeRenderOptions as X, type ExecutorBundle as Y, type TileLayout as Z, type PrintJob as _, type CodeSpec as a, type RenderPdfResult as a0, type PrintFontDeclaration as a1, type ContinuousPaperSize as a2, EXECUTOR_TARGETS as a3, type ExecutorMethod as a4, type ExecutorTargetKind as a5, FALLBACK_FONT_STACK as a6, MAX_BATCH_COPIES as a7, type NormalizedPrintData as a8, PAPER_DIMENSIONS as a9, roundMm as aA, tilePosition as aB, toFontFamilyStack as aC, validateTiling as aD, type PageDriver as aa, type PageSection as ab, type PaperSize as ac, type PrintDataInput as ad, type PrintFontFile as ae, type RenderCell as af, type RenderRequest as ag, type RenderRow as ah, type SheetPaperSize as ai, TILE_DEFAULTS as aj, TilingError as ak, type TilingIssue as al, type TilingIssueCode as am, type TilingOptions as an, type TilingResolveOptions as ao, type TilingTemplateInput as ap, buildFontFaceCss as aq, computeMaxColumns as ar, computeTileLayout as as, escapeInlineStyleValue as at, getPaperDimensions as au, isContinuousPaper as av, isContinuousPaperSize as aw, normalizePrintData as ax, normalizeTilingOptions as ay, resolveSheetMm as az, type ElementOptions as b, type TemplateData$1 as c, type TableRow as d, type TableCellBorder as e, type TableCell as f, type TableRowType as g, type ElementType as h, type RuntimeElement as i, type ElementZone as j, type PrintBusinessField as k, type ElementRect as l, type ResizePoint as m, type AlignLine as n, type DesignBackground as o, type ElementBorderEdge as p, type ElementFieldBinding as q, type MultiPageTemplateData$1 as r, type PaginationConfig$1 as s, type PaperSize$1 as t, type PrintElementData as u, type PrintElementTypeMeta as v, type TableCellBorders as w, type TableCellType as x, type TablePaginationConfig$1 as y, type TableSelection as z };
@@ -1,3 +1,9 @@
1
+ /*!
2
+ * @worm-vue3-print/core v1.3.5
3
+ * Copyright (c) 2026 Worm Base AI
4
+ * SPDX-FileCopyrightText: 2026 Worm Base AI
5
+ * SPDX-License-Identifier: MIT
6
+ */
1
7
  /** 拼版配置(模板级,随模板保存) */
2
8
  interface TilingOptions {
3
9
  enabled: boolean;
@@ -200,10 +206,6 @@ interface TemplateData$1 {
200
206
  height: number;
201
207
  elements: TemplateElement$1[];
202
208
  };
203
- firstPageOverlay: {
204
- height: number;
205
- elements: TemplateElement$1[];
206
- };
207
209
  elements: TemplateElement$1[];
208
210
  /** 页面名称(多页面模板中用于设计器页签显示;渲染端忽略) */
209
211
  name?: string;
@@ -255,7 +257,7 @@ type TextFit = 'clip' | 'shrink' | 'autoHeight';
255
257
  type VerticalAlign = 'top' | 'middle' | 'bottom';
256
258
  /** 缩放手柄方向 */
257
259
  type ResizePoint = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
258
- /** 设计背景(定位底图):仅设计画布显示,预览/PDF/打印/截图均不输出 */
260
+ /** 设计背景(定位底图):仅设计画布显示,预览/PDF/打印均不输出 */
259
261
  interface DesignBackground {
260
262
  /** 宿主上传接口返回的完整图片路径,可直接用于 <img src> */
261
263
  src: string;
@@ -364,7 +366,7 @@ interface ElementFieldBinding {
364
366
  }
365
367
  /** 元素分边边框的边位 */
366
368
  type ElementBorderSide = 'top' | 'right' | 'bottom' | 'left';
367
- /** 元素单边边框规格(px 口径,与整圈 borderWidth 一致;区别于单元格的 pt 口径) */
369
+ /** 元素单边边框规格(pt 口径,与整圈 borderWidth 及单元格边框统一) */
368
370
  interface ElementBorderEdge {
369
371
  width: number;
370
372
  style?: string;
@@ -401,7 +403,7 @@ interface ElementOptions {
401
403
  borderWidth?: number;
402
404
  borderStyle?: string;
403
405
  borderColor?: string;
404
- /** 元素分边边框(px 口径):在整圈三字段之上逐边覆盖;未设整圈时仅这些边生效 */
406
+ /** 元素分边边框(pt 口径):在整圈三字段之上逐边覆盖;未设整圈时仅这些边生效 */
405
407
  borders?: Partial<Record<ElementBorderSide, ElementBorderEdge>>;
406
408
  contentPaddingLeft?: number;
407
409
  contentPaddingTop?: number;
@@ -527,13 +529,6 @@ interface BindingDescriptor {
527
529
  /** 是否允许清空 */
528
530
  clearable?: boolean;
529
531
  }
530
- /** 截图请求载荷(设计器叠层对比用) */
531
- interface ScreenshotRequest {
532
- templateJson: TemplateData$1;
533
- printData: Record<string, any>;
534
- }
535
- /** 截图适配器:宿主依据模板 + 数据返回 PNG Blob */
536
- type RequestScreenshotFn = (req: ScreenshotRequest) => Promise<Blob>;
537
532
  /** 图片上传适配器:宿主上传文件并返回可访问的图片 URL */
538
533
  type UploadImageFn = (file: File) => Promise<string>;
539
534
  /**
@@ -603,10 +598,6 @@ interface TemplateData {
603
598
  height: number;
604
599
  elements: TemplateElement[];
605
600
  };
606
- firstPageOverlay: {
607
- height: number;
608
- elements: TemplateElement[];
609
- };
610
601
  elements: TemplateElement[];
611
602
  }
612
603
  /** 元素分页属性(非表格元素) */
@@ -843,11 +834,6 @@ interface PdfTargetSpec {
843
834
  scale: number;
844
835
  preferCSSPageSize: boolean;
845
836
  }
846
- interface ScreenshotTargetSpec {
847
- type: 'png';
848
- fullPage: boolean;
849
- omitBackground: boolean;
850
- }
851
837
  /** 宿主回传的原始测量值(CSS px,不做任何业务换算) */
852
838
  interface RawMeasurement {
853
839
  id: string;
@@ -935,11 +921,10 @@ interface PageDriver {
935
921
  injectExecutor(bundle: ExecutorBundle): Promise<void>;
936
922
  evaluate<T>(method: ExecutorMethod, args?: unknown[]): Promise<T>;
937
923
  pdf?(html: string, spec: PdfTargetSpec): Promise<Uint8Array>;
938
- screenshot?(html: string, spec: ScreenshotTargetSpec): Promise<Uint8Array>;
939
924
  close(): Promise<void>;
940
925
  }
941
926
  interface DriverFactory {
942
927
  createDriver(): Promise<PageDriver>;
943
928
  }
944
929
 
945
- export { type ExecutorBundle as $, type AdsorbResult as A, type BindingDescriptor as B, type CodeRenderer as C, type DriverFactory as D, type ElementBorderSide as E, type TableSelection as F, type TemplateElement$1 as G, type TextAlign as H, type TextFit as I, type UploadImageFn as J, type MeasuredElement as K, type TemplateElement as L, type MultiPageTemplateData as M, type PaperMm as N, type ViewportPx as O, type PageLayout as P, type HeightSource as Q, type RawMeasurement as R, type ScreenshotRequest as S, type TemplateData as T, type UploadDesignBackgroundFn as U, type VerticalAlign as V, type WatermarkOptions as W, type MarginsMm as X, type PdfTargetSpec as Y, type ScreenshotTargetSpec as Z, type CodeRenderOptions as _, type CodeSpec as a, type TileLayout as a0, type PrintJob as a1, type PreparedDocument as a2, type RenderPdfResult as a3, type PrintFontDeclaration as a4, type ContinuousPaperSize as a5, EXECUTOR_TARGETS as a6, type ExecutorMethod as a7, type ExecutorTargetKind as a8, FALLBACK_FONT_STACK as a9, normalizePrintData as aA, normalizeTilingOptions as aB, resolveSheetMm as aC, roundMm as aD, tilePosition as aE, toFontFamilyStack as aF, validateTiling as aG, MAX_BATCH_COPIES as aa, type NormalizedPrintData as ab, PAPER_DIMENSIONS as ac, type PageDriver as ad, type PageSection as ae, type PaperSize as af, type PrintDataInput as ag, type PrintFontFile as ah, type RenderCell as ai, type RenderRequest as aj, type RenderRow as ak, type SheetPaperSize as al, TILE_DEFAULTS as am, TilingError as an, type TilingIssue as ao, type TilingIssueCode as ap, type TilingOptions as aq, type TilingResolveOptions as ar, type TilingTemplateInput as as, buildFontFaceCss as at, computeMaxColumns as au, computeTileLayout as av, escapeInlineStyleValue as aw, getPaperDimensions as ax, isContinuousPaper as ay, isContinuousPaperSize as az, type ElementOptions as b, type TemplateData$1 as c, type TableRow as d, type TableCellBorder as e, type TableCell as f, type TableRowType as g, type ElementType as h, type RuntimeElement as i, type ElementZone as j, type PrintBusinessField as k, type ElementRect as l, type ResizePoint as m, type AlignLine as n, type DesignBackground as o, type ElementBorderEdge as p, type ElementFieldBinding as q, type MultiPageTemplateData$1 as r, type PaginationConfig$1 as s, type PaperSize$1 as t, type PrintElementData as u, type PrintElementTypeMeta as v, type RequestScreenshotFn as w, type TableCellBorders as x, type TableCellType as y, type TablePaginationConfig$1 as z };
930
+ export { type PreparedDocument as $, type AdsorbResult as A, type BindingDescriptor as B, type CodeRenderer as C, type DriverFactory as D, type ElementBorderSide as E, type TemplateElement$1 as F, type TextAlign as G, type TextFit as H, type UploadImageFn as I, type MeasuredElement as J, type TemplateElement as K, type PaperMm as L, type MultiPageTemplateData as M, type ViewportPx as N, type HeightSource as O, type PageLayout as P, type MarginsMm as Q, type RawMeasurement as R, type PdfTargetSpec as S, type TemplateData as T, type UploadDesignBackgroundFn as U, type VerticalAlign as V, type WatermarkOptions as W, type CodeRenderOptions as X, type ExecutorBundle as Y, type TileLayout as Z, type PrintJob as _, type CodeSpec as a, type RenderPdfResult as a0, type PrintFontDeclaration as a1, type ContinuousPaperSize as a2, EXECUTOR_TARGETS as a3, type ExecutorMethod as a4, type ExecutorTargetKind as a5, FALLBACK_FONT_STACK as a6, MAX_BATCH_COPIES as a7, type NormalizedPrintData as a8, PAPER_DIMENSIONS as a9, roundMm as aA, tilePosition as aB, toFontFamilyStack as aC, validateTiling as aD, type PageDriver as aa, type PageSection as ab, type PaperSize as ac, type PrintDataInput as ad, type PrintFontFile as ae, type RenderCell as af, type RenderRequest as ag, type RenderRow as ah, type SheetPaperSize as ai, TILE_DEFAULTS as aj, TilingError as ak, type TilingIssue as al, type TilingIssueCode as am, type TilingOptions as an, type TilingResolveOptions as ao, type TilingTemplateInput as ap, buildFontFaceCss as aq, computeMaxColumns as ar, computeTileLayout as as, escapeInlineStyleValue as at, getPaperDimensions as au, isContinuousPaper as av, isContinuousPaperSize as aw, normalizePrintData as ax, normalizeTilingOptions as ay, resolveSheetMm as az, type ElementOptions as b, type TemplateData$1 as c, type TableRow as d, type TableCellBorder as e, type TableCell as f, type TableRowType as g, type ElementType as h, type RuntimeElement as i, type ElementZone as j, type PrintBusinessField as k, type ElementRect as l, type ResizePoint as m, type AlignLine as n, type DesignBackground as o, type ElementBorderEdge as p, type ElementFieldBinding as q, type MultiPageTemplateData$1 as r, type PaginationConfig$1 as s, type PaperSize$1 as t, type PrintElementData as u, type PrintElementTypeMeta as v, type TableCellBorders as w, type TableCellType as x, type TablePaginationConfig$1 as y, type TableSelection as z };
package/dist/index.cjs CHANGED
@@ -1,3 +1,9 @@
1
+ /*!
2
+ * @worm-vue3-print/core v1.3.5
3
+ * Copyright (c) 2026 Worm Base AI
4
+ * SPDX-FileCopyrightText: 2026 Worm Base AI
5
+ * SPDX-License-Identifier: MIT
6
+ */
1
7
  "use strict";
2
8
  var __defProp = Object.defineProperty;
3
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -50,7 +56,6 @@ __export(index_exports, {
50
56
  buildPageGeometryCss: () => buildPageGeometryCss,
51
57
  buildPageRuleCss: () => buildPageRuleCss,
52
58
  buildPdfTargetSpec: () => buildPdfTargetSpec,
53
- buildScreenshotTargetSpec: () => buildScreenshotTargetSpec,
54
59
  cellFitCapMm: () => cellFitCapMm,
55
60
  cellFitKey: () => cellFitKey,
56
61
  codeSpecKey: () => codeSpecKey,
@@ -106,7 +111,6 @@ __export(index_exports, {
106
111
  prepareDocument: () => prepareDocument,
107
112
  pxToMm: () => pxToMm,
108
113
  renderPdf: () => renderPdf,
109
- renderScreenshot: () => renderScreenshot,
110
114
  renderTemplate: () => renderTemplate,
111
115
  renderWatermarkLayerHtml: () => renderWatermarkLayerHtml,
112
116
  renderWatermarkTileSvg: () => renderWatermarkTileSvg,
@@ -1070,9 +1074,6 @@ function bindData(template, printData, baseUrl, fontBaseUrl) {
1070
1074
  if (bound.footer?.elements) {
1071
1075
  bound.footer.elements = bound.footer.elements.map((el) => bindElement(el, data, baseUrl));
1072
1076
  }
1073
- if (bound.firstPageOverlay?.elements) {
1074
- bound.firstPageOverlay.elements = bound.firstPageOverlay.elements.map((el) => bindElement(el, data, baseUrl));
1075
- }
1076
1077
  bound.elements = bound.elements.map((el) => bindElement(el, data, baseUrl));
1077
1078
  const fontBase = fontBaseUrl ?? baseUrl;
1078
1079
  if (fontBase && bound.fonts?.length) {
@@ -1513,7 +1514,6 @@ function areaGeometryBlock(template, paper, desc) {
1513
1514
  const { bottom: mb } = template.margins;
1514
1515
  const headerH = template.header?.height ?? 0;
1515
1516
  const footerH = template.footer?.height ?? 0;
1516
- const overlayH = template.firstPageOverlay?.height ?? 0;
1517
1517
  const contentWidth = paper.width - ml - mr;
1518
1518
  return `
1519
1519
  /* \u2500\u2500 \u9875\u7709 \u2500\u2500 */
@@ -1525,13 +1525,14 @@ ${desc}.page-header {
1525
1525
 
1526
1526
  /* \u2500\u2500 \u9875\u811A\uFF1A\u7EDD\u5BF9\u5B9A\u4F4D\u56FA\u5B9A\u5728\u9875\u9762\u5E95\u90E8\uFF08\u5185\u5BB9\u4E0D\u8DB3\u65F6\u4E0D\u968F\u6587\u6863\u6D41\u4E0A\u6D6E\uFF09 \u2500\u2500
1527
1527
  \u7528\u663E\u5F0F top \u5B9A\u4F4D\u5230\u300C\u7EB8\u9AD8 - \u4E0B\u8FB9\u8DDD - \u9875\u811A\u9AD8\u300D\uFF0C\u4FDD\u8BC1\u4E0B\u8FB9\u8DDD\u751F\u6548\u3001
1528
- \u4E0E\u8BBE\u8BA1\u5668 CanvasPaper \u7684\u4E09\u533A\u51E0\u4F55\u4E00\u81F4\u3002 */
1528
+ \u4E0E\u8BBE\u8BA1\u5668 CanvasPaper \u7684\u4E09\u533A\u51E0\u4F55\u4E00\u81F4\u3002
1529
+ \u7EDD\u5BF9\u5B9A\u4F4D\u7684\u5305\u542B\u5757\u662F padding box \u5916\u7F18\uFF08= \u7EB8\u9762\uFF09\uFF0Cleft \u987B\u663E\u5F0F\u8865\u5DE6\u8FB9\u8DDD\u3002 */
1529
1530
  ${desc}.page-footer {
1530
1531
  width: ${mm(contentWidth)};
1531
1532
  height: ${mm(footerH)};
1532
1533
  position: absolute;
1533
1534
  top: ${mm(paper.height - mb - footerH)};
1534
- left: 0;
1535
+ left: ${mm(ml)};
1535
1536
  }
1536
1537
 
1537
1538
  /* \u2500\u2500 \u5185\u5BB9\u533A \u2500\u2500 */
@@ -1540,13 +1541,6 @@ ${desc}.content-area {
1540
1541
  position: relative;
1541
1542
  overflow: visible;
1542
1543
  }
1543
-
1544
- /* \u2500\u2500 \u9996\u9875\u53E0\u52A0\u533A\u57DF \u2500\u2500 */
1545
- ${desc}.first-page-overlay {
1546
- width: ${mm(contentWidth)};
1547
- height: ${mm(overlayH)};
1548
- position: relative;
1549
- }
1550
1544
  `;
1551
1545
  }
1552
1546
  function buildBasePageCss() {
@@ -1735,7 +1729,7 @@ var VALID_STYLES = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double
1735
1729
  function parseBorder(width, style, color) {
1736
1730
  if (typeof width !== "number" || !Number.isFinite(width) || width <= 0) return null;
1737
1731
  return {
1738
- borderWidth: `${width}px`,
1732
+ borderWidth: `${width}pt`,
1739
1733
  borderStyle: typeof style === "string" && VALID_STYLES.has(style) ? style : "solid",
1740
1734
  borderColor: color || "#000"
1741
1735
  };
@@ -2021,7 +2015,6 @@ function paginate(template, measuredElements) {
2021
2015
  const { top: mt, bottom: mb } = template.margins;
2022
2016
  const headerH = template.header?.height ?? 0;
2023
2017
  const footerH = template.footer?.height ?? 0;
2024
- const overlayH = template.firstPageOverlay?.height ?? 0;
2025
2018
  const continuous = isContinuousPaper(template);
2026
2019
  const contentHeight = continuous ? Number.POSITIVE_INFINITY : paper.height - mt - mb - headerH - footerH;
2027
2020
  if (!continuous && contentHeight <= 0) {
@@ -2061,8 +2054,7 @@ function paginate(template, measuredElements) {
2061
2054
  const unitOf = buildPaginationUnits(sorted, measuredElements, groupMap);
2062
2055
  const pages = [];
2063
2056
  let currentPage = [];
2064
- let remaining = contentHeight - overlayH - SAFETY_MARGIN;
2065
- let isFirstPage = true;
2057
+ let remaining = contentHeight - SAFETY_MARGIN;
2066
2058
  let pageBroken = false;
2067
2059
  function sectionTop(el) {
2068
2060
  return pageBroken ? pageCursorTop() : el.options?.top ?? 0;
@@ -2071,7 +2063,7 @@ function paginate(template, measuredElements) {
2071
2063
  return Math.max(0, fullPageHeight() - remaining);
2072
2064
  }
2073
2065
  function fullPageHeight() {
2074
- return isFirstPage ? contentHeight - overlayH - SAFETY_MARGIN : contentHeight - SAFETY_MARGIN;
2066
+ return contentHeight - SAFETY_MARGIN;
2075
2067
  }
2076
2068
  let overflowOnCurrent = false;
2077
2069
  function pushPage() {
@@ -2090,7 +2082,6 @@ function paginate(template, measuredElements) {
2090
2082
  pushPage();
2091
2083
  currentPage = [];
2092
2084
  remaining = contentHeight - SAFETY_MARGIN;
2093
- isFirstPage = false;
2094
2085
  pageBroken = true;
2095
2086
  overflowOnCurrent = false;
2096
2087
  }
@@ -2400,7 +2391,6 @@ function generateMeasurementHtml(template, css, ctx, printData) {
2400
2391
  // totalPages placeholder
2401
2392
  ctx
2402
2393
  );
2403
- const overlayHtml = renderAreaElements(template.firstPageOverlay?.elements ?? [], contentWidth, void 0, void 0, ctx);
2404
2394
  let html = `<!DOCTYPE html>
2405
2395
  <html lang="zh-CN">
2406
2396
  <head>
@@ -2411,7 +2401,6 @@ function generateMeasurementHtml(template, css, ctx, printData) {
2411
2401
  <section class="print-page" data-measure-page="0">
2412
2402
  ${renderWatermarkLayerHtml(template.watermark, printData, getPaperDims(template))}
2413
2403
  <div class="page-header">${headerHtml}</div>
2414
- <div class="first-page-overlay">${overlayHtml}</div>
2415
2404
  <div class="content-area" style="height:auto;overflow:visible;">
2416
2405
  ${elementsHtml}
2417
2406
  </div>
@@ -2475,14 +2464,12 @@ function renderPage(template, page, pageNum, totalPages, ctx, printData, pageCla
2475
2464
  totalPages,
2476
2465
  pageCtx
2477
2466
  );
2478
- const overlayHtml = page.pageIndex === 0 ? `<div class="first-page-overlay">${renderAreaElements(scoped.firstPageOverlay?.elements ?? [], contentWidth, pageNum, totalPages, pageCtx)}</div>` : "";
2479
2467
  let contentHtml = page.sections.map((section) => renderSection(section, scoped, pageCtx)).join("\n");
2480
2468
  contentHtml = contentHtml.replace(/\{pageIndex\}/g, String(pageNum));
2481
2469
  contentHtml = contentHtml.replace(/\{totalPages\}/g, String(totalPages));
2482
2470
  const pageInner = `
2483
2471
  ${renderWatermarkLayerHtml(template.watermark, printData, paperMm, { pageIndex: pageNum, totalPages })}
2484
2472
  <div class="page-header">${headerHtml}</div>
2485
- ${overlayHtml}
2486
2473
  <div class="content-area">
2487
2474
  ${contentHtml}
2488
2475
  </div>
@@ -2506,16 +2493,14 @@ function withPageNumbers(template, vars) {
2506
2493
  ...template,
2507
2494
  elements: template.elements.map(mapEl),
2508
2495
  header: mapArea(template.header),
2509
- footer: mapArea(template.footer),
2510
- firstPageOverlay: mapArea(template.firstPageOverlay)
2496
+ footer: mapArea(template.footer)
2511
2497
  };
2512
2498
  }
2513
2499
  function templateReferencesPageNumbers(template) {
2514
2500
  const areas = [
2515
2501
  template.elements,
2516
2502
  template.header?.elements,
2517
- template.footer?.elements,
2518
- template.firstPageOverlay?.elements
2503
+ template.footer?.elements
2519
2504
  ];
2520
2505
  return areas.some((list) => (list ?? []).some((el) => typeof el.options?.rawFormatter === "string"));
2521
2506
  }
@@ -2615,13 +2600,13 @@ function renderElement(el, isMeasure, containerStyle, overrideTop, ctx) {
2615
2600
  </div>`;
2616
2601
  }
2617
2602
  case "hline":
2618
- return `<div class="print-element" style="${style};border-top:1px solid #000;height:0;"${measureAttr}></div>`;
2603
+ return `<div class="print-element" style="${style};border-top:${opts.borderWidth || 0.75}pt ${opts.borderStyle || "solid"} ${opts.borderColor || "#333"};height:0;"${measureAttr}></div>`;
2619
2604
  case "vline":
2620
- return `<div class="print-element" style="${style};border-left:1px solid #000;width:0;"${measureAttr}></div>`;
2605
+ return `<div class="print-element" style="${style};border-left:${opts.borderWidth || 0.75}pt ${opts.borderStyle || "solid"} ${opts.borderColor || "#333"};width:0;"${measureAttr}></div>`;
2621
2606
  case "rect":
2622
- return `<div class="print-element" style="${style};border:${opts.borderWidth ?? 1}px solid ${opts.borderColor ?? "#000"};"${measureAttr}></div>`;
2607
+ return `<div class="print-element" style="${style};border:${opts.borderWidth || 1}pt ${opts.borderStyle || "solid"} ${opts.borderColor || "#333"};"${measureAttr}></div>`;
2623
2608
  case "oval":
2624
- return `<div class="print-element" style="${style};border:${opts.borderWidth ?? 1}px solid ${opts.borderColor ?? "#000"};border-radius:50%;"${measureAttr}></div>`;
2609
+ return `<div class="print-element" style="${style};border:${opts.borderWidth || 1}pt ${opts.borderStyle || "solid"} ${opts.borderColor || "#333"};border-radius:50%;"${measureAttr}></div>`;
2625
2610
  case "longText":
2626
2611
  return `<div class="print-element" style="${style}${textStyle(opts)}${elementFitStyle(fit, opts)}"${measureAttr}${fitAttr}>${esc(opts.formatter ?? opts.testData ?? "")}</div>`;
2627
2612
  case "html":
@@ -3004,9 +2989,6 @@ function toPlaywrightPdfOptions(spec) {
3004
2989
  preferCSSPageSize: spec.preferCSSPageSize
3005
2990
  };
3006
2991
  }
3007
- function buildScreenshotTargetSpec() {
3008
- return { type: "png", fullPage: true, omitBackground: false };
3009
- }
3010
2992
 
3011
2993
  // src/print/measure.ts
3012
2994
  function normalizeMeasurements(raw, template) {
@@ -3041,7 +3023,6 @@ function applyTextFitSizes(template, fits) {
3041
3023
  collect(template.elements);
3042
3024
  collect(template.header?.elements);
3043
3025
  collect(template.footer?.elements);
3044
- collect(template.firstPageOverlay?.elements);
3045
3026
  for (const fit of fits) {
3046
3027
  const parsed = parseCellFitKey(fit.key);
3047
3028
  if (!parsed) {
@@ -3213,23 +3194,6 @@ function createDomHostRuntime(factory, bundle) {
3213
3194
  "RENDER_TIMEOUT",
3214
3195
  `PDF \u751F\u6210\u8D85\u8FC7 ${ms}ms`
3215
3196
  );
3216
- },
3217
- async toScreenshot(html, spec, viewport) {
3218
- if (!driver.screenshot) throw new PrintFailure("UNSUPPORTED_RUNTIME", "\u5F53\u524D\u5BBF\u4E3B\u4E0D\u652F\u6301\u622A\u56FE");
3219
- const ms = budget();
3220
- return withTimeout(
3221
- (async () => {
3222
- try {
3223
- await load(html, viewport);
3224
- return await driver.screenshot(html, spec);
3225
- } catch (err) {
3226
- throw fail(err, "SCREENSHOT_FAILED", "\u622A\u56FE\u5931\u8D25");
3227
- }
3228
- })(),
3229
- ms,
3230
- "RENDER_TIMEOUT",
3231
- `\u622A\u56FE\u8D85\u8FC7 ${ms}ms`
3232
- );
3233
3197
  }
3234
3198
  };
3235
3199
  try {
@@ -3564,33 +3528,6 @@ async function renderPdf(job, runtime) {
3564
3528
  return { pdf, prepared };
3565
3529
  });
3566
3530
  }
3567
- async function renderScreenshot(job, runtime) {
3568
- return runtime.withSession(job, async (session) => {
3569
- const pageTemplates = normalizeTemplate(job.templateJson);
3570
- if (pageTemplates.length > 1) {
3571
- const normalized2 = normalizePrintData(job.printData);
3572
- const data2 = normalized2.mode === "batch" ? normalized2.dataList[0] : normalized2.data;
3573
- const copy = await prepareMultiCopy(job, session, data2);
3574
- const doc = composeMultiPageDocument([copy]);
3575
- const viewport2 = paperViewportPx(getPaperDimensions(pageTemplates[0]));
3576
- return session.toScreenshot(doc.html, buildScreenshotTargetSpec(), viewport2);
3577
- }
3578
- const singleJob = pageTemplates[0] !== job.templateJson ? { ...job, templateJson: pageTemplates[0] } : job;
3579
- const normalized = normalizePrintData(singleJob.printData);
3580
- const data = normalized.mode === "batch" ? normalized.dataList[0] : normalized.data;
3581
- const bound = bindData(singleJob.templateJson, data, singleJob.baseUrl, singleJob.fontBaseUrl);
3582
- const built = await buildHtmlWithCodes({
3583
- bound,
3584
- job: singleJob,
3585
- session,
3586
- data,
3587
- pageLayouts: [],
3588
- isMeasurementPass: true
3589
- });
3590
- const viewport = paperViewportPx(getPaperDimensions(bound));
3591
- return session.toScreenshot(built.html, buildScreenshotTargetSpec(), viewport);
3592
- });
3593
- }
3594
3531
  async function prepareWithSession(job, session) {
3595
3532
  const pageTemplates = normalizeTemplate(job.templateJson);
3596
3533
  if (pageTemplates.length > 1) {
@@ -3871,7 +3808,6 @@ var TemplateEngine = class {
3871
3808
  buildPageGeometryCss,
3872
3809
  buildPageRuleCss,
3873
3810
  buildPdfTargetSpec,
3874
- buildScreenshotTargetSpec,
3875
3811
  cellFitCapMm,
3876
3812
  cellFitKey,
3877
3813
  codeSpecKey,
@@ -3927,7 +3863,6 @@ var TemplateEngine = class {
3927
3863
  prepareDocument,
3928
3864
  pxToMm,
3929
3865
  renderPdf,
3930
- renderScreenshot,
3931
3866
  renderTemplate,
3932
3867
  renderWatermarkLayerHtml,
3933
3868
  renderWatermarkTileSvg,
package/dist/index.d.cts CHANGED
@@ -1,7 +1,13 @@
1
- import { T as TemplateData, C as CodeRenderer, P as PageLayout, K as MeasuredElement, L as TemplateElement, W as WatermarkOptions, N as PaperMm, O as ViewportPx, Q as HeightSource, X as MarginsMm, Y as PdfTargetSpec, Z as ScreenshotTargetSpec, R as RawMeasurement, a as CodeSpec, _ as CodeRenderOptions, D as DriverFactory, $ as ExecutorBundle, a0 as TileLayout, a1 as PrintJob, a2 as PreparedDocument, a3 as RenderPdfResult, M as MultiPageTemplateData, a4 as PrintFontDeclaration } from './driver-CNJVZK_L.cjs';
2
- export { a5 as ContinuousPaperSize, a6 as EXECUTOR_TARGETS, a7 as ExecutorMethod, a8 as ExecutorTargetKind, a9 as FALLBACK_FONT_STACK, aa as MAX_BATCH_COPIES, ab as NormalizedPrintData, ac as PAPER_DIMENSIONS, ad as PageDriver, ae as PageSection, af as PaperSize, ag as PrintDataInput, ah as PrintFontFile, ai as RenderCell, aj as RenderRequest, ak as RenderRow, al as SheetPaperSize, am as TILE_DEFAULTS, I as TextFit, an as TilingError, ao as TilingIssue, ap as TilingIssueCode, aq as TilingOptions, ar as TilingResolveOptions, as as TilingTemplateInput, at as buildFontFaceCss, au as computeMaxColumns, av as computeTileLayout, aw as escapeInlineStyleValue, ax as getPaperDimensions, ay as isContinuousPaper, az as isContinuousPaperSize, aA as normalizePrintData, aB as normalizeTilingOptions, aC as resolveSheetMm, aD as roundMm, aE as tilePosition, aF as toFontFamilyStack, aG as validateTiling } from './driver-CNJVZK_L.cjs';
3
- import { F as FitFontSize, P as PrintRuntime } from './ports-DeEgE2SL.cjs';
4
- export { C as CellFitRowKind, h as DEFAULT_READINESS_MS, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, i as DEFAULT_TIMEOUT_MS, M as MIN_SHRINK_FONT_SIZE_PT, j as MeasureResult, k as PrintSession, S as SessionBudget, c as cellFitCapMm, a as cellFitKey, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from './ports-DeEgE2SL.cjs';
1
+ /*!
2
+ * @worm-vue3-print/core v1.3.5
3
+ * Copyright (c) 2026 Worm Base AI
4
+ * SPDX-FileCopyrightText: 2026 Worm Base AI
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import { T as TemplateData, C as CodeRenderer, P as PageLayout, J as MeasuredElement, K as TemplateElement, W as WatermarkOptions, L as PaperMm, N as ViewportPx, O as HeightSource, Q as MarginsMm, S as PdfTargetSpec, R as RawMeasurement, a as CodeSpec, X as CodeRenderOptions, D as DriverFactory, Y as ExecutorBundle, Z as TileLayout, _ as PrintJob, $ as PreparedDocument, a0 as RenderPdfResult, M as MultiPageTemplateData, a1 as PrintFontDeclaration } from './driver-CFm0C_yX.cjs';
8
+ export { a2 as ContinuousPaperSize, a3 as EXECUTOR_TARGETS, a4 as ExecutorMethod, a5 as ExecutorTargetKind, a6 as FALLBACK_FONT_STACK, a7 as MAX_BATCH_COPIES, a8 as NormalizedPrintData, a9 as PAPER_DIMENSIONS, aa as PageDriver, ab as PageSection, ac as PaperSize, ad as PrintDataInput, ae as PrintFontFile, af as RenderCell, ag as RenderRequest, ah as RenderRow, ai as SheetPaperSize, aj as TILE_DEFAULTS, H as TextFit, ak as TilingError, al as TilingIssue, am as TilingIssueCode, an as TilingOptions, ao as TilingResolveOptions, ap as TilingTemplateInput, aq as buildFontFaceCss, ar as computeMaxColumns, as as computeTileLayout, at as escapeInlineStyleValue, au as getPaperDimensions, av as isContinuousPaper, aw as isContinuousPaperSize, ax as normalizePrintData, ay as normalizeTilingOptions, az as resolveSheetMm, aA as roundMm, aB as tilePosition, aC as toFontFamilyStack, aD as validateTiling } from './driver-CFm0C_yX.cjs';
9
+ import { F as FitFontSize, P as PrintRuntime } from './ports-BXYcHExa.cjs';
10
+ export { C as CellFitRowKind, h as DEFAULT_READINESS_MS, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, i as DEFAULT_TIMEOUT_MS, M as MIN_SHRINK_FONT_SIZE_PT, j as MeasureResult, k as PrintSession, S as SessionBudget, c as cellFitCapMm, a as cellFitKey, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from './ports-BXYcHExa.cjs';
5
11
 
6
12
  type TokenType = 'num' | 'str' | 'bool' | 'ident' | 'punc';
7
13
  interface Token {
@@ -218,7 +224,7 @@ declare function buildPageRuleCss(template: TemplateData, pageHeightMm?: number)
218
224
  declare function buildPageGeometryCss(template: TemplateData, scope?: string, pageHeightMm?: number): string;
219
225
  /**
220
226
  * 生成完整的打印页面 CSS。
221
- * 包含纸张尺寸、边距、页眉页脚、内容区、首页叠加区域等样式。
227
+ * 包含纸张尺寸、边距、页眉页脚、内容区几何等样式。
222
228
  * 出纸旋转角度非 0(固定纸)时,额外输出 .print-page-rotor / .print-page-rotor-${angle} 转子规则完成整页旋转。
223
229
  * @param pageHeightMm 连续纸由浏览器探针推导出的最终纸高(mm);传入时替换模板纸张高度,
224
230
  * 使 @page/.print-page/footer 全部对齐该高度。普通纸不传。
@@ -246,7 +252,7 @@ declare function tableDesignBottom(el: TemplateElement): number;
246
252
  * 1. 计算页面可用高度(contentHeight / availableHeight)
247
253
  * 2. 按 Y 坐标顺序遍历内容区元素
248
254
  * 3. 表格:逐行切片;非表格:元素级不拆分
249
- * 4. 处理 keepWithNext、单行超高、首页叠加等边界
255
+ * 4. 处理 keepWithNext、单行超高、表格跟随等边界
250
256
  * 5. 表格下方跟随区:与最后一片同页时包成 flow-group;放不下整体移下一页
251
257
  */
252
258
  declare function paginate(template: TemplateData, measuredElements: Map<string, MeasuredElement>): PageLayout[];
@@ -369,7 +375,7 @@ declare function micrometersToMillimeters(um: number): number;
369
375
  declare function millimetersToInches(mm: number): number;
370
376
 
371
377
  /** core 统一失败分类;各端只做映射,不新增协议码 */
372
- type PrintFailureCode = 'INVALID_PAPER' | 'MEASURE_FAILED' | 'RENDER_TIMEOUT' | 'PDF_FAILED' | 'SCREENSHOT_FAILED' | 'UNSUPPORTED_RUNTIME' | 'INTERNAL';
378
+ type PrintFailureCode = 'INVALID_PAPER' | 'MEASURE_FAILED' | 'RENDER_TIMEOUT' | 'PDF_FAILED' | 'UNSUPPORTED_RUNTIME' | 'INTERNAL';
373
379
  declare class PrintFailure extends Error {
374
380
  readonly code: PrintFailureCode;
375
381
  readonly cause?: unknown;
@@ -433,8 +439,6 @@ interface PlaywrightPdfOptions {
433
439
  preferCSSPageSize: boolean;
434
440
  }
435
441
  declare function toPlaywrightPdfOptions(spec: PdfTargetSpec): PlaywrightPdfOptions;
436
- /** Playwright page.screenshot 的最小结构 */
437
- declare function buildScreenshotTargetSpec(): ScreenshotTargetSpec;
438
442
 
439
443
  /**
440
444
  * 原始测量 → 分页输入。三端共用:px→mm、表格行高、重复表头段高度。
@@ -518,8 +522,6 @@ declare function composeTiledHtml(input: {
518
522
  declare function prepareDocument(job: PrintJob, runtime: PrintRuntime): Promise<PreparedDocument>;
519
523
  /** 阶段 1–7:prepared + HTML→PDF,且与准备阶段共用同一个 driver 会话 */
520
524
  declare function renderPdf(job: PrintJob, runtime: PrintRuntime): Promise<RenderPdfResult>;
521
- /** 截图:不分页,用测量模式 HTML 单页完整渲染;数组数据仅渲染首条。不参与拼版(仍是标签纸单页快照) */
522
- declare function renderScreenshot(job: PrintJob, runtime: PrintRuntime): Promise<Uint8Array>;
523
525
 
524
526
  /**
525
527
  * 归一化模板为页面模板数组:
@@ -573,4 +575,4 @@ declare class TemplateEngine {
573
575
  render(template: string, context: Record<string, any>): string;
574
576
  }
575
577
 
576
- export { type ASTNode, type BatchCopyInput, CodeRenderOptions, CodeRenderer, CodeSpec, type CollectingCodeRenderer, DriverFactory, type ElectronPrintToPdfOptions, type EngineOptions, ExecutorBundle, type ExprFunction, FitFontSize, type GenerateOptions, HeightSource, MICROMETERS_PER_INCH, MICROMETERS_PER_MM, MIN_CONTINUOUS_HEIGHT_MM, MM_PER_INCH, MM_PER_PX, MarginsMm, MeasuredElement, type MultiPageCopyInput, type MultiPageDocument, MultiPageTemplateData, PX_PER_MM, PageLayout, PaperMm, type PaperOverride, PdfTargetSpec, type PlaywrightPdfOptions, PreparedDocument, PrintFailure, type PrintFailureCode, PrintFontDeclaration, PrintJob, PrintRuntime, TemplateData as PrintTemplateData, TemplateElement as PrintTemplateElement, RawMeasurement, type RenderFinalPagesOptions, RenderPdfResult, type ResolvePaperInput, type ResolvedWatermark, ScreenshotTargetSpec, type SystemVariableContext, type TemplateAST, TemplateEngine, type TileInput, TileLayout, ViewportPx, WATERMARK_DEFAULTS, WATERMARK_DENSITY_PRESETS, WatermarkOptions, type WatermarkPaper, type WatermarkTile, addNumbers, applyTextFitSizes, avg, bindData, buildBasePageCss, buildPageCss, buildPageGeometryCss, buildPageRuleCss, buildPdfTargetSpec, buildScreenshotTargetSpec, codeSpecKey, compileTemplate, composeBatchHtml, composeContinuousHeight, composeMultiPageDocument, composeTiledHtml, count, createCollectingCodeRenderer, createDomHostRuntime, createMapCodeRenderer, divideNumbers, elementPositionStyle, escapeHeightMm, evaluate, evaluateTemplate, formatDate, formatMoney, formatTimestamp, generateHtml, getByPath, ifFn, injectSystemVariables, isMultiPageTemplate, isWatermarkVisible, max, mergeCodeMaps, mergeFontDeclarations, micrometersToMillimeters, millimetersToInches, millimetersToMicrometers, min, mm, mmToPx, multiplyNumbers, normalizeMeasurements, normalizeTemplate, paginate, paperViewportPx, parse, parseTemplate, prepareDocument, pxToMm, renderPdf, renderScreenshot, renderTemplate, renderWatermarkLayerHtml, renderWatermarkTileSvg, resolvePaperMm, resolveSystemVariables, resolveWatermarkLayout, resolveWatermarkText, round, roundDown, roundHalfEven, roundUp, safeEval, setPageIndex, setTotalPages, subtractNumbers, sum, systemVars, tableDesignBottom, toElectronPrintToPdfOptions, toPlaywrightPdfOptions, toPrintFailure, toUpperCaseAmount, tokenize, withTimeout };
578
+ export { type ASTNode, type BatchCopyInput, CodeRenderOptions, CodeRenderer, CodeSpec, type CollectingCodeRenderer, DriverFactory, type ElectronPrintToPdfOptions, type EngineOptions, ExecutorBundle, type ExprFunction, FitFontSize, type GenerateOptions, HeightSource, MICROMETERS_PER_INCH, MICROMETERS_PER_MM, MIN_CONTINUOUS_HEIGHT_MM, MM_PER_INCH, MM_PER_PX, MarginsMm, MeasuredElement, type MultiPageCopyInput, type MultiPageDocument, MultiPageTemplateData, PX_PER_MM, PageLayout, PaperMm, type PaperOverride, PdfTargetSpec, type PlaywrightPdfOptions, PreparedDocument, PrintFailure, type PrintFailureCode, PrintFontDeclaration, PrintJob, PrintRuntime, TemplateData as PrintTemplateData, TemplateElement as PrintTemplateElement, RawMeasurement, type RenderFinalPagesOptions, RenderPdfResult, type ResolvePaperInput, type ResolvedWatermark, type SystemVariableContext, type TemplateAST, TemplateEngine, type TileInput, TileLayout, ViewportPx, WATERMARK_DEFAULTS, WATERMARK_DENSITY_PRESETS, WatermarkOptions, type WatermarkPaper, type WatermarkTile, addNumbers, applyTextFitSizes, avg, bindData, buildBasePageCss, buildPageCss, buildPageGeometryCss, buildPageRuleCss, buildPdfTargetSpec, codeSpecKey, compileTemplate, composeBatchHtml, composeContinuousHeight, composeMultiPageDocument, composeTiledHtml, count, createCollectingCodeRenderer, createDomHostRuntime, createMapCodeRenderer, divideNumbers, elementPositionStyle, escapeHeightMm, evaluate, evaluateTemplate, formatDate, formatMoney, formatTimestamp, generateHtml, getByPath, ifFn, injectSystemVariables, isMultiPageTemplate, isWatermarkVisible, max, mergeCodeMaps, mergeFontDeclarations, micrometersToMillimeters, millimetersToInches, millimetersToMicrometers, min, mm, mmToPx, multiplyNumbers, normalizeMeasurements, normalizeTemplate, paginate, paperViewportPx, parse, parseTemplate, prepareDocument, pxToMm, renderPdf, renderTemplate, renderWatermarkLayerHtml, renderWatermarkTileSvg, resolvePaperMm, resolveSystemVariables, resolveWatermarkLayout, resolveWatermarkText, round, roundDown, roundHalfEven, roundUp, safeEval, setPageIndex, setTotalPages, subtractNumbers, sum, systemVars, tableDesignBottom, toElectronPrintToPdfOptions, toPlaywrightPdfOptions, toPrintFailure, toUpperCaseAmount, tokenize, withTimeout };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,13 @@
1
- import { T as TemplateData, C as CodeRenderer, P as PageLayout, K as MeasuredElement, L as TemplateElement, W as WatermarkOptions, N as PaperMm, O as ViewportPx, Q as HeightSource, X as MarginsMm, Y as PdfTargetSpec, Z as ScreenshotTargetSpec, R as RawMeasurement, a as CodeSpec, _ as CodeRenderOptions, D as DriverFactory, $ as ExecutorBundle, a0 as TileLayout, a1 as PrintJob, a2 as PreparedDocument, a3 as RenderPdfResult, M as MultiPageTemplateData, a4 as PrintFontDeclaration } from './driver-CNJVZK_L.js';
2
- export { a5 as ContinuousPaperSize, a6 as EXECUTOR_TARGETS, a7 as ExecutorMethod, a8 as ExecutorTargetKind, a9 as FALLBACK_FONT_STACK, aa as MAX_BATCH_COPIES, ab as NormalizedPrintData, ac as PAPER_DIMENSIONS, ad as PageDriver, ae as PageSection, af as PaperSize, ag as PrintDataInput, ah as PrintFontFile, ai as RenderCell, aj as RenderRequest, ak as RenderRow, al as SheetPaperSize, am as TILE_DEFAULTS, I as TextFit, an as TilingError, ao as TilingIssue, ap as TilingIssueCode, aq as TilingOptions, ar as TilingResolveOptions, as as TilingTemplateInput, at as buildFontFaceCss, au as computeMaxColumns, av as computeTileLayout, aw as escapeInlineStyleValue, ax as getPaperDimensions, ay as isContinuousPaper, az as isContinuousPaperSize, aA as normalizePrintData, aB as normalizeTilingOptions, aC as resolveSheetMm, aD as roundMm, aE as tilePosition, aF as toFontFamilyStack, aG as validateTiling } from './driver-CNJVZK_L.js';
3
- import { F as FitFontSize, P as PrintRuntime } from './ports-DSfECjvT.js';
4
- export { C as CellFitRowKind, h as DEFAULT_READINESS_MS, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, i as DEFAULT_TIMEOUT_MS, M as MIN_SHRINK_FONT_SIZE_PT, j as MeasureResult, k as PrintSession, S as SessionBudget, c as cellFitCapMm, a as cellFitKey, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from './ports-DSfECjvT.js';
1
+ /*!
2
+ * @worm-vue3-print/core v1.3.5
3
+ * Copyright (c) 2026 Worm Base AI
4
+ * SPDX-FileCopyrightText: 2026 Worm Base AI
5
+ * SPDX-License-Identifier: MIT
6
+ */
7
+ import { T as TemplateData, C as CodeRenderer, P as PageLayout, J as MeasuredElement, K as TemplateElement, W as WatermarkOptions, L as PaperMm, N as ViewportPx, O as HeightSource, Q as MarginsMm, S as PdfTargetSpec, R as RawMeasurement, a as CodeSpec, X as CodeRenderOptions, D as DriverFactory, Y as ExecutorBundle, Z as TileLayout, _ as PrintJob, $ as PreparedDocument, a0 as RenderPdfResult, M as MultiPageTemplateData, a1 as PrintFontDeclaration } from './driver-CFm0C_yX.js';
8
+ export { a2 as ContinuousPaperSize, a3 as EXECUTOR_TARGETS, a4 as ExecutorMethod, a5 as ExecutorTargetKind, a6 as FALLBACK_FONT_STACK, a7 as MAX_BATCH_COPIES, a8 as NormalizedPrintData, a9 as PAPER_DIMENSIONS, aa as PageDriver, ab as PageSection, ac as PaperSize, ad as PrintDataInput, ae as PrintFontFile, af as RenderCell, ag as RenderRequest, ah as RenderRow, ai as SheetPaperSize, aj as TILE_DEFAULTS, H as TextFit, ak as TilingError, al as TilingIssue, am as TilingIssueCode, an as TilingOptions, ao as TilingResolveOptions, ap as TilingTemplateInput, aq as buildFontFaceCss, ar as computeMaxColumns, as as computeTileLayout, at as escapeInlineStyleValue, au as getPaperDimensions, av as isContinuousPaper, aw as isContinuousPaperSize, ax as normalizePrintData, ay as normalizeTilingOptions, az as resolveSheetMm, aA as roundMm, aB as tilePosition, aC as toFontFamilyStack, aD as validateTiling } from './driver-CFm0C_yX.js';
9
+ import { F as FitFontSize, P as PrintRuntime } from './ports-Bdst9MWJ.js';
10
+ export { C as CellFitRowKind, h as DEFAULT_READINESS_MS, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, i as DEFAULT_TIMEOUT_MS, M as MIN_SHRINK_FONT_SIZE_PT, j as MeasureResult, k as PrintSession, S as SessionBudget, c as cellFitCapMm, a as cellFitKey, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from './ports-Bdst9MWJ.js';
5
11
 
6
12
  type TokenType = 'num' | 'str' | 'bool' | 'ident' | 'punc';
7
13
  interface Token {
@@ -218,7 +224,7 @@ declare function buildPageRuleCss(template: TemplateData, pageHeightMm?: number)
218
224
  declare function buildPageGeometryCss(template: TemplateData, scope?: string, pageHeightMm?: number): string;
219
225
  /**
220
226
  * 生成完整的打印页面 CSS。
221
- * 包含纸张尺寸、边距、页眉页脚、内容区、首页叠加区域等样式。
227
+ * 包含纸张尺寸、边距、页眉页脚、内容区几何等样式。
222
228
  * 出纸旋转角度非 0(固定纸)时,额外输出 .print-page-rotor / .print-page-rotor-${angle} 转子规则完成整页旋转。
223
229
  * @param pageHeightMm 连续纸由浏览器探针推导出的最终纸高(mm);传入时替换模板纸张高度,
224
230
  * 使 @page/.print-page/footer 全部对齐该高度。普通纸不传。
@@ -246,7 +252,7 @@ declare function tableDesignBottom(el: TemplateElement): number;
246
252
  * 1. 计算页面可用高度(contentHeight / availableHeight)
247
253
  * 2. 按 Y 坐标顺序遍历内容区元素
248
254
  * 3. 表格:逐行切片;非表格:元素级不拆分
249
- * 4. 处理 keepWithNext、单行超高、首页叠加等边界
255
+ * 4. 处理 keepWithNext、单行超高、表格跟随等边界
250
256
  * 5. 表格下方跟随区:与最后一片同页时包成 flow-group;放不下整体移下一页
251
257
  */
252
258
  declare function paginate(template: TemplateData, measuredElements: Map<string, MeasuredElement>): PageLayout[];
@@ -369,7 +375,7 @@ declare function micrometersToMillimeters(um: number): number;
369
375
  declare function millimetersToInches(mm: number): number;
370
376
 
371
377
  /** core 统一失败分类;各端只做映射,不新增协议码 */
372
- type PrintFailureCode = 'INVALID_PAPER' | 'MEASURE_FAILED' | 'RENDER_TIMEOUT' | 'PDF_FAILED' | 'SCREENSHOT_FAILED' | 'UNSUPPORTED_RUNTIME' | 'INTERNAL';
378
+ type PrintFailureCode = 'INVALID_PAPER' | 'MEASURE_FAILED' | 'RENDER_TIMEOUT' | 'PDF_FAILED' | 'UNSUPPORTED_RUNTIME' | 'INTERNAL';
373
379
  declare class PrintFailure extends Error {
374
380
  readonly code: PrintFailureCode;
375
381
  readonly cause?: unknown;
@@ -433,8 +439,6 @@ interface PlaywrightPdfOptions {
433
439
  preferCSSPageSize: boolean;
434
440
  }
435
441
  declare function toPlaywrightPdfOptions(spec: PdfTargetSpec): PlaywrightPdfOptions;
436
- /** Playwright page.screenshot 的最小结构 */
437
- declare function buildScreenshotTargetSpec(): ScreenshotTargetSpec;
438
442
 
439
443
  /**
440
444
  * 原始测量 → 分页输入。三端共用:px→mm、表格行高、重复表头段高度。
@@ -518,8 +522,6 @@ declare function composeTiledHtml(input: {
518
522
  declare function prepareDocument(job: PrintJob, runtime: PrintRuntime): Promise<PreparedDocument>;
519
523
  /** 阶段 1–7:prepared + HTML→PDF,且与准备阶段共用同一个 driver 会话 */
520
524
  declare function renderPdf(job: PrintJob, runtime: PrintRuntime): Promise<RenderPdfResult>;
521
- /** 截图:不分页,用测量模式 HTML 单页完整渲染;数组数据仅渲染首条。不参与拼版(仍是标签纸单页快照) */
522
- declare function renderScreenshot(job: PrintJob, runtime: PrintRuntime): Promise<Uint8Array>;
523
525
 
524
526
  /**
525
527
  * 归一化模板为页面模板数组:
@@ -573,4 +575,4 @@ declare class TemplateEngine {
573
575
  render(template: string, context: Record<string, any>): string;
574
576
  }
575
577
 
576
- export { type ASTNode, type BatchCopyInput, CodeRenderOptions, CodeRenderer, CodeSpec, type CollectingCodeRenderer, DriverFactory, type ElectronPrintToPdfOptions, type EngineOptions, ExecutorBundle, type ExprFunction, FitFontSize, type GenerateOptions, HeightSource, MICROMETERS_PER_INCH, MICROMETERS_PER_MM, MIN_CONTINUOUS_HEIGHT_MM, MM_PER_INCH, MM_PER_PX, MarginsMm, MeasuredElement, type MultiPageCopyInput, type MultiPageDocument, MultiPageTemplateData, PX_PER_MM, PageLayout, PaperMm, type PaperOverride, PdfTargetSpec, type PlaywrightPdfOptions, PreparedDocument, PrintFailure, type PrintFailureCode, PrintFontDeclaration, PrintJob, PrintRuntime, TemplateData as PrintTemplateData, TemplateElement as PrintTemplateElement, RawMeasurement, type RenderFinalPagesOptions, RenderPdfResult, type ResolvePaperInput, type ResolvedWatermark, ScreenshotTargetSpec, type SystemVariableContext, type TemplateAST, TemplateEngine, type TileInput, TileLayout, ViewportPx, WATERMARK_DEFAULTS, WATERMARK_DENSITY_PRESETS, WatermarkOptions, type WatermarkPaper, type WatermarkTile, addNumbers, applyTextFitSizes, avg, bindData, buildBasePageCss, buildPageCss, buildPageGeometryCss, buildPageRuleCss, buildPdfTargetSpec, buildScreenshotTargetSpec, codeSpecKey, compileTemplate, composeBatchHtml, composeContinuousHeight, composeMultiPageDocument, composeTiledHtml, count, createCollectingCodeRenderer, createDomHostRuntime, createMapCodeRenderer, divideNumbers, elementPositionStyle, escapeHeightMm, evaluate, evaluateTemplate, formatDate, formatMoney, formatTimestamp, generateHtml, getByPath, ifFn, injectSystemVariables, isMultiPageTemplate, isWatermarkVisible, max, mergeCodeMaps, mergeFontDeclarations, micrometersToMillimeters, millimetersToInches, millimetersToMicrometers, min, mm, mmToPx, multiplyNumbers, normalizeMeasurements, normalizeTemplate, paginate, paperViewportPx, parse, parseTemplate, prepareDocument, pxToMm, renderPdf, renderScreenshot, renderTemplate, renderWatermarkLayerHtml, renderWatermarkTileSvg, resolvePaperMm, resolveSystemVariables, resolveWatermarkLayout, resolveWatermarkText, round, roundDown, roundHalfEven, roundUp, safeEval, setPageIndex, setTotalPages, subtractNumbers, sum, systemVars, tableDesignBottom, toElectronPrintToPdfOptions, toPlaywrightPdfOptions, toPrintFailure, toUpperCaseAmount, tokenize, withTimeout };
578
+ export { type ASTNode, type BatchCopyInput, CodeRenderOptions, CodeRenderer, CodeSpec, type CollectingCodeRenderer, DriverFactory, type ElectronPrintToPdfOptions, type EngineOptions, ExecutorBundle, type ExprFunction, FitFontSize, type GenerateOptions, HeightSource, MICROMETERS_PER_INCH, MICROMETERS_PER_MM, MIN_CONTINUOUS_HEIGHT_MM, MM_PER_INCH, MM_PER_PX, MarginsMm, MeasuredElement, type MultiPageCopyInput, type MultiPageDocument, MultiPageTemplateData, PX_PER_MM, PageLayout, PaperMm, type PaperOverride, PdfTargetSpec, type PlaywrightPdfOptions, PreparedDocument, PrintFailure, type PrintFailureCode, PrintFontDeclaration, PrintJob, PrintRuntime, TemplateData as PrintTemplateData, TemplateElement as PrintTemplateElement, RawMeasurement, type RenderFinalPagesOptions, RenderPdfResult, type ResolvePaperInput, type ResolvedWatermark, type SystemVariableContext, type TemplateAST, TemplateEngine, type TileInput, TileLayout, ViewportPx, WATERMARK_DEFAULTS, WATERMARK_DENSITY_PRESETS, WatermarkOptions, type WatermarkPaper, type WatermarkTile, addNumbers, applyTextFitSizes, avg, bindData, buildBasePageCss, buildPageCss, buildPageGeometryCss, buildPageRuleCss, buildPdfTargetSpec, codeSpecKey, compileTemplate, composeBatchHtml, composeContinuousHeight, composeMultiPageDocument, composeTiledHtml, count, createCollectingCodeRenderer, createDomHostRuntime, createMapCodeRenderer, divideNumbers, elementPositionStyle, escapeHeightMm, evaluate, evaluateTemplate, formatDate, formatMoney, formatTimestamp, generateHtml, getByPath, ifFn, injectSystemVariables, isMultiPageTemplate, isWatermarkVisible, max, mergeCodeMaps, mergeFontDeclarations, micrometersToMillimeters, millimetersToInches, millimetersToMicrometers, min, mm, mmToPx, multiplyNumbers, normalizeMeasurements, normalizeTemplate, paginate, paperViewportPx, parse, parseTemplate, prepareDocument, pxToMm, renderPdf, renderTemplate, renderWatermarkLayerHtml, renderWatermarkTileSvg, resolvePaperMm, resolveSystemVariables, resolveWatermarkLayout, resolveWatermarkText, round, roundDown, roundHalfEven, roundUp, safeEval, setPageIndex, setTotalPages, subtractNumbers, sum, systemVars, tableDesignBottom, toElectronPrintToPdfOptions, toPlaywrightPdfOptions, toPrintFailure, toUpperCaseAmount, tokenize, withTimeout };