@graphty/graph-io 0.3.49 → 0.3.50
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/chunks/{approximations-Bzn3L-je.js → approximations-BRXsll0T.js} +2 -2
- package/dist/chunks/{approximations-Bzn3L-je.js.map → approximations-BRXsll0T.js.map} +1 -1
- package/dist/chunks/{block-iptrlMBb.js → block-yl0f_qLO.js} +27 -2
- package/dist/chunks/block-yl0f_qLO.js.map +1 -0
- package/dist/chunks/{context-C3p0RQxR.js → context-DizmppHy.js} +2 -2
- package/dist/chunks/{context-C3p0RQxR.js.map → context-DizmppHy.js.map} +1 -1
- package/dist/chunks/{credentials-DXHx7nwR.js → credentials-CmvJXYeH.js} +58 -9
- package/dist/chunks/credentials-CmvJXYeH.js.map +1 -0
- package/dist/chunks/{descriptor-DLA5kINx.js → descriptor-Dhez_Cew.js} +5 -1
- package/dist/chunks/{descriptor-DLA5kINx.js.map → descriptor-Dhez_Cew.js.map} +1 -1
- package/dist/chunks/{emit-BwHQkZle.js → emit-7Jkpg0yd.js} +132 -4
- package/dist/chunks/emit-7Jkpg0yd.js.map +1 -0
- package/dist/chunks/{exporter-nDfxIK5D.js → exporter-1Ajud15J.js} +4 -4
- package/dist/chunks/{exporter-nDfxIK5D.js.map → exporter-1Ajud15J.js.map} +1 -1
- package/dist/chunks/{exporter-D9yMtocA.js → exporter-B6yvL3wy.js} +3 -3
- package/dist/chunks/{exporter-D9yMtocA.js.map → exporter-B6yvL3wy.js.map} +1 -1
- package/dist/chunks/{exporter-_jrBTnos.js → exporter-CA5q8ROP.js} +4 -4
- package/dist/chunks/{exporter-_jrBTnos.js.map → exporter-CA5q8ROP.js.map} +1 -1
- package/dist/chunks/{exporter-D2CETOMK.js → exporter-CQQZFJ2v.js} +72 -10
- package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
- package/dist/chunks/{generic-ymWCETAJ.js → generic-Dc21MAdg.js} +3 -3
- package/dist/chunks/{generic-ymWCETAJ.js.map → generic-Dc21MAdg.js.map} +1 -1
- package/dist/chunks/{importer-CT9mJ1nn.js → importer-C6NVpCXp.js} +7 -6
- package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
- package/dist/chunks/{importer-GREKMdIf.js → importer-CKFe4q54.js} +4 -4
- package/dist/chunks/{importer-GREKMdIf.js.map → importer-CKFe4q54.js.map} +1 -1
- package/dist/chunks/{importer-PqaaKKnY.js → importer-CKbUbsJA.js} +4 -4
- package/dist/chunks/{importer-PqaaKKnY.js.map → importer-CKbUbsJA.js.map} +1 -1
- package/dist/chunks/{importer-DaLTjbds.js → importer-ClCsdgTJ.js} +97 -7
- package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
- package/dist/chunks/{importer-B92x1xY5.js → importer-CyVZTrf0.js} +3 -3
- package/dist/chunks/{importer-B92x1xY5.js.map → importer-CyVZTrf0.js.map} +1 -1
- package/dist/chunks/{importer-vRq4h3j5.js → importer-DgG4v1Ms.js} +89 -20
- package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
- package/dist/chunks/{importer-Vn5QvmmJ.js → importer-asFUrIsj.js} +2 -2
- package/dist/chunks/{importer-Vn5QvmmJ.js.map → importer-asFUrIsj.js.map} +1 -1
- package/dist/chunks/{lexicon-Clf4QIyl.js → lexicon-IVRq2Uoo.js} +2 -2
- package/dist/chunks/{lexicon-Clf4QIyl.js.map → lexicon-IVRq2Uoo.js.map} +1 -1
- package/dist/chunks/{round-trip-Zm3_ivgq.js → round-trip-Cy3_SHRZ.js} +2 -2
- package/dist/chunks/{round-trip-Zm3_ivgq.js.map → round-trip-Cy3_SHRZ.js.map} +1 -1
- package/dist/chunks/{sigv4-EokFic1V.js → sigv4-BXwVbza3.js} +3 -3
- package/dist/chunks/{sigv4-EokFic1V.js.map → sigv4-BXwVbza3.js.map} +1 -1
- package/dist/chunks/{styles-CCs214_3.js → styles-CAVmBLgp.js} +4 -4
- package/dist/chunks/{styles-CCs214_3.js.map → styles-CAVmBLgp.js.map} +1 -1
- package/dist/chunks/{styles-DPQQIig4.js → styles-CPczw1Jz.js} +4 -4
- package/dist/chunks/{styles-DPQQIig4.js.map → styles-CPczw1Jz.js.map} +1 -1
- package/dist/chunks/{styles-Cm62yyQX.js → styles-boK6Ln54.js} +65 -30
- package/dist/chunks/styles-boK6Ln54.js.map +1 -0
- package/dist/chunks/{styles-yed-UMFdNqze.js → styles-yed-XeFBQ6VS.js} +8 -8
- package/dist/chunks/{styles-yed-UMFdNqze.js.map → styles-yed-XeFBQ6VS.js.map} +1 -1
- package/dist/cx.js +2 -2
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +7 -4
- package/dist/gexf.js +2 -2
- package/dist/gml.js +8 -8
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +129 -104
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +2 -2
- package/dist/json.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/sources-cypher.js +25 -22
- package/dist/sources-cypher.js.map +1 -1
- package/dist/sources-ndex.js +2 -2
- package/dist/sources-rest.js +20 -4
- package/dist/sources-rest.js.map +1 -1
- package/dist/sources-sparql.js +40 -6
- package/dist/sources-sparql.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +34 -2
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +65 -5
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +3 -1
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +2 -1
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +7 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -1
- package/dist/src/formats/dot/label-places.js +9 -3
- package/dist/src/formats/dot/label-places.js.map +1 -1
- package/dist/src/formats/dot/names.d.ts +13 -0
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +13 -0
- package/dist/src/formats/dot/names.js.map +1 -1
- package/dist/src/formats/dot/styles.d.ts +10 -0
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +49 -3
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gml/styles.js +1 -1
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +3 -3
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.js +6 -4
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
- package/dist/src/formats/json/styles.d.ts.map +1 -1
- package/dist/src/formats/json/styles.js +94 -6
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +8 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -1
- package/dist/src/formats/pajek/draw.js +10 -0
- package/dist/src/formats/pajek/draw.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +142 -25
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/sources/credentials.d.ts +50 -1
- package/dist/src/sources/credentials.d.ts.map +1 -1
- package/dist/src/sources/credentials.js +69 -0
- package/dist/src/sources/credentials.js.map +1 -1
- package/dist/src/sources/cypher/index.d.ts.map +1 -1
- package/dist/src/sources/cypher/index.js +12 -11
- package/dist/src/sources/cypher/index.js.map +1 -1
- package/dist/src/sources/cypher/query-builder.d.ts +6 -6
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.js +15 -15
- package/dist/src/sources/cypher/query-builder.js.map +1 -1
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.js +4 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -1
- package/dist/src/sources/rest/openalex.d.ts +4 -2
- package/dist/src/sources/rest/openalex.d.ts.map +1 -1
- package/dist/src/sources/rest/openalex.js +4 -2
- package/dist/src/sources/rest/openalex.js.map +1 -1
- package/dist/src/sources/rest/source.d.ts.map +1 -1
- package/dist/src/sources/rest/source.js +23 -0
- package/dist/src/sources/rest/source.js.map +1 -1
- package/dist/src/sources/run.d.ts +2 -0
- package/dist/src/sources/run.d.ts.map +1 -1
- package/dist/src/sources/run.js +30 -3
- package/dist/src/sources/run.js.map +1 -1
- package/dist/src/sources/sparql/index.d.ts.map +1 -1
- package/dist/src/sources/sparql/index.js +14 -1
- package/dist/src/sources/sparql/index.js.map +1 -1
- package/dist/src/sources/sparql/query.d.ts +2 -1
- package/dist/src/sources/sparql/query.d.ts.map +1 -1
- package/dist/src/sources/sparql/query.js +55 -4
- package/dist/src/sources/sparql/query.js.map +1 -1
- package/dist/src/sources/types.d.ts +29 -0
- package/dist/src/sources/types.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +8 -0
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +124 -0
- package/dist/src/styles/cyjs/cascade.js.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.js +1 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +30 -1
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +14 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/types.d.ts +65 -0
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +21 -0
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/styles.js +6 -6
- package/dist/xgmml.js +3 -3
- package/package.json +2 -2
- package/src/formats/dot/exporter.ts +37 -1
- package/src/formats/dot/importer.ts +75 -4
- package/src/formats/dot/index.ts +3 -1
- package/src/formats/dot/label-places.ts +16 -3
- package/src/formats/dot/names.ts +15 -0
- package/src/formats/dot/styles.ts +55 -3
- package/src/formats/gml/styles.ts +1 -1
- package/src/formats/graphml/styles-yed.ts +3 -3
- package/src/formats/graphml/styles-yfiles3.ts +6 -4
- package/src/formats/json/styles.ts +102 -6
- package/src/formats/pajek/draw.ts +11 -0
- package/src/formats/pajek/styles.ts +151 -26
- package/src/index.ts +7 -0
- package/src/sources/credentials.ts +90 -1
- package/src/sources/cypher/index.ts +12 -11
- package/src/sources/cypher/query-builder.ts +15 -15
- package/src/sources/rest/descriptor.ts +4 -0
- package/src/sources/rest/openalex.ts +4 -2
- package/src/sources/rest/source.ts +25 -0
- package/src/sources/run.ts +35 -3
- package/src/sources/sparql/index.ts +16 -1
- package/src/sources/sparql/query.ts +58 -4
- package/src/sources/types.ts +33 -0
- package/src/styles/canon/enums.ts +9 -0
- package/src/styles/cyjs/cascade.ts +143 -0
- package/src/styles/cyjs/defaults-table.ts +1 -0
- package/src/styles/cyjs/emit.ts +35 -1
- package/src/styles/cyjs/mappers.ts +14 -0
- package/src/styles/types.ts +65 -0
- package/src/styles/vocabulary.ts +21 -0
- package/dist/chunks/block-iptrlMBb.js.map +0 -1
- package/dist/chunks/credentials-DXHx7nwR.js.map +0 -1
- package/dist/chunks/emit-BwHQkZle.js.map +0 -1
- package/dist/chunks/exporter-D2CETOMK.js.map +0 -1
- package/dist/chunks/importer-CT9mJ1nn.js.map +0 -1
- package/dist/chunks/importer-DaLTjbds.js.map +0 -1
- package/dist/chunks/importer-vRq4h3j5.js.map +0 -1
- package/dist/chunks/styles-Cm62yyQX.js.map +0 -1
|
@@ -7,10 +7,10 @@ import { i as inferTextDtype, W as WIDENING_UNSUPPORTED_CODE, a as isNumericText
|
|
|
7
7
|
import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
|
|
8
8
|
import { p as postscriptFont, f as graphvizFontName, i as importChosenGraph } from "./choose-CczZJaX_.js";
|
|
9
9
|
import { L as LineReader, b as throwIfAborted } from "./input-CAxt_aV-.js";
|
|
10
|
-
import { A as writeStyleBlock, B as styleBlockLosses, h as StyleNotes, p as plainCell, f as canonText, a as canonEnum, d as canonColor, e as colorOpacity, c as canonNumber, n as noteAt, b as STYLE_ISSUE, y as toolDefaults, L as DVIPS_COLORS } from "./block-
|
|
11
|
-
import { S as StyleApproximations } from "./approximations-
|
|
12
|
-
import { e as elementValues, t as takeFromBlock } from "./round-trip-
|
|
13
|
-
import { v as valueColumns } from "./styles-yed-
|
|
10
|
+
import { A as writeStyleBlock, B as styleBlockLosses, h as StyleNotes, p as plainCell, f as canonText, a as canonEnum, d as canonColor, e as colorOpacity, c as canonNumber, n as noteAt, b as STYLE_ISSUE, y as toolDefaults, L as DVIPS_COLORS } from "./block-yl0f_qLO.js";
|
|
11
|
+
import { S as StyleApproximations } from "./approximations-BRXsll0T.js";
|
|
12
|
+
import { e as elementValues, t as takeFromBlock } from "./round-trip-Cy3_SHRZ.js";
|
|
13
|
+
import { v as valueColumns } from "./styles-yed-XeFBQ6VS.js";
|
|
14
14
|
const PAJEK_WINDOW = 500;
|
|
15
15
|
function resolvePajekDraw(option) {
|
|
16
16
|
if (option === void 0) {
|
|
@@ -59,6 +59,9 @@ function flag(draw, name) {
|
|
|
59
59
|
function drawsLineLabels(draw) {
|
|
60
60
|
return draw !== null && flag(draw, "Form8.withLabels1");
|
|
61
61
|
}
|
|
62
|
+
function drawsStraightLines(draw) {
|
|
63
|
+
return draw !== null && flag(draw, "Form10.StraightLinesOnly1");
|
|
64
|
+
}
|
|
62
65
|
function iniNumber(draw, name) {
|
|
63
66
|
const v = draw.ini.get(name);
|
|
64
67
|
const n = v === void 0 || v.trim() === "" ? Number.NaN : Number(v);
|
|
@@ -624,6 +627,7 @@ const PAJEK_STYLE_CAPABILITIES = Object.freeze({
|
|
|
624
627
|
"lineStyle",
|
|
625
628
|
"sourceArrow",
|
|
626
629
|
"targetArrow",
|
|
630
|
+
"arrowSize",
|
|
627
631
|
"arrowPosition",
|
|
628
632
|
"label",
|
|
629
633
|
"labelColor",
|
|
@@ -637,6 +641,7 @@ const PAJEK_FIGURES = /* @__PURE__ */ new Map([
|
|
|
637
641
|
["other:man", [2.502, 6.487]],
|
|
638
642
|
["other:woman", [3.003, 6.478]]
|
|
639
643
|
]);
|
|
644
|
+
const PAJEK_FIGURE_UNSET_FACTOR = 0.3;
|
|
640
645
|
const PAJEK_POINTS_PER_UNIT = 500;
|
|
641
646
|
const NODE_KEYS = [
|
|
642
647
|
"ic",
|
|
@@ -659,7 +664,7 @@ const CARRIED = {
|
|
|
659
664
|
node: [SHAPE_COLUMN, ...NODE_KEYS],
|
|
660
665
|
edge: ["c", "w", "p", "s", "ap"]
|
|
661
666
|
};
|
|
662
|
-
const CARRIED_LINE = CARRIED.edge.filter((key) => key !== "p");
|
|
667
|
+
const CARRIED_LINE = CARRIED.edge.filter((key) => key !== "p" && key !== "ap");
|
|
663
668
|
const EDGE_WIDTH_PER_W = 2;
|
|
664
669
|
const ARC_DEFAULTS = { color: "#999999", width: 1 };
|
|
665
670
|
function carriedParams(keys, whole) {
|
|
@@ -871,7 +876,8 @@ function readSize(get, put, at, figure) {
|
|
|
871
876
|
if (f === null && figure === void 0) {
|
|
872
877
|
continue;
|
|
873
878
|
}
|
|
874
|
-
const
|
|
879
|
+
const unset = figure === void 0 ? 1 : PAJEK_FIGURE_UNSET_FACTOR;
|
|
880
|
+
const factor = f === null ? unset : canonNumber(f, at(property));
|
|
875
881
|
const over = figure?.[k] ?? 1;
|
|
876
882
|
put(property, factor === null ? null : Number((PAJEK_VERTEX_SIZE * factor * over).toPrecision(15)));
|
|
877
883
|
}
|
|
@@ -942,7 +948,7 @@ function readLine(get, put, at, directed, labels = true, run = null, loop = null
|
|
|
942
948
|
put("lineStyle", "solid");
|
|
943
949
|
}
|
|
944
950
|
readNumber(get("s"), "arrowSize", put, at);
|
|
945
|
-
readArrowPosition(get("ap"), put, at);
|
|
951
|
+
readArrowPosition(get("ap"), put, at, run);
|
|
946
952
|
const line = loop === null ? get : loopParam(get);
|
|
947
953
|
const controls = loop === null ? null : readLoop(line, put, loop);
|
|
948
954
|
if (labels) {
|
|
@@ -1041,21 +1047,22 @@ function readBezier(get, put, run) {
|
|
|
1041
1047
|
put("bendCurve", "bezier");
|
|
1042
1048
|
put("bends", controls.map(([along, across]) => `${fraction(along)},${fraction(across)}`).join(" "));
|
|
1043
1049
|
}
|
|
1050
|
+
const PAJEK_TIP_BACK = 1.5;
|
|
1044
1051
|
function readArcEnd(get, put, run, target) {
|
|
1045
1052
|
const ap = numberOrNull(get("ap")) ?? 0;
|
|
1046
1053
|
const length = Math.hypot(run[0], run[1]);
|
|
1047
1054
|
if (ap !== 0 || length === 0 || bezierControls(get, run) === null) {
|
|
1048
|
-
return;
|
|
1055
|
+
return false;
|
|
1049
1056
|
}
|
|
1050
1057
|
const [ux, uy] = [run[0] / length, run[1] / length];
|
|
1051
1058
|
const r = 1 / Math.hypot(ux / (target[0] / 2), uy / (target[1] / 2));
|
|
1052
|
-
const back =
|
|
1059
|
+
const back = PAJEK_TIP_BACK + 5 * (numberOrNull(get("s")) ?? 1);
|
|
1053
1060
|
const turn = -(numberOrNull(get("a2")) ?? 0) * Math.PI / 180;
|
|
1054
1061
|
const [c, s] = [Math.cos(turn), Math.sin(turn)];
|
|
1055
1062
|
const end = [run[0] - r * ux - back * (ux * c - uy * s), run[1] - r * uy - back * (ux * s + uy * c)];
|
|
1056
1063
|
const controls = bezierControls(get, end);
|
|
1057
1064
|
if (controls === null) {
|
|
1058
|
-
return;
|
|
1065
|
+
return false;
|
|
1059
1066
|
}
|
|
1060
1067
|
const L2 = length * length;
|
|
1061
1068
|
const fraction = (x) => String(Math.round(x * 1e4) / 1e4 || 0);
|
|
@@ -1064,6 +1071,16 @@ function readArcEnd(get, put, run, target) {
|
|
|
1064
1071
|
return `${fraction((x * run[0] + y * run[1]) / L2)},${fraction((x * run[1] - y * run[0]) / L2)}`;
|
|
1065
1072
|
});
|
|
1066
1073
|
put("bends", bends.join(" "));
|
|
1074
|
+
const tip = [-r * ux - PAJEK_TIP_BACK * (ux * c - uy * s), -r * uy - PAJEK_TIP_BACK * (ux * s + uy * c)];
|
|
1075
|
+
put("targetPort", `${fraction(tip[0] / (target[0] / 2))},${fraction(-tip[1] / (target[1] / 2))}`);
|
|
1076
|
+
return true;
|
|
1077
|
+
}
|
|
1078
|
+
const PAJEK_TIP_GAP = 1;
|
|
1079
|
+
function readTipGap(get, put) {
|
|
1080
|
+
const s = numberOrNull(get("s")) ?? 1;
|
|
1081
|
+
if (s > 0) {
|
|
1082
|
+
put("targetArrowGap", Number((PAJEK_TIP_GAP / (6 * s)).toPrecision(6)));
|
|
1083
|
+
}
|
|
1067
1084
|
}
|
|
1068
1085
|
function bezierControls(get, run) {
|
|
1069
1086
|
const [a1, k1, a2, k2] = ["a1", "k1", "a2", "k2"].map((key) => numberOrNull(get(key)));
|
|
@@ -1149,13 +1166,18 @@ function numberOrNull(raw) {
|
|
|
1149
1166
|
}
|
|
1150
1167
|
return typeof raw === "number" && Number.isFinite(raw) ? raw : null;
|
|
1151
1168
|
}
|
|
1152
|
-
function readArrowPosition(raw, put, at) {
|
|
1169
|
+
function readArrowPosition(raw, put, at, run = null) {
|
|
1153
1170
|
if (raw === null) {
|
|
1154
1171
|
return;
|
|
1155
1172
|
}
|
|
1156
1173
|
const ap = canonNumber(raw, at("arrowPosition"));
|
|
1174
|
+
const length = run === null ? 0 : Math.hypot(run[0], run[1]);
|
|
1157
1175
|
if (ap !== null && ap > 1) {
|
|
1158
|
-
|
|
1176
|
+
if (length > 0) {
|
|
1177
|
+
put("arrowPosition", Number(Math.min(1, ap / length).toPrecision(6)));
|
|
1178
|
+
} else {
|
|
1179
|
+
noteAt(at("arrowPosition"), STYLE_ISSUE.NOT_CARRIED, `ap ${String(ap)}`);
|
|
1180
|
+
}
|
|
1159
1181
|
return;
|
|
1160
1182
|
}
|
|
1161
1183
|
if (ap !== 0) {
|
|
@@ -1180,6 +1202,40 @@ function directedEdges(snapshot) {
|
|
|
1180
1202
|
}
|
|
1181
1203
|
return out;
|
|
1182
1204
|
}
|
|
1205
|
+
const SHARED_ARC_BOW = { a1: 15, k1: 0.25, a2: 15, k2: 0.25 };
|
|
1206
|
+
function sharedArcBows(snapshot, directed) {
|
|
1207
|
+
const byPair = /* @__PURE__ */ new Map();
|
|
1208
|
+
for (let e = 0; e < snapshot.edgeCount; e++) {
|
|
1209
|
+
const [u, v] = [snapshot.edgeSource(e), snapshot.edgeTarget(e)];
|
|
1210
|
+
if (directed[e] && u !== v) {
|
|
1211
|
+
const key = u < v ? `${String(u)} ${String(v)}` : `${String(v)} ${String(u)}`;
|
|
1212
|
+
byPair.set(key, [...byPair.get(key) ?? [], e]);
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
const out = /* @__PURE__ */ new Map();
|
|
1216
|
+
for (const arcs of byPair.values()) {
|
|
1217
|
+
if (arcs.length < 2) {
|
|
1218
|
+
continue;
|
|
1219
|
+
}
|
|
1220
|
+
for (const e of arcs) {
|
|
1221
|
+
const same = arcs.filter((x) => snapshot.edgeSource(x) === snapshot.edgeSource(e));
|
|
1222
|
+
out.set(e, (same.length - 1 - same.indexOf(e)) % 2 === 0 ? 1 : -1);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return out;
|
|
1226
|
+
}
|
|
1227
|
+
function bowedParams(get, side) {
|
|
1228
|
+
if (Object.keys(SHARED_ARC_BOW).some((key) => get(key) !== null)) {
|
|
1229
|
+
return get;
|
|
1230
|
+
}
|
|
1231
|
+
return (key) => {
|
|
1232
|
+
const bow = SHARED_ARC_BOW[key];
|
|
1233
|
+
if (bow === void 0) {
|
|
1234
|
+
return get(key);
|
|
1235
|
+
}
|
|
1236
|
+
return key.startsWith("a") ? side * bow : bow;
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1183
1239
|
function styleColumns(table, keys) {
|
|
1184
1240
|
return keys.filter((k) => table.has(k));
|
|
1185
1241
|
}
|
|
@@ -1221,14 +1277,18 @@ function pajekStyles(snapshot, context) {
|
|
|
1221
1277
|
const loop = run !== null && block === null && snapshot.edgeSource(i) === snapshot.edgeTarget(i) ? (controls) => {
|
|
1222
1278
|
loops.set(i, controls);
|
|
1223
1279
|
} : null;
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1280
|
+
const bow = bows.get(i);
|
|
1281
|
+
const line = bow === void 0 ? get : bowedParams(get, bow);
|
|
1282
|
+
readLine(line, put, at, directed[i], labels, run, loop);
|
|
1283
|
+
const ported = directed[i] && run !== null && readArcEnd(line, put, run, targetSize(snapshot.edgeTarget(i)));
|
|
1284
|
+
if (directed[i] && loop === null && !ported && block === null) {
|
|
1285
|
+
readTipGap(get, put);
|
|
1227
1286
|
}
|
|
1228
1287
|
readLineValue(lineValue(i), get, put, directed[i]);
|
|
1229
1288
|
readHooks(get, put, keywords[snapshot.edgeSource(i)], keywords[snapshot.edgeTarget(i)]);
|
|
1230
1289
|
};
|
|
1231
1290
|
const directed = directedEdges(snapshot);
|
|
1291
|
+
const bows = drawsStraightLines(draw) || block !== null ? /* @__PURE__ */ new Map() : sharedArcBows(snapshot, directed);
|
|
1232
1292
|
const keywords = [];
|
|
1233
1293
|
const weights = explicitWeights(snapshot);
|
|
1234
1294
|
const lineValue = (e) => weights.isExplicit(e) ? weights.value(e) : numberOrNull(cells(snapshot.edges, e)(VALUE_COLUMN));
|
|
@@ -1497,10 +1557,7 @@ function lineParams(get, directed, approximate) {
|
|
|
1497
1557
|
if (typeof lineStyle === "string" && lineStyle !== "solid" && pajekDots(lineStyle, out, directed, approximate)) {
|
|
1498
1558
|
out.set("p", "Dots");
|
|
1499
1559
|
}
|
|
1500
|
-
|
|
1501
|
-
if (typeof position === "number" && position > 0) {
|
|
1502
|
-
out.set("ap", position);
|
|
1503
|
-
}
|
|
1560
|
+
arrowParams(get, out);
|
|
1504
1561
|
lineLabelParams(get, out, approximate);
|
|
1505
1562
|
const target = get("targetArrow");
|
|
1506
1563
|
if (target !== null && target !== (directed ? "triangle" : "none")) {
|
|
@@ -1512,6 +1569,16 @@ function lineParams(get, directed, approximate) {
|
|
|
1512
1569
|
}
|
|
1513
1570
|
return out;
|
|
1514
1571
|
}
|
|
1572
|
+
function arrowParams(get, out) {
|
|
1573
|
+
const arrowSize = get("arrowSize");
|
|
1574
|
+
if (typeof arrowSize === "number" && arrowSize !== 1) {
|
|
1575
|
+
out.set("s", arrowSize);
|
|
1576
|
+
}
|
|
1577
|
+
const position = get("arrowPosition");
|
|
1578
|
+
if (typeof position === "number" && position > 0) {
|
|
1579
|
+
out.set("ap", position);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1515
1582
|
function lineLabelParams(get, out, approximate) {
|
|
1516
1583
|
const label = get("label");
|
|
1517
1584
|
if (typeof label === "string" && label !== "") {
|
|
@@ -1700,6 +1767,8 @@ function lineRestated(key, directed) {
|
|
|
1700
1767
|
return directed ? Number(defaults.width) : Number(defaults.width) / EDGE_WIDTH_PER_W;
|
|
1701
1768
|
case "p":
|
|
1702
1769
|
return "Solid";
|
|
1770
|
+
case "s":
|
|
1771
|
+
return 1;
|
|
1703
1772
|
default:
|
|
1704
1773
|
return 0;
|
|
1705
1774
|
}
|
|
@@ -4292,4 +4361,4 @@ export {
|
|
|
4292
4361
|
pajekImporter as d,
|
|
4293
4362
|
pajekExporter as p
|
|
4294
4363
|
};
|
|
4295
|
-
//# sourceMappingURL=importer-
|
|
4364
|
+
//# sourceMappingURL=importer-DgG4v1Ms.js.map
|