@univer-cli/univer-render-page 1.4.0 → 1.6.0

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 CHANGED
@@ -6,8 +6,12 @@ Helps the application build a browser Render Page for `@univer-cli/univer-render
6
6
 
7
7
  The package creates Univer inside the page, implements render and print operations, mounts the page protocol, and provides a ready-to-use Univer / Univer Pro composition. It does not start the browser itself.
8
8
 
9
+ The preset supports Board LaTeX rendering and committing Slide text edits with `presentation.endTextEditingAsync()` before saving.
10
+
9
11
  PDF preparation invokes the native print operation registered for the loaded Unit. The Render Page does not maintain a separate Unit-specific PDF renderer, so browser printing remains the source of truth for print layout and output behavior.
10
12
 
13
+ Board snapshots use `pages`, `pageOrder`, and `activePageId` as their current fields. When legacy Slide aliases are also present, the Render Page synchronizes them to the Board fields in its load copy so layout inspection, screenshots, and printing use the same content. The caller's snapshot remains unchanged.
14
+
11
15
  ## Installation
12
16
 
13
17
  ```bash
@@ -70,3 +74,20 @@ The Render Page processes incoming UnitData. Do not render untrusted content in
70
74
 
71
75
  The package does not install or launch a browser, host static directories, or provide Node.js screenshot/PDF APIs. Those responsibilities belong to
72
76
  [`@univer-cli/univer-render-runtime`](../univer-render-runtime/README.md).
77
+
78
+ ## Board layout capture
79
+
80
+ Full-content Board screenshots include measured connector labels outside model frames. Element selectors use the
81
+ native rendered `elementCaptureBounds` union, including connector paths and labels; missing native measurements fail
82
+ explicitly. Region selectors retain their exact resolved crop. Element and region selectors retain the requested
83
+ scale, and explicit Board-unit padding is retained when content or element bounds are recomputed.
84
+
85
+ With `includeLabelPlan: true`, capture also calls `planRenderedLabelLayout()` and returns its native plan alongside the analysis without changing the snapshot.
86
+
87
+ `includePortPlan: true` requests `planRenderedPortLayout()` and returns the native read-only plan as `portPlan`. It reorders automatic port slots and can change an unowned connector's entry or exit side to avoid another connector's label. Node frames, fixed ports, authored routes, and label positions remain preserved. Missing native support remains absent evidence; an unavailable or incomplete requested plan makes lint coverage incomplete. Apply one ready plan through `board.applyLayoutPlan()` in the editing runtime and capture again before using another plan.
88
+
89
+ An explicit `textPlanElementIds` selection additionally calls the installed `planRenderedTextLayout()` and returns its read-only `textPlan`. It sizes generated preset shapes from native text measurements without changing text or fonts. Unsupported/owned shapes return incomplete plans; a producer without this optional Facade method omits the plan. Consumers must treat requested missing or incomplete plans as incomplete coverage and replan the graph after any explicit application.
90
+
91
+ Optional `textPlanMaximumWidthGrowth` must be a finite number from 1 to 2 and requires non-empty `textPlanElementIds`; 1 preserves authored widths, while omission keeps the native twofold search. Native planning preserves complete text and fonts. Callers still require complete coverage; `unit-layout-lint` rejects returned plans that exceed the requested width budget.
92
+
93
+ The page protocol includes `captureBoardLayout`, used by the Node runtime to read final Board SDK geometry without exporting PNGs. It waits for formula presentation, fonts, and render frames before calling the rendered-layout Facade. The returned analysis retains unresolved evidence; the higher-level lint capability decides coverage completeness. Rebuild the Render Page when adopting this runtime capability.
package/README.zh-CN.md CHANGED
@@ -7,9 +7,14 @@
7
7
  Package 在页面内创建 Univer、实现 render 与 print operations、挂载 page protocol,并提供一套可直接使用的
8
8
  完整 Univer / Univer Pro composition。它本身不启动 browser。
9
9
 
10
+ Preset 支持 Board LaTeX 渲染,以及保存前通过 `presentation.endTextEditingAsync()` 提交 Slide 文本编辑。
11
+
10
12
  PDF 准备过程调用已为当前 Unit 注册的原生 print operation。Render Page 不维护另一套按 Unit 区分的 PDF
11
13
  renderer,因此打印布局与输出行为以 browser print 为唯一事实来源。
12
14
 
15
+ Board 快照以 `pages`、`pageOrder` 和 `activePageId` 为当前字段。若同时存在旧版 Slide 别名,Render Page
16
+ 会在加载副本中将它们同步到 Board 字段,使布局检查、截图和打印使用同一份内容,不修改调用者的快照。
17
+
13
18
  ## 安装
14
19
 
15
20
  ```bash
@@ -75,3 +80,17 @@ Application 应限制 browser process 的系统权限与网络范围。
75
80
 
76
81
  Package 不安装或启动 browser,不托管静态目录,也不提供 Node screenshot/PDF API。这些职责属于
77
82
  [`@univer-cli/univer-render-runtime`](../univer-render-runtime/README.zh-CN.md)。
83
+
84
+ ## Board layout capture
85
+
86
+ Board 全内容截图包含超出模型框架的实测连接线标签。元素选择使用原生 `elementCaptureBounds` 的合并范围,包含连接线路径与标签;缺少原生测量时明确失败。显式区域保留精确裁切边界。元素和区域选择均保留请求缩放比例,全内容或元素边界重新计算后仍保留以 Board 坐标单位指定的 padding。
87
+
88
+ 设置 `includeLabelPlan: true` 时,capture 还调用 `planRenderedLabelLayout()`,将原生 plan 与 analysis 一起返回,不修改 snapshot。
89
+
90
+ `includePortPlan: true` 调用 `planRenderedPortLayout()`,通过 `portPlan` 返回原生只读计划。它重新排序自动端口槽位,也可以调整无手动约束连接线的进入或离开侧,避开其他连接线的标签;保留节点框、固定端口、人工路由和标签位置。缺少原生支持时保留证据缺失;请求后计划缺失或不完整会使 lint 覆盖不完整。在编辑 runtime 中通过 `board.applyLayoutPlan()` 应用一个 ready 计划后,重新 capture,再使用其他计划。
91
+
92
+ 显式传入 `textPlanElementIds` 时,还会调用已安装的 `planRenderedTextLayout()`,返回只读的 `textPlan`。它使用原生文字测量规划生成预设图形的尺寸,保留文字和字号。受管理或不支持的图形返回 incomplete 计划;producer 缺少此可选 Facade 方法时省略计划。Consumer 必须将请求后缺失或不完整的计划视为覆盖不完整,并在显式应用后重新规划图布局。
93
+
94
+ 可选的 `textPlanMaximumWidthGrowth` 必须是 1 到 2 的有限数,并与非空 `textPlanElementIds` 一起提供;1 保留原宽,默认沿用原生最多两倍宽度搜索。原生计划保留完整文字和字号,调用方仍须检查完整覆盖。`unit-layout-lint` 拒绝超过请求宽度预算的返回计划。
95
+
96
+ Page protocol 的 `captureBoardLayout` 供 Node runtime 读取最终 Board SDK 几何,无需导出 PNG。它等待 formula presentation、字体和渲染帧,再调用 rendered-layout Facade。结果保留 unresolved 证据,由上层 lint capability 判定覆盖是否完整。接入此 runtime 能力时需重建 Render Page。