@retikz/core 0.2.0-alpha.6 → 0.2.0-alpha.7
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/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +10 -4
- package/dist/es/compile/node.d.ts +19 -4
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +159 -29
- package/dist/es/compile/paint.d.ts +16 -0
- package/dist/es/compile/paint.d.ts.map +1 -0
- package/dist/es/compile/paint.js +37 -0
- package/dist/es/compile/path/index.d.ts +3 -0
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +2 -1
- package/dist/es/index.d.ts +3 -3
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +2 -1
- package/dist/es/ir/index.d.ts +1 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +262 -9
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +9 -2
- package/dist/es/ir/paint.d.ts +132 -0
- package/dist/es/ir/paint.d.ts.map +1 -0
- package/dist/es/ir/paint.js +53 -0
- package/dist/es/ir/path/arrow.d.ts +24 -24
- package/dist/es/ir/path/path.d.ts +198 -37
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +2 -1
- package/dist/es/ir/scope.d.ts +1187 -165
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +2 -1
- package/dist/es/primitive/ellipse.d.ts +3 -5
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/paint.d.ts +24 -0
- package/dist/es/primitive/paint.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +3 -2
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +3 -2
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +4 -0
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/shapes/types.d.ts +2 -2
- package/dist/es/shapes/types.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +9 -3
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +159 -28
- package/dist/lib/compile/node.d.ts +19 -4
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/paint.cjs +37 -0
- package/dist/lib/compile/paint.d.ts +16 -0
- package/dist/lib/compile/paint.d.ts.map +1 -0
- package/dist/lib/compile/path/index.cjs +2 -1
- package/dist/lib/compile/path/index.d.ts +3 -0
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/index.cjs +3 -0
- package/dist/lib/index.d.ts +3 -3
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/index.d.ts +1 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +9 -2
- package/dist/lib/ir/node.d.ts +262 -9
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/paint.cjs +54 -0
- package/dist/lib/ir/paint.d.ts +132 -0
- package/dist/lib/ir/paint.d.ts.map +1 -0
- package/dist/lib/ir/path/arrow.d.ts +24 -24
- package/dist/lib/ir/path/path.cjs +2 -1
- package/dist/lib/ir/path/path.d.ts +198 -37
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +2 -1
- package/dist/lib/ir/scope.d.ts +1187 -165
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +3 -5
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/paint.d.ts +24 -0
- package/dist/lib/primitive/paint.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +3 -2
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +3 -2
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +4 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/shapes/types.d.ts +2 -2
- package/dist/lib/shapes/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/ir/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,aAAa,CAAC;AAOhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../../src/ir/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,QAAQ,CAAC;AAEjD,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,aAAa,CAAC;AAOhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2GrB,CAAC"}
|
package/dist/es/ir/scope.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FontSchema } from "./font.js";
|
|
2
|
+
import { PaintSpecSchema } from "./paint.js";
|
|
2
3
|
import { ArrowDetailSchema } from "./path/arrow.js";
|
|
3
4
|
import { PathSchema } from "./path/path.js";
|
|
4
5
|
import { NodeSchema } from "./node.js";
|
|
@@ -67,7 +68,7 @@ var ScopeSchema = z.object({
|
|
|
67
68
|
transforms: z.array(TransformSchema).optional().describe("Local transforms applied to all scope children; array order = application order (first element applied innermost, matching Scene `GroupPrim.transforms` / SVG transform list). Supports 6 variants; the 4 translate variants are lowered to Cartesian translate at compile time."),
|
|
68
69
|
color: z.string().optional().describe("Cascading master color for all elements in this scope (TikZ scope `color=`). Stroke / fill / text of inner elements default to it unless individually overridden; cascades into edge labels and arrows."),
|
|
69
70
|
stroke: z.string().optional().describe("Cascading default stroke color for inner nodes and paths; overrides the cascading master color for the stroke channel."),
|
|
70
|
-
fill: z.string().optional().describe("Cascading default fill color for inner nodes and paths."),
|
|
71
|
+
fill: z.union([z.string(), PaintSpecSchema]).optional().describe("Cascading default fill (CSS color or PaintSpec: gradient / pattern / image) for inner nodes and paths."),
|
|
71
72
|
strokeWidth: z.number().optional().describe("Cascading default stroke width (user units) for inner nodes and paths."),
|
|
72
73
|
opacity: z.number().min(0).max(1).optional().describe("Cascading default whole-element opacity 0..1. Replaces (does NOT compound across nested scopes — TikZ default)."),
|
|
73
74
|
fillOpacity: z.number().min(0).max(1).optional().describe("Cascading default fill opacity 0..1 for inner nodes and paths."),
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* 椭圆原语(cx/cy 圆心,rx/ry 半径)
|
|
3
|
-
* @description 圆形(rx=ry)复用同一 prim 单 case 处理;rotate 度数绕中心,非零时由 renderer 在 emit 阶段应用旋转变换
|
|
4
|
-
*/
|
|
1
|
+
import { PaintValue } from './paint';
|
|
5
2
|
export type EllipsePrim = {
|
|
6
3
|
type: 'ellipse';
|
|
7
4
|
cx: number;
|
|
@@ -10,7 +7,8 @@ export type EllipsePrim = {
|
|
|
10
7
|
ry: number;
|
|
11
8
|
/** 绕中心旋转度数 */
|
|
12
9
|
rotate?: number;
|
|
13
|
-
|
|
10
|
+
/** 填充:纯色 / 资源表 paint server(gradient)/ contextStroke */
|
|
11
|
+
fill?: PaintValue;
|
|
14
12
|
/** 填充透明度 0~1 */
|
|
15
13
|
fillOpacity?: number;
|
|
16
14
|
stroke?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/primitive/ellipse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/primitive/ellipse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,cAAc;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IRPaintSpec } from '../ir/paint';
|
|
2
|
+
/**
|
|
3
|
+
* paint 属性取值词汇表(可用于 fill / stroke,不绑定单一属性)
|
|
4
|
+
* @description 渲染无关:`string` 纯色(含 var() 由 adapter 走 inline style);`{ kind:'resourceRef' }` 指向
|
|
5
|
+
* `Scene.resources` 里的 paint server(gradient / 后续 pattern·image);`{ kind:'contextStroke' }` 继承所在元素描边
|
|
6
|
+
* (adapter → SVG context-stroke,alpha.8 arrow 用)。
|
|
7
|
+
*/
|
|
8
|
+
export type PaintValue = string | {
|
|
9
|
+
kind: 'resourceRef';
|
|
10
|
+
id: string;
|
|
11
|
+
} | {
|
|
12
|
+
kind: 'contextStroke';
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Scene 级渲染无关资源(adapter 各自物化;SVG → `<defs>`)
|
|
16
|
+
* @description discriminated union——本段只 paint(gradient),后续 clip 加 `{ kind:'clip' }` 分支不破契约。
|
|
17
|
+
* id 由 compile 去重 + 稳定分配,primitive 经 `{ kind:'resourceRef', id }` 引用。
|
|
18
|
+
*/
|
|
19
|
+
export type SceneResource = {
|
|
20
|
+
kind: 'paint';
|
|
21
|
+
id: string;
|
|
22
|
+
spec: IRPaintSpec;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=paint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paint.d.ts","sourceRoot":"","sources":["../../../src/primitive/paint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE9B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ArrowShape } from '../ir/path/arrow';
|
|
2
|
+
import { PaintValue } from './paint';
|
|
2
3
|
/** Move command:移动游标到目标点,不绘制 */
|
|
3
4
|
export type MovePathCommand = {
|
|
4
5
|
/** 鉴别字面量 */
|
|
@@ -105,8 +106,8 @@ export type PathPrim = {
|
|
|
105
106
|
type: 'path';
|
|
106
107
|
/** 结构化路径命令序列,按数组顺序绘制 */
|
|
107
108
|
commands: Array<PathCommand>;
|
|
108
|
-
/**
|
|
109
|
-
fill?:
|
|
109
|
+
/** 填充:纯色 / 资源表 paint server(gradient)/ contextStroke;不填表示不填充 */
|
|
110
|
+
fill?: PaintValue;
|
|
110
111
|
/** 填充透明度 0~1 */
|
|
111
112
|
fillOpacity?: number;
|
|
112
113
|
/** 填充规则:`nonzero`(默认)/ `evenodd`(环形 / 孔洞场景) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/primitive/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/primitive/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,8BAA8B;AAC9B,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtB,CAAC;AAEF,+BAA+B;AAC/B,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB;IACjB,OAAO,EAAE,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AAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,WAAW;IACX,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,+BAA+B;IAC/B,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PaintValue } from './paint';
|
|
1
2
|
/** 矩形原语 */
|
|
2
3
|
export type RectPrim = {
|
|
3
4
|
/** 类型判别符 */
|
|
@@ -10,8 +11,8 @@ export type RectPrim = {
|
|
|
10
11
|
width: number;
|
|
11
12
|
/** 矩形高度 */
|
|
12
13
|
height: number;
|
|
13
|
-
/**
|
|
14
|
-
fill?:
|
|
14
|
+
/** 填充:纯色 CSS 串、或指向资源表的 paint server(gradient)、或 contextStroke */
|
|
15
|
+
fill?: PaintValue;
|
|
15
16
|
/** 填充透明度 0~1 */
|
|
16
17
|
fillOpacity?: number;
|
|
17
18
|
/** 描边色 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/primitive/rect.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/primitive/rect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,WAAW;AACX,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -4,6 +4,8 @@ import { PathPrim } from './path';
|
|
|
4
4
|
import { RectPrim } from './rect';
|
|
5
5
|
import { TextPrim } from './text';
|
|
6
6
|
import { Layout } from './layout';
|
|
7
|
+
import { SceneResource } from './paint';
|
|
8
|
+
export type { PaintValue, SceneResource } from './paint';
|
|
7
9
|
/**
|
|
8
10
|
* Scene primitive:渲染目标无关的最大公约子集
|
|
9
11
|
* @description 所有 adapter(SVG/Canvas/PDF/Skia)都应能消费;不允许出现 SVG-only 或 Canvas-only 特性(filter/marker/imageData)
|
|
@@ -15,5 +17,7 @@ export type Scene = {
|
|
|
15
17
|
primitives: Array<ScenePrimitive>;
|
|
16
18
|
/** 整个场景的布局边界 */
|
|
17
19
|
layout: Layout;
|
|
20
|
+
/** 渲染无关资源表(paint server 等);adapter 物化(SVG → `<defs>`)。无资源时省略 */
|
|
21
|
+
resources?: Array<SceneResource>;
|
|
18
22
|
};
|
|
19
23
|
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/primitive/scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/primitive/scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEtF,qCAAqC;AACrC,MAAM,MAAM,KAAK,GAAG;IAClB,wBAAwB;IACxB,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,gBAAgB;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAClC,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Position } from '../geometry/point';
|
|
2
2
|
import { Rect } from '../geometry/rect';
|
|
3
|
-
import { ScenePrimitive } from '../primitive';
|
|
3
|
+
import { PaintValue, ScenePrimitive } from '../primitive';
|
|
4
4
|
/**
|
|
5
5
|
* emit 需要的视觉样式子集
|
|
6
6
|
* @description 从 NodeLayout 的样式字段收敛(不含几何 / 文本);独立 type,不耦合内部 NodeLayout。
|
|
7
7
|
* 字段名与 NodeLayout 样式字段一致(单一词汇表)。
|
|
8
8
|
*/
|
|
9
9
|
export type ShapeStyle = {
|
|
10
|
-
fill?:
|
|
10
|
+
fill?: PaintValue;
|
|
11
11
|
fillOpacity?: number;
|
|
12
12
|
stroke?: string;
|
|
13
13
|
strokeOpacity?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shapes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shapes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE/D;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,YAAY,EAAE,CACZ,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,KACpB;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,0CAA0C;IAC1C,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,KAAK,QAAQ,CAAC;IAC1D,6DAA6D;IAC7D,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IAC3D;;;;OAIG;IACH,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,EACzC,CAAC,EAAE,MAAM,KACN,QAAQ,CAAC;IACd,4DAA4D;IAC5D,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAAK,QAAQ,CAAC,cAAc,CAAC,CAAC;CACjG,CAAC"}
|
|
@@ -4,6 +4,7 @@ const require_name_stack = require("./name-stack.cjs");
|
|
|
4
4
|
const require_scope = require("./scope.cjs");
|
|
5
5
|
const require_position = require("./position.cjs");
|
|
6
6
|
const require_node = require("./node.cjs");
|
|
7
|
+
const require_paint = require("./paint.cjs");
|
|
7
8
|
const require_text_metrics = require("./text-metrics.cjs");
|
|
8
9
|
const require_index$1 = require("./path/index.cjs");
|
|
9
10
|
const require_precision = require("./precision.cjs");
|
|
@@ -133,6 +134,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
133
134
|
};
|
|
134
135
|
const nameStack = new require_name_stack.NameStack({ onDuplicate: (info) => onWarn(formatDuplicateWarning(info)) });
|
|
135
136
|
const allPoints = [];
|
|
137
|
+
const paint = require_paint.createPaintRegistry();
|
|
136
138
|
/**
|
|
137
139
|
* 解析一批本层收集的 pending paths(lookup-only 阶段)
|
|
138
140
|
* @description 两种落点:有 `slot`(scopeChain 为空)→ 原位 splice 回填该 path 在本层 sink 占的位(按引用定位免索引漂移),保住与同层 node 的 IR 声明序;无 `slot`(scopeChain 非空)→ hoist 到顶层 `primitives`,因端点已是全局坐标、进 transformed GroupPrim 会被 scope.transform 二次 apply。NameStack 切到 pass2 守门:path 解析中误调 register 抛 internal error;解析完切回 pass1 让上层 scope 子树继续 register 子节点。
|
|
@@ -147,7 +149,8 @@ var compileToScene = (ir, options = {}) => {
|
|
|
147
149
|
const result = require_index$1.emitPathPrimitive(item.path, nameStack, round, measureText, {
|
|
148
150
|
onWarn,
|
|
149
151
|
irPath: item.irPath,
|
|
150
|
-
scopeChain: item.scopeChain
|
|
152
|
+
scopeChain: item.scopeChain,
|
|
153
|
+
resolveFill: paint.resolve
|
|
151
154
|
});
|
|
152
155
|
if (item.slot) {
|
|
153
156
|
const idx = item.slot.sink.indexOf(item.slot.placeholder);
|
|
@@ -184,11 +187,12 @@ var compileToScene = (ir, options = {}) => {
|
|
|
184
187
|
const layout = require_node.layoutNode(require_style.resolveNodeStyle(child, styleStack), measureText, nameStack, nodeDistance, chain, require_style.resolveLabelDefault(styleStack), effectiveShapes);
|
|
185
188
|
const globalLayout = chain.length === 0 ? layout : require_scope.projectLayoutToGlobal(layout, chain);
|
|
186
189
|
if (child.id) nameStack.register(child.id, globalLayout, `${locatorPrefix}children[${i}].node.id`);
|
|
187
|
-
for (const prim of require_node.emitNodePrimitives(layout, round)) {
|
|
190
|
+
for (const prim of require_node.emitNodePrimitives(layout, round, paint.resolve)) {
|
|
188
191
|
sink.push(prim);
|
|
189
192
|
if (child.zIndex !== void 0) zIndexOf.set(prim, child.zIndex);
|
|
190
193
|
}
|
|
191
194
|
allPoints.push(require_rect.rect.anchor(globalLayout.rect, "north-west"), require_rect.rect.anchor(globalLayout.rect, "north-east"), require_rect.rect.anchor(globalLayout.rect, "south-west"), require_rect.rect.anchor(globalLayout.rect, "south-east"));
|
|
195
|
+
for (const p of require_node.labelExtentPoints(globalLayout)) allPoints.push(p);
|
|
192
196
|
layoutsAccumulator.push(globalLayout);
|
|
193
197
|
} else if (child.type === "coordinate") {
|
|
194
198
|
const localCenter = require_position.resolvePosition(child.position, nameStack, nodeDistance, chain);
|
|
@@ -272,9 +276,11 @@ var compileToScene = (ir, options = {}) => {
|
|
|
272
276
|
const detail = typeof process !== "undefined" && process.env.NODE_ENV !== "production" ? ` at ${collectPlaceholderLocators(primitives).join(", ")}` : "";
|
|
273
277
|
throw new Error(`internal: ${placeholderBalance} unresolved path placeholder(s) leaked into Scene output${detail}`);
|
|
274
278
|
}
|
|
279
|
+
const resources = paint.resources();
|
|
275
280
|
return {
|
|
276
281
|
primitives: stableSortByZIndex(sealSink(primitives)),
|
|
277
|
-
layout: require_layout.computeLayout(allPoints, layoutPadding, round)
|
|
282
|
+
layout: require_layout.computeLayout(allPoints, layoutPadding, round),
|
|
283
|
+
...resources.length > 0 ? { resources } : {}
|
|
278
284
|
};
|
|
279
285
|
};
|
|
280
286
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAwC,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAa,KAAK,EAA6B,MAAM,cAAc,CAAC;AAEhF,OAAO,K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
|
@@ -5,6 +5,49 @@ var DEFAULT_FONT_SIZE = 14;
|
|
|
5
5
|
var DEFAULT_PADDING = 8;
|
|
6
6
|
var DEFAULT_LINE_HEIGHT_FACTOR = 1.2;
|
|
7
7
|
var DEG_TO_RAD = Math.PI / 180;
|
|
8
|
+
/** CJK / fullwidth ranges: break per-character (no whitespace needed) */
|
|
9
|
+
var isCjk = (ch) => {
|
|
10
|
+
const c = ch.codePointAt(0) ?? 0;
|
|
11
|
+
return c >= 12288 && c <= 12351 || c >= 12352 && c <= 12543 || c >= 13312 && c <= 19903 || c >= 19968 && c <= 40959 || c >= 63744 && c <= 64255 || c >= 65280 && c <= 65519;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* 按 maxWidth 贪心折行:西文按词(空白分割)、CJK 按字;长不可断 token 溢出不硬断
|
|
15
|
+
* @description 用注入的 measureText 度量;连续空白归一为单空格分隔。空文本返回 [''].
|
|
16
|
+
*/
|
|
17
|
+
var wrapText = (text, font, maxWidth, measure) => {
|
|
18
|
+
const units = [];
|
|
19
|
+
for (const seg of text.split(/(\s+)/)) {
|
|
20
|
+
if (seg === "") continue;
|
|
21
|
+
if (/^\s+$/.test(seg)) {
|
|
22
|
+
units.push(" ");
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
let run = "";
|
|
26
|
+
for (const ch of seg) if (isCjk(ch)) {
|
|
27
|
+
if (run) {
|
|
28
|
+
units.push(run);
|
|
29
|
+
run = "";
|
|
30
|
+
}
|
|
31
|
+
units.push(ch);
|
|
32
|
+
} else run += ch;
|
|
33
|
+
if (run) units.push(run);
|
|
34
|
+
}
|
|
35
|
+
const lines = [];
|
|
36
|
+
let cur = "";
|
|
37
|
+
for (const u of units) {
|
|
38
|
+
if (u === " ") {
|
|
39
|
+
if (cur !== "") cur += " ";
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const candidate = cur === "" ? u : cur + u;
|
|
43
|
+
if (cur !== "" && measure(candidate, font).width > maxWidth) {
|
|
44
|
+
lines.push(cur.trimEnd());
|
|
45
|
+
cur = u;
|
|
46
|
+
} else cur = candidate;
|
|
47
|
+
}
|
|
48
|
+
if (cur.trimEnd() !== "") lines.push(cur.trimEnd());
|
|
49
|
+
return lines.length > 0 ? lines : [""];
|
|
50
|
+
};
|
|
8
51
|
/** Node label 与 node 边界默认距离(TikZ 默认 0pt 视觉太贴) */
|
|
9
52
|
var DEFAULT_LABEL_DISTANCE = 12;
|
|
10
53
|
/** dashed 预设:4 px 实线 + 2 px 间隙循环 */
|
|
@@ -84,7 +127,8 @@ var LABEL_DIRECTION_MAP = {
|
|
|
84
127
|
* 若用带 rotate 的 rect,label 位置会被 anchorOf / angleBoundaryOf 旋转一次、再被外层 group 旋转一次(双重旋转)。
|
|
85
128
|
* anchorOf / angleBoundaryOf 本身不改(path anchor `'A.north'` / `'A.30'` 仍需带 rotate 的 rect)。
|
|
86
129
|
*/
|
|
87
|
-
|
|
130
|
+
/** label 在 node 边界上的附着点(未旋转局部系;pin 引线起点 = 此点) */
|
|
131
|
+
var labelBorderPoint = (layout, label) => {
|
|
88
132
|
const aaLayout = {
|
|
89
133
|
...layout,
|
|
90
134
|
rect: {
|
|
@@ -92,15 +136,32 @@ var labelCenter = (layout, label) => {
|
|
|
92
136
|
rotate: 0
|
|
93
137
|
}
|
|
94
138
|
};
|
|
139
|
+
if (typeof label.position === "number") return angleBoundaryOf(aaLayout, label.position);
|
|
140
|
+
const { anchor } = LABEL_DIRECTION_MAP[label.position];
|
|
141
|
+
return anchorOf(aaLayout, anchor);
|
|
142
|
+
};
|
|
143
|
+
var labelCenter = (layout, label) => {
|
|
144
|
+
const [bx, by] = labelBorderPoint(layout, label);
|
|
95
145
|
if (typeof label.position === "number") {
|
|
96
146
|
const rad = label.position * Math.PI / 180;
|
|
97
|
-
const [bx, by] = angleBoundaryOf(aaLayout, label.position);
|
|
98
147
|
return [bx + Math.cos(rad) * label.distance, by + Math.sin(rad) * label.distance];
|
|
99
148
|
}
|
|
100
|
-
const {
|
|
101
|
-
const [bx, by] = anchorOf(aaLayout, anchor);
|
|
149
|
+
const { vec } = LABEL_DIRECTION_MAP[label.position];
|
|
102
150
|
return [bx + vec[0] * label.distance, by + vec[1] * label.distance];
|
|
103
151
|
};
|
|
152
|
+
/** 从 label 中心朝 border 方向,求 label 框(halfW×halfH)边界交点(pin 引线终点 = label 框近 node 边) */
|
|
153
|
+
var labelBoxEdgeToward = (center, border, halfW, halfH) => {
|
|
154
|
+
const dx = border[0] - center[0];
|
|
155
|
+
const dy = border[1] - center[1];
|
|
156
|
+
const len = Math.hypot(dx, dy);
|
|
157
|
+
if (len < 1e-9) return center;
|
|
158
|
+
const ux = dx / len;
|
|
159
|
+
const uy = dy / len;
|
|
160
|
+
const sx = Math.abs(ux) > 1e-9 ? halfW / Math.abs(ux) : Number.POSITIVE_INFINITY;
|
|
161
|
+
const sy = Math.abs(uy) > 1e-9 ? halfH / Math.abs(uy) : Number.POSITIVE_INFINITY;
|
|
162
|
+
const s = Math.min(sx, sy, len);
|
|
163
|
+
return [center[0] + ux * s, center[1] + uy * s];
|
|
164
|
+
};
|
|
104
165
|
/** 角度换算常量(弧度 → 度) */
|
|
105
166
|
var RAD_TO_DEG = 180 / Math.PI;
|
|
106
167
|
/**
|
|
@@ -162,32 +223,38 @@ var layoutNode = (node, measureText, nameStack, nodeDistance, scopeChain = [], l
|
|
|
162
223
|
const lineHeight = (node.lineHeight ?? baseFontSize * DEFAULT_LINE_HEIGHT_FACTOR) * sy;
|
|
163
224
|
const align = alignToTextAnchor(node.align ?? "center");
|
|
164
225
|
const rawLines = node.text === void 0 ? void 0 : typeof node.text === "string" ? [node.text] : node.text;
|
|
226
|
+
const maxTextWidth = node.maxTextWidth !== void 0 ? node.maxTextWidth * sx : void 0;
|
|
165
227
|
let textWidth = 0;
|
|
166
228
|
let textHeight = 0;
|
|
167
229
|
let lines;
|
|
168
230
|
if (rawLines) {
|
|
169
|
-
lines =
|
|
231
|
+
lines = [];
|
|
232
|
+
for (const spec of rawLines) {
|
|
170
233
|
const isObj = typeof spec !== "string";
|
|
171
234
|
const text = isObj ? spec.text : spec;
|
|
172
235
|
const lineFont = isObj ? spec.font : void 0;
|
|
173
|
-
const
|
|
236
|
+
const font = {
|
|
174
237
|
size: lineFont?.size ?? fontSize,
|
|
175
238
|
family: lineFont?.family ?? fontFamily,
|
|
176
239
|
weight: lineFont?.weight ?? fontWeight,
|
|
177
240
|
style: lineFont?.style ?? fontStyle
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
if (
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
241
|
+
};
|
|
242
|
+
const physical = maxTextWidth !== void 0 ? wrapText(text, font, maxTextWidth, measureText) : [text];
|
|
243
|
+
for (const ptext of physical) {
|
|
244
|
+
const m = measureText(ptext, font);
|
|
245
|
+
if (m.width > textWidth) textWidth = m.width;
|
|
246
|
+
const out = { text: ptext };
|
|
247
|
+
if (isObj) {
|
|
248
|
+
if (spec.fill !== void 0) out.fill = spec.fill;
|
|
249
|
+
if (spec.opacity !== void 0) out.opacity = spec.opacity;
|
|
250
|
+
if (lineFont?.size !== void 0) out.fontSize = lineFont.size;
|
|
251
|
+
if (lineFont?.family !== void 0) out.fontFamily = lineFont.family;
|
|
252
|
+
if (lineFont?.weight !== void 0) out.fontWeight = lineFont.weight;
|
|
253
|
+
if (lineFont?.style !== void 0) out.fontStyle = lineFont.style;
|
|
254
|
+
}
|
|
255
|
+
lines.push(out);
|
|
188
256
|
}
|
|
189
|
-
|
|
190
|
-
});
|
|
257
|
+
}
|
|
191
258
|
textHeight = lines.length * lineHeight;
|
|
192
259
|
}
|
|
193
260
|
const minW = node.minimumWidth ?? node.minimumSize ?? 0;
|
|
@@ -200,18 +267,29 @@ var layoutNode = (node, measureText, nameStack, nodeDistance, scopeChain = [], l
|
|
|
200
267
|
if (!center) throw new Error(`Cannot resolve position for node ${node.id ?? "(unnamed)"}; polar.origin or at.of may reference an undefined node`);
|
|
201
268
|
const labels = (node.label === void 0 ? void 0 : Array.isArray(node.label) ? node.label : [node.label])?.map((lab) => {
|
|
202
269
|
const labFont = lab.font;
|
|
270
|
+
const labFontSize = (labFont?.size ?? labelDefault?.font?.size ?? baseFontSize) * fontScale;
|
|
271
|
+
const labFamily = labFont?.family ?? labelDefault?.font?.family ?? fontFamily;
|
|
272
|
+
const labWeight = labFont?.weight ?? labelDefault?.font?.weight ?? fontWeight;
|
|
273
|
+
const labStyle = labFont?.style ?? labelDefault?.font?.style ?? fontStyle;
|
|
203
274
|
return {
|
|
204
275
|
text: lab.text,
|
|
205
276
|
position: lab.position ?? "above",
|
|
206
277
|
distance: lab.distance ?? DEFAULT_LABEL_DISTANCE,
|
|
207
278
|
textColor: lab.textColor ?? labelDefault?.textColor ?? labelDefault?.color ?? node.textColor,
|
|
208
279
|
opacity: lab.opacity ?? labelDefault?.opacity,
|
|
209
|
-
fontSize:
|
|
210
|
-
fontFamily:
|
|
211
|
-
fontWeight:
|
|
212
|
-
fontStyle:
|
|
280
|
+
fontSize: labFontSize,
|
|
281
|
+
fontFamily: labFamily,
|
|
282
|
+
fontWeight: labWeight,
|
|
283
|
+
fontStyle: labStyle,
|
|
213
284
|
rotate: lab.rotate,
|
|
214
|
-
keepUpright: lab.keepUpright
|
|
285
|
+
keepUpright: lab.keepUpright,
|
|
286
|
+
measuredWidth: measureText(lab.text, {
|
|
287
|
+
size: labFontSize,
|
|
288
|
+
family: labFamily,
|
|
289
|
+
weight: labWeight,
|
|
290
|
+
style: labStyle
|
|
291
|
+
}).width,
|
|
292
|
+
pin: lab.pin
|
|
215
293
|
};
|
|
216
294
|
});
|
|
217
295
|
return {
|
|
@@ -248,9 +326,9 @@ var layoutNode = (node, measureText, nameStack, nodeDistance, scopeChain = [], l
|
|
|
248
326
|
labels
|
|
249
327
|
};
|
|
250
328
|
};
|
|
251
|
-
/** 从 NodeLayout 收敛 emit 所需的视觉样式子集(ShapeStyle,不含几何 /
|
|
252
|
-
var toShapeStyle = (layout) => ({
|
|
253
|
-
fill: layout.fill,
|
|
329
|
+
/** 从 NodeLayout 收敛 emit 所需的视觉样式子集(ShapeStyle,不含几何 / 文本);fill 经 resolveFill 转 PaintValue */
|
|
330
|
+
var toShapeStyle = (layout, resolveFill) => ({
|
|
331
|
+
fill: resolveFill(layout.fill),
|
|
254
332
|
fillOpacity: layout.fillOpacity,
|
|
255
333
|
stroke: layout.stroke,
|
|
256
334
|
strokeOpacity: layout.strokeOpacity,
|
|
@@ -264,12 +342,44 @@ var toShapeStyle = (layout) => ({
|
|
|
264
342
|
* @description shape 主体走 `shapeDef.emit`(收轴对齐 rect、可出多 primitive);text 始终走 TextPrim;
|
|
265
343
|
* 有旋转时外层 GroupPrim 用 `rotate(deg cx cy)` 统一包裹 shape + text(diamond 顶点 / text 都靠 group 旋转)
|
|
266
344
|
*/
|
|
267
|
-
|
|
345
|
+
/**
|
|
346
|
+
* 节点 label 的外接点(供顶层 bbox / viewBox 计算,让 label 不被裁——与 step.label 进 bbox 一致)
|
|
347
|
+
* @description 每个 label 取其文本框四角;label 中心走 labelCenter(轴对齐系),node 自身 rotate 时绕 node 中心旋转
|
|
348
|
+
* (与 emit 的 group rotate 同步)。pin 引线起点在 node 边界内、已被 node 四角覆盖,无需额外。
|
|
349
|
+
*/
|
|
350
|
+
var labelExtentPoints = (layout) => {
|
|
351
|
+
if (!layout.labels || layout.labels.length === 0) return [];
|
|
352
|
+
const cx = layout.rect.x;
|
|
353
|
+
const cy = layout.rect.y;
|
|
354
|
+
const rad = layout.rotateDeg * Math.PI / 180;
|
|
355
|
+
const cos = Math.cos(rad);
|
|
356
|
+
const sin = Math.sin(rad);
|
|
357
|
+
const pts = [];
|
|
358
|
+
for (const lab of layout.labels) {
|
|
359
|
+
const [lx, ly] = labelCenter(layout, lab);
|
|
360
|
+
const halfW = lab.measuredWidth / 2;
|
|
361
|
+
const halfH = lab.fontSize / 2;
|
|
362
|
+
const corners = [
|
|
363
|
+
[lx - halfW, ly - halfH],
|
|
364
|
+
[lx + halfW, ly - halfH],
|
|
365
|
+
[lx - halfW, ly + halfH],
|
|
366
|
+
[lx + halfW, ly + halfH]
|
|
367
|
+
];
|
|
368
|
+
for (const [px, py] of corners) if (layout.rotateDeg === 0) pts.push([px, py]);
|
|
369
|
+
else {
|
|
370
|
+
const dx = px - cx;
|
|
371
|
+
const dy = py - cy;
|
|
372
|
+
pts.push([cx + dx * cos - dy * sin, cy + dx * sin + dy * cos]);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return pts;
|
|
376
|
+
};
|
|
377
|
+
var emitNodePrimitives = (layout, round, resolveFill) => {
|
|
268
378
|
const axisAlignedRect = {
|
|
269
379
|
...layout.rect,
|
|
270
380
|
rotate: 0
|
|
271
381
|
};
|
|
272
|
-
const inner = [...layout.shapeDef.emit(axisAlignedRect, toShapeStyle(layout), round)];
|
|
382
|
+
const inner = [...layout.shapeDef.emit(axisAlignedRect, toShapeStyle(layout, resolveFill), round)];
|
|
273
383
|
if (layout.lines) {
|
|
274
384
|
const halfBlockW = layout.textWidth / 2;
|
|
275
385
|
const xOffset = layout.align === "start" ? -halfBlockW : layout.align === "end" ? halfBlockW : 0;
|
|
@@ -296,6 +406,26 @@ var emitNodePrimitives = (layout, round) => {
|
|
|
296
406
|
const cy = layout.rect.y;
|
|
297
407
|
for (const lab of layout.labels) {
|
|
298
408
|
const [lx, ly] = labelCenter(layout, lab);
|
|
409
|
+
if (lab.pin) {
|
|
410
|
+
const style = typeof lab.pin === "object" ? lab.pin : void 0;
|
|
411
|
+
const [bx, by] = labelBorderPoint(layout, lab);
|
|
412
|
+
const pad = 2;
|
|
413
|
+
const [nx, ny] = labelBoxEdgeToward([lx, ly], [bx, by], lab.measuredWidth / 2 + pad, lab.fontSize / 2 + pad);
|
|
414
|
+
inner.push({
|
|
415
|
+
type: "path",
|
|
416
|
+
commands: [{
|
|
417
|
+
kind: "move",
|
|
418
|
+
to: [round(bx), round(by)]
|
|
419
|
+
}, {
|
|
420
|
+
kind: "line",
|
|
421
|
+
to: [round(nx), round(ny)]
|
|
422
|
+
}],
|
|
423
|
+
stroke: style?.stroke ?? lab.textColor ?? "currentColor",
|
|
424
|
+
strokeWidth: style?.strokeWidth ?? 1,
|
|
425
|
+
dashPattern: style?.dashPattern,
|
|
426
|
+
opacity: lab.opacity ?? layout.opacity
|
|
427
|
+
});
|
|
428
|
+
}
|
|
299
429
|
const textPrim = {
|
|
300
430
|
type: "text",
|
|
301
431
|
x: round(lx),
|
|
@@ -345,4 +475,5 @@ exports.anchorOf = anchorOf;
|
|
|
345
475
|
exports.angleBoundaryOf = angleBoundaryOf;
|
|
346
476
|
exports.boundaryPointOf = boundaryPointOf;
|
|
347
477
|
exports.emitNodePrimitives = emitNodePrimitives;
|
|
478
|
+
exports.labelExtentPoints = labelExtentPoints;
|
|
348
479
|
exports.layoutNode = layoutNode;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Position } from '../geometry/point';
|
|
2
2
|
import { Rect } from '../geometry/rect';
|
|
3
|
-
import { AtDirection, IRLabelDefault, IRNode } from '../ir';
|
|
3
|
+
import { AtDirection, IRLabelDefault, IRNode, IRPaintSpec } from '../ir';
|
|
4
|
+
import { PaintResolver } from './paint';
|
|
4
5
|
import { ScenePrimitive, TextLine, Transform } from '../primitive';
|
|
5
6
|
import { ShapeDefinition } from '../shapes';
|
|
6
7
|
import { NameStack } from './name-stack';
|
|
@@ -42,8 +43,8 @@ export type NodeLayout = {
|
|
|
42
43
|
fontWeight?: string | number;
|
|
43
44
|
/** 字形 */
|
|
44
45
|
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
45
|
-
/**
|
|
46
|
-
fill?: string;
|
|
46
|
+
/** 节点背景填充(纯色 / PaintSpec gradient),emit 时经 resolveFill → PaintValue、'transparent' 兜底 */
|
|
47
|
+
fill?: string | IRPaintSpec;
|
|
47
48
|
/** 填充透明度 0~1 */
|
|
48
49
|
fillOpacity?: number;
|
|
49
50
|
/** 节点边框色,emit 时 'currentColor' 兜底 */
|
|
@@ -83,6 +84,14 @@ export type NodeLabelLayout = {
|
|
|
83
84
|
rotate?: 'none' | 'radial' | 'tangent' | number;
|
|
84
85
|
/** 自旋后若文字倒置则翻 180°;缺省 false */
|
|
85
86
|
keepUpright?: boolean;
|
|
87
|
+
/** label 文本测量宽度(pin leader 算 label 框近边用) */
|
|
88
|
+
measuredWidth: number;
|
|
89
|
+
/** pin:true = 默认引线;对象 = 带样式引线(stroke / strokeWidth / dashPattern);缺省 / false = 无引线 */
|
|
90
|
+
pin?: boolean | {
|
|
91
|
+
stroke?: string;
|
|
92
|
+
strokeWidth?: number;
|
|
93
|
+
dashPattern?: Array<number>;
|
|
94
|
+
};
|
|
86
95
|
};
|
|
87
96
|
/**
|
|
88
97
|
* 取节点 shape 在 toward 方向的附着点(path 端点贴边用)
|
|
@@ -113,5 +122,11 @@ export declare const layoutNode: (node: IRNode, measureText: TextMeasurer, nameS
|
|
|
113
122
|
* @description shape 主体走 `shapeDef.emit`(收轴对齐 rect、可出多 primitive);text 始终走 TextPrim;
|
|
114
123
|
* 有旋转时外层 GroupPrim 用 `rotate(deg cx cy)` 统一包裹 shape + text(diamond 顶点 / text 都靠 group 旋转)
|
|
115
124
|
*/
|
|
116
|
-
|
|
125
|
+
/**
|
|
126
|
+
* 节点 label 的外接点(供顶层 bbox / viewBox 计算,让 label 不被裁——与 step.label 进 bbox 一致)
|
|
127
|
+
* @description 每个 label 取其文本框四角;label 中心走 labelCenter(轴对齐系),node 自身 rotate 时绕 node 中心旋转
|
|
128
|
+
* (与 emit 的 group rotate 同步)。pin 引线起点在 node 边界内、已被 node 四角覆盖,无需额外。
|
|
129
|
+
*/
|
|
130
|
+
export declare const labelExtentPoints: (layout: NodeLayout) => Array<Position>;
|
|
131
|
+
export declare const emitNodePrimitives: (layout: NodeLayout, round: (n: number) => number, resolveFill: PaintResolver) => Array<ScenePrimitive>;
|
|
117
132
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/compile/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/compile/node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAc,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAc,MAAM,EAAe,WAAW,EAAE,MAAM,OAAO,CAAC;AACvG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAa,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnF,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgG7D,MAAM,MAAM,UAAU,GAAG;IACvB,qBAAqB;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,QAAQ,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf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