@univer-cli/unit-layout-lint 1.0.0-beta.2

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,52 @@
1
+ # @univer-cli/unit-layout-lint
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ Use real browser-generated layout facts to detect text overflow and overlap in Slides, returning structured findings with evidence.
6
+
7
+ Currently only Slide is supported. If the goal is to take a screenshot rather than diagnose, use `@univer-cli/unit-screenshot`.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pnpm add @univer-cli/unit-layout-lint @univer-cli/univer-render-runtime
13
+ ```
14
+
15
+ The application must also build the Render Page and provide Chrome, Chromium, or Edge.
16
+
17
+ ## Quick Start
18
+
19
+ ```ts
20
+ import { fileURLToPath } from "node:url";
21
+ import { createUnitLayoutLint } from "@univer-cli/unit-layout-lint";
22
+ import { createUniverRenderRuntime } from "@univer-cli/univer-render-runtime";
23
+
24
+ const runtime = await createUniverRenderRuntime({
25
+ renderPageRoot: fileURLToPath(new URL("../dist/render-page", import.meta.url)),
26
+ });
27
+
28
+ try {
29
+ const lint = createUnitLayoutLint({ runtime });
30
+ const report = await lint.lint({
31
+ unitType: "slide",
32
+ unitData: slideData,
33
+ pages: [1, "closing-slide"],
34
+ });
35
+ console.log(report.findings);
36
+ } finally {
37
+ await runtime.close();
38
+ }
39
+ ```
40
+
41
+ ## Current rules
42
+
43
+ - `text-off-page`: actual glyph ink extends beyond the page.
44
+ - `text-escapes-container`: text visibly escapes a smaller opaque container.
45
+ - `text-overlaps-text`: two regions of actual glyph ink overlap significantly.
46
+
47
+ A finding is an evidence-backed review suggestion, not a content error that must always be fixed. When `pages` is omitted, every page is checked. Numeric page selectors are one-based; string selectors use page IDs from `slideOrder`.
48
+
49
+ The application is responsible for materializing the Slide and providing a render runtime. The package does not load remote targets, save reports, or define lint rules for other Unit types.
50
+
51
+ For the preset command, see
52
+ [`@univer-cli/unit-layout-lint-command`](../unit-layout-lint-command/README.md).
@@ -0,0 +1,54 @@
1
+ # @univer-cli/unit-layout-lint
2
+
3
+ [English](./README.md) | 简体中文
4
+
5
+ 使用浏览器产生的真实 layout facts 检查 Slide 中的文字越界与重叠,并返回带证据的结构化 findings。
6
+
7
+ 当前只支持 Slide。若目标是截图而不是诊断,使用 `@univer-cli/unit-screenshot`。
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ pnpm add @univer-cli/unit-layout-lint @univer-cli/univer-render-runtime
13
+ ```
14
+
15
+ 还需要 application 构建 Render Page,并提供 Chrome、Chromium 或 Edge。
16
+
17
+ ## 快速开始
18
+
19
+ ```ts
20
+ import { fileURLToPath } from "node:url";
21
+ import { createUnitLayoutLint } from "@univer-cli/unit-layout-lint";
22
+ import { createUniverRenderRuntime } from "@univer-cli/univer-render-runtime";
23
+
24
+ const runtime = await createUniverRenderRuntime({
25
+ renderPageRoot: fileURLToPath(new URL("../dist/render-page", import.meta.url)),
26
+ });
27
+
28
+ try {
29
+ const lint = createUnitLayoutLint({ runtime });
30
+ const report = await lint.lint({
31
+ unitType: "slide",
32
+ unitData: slideData,
33
+ pages: [1, "closing-slide"],
34
+ });
35
+ console.log(report.findings);
36
+ } finally {
37
+ await runtime.close();
38
+ }
39
+ ```
40
+
41
+ ## 当前规则
42
+
43
+ - `text-off-page`:实际 glyph ink 超出页面;
44
+ - `text-escapes-container`:文字明显冲出较小、不透明的容器;
45
+ - `text-overlaps-text`:两段实际 glyph ink 发生显著重叠。
46
+
47
+ Finding 是带证据的复查建议,不是必须清零的内容错误。省略 `pages` 时检查全部页面;page number 从 1 开始,
48
+ 字符串 selector 使用 `slideOrder` 中的 page ID。
49
+
50
+ Application 负责物化 Slide 并提供 render runtime。Package 不加载远程 target、不保存报告,也不声明其他 Unit
51
+ lint。
52
+
53
+ 预设 command 见
54
+ [`@univer-cli/unit-layout-lint-command`](../unit-layout-lint-command/README.zh-CN.md)。
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';module['exports']=require('./index.mjs');
@@ -0,0 +1,94 @@
1
+ import { UniverRenderFormulaReferenceUnit, UniverRenderUnit, UniverSlideLayoutRuntime } from "@univer-cli/univer-render-runtime";
2
+ //#region src/errors.d.ts
3
+ type UnitLayoutLintErrorCode = "INVALID_INPUT" | "INVALID_RENDER_RESULT";
4
+ declare class UnitLayoutLintError extends Error {
5
+ readonly code: UnitLayoutLintErrorCode;
6
+ constructor(code: UnitLayoutLintErrorCode, message: string, options?: ErrorOptions);
7
+ }
8
+ declare function isUnitLayoutLintError(value: unknown): value is UnitLayoutLintError;
9
+ //#endregion
10
+ //#region src/types.d.ts
11
+ type SlideUnitData = Extract<UniverRenderUnit, {
12
+ readonly unitType: "slide";
13
+ }>["unitData"];
14
+ type SlideLayoutLintRule = "text-off-page" | "text-escapes-container" | "text-overlaps-text";
15
+ type SlideLayoutLintPageSelector = number | string;
16
+ interface SlideLayoutLintBox {
17
+ readonly height: number;
18
+ readonly left: number;
19
+ readonly top: number;
20
+ readonly width: number;
21
+ }
22
+ interface SlideLayoutLintText {
23
+ readonly color?: string;
24
+ readonly content: string;
25
+ readonly id: string;
26
+ readonly ink: SlideLayoutLintBox;
27
+ readonly opacity?: number;
28
+ }
29
+ interface SlideLayoutLintContainer {
30
+ readonly box: SlideLayoutLintBox;
31
+ readonly fill?: {
32
+ readonly color?: string;
33
+ readonly opacity?: number;
34
+ readonly type?: string;
35
+ };
36
+ readonly id: string;
37
+ readonly type: string;
38
+ }
39
+ interface SlideLayoutLintOverflow {
40
+ readonly bottom?: number;
41
+ readonly left?: number;
42
+ readonly right?: number;
43
+ readonly top?: number;
44
+ }
45
+ interface SlideLayoutLintFinding {
46
+ readonly container?: SlideLayoutLintContainer;
47
+ readonly detail: string;
48
+ readonly fingerprint: string;
49
+ readonly id: string;
50
+ readonly other?: SlideLayoutLintText;
51
+ readonly overflow?: SlideLayoutLintOverflow;
52
+ readonly overlapRatio?: number;
53
+ readonly page: number;
54
+ readonly pageBox?: SlideLayoutLintBox;
55
+ readonly pageId: string;
56
+ readonly related?: string;
57
+ readonly rule: SlideLayoutLintRule;
58
+ readonly severity: "warning";
59
+ readonly text: SlideLayoutLintText;
60
+ }
61
+ interface SlideUnitLayoutLintInput {
62
+ readonly formulaReferenceUnits?: readonly UniverRenderFormulaReferenceUnit[];
63
+ readonly pages?: readonly SlideLayoutLintPageSelector[];
64
+ readonly signal?: AbortSignal;
65
+ readonly unitData: SlideUnitData;
66
+ readonly unitType: "slide";
67
+ }
68
+ type UnitLayoutLintInput = SlideUnitLayoutLintInput;
69
+ type UnitLayoutLintSource = Omit<UnitLayoutLintInput, "pages">;
70
+ interface SlideUnitLayoutLintReport {
71
+ readonly coverage: {
72
+ readonly pages: readonly {
73
+ readonly page: number;
74
+ readonly pageId: string;
75
+ }[];
76
+ readonly rules: readonly SlideLayoutLintRule[];
77
+ };
78
+ readonly findings: readonly SlideLayoutLintFinding[];
79
+ readonly kind: "unit-layout-lint";
80
+ readonly unitId: string;
81
+ readonly unitType: "slide";
82
+ }
83
+ type UnitLayoutLintReport = SlideUnitLayoutLintReport;
84
+ interface UnitLayoutLint {
85
+ lint(input: UnitLayoutLintInput): Promise<UnitLayoutLintReport>;
86
+ }
87
+ interface UnitLayoutLintOptions {
88
+ readonly runtime: UniverSlideLayoutRuntime;
89
+ }
90
+ //#endregion
91
+ //#region src/unit-layout-lint.d.ts
92
+ declare function createUnitLayoutLint(options: UnitLayoutLintOptions): UnitLayoutLint;
93
+ //#endregion
94
+ export { type SlideLayoutLintBox, type SlideLayoutLintContainer, type SlideLayoutLintFinding, type SlideLayoutLintOverflow, type SlideLayoutLintPageSelector, type SlideLayoutLintRule, type SlideLayoutLintText, type SlideUnitLayoutLintInput, type SlideUnitLayoutLintReport, type UnitLayoutLint, UnitLayoutLintError, type UnitLayoutLintErrorCode, type UnitLayoutLintInput, type UnitLayoutLintOptions, type UnitLayoutLintReport, type UnitLayoutLintSource, createUnitLayoutLint, isUnitLayoutLintError };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ const _0x28de21=_0x1d2d;(function(_0x5060c4,_0x5f403f){const _0x1cda09=_0x1d2d,_0x4887c9=_0x5060c4();while(!![]){try{const _0x5c0e73=parseInt(_0x1cda09(0xee))/0x1*(-parseInt(_0x1cda09(0xfa))/0x2)+-parseInt(_0x1cda09(0x10a))/0x3*(parseInt(_0x1cda09(0x12e))/0x4)+-parseInt(_0x1cda09(0x13e))/0x5*(-parseInt(_0x1cda09(0x10e))/0x6)+parseInt(_0x1cda09(0x102))/0x7+parseInt(_0x1cda09(0x141))/0x8*(-parseInt(_0x1cda09(0x119))/0x9)+parseInt(_0x1cda09(0x132))/0xa*(-parseInt(_0x1cda09(0xf0))/0xb)+parseInt(_0x1cda09(0x13f))/0xc;if(_0x5c0e73===_0x5f403f)break;else _0x4887c9['push'](_0x4887c9['shift']());}catch(_0x4c5c40){_0x4887c9['push'](_0x4887c9['shift']());}}}(_0x5aff,0x60926));var e=class extends Error{[_0x28de21(0x133)];constructor(_0x3d2cd1,_0x473bc4,_0x449505){const _0x26beeb=_0x28de21;super(_0x473bc4,_0x449505),this['name']=_0x26beeb(0x139),this['code']=_0x3d2cd1;}};function t(_0x58d6e7){return _0x58d6e7 instanceof e;}var n=0x2,r=0x6,i=0.02,a=0.15,o=0.5,s=new Set([_0x28de21(0x149),_0x28de21(0x138)]),c=['text-off-page',_0x28de21(0x126),_0x28de21(0x136)];function l(_0x4e4693){return{async 'lint'(_0x21d2c1){const _0x1d9fd0=_0x1d2d;if(_0x21d2c1['unitType']!==_0x1d9fd0(0x12a))throw new e(_0x1d9fd0(0x143),'Unit\x20layout\x20lint\x20currently\x20supports\x20Slide\x20only');let _0x19e3cc=O(_0x21d2c1[_0x1d9fd0(0x11c)]['id']),_0x396d8c=u(_0x21d2c1['unitData'][_0x1d9fd0(0x115)]??[],_0x21d2c1[_0x1d9fd0(0x11e)]),_0xe68f99=await _0x4e4693[_0x1d9fd0(0xf3)]['captureSlideLayout']({'unitType':'slide','unitData':_0x21d2c1['unitData'],..._0x21d2c1[_0x1d9fd0(0x100)]===void 0x0?{}:{'formulaReferenceUnits':_0x21d2c1['formulaReferenceUnits']},'pages':_0x396d8c['map'](({page:_0x1de744})=>_0x1de744),..._0x21d2c1[_0x1d9fd0(0x113)]===void 0x0?{}:{'signal':_0x21d2c1[_0x1d9fd0(0x113)]}});return d(_0xe68f99,_0x396d8c),{'kind':'unit-layout-lint','unitId':_0x19e3cc,'unitType':'slide','coverage':{'pages':_0x396d8c,'rules':c},'findings':f(_0xe68f99)};}};}function _0x1d2d(_0x1ae6d9,_0x35c9fa){_0x1ae6d9=_0x1ae6d9-0xee;const _0x5aff29=_0x5aff();let _0x1d2dda=_0x5aff29[_0x1ae6d9];return _0x1d2dda;}function u(_0x48871a,_0x3f74bd){const _0x103fe9=_0x28de21;if(_0x48871a['length']===0x0)throw new e(_0x103fe9(0x143),_0x103fe9(0x11a));if(_0x3f74bd!==void 0x0&&_0x3f74bd[_0x103fe9(0xfd)]===0x0)throw new e(_0x103fe9(0x143),_0x103fe9(0x112));let _0x27ee96=_0x3f74bd??_0x48871a['map']((_0x28d921,_0x56228f)=>_0x56228f+0x1),_0x4fe622=new Set(),_0x5a0c36=[];for(let _0x114fb0 of _0x27ee96){let _0x504003=typeof _0x114fb0==_0x103fe9(0x110)?_0x114fb0:_0x48871a[_0x103fe9(0x131)](_0x1fdf85=>_0x1fdf85===_0x114fb0)+0x1;if(!Number[_0x103fe9(0x129)](_0x504003)||_0x504003<0x1||_0x504003>_0x48871a['length'])throw new e(_0x103fe9(0x143),'Slide\x20page\x20selector\x20is\x20invalid:\x20'+String(_0x114fb0));let _0x325943=_0x48871a[_0x504003-0x1];_0x4fe622[_0x103fe9(0x114)](_0x325943)||(_0x4fe622['add'](_0x325943),_0x5a0c36[_0x103fe9(0x125)]({'page':_0x504003,'pageId':_0x325943}));}return _0x5a0c36;}function d(_0x4c49e1,_0x5f0d5f){const _0x3d9f47=_0x28de21;let _0x2ff854=new Map();for(let _0x4cf813 of _0x4c49e1[_0x3d9f47(0x11e)]){let _0x331176=_0x2ff854[_0x3d9f47(0x14c)](_0x4cf813[_0x3d9f47(0xef)])??[];_0x331176[_0x3d9f47(0x125)](_0x4cf813),_0x2ff854[_0x3d9f47(0xfe)](_0x4cf813[_0x3d9f47(0xef)],_0x331176);}for(let _0x5a9a56 of _0x5f0d5f){let _0x2a6f87=_0x2ff854['get'](_0x5a9a56[_0x3d9f47(0xef)])??[];if(_0x2a6f87[_0x3d9f47(0xfd)]!==0x1||_0x2a6f87[0x0]?.[_0x3d9f47(0xf4)]!==_0x5a9a56[_0x3d9f47(0xf4)])throw new e(_0x3d9f47(0x12b),_0x3d9f47(0x123)+_0x5a9a56[_0x3d9f47(0xef)]);let _0x5d87b0=_0x2a6f87[0x0][_0x3d9f47(0x10f)][_0x3d9f47(0x103)](({elementId:_0x53d29e})=>_0x53d29e);if(new Set(_0x5d87b0)[_0x3d9f47(0x140)]!==_0x5d87b0[_0x3d9f47(0xfd)])throw new e(_0x3d9f47(0x12b),_0x3d9f47(0x11f)+_0x5a9a56['pageId']);}if(_0x4c49e1[_0x3d9f47(0x11e)][_0x3d9f47(0xfd)]!==_0x5f0d5f[_0x3d9f47(0xfd)])throw new e(_0x3d9f47(0x12b),_0x3d9f47(0x12d));}function f(_0x141411){const _0xbaa5da=_0x28de21;let _0x5220c9=[];for(let _0x3a10d9 of _0x141411[_0xbaa5da(0x11e)]){let _0x20bebd=_0x3a10d9['elements'][_0xbaa5da(0xf8)](_0x21b493=>!_0x21b493[_0xbaa5da(0x11b)][_0xbaa5da(0x146)](_0xbaa5da(0x127))),_0x5b7dd6=_0x20bebd['filter'](_0x368bab=>_0x368bab[_0xbaa5da(0x106)]!==void 0x0&&_0x368bab[_0xbaa5da(0x106)][_0xbaa5da(0x101)][_0xbaa5da(0x12f)]()!=='');for(let _0x51fb61 of _0x5b7dd6){let _0x1e6c2f=m(_0x51fb61[_0xbaa5da(0x106)]['ink']),_0x5e965c={..._0x1e6c2f[_0xbaa5da(0x11d)]<-0x2?{'left':_(-_0x1e6c2f[_0xbaa5da(0x11d)])}:{},..._0x1e6c2f[_0xbaa5da(0x130)]<-0x2?{'top':_(-_0x1e6c2f[_0xbaa5da(0x130)])}:{},..._0x1e6c2f[_0xbaa5da(0x10b)]>_0x3a10d9[_0xbaa5da(0x120)]+n?{'right':_(_0x1e6c2f['right']-_0x3a10d9[_0xbaa5da(0x120)])}:{},..._0x1e6c2f[_0xbaa5da(0xfc)]>_0x3a10d9[_0xbaa5da(0x144)]+n?{'bottom':_(_0x1e6c2f[_0xbaa5da(0xfc)]-_0x3a10d9[_0xbaa5da(0x144)])}:{}},_0x1ecadc=D(_0x5e965c);if(_0x1ecadc!=='-'){let _0x10e4de=b(_0x51fb61),_0x266950=y({'left':0x0,'top':0x0,'width':_0x3a10d9[_0xbaa5da(0x120)],'height':_0x3a10d9[_0xbaa5da(0x144)]});_0x5220c9[_0xbaa5da(0x125)](p({'page':_0x3a10d9[_0xbaa5da(0xf4)],'pageId':_0x3a10d9[_0xbaa5da(0xef)],'rule':_0xbaa5da(0xf9),'id':_0x51fb61[_0xbaa5da(0x11b)],'text':_0x10e4de,'pageBox':_0x266950,'overflow':_0x5e965c,'detail':_0xbaa5da(0x13c)+v(_0x10e4de[_0xbaa5da(0x101)])+_0xbaa5da(0x14b)+_0x1ecadc+_0xbaa5da(0x12c)+w(_0x10e4de[_0xbaa5da(0xf6)])+_0xbaa5da(0x104)+w(_0x266950)}));}}for(let _0x3526ec of _0x5b7dd6){let _0x2c8267=E(_0x3526ec,_0x20bebd,_0x3a10d9);if(_0x2c8267===void 0x0)continue;let _0x3add8e=m(_0x3526ec['text'][_0xbaa5da(0xf6)]),_0x4b7ddf=m(_0x2c8267['declared']),_0x3fa553=Math[_0xbaa5da(0x135)](r,i*(_0x4b7ddf[_0xbaa5da(0x10b)]-_0x4b7ddf[_0xbaa5da(0x11d)])),_0x40bad2={..._0x4b7ddf[_0xbaa5da(0x11d)]-_0x3add8e[_0xbaa5da(0x11d)]>_0x3fa553?{'left':_(_0x4b7ddf[_0xbaa5da(0x11d)]-_0x3add8e[_0xbaa5da(0x11d)])}:{},..._0x3add8e[_0xbaa5da(0x10b)]-_0x4b7ddf[_0xbaa5da(0x10b)]>_0x3fa553?{'right':_(_0x3add8e['right']-_0x4b7ddf['right'])}:{},..._0x3add8e['bottom']-_0x4b7ddf[_0xbaa5da(0xfc)]>_0x3fa553?{'bottom':_(_0x3add8e['bottom']-_0x4b7ddf[_0xbaa5da(0xfc)])}:{}},_0x592015=D(_0x40bad2);if(_0x592015!=='-'){let _0x8870c4=b(_0x3526ec),_0x191d95=S(_0x2c8267);_0x5220c9[_0xbaa5da(0x125)](p({'page':_0x3a10d9['page'],'pageId':_0x3a10d9['pageId'],'rule':_0xbaa5da(0x126),'id':_0x3526ec[_0xbaa5da(0x11b)],'related':_0x2c8267[_0xbaa5da(0x11b)],'text':_0x8870c4,'container':_0x191d95,'overflow':_0x40bad2,'detail':'text\x20\x22'+v(_0x8870c4[_0xbaa5da(0x101)])+_0xbaa5da(0x111)+_0x191d95['id']+'\x20('+_0x592015+_0xbaa5da(0x12c)+w(_0x8870c4[_0xbaa5da(0xf6)])+',\x20'+_0x191d95['id']+'\x20=\x20'+_0x191d95[_0xbaa5da(0x116)]+'\x20'+C(_0x191d95[_0xbaa5da(0x10d)])+'\x20'+w(_0x191d95[_0xbaa5da(0x148)])}));}}for(let _0x1de615=0x0;_0x1de615<_0x5b7dd6[_0xbaa5da(0xfd)];_0x1de615+=0x1)for(let _0x2a2c38=_0x1de615+0x1;_0x2a2c38<_0x5b7dd6[_0xbaa5da(0xfd)];_0x2a2c38+=0x1){let _0x4ea6a2=_0x5b7dd6[_0x1de615],_0x5c2b88=_0x5b7dd6[_0x2a2c38],_0xf3e42=m(_0x4ea6a2[_0xbaa5da(0x106)][_0xbaa5da(0xf6)]),_0x5158f7=m(_0x5c2b88[_0xbaa5da(0x106)][_0xbaa5da(0xf6)]),_0x541345=h(g(_0xf3e42,_0x5158f7));if(_0x541345<=0x1)continue;let _0x4809e4=_0x541345/Math[_0xbaa5da(0x135)](0x1,Math[_0xbaa5da(0x13d)](h(_0xf3e42),h(_0x5158f7)));if(_0x4809e4<=a)continue;let _0x371259=b(_0x4ea6a2),_0x197c6e=b(_0x5c2b88);_0x5220c9[_0xbaa5da(0x125)](p({'page':_0x3a10d9['page'],'pageId':_0x3a10d9[_0xbaa5da(0xef)],'rule':_0xbaa5da(0x136),'id':_0x4ea6a2[_0xbaa5da(0x11b)],'related':_0x5c2b88[_0xbaa5da(0x11b)],'text':_0x371259,'other':_0x197c6e,'overlapRatio':Math['round'](_0x4809e4*0x64)/0x64,'detail':'text\x20\x22'+v(_0x371259[_0xbaa5da(0x101)])+'\x22'+x(_0x371259)+_0xbaa5da(0x117)+v(_0x197c6e[_0xbaa5da(0x101)])+'\x22'+x(_0x197c6e)+_0xbaa5da(0x124)+Math[_0xbaa5da(0xf2)](_0x4809e4*0x64)+'%\x20of\x20the\x20smaller\x20glyph\x20band;\x20ink\x20'+w(_0x371259[_0xbaa5da(0xf6)])+',\x20'+w(_0x197c6e[_0xbaa5da(0xf6)])}));}}return _0x5220c9[_0xbaa5da(0x10c)]((_0x2f39b2,_0x513b96)=>_0x2f39b2[_0xbaa5da(0xfb)]['localeCompare'](_0x513b96[_0xbaa5da(0xfb)]));}function p(_0x1c15c8){const _0x5da4ba=_0x28de21;return{..._0x1c15c8,'fingerprint':[_0x1c15c8[_0x5da4ba(0x145)],_0x1c15c8[_0x5da4ba(0xef)],_0x1c15c8['id'],_0x1c15c8[_0x5da4ba(0x121)]??'']['join'](':'),'severity':_0x5da4ba(0x13b)};}function m(_0x27ce92){const _0x104c31=_0x28de21;return{'left':_0x27ce92[_0x104c31(0x11d)],'top':_0x27ce92[_0x104c31(0x130)],'right':_0x27ce92['left']+_0x27ce92['width'],'bottom':_0x27ce92['top']+_0x27ce92[_0x104c31(0xf5)]};}function h(_0x54a113){const _0x10a43b=_0x28de21;return Math[_0x10a43b(0x135)](0x0,_0x54a113[_0x10a43b(0x10b)]-_0x54a113[_0x10a43b(0x11d)])*Math[_0x10a43b(0x135)](0x0,_0x54a113['bottom']-_0x54a113[_0x10a43b(0x130)]);}function g(_0x1f0142,_0x2536ee){const _0x4386b8=_0x28de21;return{'left':Math[_0x4386b8(0x135)](_0x1f0142[_0x4386b8(0x11d)],_0x2536ee[_0x4386b8(0x11d)]),'top':Math[_0x4386b8(0x135)](_0x1f0142[_0x4386b8(0x130)],_0x2536ee[_0x4386b8(0x130)]),'right':Math[_0x4386b8(0x13d)](_0x1f0142[_0x4386b8(0x10b)],_0x2536ee['right']),'bottom':Math[_0x4386b8(0x13d)](_0x1f0142[_0x4386b8(0xfc)],_0x2536ee['bottom'])};}function _(_0x192de5){const _0x2b1294=_0x28de21;return Math[_0x2b1294(0xf2)](_0x192de5);}function v(_0x16c024){const _0x361123=_0x28de21;let _0x3bad7b=_0x16c024[_0x361123(0x13a)](/\s+/gu,'\x20')[_0x361123(0x12f)]();return _0x3bad7b[_0x361123(0xfd)]<=0x10?_0x3bad7b:_0x3bad7b['slice'](0x0,0x10)+'…';}function y(_0x527a0d){const _0x48b39b=_0x28de21;return{'left':_(_0x527a0d[_0x48b39b(0x11d)]),'top':_(_0x527a0d[_0x48b39b(0x130)]),'width':_(_0x527a0d[_0x48b39b(0xf7)]),'height':_(_0x527a0d[_0x48b39b(0xf5)])};}function b(_0x2ce631){const _0xa13fe=_0x28de21;let _0x24bc02=_0x2ce631[_0xa13fe(0x106)];return{'id':_0x2ce631[_0xa13fe(0x11b)],'content':_0x24bc02[_0xa13fe(0x101)],'ink':y(_0x24bc02[_0xa13fe(0xf6)]),..._0x24bc02['color']===void 0x0?{}:{'color':_0x24bc02[_0xa13fe(0xff)]},..._0x24bc02['opacity']===void 0x0?{}:{'opacity':_0x24bc02[_0xa13fe(0x128)]}};}function x(_0xae25d8){const _0x24b576=_0x28de21;return _0xae25d8[_0x24b576(0xff)]===void 0x0&&_0xae25d8[_0x24b576(0x128)]===void 0x0?'':''+(_0xae25d8[_0x24b576(0xff)]===void 0x0?'':'\x20\x20'+_0xae25d8[_0x24b576(0xff)])+(_0xae25d8[_0x24b576(0x128)]===void 0x0?'':_0x24b576(0x142)+_0xae25d8[_0x24b576(0x128)]);}function S(_0x5b94ab){const _0xde89d9=_0x28de21;return{'id':_0x5b94ab[_0xde89d9(0x11b)],'type':_0x5b94ab['shapeType']===void 0x0?_0x5b94ab[_0xde89d9(0x105)]:_0x5b94ab[_0xde89d9(0x105)]+':'+_0x5b94ab[_0xde89d9(0x147)],..._0x5b94ab[_0xde89d9(0x10d)]===void 0x0?{}:{'fill':_0x5b94ab[_0xde89d9(0x10d)]},'box':y(_0x5b94ab[_0xde89d9(0x14a)])};}function C(_0x1e3bcb){const _0x15a84e=_0x28de21;if(_0x1e3bcb===void 0x0)return'no\x20fill';let _0x27b73e=_0x1e3bcb['opacity']===void 0x0||_0x1e3bcb[_0x15a84e(0x128)]===0x1?'':'\x20@'+_0x1e3bcb[_0x15a84e(0x128)];return((_0x1e3bcb[_0x15a84e(0x116)]??'?')+'\x20'+(_0x1e3bcb[_0x15a84e(0xff)]??'')+_0x27b73e)[_0x15a84e(0x12f)]();}function w(_0x234dfc){const _0x58753d=_0x28de21;return'('+_0x234dfc[_0x58753d(0x11d)]+','+_0x234dfc[_0x58753d(0x130)]+'\x20'+_0x234dfc['width']+'×'+_0x234dfc[_0x58753d(0xf5)]+')';}function T(_0x22290a){const _0x968ff6=_0x28de21;let _0x468b82=_0x22290a['fill'];return!(_0x468b82===void 0x0||_0x468b82[_0x968ff6(0x116)]===_0x968ff6(0x108)||_0x468b82[_0x968ff6(0x128)]!==void 0x0&&_0x468b82[_0x968ff6(0x128)]<o||_0x22290a[_0x968ff6(0x147)]===void 0x0||!s[_0x968ff6(0x114)](_0x22290a[_0x968ff6(0x147)])||_0x22290a[_0x968ff6(0x107)]===!0x1);}function _0x5aff(){const _0x450b99=['2874HeOlQT','elements','number','\x22\x20escapes\x20','pages\x20must\x20not\x20be\x20empty','signal','has','slideOrder','type','\x20overlaps\x20\x22','right\x20','1170135mqJLiM','Slide\x20has\x20no\x20pages\x20to\x20lint','elementId','unitData','left','pages','Render\x20result\x20contains\x20duplicate\x20element\x20identities\x20on\x20page\x20','pageWidth','related','top\x20','Render\x20result\x20does\x20not\x20contain\x20exactly\x20one\x20matching\x20page\x20','\x20by\x20','push','text-escapes-container','layout:','opacity','isInteger','slide','INVALID_RENDER_RESULT',');\x20ink\x20','Render\x20result\x20contains\x20unrequested\x20Slide\x20pages','44oIfkuL','trim','top','findIndex','67930HdUniH','code','bottom\x20','max','text-overlaps-text','join','roundRect','UnitLayoutLintError','replace','warning','text\x20\x22','min','2695GkIqoq','17203884VxcsMp','size','32EKnZuA','\x20\x20opacity\x20','INVALID_INPUT','pageHeight','rule','startsWith','shapeType','box','rect','declared','\x22\x20runs\x20off\x20the\x20page\x20(','get','1045DukMyZ','pageId','814VHySxS','Slide\x20unitData.id\x20is\x20required','round','runtime','page','height','ink','width','filter','text-off-page','1160aVtFAj','fingerprint','bottom','length','set','color','formulaReferenceUnits','content','4190795Cawjhl','map',',\x20page\x20','elementType','text','visible','none','zIndex','72579ptoFXT','right','sort','fill'];_0x5aff=function(){return _0x450b99;};return _0x5aff();}function E(_0x43e399,_0x2cfa27,_0x52a325){const _0xeef9d3=_0x28de21;let _0x3c7d6d=m(_0x43e399[_0xeef9d3(0x106)][_0xeef9d3(0xf6)]),_0xbe0e70;for(let _0xd2a530 of _0x2cfa27){if(_0xd2a530[_0xeef9d3(0x109)]>=_0x43e399['zIndex']||!T(_0xd2a530))continue;let _0x31a4d0=m(_0xd2a530['declared']),_0x5269ad=h(_0x31a4d0);if(_0x5269ad>=0.5*_0x52a325[_0xeef9d3(0x120)]*_0x52a325[_0xeef9d3(0x144)])continue;let _0x3d9725=_0x3c7d6d[_0xeef9d3(0x130)]>=_0x31a4d0[_0xeef9d3(0x130)]-n&&_0x3c7d6d['bottom']<=_0x31a4d0[_0xeef9d3(0xfc)]+n,_0x14bd61=_0x3c7d6d[_0xeef9d3(0x11d)]>=_0x31a4d0[_0xeef9d3(0x11d)]-n&&_0x3c7d6d[_0xeef9d3(0x11d)]<=_0x31a4d0[_0xeef9d3(0x10b)]+n&&_0x3c7d6d[_0xeef9d3(0x130)]>=_0x31a4d0[_0xeef9d3(0x130)]-n,_0x33ea78=h(g(_0x3c7d6d,_0x31a4d0))/Math[_0xeef9d3(0x135)](h(_0x3c7d6d),0x1);!_0x3d9725||!_0x14bd61||_0x33ea78<0.35||(_0xbe0e70===void 0x0||_0x5269ad<_0xbe0e70['area'])&&(_0xbe0e70={'element':_0xd2a530,'area':_0x5269ad});}return _0xbe0e70?.['element'];}function D(_0x187183){const _0x217e48=_0x28de21;let _0x11afd8=[_0x187183[_0x217e48(0x11d)]===void 0x0?'':'left\x20'+_0x187183[_0x217e48(0x11d)]+'px',_0x187183[_0x217e48(0x130)]===void 0x0?'':_0x217e48(0x122)+_0x187183[_0x217e48(0x130)]+'px',_0x187183['right']===void 0x0?'':_0x217e48(0x118)+_0x187183[_0x217e48(0x10b)]+'px',_0x187183[_0x217e48(0xfc)]===void 0x0?'':_0x217e48(0x134)+_0x187183[_0x217e48(0xfc)]+'px'][_0x217e48(0xf8)](_0x2b7267=>_0x2b7267!=='');return _0x11afd8['length']===0x0?'-':_0x11afd8[_0x217e48(0x137)](',\x20');}function O(_0x87d98b){const _0x51397f=_0x28de21;if(typeof _0x87d98b!='string'||_0x87d98b['trim']()==='')throw new e(_0x51397f(0x143),_0x51397f(0xf1));return _0x87d98b;}export{e as UnitLayoutLintError,l as createUnitLayoutLint,t as isUnitLayoutLintError};
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@univer-cli/unit-layout-lint",
3
+ "type": "module",
4
+ "version": "1.0.0-beta.2",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "README.zh-CN.md"
19
+ ],
20
+ "dependencies": {
21
+ "@univer-cli/univer-render-runtime": "1.0.0-beta.2"
22
+ }
23
+ }