schematex 0.4.3 → 0.5.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/README.md +24 -3
- package/dist/ai/ai-sdk.cjs +9 -9
- package/dist/ai/ai-sdk.d.cts +2 -2
- package/dist/ai/ai-sdk.d.ts +2 -2
- package/dist/ai/ai-sdk.js +4 -4
- package/dist/ai/index.cjs +12 -12
- package/dist/ai/index.d.cts +3 -3
- package/dist/ai/index.d.ts +3 -3
- package/dist/ai/index.js +4 -4
- package/dist/{api-BIj9t4Oc.d.cts → api-C5UcmT7n.d.cts} +1 -1
- package/dist/{api-BIj9t4Oc.d.ts → api-C5UcmT7n.d.ts} +1 -1
- package/dist/browser.cjs +6 -6
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -4
- package/dist/{chunk-SMXU3KYA.cjs → chunk-3YUUC6RN.cjs} +5115 -282
- package/dist/chunk-3YUUC6RN.cjs.map +1 -0
- package/dist/{chunk-KWQTF6ZL.js → chunk-GTDQAN2Z.js} +5110 -280
- package/dist/chunk-GTDQAN2Z.js.map +1 -0
- package/dist/{chunk-J7JWMQD5.js → chunk-HUPDIRBX.js} +119 -4
- package/dist/chunk-HUPDIRBX.js.map +1 -0
- package/dist/{chunk-UBTKM2TB.js → chunk-IM4RCUHA.js} +210 -22
- package/dist/chunk-IM4RCUHA.js.map +1 -0
- package/dist/{chunk-N3SLYVNW.cjs → chunk-NWPCY65Z.cjs} +212 -24
- package/dist/{chunk-UBTKM2TB.js.map → chunk-NWPCY65Z.cjs.map} +1 -1
- package/dist/{chunk-VITE3MZQ.cjs → chunk-QTNPMIO2.cjs} +99 -5
- package/dist/chunk-QTNPMIO2.cjs.map +1 -0
- package/dist/{chunk-6IGSKU6D.js → chunk-UFTYX73U.js} +99 -5
- package/dist/chunk-UFTYX73U.js.map +1 -0
- package/dist/{chunk-2Z543TC3.cjs → chunk-XRCY75UV.cjs} +119 -4
- package/dist/chunk-XRCY75UV.cjs.map +1 -0
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.cjs +7 -7
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.js +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.cjs +7 -7
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +1 -1
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-DYpJXJcy.d.cts → index-C9A0h-CB.d.cts} +1 -1
- package/dist/{index-BeUVaQiD.d.ts → index-CJai_TEZ.d.ts} +1 -1
- package/dist/index.cjs +23 -11
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +3 -3
- package/dist/react.cjs +4 -4
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +3 -3
- package/dist/{types-DKdo-Ua_.d.cts → types-BOAsqHoU.d.cts} +2 -2
- package/dist/{types-DKdo-Ua_.d.ts → types-BOAsqHoU.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/chunk-2Z543TC3.cjs.map +0 -1
- package/dist/chunk-6IGSKU6D.js.map +0 -1
- package/dist/chunk-J7JWMQD5.js.map +0 -1
- package/dist/chunk-KWQTF6ZL.js.map +0 -1
- package/dist/chunk-N3SLYVNW.cjs.map +0 -1
- package/dist/chunk-SMXU3KYA.cjs.map +0 -1
- package/dist/chunk-VITE3MZQ.cjs.map +0 -1
|
@@ -824,15 +824,27 @@ function isFullWidth(code) {
|
|
|
824
824
|
if (code >= 131072 && code <= 196607) return true;
|
|
825
825
|
return false;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function labelLines(label) {
|
|
828
|
+
return String(label).split(/<br\s*\/?>|\n/i).map((line2) => line2.replace(/<\/?[bi]>/gi, ""));
|
|
829
|
+
}
|
|
830
|
+
function measureLineWidth(line2) {
|
|
828
831
|
let w = 0;
|
|
829
|
-
for (const ch of
|
|
832
|
+
for (const ch of line2) {
|
|
830
833
|
const code = ch.codePointAt(0) ?? 0;
|
|
831
834
|
if (isFullWidth(code)) w += FC_CONST.cjkCharWidth;
|
|
832
835
|
else w += FC_CONST.charWidth;
|
|
833
836
|
}
|
|
834
837
|
return w;
|
|
835
838
|
}
|
|
839
|
+
function measureLabelWidth(label) {
|
|
840
|
+
const lines = labelLines(label);
|
|
841
|
+
let max = 0;
|
|
842
|
+
for (const line2 of lines) {
|
|
843
|
+
const w = measureLineWidth(line2);
|
|
844
|
+
if (w > max) max = w;
|
|
845
|
+
}
|
|
846
|
+
return max;
|
|
847
|
+
}
|
|
836
848
|
function greedyFAS(nodeIds, edges) {
|
|
837
849
|
const outAdj = /* @__PURE__ */ new Map();
|
|
838
850
|
const inAdj = /* @__PURE__ */ new Map();
|
|
@@ -1265,6 +1277,85 @@ function laneBasedXCoords(layerNodes, pathOf, nodeSpacingX, segments) {
|
|
|
1265
1277
|
}
|
|
1266
1278
|
return result;
|
|
1267
1279
|
}
|
|
1280
|
+
function enforceSequentialClusterLayers(ast, layerMap, edges) {
|
|
1281
|
+
const sgParent = /* @__PURE__ */ new Map();
|
|
1282
|
+
for (const sg of ast.subgraphs) {
|
|
1283
|
+
for (const childSg of sg.subgraphs) sgParent.set(childSg, sg.id);
|
|
1284
|
+
if (!sgParent.has(sg.id)) sgParent.set(sg.id, void 0);
|
|
1285
|
+
}
|
|
1286
|
+
const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
|
|
1287
|
+
if (topLevel.length < 2) return;
|
|
1288
|
+
const collect = (sgId) => {
|
|
1289
|
+
const sg = ast.subgraphs.find((s) => s.id === sgId);
|
|
1290
|
+
if (!sg) return [];
|
|
1291
|
+
const ids = [...sg.children];
|
|
1292
|
+
for (const childSgId of sg.subgraphs) ids.push(...collect(childSgId));
|
|
1293
|
+
return ids;
|
|
1294
|
+
};
|
|
1295
|
+
const adjOut = /* @__PURE__ */ new Map();
|
|
1296
|
+
for (const e of edges) {
|
|
1297
|
+
if (!adjOut.has(e.from)) adjOut.set(e.from, []);
|
|
1298
|
+
adjOut.get(e.from).push(e.to);
|
|
1299
|
+
}
|
|
1300
|
+
const hasForwardEdge = (srcSgId, dstSgId) => {
|
|
1301
|
+
const srcIds = new Set(collect(srcSgId));
|
|
1302
|
+
const dstIds = new Set(collect(dstSgId));
|
|
1303
|
+
for (const id of srcIds) {
|
|
1304
|
+
for (const t of adjOut.get(id) ?? []) {
|
|
1305
|
+
if (dstIds.has(t)) return true;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
return false;
|
|
1309
|
+
};
|
|
1310
|
+
const chains = [];
|
|
1311
|
+
let cur = [];
|
|
1312
|
+
for (let i = 0; i < topLevel.length; i++) {
|
|
1313
|
+
const sg = topLevel[i];
|
|
1314
|
+
if (i === 0 || !hasForwardEdge(topLevel[i - 1].id, sg.id)) {
|
|
1315
|
+
if (cur.length > 1) chains.push(cur);
|
|
1316
|
+
cur = [sg.id];
|
|
1317
|
+
} else {
|
|
1318
|
+
cur.push(sg.id);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
if (cur.length > 1) chains.push(cur);
|
|
1322
|
+
if (chains.length === 0) return;
|
|
1323
|
+
for (const chain of chains) {
|
|
1324
|
+
let prevMax = -Infinity;
|
|
1325
|
+
for (const clusterId of chain) {
|
|
1326
|
+
const ids = collect(clusterId);
|
|
1327
|
+
if (ids.length === 0) continue;
|
|
1328
|
+
let curMin = Infinity;
|
|
1329
|
+
let curMax = -Infinity;
|
|
1330
|
+
for (const id of ids) {
|
|
1331
|
+
const l = layerMap.get(id) ?? 0;
|
|
1332
|
+
if (l < curMin) curMin = l;
|
|
1333
|
+
if (l > curMax) curMax = l;
|
|
1334
|
+
}
|
|
1335
|
+
const requiredMin = prevMax === -Infinity ? curMin : prevMax + 1;
|
|
1336
|
+
if (curMin < requiredMin) {
|
|
1337
|
+
const shift = requiredMin - curMin;
|
|
1338
|
+
const toShift = new Set(ids);
|
|
1339
|
+
const queue = [...ids];
|
|
1340
|
+
while (queue.length > 0) {
|
|
1341
|
+
const u = queue.shift();
|
|
1342
|
+
for (const t of adjOut.get(u) ?? []) {
|
|
1343
|
+
if (!toShift.has(t)) {
|
|
1344
|
+
toShift.add(t);
|
|
1345
|
+
queue.push(t);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
for (const id of toShift) {
|
|
1350
|
+
layerMap.set(id, (layerMap.get(id) ?? 0) + shift);
|
|
1351
|
+
}
|
|
1352
|
+
prevMax = curMax + shift;
|
|
1353
|
+
} else {
|
|
1354
|
+
prevMax = curMax;
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1268
1359
|
function hasOverlappingTopLevelClusters(ast, layerMap, sgParent) {
|
|
1269
1360
|
const topLevel = ast.subgraphs.filter((sg) => !sgParent.get(sg.id));
|
|
1270
1361
|
if (topLevel.length < 2) return false;
|
|
@@ -1301,7 +1392,9 @@ function layoutFlowchart(ast) {
|
|
|
1301
1392
|
Math.ceil(rawTextW) + FC_CONST.labelHPad * 2
|
|
1302
1393
|
);
|
|
1303
1394
|
let shapeW = Math.max(FC_CONST.minNodeWidth, labelW);
|
|
1304
|
-
|
|
1395
|
+
const nLines = labelLines(n.label).length;
|
|
1396
|
+
const multilineH = nLines > 1 ? FC_CONST.nodeHeight + (nLines - 1) * 14 : FC_CONST.nodeHeight;
|
|
1397
|
+
let shapeH = multilineH;
|
|
1305
1398
|
if (n.shape === "diamond") {
|
|
1306
1399
|
shapeW = Math.max(shapeW, labelW * 1.4);
|
|
1307
1400
|
shapeH = Math.max(shapeH, 52);
|
|
@@ -1358,6 +1451,7 @@ function layoutFlowchart(ast) {
|
|
|
1358
1451
|
};
|
|
1359
1452
|
});
|
|
1360
1453
|
const layerMap = longestPathLayers(allIds, ledges);
|
|
1454
|
+
enforceSequentialClusterLayers(ast, layerMap, ledges);
|
|
1361
1455
|
let dummyCounter = 0;
|
|
1362
1456
|
const dummies = [];
|
|
1363
1457
|
const { updatedEdges } = insertDummies(ledges, layerMap, () => {
|
|
@@ -2150,5 +2244,5 @@ exports.layoutFlowchart = layoutFlowchart;
|
|
|
2150
2244
|
exports.parseFlowchart = parseFlowchart;
|
|
2151
2245
|
exports.renderFlowchart = renderFlowchart;
|
|
2152
2246
|
exports.renderFlowchartAST = renderFlowchartAST;
|
|
2153
|
-
//# sourceMappingURL=chunk-
|
|
2154
|
-
//# sourceMappingURL=chunk-
|
|
2247
|
+
//# sourceMappingURL=chunk-QTNPMIO2.cjs.map
|
|
2248
|
+
//# sourceMappingURL=chunk-QTNPMIO2.cjs.map
|