graphics-debug 0.0.83 → 0.0.85
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/{chunk-HU5LL4ZE.js → chunk-5O6JHGHI.js} +2 -2
- package/dist/chunk-5O6JHGHI.js.map +1 -0
- package/dist/{chunk-NYENUFOW.js → chunk-7236NVI2.js} +5 -1
- package/dist/chunk-7236NVI2.js.map +1 -0
- package/dist/chunk-FLFF6QXL.js +89 -0
- package/dist/chunk-FLFF6QXL.js.map +1 -0
- package/dist/{chunk-BQ3ZHEQO.js → chunk-K37Y2KHE.js} +5 -1
- package/dist/chunk-K37Y2KHE.js.map +1 -0
- package/dist/{chunk-PPB7D4OE.js → chunk-ME47RV6O.js} +85 -10
- package/dist/chunk-ME47RV6O.js.map +1 -0
- package/dist/{chunk-GZRUE2GP.js → chunk-OB4CGOL3.js} +6 -1
- package/dist/chunk-OB4CGOL3.js.map +1 -0
- package/dist/{chunk-IOVKI3ZO.js → chunk-PCHDJSKZ.js} +48 -2
- package/dist/chunk-PCHDJSKZ.js.map +1 -0
- package/dist/{chunk-MXOATGTD.js → chunk-PEHHGMS7.js} +4 -4
- package/dist/{chunk-7NMLOZRC.js → chunk-TBTTAU4R.js} +122 -8
- package/dist/chunk-TBTTAU4R.js.map +1 -0
- package/dist/cli/cli.js +9 -8
- package/dist/cli/cli.js.map +1 -1
- package/dist/lib/arrowHelpers.d.ts +27 -1
- package/dist/lib/arrowHelpers.js +5 -3
- package/dist/lib/drawGraphicsToCanvas.js +3 -2
- package/dist/lib/getSvgFromGraphicsObject.d.ts +3 -2
- package/dist/lib/getSvgFromGraphicsObject.js +3 -2
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +9 -8
- package/dist/lib/infiniteLineHelpers.d.ts +7 -0
- package/dist/lib/infiniteLineHelpers.js +9 -0
- package/dist/lib/infiniteLineHelpers.js.map +1 -0
- package/dist/lib/matcher.js +3 -2
- package/dist/lib/matcher.js.map +1 -1
- package/dist/lib/mergeGraphics.js +1 -1
- package/dist/lib/react.d.ts +1 -1
- package/dist/lib/react.js +260 -114
- package/dist/lib/react.js.map +1 -1
- package/dist/lib/setStepOfAllObjects.js +1 -1
- package/dist/lib/stackGraphics.js +6 -5
- package/dist/lib/translateGraphics.js +1 -1
- package/dist/lib/types.d.ts +21 -1
- package/package.json +1 -1
- package/dist/chunk-7NMLOZRC.js.map +0 -1
- package/dist/chunk-BQ3ZHEQO.js.map +0 -1
- package/dist/chunk-GZRUE2GP.js.map +0 -1
- package/dist/chunk-HU5LL4ZE.js.map +0 -1
- package/dist/chunk-IOVKI3ZO.js.map +0 -1
- package/dist/chunk-NYENUFOW.js.map +0 -1
- package/dist/chunk-PPB7D4OE.js.map +0 -1
- /package/dist/{chunk-MXOATGTD.js.map → chunk-PEHHGMS7.js.map} +0 -0
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getArrowBoundingBox,
|
|
3
|
-
getArrowGeometry
|
|
4
|
-
|
|
3
|
+
getArrowGeometry,
|
|
4
|
+
getInlineLabelLayout
|
|
5
|
+
} from "./chunk-PCHDJSKZ.js";
|
|
5
6
|
import {
|
|
6
7
|
FONT_SIZE_HEIGHT_RATIO,
|
|
7
8
|
FONT_SIZE_WIDTH_RATIO
|
|
8
9
|
} from "./chunk-ZGI74PYD.js";
|
|
10
|
+
import {
|
|
11
|
+
clipInfiniteLineToBounds
|
|
12
|
+
} from "./chunk-FLFF6QXL.js";
|
|
9
13
|
|
|
10
14
|
// lib/getSvgFromGraphicsObject.ts
|
|
15
|
+
import { stringify } from "svgson";
|
|
11
16
|
import {
|
|
17
|
+
applyToPoint,
|
|
12
18
|
compose,
|
|
13
|
-
translate,
|
|
14
19
|
scale,
|
|
15
|
-
|
|
20
|
+
translate
|
|
16
21
|
} from "transformation-matrix";
|
|
17
|
-
import { stringify } from "svgson";
|
|
18
22
|
var DEFAULT_SVG_SIZE = 640;
|
|
19
23
|
var PADDING = 40;
|
|
20
24
|
function getBounds(graphics) {
|
|
@@ -107,6 +111,7 @@ function projectPoint(point, matrix) {
|
|
|
107
111
|
}
|
|
108
112
|
function getSvgFromGraphicsObject(graphics, {
|
|
109
113
|
includeTextLabels = false,
|
|
114
|
+
hideInlineLabels = false,
|
|
110
115
|
backgroundColor = "white",
|
|
111
116
|
svgWidth = DEFAULT_SVG_SIZE,
|
|
112
117
|
svgHeight = DEFAULT_SVG_SIZE
|
|
@@ -229,6 +234,55 @@ function getSvgFromGraphicsObject(graphics, {
|
|
|
229
234
|
]
|
|
230
235
|
};
|
|
231
236
|
}),
|
|
237
|
+
...(graphics.infiniteLines || []).flatMap((line) => {
|
|
238
|
+
const segment = clipInfiniteLineToBounds(line, bounds);
|
|
239
|
+
if (!segment) return [];
|
|
240
|
+
const [start, end] = segment;
|
|
241
|
+
const projectedStart = projectPoint(start, matrix);
|
|
242
|
+
const projectedEnd = projectPoint(end, matrix);
|
|
243
|
+
return [
|
|
244
|
+
{
|
|
245
|
+
name: "g",
|
|
246
|
+
type: "element",
|
|
247
|
+
attributes: {},
|
|
248
|
+
children: [
|
|
249
|
+
{
|
|
250
|
+
name: "line",
|
|
251
|
+
type: "element",
|
|
252
|
+
attributes: {
|
|
253
|
+
"data-type": "infinite-line",
|
|
254
|
+
"data-label": line.label || "",
|
|
255
|
+
"data-origin": `${line.origin.x},${line.origin.y}`,
|
|
256
|
+
"data-direction": `${line.directionVector.x},${line.directionVector.y}`,
|
|
257
|
+
x1: projectedStart.x.toString(),
|
|
258
|
+
y1: projectedStart.y.toString(),
|
|
259
|
+
x2: projectedEnd.x.toString(),
|
|
260
|
+
y2: projectedEnd.y.toString(),
|
|
261
|
+
stroke: line.strokeColor || "black",
|
|
262
|
+
"stroke-width": !line.strokeWidth ? "1px" : typeof line.strokeWidth === "string" ? line.strokeWidth : (strokeScale * line.strokeWidth).toString(),
|
|
263
|
+
...line.strokeDash && {
|
|
264
|
+
"stroke-dasharray": Array.isArray(line.strokeDash) ? line.strokeDash.join(" ") : line.strokeDash
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
...shouldRenderLabel("infiniteLines") && line.label ? [
|
|
269
|
+
{
|
|
270
|
+
name: "text",
|
|
271
|
+
type: "element",
|
|
272
|
+
attributes: {
|
|
273
|
+
x: ((projectedStart.x + projectedEnd.x) / 2 + 5).toString(),
|
|
274
|
+
y: ((projectedStart.y + projectedEnd.y) / 2 - 5).toString(),
|
|
275
|
+
"font-family": "sans-serif",
|
|
276
|
+
"font-size": "12",
|
|
277
|
+
fill: line.strokeColor || "black"
|
|
278
|
+
},
|
|
279
|
+
children: [{ type: "text", value: line.label }]
|
|
280
|
+
}
|
|
281
|
+
] : []
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
];
|
|
285
|
+
}),
|
|
232
286
|
// Rectangles
|
|
233
287
|
...(graphics.rects || []).map((rect) => {
|
|
234
288
|
const corner1 = {
|
|
@@ -358,6 +412,29 @@ function getSvgFromGraphicsObject(graphics, {
|
|
|
358
412
|
const geometry = getArrowGeometry(arrow);
|
|
359
413
|
const projectedShaftStart = projectPoint(geometry.shaftStart, matrix);
|
|
360
414
|
const projectedShaftEnd = projectPoint(geometry.shaftEnd, matrix);
|
|
415
|
+
const fontSize = 12;
|
|
416
|
+
const strokeWidth = geometry.shaftWidth;
|
|
417
|
+
const alongSeparation = fontSize * 0.6;
|
|
418
|
+
const inlineLabelLayout = getInlineLabelLayout(
|
|
419
|
+
projectedShaftStart,
|
|
420
|
+
projectedShaftEnd,
|
|
421
|
+
{
|
|
422
|
+
fontSize,
|
|
423
|
+
strokeWidth,
|
|
424
|
+
normalPadding: 6,
|
|
425
|
+
alongOffset: arrow.label ? alongSeparation : 0
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
const arrowLabelLayout = getInlineLabelLayout(
|
|
429
|
+
projectedShaftStart,
|
|
430
|
+
projectedShaftEnd,
|
|
431
|
+
{
|
|
432
|
+
fontSize,
|
|
433
|
+
strokeWidth,
|
|
434
|
+
normalPadding: 12,
|
|
435
|
+
alongOffset: arrow.inlineLabel ? -alongSeparation : 0
|
|
436
|
+
}
|
|
437
|
+
);
|
|
361
438
|
const color = arrow.color || "black";
|
|
362
439
|
const headChildren = geometry.heads.map((head) => {
|
|
363
440
|
const projectedTip = projectPoint(head.tip, matrix);
|
|
@@ -392,7 +469,42 @@ function getSvgFromGraphicsObject(graphics, {
|
|
|
392
469
|
"stroke-linecap": "round"
|
|
393
470
|
}
|
|
394
471
|
},
|
|
395
|
-
...headChildren
|
|
472
|
+
...headChildren,
|
|
473
|
+
...shouldRenderLabel("arrows") && arrow.label ? [
|
|
474
|
+
{
|
|
475
|
+
name: "text",
|
|
476
|
+
type: "element",
|
|
477
|
+
attributes: {
|
|
478
|
+
"data-type": "arrow-label",
|
|
479
|
+
x: arrowLabelLayout.x.toString(),
|
|
480
|
+
y: arrowLabelLayout.y.toString(),
|
|
481
|
+
"font-family": "sans-serif",
|
|
482
|
+
"font-size": fontSize.toString(),
|
|
483
|
+
"text-anchor": "middle",
|
|
484
|
+
"dominant-baseline": "central",
|
|
485
|
+
fill: color
|
|
486
|
+
},
|
|
487
|
+
children: [{ type: "text", value: arrow.label }]
|
|
488
|
+
}
|
|
489
|
+
] : [],
|
|
490
|
+
...!hideInlineLabels && arrow.inlineLabel ? [
|
|
491
|
+
{
|
|
492
|
+
name: "text",
|
|
493
|
+
type: "element",
|
|
494
|
+
attributes: {
|
|
495
|
+
"data-type": "arrow-inline-label",
|
|
496
|
+
x: inlineLabelLayout.x.toString(),
|
|
497
|
+
y: inlineLabelLayout.y.toString(),
|
|
498
|
+
transform: `rotate(${inlineLabelLayout.angleDegrees} ${inlineLabelLayout.x} ${inlineLabelLayout.y})`,
|
|
499
|
+
"font-family": "sans-serif",
|
|
500
|
+
"font-size": fontSize.toString(),
|
|
501
|
+
"text-anchor": "middle",
|
|
502
|
+
"dominant-baseline": "central",
|
|
503
|
+
fill: color
|
|
504
|
+
},
|
|
505
|
+
children: [{ type: "text", value: arrow.inlineLabel }]
|
|
506
|
+
}
|
|
507
|
+
] : []
|
|
396
508
|
];
|
|
397
509
|
return {
|
|
398
510
|
name: "g",
|
|
@@ -401,7 +513,9 @@ function getSvgFromGraphicsObject(graphics, {
|
|
|
401
513
|
"data-type": "arrow",
|
|
402
514
|
"data-start": `${arrow.start.x},${arrow.start.y}`,
|
|
403
515
|
"data-end": `${arrow.end.x},${arrow.end.y}`,
|
|
404
|
-
"data-double-sided": arrow.doubleSided ? "true" : "false"
|
|
516
|
+
"data-double-sided": arrow.doubleSided ? "true" : "false",
|
|
517
|
+
...arrow.label ? { "data-label": arrow.label } : {},
|
|
518
|
+
...arrow.inlineLabel ? { "data-inline-label": arrow.inlineLabel } : {}
|
|
405
519
|
},
|
|
406
520
|
children
|
|
407
521
|
};
|
|
@@ -557,4 +671,4 @@ function getSvgFromGraphicsObject(graphics, {
|
|
|
557
671
|
export {
|
|
558
672
|
getSvgFromGraphicsObject
|
|
559
673
|
};
|
|
560
|
-
//# sourceMappingURL=chunk-
|
|
674
|
+
//# sourceMappingURL=chunk-TBTTAU4R.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../lib/getSvgFromGraphicsObject.ts"],"sourcesContent":["import { stringify } from \"svgson\"\nimport {\n type Matrix,\n applyToPoint,\n compose,\n identity,\n scale,\n transform,\n translate,\n} from \"transformation-matrix\"\nimport {\n getArrowBoundingBox,\n getArrowGeometry,\n getInlineLabelLayout,\n} from \"./arrowHelpers\"\nimport { FONT_SIZE_HEIGHT_RATIO, FONT_SIZE_WIDTH_RATIO } from \"./constants\"\nimport { clipInfiniteLineToBounds } from \"./infiniteLineHelpers\"\nimport type { GraphicsObject, Point } from \"./types\"\n\nconst DEFAULT_SVG_SIZE = 640\nconst PADDING = 40\n\ninterface Bounds {\n minX: number\n maxX: number\n minY: number\n maxY: number\n}\n\nfunction getBounds(graphics: GraphicsObject): Bounds {\n const points: Point[] = [\n ...(graphics.points || []),\n ...(graphics.lines || []).flatMap((line) => line.points),\n ...(graphics.polygons || []).flatMap((polygon) => polygon.points),\n ...(graphics.rects || []).flatMap((rect) => {\n const halfWidth = rect.width / 2\n const halfHeight = rect.height / 2\n return [\n { x: rect.center.x - halfWidth, y: rect.center.y - halfHeight },\n { x: rect.center.x + halfWidth, y: rect.center.y - halfHeight },\n { x: rect.center.x - halfWidth, y: rect.center.y + halfHeight },\n { x: rect.center.x + halfWidth, y: rect.center.y + halfHeight },\n ]\n }),\n ...(graphics.circles || []).flatMap((circle) => [\n { x: circle.center.x - circle.radius, y: circle.center.y }, // left\n { x: circle.center.x + circle.radius, y: circle.center.y }, // right\n { x: circle.center.x, y: circle.center.y - circle.radius }, // top\n { x: circle.center.x, y: circle.center.y + circle.radius }, // bottom\n ]),\n ...(graphics.arrows || []).flatMap((arrow) => {\n const bounds = getArrowBoundingBox(arrow)\n return [\n { x: bounds.minX, y: bounds.minY },\n { x: bounds.maxX, y: bounds.maxY },\n ]\n }),\n ...(graphics.texts || []).flatMap((t) => {\n const fontSize = t.fontSize ?? 12\n const width = t.text.length * fontSize * FONT_SIZE_WIDTH_RATIO\n const height = fontSize * FONT_SIZE_HEIGHT_RATIO\n const anchor = t.anchorSide ?? \"center\"\n const offsetMap: Record<string, { dx: number; dy: number }> = {\n top_left: { dx: 0, dy: 0 },\n top_center: { dx: -width / 2, dy: 0 },\n top_right: { dx: -width, dy: 0 },\n center_left: { dx: 0, dy: -height / 2 },\n center: { dx: -width / 2, dy: -height / 2 },\n center_right: { dx: -width, dy: -height / 2 },\n bottom_left: { dx: 0, dy: -height },\n bottom_center: { dx: -width / 2, dy: -height },\n bottom_right: { dx: -width, dy: -height },\n }\n const { dx, dy } = offsetMap[anchor]\n const x0 = t.x + dx\n const y0 = t.y + dy\n return [\n { x: x0, y: y0 },\n { x: x0 + width, y: y0 + height },\n ]\n }),\n ]\n\n if (points.length === 0) {\n return { minX: -1, maxX: 1, minY: -1, maxY: 1 }\n }\n\n return points.reduce(\n (bounds, point) => ({\n minX: Math.min(bounds.minX, point.x),\n maxX: Math.max(bounds.maxX, point.x),\n minY: Math.min(bounds.minY, point.y),\n maxY: Math.max(bounds.maxY, point.y),\n }),\n { minX: Infinity, maxX: -Infinity, minY: Infinity, maxY: -Infinity },\n )\n}\n\nfunction getProjectionMatrix(\n bounds: Bounds,\n coordinateSystem: GraphicsObject[\"coordinateSystem\"],\n svgWidth: number,\n svgHeight: number,\n) {\n const width = bounds.maxX - bounds.minX || 1\n const height = bounds.maxY - bounds.minY || 1\n\n const scale_factor = Math.min(\n (svgWidth - 2 * PADDING) / width,\n (svgHeight - 2 * PADDING) / height,\n )\n\n const yFlip = coordinateSystem === \"screen\" ? 1 : -1\n\n return compose(\n translate(svgWidth / 2, svgHeight / 2),\n scale(scale_factor, yFlip * scale_factor),\n translate(-(bounds.minX + width / 2), -(bounds.minY + height / 2)),\n )\n}\n\nfunction projectPoint(point: Point, matrix: Matrix) {\n const projected = applyToPoint(matrix, { x: point.x, y: point.y })\n return { ...point, ...projected }\n}\n\nexport function getSvgFromGraphicsObject(\n graphics: GraphicsObject,\n {\n includeTextLabels = false,\n hideInlineLabels = false,\n backgroundColor = \"white\",\n svgWidth = DEFAULT_SVG_SIZE,\n svgHeight = DEFAULT_SVG_SIZE,\n }: {\n includeTextLabels?:\n | boolean\n | Array<\n \"points\" | \"lines\" | \"infiniteLines\" | \"rects\" | \"polygons\" | \"arrows\"\n >\n backgroundColor?: string | null\n hideInlineLabels?: boolean\n svgWidth?: number\n svgHeight?: number\n } = {},\n): string {\n const bounds = getBounds(graphics)\n const matrix = getProjectionMatrix(\n bounds,\n graphics.coordinateSystem,\n svgWidth,\n svgHeight,\n )\n const strokeScale = Math.abs(matrix.a)\n\n const shouldRenderLabel = (\n type:\n | \"points\"\n | \"lines\"\n | \"infiniteLines\"\n | \"rects\"\n | \"polygons\"\n | \"arrows\",\n ): boolean => {\n if (typeof includeTextLabels === \"boolean\") {\n return includeTextLabels\n }\n if (Array.isArray(includeTextLabels)) {\n return includeTextLabels.includes(type)\n }\n return false\n }\n\n const svgObject = {\n name: \"svg\",\n type: \"element\",\n attributes: {\n width: svgWidth.toString(),\n height: svgHeight.toString(),\n viewBox: `0 0 ${svgWidth} ${svgHeight}`,\n xmlns: \"http://www.w3.org/2000/svg\",\n },\n children: [\n // Background rectangle (optional)\n ...(backgroundColor\n ? [\n {\n name: \"rect\",\n type: \"element\",\n attributes: {\n width: \"100%\",\n height: \"100%\",\n fill: backgroundColor,\n },\n },\n ]\n : []),\n // Points\n ...(graphics.points || []).map((point) => {\n const projected = projectPoint(point, matrix)\n return {\n name: \"g\",\n type: \"element\",\n attributes: {},\n children: [\n {\n name: \"circle\",\n type: \"element\",\n attributes: {\n \"data-type\": \"point\",\n \"data-label\": point.label || \"\",\n \"data-x\": point.x.toString(),\n \"data-y\": point.y.toString(),\n cx: projected.x.toString(),\n cy: projected.y.toString(),\n r: \"3\",\n fill: point.color || \"black\",\n },\n },\n ...(shouldRenderLabel(\"points\") && point.label\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n x: (projected.x + 5).toString(),\n y: (projected.y - 5).toString(),\n \"font-family\": \"sans-serif\",\n \"font-size\": \"12\",\n },\n children: [{ type: \"text\", value: point.label }],\n },\n ]\n : []),\n ],\n }\n }),\n // Lines\n ...(graphics.lines || []).map((line) => {\n const projectedPoints = line.points.map((p) => projectPoint(p, matrix))\n return {\n name: \"g\",\n type: \"element\",\n attributes: {},\n children: [\n {\n name: \"polyline\",\n type: \"element\",\n attributes: {\n \"data-points\": line.points\n .map((p) => `${p.x},${p.y}`)\n .join(\" \"),\n \"data-type\": \"line\",\n \"data-label\": line.label || \"\",\n points: projectedPoints.map((p) => `${p.x},${p.y}`).join(\" \"),\n fill: \"none\",\n stroke: line.strokeColor || \"black\",\n \"stroke-width\": !line.strokeWidth\n ? \"1px\"\n : typeof line.strokeWidth === \"string\"\n ? line.strokeWidth\n : (strokeScale * line.strokeWidth).toString(),\n ...(line.strokeDash && {\n \"stroke-dasharray\": Array.isArray(line.strokeDash)\n ? line.strokeDash.join(\" \")\n : line.strokeDash,\n }),\n },\n },\n ...(shouldRenderLabel(\"lines\") &&\n line.label &&\n projectedPoints.length > 0\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n x: (projectedPoints[0].x + 5).toString(),\n y: (projectedPoints[0].y - 5).toString(),\n \"font-family\": \"sans-serif\",\n \"font-size\": \"12\",\n fill: line.strokeColor || \"black\",\n },\n children: [{ type: \"text\", value: line.label }],\n },\n ]\n : []),\n ],\n }\n }),\n ...(graphics.infiniteLines || []).flatMap((line) => {\n const segment = clipInfiniteLineToBounds(line, bounds)\n if (!segment) return []\n\n const [start, end] = segment\n const projectedStart = projectPoint(start, matrix)\n const projectedEnd = projectPoint(end, matrix)\n\n return [\n {\n name: \"g\",\n type: \"element\",\n attributes: {},\n children: [\n {\n name: \"line\",\n type: \"element\",\n attributes: {\n \"data-type\": \"infinite-line\",\n \"data-label\": line.label || \"\",\n \"data-origin\": `${line.origin.x},${line.origin.y}`,\n \"data-direction\": `${line.directionVector.x},${line.directionVector.y}`,\n x1: projectedStart.x.toString(),\n y1: projectedStart.y.toString(),\n x2: projectedEnd.x.toString(),\n y2: projectedEnd.y.toString(),\n stroke: line.strokeColor || \"black\",\n \"stroke-width\": !line.strokeWidth\n ? \"1px\"\n : typeof line.strokeWidth === \"string\"\n ? line.strokeWidth\n : (strokeScale * line.strokeWidth).toString(),\n ...(line.strokeDash && {\n \"stroke-dasharray\": Array.isArray(line.strokeDash)\n ? line.strokeDash.join(\" \")\n : line.strokeDash,\n }),\n },\n },\n ...(shouldRenderLabel(\"infiniteLines\") && line.label\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n x: (\n (projectedStart.x + projectedEnd.x) / 2 +\n 5\n ).toString(),\n y: (\n (projectedStart.y + projectedEnd.y) / 2 -\n 5\n ).toString(),\n \"font-family\": \"sans-serif\",\n \"font-size\": \"12\",\n fill: line.strokeColor || \"black\",\n },\n children: [{ type: \"text\", value: line.label }],\n },\n ]\n : []),\n ],\n },\n ]\n }),\n // Rectangles\n ...(graphics.rects || []).map((rect) => {\n const corner1 = {\n x: rect.center.x - rect.width / 2,\n y: rect.center.y - rect.height / 2,\n }\n const projectedCorner1 = projectPoint(corner1, matrix)\n const corner2 = {\n x: rect.center.x + rect.width / 2,\n y: rect.center.y + rect.height / 2,\n }\n const projectedCorner2 = projectPoint(corner2, matrix)\n const scaledWidth = Math.abs(projectedCorner2.x - projectedCorner1.x)\n const scaledHeight = Math.abs(projectedCorner2.y - projectedCorner1.y)\n const rectX = Math.min(projectedCorner1.x, projectedCorner2.x)\n const rectY = Math.min(projectedCorner1.y, projectedCorner2.y)\n\n return {\n name: \"g\",\n type: \"element\",\n attributes: {},\n children: [\n {\n name: \"rect\",\n type: \"element\",\n attributes: {\n \"data-type\": \"rect\",\n \"data-label\": rect.label || \"\",\n \"data-x\": rect.center.x.toString(),\n \"data-y\": rect.center.y.toString(),\n x: rectX.toString(),\n y: rectY.toString(),\n width: scaledWidth.toString(),\n height: scaledHeight.toString(),\n fill: rect.fill || \"none\",\n stroke: rect.stroke || \"black\",\n \"stroke-width\": Math.abs(1 / matrix.a).toString(), // Consider scaling stroke width like lines if needed\n },\n },\n ...(shouldRenderLabel(\"rects\") && rect.label\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n x: (rectX + 5).toString(),\n y: rectY.toString(),\n \"font-family\": \"sans-serif\",\n \"dominant-baseline\": \"text-before-edge\",\n \"font-size\": (\n ((scaledWidth + scaledHeight) / 2) *\n 0.06\n ).toString(),\n fill: rect.stroke || \"black\", // Default to stroke color for label\n },\n children: [{ type: \"text\", value: rect.label }],\n },\n ]\n : []),\n ],\n }\n }),\n // Polygons\n ...(graphics.polygons || []).map((polygon) => {\n const projectedPoints = polygon.points.map((point) =>\n projectPoint(point, matrix),\n )\n const xs = projectedPoints.map((p) => p.x)\n const ys = projectedPoints.map((p) => p.y)\n const minX = xs.length > 0 ? Math.min(...xs) : 0\n const minY = ys.length > 0 ? Math.min(...ys) : 0\n const polygonStrokeWidth =\n polygon.strokeWidth === undefined\n ? Math.abs(1 / matrix.a)\n : strokeScale * polygon.strokeWidth\n\n return {\n name: \"g\",\n type: \"element\",\n attributes: {},\n children: [\n {\n name: \"polygon\",\n type: \"element\",\n attributes: {\n \"data-type\": \"polygon\",\n \"data-label\": polygon.label || \"\",\n \"data-points\": polygon.points\n .map((p) => `${p.x},${p.y}`)\n .join(\" \"),\n points: projectedPoints.map((p) => `${p.x},${p.y}`).join(\" \"),\n fill: polygon.fill || \"none\",\n stroke: polygon.stroke || \"black\",\n \"stroke-width\": polygonStrokeWidth.toString(),\n },\n },\n ...(shouldRenderLabel(\"polygons\") && polygon.label\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n x: (minX + 5).toString(),\n y: minY.toString(),\n \"font-family\": \"sans-serif\",\n \"dominant-baseline\": \"text-before-edge\",\n \"font-size\": \"12\",\n fill: polygon.stroke || \"black\",\n },\n children: [{ type: \"text\", value: polygon.label }],\n },\n ]\n : []),\n ],\n }\n }),\n // Circles\n ...(graphics.circles || []).map((circle) => {\n const projected = projectPoint(circle.center, matrix)\n const scaledRadius = circle.radius * Math.abs(matrix.a)\n return {\n name: \"circle\",\n type: \"element\",\n attributes: {\n \"data-type\": \"circle\",\n \"data-label\": \"\",\n \"data-x\": circle.center.x.toString(),\n \"data-y\": circle.center.y.toString(),\n cx: projected.x.toString(),\n cy: projected.y.toString(),\n r: scaledRadius.toString(),\n fill: circle.fill || \"none\",\n stroke: circle.stroke || \"black\",\n \"stroke-width\": Math.abs(1 / matrix.a).toString(),\n },\n }\n }),\n ...(graphics.arrows || []).map((arrow) => {\n const geometry = getArrowGeometry(arrow)\n const projectedShaftStart = projectPoint(geometry.shaftStart, matrix)\n const projectedShaftEnd = projectPoint(geometry.shaftEnd, matrix)\n const fontSize = 12\n const strokeWidth = geometry.shaftWidth\n const alongSeparation = fontSize * 0.6\n const inlineLabelLayout = getInlineLabelLayout(\n projectedShaftStart,\n projectedShaftEnd,\n {\n fontSize,\n strokeWidth,\n normalPadding: 6,\n alongOffset: arrow.label ? alongSeparation : 0,\n },\n )\n const arrowLabelLayout = getInlineLabelLayout(\n projectedShaftStart,\n projectedShaftEnd,\n {\n fontSize,\n strokeWidth,\n normalPadding: 12,\n alongOffset: arrow.inlineLabel ? -alongSeparation : 0,\n },\n )\n\n const color = arrow.color || \"black\"\n\n const headChildren = geometry.heads.map((head) => {\n const projectedTip = projectPoint(head.tip, matrix)\n const projectedLeftWing = projectPoint(head.leftWing, matrix)\n const projectedRightWing = projectPoint(head.rightWing, matrix)\n\n return {\n name: \"polygon\",\n type: \"element\",\n attributes: {\n \"data-type\": \"arrow-head\",\n points: [\n `${projectedTip.x},${projectedTip.y}`,\n `${projectedLeftWing.x},${projectedLeftWing.y}`,\n `${projectedRightWing.x},${projectedRightWing.y}`,\n ].join(\" \"),\n fill: color,\n },\n }\n })\n\n const children = [\n {\n name: \"line\",\n type: \"element\",\n attributes: {\n \"data-type\": \"arrow-shaft\",\n x1: projectedShaftStart.x.toString(),\n y1: projectedShaftStart.y.toString(),\n x2: projectedShaftEnd.x.toString(),\n y2: projectedShaftEnd.y.toString(),\n stroke: color,\n \"stroke-width\": geometry.shaftWidth.toString(),\n \"stroke-linecap\": \"round\",\n },\n },\n ...headChildren,\n ...(shouldRenderLabel(\"arrows\") && arrow.label\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n \"data-type\": \"arrow-label\",\n x: arrowLabelLayout.x.toString(),\n y: arrowLabelLayout.y.toString(),\n \"font-family\": \"sans-serif\",\n \"font-size\": fontSize.toString(),\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": \"central\",\n fill: color,\n },\n children: [{ type: \"text\", value: arrow.label }],\n },\n ]\n : []),\n ...(!hideInlineLabels && arrow.inlineLabel\n ? [\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n \"data-type\": \"arrow-inline-label\",\n x: inlineLabelLayout.x.toString(),\n y: inlineLabelLayout.y.toString(),\n transform: `rotate(${inlineLabelLayout.angleDegrees} ${inlineLabelLayout.x} ${inlineLabelLayout.y})`,\n \"font-family\": \"sans-serif\",\n \"font-size\": fontSize.toString(),\n \"text-anchor\": \"middle\",\n \"dominant-baseline\": \"central\",\n fill: color,\n },\n children: [{ type: \"text\", value: arrow.inlineLabel }],\n },\n ]\n : []),\n ]\n\n return {\n name: \"g\",\n type: \"element\",\n attributes: {\n \"data-type\": \"arrow\",\n \"data-start\": `${arrow.start.x},${arrow.start.y}`,\n \"data-end\": `${arrow.end.x},${arrow.end.y}`,\n \"data-double-sided\": arrow.doubleSided ? \"true\" : \"false\",\n ...(arrow.label ? { \"data-label\": arrow.label } : {}),\n ...(arrow.inlineLabel\n ? { \"data-inline-label\": arrow.inlineLabel }\n : {}),\n },\n children,\n }\n }),\n // Texts\n ...(graphics.texts || []).map((txt) => {\n const projected = projectPoint({ x: txt.x, y: txt.y }, matrix)\n const anchor = txt.anchorSide ?? \"center\"\n const alignMap: Record<string, string> = {\n top_left: \"start\",\n center_left: \"start\",\n bottom_left: \"start\",\n top_center: \"middle\",\n center: \"middle\",\n bottom_center: \"middle\",\n top_right: \"end\",\n center_right: \"end\",\n bottom_right: \"end\",\n }\n const baselineMap: Record<string, string> = {\n top_left: \"text-before-edge\",\n top_center: \"text-before-edge\",\n top_right: \"text-before-edge\",\n center_left: \"central\",\n center: \"central\",\n center_right: \"central\",\n bottom_left: \"text-after-edge\",\n bottom_center: \"text-after-edge\",\n bottom_right: \"text-after-edge\",\n }\n return {\n name: \"text\",\n type: \"element\",\n attributes: {\n \"data-type\": \"text\",\n \"data-label\": txt.text,\n \"data-x\": txt.x.toString(),\n \"data-y\": txt.y.toString(),\n x: projected.x.toString(),\n y: projected.y.toString(),\n fill: txt.color || \"black\",\n \"font-size\": ((txt.fontSize ?? 12) * Math.abs(matrix.a)).toString(),\n \"font-family\": \"sans-serif\",\n \"text-anchor\": alignMap[anchor],\n \"dominant-baseline\": baselineMap[anchor],\n },\n children: [{ type: \"text\", value: txt.text }],\n }\n }),\n // Crosshair lines and coordinates (initially hidden)\n {\n name: \"g\",\n type: \"element\",\n attributes: {\n id: \"crosshair\",\n style: \"display: none\",\n },\n children: [\n {\n name: \"line\",\n type: \"element\",\n attributes: {\n id: \"crosshair-h\",\n y1: \"0\",\n y2: svgHeight.toString(),\n stroke: \"#666\",\n \"stroke-width\": \"0.5\",\n },\n },\n {\n name: \"line\",\n type: \"element\",\n attributes: {\n id: \"crosshair-v\",\n x1: \"0\",\n x2: svgWidth.toString(),\n stroke: \"#666\",\n \"stroke-width\": \"0.5\",\n },\n },\n {\n name: \"text\",\n type: \"element\",\n attributes: {\n id: \"coordinates\",\n \"font-family\": \"monospace\",\n \"font-size\": \"12\",\n fill: \"#666\",\n },\n children: [{ type: \"text\", value: \"\" }],\n },\n ],\n },\n // Mouse tracking script\n {\n name: \"script\",\n type: \"element\",\n children: [\n {\n type: \"text\",\n value: `\n document.currentScript.parentElement.addEventListener('mousemove', (e) => {\n const svg = e.currentTarget;\n const rect = svg.getBoundingClientRect();\n const x = e.clientX - rect.left;\n const y = e.clientY - rect.top;\n const crosshair = svg.getElementById('crosshair');\n const h = svg.getElementById('crosshair-h');\n const v = svg.getElementById('crosshair-v');\n const coords = svg.getElementById('coordinates');\n \n crosshair.style.display = 'block';\n h.setAttribute('x1', '0');\n h.setAttribute('x2', '${svgWidth}');\n h.setAttribute('y1', y);\n h.setAttribute('y2', y);\n v.setAttribute('x1', x);\n v.setAttribute('x2', x);\n v.setAttribute('y1', '0');\n v.setAttribute('y2', '${svgHeight}');\n\n // Calculate real coordinates using inverse transformation\n const matrix = ${JSON.stringify(matrix)};\n // Manually invert and apply the affine transform\n // Since we only use translate and scale, we can directly compute:\n // x' = (x - tx) / sx\n // y' = (y - ty) / sy\n const sx = matrix.a;\n const sy = matrix.d;\n const tx = matrix.e; \n const ty = matrix.f;\n const realPoint = {\n x: (x - tx) / sx,\n y: (y - ty) / sy // Flip y back since we used negative scale\n }\n \n coords.textContent = \\`(\\${realPoint.x.toFixed(2)}, \\${realPoint.y.toFixed(2)})\\`;\n coords.setAttribute('x', (x + 5).toString());\n coords.setAttribute('y', (y - 5).toString());\n });\n document.currentScript.parentElement.addEventListener('mouseleave', () => {\n document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';\n });\n `,\n },\n ],\n },\n ],\n }\n\n // biome-ignore lint/suspicious/noExplicitAny: TODO\n return stringify(svgObject as any)\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OACK;AAUP,IAAM,mBAAmB;AACzB,IAAM,UAAU;AAShB,SAAS,UAAU,UAAkC;AACnD,QAAM,SAAkB;AAAA,IACtB,GAAI,SAAS,UAAU,CAAC;AAAA,IACxB,IAAI,SAAS,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS,KAAK,MAAM;AAAA,IACvD,IAAI,SAAS,YAAY,CAAC,GAAG,QAAQ,CAAC,YAAY,QAAQ,MAAM;AAAA,IAChE,IAAI,SAAS,SAAS,CAAC,GAAG,QAAQ,CAAC,SAAS;AAC1C,YAAM,YAAY,KAAK,QAAQ;AAC/B,YAAM,aAAa,KAAK,SAAS;AACjC,aAAO;AAAA,QACL,EAAE,GAAG,KAAK,OAAO,IAAI,WAAW,GAAG,KAAK,OAAO,IAAI,WAAW;AAAA,QAC9D,EAAE,GAAG,KAAK,OAAO,IAAI,WAAW,GAAG,KAAK,OAAO,IAAI,WAAW;AAAA,QAC9D,EAAE,GAAG,KAAK,OAAO,IAAI,WAAW,GAAG,KAAK,OAAO,IAAI,WAAW;AAAA,QAC9D,EAAE,GAAG,KAAK,OAAO,IAAI,WAAW,GAAG,KAAK,OAAO,IAAI,WAAW;AAAA,MAChE;AAAA,IACF,CAAC;AAAA,IACD,IAAI,SAAS,WAA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;AAAA;AAAA,wCAaqB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAMR,SAAS;AAAA;AAAA;AAAA,iCAGhB,KAAK,UAAU,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAsB7C;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAGA,SAAO,UAAU,SAAgB;AACnC;","names":[]}
|
package/dist/cli/cli.js
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getHtmlFromLogString,
|
|
4
4
|
getSvgsFromLogString
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-5O6JHGHI.js";
|
|
6
|
+
import "../chunk-OB4CGOL3.js";
|
|
7
|
+
import "../chunk-PEHHGMS7.js";
|
|
8
|
+
import "../chunk-K37Y2KHE.js";
|
|
9
|
+
import "../chunk-7236NVI2.js";
|
|
10
|
+
import "../chunk-ME47RV6O.js";
|
|
11
11
|
import {
|
|
12
12
|
getGraphicsObjectsFromLogString
|
|
13
13
|
} from "../chunk-NG6H63SM.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-TBTTAU4R.js";
|
|
15
|
+
import "../chunk-PCHDJSKZ.js";
|
|
16
16
|
import "../chunk-ZGI74PYD.js";
|
|
17
|
+
import "../chunk-FLFF6QXL.js";
|
|
17
18
|
|
|
18
19
|
// cli/cli.ts
|
|
19
20
|
import { parseArgs } from "util";
|
package/dist/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../cli/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from \"node:util\"\nimport { readFileSync } from \"node:fs\"\nimport { writeFileSync } from \"node:fs\"\nimport {\n getSvgsFromLogString,\n getHtmlFromLogString,\n getGraphicsObjectsFromLogString,\n} from \"../lib\"\n\nasync function getInput(): Promise<string> {\n // Check if there's data being piped in\n if (process.stdin.isTTY && process.stderr.isTTY) {\n console.error(\n \"Error: No input provided. Pipe in content with graphics objects.\",\n )\n process.exit(1)\n }\n\n const chunks = []\n\n // Read from stdin if available\n if (!process.stdin.isTTY) {\n for await (const chunk of process.stdin) {\n chunks.push(chunk)\n }\n }\n\n return chunks.join(\"\")\n}\n\nasync function main() {\n const { values } = parseArgs({\n options: {\n html: { type: \"boolean\" },\n url: { type: \"boolean\" },\n help: { type: \"boolean\" },\n },\n })\n\n if (values.help) {\n console.log(`\nUsage: graphics-debug [options]\n\nOptions:\n --html Output a single HTML file with all graphics\n --url Print a url to view the graphics in a browser\n --help Show this help message\n\nExamples:\n cat debug.log | graphics-debug\n echo '{ graphics: { points: [{x: 0, y: 0}] } }' | graphics-debug --html\n `)\n process.exit(0)\n }\n\n const input = await getInput()\n\n if (values.html) {\n const html = getHtmlFromLogString(input)\n writeFileSync(\"graphicsdebug.debug.html\", html)\n console.log('Wrote to \"graphicsdebug.debug.html\"')\n } else if (values.url) {\n const graphicsObjects = getGraphicsObjectsFromLogString(input)\n if (graphicsObjects.length === 0) {\n console.error(\"No graphics objects found in input\")\n process.exit(0)\n }\n\n const { url } = await fetch(\"https://gdstore.seve.workers.dev/store\", {\n method: \"POST\",\n body: JSON.stringify({\n graphicsObjects: getGraphicsObjectsFromLogString(input),\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }).then((res) => res.json())\n\n const token = url.split(\"/get/\").pop()\n\n console.log(`https://graphicsdebug.com/t/${token}`)\n } else {\n const svgs = getSvgsFromLogString(input)\n svgs.forEach((svg, i) => {\n const filename = `${svg.title.toLowerCase().replace(/\\s+/g, \"-\")}-${i + 1}.debug.svg`\n writeFileSync(filename, svg.svg)\n console.log(`Wrote to \"${filename}\"`)\n })\n }\n}\n\nmain().catch((err) => {\n console.error(\"Error:\", err)\n process.exit(1)\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../cli/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { parseArgs } from \"node:util\"\nimport { readFileSync } from \"node:fs\"\nimport { writeFileSync } from \"node:fs\"\nimport {\n getSvgsFromLogString,\n getHtmlFromLogString,\n getGraphicsObjectsFromLogString,\n} from \"../lib\"\n\nasync function getInput(): Promise<string> {\n // Check if there's data being piped in\n if (process.stdin.isTTY && process.stderr.isTTY) {\n console.error(\n \"Error: No input provided. Pipe in content with graphics objects.\",\n )\n process.exit(1)\n }\n\n const chunks = []\n\n // Read from stdin if available\n if (!process.stdin.isTTY) {\n for await (const chunk of process.stdin) {\n chunks.push(chunk)\n }\n }\n\n return chunks.join(\"\")\n}\n\nasync function main() {\n const { values } = parseArgs({\n options: {\n html: { type: \"boolean\" },\n url: { type: \"boolean\" },\n help: { type: \"boolean\" },\n },\n })\n\n if (values.help) {\n console.log(`\nUsage: graphics-debug [options]\n\nOptions:\n --html Output a single HTML file with all graphics\n --url Print a url to view the graphics in a browser\n --help Show this help message\n\nExamples:\n cat debug.log | graphics-debug\n echo '{ graphics: { points: [{x: 0, y: 0}] } }' | graphics-debug --html\n `)\n process.exit(0)\n }\n\n const input = await getInput()\n\n if (values.html) {\n const html = getHtmlFromLogString(input)\n writeFileSync(\"graphicsdebug.debug.html\", html)\n console.log('Wrote to \"graphicsdebug.debug.html\"')\n } else if (values.url) {\n const graphicsObjects = getGraphicsObjectsFromLogString(input)\n if (graphicsObjects.length === 0) {\n console.error(\"No graphics objects found in input\")\n process.exit(0)\n }\n\n const { url } = await fetch(\"https://gdstore.seve.workers.dev/store\", {\n method: \"POST\",\n body: JSON.stringify({\n graphicsObjects: getGraphicsObjectsFromLogString(input),\n }),\n headers: {\n \"Content-Type\": \"application/json\",\n },\n }).then((res) => res.json())\n\n const token = url.split(\"/get/\").pop()\n\n console.log(`https://graphicsdebug.com/t/${token}`)\n } else {\n const svgs = getSvgsFromLogString(input)\n svgs.forEach((svg, i) => {\n const filename = `${svg.title.toLowerCase().replace(/\\s+/g, \"-\")}-${i + 1}.debug.svg`\n writeFileSync(filename, svg.svg)\n console.log(`Wrote to \"${filename}\"`)\n })\n }\n}\n\nmain().catch((err) => {\n console.error(\"Error:\", err)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA,SAAS,iBAAiB;AAE1B,SAAS,qBAAqB;AAO9B,eAAe,WAA4B;AAEzC,MAAI,QAAQ,MAAM,SAAS,QAAQ,OAAO,OAAO;AAC/C,YAAQ;AAAA,MACN;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,SAAS,CAAC;AAGhB,MAAI,CAAC,QAAQ,MAAM,OAAO;AACxB,qBAAiB,SAAS,QAAQ,OAAO;AACvC,aAAO,KAAK,KAAK;AAAA,IACnB;AAAA,EACF;AAEA,SAAO,OAAO,KAAK,EAAE;AACvB;AAEA,eAAe,OAAO;AACpB,QAAM,EAAE,OAAO,IAAI,UAAU;AAAA,IAC3B,SAAS;AAAA,MACP,MAAM,EAAE,MAAM,UAAU;AAAA,MACxB,KAAK,EAAE,MAAM,UAAU;AAAA,MACvB,MAAM,EAAE,MAAM,UAAU;AAAA,IAC1B;AAAA,EACF,CAAC;AAED,MAAI,OAAO,MAAM;AACf,YAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAWX;AACD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,QAAQ,MAAM,SAAS;AAE7B,MAAI,OAAO,MAAM;AACf,UAAM,OAAO,qBAAqB,KAAK;AACvC,kBAAc,4BAA4B,IAAI;AAC9C,YAAQ,IAAI,qCAAqC;AAAA,EACnD,WAAW,OAAO,KAAK;AACrB,UAAM,kBAAkB,gCAAgC,KAAK;AAC7D,QAAI,gBAAgB,WAAW,GAAG;AAChC,cAAQ,MAAM,oCAAoC;AAClD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,EAAE,IAAI,IAAI,MAAM,MAAM,0CAA0C;AAAA,MACpE,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU;AAAA,QACnB,iBAAiB,gCAAgC,KAAK;AAAA,MACxD,CAAC;AAAA,MACD,SAAS;AAAA,QACP,gBAAgB;AAAA,MAClB;AAAA,IACF,CAAC,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC;AAE3B,UAAM,QAAQ,IAAI,MAAM,OAAO,EAAE,IAAI;AAErC,YAAQ,IAAI,+BAA+B,KAAK,EAAE;AAAA,EACpD,OAAO;AACL,UAAM,OAAO,qBAAqB,KAAK;AACvC,SAAK,QAAQ,CAAC,KAAK,MAAM;AACvB,YAAM,WAAW,GAAG,IAAI,MAAM,YAAY,EAAE,QAAQ,QAAQ,GAAG,CAAC,IAAI,IAAI,CAAC;AACzE,oBAAc,UAAU,IAAI,GAAG;AAC/B,cAAQ,IAAI,aAAa,QAAQ,GAAG;AAAA,IACtC,CAAC;AAAA,EACH;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,UAAU,GAAG;AAC3B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
|
|
@@ -34,6 +34,20 @@ type ArrowGeometry = {
|
|
|
34
34
|
headWidth: number;
|
|
35
35
|
length: number;
|
|
36
36
|
};
|
|
37
|
+
type InlineLabelLayout = {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
angleRadians: number;
|
|
41
|
+
angleDegrees: number;
|
|
42
|
+
direction: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
};
|
|
46
|
+
normal: {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
37
51
|
declare function getArrowGeometry(arrow: Arrow): ArrowGeometry;
|
|
38
52
|
declare function getArrowBoundingBox(arrow: Arrow): {
|
|
39
53
|
minX: number;
|
|
@@ -41,5 +55,17 @@ declare function getArrowBoundingBox(arrow: Arrow): {
|
|
|
41
55
|
minY: number;
|
|
42
56
|
maxY: number;
|
|
43
57
|
};
|
|
58
|
+
declare function getInlineLabelLayout(shaftStart: {
|
|
59
|
+
x: number;
|
|
60
|
+
y: number;
|
|
61
|
+
}, shaftEnd: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}, { fontSize, strokeWidth, normalPadding, alongOffset, }?: {
|
|
65
|
+
fontSize?: number;
|
|
66
|
+
strokeWidth?: number;
|
|
67
|
+
normalPadding?: number;
|
|
68
|
+
alongOffset?: number;
|
|
69
|
+
}): InlineLabelLayout;
|
|
44
70
|
|
|
45
|
-
export { type ArrowGeometry, type ArrowHeadGeometry, getArrowBoundingBox, getArrowGeometry };
|
|
71
|
+
export { type ArrowGeometry, type ArrowHeadGeometry, type InlineLabelLayout, getArrowBoundingBox, getArrowGeometry, getInlineLabelLayout };
|
package/dist/lib/arrowHelpers.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getArrowBoundingBox,
|
|
3
|
-
getArrowGeometry
|
|
4
|
-
|
|
3
|
+
getArrowGeometry,
|
|
4
|
+
getInlineLabelLayout
|
|
5
|
+
} from "../chunk-PCHDJSKZ.js";
|
|
5
6
|
export {
|
|
6
7
|
getArrowBoundingBox,
|
|
7
|
-
getArrowGeometry
|
|
8
|
+
getArrowGeometry,
|
|
9
|
+
getInlineLabelLayout
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=arrowHelpers.js.map
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
computeTransformFromViewbox,
|
|
3
3
|
drawGraphicsToCanvas,
|
|
4
4
|
getBounds
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-ME47RV6O.js";
|
|
6
|
+
import "../chunk-PCHDJSKZ.js";
|
|
7
7
|
import "../chunk-ZGI74PYD.js";
|
|
8
|
+
import "../chunk-FLFF6QXL.js";
|
|
8
9
|
export {
|
|
9
10
|
computeTransformFromViewbox,
|
|
10
11
|
drawGraphicsToCanvas,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { GraphicsObject } from './types.js';
|
|
2
2
|
import 'transformation-matrix';
|
|
3
3
|
|
|
4
|
-
declare function getSvgFromGraphicsObject(graphics: GraphicsObject, { includeTextLabels, backgroundColor, svgWidth, svgHeight, }?: {
|
|
5
|
-
includeTextLabels?: boolean | Array<"points" | "lines" | "rects" | "polygons">;
|
|
4
|
+
declare function getSvgFromGraphicsObject(graphics: GraphicsObject, { includeTextLabels, hideInlineLabels, backgroundColor, svgWidth, svgHeight, }?: {
|
|
5
|
+
includeTextLabels?: boolean | Array<"points" | "lines" | "infiniteLines" | "rects" | "polygons" | "arrows">;
|
|
6
6
|
backgroundColor?: string | null;
|
|
7
|
+
hideInlineLabels?: boolean;
|
|
7
8
|
svgWidth?: number;
|
|
8
9
|
svgHeight?: number;
|
|
9
10
|
}): string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSvgFromGraphicsObject
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-TBTTAU4R.js";
|
|
4
|
+
import "../chunk-PCHDJSKZ.js";
|
|
5
5
|
import "../chunk-ZGI74PYD.js";
|
|
6
|
+
import "../chunk-FLFF6QXL.js";
|
|
6
7
|
export {
|
|
7
8
|
getSvgFromGraphicsObject
|
|
8
9
|
};
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Arrow, CenterViewbox, Circle, GraphicsObject, Line, NinePointAnchor, Point, Polygon, Rect, Text, TransformOptions, Viewbox } from './types.js';
|
|
1
|
+
export { Arrow, CenterViewbox, Circle, GraphicsObject, InfiniteLine, Line, NinePointAnchor, Point, Polygon, Rect, Text, TransformOptions, Viewbox } from './types.js';
|
|
2
2
|
export { getGraphicsObjectsFromLogString } from './getGraphicsObjectsFromLogString.js';
|
|
3
3
|
export { getSvgFromGraphicsObject } from './getSvgFromGraphicsObject.js';
|
|
4
4
|
export { computeTransformFromViewbox, drawGraphicsToCanvas, getBounds } from './drawGraphicsToCanvas.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -2,37 +2,38 @@ import {
|
|
|
2
2
|
getHtmlFromLogString,
|
|
3
3
|
getSvgFromLogString,
|
|
4
4
|
getSvgsFromLogString
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-5O6JHGHI.js";
|
|
6
6
|
import {
|
|
7
7
|
setStepOfAllObjects
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-OB4CGOL3.js";
|
|
9
9
|
import {
|
|
10
10
|
createGraphicsGrid,
|
|
11
11
|
stackGraphicsHorizontally,
|
|
12
12
|
stackGraphicsVertically
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-PEHHGMS7.js";
|
|
14
14
|
import {
|
|
15
15
|
mergeGraphics
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-K37Y2KHE.js";
|
|
17
17
|
import {
|
|
18
18
|
translateGraphics
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-7236NVI2.js";
|
|
20
20
|
import {
|
|
21
21
|
computeTransformFromViewbox,
|
|
22
22
|
drawGraphicsToCanvas,
|
|
23
23
|
getBounds
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-ME47RV6O.js";
|
|
25
25
|
import {
|
|
26
26
|
getGraphicsObjectsFromLogString
|
|
27
27
|
} from "../chunk-NG6H63SM.js";
|
|
28
28
|
import {
|
|
29
29
|
getSvgFromGraphicsObject
|
|
30
|
-
} from "../chunk-
|
|
31
|
-
import "../chunk-
|
|
30
|
+
} from "../chunk-TBTTAU4R.js";
|
|
31
|
+
import "../chunk-PCHDJSKZ.js";
|
|
32
32
|
import {
|
|
33
33
|
FONT_SIZE_HEIGHT_RATIO,
|
|
34
34
|
FONT_SIZE_WIDTH_RATIO
|
|
35
35
|
} from "../chunk-ZGI74PYD.js";
|
|
36
|
+
import "../chunk-FLFF6QXL.js";
|
|
36
37
|
export {
|
|
37
38
|
FONT_SIZE_HEIGHT_RATIO,
|
|
38
39
|
FONT_SIZE_WIDTH_RATIO,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Matrix } from 'transformation-matrix';
|
|
2
|
+
import { InfiniteLine, Viewbox, Point } from './types.js';
|
|
3
|
+
|
|
4
|
+
declare function clipInfiniteLineToBounds(infiniteLine: InfiniteLine, bounds: Viewbox): [Point, Point] | null;
|
|
5
|
+
declare function getViewportBoundsFromMatrix(matrix: Matrix, width: number, height: number): Viewbox;
|
|
6
|
+
|
|
7
|
+
export { clipInfiniteLineToBounds, getViewportBoundsFromMatrix };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/lib/matcher.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSvgFromGraphicsObject
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-TBTTAU4R.js";
|
|
4
|
+
import "../chunk-PCHDJSKZ.js";
|
|
5
5
|
import "../chunk-ZGI74PYD.js";
|
|
6
|
+
import "../chunk-FLFF6QXL.js";
|
|
6
7
|
|
|
7
8
|
// lib/matcher.ts
|
|
8
9
|
import { expect } from "bun:test";
|
package/dist/lib/matcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../lib/matcher.ts"],"sourcesContent":["import { expect, type MatcherResult } from \"bun:test\"\nimport * as fs from \"node:fs\"\nimport * as path from \"node:path\"\nimport looksSame from \"looks-same\"\nimport { GraphicsObject } from \"./types\"\nimport { getSvgFromGraphicsObject } from \"./getSvgFromGraphicsObject\"\n\n/**\n * Custom matcher for Bun tests to compare GraphicsObjects as SVGs\n *\n * @param this Matcher context\n * @param receivedMaybePromise GraphicsObject or Promise<GraphicsObject> to test\n * @param testPathOriginal Path to the test file\n * @param svgName Optional name for the snapshot\n * @returns Matcher result\n */\nasync function toMatchGraphicsSvg(\n // biome-ignore lint/suspicious/noExplicitAny: bun doesn't expose matcher type\n this: any,\n receivedMaybePromise: GraphicsObject | Promise<GraphicsObject>,\n testPathOriginal: string,\n opts: { backgroundColor?: string; svgName?: string } = {},\n): Promise<MatcherResult> {\n const received = await receivedMaybePromise\n const testPath = testPathOriginal.replace(/\\.test\\.tsx?$/, \"\")\n const snapshotDir = path.join(path.dirname(testPath), \"__snapshots__\")\n const snapshotName = opts.svgName\n ? `${opts.svgName}.snap.svg`\n : `${path.basename(testPath)}.snap.svg`\n const filePath = path.join(snapshotDir, snapshotName)\n\n if (!fs.existsSync(snapshotDir)) {\n fs.mkdirSync(snapshotDir, { recursive: true })\n }\n\n // Convert GraphicsObject to SVG\n const receivedSvg = getSvgFromGraphicsObject(received, {\n backgroundColor: opts.backgroundColor,\n })\n\n const updateSnapshot =\n process.argv.includes(\"--update-snapshots\") ||\n process.argv.includes(\"-u\") ||\n Boolean(process.env[\"BUN_UPDATE_SNAPSHOTS\"])\n\n if (!fs.existsSync(filePath) || updateSnapshot) {\n console.log(\"Writing snapshot to\", filePath)\n fs.writeFileSync(filePath, receivedSvg)\n return {\n message: () => `Snapshot created at ${filePath}`,\n pass: true,\n }\n }\n\n const existingSnapshot = fs.readFileSync(filePath, \"utf-8\")\n\n const result: any = await looksSame(\n Buffer.from(receivedSvg),\n Buffer.from(existingSnapshot),\n {\n strict: false,\n tolerance: 2,\n },\n )\n\n if (result.equal) {\n return {\n message: () => \"Snapshot matches\",\n pass: true,\n }\n }\n\n const diffPath = filePath.replace(\".snap.svg\", \".diff.png\")\n await looksSame.createDiff({\n reference: Buffer.from(existingSnapshot),\n current: Buffer.from(receivedSvg),\n diff: diffPath,\n highlightColor: \"#ff00ff\",\n })\n\n return {\n message: () => `Snapshot does not match. Diff saved at ${diffPath}`,\n pass: false,\n }\n}\n\n// Add the custom matcher to the expect object\nexpect.extend({\n // biome-ignore lint/suspicious/noExplicitAny: bun's types don't expose matcher type\n toMatchGraphicsSvg: toMatchGraphicsSvg as any,\n})\n\n// Extend the TypeScript interface for the matcher\ndeclare module \"bun:test\" {\n interface Matchers<T = unknown> {\n toMatchGraphicsSvg(\n testPath: string,\n opts?: { backgroundColor?: string; svgName?: string },\n ): Promise<MatcherResult>\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../lib/matcher.ts"],"sourcesContent":["import { expect, type MatcherResult } from \"bun:test\"\nimport * as fs from \"node:fs\"\nimport * as path from \"node:path\"\nimport looksSame from \"looks-same\"\nimport { GraphicsObject } from \"./types\"\nimport { getSvgFromGraphicsObject } from \"./getSvgFromGraphicsObject\"\n\n/**\n * Custom matcher for Bun tests to compare GraphicsObjects as SVGs\n *\n * @param this Matcher context\n * @param receivedMaybePromise GraphicsObject or Promise<GraphicsObject> to test\n * @param testPathOriginal Path to the test file\n * @param svgName Optional name for the snapshot\n * @returns Matcher result\n */\nasync function toMatchGraphicsSvg(\n // biome-ignore lint/suspicious/noExplicitAny: bun doesn't expose matcher type\n this: any,\n receivedMaybePromise: GraphicsObject | Promise<GraphicsObject>,\n testPathOriginal: string,\n opts: { backgroundColor?: string; svgName?: string } = {},\n): Promise<MatcherResult> {\n const received = await receivedMaybePromise\n const testPath = testPathOriginal.replace(/\\.test\\.tsx?$/, \"\")\n const snapshotDir = path.join(path.dirname(testPath), \"__snapshots__\")\n const snapshotName = opts.svgName\n ? `${opts.svgName}.snap.svg`\n : `${path.basename(testPath)}.snap.svg`\n const filePath = path.join(snapshotDir, snapshotName)\n\n if (!fs.existsSync(snapshotDir)) {\n fs.mkdirSync(snapshotDir, { recursive: true })\n }\n\n // Convert GraphicsObject to SVG\n const receivedSvg = getSvgFromGraphicsObject(received, {\n backgroundColor: opts.backgroundColor,\n })\n\n const updateSnapshot =\n process.argv.includes(\"--update-snapshots\") ||\n process.argv.includes(\"-u\") ||\n Boolean(process.env[\"BUN_UPDATE_SNAPSHOTS\"])\n\n if (!fs.existsSync(filePath) || updateSnapshot) {\n console.log(\"Writing snapshot to\", filePath)\n fs.writeFileSync(filePath, receivedSvg)\n return {\n message: () => `Snapshot created at ${filePath}`,\n pass: true,\n }\n }\n\n const existingSnapshot = fs.readFileSync(filePath, \"utf-8\")\n\n const result: any = await looksSame(\n Buffer.from(receivedSvg),\n Buffer.from(existingSnapshot),\n {\n strict: false,\n tolerance: 2,\n },\n )\n\n if (result.equal) {\n return {\n message: () => \"Snapshot matches\",\n pass: true,\n }\n }\n\n const diffPath = filePath.replace(\".snap.svg\", \".diff.png\")\n await looksSame.createDiff({\n reference: Buffer.from(existingSnapshot),\n current: Buffer.from(receivedSvg),\n diff: diffPath,\n highlightColor: \"#ff00ff\",\n })\n\n return {\n message: () => `Snapshot does not match. Diff saved at ${diffPath}`,\n pass: false,\n }\n}\n\n// Add the custom matcher to the expect object\nexpect.extend({\n // biome-ignore lint/suspicious/noExplicitAny: bun's types don't expose matcher type\n toMatchGraphicsSvg: toMatchGraphicsSvg as any,\n})\n\n// Extend the TypeScript interface for the matcher\ndeclare module \"bun:test\" {\n interface Matchers<T = unknown> {\n toMatchGraphicsSvg(\n testPath: string,\n opts?: { backgroundColor?: string; svgName?: string },\n ): Promise<MatcherResult>\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,cAAkC;AAC3C,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,OAAO,eAAe;AAatB,eAAe,mBAGb,sBACA,kBACA,OAAuD,CAAC,GAChC;AACxB,QAAM,WAAW,MAAM;AACvB,QAAM,WAAW,iBAAiB,QAAQ,iBAAiB,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jE,MAAM;AAAA,EACR;AACF;AAGA,OAAO,OAAO;AAAA;AAAA,EAEZ;AACF,CAAC;","names":[]}
|
package/dist/lib/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { GraphicsObject } from './types.js';
|
|
|
3
3
|
import { Matrix } from 'transformation-matrix';
|
|
4
4
|
|
|
5
5
|
type GraphicsObjectClickEvent = {
|
|
6
|
-
type: "point" | "line" | "rect" | "circle" | "text" | "arrow" | "polygon";
|
|
6
|
+
type: "point" | "line" | "infinite-line" | "rect" | "circle" | "text" | "arrow" | "polygon";
|
|
7
7
|
index: number;
|
|
8
8
|
object: any;
|
|
9
9
|
};
|