@sketchmark/plugin-geometry 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/dist/index.cjs +561 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +558 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AA4CA,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAsB;IACtD,OAAO;IACP,SAAS;IACT,KAAK;IACL,MAAM;IACN,QAAQ;IACR,KAAK;IACL,SAAS;IACT,SAAS;IACT,UAAU;AACX,CAAA,CAAC;AAEF,MAAM,QAAQ,GAAoC;AAChD,IAAA,WAAW,EAAE,CAAC;AACd,IAAA,YAAY,EAAE,EAAE;IAChB,YAAY,EAAE,GAAG;AACjB,IAAA,UAAU,EAAE,EAAE;AACd,IAAA,kBAAkB,EAAE,IAAI;CACzB;AAED,MAAM,SAAS,GAAG;IAChB,OAAO;IACP,SAAS;IACT,WAAW;IACX,aAAa;IACb,MAAM;IACN,gBAAgB;IAChB,YAAY;IACZ,gBAAgB;IAChB,aAAa;CACd;AAEK,SAAU,QAAQ,CAAC,OAAA,GAAiC,EAAE,EAAA;IAC1D,OAAO;AACL,QAAA,IAAI,EAAE,UAAU;AAChB,QAAA,UAAU,CAAC,MAAM,EAAA;AACf,YAAA,OAAO,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC;QACzC,CAAC;KACF;AACH;SAEgB,eAAe,CAAC,MAAc,EAAE,UAAiC,EAAE,EAAA;IACjF,MAAM,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE,GAAG,OAAO,EAAE;IAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,C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,WAAW,CAAC,MAAe,EAAA;IAClC,IAAI,KAAK,GAAG,CAAC;AACb,IAAA,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC;QAAE,KAAK,IAAI,CAAC;IAC5B,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG;QAAE,KAAK,IAAI,CAAC;AACxC,IAAA,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC;QAAE,KAAK,IAAI,IAAI;AAC/B,IAAA,OAAO,KAAK;AACd;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SketchmarkPlugin } from "sketchmark";
|
|
2
|
+
export interface GeometryPluginOptions {
|
|
3
|
+
pointRadius?: number;
|
|
4
|
+
pointLabelDx?: number;
|
|
5
|
+
pointLabelDy?: number;
|
|
6
|
+
lineExtend?: number;
|
|
7
|
+
autoAbsoluteLayout?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function geometry(options?: GeometryPluginOptions): SketchmarkPlugin;
|
|
10
|
+
export declare function compileGeometry(source: string, options?: GeometryPluginOptions): string;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAoED,wBAAgB,QAAQ,CAAC,OAAO,GAAE,qBAA0B,GAAG,gBAAgB,CAO9E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,CA+C3F"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
const SUPPORTED_COMMANDS = new Set([
|
|
2
|
+
"point",
|
|
3
|
+
"segment",
|
|
4
|
+
"ray",
|
|
5
|
+
"line",
|
|
6
|
+
"circle",
|
|
7
|
+
"arc",
|
|
8
|
+
"ellipse",
|
|
9
|
+
"polygon",
|
|
10
|
+
"triangle",
|
|
11
|
+
]);
|
|
12
|
+
const DEFAULTS = {
|
|
13
|
+
pointRadius: 4,
|
|
14
|
+
pointLabelDx: 12,
|
|
15
|
+
pointLabelDy: -16,
|
|
16
|
+
lineExtend: 80,
|
|
17
|
+
autoAbsoluteLayout: true,
|
|
18
|
+
};
|
|
19
|
+
const TEXT_KEYS = [
|
|
20
|
+
"color",
|
|
21
|
+
"opacity",
|
|
22
|
+
"font-size",
|
|
23
|
+
"font-weight",
|
|
24
|
+
"font",
|
|
25
|
+
"letter-spacing",
|
|
26
|
+
"text-align",
|
|
27
|
+
"vertical-align",
|
|
28
|
+
"line-height",
|
|
29
|
+
];
|
|
30
|
+
function geometry(options = {}) {
|
|
31
|
+
return {
|
|
32
|
+
name: "geometry",
|
|
33
|
+
preprocess(source) {
|
|
34
|
+
return compileGeometry(source, options);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function compileGeometry(source, options = {}) {
|
|
39
|
+
const settings = { ...DEFAULTS, ...options };
|
|
40
|
+
const lines = source.split(/\r?\n/);
|
|
41
|
+
const commandByLine = new Map();
|
|
42
|
+
const pointMap = new Map();
|
|
43
|
+
let hasGeometry = false;
|
|
44
|
+
let inTripleQuoteBlock = false;
|
|
45
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
46
|
+
const trimmed = lines[index]?.trim() ?? "";
|
|
47
|
+
if (trimmed === '"""') {
|
|
48
|
+
inTripleQuoteBlock = !inTripleQuoteBlock;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (inTripleQuoteBlock || !trimmed.startsWith("geo."))
|
|
52
|
+
continue;
|
|
53
|
+
const command = parseGeometryCommand(trimmed, index + 1);
|
|
54
|
+
commandByLine.set(index, command);
|
|
55
|
+
hasGeometry = true;
|
|
56
|
+
if (command.type === "point") {
|
|
57
|
+
if (pointMap.has(command.id)) {
|
|
58
|
+
throw new Error(`Duplicate geo.point "${command.id}" on line ${command.lineNumber}`);
|
|
59
|
+
}
|
|
60
|
+
pointMap.set(command.id, buildPointSpec(command, settings));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!hasGeometry)
|
|
64
|
+
return source;
|
|
65
|
+
const layoutDecision = resolveLayout(lines, settings.autoAbsoluteLayout);
|
|
66
|
+
const output = [];
|
|
67
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
68
|
+
output.push(lines[index] ?? "");
|
|
69
|
+
if (layoutDecision.insertAfterDiagramIndex === index) {
|
|
70
|
+
output.push("layout absolute");
|
|
71
|
+
}
|
|
72
|
+
const command = commandByLine.get(index);
|
|
73
|
+
if (!command)
|
|
74
|
+
continue;
|
|
75
|
+
output.pop();
|
|
76
|
+
output.push(...emitCommand(command, pointMap, settings));
|
|
77
|
+
}
|
|
78
|
+
return output.join("\n");
|
|
79
|
+
}
|
|
80
|
+
function parseGeometryCommand(line, lineNumber) {
|
|
81
|
+
const tokens = tokenizeLine(line);
|
|
82
|
+
if (tokens.length < 2) {
|
|
83
|
+
throw new Error(`Invalid geometry command on line ${lineNumber}`);
|
|
84
|
+
}
|
|
85
|
+
const commandToken = tokens[0] ?? "";
|
|
86
|
+
const type = commandToken.slice("geo.".length);
|
|
87
|
+
if (!SUPPORTED_COMMANDS.has(type)) {
|
|
88
|
+
throw new Error(`Unsupported geometry command "${commandToken}" on line ${lineNumber}`);
|
|
89
|
+
}
|
|
90
|
+
const id = tokens[1] ?? "";
|
|
91
|
+
if (!id || id.includes("=")) {
|
|
92
|
+
throw new Error(`Geometry command "${commandToken}" requires an explicit id on line ${lineNumber}`);
|
|
93
|
+
}
|
|
94
|
+
const props = {};
|
|
95
|
+
for (const token of tokens.slice(2)) {
|
|
96
|
+
const eqIndex = token.indexOf("=");
|
|
97
|
+
if (eqIndex < 1) {
|
|
98
|
+
throw new Error(`Invalid geometry property "${token}" on line ${lineNumber}`);
|
|
99
|
+
}
|
|
100
|
+
const key = token.slice(0, eqIndex);
|
|
101
|
+
const value = stripWrapping(token.slice(eqIndex + 1));
|
|
102
|
+
props[key] = value;
|
|
103
|
+
}
|
|
104
|
+
return { type, id, props, lineNumber };
|
|
105
|
+
}
|
|
106
|
+
function tokenizeLine(line) {
|
|
107
|
+
const tokens = [];
|
|
108
|
+
let index = 0;
|
|
109
|
+
while (index < line.length) {
|
|
110
|
+
while (index < line.length && /\s/.test(line[index] ?? ""))
|
|
111
|
+
index += 1;
|
|
112
|
+
if (index >= line.length)
|
|
113
|
+
break;
|
|
114
|
+
const start = index;
|
|
115
|
+
let inQuote = false;
|
|
116
|
+
let listDepth = 0;
|
|
117
|
+
while (index < line.length) {
|
|
118
|
+
const ch = line[index] ?? "";
|
|
119
|
+
if (ch === '"' && line[index - 1] !== "\\") {
|
|
120
|
+
inQuote = !inQuote;
|
|
121
|
+
index += 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (!inQuote) {
|
|
125
|
+
if (ch === "[")
|
|
126
|
+
listDepth += 1;
|
|
127
|
+
if (ch === "]" && listDepth > 0)
|
|
128
|
+
listDepth -= 1;
|
|
129
|
+
if (/\s/.test(ch) && listDepth === 0)
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
index += 1;
|
|
133
|
+
}
|
|
134
|
+
tokens.push(line.slice(start, index));
|
|
135
|
+
}
|
|
136
|
+
return tokens;
|
|
137
|
+
}
|
|
138
|
+
function stripWrapping(value) {
|
|
139
|
+
if (value.length >= 2 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
140
|
+
return value.slice(1, -1).replace(/\\"/g, '"');
|
|
141
|
+
}
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
function resolveLayout(lines, autoAbsoluteLayout) {
|
|
145
|
+
const diagramIndex = lines.findIndex((line) => (line.trim() ?? "") === "diagram");
|
|
146
|
+
if (diagramIndex < 0) {
|
|
147
|
+
throw new Error('Geometry plugin requires a root "diagram" block');
|
|
148
|
+
}
|
|
149
|
+
const layoutIndex = lines.findIndex((line, index) => {
|
|
150
|
+
if (index <= diagramIndex)
|
|
151
|
+
return false;
|
|
152
|
+
return line.trim().startsWith("layout ");
|
|
153
|
+
});
|
|
154
|
+
if (layoutIndex < 0) {
|
|
155
|
+
if (!autoAbsoluteLayout) {
|
|
156
|
+
throw new Error('Geometry plugin requires "layout absolute"');
|
|
157
|
+
}
|
|
158
|
+
return { insertAfterDiagramIndex: diagramIndex };
|
|
159
|
+
}
|
|
160
|
+
if (lines[layoutIndex]?.trim() !== "layout absolute") {
|
|
161
|
+
throw new Error('Geometry commands require the root diagram to use "layout absolute"');
|
|
162
|
+
}
|
|
163
|
+
return {};
|
|
164
|
+
}
|
|
165
|
+
function buildPointSpec(command, settings) {
|
|
166
|
+
const x = requireNumber(command.props, "x", command.lineNumber);
|
|
167
|
+
const y = requireNumber(command.props, "y", command.lineNumber);
|
|
168
|
+
const radius = readNumber(command.props.r ?? command.props.radius) ?? settings.pointRadius;
|
|
169
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? settings.pointLabelDx;
|
|
170
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? settings.pointLabelDy;
|
|
171
|
+
return {
|
|
172
|
+
id: command.id,
|
|
173
|
+
x,
|
|
174
|
+
y,
|
|
175
|
+
radius,
|
|
176
|
+
label: command.props.label ?? command.id,
|
|
177
|
+
labelDx,
|
|
178
|
+
labelDy,
|
|
179
|
+
props: command.props,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function emitCommand(command, pointMap, settings) {
|
|
183
|
+
switch (command.type) {
|
|
184
|
+
case "point":
|
|
185
|
+
return emitPoint(pointMap.get(command.id));
|
|
186
|
+
case "segment":
|
|
187
|
+
return emitLinear(command, pointMap, "segment", settings.lineExtend);
|
|
188
|
+
case "ray":
|
|
189
|
+
return emitLinear(command, pointMap, "ray", settings.lineExtend);
|
|
190
|
+
case "line":
|
|
191
|
+
return emitLinear(command, pointMap, "line", settings.lineExtend);
|
|
192
|
+
case "circle":
|
|
193
|
+
return emitCircle(command, pointMap);
|
|
194
|
+
case "arc":
|
|
195
|
+
return emitArc(command, pointMap);
|
|
196
|
+
case "ellipse":
|
|
197
|
+
return emitEllipse(command, pointMap);
|
|
198
|
+
case "polygon":
|
|
199
|
+
return emitPolygon(command, pointMap, false);
|
|
200
|
+
case "triangle":
|
|
201
|
+
return emitPolygon(command, pointMap, true);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function emitPoint(point) {
|
|
205
|
+
const fill = point.props.fill ?? "#1a1208";
|
|
206
|
+
const stroke = point.props.stroke ?? fill;
|
|
207
|
+
const strokeWidth = readNumber(point.props["stroke-width"]) ?? 1;
|
|
208
|
+
const lines = [
|
|
209
|
+
serializeNode("circle", point.id, "", {
|
|
210
|
+
x: point.x - point.radius,
|
|
211
|
+
y: point.y - point.radius,
|
|
212
|
+
width: point.radius * 2,
|
|
213
|
+
height: point.radius * 2,
|
|
214
|
+
fill,
|
|
215
|
+
stroke,
|
|
216
|
+
"stroke-width": strokeWidth,
|
|
217
|
+
...pickKeys(point.props, ["theme", "opacity", "dash", "stroke-dash"]),
|
|
218
|
+
}),
|
|
219
|
+
];
|
|
220
|
+
if (point.label) {
|
|
221
|
+
lines.push(serializeNode("text", labelNodeId(point.id), point.label, {
|
|
222
|
+
x: point.x + point.labelDx,
|
|
223
|
+
y: point.y + point.labelDy,
|
|
224
|
+
"animation-parent": point.id,
|
|
225
|
+
color: point.props.color ?? stroke,
|
|
226
|
+
...pickKeys(point.props, TEXT_KEYS),
|
|
227
|
+
}));
|
|
228
|
+
}
|
|
229
|
+
return lines;
|
|
230
|
+
}
|
|
231
|
+
function emitLinear(command, pointMap, mode, defaultExtend) {
|
|
232
|
+
const from = requirePoint(pointMap, command.props.from, "from", command.lineNumber);
|
|
233
|
+
const to = requirePoint(pointMap, command.props.to, "to", command.lineNumber);
|
|
234
|
+
const length = distance(from, to);
|
|
235
|
+
if (length === 0) {
|
|
236
|
+
throw new Error(`Geometry command "${command.id}" on line ${command.lineNumber} needs distinct points`);
|
|
237
|
+
}
|
|
238
|
+
const extend = readNumber(command.props.extend) ?? defaultExtend;
|
|
239
|
+
const unit = { x: (to.x - from.x) / length, y: (to.y - from.y) / length };
|
|
240
|
+
const start = mode === "line"
|
|
241
|
+
? { x: from.x - unit.x * extend, y: from.y - unit.y * extend }
|
|
242
|
+
: { x: from.x, y: from.y };
|
|
243
|
+
const end = mode === "segment"
|
|
244
|
+
? { x: to.x, y: to.y }
|
|
245
|
+
: { x: to.x + unit.x * extend, y: to.y + unit.y * extend };
|
|
246
|
+
const lines = [serializePathNode(command.id, [start, end], false, command.props)];
|
|
247
|
+
if (mode === "ray") {
|
|
248
|
+
lines.push(serializeArrowHeadNode(arrowNodeId(command.id), end, unit, command.props, command.id));
|
|
249
|
+
}
|
|
250
|
+
if (command.props.label) {
|
|
251
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? 0;
|
|
252
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? 0;
|
|
253
|
+
const labelOffset = readNumber(command.props["label-offset"]) ?? 18;
|
|
254
|
+
const anchor = lineLabelAnchor(start, end, labelOffset);
|
|
255
|
+
lines.push(serializeNode("text", labelNodeId(command.id), command.props.label, {
|
|
256
|
+
x: anchor.x + labelDx,
|
|
257
|
+
y: anchor.y + labelDy,
|
|
258
|
+
"animation-parent": command.id,
|
|
259
|
+
color: command.props.color ?? command.props.stroke ?? "#1a1208",
|
|
260
|
+
...pickKeys(command.props, TEXT_KEYS),
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
return lines;
|
|
264
|
+
}
|
|
265
|
+
function serializeArrowHeadNode(id, tip, direction, props, animationParent) {
|
|
266
|
+
const strokeWidth = readNumber(props["stroke-width"]) ?? 1.5;
|
|
267
|
+
const arrowLength = readNumber(props["tip-size"]) ?? Math.max(10, strokeWidth * 6.5);
|
|
268
|
+
const arrowWidth = arrowLength * 0.65;
|
|
269
|
+
const base = {
|
|
270
|
+
x: tip.x - direction.x * arrowLength,
|
|
271
|
+
y: tip.y - direction.y * arrowLength,
|
|
272
|
+
};
|
|
273
|
+
const normal = { x: -direction.y, y: direction.x };
|
|
274
|
+
const left = {
|
|
275
|
+
x: base.x + normal.x * (arrowWidth / 2),
|
|
276
|
+
y: base.y + normal.y * (arrowWidth / 2),
|
|
277
|
+
};
|
|
278
|
+
const right = {
|
|
279
|
+
x: base.x - normal.x * (arrowWidth / 2),
|
|
280
|
+
y: base.y - normal.y * (arrowWidth / 2),
|
|
281
|
+
};
|
|
282
|
+
return serializePathNode(id, [left, tip, right], true, {
|
|
283
|
+
...pickKeys(props, ["theme", "opacity"]),
|
|
284
|
+
fill: props.stroke ?? "#1a1208",
|
|
285
|
+
stroke: props.stroke ?? "#1a1208",
|
|
286
|
+
"stroke-width": String(Math.max(1, strokeWidth * 0.75)),
|
|
287
|
+
"animation-parent": animationParent,
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function emitCircle(command, pointMap) {
|
|
291
|
+
const center = requirePoint(pointMap, command.props.center, "center", command.lineNumber);
|
|
292
|
+
const radius = requireNumber(command.props, "r", command.lineNumber, "radius");
|
|
293
|
+
const diameter = radius * 2;
|
|
294
|
+
const lines = [
|
|
295
|
+
serializeNode("circle", command.id, "", {
|
|
296
|
+
x: center.x - radius,
|
|
297
|
+
y: center.y - radius,
|
|
298
|
+
width: diameter,
|
|
299
|
+
height: diameter,
|
|
300
|
+
fill: command.props.fill ?? "none",
|
|
301
|
+
stroke: command.props.stroke ?? "#1a1208",
|
|
302
|
+
"stroke-width": readNumber(command.props["stroke-width"]) ?? 1.5,
|
|
303
|
+
...pickKeys(command.props, ["theme", "opacity", "dash", "stroke-dash"]),
|
|
304
|
+
}),
|
|
305
|
+
];
|
|
306
|
+
if (command.props.label) {
|
|
307
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? radius + 10;
|
|
308
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? -radius - 10;
|
|
309
|
+
lines.push(serializeNode("text", labelNodeId(command.id), command.props.label, {
|
|
310
|
+
x: center.x + labelDx,
|
|
311
|
+
y: center.y + labelDy,
|
|
312
|
+
"animation-parent": command.id,
|
|
313
|
+
color: command.props.color ?? command.props.stroke ?? "#1a1208",
|
|
314
|
+
...pickKeys(command.props, TEXT_KEYS),
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
return lines;
|
|
318
|
+
}
|
|
319
|
+
function emitArc(command, pointMap) {
|
|
320
|
+
const center = requirePoint(pointMap, command.props.center, "center", command.lineNumber);
|
|
321
|
+
const radius = requireNumber(command.props, "r", command.lineNumber, "radius");
|
|
322
|
+
const startDeg = requireNumber(command.props, "start", command.lineNumber);
|
|
323
|
+
const endDeg = requireNumber(command.props, "end", command.lineNumber);
|
|
324
|
+
const closeMode = normalizeArcClose(command.props.close, command.lineNumber);
|
|
325
|
+
const arcPoints = sampleArcPoints(center, radius, startDeg, endDeg);
|
|
326
|
+
const pathPoints = closeMode === "center" ? [center, ...arcPoints] : arcPoints;
|
|
327
|
+
const lines = [
|
|
328
|
+
serializePathNode(command.id, pathPoints, closeMode !== "none", {
|
|
329
|
+
...command.props,
|
|
330
|
+
fill: closeMode === "none" ? "none" : (command.props.fill ?? "none"),
|
|
331
|
+
}),
|
|
332
|
+
];
|
|
333
|
+
if (command.props.label) {
|
|
334
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? 0;
|
|
335
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? 0;
|
|
336
|
+
const labelOffset = readNumber(command.props["label-offset"])
|
|
337
|
+
?? (closeMode === "center" ? 0 : 12);
|
|
338
|
+
const labelAngle = startDeg + (endDeg - startDeg) / 2;
|
|
339
|
+
const anchor = polarPoint(center, radius + labelOffset, labelAngle);
|
|
340
|
+
lines.push(serializeNode("text", labelNodeId(command.id), command.props.label, {
|
|
341
|
+
x: anchor.x + labelDx,
|
|
342
|
+
y: anchor.y + labelDy,
|
|
343
|
+
"animation-parent": command.id,
|
|
344
|
+
color: command.props.color ?? command.props.stroke ?? "#1a1208",
|
|
345
|
+
...pickKeys(command.props, TEXT_KEYS),
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
return lines;
|
|
349
|
+
}
|
|
350
|
+
function emitEllipse(command, pointMap) {
|
|
351
|
+
const center = requirePoint(pointMap, command.props.center, "center", command.lineNumber);
|
|
352
|
+
const rx = requireNumber(command.props, "rx", command.lineNumber, "radius");
|
|
353
|
+
const ry = requireNumber(command.props, "ry", command.lineNumber, "radius");
|
|
354
|
+
const points = sampleEllipsePoints(center, rx, ry);
|
|
355
|
+
const lines = [
|
|
356
|
+
serializePathNode(command.id, points, true, {
|
|
357
|
+
...command.props,
|
|
358
|
+
fill: command.props.fill ?? "none",
|
|
359
|
+
}),
|
|
360
|
+
];
|
|
361
|
+
if (command.props.label) {
|
|
362
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? rx + 10;
|
|
363
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? -ry - 10;
|
|
364
|
+
lines.push(serializeNode("text", labelNodeId(command.id), command.props.label, {
|
|
365
|
+
x: center.x + labelDx,
|
|
366
|
+
y: center.y + labelDy,
|
|
367
|
+
"animation-parent": command.id,
|
|
368
|
+
color: command.props.color ?? command.props.stroke ?? "#1a1208",
|
|
369
|
+
...pickKeys(command.props, TEXT_KEYS),
|
|
370
|
+
}));
|
|
371
|
+
}
|
|
372
|
+
return lines;
|
|
373
|
+
}
|
|
374
|
+
function emitPolygon(command, pointMap, isTriangle) {
|
|
375
|
+
const ids = parseList(command.props.points, command.lineNumber, "points");
|
|
376
|
+
if (isTriangle && ids.length !== 3) {
|
|
377
|
+
throw new Error(`geo.triangle "${command.id}" on line ${command.lineNumber} needs exactly 3 points`);
|
|
378
|
+
}
|
|
379
|
+
if (!isTriangle && ids.length < 3) {
|
|
380
|
+
throw new Error(`geo.polygon "${command.id}" on line ${command.lineNumber} needs at least 3 points`);
|
|
381
|
+
}
|
|
382
|
+
const points = ids.map((id) => requirePoint(pointMap, id, "points", command.lineNumber));
|
|
383
|
+
const lines = [serializePathNode(command.id, points, true, command.props)];
|
|
384
|
+
if (command.props.label) {
|
|
385
|
+
const labelDx = readNumber(command.props["label-dx"]) ?? 0;
|
|
386
|
+
const labelDy = readNumber(command.props["label-dy"]) ?? -26;
|
|
387
|
+
const labelX = (Math.min(...points.map((point) => point.x)) + Math.max(...points.map((point) => point.x))) / 2;
|
|
388
|
+
const labelY = Math.min(...points.map((point) => point.y));
|
|
389
|
+
lines.push(serializeNode("text", labelNodeId(command.id), command.props.label, {
|
|
390
|
+
x: labelX + labelDx,
|
|
391
|
+
y: labelY + labelDy,
|
|
392
|
+
"animation-parent": command.id,
|
|
393
|
+
color: command.props.color ?? command.props.stroke ?? "#1a1208",
|
|
394
|
+
...pickKeys(command.props, TEXT_KEYS),
|
|
395
|
+
}));
|
|
396
|
+
}
|
|
397
|
+
return lines;
|
|
398
|
+
}
|
|
399
|
+
function serializePathNode(id, points, closePath, props) {
|
|
400
|
+
const minX = Math.min(...points.map((point) => point.x));
|
|
401
|
+
const minY = Math.min(...points.map((point) => point.y));
|
|
402
|
+
const maxX = Math.max(...points.map((point) => point.x));
|
|
403
|
+
const maxY = Math.max(...points.map((point) => point.y));
|
|
404
|
+
const d = points
|
|
405
|
+
.map((point, index) => {
|
|
406
|
+
const prefix = index === 0 ? "M" : "L";
|
|
407
|
+
return `${prefix} ${formatNumber(point.x - minX)} ${formatNumber(point.y - minY)}`;
|
|
408
|
+
})
|
|
409
|
+
.join(" ");
|
|
410
|
+
return serializeNode("path", id, "", {
|
|
411
|
+
value: `${d}${closePath ? " Z" : ""}`,
|
|
412
|
+
x: minX,
|
|
413
|
+
y: minY,
|
|
414
|
+
width: Math.max(1, maxX - minX),
|
|
415
|
+
height: Math.max(1, maxY - minY),
|
|
416
|
+
fill: props.fill ?? "none",
|
|
417
|
+
stroke: props.stroke ?? "#1a1208",
|
|
418
|
+
"stroke-width": readNumber(props["stroke-width"]) ?? 1.5,
|
|
419
|
+
...pickKeys(props, ["theme", "opacity", "dash", "stroke-dash", "animation-parent"]),
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function requirePoint(pointMap, id, propName, lineNumber) {
|
|
423
|
+
if (!id) {
|
|
424
|
+
throw new Error(`Geometry command on line ${lineNumber} requires "${propName}"`);
|
|
425
|
+
}
|
|
426
|
+
const point = pointMap.get(id);
|
|
427
|
+
if (!point) {
|
|
428
|
+
throw new Error(`Unknown point "${id}" referenced by "${propName}" on line ${lineNumber}`);
|
|
429
|
+
}
|
|
430
|
+
return point;
|
|
431
|
+
}
|
|
432
|
+
function parseList(value, lineNumber, propName) {
|
|
433
|
+
if (!value || value[0] !== "[" || value[value.length - 1] !== "]") {
|
|
434
|
+
throw new Error(`Geometry command on line ${lineNumber} requires ${propName}=[...]`);
|
|
435
|
+
}
|
|
436
|
+
return value
|
|
437
|
+
.slice(1, -1)
|
|
438
|
+
.split(",")
|
|
439
|
+
.map((part) => part.trim())
|
|
440
|
+
.filter(Boolean);
|
|
441
|
+
}
|
|
442
|
+
function serializeNode(shape, id, label, props) {
|
|
443
|
+
const parts = [shape, id, `label=${quote(label)}`];
|
|
444
|
+
for (const [key, value] of Object.entries(props)) {
|
|
445
|
+
if (value === undefined)
|
|
446
|
+
continue;
|
|
447
|
+
parts.push(`${key}=${formatPropValue(value)}`);
|
|
448
|
+
}
|
|
449
|
+
return parts.join(" ");
|
|
450
|
+
}
|
|
451
|
+
function quote(value) {
|
|
452
|
+
return `"${value
|
|
453
|
+
.replace(/\\/g, "\\\\")
|
|
454
|
+
.replace(/"/g, '\\"')
|
|
455
|
+
.replace(/\n/g, "\\n")}"`;
|
|
456
|
+
}
|
|
457
|
+
function formatPropValue(value) {
|
|
458
|
+
if (typeof value === "number")
|
|
459
|
+
return formatNumber(value);
|
|
460
|
+
return quote(value);
|
|
461
|
+
}
|
|
462
|
+
function formatNumber(value) {
|
|
463
|
+
const rounded = Math.round(value * 100) / 100;
|
|
464
|
+
return Number.isInteger(rounded) ? String(rounded) : String(rounded).replace(/\.?0+$/, "");
|
|
465
|
+
}
|
|
466
|
+
function labelNodeId(id) {
|
|
467
|
+
return `__geo_${sanitizeId(id)}_label`;
|
|
468
|
+
}
|
|
469
|
+
function arrowNodeId(id) {
|
|
470
|
+
return `__geo_${sanitizeId(id)}_tip`;
|
|
471
|
+
}
|
|
472
|
+
function sanitizeId(value) {
|
|
473
|
+
return value.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
474
|
+
}
|
|
475
|
+
function pickKeys(props, keys) {
|
|
476
|
+
const next = {};
|
|
477
|
+
for (const key of keys) {
|
|
478
|
+
if (props[key] !== undefined)
|
|
479
|
+
next[key] = props[key];
|
|
480
|
+
}
|
|
481
|
+
return next;
|
|
482
|
+
}
|
|
483
|
+
function requireNumber(props, key, lineNumber, alias) {
|
|
484
|
+
const value = readNumber(props[key] ?? (alias ? props[alias] : undefined));
|
|
485
|
+
if (value === undefined || Number.isNaN(value)) {
|
|
486
|
+
throw new Error(`Geometry command on line ${lineNumber} requires numeric "${key}"`);
|
|
487
|
+
}
|
|
488
|
+
return value;
|
|
489
|
+
}
|
|
490
|
+
function readNumber(value) {
|
|
491
|
+
if (value === undefined || value === "")
|
|
492
|
+
return undefined;
|
|
493
|
+
const parsed = Number(value);
|
|
494
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
495
|
+
}
|
|
496
|
+
function distance(from, to) {
|
|
497
|
+
return Math.hypot(to.x - from.x, to.y - from.y);
|
|
498
|
+
}
|
|
499
|
+
function polarPoint(center, radius, deg) {
|
|
500
|
+
const radians = (deg * Math.PI) / 180;
|
|
501
|
+
return {
|
|
502
|
+
x: center.x + Math.cos(radians) * radius,
|
|
503
|
+
y: center.y - Math.sin(radians) * radius,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
function sampleArcPoints(center, radius, startDeg, endDeg) {
|
|
507
|
+
const delta = endDeg - startDeg;
|
|
508
|
+
const segments = Math.max(8, Math.ceil(Math.abs(delta) / 12));
|
|
509
|
+
return Array.from({ length: segments + 1 }, (_, index) => polarPoint(center, radius, startDeg + (delta * index) / segments));
|
|
510
|
+
}
|
|
511
|
+
function sampleEllipsePoints(center, rx, ry) {
|
|
512
|
+
const segments = 36;
|
|
513
|
+
return Array.from({ length: segments }, (_, index) => {
|
|
514
|
+
const deg = (index / segments) * 360;
|
|
515
|
+
const radians = (deg * Math.PI) / 180;
|
|
516
|
+
return {
|
|
517
|
+
x: center.x + Math.cos(radians) * rx,
|
|
518
|
+
y: center.y - Math.sin(radians) * ry,
|
|
519
|
+
};
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function normalizeArcClose(value, lineNumber) {
|
|
523
|
+
if (!value || value === "none")
|
|
524
|
+
return "none";
|
|
525
|
+
if (value === "chord" || value === "center")
|
|
526
|
+
return value;
|
|
527
|
+
throw new Error(`Invalid geo.arc close "${value}" on line ${lineNumber}; expected none, chord, or center`);
|
|
528
|
+
}
|
|
529
|
+
function lineLabelAnchor(start, end, offset) {
|
|
530
|
+
const mid = {
|
|
531
|
+
x: (start.x + end.x) / 2,
|
|
532
|
+
y: (start.y + end.y) / 2,
|
|
533
|
+
};
|
|
534
|
+
const dx = end.x - start.x;
|
|
535
|
+
const dy = end.y - start.y;
|
|
536
|
+
const length = Math.hypot(dx, dy) || 1;
|
|
537
|
+
const unit = { x: dx / length, y: dy / length };
|
|
538
|
+
const normalA = { x: unit.y, y: -unit.x };
|
|
539
|
+
const normalB = { x: -unit.y, y: unit.x };
|
|
540
|
+
const normal = normalScore(normalA) >= normalScore(normalB) ? normalA : normalB;
|
|
541
|
+
return {
|
|
542
|
+
x: mid.x + normal.x * offset,
|
|
543
|
+
y: mid.y + normal.y * offset,
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function normalScore(normal) {
|
|
547
|
+
let score = 0;
|
|
548
|
+
if (normal.y < 0)
|
|
549
|
+
score += 2;
|
|
550
|
+
if (Math.abs(normal.x) > 0.6)
|
|
551
|
+
score += 1;
|
|
552
|
+
if (normal.x > 0)
|
|
553
|
+
score += 0.25;
|
|
554
|
+
return score;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export { compileGeometry, geometry };
|
|
558
|
+
//# sourceMappingURL=index.js.map
|