@retikz/core 0.2.0-alpha.1 → 0.2.0-alpha.3
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 +8 -1
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +21 -6
- package/dist/es/compile/node.d.ts +15 -10
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +44 -181
- package/dist/es/compile/path/index.js +1 -1
- package/dist/es/compile/path/label.d.ts +1 -1
- package/dist/es/compile/path/label.d.ts.map +1 -1
- package/dist/es/compile/path/label.js +17 -4
- package/dist/es/compile/scope.d.ts.map +1 -1
- package/dist/es/compile/scope.js +3 -1
- package/dist/es/compile/style.d.ts +46 -0
- package/dist/es/compile/style.d.ts.map +1 -0
- package/dist/es/compile/style.js +259 -0
- package/dist/es/index.d.ts +4 -2
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +5 -3
- package/dist/es/ir/node.d.ts +19 -12
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +2 -1
- package/dist/es/ir/path/path.d.ts +531 -0
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +1 -0
- package/dist/es/ir/path/step.d.ts +834 -0
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +5 -1
- package/dist/es/ir/scope.d.ts +3493 -3
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +64 -4
- package/dist/es/shapes/_shared.d.ts +7 -0
- package/dist/es/shapes/_shared.d.ts.map +1 -0
- package/dist/es/shapes/_shared.js +11 -0
- package/dist/es/shapes/circle.d.ts +8 -0
- package/dist/es/shapes/circle.d.ts.map +1 -0
- package/dist/es/shapes/circle.js +33 -0
- package/dist/es/shapes/diamond.d.ts +8 -0
- package/dist/es/shapes/diamond.d.ts.map +1 -0
- package/dist/es/shapes/diamond.js +65 -0
- package/dist/es/shapes/ellipse.d.ts +8 -0
- package/dist/es/shapes/ellipse.d.ts.map +1 -0
- package/dist/es/shapes/ellipse.js +45 -0
- package/dist/es/shapes/index.d.ts +14 -0
- package/dist/es/shapes/index.d.ts.map +1 -0
- package/dist/es/shapes/index.js +15 -0
- package/dist/es/shapes/rectangle.d.ts +8 -0
- package/dist/es/shapes/rectangle.d.ts.map +1 -0
- package/dist/es/shapes/rectangle.js +40 -0
- package/dist/es/shapes/types.d.ts +44 -0
- package/dist/es/shapes/types.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +23 -8
- package/dist/lib/compile/compile.d.ts +8 -1
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +44 -181
- package/dist/lib/compile/node.d.ts +15 -10
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +1 -1
- package/dist/lib/compile/path/label.cjs +17 -4
- package/dist/lib/compile/path/label.d.ts +1 -1
- package/dist/lib/compile/path/label.d.ts.map +1 -1
- package/dist/lib/compile/scope.cjs +3 -1
- package/dist/lib/compile/scope.d.ts.map +1 -1
- package/dist/lib/compile/style.cjs +262 -0
- package/dist/lib/compile/style.d.ts +46 -0
- package/dist/lib/compile/style.d.ts.map +1 -0
- package/dist/lib/index.cjs +10 -1
- package/dist/lib/index.d.ts +4 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +2 -1
- package/dist/lib/ir/node.d.ts +19 -12
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +1 -0
- package/dist/lib/ir/path/path.d.ts +531 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +5 -1
- package/dist/lib/ir/path/step.d.ts +834 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +67 -3
- package/dist/lib/ir/scope.d.ts +3493 -3
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/shapes/_shared.cjs +11 -0
- package/dist/lib/shapes/_shared.d.ts +7 -0
- package/dist/lib/shapes/_shared.d.ts.map +1 -0
- package/dist/lib/shapes/circle.cjs +33 -0
- package/dist/lib/shapes/circle.d.ts +8 -0
- package/dist/lib/shapes/circle.d.ts.map +1 -0
- package/dist/lib/shapes/diamond.cjs +65 -0
- package/dist/lib/shapes/diamond.d.ts +8 -0
- package/dist/lib/shapes/diamond.d.ts.map +1 -0
- package/dist/lib/shapes/ellipse.cjs +45 -0
- package/dist/lib/shapes/ellipse.d.ts +8 -0
- package/dist/lib/shapes/ellipse.d.ts.map +1 -0
- package/dist/lib/shapes/index.cjs +14 -0
- package/dist/lib/shapes/index.d.ts +14 -0
- package/dist/lib/shapes/index.d.ts.map +1 -0
- package/dist/lib/shapes/rectangle.cjs +40 -0
- package/dist/lib/shapes/rectangle.d.ts +8 -0
- package/dist/lib/shapes/rectangle.d.ts.map +1 -0
- package/dist/lib/shapes/types.d.ts +44 -0
- package/dist/lib/shapes/types.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
//#region src/compile/style.ts
|
|
2
|
+
/** 拷贝源对象中 `!== undefined` 的字段(per-field 合并按存在性,不按真假值) */
|
|
3
|
+
var pickDefinedKeys = (src) => {
|
|
4
|
+
const out = {};
|
|
5
|
+
for (const key of Object.keys(src)) {
|
|
6
|
+
const value = src[key];
|
|
7
|
+
if (value !== void 0) out[key] = value;
|
|
8
|
+
}
|
|
9
|
+
return out;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 从 IRScope 抽取样式 frame
|
|
13
|
+
* @description 只摘样式相关字段(级联 graphic state + 四通道 + resetStyle);transforms / id / localNamespace 与样式正交,不进 frame
|
|
14
|
+
*/
|
|
15
|
+
var buildStyleFrame = (scope) => {
|
|
16
|
+
const cascade = {};
|
|
17
|
+
if (scope.color !== void 0) cascade.color = scope.color;
|
|
18
|
+
if (scope.stroke !== void 0) cascade.stroke = scope.stroke;
|
|
19
|
+
if (scope.fill !== void 0) cascade.fill = scope.fill;
|
|
20
|
+
if (scope.strokeWidth !== void 0) cascade.strokeWidth = scope.strokeWidth;
|
|
21
|
+
if (scope.opacity !== void 0) cascade.opacity = scope.opacity;
|
|
22
|
+
if (scope.fillOpacity !== void 0) cascade.fillOpacity = scope.fillOpacity;
|
|
23
|
+
if (scope.drawOpacity !== void 0) cascade.drawOpacity = scope.drawOpacity;
|
|
24
|
+
const frame = { cascade };
|
|
25
|
+
if (scope.nodeDefault) frame.nodeDefault = scope.nodeDefault;
|
|
26
|
+
if (scope.pathDefault) frame.pathDefault = scope.pathDefault;
|
|
27
|
+
if (scope.labelDefault) frame.labelDefault = scope.labelDefault;
|
|
28
|
+
if (scope.arrowDefault) frame.arrowDefault = scope.arrowDefault;
|
|
29
|
+
if (scope.resetStyle !== void 0) frame.resetStyle = scope.resetStyle;
|
|
30
|
+
return frame;
|
|
31
|
+
};
|
|
32
|
+
/** resetStyle 是否切某通道 */
|
|
33
|
+
var cuts = (reset, channel) => {
|
|
34
|
+
if (reset === void 0 || reset === false) return false;
|
|
35
|
+
if (reset === true) return true;
|
|
36
|
+
return reset.includes(channel);
|
|
37
|
+
};
|
|
38
|
+
/** 级联 graphic state 投影到 node 样式字段(主色展开:stroke / fill / textColor 默认随 color) */
|
|
39
|
+
var cascadeToNode = (c) => {
|
|
40
|
+
const out = {};
|
|
41
|
+
const master = c.color;
|
|
42
|
+
const stroke = c.stroke ?? master;
|
|
43
|
+
if (stroke !== void 0) out.stroke = stroke;
|
|
44
|
+
const fill = c.fill ?? master;
|
|
45
|
+
if (fill !== void 0) out.fill = fill;
|
|
46
|
+
if (master !== void 0) out.textColor = master;
|
|
47
|
+
if (c.strokeWidth !== void 0) out.strokeWidth = c.strokeWidth;
|
|
48
|
+
if (c.opacity !== void 0) out.opacity = c.opacity;
|
|
49
|
+
if (c.fillOpacity !== void 0) out.fillOpacity = c.fillOpacity;
|
|
50
|
+
if (c.drawOpacity !== void 0) out.drawOpacity = c.drawOpacity;
|
|
51
|
+
return out;
|
|
52
|
+
};
|
|
53
|
+
/** 级联 graphic state 投影到 path 样式字段(主色展开 stroke;path fill 不随主色——与 TikZ 一致) */
|
|
54
|
+
var cascadeToPath = (c) => {
|
|
55
|
+
const out = {};
|
|
56
|
+
const stroke = c.stroke ?? c.color;
|
|
57
|
+
if (stroke !== void 0) out.stroke = stroke;
|
|
58
|
+
if (c.fill !== void 0) out.fill = c.fill;
|
|
59
|
+
if (c.strokeWidth !== void 0) out.strokeWidth = c.strokeWidth;
|
|
60
|
+
if (c.opacity !== void 0) out.opacity = c.opacity;
|
|
61
|
+
if (c.fillOpacity !== void 0) out.fillOpacity = c.fillOpacity;
|
|
62
|
+
if (c.drawOpacity !== void 0) out.drawOpacity = c.drawOpacity;
|
|
63
|
+
return out;
|
|
64
|
+
};
|
|
65
|
+
/** node 源同源主色展开:未显式给的 stroke / fill / textColor 取该源 color */
|
|
66
|
+
var expandNodeColor = (src) => {
|
|
67
|
+
const out = { ...src };
|
|
68
|
+
const master = src.color;
|
|
69
|
+
if (master !== void 0) {
|
|
70
|
+
if (out.stroke === void 0) out.stroke = master;
|
|
71
|
+
if (out.fill === void 0) out.fill = master;
|
|
72
|
+
if (out.textColor === void 0) out.textColor = master;
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
};
|
|
76
|
+
/** path 源同源主色展开:未显式给的 stroke 取该源 color(fill 不随主色) */
|
|
77
|
+
var expandPathColor = (src) => {
|
|
78
|
+
const out = { ...src };
|
|
79
|
+
if (src.color !== void 0 && out.stroke === void 0) out.stroke = src.color;
|
|
80
|
+
return out;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 解析 node 最终样式——fold 外→内 frame 栈 + 元素显式
|
|
84
|
+
* @description 优先级链(每分项就近 model A):元素显式分项 > 元素 color > nodeDefault 分项 > nodeDefault color
|
|
85
|
+
* > scope 级联分项 > scope color > 内置(layoutNode 兜底)。同 frame 内 nodeDefault 优先于级联。
|
|
86
|
+
* resetStyle('node') 丢外层累积;position / id / text / label 取元素自身(不参与继承)。
|
|
87
|
+
*/
|
|
88
|
+
var resolveNodeStyle = (node, stack) => {
|
|
89
|
+
let acc = {};
|
|
90
|
+
for (const frame of stack) {
|
|
91
|
+
if (cuts(frame.resetStyle, "node")) acc = {};
|
|
92
|
+
acc = {
|
|
93
|
+
...acc,
|
|
94
|
+
...pickDefinedKeys(cascadeToNode(frame.cascade))
|
|
95
|
+
};
|
|
96
|
+
if (frame.nodeDefault) acc = {
|
|
97
|
+
...acc,
|
|
98
|
+
...pickDefinedKeys(expandNodeColor(frame.nodeDefault))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
acc = {
|
|
102
|
+
...acc,
|
|
103
|
+
...pickDefinedKeys(expandNodeColor(node))
|
|
104
|
+
};
|
|
105
|
+
return acc;
|
|
106
|
+
};
|
|
107
|
+
/** fold labelDefault 通道(node label + step label 共享);resetStyle('label') 丢外层 */
|
|
108
|
+
var resolveLabelDefault = (stack) => {
|
|
109
|
+
let acc = {};
|
|
110
|
+
for (const frame of stack) {
|
|
111
|
+
if (cuts(frame.resetStyle, "label")) acc = {};
|
|
112
|
+
if (frame.labelDefault) acc = {
|
|
113
|
+
...acc,
|
|
114
|
+
...pickDefinedKeys(frame.labelDefault)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return acc;
|
|
118
|
+
};
|
|
119
|
+
/** 逐字段合并字体(a 优先,缺字段回退 b);都空返回 undefined */
|
|
120
|
+
var mergeFont = (a, b) => {
|
|
121
|
+
if (a === void 0) return b;
|
|
122
|
+
if (b === void 0) return a;
|
|
123
|
+
const out = {};
|
|
124
|
+
const family = a.family ?? b.family;
|
|
125
|
+
if (family !== void 0) out.family = family;
|
|
126
|
+
const size = a.size ?? b.size;
|
|
127
|
+
if (size !== void 0) out.size = size;
|
|
128
|
+
const weight = a.weight ?? b.weight;
|
|
129
|
+
if (weight !== void 0) out.weight = weight;
|
|
130
|
+
const style = a.style ?? b.style;
|
|
131
|
+
if (style !== void 0) out.style = style;
|
|
132
|
+
return out;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* 解析 step label 最终样式——消费 scope labelDefault + 宿主 path 已解析主色
|
|
136
|
+
* @description 继承顺序:label 显式 > scope.labelDefault (textColor → color) > 宿主 path 主色 > currentColor(emit 兜底)。
|
|
137
|
+
* 跟随的是宿主 path 主色(不是 stroke);font 逐字段回退 labelDefault;opacity 与 path opacity 相乘在 emit 阶段。
|
|
138
|
+
* masterColor 是 host 轴(结构关系),不受 resetStyle('label') 影响——label 仍跟所属线,不成孤岛。
|
|
139
|
+
*/
|
|
140
|
+
var resolveStepLabel = (label, labelDefault, masterColor) => {
|
|
141
|
+
const out = { ...label };
|
|
142
|
+
const textColor = label.textColor ?? labelDefault.textColor ?? labelDefault.color ?? masterColor;
|
|
143
|
+
if (textColor !== void 0) out.textColor = textColor;
|
|
144
|
+
else delete out.textColor;
|
|
145
|
+
const font = mergeFont(label.font, labelDefault.font);
|
|
146
|
+
if (font !== void 0) out.font = font;
|
|
147
|
+
const opacity = label.opacity ?? labelDefault.opacity;
|
|
148
|
+
if (opacity !== void 0) out.opacity = opacity;
|
|
149
|
+
return out;
|
|
150
|
+
};
|
|
151
|
+
/** per-field 合并 arrow 端点 spec(b 覆盖 a 的 defined 字段;返回新对象,不共享引用) */
|
|
152
|
+
var mergeArrowEnd = (a, b) => {
|
|
153
|
+
if (a === void 0) return b === void 0 ? void 0 : { ...b };
|
|
154
|
+
if (b === void 0) return { ...a };
|
|
155
|
+
return {
|
|
156
|
+
...a,
|
|
157
|
+
...pickDefinedKeys(b)
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
/** per-field 合并 arrow detail:顶层 + start / end 各自 nested per-field merge(返回新对象,不共享引用) */
|
|
161
|
+
var mergeArrowDetail = (a, b) => {
|
|
162
|
+
const { start: aStart, end: aEnd, ...aTop } = a;
|
|
163
|
+
const { start: bStart, end: bEnd, ...bTop } = b;
|
|
164
|
+
const out = {
|
|
165
|
+
...aTop,
|
|
166
|
+
...pickDefinedKeys(bTop)
|
|
167
|
+
};
|
|
168
|
+
const start = mergeArrowEnd(aStart, bStart);
|
|
169
|
+
if (start !== void 0) out.start = start;
|
|
170
|
+
const end = mergeArrowEnd(aEnd, bEnd);
|
|
171
|
+
if (end !== void 0) out.end = end;
|
|
172
|
+
return out;
|
|
173
|
+
};
|
|
174
|
+
/** 去掉端点 spec 的 color(让端点 color 回退到顶层主色);返回新对象 */
|
|
175
|
+
var dropArrowEndColor = (end) => {
|
|
176
|
+
const next = { ...end };
|
|
177
|
+
delete next.color;
|
|
178
|
+
return next;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* 解析 arrow detail——fold arrowDefault 通道 + 跟宿主 path 主色 + 元素 arrowDetail
|
|
182
|
+
* @description color 优先级(顶层与 start / end 端点同理):元素显式 arrowDetail(含 start / end.color)> 宿主 path 已解析主色 > arrowDefault(含 start / end.color)> 内置。
|
|
183
|
+
* 宿主主色(host 轴,决策 13)会清掉 arrowDefault 带来的端点 color,让 start / end 回退到顶层主色;元素自身 arrowDetail(含 start / end.color)仍最高。
|
|
184
|
+
* masterColor 不受 resetStyle('arrow') 影响(host 轴非 scope 继承)。lineWidth / fill 的主色映射推迟(render 端仍按现有兜底继承 path stroke)。
|
|
185
|
+
*/
|
|
186
|
+
var resolveArrowDetail = (explicit, stack, masterColor) => {
|
|
187
|
+
let acc = {};
|
|
188
|
+
let touched = false;
|
|
189
|
+
for (const frame of stack) {
|
|
190
|
+
if (cuts(frame.resetStyle, "arrow")) {
|
|
191
|
+
acc = {};
|
|
192
|
+
touched = false;
|
|
193
|
+
}
|
|
194
|
+
if (frame.arrowDefault) {
|
|
195
|
+
acc = mergeArrowDetail(acc, frame.arrowDefault);
|
|
196
|
+
touched = true;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (masterColor !== void 0) {
|
|
200
|
+
acc.color = masterColor;
|
|
201
|
+
if (acc.start !== void 0) acc.start = dropArrowEndColor(acc.start);
|
|
202
|
+
if (acc.end !== void 0) acc.end = dropArrowEndColor(acc.end);
|
|
203
|
+
touched = true;
|
|
204
|
+
}
|
|
205
|
+
if (explicit) {
|
|
206
|
+
acc = mergeArrowDetail(acc, explicit);
|
|
207
|
+
touched = true;
|
|
208
|
+
}
|
|
209
|
+
return touched ? acc : void 0;
|
|
210
|
+
};
|
|
211
|
+
/** 替换 path children 中各 step 的 label 为已解析 effective label */
|
|
212
|
+
var resolveStepLabels = (children, labelDefault, masterColor) => children.map((step) => {
|
|
213
|
+
if ("label" in step && step.label !== void 0) return {
|
|
214
|
+
...step,
|
|
215
|
+
label: resolveStepLabel(step.label, labelDefault, masterColor)
|
|
216
|
+
};
|
|
217
|
+
return step;
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* 解析 path 最终样式——fold frame 栈 + 元素显式 + arrow / step-label 跟宿主主色
|
|
221
|
+
* @description 返回 effective IRPath:base 样式 fold(优先级链同 node);arrowDetail 消费 arrowDefault 通道 + 跟主色;
|
|
222
|
+
* 每个 step.label 消费 labelDefault 通道 + 跟主色。masterColor = path 已解析主色(就近 color),arrow / step-label 跟它(不跟 stroke)。
|
|
223
|
+
*/
|
|
224
|
+
var resolveEffectivePath = (path, stack) => {
|
|
225
|
+
let acc = {};
|
|
226
|
+
let masterColor;
|
|
227
|
+
for (const frame of stack) {
|
|
228
|
+
if (cuts(frame.resetStyle, "path")) {
|
|
229
|
+
acc = {};
|
|
230
|
+
masterColor = void 0;
|
|
231
|
+
}
|
|
232
|
+
if (frame.cascade.color !== void 0) masterColor = frame.cascade.color;
|
|
233
|
+
acc = {
|
|
234
|
+
...acc,
|
|
235
|
+
...pickDefinedKeys(cascadeToPath(frame.cascade))
|
|
236
|
+
};
|
|
237
|
+
if (frame.pathDefault) {
|
|
238
|
+
if (frame.pathDefault.color !== void 0) masterColor = frame.pathDefault.color;
|
|
239
|
+
acc = {
|
|
240
|
+
...acc,
|
|
241
|
+
...pickDefinedKeys(expandPathColor(frame.pathDefault))
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (path.color !== void 0) masterColor = path.color;
|
|
246
|
+
acc = {
|
|
247
|
+
...acc,
|
|
248
|
+
...pickDefinedKeys(expandPathColor(path))
|
|
249
|
+
};
|
|
250
|
+
const effective = acc;
|
|
251
|
+
const arrowDetail = resolveArrowDetail(path.arrowDetail, stack, masterColor);
|
|
252
|
+
if (arrowDetail !== void 0) effective.arrowDetail = arrowDetail;
|
|
253
|
+
else delete effective.arrowDetail;
|
|
254
|
+
const labelDefault = resolveLabelDefault(stack);
|
|
255
|
+
effective.children = resolveStepLabels(path.children, labelDefault, masterColor);
|
|
256
|
+
return effective;
|
|
257
|
+
};
|
|
258
|
+
//#endregion
|
|
259
|
+
export { buildStyleFrame, resolveEffectivePath, resolveLabelDefault, resolveNodeStyle };
|
package/dist/es/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @retikz/core 公开 API
|
|
3
3
|
* @description 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)只能 import 本文件导出内容,不准走子路径。本包零 React/零 DOM 依赖
|
|
4
4
|
*/
|
|
5
|
-
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
6
|
-
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, NodeTextAlign, } from './ir';
|
|
5
|
+
export { PositionSchema, PolarPositionSchema, AtPositionSchema, OffsetPositionSchema, AT_DIRECTIONS, TargetSchema, RelativeTargetSchema, RelativeAccumulateTargetSchema, MoveStepSchema, LineStepSchema, FoldStepSchema, CycleStepSchema, CurveStepSchema, CubicStepSchema, BendStepSchema, ArcStepSchema, CirclePathStepSchema, EllipsePathStepSchema, ControlPointSchema, StepLabelSchema, StepSchema, NodeSchema, NodeLabelSchema, CoordinateSchema, FontSchema, TextBlockSchema, LineSpecSchema, PathSchema, ArrowDetailSchema, ArrowEndDetailSchema, ScopeSchema, NodeDefaultSchema, PathDefaultSchema, LabelDefaultSchema, ArrowDefaultSchema, TransformSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
6
|
+
export type { IRPosition, IRAtPosition, IROffsetPosition, AtDirection, IRTarget, IRRelativeTarget, IRRelativeAccumulateTarget, IRMoveStep, IRLineStep, IRFoldStep, IRCycleStep, IRCurveStep, IRCubicStep, IRBendStep, IRArcStep, IRCirclePathStep, IREllipsePathStep, IRControlPoint, IRStepLabel, IRStep, IRNode, IRNodeLabel, IRCoordinate, IRFont, IRLineSpec, IRTextBlock, IRPath, IRScope, IRNodeDefault, IRPathDefault, IRLabelDefault, IRArrowDefault, StyleChannel, IRTransform, IRTranslateTransform, IRPolarTranslateTransform, IRAtTranslateTransform, IROffsetTranslateTransform, IRRotateTransform, IRScaleTransform, IRChild, IR, ArrowShape, IRArrowDetail, IRArrowEndDetail, NodeShape, BuiltinShapeName, NodeTextAlign, } from './ir';
|
|
7
7
|
export { ARROW_SHAPES, DEFAULT_ARROW_SHAPE, HOLLOW_ARROW_SHAPES, ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, NODE_SHAPES, NODE_TEXT_ALIGNS, } from './ir';
|
|
8
8
|
export type { ScenePrimitive, RectPrim, EllipsePrim, TextPrim, TextLine, PathPrim, PathCommand,
|
|
9
9
|
/** 7 个 named PathCommand 分支(便于 wrapper / Pick<>) */
|
|
@@ -16,5 +16,7 @@ export type { WayItem, WayDSL, WayCycle, WayVia, WayRelativeItem, WayLabel, WayL
|
|
|
16
16
|
export { parseWay, DrawWay, parseTargetSugar } from './parsers';
|
|
17
17
|
export type { Position, Rect, RectAnchor, Circle, Ellipse, Diamond, PolarPosition, } from './geometry';
|
|
18
18
|
export { point, rect, circle, ellipse, diamond, RECT_ANCHORS, polar } from './geometry';
|
|
19
|
+
export type { ShapeDefinition, ShapeStyle } from './shapes';
|
|
20
|
+
export { BUILTIN_SHAPES, worldToLocal, localToWorld } from './shapes';
|
|
19
21
|
export type { ValueOf, AssertEqual } from './types';
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/es/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,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,CAAC;AAGrB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG5E,YAAY,EACV,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,eAAe,EACf,QAAQ,EACR,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAIhE,YAAY,EACV,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,MAAM,EACN,OAAO,EACP,OAAO,EACP,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxF,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,8BAA8B,EAC9B,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,WAAW,EACX,WAAW,E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,cAAc,EAAE,MAAM,WAAW,CAAC;AAG5E,YAAY,EACV,OAAO,EACP,MAAM,EACN,QAAQ,EACR,MAAM,EACN,eAAe,EACf,QAAQ,EACR,UAAU,GACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAIhE,YAAY,EACV,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,MAAM,EACN,OAAO,EACP,OAAO,EACP,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxF,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGtE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/es/index.js
CHANGED
|
@@ -11,12 +11,14 @@ import { PathSchema } from "./ir/path/path.js";
|
|
|
11
11
|
import { NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema } from "./ir/node.js";
|
|
12
12
|
import { CoordinateSchema } from "./ir/coordinate.js";
|
|
13
13
|
import { TransformSchema } from "./ir/transform.js";
|
|
14
|
-
import { ScopeSchema } from "./ir/scope.js";
|
|
14
|
+
import { ArrowDefaultSchema, LabelDefaultSchema, NodeDefaultSchema, PathDefaultSchema, ScopeSchema } from "./ir/scope.js";
|
|
15
15
|
import { CURRENT_IR_VERSION, ChildSchema, SceneSchema } from "./ir/scene.js";
|
|
16
|
+
import { localToWorld, worldToLocal } from "./geometry/_transform.js";
|
|
16
17
|
import { RECT_ANCHORS, rect } from "./geometry/rect.js";
|
|
17
18
|
import { circle } from "./geometry/circle.js";
|
|
18
|
-
import { diamond } from "./geometry/diamond.js";
|
|
19
19
|
import { ellipse } from "./geometry/ellipse.js";
|
|
20
|
+
import { diamond } from "./geometry/diamond.js";
|
|
21
|
+
import { BUILTIN_SHAPES } from "./shapes/index.js";
|
|
20
22
|
import { fallbackMeasurer } from "./compile/text-metrics.js";
|
|
21
23
|
import { computeLayout } from "./compile/layout.js";
|
|
22
24
|
import { compileToScene } from "./compile/compile.js";
|
|
@@ -24,4 +26,4 @@ import { parseTargetSugar } from "./parsers/parseTargetSugar.js";
|
|
|
24
26
|
import { DrawWay, parseWay } from "./parsers/parseWay.js";
|
|
25
27
|
import { polar } from "./geometry/polar.js";
|
|
26
28
|
import { point } from "./geometry/point.js";
|
|
27
|
-
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, HOLLOW_ARROW_SHAPES, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeLabelSchema, NodeSchema, OffsetPositionSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, circle, compileToScene, computeLayout, diamond, ellipse, fallbackMeasurer, parseTargetSugar, parseWay, point, polar, rect };
|
|
29
|
+
export { ARROW_MARKER_DEFAULT_SIZE, ARROW_MARKER_HOLLOW_DEFAULT_LINE_WIDTH, ARROW_SHAPES, AT_DIRECTIONS, ArcStepSchema, ArrowDefaultSchema, ArrowDetailSchema, ArrowEndDetailSchema, AtPositionSchema, BUILTIN_SHAPES, BendStepSchema, CURRENT_IR_VERSION, ChildSchema, CirclePathStepSchema, ControlPointSchema, CoordinateSchema, CubicStepSchema, CurveStepSchema, CycleStepSchema, DEFAULT_ARROW_SHAPE, DrawWay, EllipsePathStepSchema, FoldStepSchema, FontSchema, HOLLOW_ARROW_SHAPES, LabelDefaultSchema, LineSpecSchema, LineStepSchema, MoveStepSchema, NODE_SHAPES, NODE_TEXT_ALIGNS, NodeDefaultSchema, NodeLabelSchema, NodeSchema, OffsetPositionSchema, PathDefaultSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, RelativeAccumulateTargetSchema, RelativeTargetSchema, SceneSchema, ScopeSchema, StepLabelSchema, StepSchema, TargetSchema, TextBlockSchema, TransformSchema, circle, compileToScene, computeLayout, diamond, ellipse, fallbackMeasurer, localToWorld, parseTargetSugar, parseWay, point, polar, rect, worldToLocal };
|
package/dist/es/ir/node.d.ts
CHANGED
|
@@ -10,8 +10,17 @@ export declare const NODE_SHAPES: {
|
|
|
10
10
|
readonly ellipse: "ellipse";
|
|
11
11
|
readonly diamond: "diamond";
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* 内置 4 shape 名联合
|
|
15
|
+
* @description `BUILTIN_SHAPES` 的 Record key(保穷尽性约束,不随 `NodeShape` 开放而退化为 `string`)
|
|
16
|
+
*/
|
|
17
|
+
export type BuiltinShapeName = ValueOf<typeof NODE_SHAPES>;
|
|
18
|
+
/**
|
|
19
|
+
* 节点形状名:开放字符串
|
|
20
|
+
* @description 内置 `BuiltinShapeName`,或经 `CompileOptions.shapes` 注册的扩展 shape 名;
|
|
21
|
+
* `& {}` 让 IDE 仍对内置 4 名自动补全,同时接受任意非空字符串
|
|
22
|
+
*/
|
|
23
|
+
export type NodeShape = BuiltinShapeName | (string & {});
|
|
15
24
|
/** 节点文本对齐(TikZ `align=` 同义) */
|
|
16
25
|
export declare const NODE_TEXT_ALIGNS: {
|
|
17
26
|
readonly left: "left";
|
|
@@ -84,12 +93,7 @@ export type IRNodeLabel = z.infer<typeof NodeLabelSchema>;
|
|
|
84
93
|
export declare const NodeSchema: z.ZodObject<{
|
|
85
94
|
type: z.ZodLiteral<"node">;
|
|
86
95
|
id: z.ZodOptional<z.ZodString>;
|
|
87
|
-
shape: z.ZodOptional<z.
|
|
88
|
-
readonly rectangle: "rectangle";
|
|
89
|
-
readonly circle: "circle";
|
|
90
|
-
readonly ellipse: "ellipse";
|
|
91
|
-
readonly diamond: "diamond";
|
|
92
|
-
}>>;
|
|
96
|
+
shape: z.ZodOptional<z.ZodString>;
|
|
93
97
|
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodObject<{
|
|
94
98
|
direction: z.ZodNativeEnum<{
|
|
95
99
|
readonly above: "above";
|
|
@@ -169,6 +173,7 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
169
173
|
readonly right: "right";
|
|
170
174
|
}>>;
|
|
171
175
|
lineHeight: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
color: z.ZodOptional<z.ZodString>;
|
|
172
177
|
fill: z.ZodOptional<z.ZodString>;
|
|
173
178
|
fillOpacity: z.ZodOptional<z.ZodNumber>;
|
|
174
179
|
stroke: z.ZodOptional<z.ZodString>;
|
|
@@ -347,8 +352,10 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
347
352
|
weight?: number | "normal" | "bold" | undefined;
|
|
348
353
|
style?: "normal" | "italic" | "oblique" | undefined;
|
|
349
354
|
} | undefined;
|
|
350
|
-
shape?:
|
|
355
|
+
shape?: string | undefined;
|
|
351
356
|
scale?: number | undefined;
|
|
357
|
+
color?: string | undefined;
|
|
358
|
+
textColor?: string | undefined;
|
|
352
359
|
label?: {
|
|
353
360
|
text: string;
|
|
354
361
|
distance?: number | undefined;
|
|
@@ -378,7 +385,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
378
385
|
strokeWidth?: number | undefined;
|
|
379
386
|
fillOpacity?: number | undefined;
|
|
380
387
|
drawOpacity?: number | undefined;
|
|
381
|
-
textColor?: string | undefined;
|
|
382
388
|
id?: string | undefined;
|
|
383
389
|
rotate?: number | undefined;
|
|
384
390
|
align?: "left" | "right" | "center" | undefined;
|
|
@@ -426,8 +432,10 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
426
432
|
weight?: number | "normal" | "bold" | undefined;
|
|
427
433
|
style?: "normal" | "italic" | "oblique" | undefined;
|
|
428
434
|
} | undefined;
|
|
429
|
-
shape?:
|
|
435
|
+
shape?: string | undefined;
|
|
430
436
|
scale?: number | undefined;
|
|
437
|
+
color?: string | undefined;
|
|
438
|
+
textColor?: string | undefined;
|
|
431
439
|
label?: {
|
|
432
440
|
text: string;
|
|
433
441
|
distance?: number | undefined;
|
|
@@ -457,7 +465,6 @@ export declare const NodeSchema: z.ZodObject<{
|
|
|
457
465
|
strokeWidth?: number | undefined;
|
|
458
466
|
fillOpacity?: number | undefined;
|
|
459
467
|
drawOpacity?: number | undefined;
|
|
460
|
-
textColor?: string | undefined;
|
|
461
468
|
id?: string | undefined;
|
|
462
469
|
rotate?: number | undefined;
|
|
463
470
|
align?: "left" | "right" | "center" | undefined;
|
package/dist/es/ir/node.d.ts.map
CHANGED
|
@@ -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;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKxC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ir/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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C"}
|
package/dist/es/ir/node.js
CHANGED
|
@@ -37,7 +37,7 @@ var NodeLabelSchema = z.object({
|
|
|
37
37
|
var NodeSchema = z.object({
|
|
38
38
|
type: z.literal("node").describe("Discriminator marking this child as a node"),
|
|
39
39
|
id: z.string().min(1).optional().describe("Optional unique id; required if any path needs to reference this node by string"),
|
|
40
|
-
shape: z.
|
|
40
|
+
shape: z.string().min(1).optional().describe("Node visual shape name; built-in `rectangle` / `circle` / `ellipse` / `diamond`, or an extension shape registered via `CompileOptions.shapes`. Any non-empty string passes schema validation; unregistered names are rejected at compile time. Defaults to `rectangle`. The boundary fully contains text + padding (circumscribed for circle / ellipse / diamond)."),
|
|
41
41
|
position: z.union([
|
|
42
42
|
PositionSchema,
|
|
43
43
|
PolarPositionSchema,
|
|
@@ -48,6 +48,7 @@ var NodeSchema = z.object({
|
|
|
48
48
|
text: TextBlockSchema.optional(),
|
|
49
49
|
align: z.nativeEnum(NODE_TEXT_ALIGNS).optional().describe("Multi-line text alignment within the text block; `left` / `center` / `right`. Defaults to `center` (matches TikZ)."),
|
|
50
50
|
lineHeight: z.number().positive().optional().describe("Line height in user units; falls back to `font.size × 1.2` when omitted."),
|
|
51
|
+
color: z.string().optional().describe("Master color (TikZ `color=`). When set, stroke / fill / text default to it unless individually overridden, and it cascades to the inner text and edge labels. Individual fields (stroke / fill / textColor) always win over this within the same node."),
|
|
51
52
|
fill: z.string().optional().describe("Background color of the node shape; any CSS color (e.g. \"lightblue\", \"#fafafa\", \"rgba(...)\")"),
|
|
52
53
|
fillOpacity: z.number().min(0).max(1).optional().describe("Fill opacity 0..1; affects only the shape fill, leaves stroke / text alone."),
|
|
53
54
|
stroke: z.string().optional().describe("Border color of the node shape; any CSS color. Defaults to currentColor when omitted"),
|