kordoc 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -119
- package/dist/{chunk-YDXK5T53.js → chunk-NJ3R7LNR.js} +86 -43
- package/dist/chunk-NJ3R7LNR.js.map +1 -0
- package/dist/cli.js +2 -2
- package/dist/index.cjs +85 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -42
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/provider-A4FHJSID.js +0 -0
- package/dist/{watch-C5LIQLZC.js → watch-AKTZTPVF.js} +2 -2
- package/package.json +2 -2
- package/dist/chunk-YDXK5T53.js.map +0 -1
- /package/dist/{watch-C5LIQLZC.js.map → watch-AKTZTPVF.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -254,7 +254,7 @@ function tableToMarkdown(table) {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
// src/utils.ts
|
|
257
|
-
var VERSION = true ? "1.7.
|
|
257
|
+
var VERSION = true ? "1.7.2" : "0.0.0-dev";
|
|
258
258
|
function toArrayBuffer(buf) {
|
|
259
259
|
if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
|
|
260
260
|
return buf.buffer;
|
|
@@ -1573,6 +1573,20 @@ function extractLines(fnArray, argsArray) {
|
|
|
1573
1573
|
let currentPath = [];
|
|
1574
1574
|
let pathStartX = 0, pathStartY = 0;
|
|
1575
1575
|
let curX = 0, curY = 0;
|
|
1576
|
+
function pushRectangle(path, rx, ry, rw, rh) {
|
|
1577
|
+
if (Math.abs(rh) < ORIENTATION_TOL * 2) {
|
|
1578
|
+
path.push({ x1: rx, y1: ry + rh / 2, x2: rx + rw, y2: ry + rh / 2 });
|
|
1579
|
+
} else if (Math.abs(rw) < ORIENTATION_TOL * 2) {
|
|
1580
|
+
path.push({ x1: rx + rw / 2, y1: ry, x2: rx + rw / 2, y2: ry + rh });
|
|
1581
|
+
} else {
|
|
1582
|
+
path.push(
|
|
1583
|
+
{ x1: rx, y1: ry, x2: rx + rw, y2: ry },
|
|
1584
|
+
{ x1: rx + rw, y1: ry, x2: rx + rw, y2: ry + rh },
|
|
1585
|
+
{ x1: rx + rw, y1: ry + rh, x2: rx, y2: ry + rh },
|
|
1586
|
+
{ x1: rx, y1: ry + rh, x2: rx, y2: ry }
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1576
1590
|
function flushPath(isStroke) {
|
|
1577
1591
|
if (!isStroke) {
|
|
1578
1592
|
currentPath = [];
|
|
@@ -1591,49 +1605,78 @@ function extractLines(fnArray, argsArray) {
|
|
|
1591
1605
|
lineWidth = args[0] || 1;
|
|
1592
1606
|
break;
|
|
1593
1607
|
case OPS.constructPath: {
|
|
1594
|
-
const
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
// left
|
|
1625
|
-
);
|
|
1608
|
+
const arg0 = args[0];
|
|
1609
|
+
if (Array.isArray(arg0)) {
|
|
1610
|
+
const subOps = arg0;
|
|
1611
|
+
const coords = args[1];
|
|
1612
|
+
let ci = 0;
|
|
1613
|
+
for (const subOp of subOps) {
|
|
1614
|
+
if (subOp === OPS.moveTo) {
|
|
1615
|
+
curX = coords[ci++];
|
|
1616
|
+
curY = coords[ci++];
|
|
1617
|
+
pathStartX = curX;
|
|
1618
|
+
pathStartY = curY;
|
|
1619
|
+
} else if (subOp === OPS.lineTo) {
|
|
1620
|
+
const x2 = coords[ci++], y2 = coords[ci++];
|
|
1621
|
+
currentPath.push({ x1: curX, y1: curY, x2, y2 });
|
|
1622
|
+
curX = x2;
|
|
1623
|
+
curY = y2;
|
|
1624
|
+
} else if (subOp === OPS.rectangle) {
|
|
1625
|
+
const rx = coords[ci++], ry = coords[ci++];
|
|
1626
|
+
const rw = coords[ci++], rh = coords[ci++];
|
|
1627
|
+
pushRectangle(currentPath, rx, ry, rw, rh);
|
|
1628
|
+
} else if (subOp === OPS.closePath) {
|
|
1629
|
+
if (curX !== pathStartX || curY !== pathStartY) {
|
|
1630
|
+
currentPath.push({ x1: curX, y1: curY, x2: pathStartX, y2: pathStartY });
|
|
1631
|
+
}
|
|
1632
|
+
curX = pathStartX;
|
|
1633
|
+
curY = pathStartY;
|
|
1634
|
+
} else if (subOp === OPS.curveTo) {
|
|
1635
|
+
ci += 6;
|
|
1636
|
+
} else if (subOp === OPS.curveTo2 || subOp === OPS.curveTo3) {
|
|
1637
|
+
ci += 4;
|
|
1626
1638
|
}
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1639
|
+
}
|
|
1640
|
+
} else {
|
|
1641
|
+
const afterOp = arg0;
|
|
1642
|
+
const dataArr = args[1];
|
|
1643
|
+
const pathData = dataArr?.[0];
|
|
1644
|
+
if (pathData && typeof pathData === "object") {
|
|
1645
|
+
const len = Object.keys(pathData).length;
|
|
1646
|
+
let di = 0;
|
|
1647
|
+
while (di < len) {
|
|
1648
|
+
const drawOp = pathData[di++];
|
|
1649
|
+
if (drawOp === 0 /* moveTo */) {
|
|
1650
|
+
curX = pathData[di++];
|
|
1651
|
+
curY = pathData[di++];
|
|
1652
|
+
pathStartX = curX;
|
|
1653
|
+
pathStartY = curY;
|
|
1654
|
+
} else if (drawOp === 1 /* lineTo */) {
|
|
1655
|
+
const x2 = pathData[di++], y2 = pathData[di++];
|
|
1656
|
+
currentPath.push({ x1: curX, y1: curY, x2, y2 });
|
|
1657
|
+
curX = x2;
|
|
1658
|
+
curY = y2;
|
|
1659
|
+
} else if (drawOp === 2 /* curveTo */) {
|
|
1660
|
+
di += 6;
|
|
1661
|
+
} else if (drawOp === 3 /* quadraticCurveTo */) {
|
|
1662
|
+
di += 4;
|
|
1663
|
+
} else if (drawOp === 4 /* closePath */) {
|
|
1664
|
+
if (curX !== pathStartX || curY !== pathStartY) {
|
|
1665
|
+
currentPath.push({ x1: curX, y1: curY, x2: pathStartX, y2: pathStartY });
|
|
1666
|
+
}
|
|
1667
|
+
curX = pathStartX;
|
|
1668
|
+
curY = pathStartY;
|
|
1669
|
+
} else {
|
|
1670
|
+
break;
|
|
1671
|
+
}
|
|
1630
1672
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1673
|
+
}
|
|
1674
|
+
if (afterOp === OPS.stroke || afterOp === OPS.closeStroke) {
|
|
1675
|
+
flushPath(true);
|
|
1676
|
+
} else if (afterOp === OPS.fill || afterOp === OPS.eoFill || afterOp === OPS.fillStroke || afterOp === OPS.eoFillStroke || afterOp === OPS.closeFillStroke || afterOp === OPS.closeEOFillStroke) {
|
|
1677
|
+
flushPath(true);
|
|
1678
|
+
} else if (afterOp === OPS.endPath) {
|
|
1679
|
+
flushPath(false);
|
|
1637
1680
|
}
|
|
1638
1681
|
}
|
|
1639
1682
|
break;
|