@retikz/core 0.1.0-alpha.0 → 0.1.0-alpha.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/dist/es/compile/index.d.ts +1 -0
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/node.d.ts +73 -22
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +276 -52
- package/dist/es/compile/parseTarget.d.ts +25 -0
- package/dist/es/compile/parseTarget.d.ts.map +1 -0
- package/dist/es/compile/parseTarget.js +48 -0
- package/dist/es/compile/path.d.ts +17 -7
- package/dist/es/compile/path.d.ts.map +1 -1
- package/dist/es/compile/path.js +276 -33
- package/dist/es/compile/text-metrics.d.ts +2 -2
- package/dist/es/compile/text-metrics.d.ts.map +1 -1
- package/dist/es/geometry/circle.d.ts +32 -0
- package/dist/es/geometry/circle.d.ts.map +1 -0
- package/dist/es/geometry/circle.js +79 -0
- package/dist/es/geometry/diamond.d.ts +44 -0
- package/dist/es/geometry/diamond.d.ts.map +1 -0
- package/dist/es/geometry/diamond.js +87 -0
- package/dist/es/geometry/ellipse.d.ts +38 -0
- package/dist/es/geometry/ellipse.d.ts.map +1 -0
- package/dist/es/geometry/ellipse.js +86 -0
- package/dist/es/geometry/index.d.ts +3 -0
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/index.d.ts +9 -7
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +8 -4
- package/dist/es/ir/node.d.ts +319 -7
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +96 -8
- package/dist/es/ir/path/arrow.d.ts +26 -0
- package/dist/es/ir/path/arrow.d.ts.map +1 -0
- package/dist/es/ir/path/arrow.js +25 -0
- package/dist/es/ir/path/index.d.ts +1 -0
- package/dist/es/ir/path/index.d.ts.map +1 -1
- package/dist/es/ir/path/path.d.ts +60 -0
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +10 -0
- package/dist/es/ir/path/step.d.ts +56 -2
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +17 -2
- package/dist/es/ir/scene.d.ts +538 -16
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/parsers/parseWay.d.ts +56 -10
- package/dist/es/parsers/parseWay.d.ts.map +1 -1
- package/dist/es/parsers/parseWay.js +68 -6
- package/dist/es/primitive/ellipse.d.ts +34 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -0
- package/dist/es/primitive/index.d.ts +1 -0
- package/dist/es/primitive/index.d.ts.map +1 -1
- package/dist/es/primitive/path.d.ts +11 -0
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +2 -0
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +2 -1
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +43 -13
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/es/types.d.ts +3 -0
- package/dist/es/types.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +1 -0
- package/dist/lib/compile/index.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +278 -52
- package/dist/lib/compile/node.d.ts +73 -22
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/parseTarget.cjs +48 -0
- package/dist/lib/compile/parseTarget.d.ts +25 -0
- package/dist/lib/compile/parseTarget.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +275 -32
- package/dist/lib/compile/path.d.ts +17 -7
- package/dist/lib/compile/path.d.ts.map +1 -1
- package/dist/lib/compile/text-metrics.d.ts +2 -2
- package/dist/lib/compile/text-metrics.d.ts.map +1 -1
- package/dist/lib/geometry/circle.cjs +79 -0
- package/dist/lib/geometry/circle.d.ts +32 -0
- package/dist/lib/geometry/circle.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +87 -0
- package/dist/lib/geometry/diamond.d.ts +44 -0
- package/dist/lib/geometry/diamond.d.ts.map +1 -0
- package/dist/lib/geometry/ellipse.cjs +86 -0
- package/dist/lib/geometry/ellipse.d.ts +38 -0
- package/dist/lib/geometry/ellipse.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +3 -0
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/index.cjs +16 -0
- package/dist/lib/index.d.ts +9 -7
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +100 -7
- package/dist/lib/ir/node.d.ts +319 -7
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.cjs +25 -0
- package/dist/lib/ir/path/arrow.d.ts +26 -0
- package/dist/lib/ir/path/arrow.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +1 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +10 -0
- package/dist/lib/ir/path/path.d.ts +60 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +18 -1
- package/dist/lib/ir/path/step.d.ts +56 -2
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/scene.d.ts +538 -16
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/parsers/parseWay.cjs +68 -5
- package/dist/lib/parsers/parseWay.d.ts +56 -10
- package/dist/lib/parsers/parseWay.d.ts.map +1 -1
- package/dist/lib/primitive/ellipse.d.ts +34 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -0
- package/dist/lib/primitive/index.d.ts +1 -0
- package/dist/lib/primitive/index.d.ts.map +1 -1
- package/dist/lib/primitive/path.d.ts +11 -0
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +2 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +2 -1
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +43 -13
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/lib/ir/node.d.ts
CHANGED
|
@@ -1,41 +1,353 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ValueOf } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* 节点形状常量。值是 IR 中 `shape` 字段的字面字符串;
|
|
5
|
+
* 用 const + ValueOf 派生(不用 TS enum)。
|
|
6
|
+
*
|
|
7
|
+
* - `rectangle`:矩形(默认;UML 类、流程图常规节点)
|
|
8
|
+
* - `circle`:圆形(流程图起止、状态机)
|
|
9
|
+
* - `ellipse`:椭圆(状态机、集合图)
|
|
10
|
+
* - `diamond`:菱形(流程图判定)
|
|
11
|
+
*
|
|
12
|
+
* 每个 shape 的几何语义:node 的视觉边界包住"text 矩形 + padding"——
|
|
13
|
+
* - rectangle: 视觉 rect = text rect
|
|
14
|
+
* - circle: 外接圆,r = √(innerHalfW² + innerHalfH²)
|
|
15
|
+
* - ellipse: 外接椭圆,rx = innerHalfW×√2、ry = innerHalfH×√2
|
|
16
|
+
* - diamond: 外接菱形,halfA = 2×innerHalfW、halfB = 2×innerHalfH
|
|
17
|
+
*/
|
|
18
|
+
export declare const NODE_SHAPES: {
|
|
19
|
+
readonly rectangle: "rectangle";
|
|
20
|
+
readonly circle: "circle";
|
|
21
|
+
readonly ellipse: "ellipse";
|
|
22
|
+
readonly diamond: "diamond";
|
|
23
|
+
};
|
|
24
|
+
/** 节点形状字面量类型,由 `NODE_SHAPES` 派生 */
|
|
25
|
+
export type NodeShape = ValueOf<typeof NODE_SHAPES>;
|
|
26
|
+
/**
|
|
27
|
+
* 节点字体规格——family / size / weight / style 全部可选;
|
|
28
|
+
* 单字段透传到 SVG `<text>` 的 `font-*` 属性 / `font-size`。
|
|
29
|
+
*
|
|
30
|
+
* 取代 alpha.1 的标量 `fontSize` 字段(已删)。
|
|
31
|
+
*/
|
|
32
|
+
export declare const FontSchema: z.ZodObject<{
|
|
33
|
+
family: z.ZodOptional<z.ZodString>;
|
|
34
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
|
|
36
|
+
style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
family?: string | undefined;
|
|
39
|
+
size?: number | undefined;
|
|
40
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
41
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
family?: string | undefined;
|
|
44
|
+
size?: number | undefined;
|
|
45
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
46
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
/** 节点字体规格(IR 层)——所有字段可选,编译期解析默认值 */
|
|
49
|
+
export type IRFont = z.infer<typeof FontSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* 单行文本规格——纯字符串走块级默认样式;对象形式可对该行覆盖 fill / opacity / font。
|
|
52
|
+
*
|
|
53
|
+
* 行级覆盖只生效于本行的 `<tspan>`:
|
|
54
|
+
* - `fill`:仅这一行颜色
|
|
55
|
+
* - `opacity`:仅这一行 0~1 透明度
|
|
56
|
+
* - `font`:family / size / weight / style 任意子集;未填字段继承块级 font
|
|
57
|
+
*
|
|
58
|
+
* 块级 `align` / `lineHeight` 不可被行覆盖(多行块整体属性)。
|
|
59
|
+
*/
|
|
60
|
+
export declare const LineSpecSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
61
|
+
text: z.ZodString;
|
|
62
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
63
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
family: z.ZodOptional<z.ZodString>;
|
|
66
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
|
|
68
|
+
style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
family?: string | undefined;
|
|
71
|
+
size?: number | undefined;
|
|
72
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
73
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
family?: string | undefined;
|
|
76
|
+
size?: number | undefined;
|
|
77
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
78
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
79
|
+
}>>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
text: string;
|
|
82
|
+
fill?: string | undefined;
|
|
83
|
+
opacity?: number | undefined;
|
|
84
|
+
font?: {
|
|
85
|
+
family?: string | undefined;
|
|
86
|
+
size?: number | undefined;
|
|
87
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
88
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
}, {
|
|
91
|
+
text: string;
|
|
92
|
+
fill?: string | undefined;
|
|
93
|
+
opacity?: number | undefined;
|
|
94
|
+
font?: {
|
|
95
|
+
family?: string | undefined;
|
|
96
|
+
size?: number | undefined;
|
|
97
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
98
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
99
|
+
} | undefined;
|
|
100
|
+
}>]>;
|
|
101
|
+
/** 行规格 IR 类型(string 或对象) */
|
|
102
|
+
export type IRLineSpec = z.infer<typeof LineSpecSchema>;
|
|
103
|
+
/**
|
|
104
|
+
* 节点文本——单行字符串或非空多行数组(每元素一个 LineSpec):
|
|
105
|
+
* - `'Hello'` 等价于 `[{ text: 'Hello' }]`,按一行渲染
|
|
106
|
+
* - `['Line 1', 'Line 2']` 两行无样式覆盖
|
|
107
|
+
* - `[{ text: 'Heading', fill: 'red', font: { weight: 'bold' } }, 'body']` 混排
|
|
108
|
+
*
|
|
109
|
+
* 选 `Array<LineSpec>` 而非 `'\n'` 字符串:JSON 友好(无 escape);行级覆盖天然落字段。
|
|
110
|
+
*/
|
|
111
|
+
export declare const NodeTextSchema: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
112
|
+
text: z.ZodString;
|
|
113
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
114
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
family: z.ZodOptional<z.ZodString>;
|
|
117
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
|
|
119
|
+
style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
family?: string | undefined;
|
|
122
|
+
size?: number | undefined;
|
|
123
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
124
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
125
|
+
}, {
|
|
126
|
+
family?: string | undefined;
|
|
127
|
+
size?: number | undefined;
|
|
128
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
129
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
130
|
+
}>>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
text: string;
|
|
133
|
+
fill?: string | undefined;
|
|
134
|
+
opacity?: number | undefined;
|
|
135
|
+
font?: {
|
|
136
|
+
family?: string | undefined;
|
|
137
|
+
size?: number | undefined;
|
|
138
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
139
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
140
|
+
} | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
text: string;
|
|
143
|
+
fill?: string | undefined;
|
|
144
|
+
opacity?: number | undefined;
|
|
145
|
+
font?: {
|
|
146
|
+
family?: string | undefined;
|
|
147
|
+
size?: number | undefined;
|
|
148
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
149
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
}>]>, "many">]>;
|
|
152
|
+
/** 节点文本对齐(多行内文本对齐)——TikZ `align=` 同义词 */
|
|
153
|
+
export declare const NODE_TEXT_ALIGNS: {
|
|
154
|
+
readonly left: "left";
|
|
155
|
+
readonly center: "center";
|
|
156
|
+
readonly right: "right";
|
|
157
|
+
};
|
|
158
|
+
/** 多行文本对齐字面量类型 */
|
|
159
|
+
export type NodeTextAlign = ValueOf<typeof NODE_TEXT_ALIGNS>;
|
|
2
160
|
export declare const NodeSchema: z.ZodObject<{
|
|
3
161
|
type: z.ZodLiteral<"node">;
|
|
4
162
|
id: z.ZodOptional<z.ZodString>;
|
|
163
|
+
shape: z.ZodOptional<z.ZodNativeEnum<{
|
|
164
|
+
readonly rectangle: "rectangle";
|
|
165
|
+
readonly circle: "circle";
|
|
166
|
+
readonly ellipse: "ellipse";
|
|
167
|
+
readonly diamond: "diamond";
|
|
168
|
+
}>>;
|
|
5
169
|
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
6
170
|
rotate: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
text: z.ZodOptional<z.ZodString
|
|
171
|
+
text: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
172
|
+
text: z.ZodString;
|
|
173
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
174
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
family: z.ZodOptional<z.ZodString>;
|
|
177
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
178
|
+
weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
|
|
179
|
+
style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
family?: string | undefined;
|
|
182
|
+
size?: number | undefined;
|
|
183
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
184
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
185
|
+
}, {
|
|
186
|
+
family?: string | undefined;
|
|
187
|
+
size?: number | undefined;
|
|
188
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
189
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
190
|
+
}>>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
text: string;
|
|
193
|
+
fill?: string | undefined;
|
|
194
|
+
opacity?: number | undefined;
|
|
195
|
+
font?: {
|
|
196
|
+
family?: string | undefined;
|
|
197
|
+
size?: number | undefined;
|
|
198
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
199
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
200
|
+
} | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
text: string;
|
|
203
|
+
fill?: string | undefined;
|
|
204
|
+
opacity?: number | undefined;
|
|
205
|
+
font?: {
|
|
206
|
+
family?: string | undefined;
|
|
207
|
+
size?: number | undefined;
|
|
208
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
209
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
210
|
+
} | undefined;
|
|
211
|
+
}>]>, "many">]>>;
|
|
212
|
+
align: z.ZodOptional<z.ZodNativeEnum<{
|
|
213
|
+
readonly left: "left";
|
|
214
|
+
readonly center: "center";
|
|
215
|
+
readonly right: "right";
|
|
216
|
+
}>>;
|
|
217
|
+
lineHeight: z.ZodOptional<z.ZodNumber>;
|
|
8
218
|
fill: z.ZodOptional<z.ZodString>;
|
|
219
|
+
fillOpacity: z.ZodOptional<z.ZodNumber>;
|
|
9
220
|
stroke: z.ZodOptional<z.ZodString>;
|
|
221
|
+
drawOpacity: z.ZodOptional<z.ZodNumber>;
|
|
10
222
|
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
223
|
+
dashed: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
dotted: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
+
dashArray: z.ZodOptional<z.ZodString>;
|
|
226
|
+
roundedCorners: z.ZodOptional<z.ZodNumber>;
|
|
227
|
+
minimumWidth: z.ZodOptional<z.ZodNumber>;
|
|
228
|
+
minimumHeight: z.ZodOptional<z.ZodNumber>;
|
|
229
|
+
minimumSize: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
scale: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
xScale: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
yScale: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
textColor: z.ZodOptional<z.ZodString>;
|
|
234
|
+
opacity: z.ZodOptional<z.ZodNumber>;
|
|
235
|
+
innerXSep: z.ZodOptional<z.ZodNumber>;
|
|
236
|
+
innerYSep: z.ZodOptional<z.ZodNumber>;
|
|
237
|
+
outerSep: z.ZodOptional<z.ZodNumber>;
|
|
11
238
|
padding: z.ZodOptional<z.ZodNumber>;
|
|
12
239
|
margin: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
|
|
240
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
241
|
+
family: z.ZodOptional<z.ZodString>;
|
|
242
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
weight: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["normal", "bold"]>, z.ZodNumber]>>;
|
|
244
|
+
style: z.ZodOptional<z.ZodEnum<["normal", "italic", "oblique"]>>;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
family?: string | undefined;
|
|
247
|
+
size?: number | undefined;
|
|
248
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
249
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
250
|
+
}, {
|
|
251
|
+
family?: string | undefined;
|
|
252
|
+
size?: number | undefined;
|
|
253
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
254
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
255
|
+
}>>;
|
|
14
256
|
}, "strip", z.ZodTypeAny, {
|
|
15
257
|
type: "node";
|
|
16
258
|
position: [number, number] | import('./position').PolarPosition;
|
|
17
259
|
fill?: string | undefined;
|
|
260
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
18
261
|
stroke?: string | undefined;
|
|
19
262
|
strokeWidth?: number | undefined;
|
|
263
|
+
text?: string | (string | {
|
|
264
|
+
text: string;
|
|
265
|
+
fill?: string | undefined;
|
|
266
|
+
opacity?: number | undefined;
|
|
267
|
+
font?: {
|
|
268
|
+
family?: string | undefined;
|
|
269
|
+
size?: number | undefined;
|
|
270
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
271
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
272
|
+
} | undefined;
|
|
273
|
+
})[] | undefined;
|
|
274
|
+
opacity?: number | undefined;
|
|
275
|
+
font?: {
|
|
276
|
+
family?: string | undefined;
|
|
277
|
+
size?: number | undefined;
|
|
278
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
279
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
280
|
+
} | undefined;
|
|
20
281
|
id?: string | undefined;
|
|
21
282
|
rotate?: number | undefined;
|
|
22
|
-
|
|
283
|
+
align?: "left" | "center" | "right" | undefined;
|
|
284
|
+
lineHeight?: number | undefined;
|
|
285
|
+
fillOpacity?: number | undefined;
|
|
286
|
+
drawOpacity?: number | undefined;
|
|
287
|
+
dashed?: boolean | undefined;
|
|
288
|
+
dotted?: boolean | undefined;
|
|
289
|
+
dashArray?: string | undefined;
|
|
290
|
+
roundedCorners?: number | undefined;
|
|
291
|
+
minimumWidth?: number | undefined;
|
|
292
|
+
minimumHeight?: number | undefined;
|
|
293
|
+
minimumSize?: number | undefined;
|
|
294
|
+
scale?: number | undefined;
|
|
295
|
+
xScale?: number | undefined;
|
|
296
|
+
yScale?: number | undefined;
|
|
297
|
+
textColor?: string | undefined;
|
|
298
|
+
innerXSep?: number | undefined;
|
|
299
|
+
innerYSep?: number | undefined;
|
|
300
|
+
outerSep?: number | undefined;
|
|
23
301
|
padding?: number | undefined;
|
|
24
302
|
margin?: number | undefined;
|
|
25
|
-
fontSize?: number | undefined;
|
|
26
303
|
}, {
|
|
27
304
|
type: "node";
|
|
28
305
|
position: [number, number] | import('./position').PolarPosition;
|
|
29
306
|
fill?: string | undefined;
|
|
307
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
30
308
|
stroke?: string | undefined;
|
|
31
309
|
strokeWidth?: number | undefined;
|
|
310
|
+
text?: string | (string | {
|
|
311
|
+
text: string;
|
|
312
|
+
fill?: string | undefined;
|
|
313
|
+
opacity?: number | undefined;
|
|
314
|
+
font?: {
|
|
315
|
+
family?: string | undefined;
|
|
316
|
+
size?: number | undefined;
|
|
317
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
318
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
319
|
+
} | undefined;
|
|
320
|
+
})[] | undefined;
|
|
321
|
+
opacity?: number | undefined;
|
|
322
|
+
font?: {
|
|
323
|
+
family?: string | undefined;
|
|
324
|
+
size?: number | undefined;
|
|
325
|
+
weight?: number | "normal" | "bold" | undefined;
|
|
326
|
+
style?: "normal" | "italic" | "oblique" | undefined;
|
|
327
|
+
} | undefined;
|
|
32
328
|
id?: string | undefined;
|
|
33
329
|
rotate?: number | undefined;
|
|
34
|
-
|
|
330
|
+
align?: "left" | "center" | "right" | undefined;
|
|
331
|
+
lineHeight?: number | undefined;
|
|
332
|
+
fillOpacity?: number | undefined;
|
|
333
|
+
drawOpacity?: number | undefined;
|
|
334
|
+
dashed?: boolean | undefined;
|
|
335
|
+
dotted?: boolean | undefined;
|
|
336
|
+
dashArray?: string | undefined;
|
|
337
|
+
roundedCorners?: number | undefined;
|
|
338
|
+
minimumWidth?: number | undefined;
|
|
339
|
+
minimumHeight?: number | undefined;
|
|
340
|
+
minimumSize?: number | undefined;
|
|
341
|
+
scale?: number | undefined;
|
|
342
|
+
xScale?: number | undefined;
|
|
343
|
+
yScale?: number | undefined;
|
|
344
|
+
textColor?: string | undefined;
|
|
345
|
+
innerXSep?: number | undefined;
|
|
346
|
+
innerYSep?: number | undefined;
|
|
347
|
+
outerSep?: number | undefined;
|
|
35
348
|
padding?: number | undefined;
|
|
36
349
|
margin?: number | undefined;
|
|
37
|
-
fontSize?: number | undefined;
|
|
38
350
|
}>;
|
|
39
|
-
/**
|
|
351
|
+
/** 节点:可定位的形状容器(矩形 / 圆 / 椭圆 / 菱形)+ 可选文本标签 */
|
|
40
352
|
export type IRNode = z.infer<typeof NodeSchema>;
|
|
41
353
|
//# sourceMappingURL=node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ir/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ir/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;EAwBpB,CAAC;AAEJ,oCAAoC;AACpC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEhD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBxB,CAAC;AAEJ,4BAA4B;AAC5B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAIxB,CAAC;AAEJ,yCAAyC;AACzC,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX,kBAAkB;AAClB,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyKpB,CAAC;AAEJ,4CAA4C;AAC5C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/ir/path/arrow.ts
|
|
2
|
+
/**
|
|
3
|
+
* 箭头形状常量。值就是 IR / Scene 中 arrow 字段的字面字符串;
|
|
4
|
+
* 用 const 而不是 TS enum——避免 enum 在数值场景生成 reverse-mapping、
|
|
5
|
+
* 在 string 场景与字面量类型不互通的两个坑。
|
|
6
|
+
*
|
|
7
|
+
* - `normal`:实心三角(默认;最常见)
|
|
8
|
+
* - `open`:空心三角(UML 泛化 / 继承)
|
|
9
|
+
* - `stealth`:尖锐倒钩三角(流图常见、视觉锐利)
|
|
10
|
+
* - `diamond`:实心菱形(UML 组合)
|
|
11
|
+
* - `openDiamond`:空心菱形(UML 聚合)
|
|
12
|
+
* - `circle`:实心圆点(连接点 / dot end)
|
|
13
|
+
* - `openCircle`:空心圆点(白圈 / o-end)
|
|
14
|
+
*/
|
|
15
|
+
var ARROW_SHAPES = {
|
|
16
|
+
normal: "normal",
|
|
17
|
+
open: "open",
|
|
18
|
+
stealth: "stealth",
|
|
19
|
+
diamond: "diamond",
|
|
20
|
+
openDiamond: "openDiamond",
|
|
21
|
+
circle: "circle",
|
|
22
|
+
openCircle: "openCircle"
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.ARROW_SHAPES = ARROW_SHAPES;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ValueOf } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* 箭头形状常量。值就是 IR / Scene 中 arrow 字段的字面字符串;
|
|
4
|
+
* 用 const 而不是 TS enum——避免 enum 在数值场景生成 reverse-mapping、
|
|
5
|
+
* 在 string 场景与字面量类型不互通的两个坑。
|
|
6
|
+
*
|
|
7
|
+
* - `normal`:实心三角(默认;最常见)
|
|
8
|
+
* - `open`:空心三角(UML 泛化 / 继承)
|
|
9
|
+
* - `stealth`:尖锐倒钩三角(流图常见、视觉锐利)
|
|
10
|
+
* - `diamond`:实心菱形(UML 组合)
|
|
11
|
+
* - `openDiamond`:空心菱形(UML 聚合)
|
|
12
|
+
* - `circle`:实心圆点(连接点 / dot end)
|
|
13
|
+
* - `openCircle`:空心圆点(白圈 / o-end)
|
|
14
|
+
*/
|
|
15
|
+
export declare const ARROW_SHAPES: {
|
|
16
|
+
readonly normal: "normal";
|
|
17
|
+
readonly open: "open";
|
|
18
|
+
readonly stealth: "stealth";
|
|
19
|
+
readonly diamond: "diamond";
|
|
20
|
+
readonly openDiamond: "openDiamond";
|
|
21
|
+
readonly circle: "circle";
|
|
22
|
+
readonly openCircle: "openCircle";
|
|
23
|
+
};
|
|
24
|
+
/** 箭头形状字面量类型,由 `ARROW_SHAPES` 派生 */
|
|
25
|
+
export type ArrowShape = ValueOf<typeof ARROW_SHAPES>;
|
|
26
|
+
//# sourceMappingURL=arrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/arrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY;;;;;;;;CAQf,CAAC;AAEX,oCAAoC;AACpC,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_arrow = require("./arrow.cjs");
|
|
1
2
|
const require_step = require("./step.cjs");
|
|
2
3
|
let zod = require("zod");
|
|
3
4
|
//#region src/ir/path/path.ts
|
|
@@ -6,6 +7,15 @@ var PathSchema = zod.z.object({
|
|
|
6
7
|
stroke: zod.z.string().optional().describe("Stroke color of the path; any CSS color. Defaults to currentColor when omitted"),
|
|
7
8
|
strokeWidth: zod.z.number().optional().describe("Stroke width in user units; defaults to 1 when omitted"),
|
|
8
9
|
strokeDasharray: zod.z.string().optional().describe("SVG stroke-dasharray pattern (e.g. \"4 2\"); leave empty for solid line"),
|
|
10
|
+
arrow: zod.z.enum([
|
|
11
|
+
"none",
|
|
12
|
+
"->",
|
|
13
|
+
"<-",
|
|
14
|
+
"<->"
|
|
15
|
+
]).optional().describe("Path-level arrow direction. omitted/`none` = no arrows; `->` = arrow at end; `<-` = at start; `<->` = both."),
|
|
16
|
+
arrowShape: zod.z.nativeEnum(require_arrow.ARROW_SHAPES).optional().describe("Arrow tip shape; default `normal` (filled triangle). Other values: `open` (hollow triangle), `stealth` (sharp barb), `diamond`, `circle`."),
|
|
17
|
+
fill: zod.z.string().optional().describe("Fill color of the closed region; any CSS color. Omitted = no fill (stroke only). Pairs with `cycle` step for filled shapes."),
|
|
18
|
+
fillRule: zod.z.enum(["nonzero", "evenodd"]).optional().describe("How self-intersecting / nested sub-paths are filled. `nonzero` (default, SVG default) winds-by-direction; `evenodd` toggles fill on each crossing — useful for ring / donut shapes."),
|
|
9
19
|
children: zod.z.array(require_step.StepSchema).min(2).describe("Sequence of step actions defining the path; the first should usually be a `move`")
|
|
10
20
|
}).describe("A drawn path composed of a sequence of step actions (move / line / ...)");
|
|
11
21
|
//#endregion
|
|
@@ -4,6 +4,18 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
4
4
|
stroke: z.ZodOptional<z.ZodString>;
|
|
5
5
|
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
6
6
|
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
7
|
+
arrow: z.ZodOptional<z.ZodEnum<["none", "->", "<-", "<->"]>>;
|
|
8
|
+
arrowShape: z.ZodOptional<z.ZodNativeEnum<{
|
|
9
|
+
readonly normal: "normal";
|
|
10
|
+
readonly open: "open";
|
|
11
|
+
readonly stealth: "stealth";
|
|
12
|
+
readonly diamond: "diamond";
|
|
13
|
+
readonly openDiamond: "openDiamond";
|
|
14
|
+
readonly circle: "circle";
|
|
15
|
+
readonly openCircle: "openCircle";
|
|
16
|
+
}>>;
|
|
17
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
18
|
+
fillRule: z.ZodOptional<z.ZodEnum<["nonzero", "evenodd"]>>;
|
|
7
19
|
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
8
20
|
type: z.ZodLiteral<"step">;
|
|
9
21
|
kind: z.ZodLiteral<"move">;
|
|
@@ -28,6 +40,30 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
28
40
|
type: "step";
|
|
29
41
|
kind: "line";
|
|
30
42
|
to: string | [number, number] | import('..').PolarPosition;
|
|
43
|
+
}>, z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"step">;
|
|
45
|
+
kind: z.ZodLiteral<"step">;
|
|
46
|
+
via: z.ZodEnum<["-|", "|-"]>;
|
|
47
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
type: "step";
|
|
50
|
+
kind: "step";
|
|
51
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
52
|
+
via: "-|" | "|-";
|
|
53
|
+
}, {
|
|
54
|
+
type: "step";
|
|
55
|
+
kind: "step";
|
|
56
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
57
|
+
via: "-|" | "|-";
|
|
58
|
+
}>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"step">;
|
|
60
|
+
kind: z.ZodLiteral<"cycle">;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
type: "step";
|
|
63
|
+
kind: "cycle";
|
|
64
|
+
}, {
|
|
65
|
+
type: "step";
|
|
66
|
+
kind: "cycle";
|
|
31
67
|
}>]>, "many">;
|
|
32
68
|
}, "strip", z.ZodTypeAny, {
|
|
33
69
|
type: "path";
|
|
@@ -39,10 +75,22 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
39
75
|
type: "step";
|
|
40
76
|
kind: "line";
|
|
41
77
|
to: string | [number, number] | import('..').PolarPosition;
|
|
78
|
+
} | {
|
|
79
|
+
type: "step";
|
|
80
|
+
kind: "step";
|
|
81
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
82
|
+
via: "-|" | "|-";
|
|
83
|
+
} | {
|
|
84
|
+
type: "step";
|
|
85
|
+
kind: "cycle";
|
|
42
86
|
})[];
|
|
87
|
+
fill?: string | undefined;
|
|
43
88
|
stroke?: string | undefined;
|
|
44
89
|
strokeWidth?: number | undefined;
|
|
45
90
|
strokeDasharray?: string | undefined;
|
|
91
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
92
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
93
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
46
94
|
}, {
|
|
47
95
|
type: "path";
|
|
48
96
|
children: ({
|
|
@@ -53,10 +101,22 @@ export declare const PathSchema: z.ZodObject<{
|
|
|
53
101
|
type: "step";
|
|
54
102
|
kind: "line";
|
|
55
103
|
to: string | [number, number] | import('..').PolarPosition;
|
|
104
|
+
} | {
|
|
105
|
+
type: "step";
|
|
106
|
+
kind: "step";
|
|
107
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
108
|
+
via: "-|" | "|-";
|
|
109
|
+
} | {
|
|
110
|
+
type: "step";
|
|
111
|
+
kind: "cycle";
|
|
56
112
|
})[];
|
|
113
|
+
fill?: string | undefined;
|
|
57
114
|
stroke?: string | undefined;
|
|
58
115
|
strokeWidth?: number | undefined;
|
|
59
116
|
strokeDasharray?: string | undefined;
|
|
117
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
118
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
119
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
60
120
|
}>;
|
|
61
121
|
/** 路径:由若干 step 动作(move / line / ...)组成的绘制路径 */
|
|
62
122
|
export type IRPath = z.infer<typeof PathSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsDpB,CAAC;AAEJ,+CAA+C;AAC/C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -11,8 +11,25 @@ var LineStepSchema = zod.z.object({
|
|
|
11
11
|
kind: zod.z.literal("line").describe("Draw a straight line from the current cursor to the target (like SVG path \"L\")"),
|
|
12
12
|
to: require_target.TargetSchema.describe("Destination point of the line segment")
|
|
13
13
|
}).describe("Line action: straight-line segment from cursor to target");
|
|
14
|
-
var
|
|
14
|
+
var FoldStepSchema = zod.z.object({
|
|
15
|
+
type: zod.z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
16
|
+
kind: zod.z.literal("step").describe("Folded right-angle segment from cursor to target through one intermediate point (TikZ `-|` / `|-`)"),
|
|
17
|
+
via: zod.z.enum(["-|", "|-"]).describe("Folding direction: `-|` first horizontal then vertical; `|-` first vertical then horizontal"),
|
|
18
|
+
to: require_target.TargetSchema.describe("Destination point of the folded segment")
|
|
19
|
+
}).describe("Fold action: TikZ-style right-angle fold with a single intermediate point chosen by `via`");
|
|
20
|
+
var CycleStepSchema = zod.z.object({
|
|
21
|
+
type: zod.z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
22
|
+
kind: zod.z.literal("cycle").describe("Close the path back to the most recent move target (TikZ `cycle` / SVG path \"Z\")")
|
|
23
|
+
}).describe("Cycle action: close the current sub-path back to its starting point; carries no `to` field");
|
|
24
|
+
var StepSchema = zod.z.discriminatedUnion("kind", [
|
|
25
|
+
MoveStepSchema,
|
|
26
|
+
LineStepSchema,
|
|
27
|
+
FoldStepSchema,
|
|
28
|
+
CycleStepSchema
|
|
29
|
+
]).describe("A single path action; the discriminator field is `kind`");
|
|
15
30
|
//#endregion
|
|
31
|
+
exports.CycleStepSchema = CycleStepSchema;
|
|
32
|
+
exports.FoldStepSchema = FoldStepSchema;
|
|
16
33
|
exports.LineStepSchema = LineStepSchema;
|
|
17
34
|
exports.MoveStepSchema = MoveStepSchema;
|
|
18
35
|
exports.StepSchema = StepSchema;
|
|
@@ -25,6 +25,32 @@ export declare const LineStepSchema: z.ZodObject<{
|
|
|
25
25
|
kind: "line";
|
|
26
26
|
to: string | [number, number] | import('..').PolarPosition;
|
|
27
27
|
}>;
|
|
28
|
+
export declare const FoldStepSchema: z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"step">;
|
|
30
|
+
kind: z.ZodLiteral<"step">;
|
|
31
|
+
via: z.ZodEnum<["-|", "|-"]>;
|
|
32
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
type: "step";
|
|
35
|
+
kind: "step";
|
|
36
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
37
|
+
via: "-|" | "|-";
|
|
38
|
+
}, {
|
|
39
|
+
type: "step";
|
|
40
|
+
kind: "step";
|
|
41
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
42
|
+
via: "-|" | "|-";
|
|
43
|
+
}>;
|
|
44
|
+
export declare const CycleStepSchema: z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"step">;
|
|
46
|
+
kind: z.ZodLiteral<"cycle">;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
type: "step";
|
|
49
|
+
kind: "cycle";
|
|
50
|
+
}, {
|
|
51
|
+
type: "step";
|
|
52
|
+
kind: "cycle";
|
|
53
|
+
}>;
|
|
28
54
|
export declare const StepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
29
55
|
type: z.ZodLiteral<"step">;
|
|
30
56
|
kind: z.ZodLiteral<"move">;
|
|
@@ -49,14 +75,42 @@ export declare const StepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
|
49
75
|
type: "step";
|
|
50
76
|
kind: "line";
|
|
51
77
|
to: string | [number, number] | import('..').PolarPosition;
|
|
78
|
+
}>, z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"step">;
|
|
80
|
+
kind: z.ZodLiteral<"step">;
|
|
81
|
+
via: z.ZodEnum<["-|", "|-"]>;
|
|
82
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
type: "step";
|
|
85
|
+
kind: "step";
|
|
86
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
87
|
+
via: "-|" | "|-";
|
|
88
|
+
}, {
|
|
89
|
+
type: "step";
|
|
90
|
+
kind: "step";
|
|
91
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
92
|
+
via: "-|" | "|-";
|
|
93
|
+
}>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"step">;
|
|
95
|
+
kind: z.ZodLiteral<"cycle">;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
type: "step";
|
|
98
|
+
kind: "cycle";
|
|
99
|
+
}, {
|
|
100
|
+
type: "step";
|
|
101
|
+
kind: "cycle";
|
|
52
102
|
}>]>;
|
|
53
103
|
/** Move step:移动游标但不绘制 */
|
|
54
104
|
export type IRMoveStep = z.infer<typeof MoveStepSchema>;
|
|
55
105
|
/** Line step:从游标到目标画直线 */
|
|
56
106
|
export type IRLineStep = z.infer<typeof LineStepSchema>;
|
|
107
|
+
/** Fold step:折角段,从游标到目标经一个直角中间点(TikZ `-|` / `|-`) */
|
|
108
|
+
export type IRFoldStep = z.infer<typeof FoldStepSchema>;
|
|
109
|
+
/** Cycle step:把当前子路径闭合回起点(TikZ `cycle` / SVG `Z`) */
|
|
110
|
+
export type IRCycleStep = z.infer<typeof CycleStepSchema>;
|
|
57
111
|
/**
|
|
58
|
-
* 路径上的一个动作。v0.1.0-alpha
|
|
59
|
-
* 后续会加 '
|
|
112
|
+
* 路径上的一个动作。v0.1.0-alpha.1 支持 'move' / 'line' / 'step'(折角)/ 'cycle'(闭合)。
|
|
113
|
+
* 后续会加 'curve'、'cubic'、'rel' 等。
|
|
60
114
|
*/
|
|
61
115
|
export type IRStep = z.infer<typeof StepSchema>;
|
|
62
116
|
//# sourceMappingURL=step.d.ts.map
|