@worm-vue3-print/core 1.3.0 → 1.3.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
@@ -1,7 +1,7 @@
1
- import { T as TemplateData, C as CodeRenderer, P as PageLayout, I as MeasuredElement, J as TemplateElement, W as WatermarkOptions, K as PaperMm, L as ViewportPx, N as HeightSource, O as MarginsMm, Q as PdfTargetSpec, X as ScreenshotTargetSpec, R as RawMeasurement, a as CodeSpec, Y as CodeRenderOptions, D as DriverFactory, Z as ExecutorBundle, _ as TileLayout, $ as PrintJob, a0 as PreparedDocument, a1 as RenderPdfResult, M as MultiPageTemplateData, a2 as PrintFontDeclaration } from './driver-CsWkGK4a.js';
2
- export { a3 as ContinuousPaperSize, a4 as EXECUTOR_TARGETS, a5 as ExecutorMethod, a6 as ExecutorTargetKind, a7 as FALLBACK_FONT_STACK, a8 as MAX_BATCH_COPIES, a9 as NormalizedPrintData, aa as PAPER_DIMENSIONS, ab as PageDriver, ac as PageSection, ad as PaperSize, ae as PrintDataInput, af as PrintFontFile, ag as RenderCell, ah as RenderRequest, ai as RenderRow, aj as SheetPaperSize, ak as TILE_DEFAULTS, G as TextFit, al as TilingError, am as TilingIssue, an as TilingIssueCode, ao as TilingOptions, ap as TilingResolveOptions, aq as TilingTemplateInput, ar as buildFontFaceCss, as as computeMaxColumns, at as computeTileLayout, au as escapeInlineStyleValue, av as getPaperDimensions, aw as isContinuousPaper, ax as isContinuousPaperSize, ay as normalizePrintData, az as normalizeTilingOptions, aA as resolveSheetMm, aB as roundMm, aC as tilePosition, aD as toFontFamilyStack, aE as validateTiling } from './driver-CsWkGK4a.js';
3
- import { F as FitFontSize, P as PrintRuntime } from './ports-B63x7kCX.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-B63x7kCX.js';
1
+ import { T as TemplateData, C as CodeRenderer, P as PageLayout, I as MeasuredElement, J as TemplateElement, W as WatermarkOptions, K as PaperMm, L as ViewportPx, N as HeightSource, O as MarginsMm, Q as PdfTargetSpec, X as ScreenshotTargetSpec, R as RawMeasurement, a as CodeSpec, Y as CodeRenderOptions, D as DriverFactory, Z as ExecutorBundle, _ as TileLayout, $ as PrintJob, a0 as PreparedDocument, a1 as RenderPdfResult, M as MultiPageTemplateData, a2 as PrintFontDeclaration } from './driver-Dn_YAzO5.js';
2
+ export { a3 as ContinuousPaperSize, a4 as EXECUTOR_TARGETS, a5 as ExecutorMethod, a6 as ExecutorTargetKind, a7 as FALLBACK_FONT_STACK, a8 as MAX_BATCH_COPIES, a9 as NormalizedPrintData, aa as PAPER_DIMENSIONS, ab as PageDriver, ac as PageSection, ad as PaperSize, ae as PrintDataInput, af as PrintFontFile, ag as RenderCell, ah as RenderRequest, ai as RenderRow, aj as SheetPaperSize, ak as TILE_DEFAULTS, G as TextFit, al as TilingError, am as TilingIssue, an as TilingIssueCode, ao as TilingOptions, ap as TilingResolveOptions, aq as TilingTemplateInput, ar as buildFontFaceCss, as as computeMaxColumns, at as computeTileLayout, au as escapeInlineStyleValue, av as getPaperDimensions, aw as isContinuousPaper, ax as isContinuousPaperSize, ay as normalizePrintData, az as normalizeTilingOptions, aA as resolveSheetMm, aB as roundMm, aC as tilePosition, aD as toFontFamilyStack, aE as validateTiling } from './driver-Dn_YAzO5.js';
3
+ import { F as FitFontSize, P as PrintRuntime } from './ports-BvwlA_km.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-BvwlA_km.js';
5
5
 
6
6
  type TokenType = 'num' | 'str' | 'bool' | 'ident' | 'punc';
7
7
  interface Token {
@@ -131,6 +131,25 @@ declare const systemVars: {
131
131
  printTime: () => number;
132
132
  };
133
133
 
134
+ /** ADD(a, b, …):相加,无法解析为数字的参数按 0 处理 */
135
+ declare function addNumbers(...values: unknown[]): number;
136
+ /** SUB(a, b, …):首项依次减去后续各项 */
137
+ declare function subtractNumbers(...values: unknown[]): number;
138
+ /** MUL(a, b, …):相乘 */
139
+ declare function multiplyNumbers(...values: unknown[]): number;
140
+ /** DIV(a, b):相除,除数为 0 返回 0(不产生 Infinity / NaN) */
141
+ declare function divideNumbers(a: unknown, b: unknown): number;
142
+ /**
143
+ * ROUND(n, d):四舍五入到 d 位小数(d 缺省 2;负数修约到整十/整百,如 -2 → 百位)
144
+ */
145
+ declare function round(value: unknown, digits?: unknown): number;
146
+ /** ROUNDUP / CEIL(n, d):进一法(远离零方向) */
147
+ declare function roundUp(value: unknown, digits?: unknown): number;
148
+ /** ROUNDDOWN / FLOOR(n, d):去尾法(朝零方向) */
149
+ declare function roundDown(value: unknown, digits?: unknown): number;
150
+ /** ROUNDBANK(n, d):四舍六入五成双(GB/T 8170 数值修约规则) */
151
+ declare function roundHalfEven(value: unknown, digits?: unknown): number;
152
+
134
153
  /**
135
154
  * 将模板中元素的 formatter 表达式求值为实际值。
136
155
  * 返回新的模板对象(深拷贝),不修改原始模板。
@@ -551,4 +570,4 @@ declare class TemplateEngine {
551
570
  render(template: string, context: Record<string, any>): string;
552
571
  }
553
572
 
554
- 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, applyTextFitSizes, avg, bindData, buildBasePageCss, buildPageCss, buildPageGeometryCss, buildPageRuleCss, buildPdfTargetSpec, buildScreenshotTargetSpec, codeSpecKey, compileTemplate, composeBatchHtml, composeContinuousHeight, composeMultiPageDocument, composeTiledHtml, count, createCollectingCodeRenderer, createDomHostRuntime, createMapCodeRenderer, elementPositionStyle, escapeHeightMm, evaluate, evaluateTemplate, formatDate, formatMoney, formatTimestamp, generateHtml, getByPath, ifFn, injectSystemVariables, isMultiPageTemplate, isWatermarkVisible, max, mergeCodeMaps, mergeFontDeclarations, micrometersToMillimeters, millimetersToInches, millimetersToMicrometers, min, mm, mmToPx, normalizeMeasurements, normalizeTemplate, paginate, paperViewportPx, parse, parseTemplate, prepareDocument, pxToMm, renderPdf, renderScreenshot, renderTemplate, renderWatermarkLayerHtml, renderWatermarkTileSvg, resolvePaperMm, resolveSystemVariables, resolveWatermarkLayout, resolveWatermarkText, safeEval, setPageIndex, setTotalPages, sum, systemVars, tableDesignBottom, toElectronPrintToPdfOptions, toPlaywrightPdfOptions, toPrintFailure, toUpperCaseAmount, tokenize, withTimeout };
573
+ 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 };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TemplateEngine
3
- } from "./chunk-V4A5623C.js";
3
+ } from "./chunk-AKWV6SID.js";
4
4
  import {
5
5
  DEFAULT_READINESS_MS,
6
6
  DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
@@ -21,6 +21,7 @@ import {
21
21
  TilingError,
22
22
  WATERMARK_DEFAULTS,
23
23
  WATERMARK_DENSITY_PRESETS,
24
+ addNumbers,
24
25
  applyTextFitSizes,
25
26
  avg,
26
27
  bindData,
@@ -45,6 +46,7 @@ import {
45
46
  createCollectingCodeRenderer,
46
47
  createDomHostRuntime,
47
48
  createMapCodeRenderer,
49
+ divideNumbers,
48
50
  elementPositionStyle,
49
51
  escapeHeightMm,
50
52
  escapeInlineStyleValue,
@@ -72,6 +74,7 @@ import {
72
74
  min,
73
75
  mm,
74
76
  mmToPx2 as mmToPx,
77
+ multiplyNumbers,
75
78
  normalizeMeasurements,
76
79
  normalizePrintData,
77
80
  normalizeTemplate,
@@ -96,11 +99,16 @@ import {
96
99
  resolveSystemVariables,
97
100
  resolveWatermarkLayout,
98
101
  resolveWatermarkText,
102
+ round,
103
+ roundDown,
99
104
  roundFontSize,
105
+ roundHalfEven,
100
106
  roundMm,
107
+ roundUp,
101
108
  safeEval,
102
109
  setPageIndex,
103
110
  setTotalPages,
111
+ subtractNumbers,
104
112
  sum,
105
113
  systemVars,
106
114
  tableDesignBottom,
@@ -113,7 +121,7 @@ import {
113
121
  tokenize,
114
122
  validateTiling,
115
123
  withTimeout
116
- } from "./chunk-VFEURLAZ.js";
124
+ } from "./chunk-KFRPTLFV.js";
117
125
  export {
118
126
  DEFAULT_READINESS_MS,
119
127
  DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
@@ -135,6 +143,7 @@ export {
135
143
  TilingError,
136
144
  WATERMARK_DEFAULTS,
137
145
  WATERMARK_DENSITY_PRESETS,
146
+ addNumbers,
138
147
  applyTextFitSizes,
139
148
  avg,
140
149
  bindData,
@@ -159,6 +168,7 @@ export {
159
168
  createCollectingCodeRenderer,
160
169
  createDomHostRuntime,
161
170
  createMapCodeRenderer,
171
+ divideNumbers,
162
172
  elementPositionStyle,
163
173
  escapeHeightMm,
164
174
  escapeInlineStyleValue,
@@ -186,6 +196,7 @@ export {
186
196
  min,
187
197
  mm,
188
198
  mmToPx,
199
+ multiplyNumbers,
189
200
  normalizeMeasurements,
190
201
  normalizePrintData,
191
202
  normalizeTemplate,
@@ -210,11 +221,16 @@ export {
210
221
  resolveSystemVariables,
211
222
  resolveWatermarkLayout,
212
223
  resolveWatermarkText,
224
+ round,
225
+ roundDown,
213
226
  roundFontSize,
227
+ roundHalfEven,
214
228
  roundMm,
229
+ roundUp,
215
230
  safeEval,
216
231
  setPageIndex,
217
232
  setTotalPages,
233
+ subtractNumbers,
218
234
  sum,
219
235
  systemVars,
220
236
  tableDesignBottom,
@@ -1,4 +1,4 @@
1
- import { Z as ExecutorBundle } from '../driver-CsWkGK4a.cjs';
1
+ import { Z as ExecutorBundle } from '../driver-Dn_YAzO5.cjs';
2
2
 
3
3
  /** 读取 core 自带的 DOM 执行器 IIFE 产物;宿主把它注入页面后即可调用 __wormDom */
4
4
  declare function loadExecutorBundle(): ExecutorBundle;
@@ -1,4 +1,4 @@
1
- import { Z as ExecutorBundle } from '../driver-CsWkGK4a.js';
1
+ import { Z as ExecutorBundle } from '../driver-Dn_YAzO5.js';
2
2
 
3
3
  /** 读取 core 自带的 DOM 执行器 IIFE 产物;宿主把它注入页面后即可调用 __wormDom */
4
4
  declare function loadExecutorBundle(): ExecutorBundle;
@@ -1,4 +1,4 @@
1
- import { G as TextFit, a as CodeSpec, L as ViewportPx, R as RawMeasurement, Q as PdfTargetSpec, X as ScreenshotTargetSpec } from './driver-CsWkGK4a.js';
1
+ import { G as TextFit, a as CodeSpec, L as ViewportPx, R as RawMeasurement, Q as PdfTargetSpec, X as ScreenshotTargetSpec } from './driver-Dn_YAzO5.js';
2
2
 
3
3
  /** 自动缩小的默认下限字号(pt) */
4
4
  declare const DEFAULT_SHRINK_MIN_FONT_SIZE_PT = 6;
@@ -1,4 +1,4 @@
1
- import { G as TextFit, a as CodeSpec, L as ViewportPx, R as RawMeasurement, Q as PdfTargetSpec, X as ScreenshotTargetSpec } from './driver-CsWkGK4a.cjs';
1
+ import { G as TextFit, a as CodeSpec, L as ViewportPx, R as RawMeasurement, Q as PdfTargetSpec, X as ScreenshotTargetSpec } from './driver-Dn_YAzO5.cjs';
2
2
 
3
3
  /** 自动缩小的默认下限字号(pt) */
4
4
  declare const DEFAULT_SHRINK_MIN_FONT_SIZE_PT = 6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worm-vue3-print/core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "打印模板表达式引擎、同构渲染管线与框架无关的设计器内核(HTML 生成/分页/数据绑定/设计器模型与工具),无 Vue/React 依赖",
6
6
  "main": "dist/index.cjs",
@@ -27,6 +27,11 @@
27
27
  "types": "./dist/node/index.d.ts",
28
28
  "import": "./dist/node/index.js",
29
29
  "require": "./dist/node/index.cjs"
30
+ },
31
+ "./client": {
32
+ "types": "./dist/client/index.d.ts",
33
+ "import": "./dist/client/index.js",
34
+ "require": "./dist/client/index.cjs"
30
35
  }
31
36
  },
32
37
  "files": [