@worm-vue3-print/core 1.0.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/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # @worm-vue3-print/core
2
+
3
+ 打印模板表达式引擎与**同构渲染管线**(数据绑定 / HTML 生成 / 分页 / 测量元素),纯 TypeScript。
4
+
5
+ ```
6
+ print-core/
7
+ src/
8
+ lexer.ts / parser.ts / evaluator.ts / template-parser.ts # 模板表达式引擎
9
+ functions/ # formatMoney / formatDate / sum / concat 等
10
+ render/
11
+ data-binder.ts # 变量/表达式绑定
12
+ html-generator.ts # 模板 JSON → HTML/CSS/SVG
13
+ pagination-engine.ts # 表格分页、重复表头、小计/汇总
14
+ css-builder.ts # mm 单位布局 → CSS
15
+ expression-eval.ts # 表达式安全求值(safelist)
16
+ types.ts # 模板/请求类型(JSON 可序列化)
17
+ ```
18
+
19
+ `core` 无 Vue、无宿主依赖,可在 Node 服务端(`@worm-vue3-print/render`)与浏览器端(`@worm-vue3-print/canvas`)共用,
20
+ 保证「浏览器预览」与「服务端 PDF」结果一致。
21
+
22
+ ## 使用
23
+
24
+ ```ts
25
+ import { generateHtml, paginate, bindData } from '@worm-vue3-print/core'
26
+
27
+ const bound = bindData(templateJson, printData)
28
+ const pages = paginate(bound, measured, options)
29
+ const html = generateHtml(pages)
30
+ ```
31
+
32
+ ## 开发
33
+
34
+ ```bash
35
+ npm run build # tsup → dist/index.js + index.cjs + d.ts
36
+ npm test # vitest
37
+ ```