@graphty/graph-io 0.3.48 → 0.3.49
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-C2riR4NT.js → approximations-Bzn3L-je.js} +2 -2
- package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-Bzn3L-je.js.map} +1 -1
- package/dist/chunks/bends-BGXjv_U4.js +129 -0
- package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
- package/dist/chunks/{block-Cu22ewuS.js → block-iptrlMBb.js} +906 -164
- package/dist/chunks/block-iptrlMBb.js.map +1 -0
- package/dist/chunks/choose-CczZJaX_.js +717 -0
- package/dist/chunks/choose-CczZJaX_.js.map +1 -0
- package/dist/chunks/{codes-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/{context-cgmmOxZ2.js → context-C3p0RQxR.js} +5 -4
- package/dist/chunks/{context-cgmmOxZ2.js.map → context-C3p0RQxR.js.map} +1 -1
- package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
- package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
- package/dist/chunks/{credentials-BiQsnMTb.js → credentials-DXHx7nwR.js} +16 -14
- package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
- package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
- package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-DLA5kINx.js} +7 -2
- package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
- package/dist/chunks/{emit-CD8xnY8s.js → emit-BwHQkZle.js} +1660 -133
- package/dist/chunks/emit-BwHQkZle.js.map +1 -0
- package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
- package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
- package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-D2CETOMK.js} +1222 -156
- package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
- package/dist/chunks/{exporter-BIdaoIgh.js → exporter-D9yMtocA.js} +7 -7
- package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-D9yMtocA.js.map} +1 -1
- package/dist/chunks/{exporter-DtVU80Fa.js → exporter-_jrBTnos.js} +9 -8
- package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-_jrBTnos.js.map} +1 -1
- package/dist/chunks/{exporter-ChjL5fmP.js → exporter-nDfxIK5D.js} +9 -8
- package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-nDfxIK5D.js.map} +1 -1
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-CP6YD34u.js → generic-ymWCETAJ.js} +387 -31
- package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
- package/dist/chunks/{importer-e3huMZbm.js → importer-B92x1xY5.js} +14 -10
- package/dist/chunks/importer-B92x1xY5.js.map +1 -0
- package/dist/chunks/{importer-B87_fmVx.js → importer-CT9mJ1nn.js} +326 -84
- package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
- package/dist/chunks/{importer-CB_zV5_L.js → importer-DaLTjbds.js} +116 -1102
- package/dist/chunks/importer-DaLTjbds.js.map +1 -0
- package/dist/chunks/{importer-DPZDN40-.js → importer-GREKMdIf.js} +25 -17
- package/dist/chunks/importer-GREKMdIf.js.map +1 -0
- package/dist/chunks/{importer-Bji2MeWr.js → importer-PqaaKKnY.js} +13 -10
- package/dist/chunks/{importer-Bji2MeWr.js.map → importer-PqaaKKnY.js.map} +1 -1
- package/dist/chunks/{importer-Cyy6UseH.js → importer-Vn5QvmmJ.js} +66 -13
- package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
- package/dist/chunks/{importer-CVT-JyDE.js → importer-vRq4h3j5.js} +1469 -356
- package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
- package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
- package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
- package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-Clf4QIyl.js} +282 -74
- package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
- package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
- package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
- package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
- package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
- package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-EokFic1V.js} +5 -5
- package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
- package/dist/chunks/{styles-CaABMoO1.js → styles-CCs214_3.js} +1237 -138
- package/dist/chunks/styles-CCs214_3.js.map +1 -0
- package/dist/chunks/styles-Cm62yyQX.js +2812 -0
- package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
- package/dist/chunks/styles-DPQQIig4.js +1928 -0
- package/dist/chunks/styles-DPQQIig4.js.map +1 -0
- package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-UMFdNqze.js} +503 -172
- package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
- package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -7
- package/dist/cx.js +2 -2
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -12
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +847 -193
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +232 -220
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +3 -2
- package/dist/neo4j.js +6 -6
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/positions.js +45 -3
- package/dist/positions.js.map +1 -1
- package/dist/sources-cypher.js +138 -23
- package/dist/sources-cypher.js.map +1 -1
- package/dist/sources-ndex.js +2 -2
- package/dist/sources-rest.js +16 -6
- package/dist/sources-rest.js.map +1 -1
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +405 -0
- package/dist/sources-sparql.js.map +1 -0
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +5 -1
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +24 -1
- package/dist/src/formats/cx/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +117 -11
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +1 -0
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts.map +1 -1
- package/dist/src/formats/cx2/styles.js +3 -1
- package/dist/src/formats/cx2/styles.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +1 -0
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +2 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -1
- package/dist/src/formats/cys/styles.js +15 -7
- package/dist/src/formats/cys/styles.js.map +1 -1
- package/dist/src/formats/dot/drawing.d.ts +98 -0
- package/dist/src/formats/dot/drawing.d.ts.map +1 -0
- package/dist/src/formats/dot/drawing.js +734 -0
- package/dist/src/formats/dot/drawing.js.map +1 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +108 -31
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +34 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +179 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/record.d.ts +50 -0
- package/dist/src/formats/dot/record.d.ts.map +1 -0
- package/dist/src/formats/dot/record.js +275 -0
- package/dist/src/formats/dot/record.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +62 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1454 -119
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
- package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
- package/dist/src/formats/gexf/dialog-metrics.js +59 -0
- package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
- package/dist/src/formats/gexf/importer.d.ts +7 -0
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +41 -5
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/preview.d.ts +77 -0
- package/dist/src/formats/gexf/preview.d.ts.map +1 -0
- package/dist/src/formats/gexf/preview.js +191 -0
- package/dist/src/formats/gexf/preview.js.map +1 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +2 -1
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +58 -31
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +848 -225
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +5 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +258 -71
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +1 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +1 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +7 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -1
- package/dist/src/formats/gml/positions.js +29 -7
- package/dist/src/formats/gml/positions.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +753 -101
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-plain.js +6 -10
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +692 -161
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +3 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +16 -6
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +3 -2
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +39 -5
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +13 -2
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +42 -6
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +1 -1
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +1 -1
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +5 -2
- package/dist/src/formats/json/positions.d.ts.map +1 -1
- package/dist/src/formats/json/positions.js +20 -4
- package/dist/src/formats/json/positions.js.map +1 -1
- package/dist/src/formats/json/styles.d.ts +12 -1
- package/dist/src/formats/json/styles.d.ts.map +1 -1
- package/dist/src/formats/json/styles.js +1755 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +96 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +372 -0
- package/dist/src/formats/pajek/draw.js.map +1 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +70 -51
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +9 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +233 -102
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +1 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +15 -7
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1278 -114
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +10 -1
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +26 -2
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +1 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +65 -5
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +23 -3
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +277 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/convert.d.ts.map +1 -1
- package/dist/src/positions/convert.js +11 -1
- package/dist/src/positions/convert.js.map +1 -1
- package/dist/src/positions/extract.d.ts.map +1 -1
- package/dist/src/positions/extract.js +53 -1
- package/dist/src/positions/extract.js.map +1 -1
- package/dist/src/positions/index.d.ts +1 -1
- package/dist/src/positions/index.d.ts.map +1 -1
- package/dist/src/positions/types.d.ts +59 -0
- package/dist/src/positions/types.d.ts.map +1 -1
- package/dist/src/sources/builtins.d.ts +1 -1
- package/dist/src/sources/builtins.d.ts.map +1 -1
- package/dist/src/sources/builtins.js +8 -2
- package/dist/src/sources/builtins.js.map +1 -1
- package/dist/src/sources/context.d.ts.map +1 -1
- package/dist/src/sources/context.js +1 -0
- package/dist/src/sources/context.js.map +1 -1
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
- package/dist/src/sources/cypher/descriptor.js +5 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -1
- package/dist/src/sources/cypher/index.d.ts.map +1 -1
- package/dist/src/sources/cypher/index.js +124 -18
- package/dist/src/sources/cypher/index.js.map +1 -1
- package/dist/src/sources/cypher/params.d.ts +1 -1
- package/dist/src/sources/cypher/params.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.d.ts +17 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.js +31 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -1
- package/dist/src/sources/ids.d.ts +5 -0
- package/dist/src/sources/ids.d.ts.map +1 -1
- package/dist/src/sources/ids.js +5 -0
- package/dist/src/sources/ids.js.map +1 -1
- package/dist/src/sources/params.d.ts +3 -0
- package/dist/src/sources/params.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.js +5 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -1
- package/dist/src/sources/rest/source.d.ts.map +1 -1
- package/dist/src/sources/rest/source.js +15 -0
- package/dist/src/sources/rest/source.js.map +1 -1
- package/dist/src/sources/sigv4.d.ts +5 -3
- package/dist/src/sources/sigv4.d.ts.map +1 -1
- package/dist/src/sources/sigv4.js +6 -4
- package/dist/src/sources/sigv4.js.map +1 -1
- package/dist/src/sources/sparql/descriptor.d.ts +10 -0
- package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
- package/dist/src/sources/sparql/descriptor.js +64 -0
- package/dist/src/sources/sparql/descriptor.js.map +1 -0
- package/dist/src/sources/sparql/index.d.ts +28 -0
- package/dist/src/sources/sparql/index.d.ts.map +1 -0
- package/dist/src/sources/sparql/index.js +314 -0
- package/dist/src/sources/sparql/index.js.map +1 -0
- package/dist/src/sources/sparql/ntriples.d.ts +69 -0
- package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
- package/dist/src/sources/sparql/ntriples.js +180 -0
- package/dist/src/sources/sparql/ntriples.js.map +1 -0
- package/dist/src/sources/sparql/params.d.ts +27 -0
- package/dist/src/sources/sparql/params.d.ts.map +1 -0
- package/dist/src/sources/sparql/params.js +5 -0
- package/dist/src/sources/sparql/params.js.map +1 -0
- package/dist/src/sources/sparql/query.d.ts +72 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +113 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/types.d.ts +31 -0
- package/dist/src/sources/types.d.ts.map +1 -1
- package/dist/src/styles/annotations.d.ts +61 -5
- package/dist/src/styles/annotations.d.ts.map +1 -1
- package/dist/src/styles/annotations.js +130 -22
- package/dist/src/styles/annotations.js.map +1 -1
- package/dist/src/styles/canon/bends.d.ts +46 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -1
- package/dist/src/styles/canon/bends.js +123 -0
- package/dist/src/styles/canon/bends.js.map +1 -1
- package/dist/src/styles/canon/color-tables.d.ts +6 -1
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
- package/dist/src/styles/canon/color-tables.js +10 -4
- package/dist/src/styles/canon/color-tables.js.map +1 -1
- package/dist/src/styles/canon/color.d.ts +3 -1
- package/dist/src/styles/canon/color.d.ts.map +1 -1
- package/dist/src/styles/canon/color.js +103 -3
- package/dist/src/styles/canon/color.js.map +1 -1
- package/dist/src/styles/canon/enums.d.ts +2 -2
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +81 -7
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/canon/graphviz.d.ts +12 -3
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
- package/dist/src/styles/canon/graphviz.js +57 -9
- package/dist/src/styles/canon/graphviz.js.map +1 -1
- package/dist/src/styles/canon/number.d.ts +8 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -1
- package/dist/src/styles/canon/number.js +18 -0
- package/dist/src/styles/canon/number.js.map +1 -1
- package/dist/src/styles/canon/text.d.ts +29 -2
- package/dist/src/styles/canon/text.d.ts.map +1 -1
- package/dist/src/styles/canon/text.js +156 -16
- package/dist/src/styles/canon/text.js.map +1 -1
- package/dist/src/styles/codes.d.ts +2 -0
- package/dist/src/styles/codes.d.ts.map +1 -1
- package/dist/src/styles/codes.js +2 -0
- package/dist/src/styles/codes.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +1015 -79
- 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 +3 -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 +202 -9
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/face.d.ts +20 -0
- package/dist/src/styles/cyjs/face.d.ts.map +1 -0
- package/dist/src/styles/cyjs/face.js +332 -0
- package/dist/src/styles/cyjs/face.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +44 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +461 -26
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cyjs/routes.d.ts +53 -0
- package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
- package/dist/src/styles/cyjs/routes.js +360 -0
- package/dist/src/styles/cyjs/routes.js.map +1 -0
- package/dist/src/styles/cytoscape/charts.d.ts +23 -0
- package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/charts.js +560 -0
- package/dist/src/styles/cytoscape/charts.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +156 -48
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +387 -77
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/mappings.js +92 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +42 -2
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +623 -17
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +46 -26
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +308 -71
- package/dist/src/styles/defaults.js.map +1 -1
- package/dist/src/styles/index.d.ts +4 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +3 -2
- package/dist/src/styles/index.js.map +1 -1
- package/dist/src/styles/internal.d.ts +1 -0
- package/dist/src/styles/internal.d.ts.map +1 -1
- package/dist/src/styles/internal.js +1 -0
- package/dist/src/styles/internal.js.map +1 -1
- package/dist/src/styles/io/generic.d.ts.map +1 -1
- package/dist/src/styles/io/generic.js +56 -16
- package/dist/src/styles/io/generic.js.map +1 -1
- package/dist/src/styles/io/round-trip.d.ts +56 -0
- package/dist/src/styles/io/round-trip.d.ts.map +1 -0
- package/dist/src/styles/io/round-trip.js +138 -0
- package/dist/src/styles/io/round-trip.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +6 -1
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/notes.d.ts.map +1 -1
- package/dist/src/styles/notes.js +1 -0
- package/dist/src/styles/notes.js.map +1 -1
- package/dist/src/styles/plan/features.d.ts +1 -1
- package/dist/src/styles/plan/features.d.ts.map +1 -1
- package/dist/src/styles/plan/features.js +22 -2
- package/dist/src/styles/plan/features.js.map +1 -1
- package/dist/src/styles/plan/index.d.ts +1 -1
- package/dist/src/styles/plan/index.d.ts.map +1 -1
- package/dist/src/styles/plan/index.js +1 -1
- package/dist/src/styles/plan/index.js.map +1 -1
- package/dist/src/styles/plan/plan.d.ts.map +1 -1
- package/dist/src/styles/plan/plan.js +61 -4
- package/dist/src/styles/plan/plan.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +11 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +40 -4
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/slots.d.ts +14 -0
- package/dist/src/styles/slots.d.ts.map +1 -0
- package/dist/src/styles/slots.js +20 -0
- package/dist/src/styles/slots.js.map +1 -0
- package/dist/src/styles/types.d.ts +622 -6
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts +3 -2
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +203 -0
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/styles.js +30 -239
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/package.json +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +143 -9
- package/src/formats/cx2/importer.ts +1 -0
- package/src/formats/cx2/styles.ts +3 -1
- package/src/formats/cys/importer.ts +1 -0
- package/src/formats/cys/styles.ts +27 -5
- package/src/formats/dot/drawing.ts +799 -0
- package/src/formats/dot/importer.ts +120 -35
- package/src/formats/dot/label-places.ts +228 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1654 -153
- package/src/formats/gexf/dialog-metrics.ts +61 -0
- package/src/formats/gexf/importer.ts +50 -5
- package/src/formats/gexf/preview.ts +217 -0
- package/src/formats/gexf/schema.ts +2 -1
- package/src/formats/gexf/styles.ts +1099 -245
- package/src/formats/gml/importer.ts +291 -76
- package/src/formats/gml/index.ts +1 -1
- package/src/formats/gml/positions.ts +29 -7
- package/src/formats/gml/styles.ts +851 -109
- package/src/formats/graphml/styles-plain.ts +6 -15
- package/src/formats/graphml/styles-yed.ts +762 -173
- package/src/formats/graphml/styles-yfiles3.ts +485 -63
- package/src/formats/graphml/yfiles.ts +19 -6
- package/src/formats/json/dialect.ts +41 -5
- package/src/formats/json/importer.ts +59 -7
- package/src/formats/json/index.ts +1 -0
- package/src/formats/json/positions.ts +22 -5
- package/src/formats/json/styles.ts +2041 -185
- package/src/formats/pajek/draw.ts +458 -0
- package/src/formats/pajek/exporter.ts +81 -49
- package/src/formats/pajek/importer.ts +278 -103
- package/src/formats/pajek/index.ts +1 -0
- package/src/formats/pajek/styles.ts +1381 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +330 -71
- package/src/index.ts +5 -1
- package/src/positions/convert.ts +12 -1
- package/src/positions/extract.ts +55 -1
- package/src/positions/index.ts +1 -0
- package/src/positions/types.ts +60 -0
- package/src/sources/builtins.ts +8 -1
- package/src/sources/context.ts +1 -0
- package/src/sources/cypher/descriptor.ts +7 -1
- package/src/sources/cypher/index.ts +148 -18
- package/src/sources/cypher/params.ts +1 -1
- package/src/sources/cypher/query-builder.ts +33 -0
- package/src/sources/ids.ts +6 -0
- package/src/sources/params.ts +3 -0
- package/src/sources/rest/descriptor.ts +5 -0
- package/src/sources/rest/source.ts +16 -0
- package/src/sources/sigv4.ts +6 -4
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +356 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +162 -0
- package/src/sources/types.ts +35 -0
- package/src/styles/annotations.ts +201 -27
- package/src/styles/canon/bends.ts +137 -0
- package/src/styles/canon/color-tables.ts +10 -4
- package/src/styles/canon/color.ts +105 -3
- package/src/styles/canon/enums.ts +98 -8
- package/src/styles/canon/graphviz.ts +71 -10
- package/src/styles/canon/number.ts +19 -0
- package/src/styles/canon/text.ts +187 -16
- package/src/styles/codes.ts +2 -0
- package/src/styles/cyjs/cascade.ts +1160 -84
- package/src/styles/cyjs/defaults-table.ts +3 -0
- package/src/styles/cyjs/emit.ts +233 -13
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +492 -27
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +170 -48
- package/src/styles/cytoscape/lexicon.ts +431 -78
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +741 -17
- package/src/styles/defaults.ts +417 -108
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +6 -1
- package/src/styles/notes.ts +1 -0
- package/src/styles/plan/features.ts +23 -2
- package/src/styles/plan/index.ts +1 -1
- package/src/styles/plan/plan.ts +69 -5
- package/src/styles/plan/resolve.ts +47 -4
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +633 -5
- package/src/styles/vocabulary.ts +211 -2
- package/dist/chunks/block-Cu22ewuS.js.map +0 -1
- package/dist/chunks/choose-Cdx6Enl2.js +0 -57
- package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
- package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
- package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
- package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
- package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
- package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
- package/dist/chunks/format-BMS-1Nxb.js +0 -64
- package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
- package/dist/chunks/generic-CP6YD34u.js.map +0 -1
- package/dist/chunks/importer-B87_fmVx.js.map +0 -1
- package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
- package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
- package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
- package/dist/chunks/importer-DPZDN40-.js.map +0 -1
- package/dist/chunks/importer-e3huMZbm.js.map +0 -1
- package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
- package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
- package/dist/chunks/styles-CaABMoO1.js.map +0 -1
- package/dist/chunks/styles-P_gmFAOi.js +0 -770
- package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
- package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
- package/dist/chunks/writer-DvHTl36J.js +0 -449
- package/dist/chunks/writer-DvHTl36J.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-BXiAb-1h.js","sources":["../../src/common/direction.ts","../../src/common/format.ts"],"sourcesContent":["/**\n * Direction resolution through the sink (design sections 3.6 and 8.4, decision D-DIR): the\n * importer reads the file's header direction, calls `sink.setDirected()` once before the first\n * edge, then pushes every edge as it is read. Mixed files are handled per `onMixedDirection`:\n *\n * - \"expand\" (default): an undirected edge into a directed sink becomes two logical edges linked\n * by the `graphty.pair` column with `graphty.directed` = false on both halves; a directed edge\n * into an undirected sink triggers ONE `setDirected(true, { expand: true })`, after which the\n * builder has expanded everything pushed so far and the importer continues in directed mode.\n * - \"directed\" / \"undirected\": every edge is treated that way (the distinction is dropped and\n * reported once, with the count).\n * - \"error\": the first edge whose direction differs from the sink's aborts the import.\n *\n * A locked or non-empty sink wins over the file (design section 8.4 precedence): a refused\n * `setDirected` is recorded as a coercion issue and the importer continues with `sink.directed`,\n * expanding every edge that differs. A GEXF `mutual` edge expands like an undirected one with the\n * additional `graphty.mutual` role column set on its primary half.\n *\n * The reserved columns are declared with exactly the builder's own declarations so that a sink the\n * builder already expanded hands back the existing handles.\n */\n\nimport {\n type Column,\n type ColumnDecl,\n type ColumnHandle,\n GraphFormatError,\n type GraphSink,\n type GraphSnapshot,\n INVALID_INDEX,\n type NodeId,\n} from \"@graphty/graph-format\";\n\nimport { DIRECTION_FORCED_CODE, DIRECTION_REFUSED_CODE, MIXED_DIRECTION_CODE } from \"./codes.js\";\nimport { type ImportReportBuilder } from \"./report.js\";\n\n/**\n * The direction of one source edge.\n * @public\n * @category Plugin helpers\n */\nexport type EdgeKind = \"directed\" | \"undirected\" | \"mutual\";\n\n/**\n * Where an edge or header was read, for issues.\n * @public\n * @category Plugin helpers\n */\nexport interface EdgeLocation {\n /** The 1-based line, when known. */\n readonly line?: number | null | undefined;\n /** The edge id or another element name, when known. */\n readonly element?: string | null | undefined;\n}\n\n/**\n * The name of the bool edge column that, in a graph with both directed and undirected edges, says\n * which edges were directed in the file (true) and which were undirected (false).\n * @category Plugin helpers\n */\nexport const DIRECTED_COLUMN = \"graphty.directed\";\n\n/**\n * The name of the edge column that links the two edges an undirected edge is stored as, in a graph\n * with both directed and undirected edges: each holds the index of the other.\n * @category Plugin helpers\n */\nexport const PAIR_COLUMN = \"graphty.pair\";\n\n/**\n * The name of the bool edge column that marks a GEXF `mutual` edge.\n * @category Plugin helpers\n */\nexport const MUTUAL_COLUMN = \"graphty.mutual\";\n\nexport { DIRECTION_FORCED_CODE, DIRECTION_REFUSED_CODE, MIXED_DIRECTION_CODE } from \"./codes.js\";\n\nconst DIRECTED_DECL: ColumnDecl = { name: DIRECTED_COLUMN, dtype: \"bool\", role: \"directed\" };\nconst PAIR_DECL: ColumnDecl = { name: PAIR_COLUMN, dtype: \"u32\", role: \"pair\", refersTo: \"edge\" };\nconst MUTUAL_DECL: ColumnDecl = { name: MUTUAL_COLUMN, dtype: \"bool\", role: \"mutual\" };\n\n/**\n * Adds edges to the sink and handles files whose edges have different directions, the way\n * `onMixedDirection` asks. Make one per import call, call `setHeader()` once with the direction the\n * file declares, then `addEdge()` for each edge. In a directed graph an undirected edge is stored as\n * two edges, one each way, linked so an exporter writes them back as one.\n * @category Writing a format\n */\nexport class DirectionResolver {\n private readonly sink: GraphSink;\n\n private readonly report: ImportReportBuilder;\n\n private readonly policy: \"expand\" | \"directed\" | \"undirected\" | \"error\";\n\n private directedHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private pairHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n private mutualHandle: ColumnHandle = INVALID_INDEX as ColumnHandle;\n\n /** The first edge index this resolver pushed, for the backfill of graphty.directed; -1 before the first. */\n private firstEdge = -1;\n\n /** The next edge index this resolver expects to receive (contiguity between compactions, I16). */\n private nextEdge = -1;\n\n private forcedCount = 0;\n\n private headerSet = false;\n\n private mirrorOfLast: number = INVALID_INDEX;\n\n /**\n * Create a resolver.\n * @param sink - the sink edges are pushed into\n * @param report - the report issues are recorded in\n * @param policy - the resolved onMixedDirection option\n */\n constructor(sink: GraphSink, report: ImportReportBuilder, policy: \"expand\" | \"directed\" | \"undirected\" | \"error\") {\n this.sink = sink;\n this.report = report;\n this.policy = policy;\n }\n\n /**\n * The sink's current direction.\n * @returns true when directed\n */\n get directed(): boolean {\n return this.sink.directed;\n }\n\n /**\n * Whether the graph holds undirected edges stored as two edges.\n * @returns true once the first such edge was added\n */\n get expanded(): boolean {\n return this.pairHandle !== INVALID_INDEX;\n }\n\n /**\n * Set the graph's direction before the first edge: the direction the file declares, or the\n * `defaultDirected` option for a file that declares none. Under `onMixedDirection` \"directed\" or\n * \"undirected\" that direction is used instead, with a warning when it differs. When the sink\n * cannot change direction (a caller's builder that already holds edges or was locked), the\n * sink's direction stands and a warning is recorded.\n * @param headerDirected - the direction the file declares (or the default)\n * @param where - the line of the header, when known\n */\n setHeader(headerDirected: boolean, where?: EdgeLocation): void {\n this.headerSet = true;\n let wanted = headerDirected;\n if (this.policy === \"directed\" || this.policy === \"undirected\") {\n wanted = this.policy === \"directed\";\n if (wanted !== headerDirected) {\n // once: this says it for every edge, so no edge repeats it\n this.report.warnOnce(\n \"coercion\",\n DIRECTION_FORCED_CODE,\n `the file declares ${direction(headerDirected)} edges; read as ${direction(wanted)} per onMixedDirection`,\n { line: where?.line ?? null },\n `${DIRECTION_FORCED_CODE}:${direction(headerDirected)}`,\n );\n }\n }\n const { sink } = this;\n if (sink.directed === wanted) {\n this.adoptExisting();\n return;\n }\n try {\n if (wanted && sink.edgeCount > 0 && !sink.directedLocked) {\n const before = sink.edgeCount;\n sink.setDirected(true, { expand: true });\n this.adoptExpansionColumns();\n this.report.counts.expandedMixed += before;\n } else {\n sink.setDirected(wanted);\n }\n } catch (err) {\n if (!(err instanceof GraphFormatError) || err.code !== \"E_DIRECTED\") {\n throw err;\n }\n this.report.warning(\n \"coercion\",\n DIRECTION_REFUSED_CODE,\n `the file is ${direction(wanted)} but the sink is ${direction(sink.directed)} (${reasonOf(err)}); read as ${direction(sink.directed)}`,\n { line: where?.line ?? null },\n );\n }\n this.adoptExisting();\n }\n\n /**\n * Pick up reserved columns a caller's sink already holds (an earlier expansion), so every edge\n * pushed from now on gets its graphty.directed value.\n */\n private adoptExisting(): void {\n if (this.pairHandle === INVALID_INDEX && this.sink.edgeColumn(PAIR_COLUMN) !== INVALID_INDEX) {\n this.adoptExpansionColumns();\n }\n }\n\n /**\n * The second edge of the edge the last addEdge() call added, when that edge was stored as two;\n * otherwise INVALID_INDEX (4294967295). An edge attribute or weight you set after addEdge()\n * belongs on both: set it on the index addEdge() returned and, when this is not INVALID_INDEX,\n * on this index too.\n * @returns the second edge's index, or INVALID_INDEX\n */\n get lastMirror(): number {\n return this.mirrorOfLast;\n }\n\n /**\n * Add one edge. An edge with the graph's direction is added as it is; one with the other\n * direction is stored as two edges, given the graph's direction, or refused, as\n * `onMixedDirection` says. When it is stored as two, the return value is the first and\n * `lastMirror` the second.\n * @param source - the source id\n * @param target - the target id\n * @param kind - the edge's direction in the file\n * @param weight - the weight, or undefined when the file gives none\n * @param where - the line and element, for issues\n * @returns the index of the edge added (the first one, when it was stored as two)\n */\n addEdge(source: NodeId, target: NodeId, kind: EdgeKind, weight?: number, where?: EdgeLocation): number {\n if (!this.headerSet) {\n throw new GraphFormatError(\"E_DIRECTED\", \"DirectionResolver.setHeader() must run before the first edge\", {\n reason: \"header not set\",\n });\n }\n const { sink } = this;\n this.mirrorOfLast = INVALID_INDEX;\n const edgeDirected = kind !== \"undirected\";\n if (edgeDirected === sink.directed && kind !== \"mutual\") {\n const e = sink.addEdge(source, target, weight);\n this.track(e);\n if (this.directedHandle !== INVALID_INDEX) {\n sink.setEdgeValue(this.directedHandle, e, edgeDirected);\n }\n return e;\n }\n switch (this.policy) {\n case \"directed\":\n case \"undirected\": {\n // the sink's direction is the policy's (or a locked sink's); the edge is pushed as the sink's kind\n this.forcedCount++;\n this.report.warnOnce(\n \"coercion\",\n DIRECTION_FORCED_CODE,\n `${kind} edges read as ${direction(sink.directed)} per onMixedDirection`,\n where,\n `${DIRECTION_FORCED_CODE}:${kind}`,\n );\n const e = sink.addEdge(source, target, weight);\n this.track(e);\n if (this.directedHandle !== INVALID_INDEX) {\n sink.setEdgeValue(this.directedHandle, e, sink.directed);\n }\n return e;\n }\n case \"error\":\n this.report.error(\n \"validation-error\",\n MIXED_DIRECTION_CODE,\n `${kind} edge in a ${direction(sink.directed)} graph (onMixedDirection: \"error\")`,\n where,\n );\n throw this.report.abort(\"mixed direction refused\", { code: MIXED_DIRECTION_CODE });\n case \"expand\":\n return this.expand(source, target, kind, weight, where);\n default: {\n const name: string = this.policy;\n throw new GraphFormatError(\"E_UNSUPPORTED\", `unknown onMixedDirection ${name}`, {\n option: \"onMixedDirection\",\n found: name,\n });\n }\n }\n }\n\n /**\n * How many edges were given a direction other than their own, under `onMixedDirection`\n * \"directed\" or \"undirected\".\n * @returns the count\n */\n get forced(): number {\n return this.forcedCount;\n }\n\n /**\n * Expand one edge that differs from the sink's direction.\n * @param source - the source id\n * @param target - the target id\n * @param kind - the edge's direction in the file\n * @param weight - the weight, or undefined\n * @param where - the line and element, for issues\n * @returns the primary edge index\n */\n private expand(\n source: NodeId,\n target: NodeId,\n kind: EdgeKind,\n weight: number | undefined,\n where: EdgeLocation | undefined,\n ): number {\n const { sink } = this;\n if (!sink.directed) {\n // a directed (or mutual) edge into an undirected sink: expand the sink once\n try {\n const before = sink.edgeCount;\n sink.setDirected(true, { expand: true });\n this.adoptExpansionColumns();\n this.report.counts.expandedMixed += before;\n } catch (err) {\n if (!(err instanceof GraphFormatError) || err.code !== \"E_DIRECTED\") {\n throw err;\n }\n this.report.error(\n \"coercion\",\n DIRECTION_REFUSED_CODE,\n `${direction(true)} edge in a locked ${direction(false)} sink cannot be expanded`,\n where,\n );\n throw this.report.abort(\"the sink refused the expansion to directed\", {\n code: DIRECTION_REFUSED_CODE,\n reason: err.details.reason,\n });\n }\n if (kind === \"directed\") {\n const e = sink.addEdge(source, target, weight);\n this.track(e);\n sink.setEdgeValue(this.directedHandle, e, true);\n return e;\n }\n }\n this.ensureExpansionColumns();\n const first = sink.addEdge(source, target, weight);\n this.track(first);\n const mutual = kind === \"mutual\";\n sink.setEdgeValue(this.directedHandle, first, mutual);\n this.report.counts.expandedMixed++;\n if (mutual) {\n this.ensureMutualColumn();\n sink.setEdgeValue(this.mutualHandle, first, true);\n }\n const u = sink.indexOf(source);\n const v = sink.indexOf(target);\n if (u === v) {\n // an undirected self-loop is one arc (I7); the builder does not mirror it either\n return first;\n }\n const mirror = sink.addEdge(target, source, weight); // NOSONAR(S2234): the mirror arc runs the other way on purpose\n this.track(mirror);\n this.mirrorOfLast = mirror;\n sink.setEdgeValue(this.directedHandle, mirror, mutual);\n sink.setEdgeValue(this.pairHandle, first, mirror);\n sink.setEdgeValue(this.pairHandle, mirror, first);\n return first;\n }\n\n /**\n * Note an edge index this resolver pushed, for the backfill of graphty.directed.\n * @param e - the edge index\n */\n private track(e: number): void {\n if (this.firstEdge < 0) {\n this.firstEdge = e;\n }\n this.nextEdge = e + 1;\n }\n\n /**\n * Pick up the reserved columns the builder wrote during its own expansion.\n */\n private adoptExpansionColumns(): void {\n this.directedHandle = this.sink.declareEdgeColumn(DIRECTED_DECL);\n this.pairHandle = this.sink.declareEdgeColumn(PAIR_DECL);\n }\n\n /**\n * Declare the reserved columns on first use in a directed sink and backfill graphty.directed\n * = true for every edge this resolver pushed so far (they were directed in the source).\n */\n private ensureExpansionColumns(): void {\n if (this.pairHandle !== INVALID_INDEX) {\n return;\n }\n this.directedHandle = this.sink.declareEdgeColumn(DIRECTED_DECL);\n this.pairHandle = this.sink.declareEdgeColumn(PAIR_DECL);\n if (this.firstEdge >= 0) {\n for (let e = this.firstEdge; e < this.nextEdge; e++) {\n this.sink.setEdgeValue(this.directedHandle, e, true);\n }\n }\n }\n\n /** Declare graphty.mutual on first use. */\n private ensureMutualColumn(): void {\n if (this.mutualHandle === INVALID_INDEX) {\n this.mutualHandle = this.sink.declareEdgeColumn(MUTUAL_DECL);\n }\n }\n}\n\n/**\n * The reason of a refused setDirected(), for messages.\n * @param err - the E_DIRECTED error\n * @returns details.reason when it is a string, \"refused\" otherwise\n */\nfunction reasonOf(err: GraphFormatError): string {\n const { reason } = err.details;\n return typeof reason === \"string\" ? reason : \"refused\";\n}\n\n/**\n * The word for a direction, for messages.\n * @param directed - the direction\n * @returns \"directed\" or \"undirected\"\n */\nfunction direction(directed: boolean): string {\n return directed ? \"directed\" : \"undirected\";\n}\n\n// ============================================================ the exporter side\n\n/**\n * What an exporter needs to know about edge direction, from `pairFolding(snapshot)`. In a graph\n * with both directed and undirected edges, each undirected edge is stored as two edges, one each\n * way. `folded(e)` tells you which of the two to skip, so the edge is written once, and\n * `sourceDirected(e)` whether an edge was directed. A GEXF `mutual` edge is also stored as two\n * edges; it is written as two directed edges unless you pass `foldMutual: true`.\n * @public\n * @category Plugin helpers\n */\nexport interface PairFolding {\n /** Whether the graph holds any edge stored as two edges. When false, every method answers as for a plain edge. */\n readonly expanded: boolean;\n /** How many GEXF mutual edges the graph holds, each counted once. */\n readonly mutualCount: number;\n /**\n * Whether to skip an edge: true for the second of the two edges an undirected edge (or, with\n * `foldMutual`, a mutual edge) is stored as. Write the first and skip this one.\n * @param e - the edge index\n * @returns true when the edge must be skipped\n */\n folded(e: number): boolean;\n /**\n * The other of the two edges an undirected or mutual edge is stored as.\n * @param e - the edge index\n * @returns the other edge's index, or INVALID_INDEX (4294967295) for an edge stored once\n */\n mateOf(e: number): number;\n /**\n * Whether an edge was directed in the file it was read from: false for an undirected edge of a\n * graph with both kinds. It is true for every edge of a graph without mixed direction, an\n * undirected graph included, so the direction to write for edge `e` is\n * `snapshot.directed && sourceDirected(e)`.\n * @param e - the edge index\n * @returns whether the edge is directed\n */\n sourceDirected(e: number): boolean;\n /**\n * Whether an edge is either of the two edges a GEXF `mutual` edge is stored as.\n * @param e - the edge index\n * @returns true for a mutual edge\n */\n isMutual(e: number): boolean;\n}\n\n/**\n * The per-format choice of pairFolding().\n * @category Plugin helpers\n */\nexport interface PairFoldingOptions {\n /**\n * Write a GEXF mutual edge once, for a format that can say an edge goes both ways. When false\n * (the default), `folded()` keeps both of its edges, so it is written as two directed edges.\n */\n readonly foldMutual?: boolean | undefined;\n}\n\n/**\n * Read how a snapshot stores edge direction, for an exporter: which edges to skip so each\n * undirected edge is written once, and which edges were directed.\n * @param snapshot - the graph to write\n * @param options - whether a GEXF mutual edge is written once\n * @returns the answers, per edge\n * @category Writing a format\n */\nexport function pairFolding(snapshot: GraphSnapshot, options: PairFoldingOptions = {}): PairFolding {\n const foldMutual = options.foldMutual ?? false;\n const directedColumn = roleColumn(snapshot.edges.byRole(\"directed\"), \"bool\");\n const pairColumn = roleColumn(snapshot.edges.byRole(\"pair\"), \"u32\");\n const mutualColumn = roleColumn(snapshot.edges.byRole(\"mutual\"), \"bool\");\n const { edgeCount } = snapshot;\n const mateOf = (e: number): number => {\n if (!pairColumn?.isSet(e)) {\n return INVALID_INDEX;\n }\n const mate = pairColumn.value(e);\n return typeof mate === \"number\" && mate !== INVALID_INDEX ? mate : INVALID_INDEX;\n };\n const sourceDirected = (e: number): boolean =>\n directedColumn === null || !directedColumn.isSet(e) || directedColumn.value(e) === true;\n const isMutual = (e: number): boolean => {\n if (mutualColumn === null) {\n return false;\n }\n if (mutualColumn.isSet(e) && mutualColumn.value(e) === true) {\n return true;\n }\n const mate = mateOf(e);\n return mate !== INVALID_INDEX && mutualColumn.isSet(mate) && mutualColumn.value(mate) === true;\n };\n const folded = (e: number): boolean => {\n const mate = mateOf(e);\n if (mate === INVALID_INDEX || mate >= e) {\n return false;\n }\n // an undirected pair always folds; a mutual pair (directed on both halves) folds on request\n return !sourceDirected(e) || (foldMutual && isMutual(e));\n };\n let mutualCount = 0;\n if (mutualColumn !== null) {\n for (let e = 0; e < edgeCount; e++) {\n if (mutualColumn.isSet(e) && mutualColumn.value(e) === true && mateOf(e) > e) {\n mutualCount++;\n }\n }\n }\n return { expanded: pairColumn !== null, mutualCount, folded, mateOf, sourceDirected, isMutual };\n}\n\n/**\n * A role column when it has the dtype the role requires, else null.\n * @param column - the column, or null\n * @param dtype - the required dtype\n * @returns the column or null\n */\nfunction roleColumn(column: Column | null, dtype: \"bool\" | \"u32\"): Column | null {\n return column !== null && column.dtype === dtype ? column : null;\n}\n","/**\n * Number formatting for exporters (design section 3.7): an f32 weight is written as the shortest\n * decimal that round-trips through Math.fround (never `String(x)`, which prints\n * 0.10000000149011612 for a stored 0.1); an f64 value as its shortest JS text; a GML real always\n * with a decimal point so the dtype survives (design section 8.5); non-finite values as the\n * spelling the target syntax accepts.\n */\n\nimport type { NodeId } from \"@graphty/graph-format\";\n\n/**\n * The shortest decimal text that reads back to the same f32 value through Math.fround.\n * @param value - an f32 value (a JS number holding one)\n * @returns the text; \"Infinity\" / \"-Infinity\" / \"NaN\" for the non-finite values, \"-0\" for negative zero\n * @category Plugin helpers\n */\nexport function formatF32(value: number): string {\n if (!Number.isFinite(value)) {\n return String(value);\n }\n if (value === 0) {\n return Object.is(value, -0) ? \"-0\" : \"0\";\n }\n for (let digits = 1; digits <= 9; digits++) {\n const text = value.toPrecision(digits);\n if (Math.fround(Number(text)) === value) {\n return String(Number(text));\n }\n }\n return String(value);\n}\n\n/**\n * The shortest text of an f64 value: `String(x)`, which is already the shortest round-tripping\n * decimal in JS, except for negative zero, which `String()` writes as \"0\".\n * @param value - the value\n * @returns the text; \"Infinity\" / \"-Infinity\" / \"NaN\" for the non-finite values, \"-0\" for negative zero\n * @category Plugin helpers\n */\nexport function formatF64(value: number): string {\n return Object.is(value, -0) ? \"-0\" : String(value);\n}\n\n/**\n * The text of a node id for the text formats that write ids bare (DOT, Pajek, XGMML): the string\n * itself, or the shortest decimal of a number (formatF64).\n * @param id - the id\n * @returns the text\n */\nexport function idText(id: NodeId): string {\n return typeof id === \"number\" ? formatF64(id) : id;\n}\n\n/**\n * A decimal text with a decimal point or an exponent guaranteed for a finite value (`2.0`,\n * `1e+21`, `1.5e-7`), so an\n * untyped re-import keeps the column f64 rather than i32; negative zero is\n * written `-0.0` so it reads back as -0; non-finite values are the JS spellings (`Infinity`,\n * `-Infinity`, `NaN`), which the CSV / DOT / Pajek importers read back as text. The one\n * implementation of the \"decimal point guaranteed\" rule for every text format; GML has its own\n * spellings of the non-finite values in formatGmlReal().\n * @param value - the value\n * @param dtype - the column dtype the value comes from; f32 values use the shortest fround-round-trip text\n * @returns the text\n * @category Plugin helpers\n */\nexport function formatDecimal(value: number, dtype: \"f32\" | \"f64\" | \"i32\" | \"u32\" | \"u8\" = \"f64\"): string {\n if (!Number.isFinite(value)) {\n return String(value);\n }\n if (Object.is(value, -0)) {\n return \"-0.0\";\n }\n const text = formatNumber(value, dtype);\n // an exponent form (`1e+21`, `1.5e-7`) is already f64 text under the 5.1 grammar\n return text.includes(\".\") || text.includes(\"e\") ? text : `${text}.0`;\n}\n\n/**\n * A GML real: the shortest text with a decimal point guaranteed (`2.0`, `1.0e-7`), so a re-import\n * keeps the column real rather than int. Non-finite values have no GML spelling and are written\n * as the texts NetworkX's writer emits and its reader accepts, `+INF`, `-INF` and `NAN` (the\n * lowercase `inf` / `nan` would lex as keys there).\n * @param value - the value\n * @param dtype - the column dtype the value comes from; f32 values use the shortest fround-round-trip text\n * @returns the text\n * @category Plugin helpers\n */\nexport function formatGmlReal(value: number, dtype: \"f32\" | \"f64\" | \"i32\" | \"u32\" | \"u8\" = \"f64\"): string {\n if (Number.isNaN(value)) {\n return \"NAN\";\n }\n if (!Number.isFinite(value)) {\n return value > 0 ? \"+INF\" : \"-INF\";\n }\n const text = formatDecimal(value, dtype);\n if (text.includes(\".\")) {\n return text;\n }\n // NetworkX's real pattern requires a decimal point even in the exponent form (`1.0e-7`)\n const e = text.indexOf(\"e\");\n return `${text.slice(0, e)}.0${text.slice(e)}`;\n}\n\n/**\n * An integer text for a value known to be integral (an i32 / u32 / u8 cell, an f64 that holds an\n * integer), avoiding the exponent form `String()` uses above 1e21.\n * @param value - an integral value\n * @returns the digits\n * @category Plugin helpers\n */\nexport function formatInteger(value: number): string {\n if (Number.isSafeInteger(value) || !Number.isFinite(value)) {\n return String(value);\n }\n return BigInt(value).toString();\n}\n\n/**\n * The text of a numeric cell of any numeric dtype, dispatching on the dtype: f32 through\n * formatF32, everything else through formatF64.\n * @param value - the value\n * @param dtype - the column dtype the value came from\n * @returns the text\n * @category Plugin helpers\n */\nexport function formatNumber(value: number, dtype: \"f32\" | \"f64\" | \"i32\" | \"u32\" | \"u8\"): string {\n return dtype === \"f32\" ? formatF32(value) : formatF64(value);\n}\n"],"names":[],"mappings":";;AA4DO,MAAM,kBAAkB;AAOxB,MAAM,cAAc;AAMpB,MAAM,gBAAgB;AAI7B,MAAM,gBAA4B,EAAE,MAAM,iBAAiB,OAAO,QAAQ,MAAM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,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;AAChD;AASO,SAAS,cAAc,OAAuB;AACjD,MAAI,OAAO,cAAc,KAAK,KAAK,CAAC,OAAO,SAAS,KAAK,GAAG;AACxD,WAAO,OAAO,KAAK;AAAA,EACvB;AACA,SAAO,OAAO,KAAK,EAAE,SAAA;AACzB;AAUO,SAAS,aAAa,OAAe,OAAqD;AAC7F,SAAO,UAAU,QAAQ,UAAU,KAAK,IAAI,UAAU,KAAK;AAC/D;"}
|
|
@@ -1,6 +1,293 @@
|
|
|
1
|
-
import { an as keptForStyles } from "./report-
|
|
2
|
-
import { S as StyleBudget } from "./emit-
|
|
3
|
-
import {
|
|
1
|
+
import { an as keptForStyles } from "./report-CwMfYa9J.js";
|
|
2
|
+
import { S as StyleBudget } from "./emit-BwHQkZle.js";
|
|
3
|
+
import { w as STYLE_PROPERTIES, N as interpolate, O as within, h as StyleNotes, y as toolDefaults, l as isStyleValue, P as describeFeature, b as STYLE_ISSUE, Q as refSource, R as isShortPredicate, U as resolveRules, V as matches, W as evalContinuous, X as numberOf, C as canonicalFor, o as styleFingerprint, t as featuresOf, m as parseStyleBlock, q as blockStyles, Y as styleLengthUnit, p as plainCell, S as STYLE_BLOCK_NAME, d as canonColor, e as colorOpacity, a as canonEnum, f as canonText, k as canonBoolean, j as canonOpacity, g as canonSigned, c as canonNumber, H as DOT_POINTS_PER_INCH } from "./block-iptrlMBb.js";
|
|
4
|
+
const CYTOSCAPE_ANNOTATIONS_COLUMN = "__Annotations";
|
|
5
|
+
const TYPE_PREFIX = "org.cytoscape.view.presentation.annotations.";
|
|
6
|
+
const SHAPES = /* @__PURE__ */ new Map([
|
|
7
|
+
["rectangle", "rectangle"],
|
|
8
|
+
["roundedrectangle", "round-rectangle"],
|
|
9
|
+
["rounded_rectangle", "round-rectangle"],
|
|
10
|
+
["ellipse", "ellipse"],
|
|
11
|
+
["triangle", "triangle"],
|
|
12
|
+
["diamond", "diamond"],
|
|
13
|
+
["pentagon", "pentagon"],
|
|
14
|
+
["hexagon", "hexagon"],
|
|
15
|
+
["octagon", "octagon"],
|
|
16
|
+
["parallelogram", "parallelogram"],
|
|
17
|
+
["star5", "star"],
|
|
18
|
+
["star6", "star"],
|
|
19
|
+
["v", "vee"]
|
|
20
|
+
]);
|
|
21
|
+
const ARROW_ORDER = [
|
|
22
|
+
"circle",
|
|
23
|
+
"triangle",
|
|
24
|
+
"vee",
|
|
25
|
+
"diamond",
|
|
26
|
+
"triangle-open",
|
|
27
|
+
"none",
|
|
28
|
+
"other:x",
|
|
29
|
+
"triangle",
|
|
30
|
+
"tee"
|
|
31
|
+
];
|
|
32
|
+
const ARROW_LENGTHS = [10, 17, 17, 17, 17, 0, 10, 5, 0];
|
|
33
|
+
const ARROW_WIDTH = 10;
|
|
34
|
+
const ARROW_NAMES = /* @__PURE__ */ new Map([
|
|
35
|
+
["circle", "circle"],
|
|
36
|
+
["closed arrow", "triangle"],
|
|
37
|
+
["concave arrow", "vee"],
|
|
38
|
+
["diamond", "diamond"],
|
|
39
|
+
["open arrow", "triangle-open"],
|
|
40
|
+
["no arrow", "none"],
|
|
41
|
+
["pipe", "tee"],
|
|
42
|
+
["triangle", "triangle"],
|
|
43
|
+
["t", "tee"],
|
|
44
|
+
["t-shape", "tee"],
|
|
45
|
+
["triangular head", "triangle"],
|
|
46
|
+
["x", "other:x"],
|
|
47
|
+
["x arrow", "other:x"]
|
|
48
|
+
]);
|
|
49
|
+
function readAnnotations(snapshot) {
|
|
50
|
+
const { graph } = snapshot;
|
|
51
|
+
const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;
|
|
52
|
+
const entries = cellStrings(cell);
|
|
53
|
+
const fields = entries.map(parseEntry);
|
|
54
|
+
const byId = new Map(fields.map((f, i) => [f.get("uuid") ?? String(i), f]));
|
|
55
|
+
const annotations = [];
|
|
56
|
+
const skipped = /* @__PURE__ */ new Set();
|
|
57
|
+
fields.forEach((f, i) => {
|
|
58
|
+
const read = readOne(f, String(i), byId);
|
|
59
|
+
if (read === null) {
|
|
60
|
+
skipped.add((f.get("type") ?? "").replace(TYPE_PREFIX, ""));
|
|
61
|
+
} else {
|
|
62
|
+
annotations.push(...read);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return { annotations, skipped: [...skipped] };
|
|
66
|
+
}
|
|
67
|
+
function readImageAnnotations(snapshot) {
|
|
68
|
+
const { graph } = snapshot;
|
|
69
|
+
const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;
|
|
70
|
+
return cellStrings(cell).flatMap((entry, i) => {
|
|
71
|
+
const f = parseEntry(entry);
|
|
72
|
+
const url = f.get("URL") ?? "";
|
|
73
|
+
if ((f.get("type") ?? "").replace(TYPE_PREFIX, "") !== "ImageAnnotation" || url === "") {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const zoom = positive(f.get("zoom")) ?? 1;
|
|
77
|
+
const x = num(f.get("x")) ?? 0;
|
|
78
|
+
const y = num(f.get("y")) ?? 0;
|
|
79
|
+
const width = (positive(f.get("width")) ?? 0) / zoom;
|
|
80
|
+
const height = (positive(f.get("height")) ?? 0) / zoom;
|
|
81
|
+
const border = javaColor(f.get("edgeColor")) ?? { color: "#000000", alpha: 1 };
|
|
82
|
+
const opacity = num(f.get("opacity"));
|
|
83
|
+
return [
|
|
84
|
+
{
|
|
85
|
+
id: f.get("uuid") ?? String(i),
|
|
86
|
+
layer: f.get("canvas") === "background" ? "background" : "foreground",
|
|
87
|
+
z: num(f.get("z")) ?? 0,
|
|
88
|
+
kind: "image",
|
|
89
|
+
rotation: num(f.get("rotation")) ?? 0,
|
|
90
|
+
center: { x: x + width / 2, y: -(y + height / 2) },
|
|
91
|
+
width,
|
|
92
|
+
height,
|
|
93
|
+
url,
|
|
94
|
+
opacity: opacity === null ? 1 : Math.min(1, Math.max(0, opacity)),
|
|
95
|
+
borderColor: border.color,
|
|
96
|
+
borderOpacity: border.alpha * percent(f.get("edgeOpacity")),
|
|
97
|
+
borderWidth: (num(f.get("edgeThickness")) ?? 0) / zoom
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function cellStrings(cell) {
|
|
103
|
+
if (typeof cell === "string") {
|
|
104
|
+
return cell.split(/[\r\n]+/).filter((s) => s !== "");
|
|
105
|
+
}
|
|
106
|
+
if (cell !== null && typeof cell === "object" && Symbol.iterator in cell) {
|
|
107
|
+
return Array.from(cell).filter((s) => typeof s === "string" && s !== "");
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
function parseEntry(entry) {
|
|
112
|
+
const out = /* @__PURE__ */ new Map();
|
|
113
|
+
for (const part of entry.split("|")) {
|
|
114
|
+
const eq = part.indexOf("=");
|
|
115
|
+
if (eq > 0) {
|
|
116
|
+
out.set(part.slice(0, eq), part.slice(eq + 1));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
function readOne(f, index, byId) {
|
|
122
|
+
const type = (f.get("type") ?? "").replace(TYPE_PREFIX, "");
|
|
123
|
+
const zoom = positive(f.get("zoom")) ?? 1;
|
|
124
|
+
const base = {
|
|
125
|
+
id: f.get("uuid") ?? index,
|
|
126
|
+
layer: f.get("canvas") === "background" ? "background" : "foreground",
|
|
127
|
+
z: num(f.get("z")) ?? 0
|
|
128
|
+
};
|
|
129
|
+
switch (type) {
|
|
130
|
+
case "ShapeAnnotation":
|
|
131
|
+
return [shapeOf(f, base, zoom)];
|
|
132
|
+
case "TextAnnotation":
|
|
133
|
+
return [textOf(f, base, zoom, { x: num(f.get("x")) ?? 0, y: -(num(f.get("y")) ?? 0) }, "top-left")];
|
|
134
|
+
case "BoundedTextAnnotation": {
|
|
135
|
+
const shape = shapeOf(f, base, zoom);
|
|
136
|
+
return [shape, textOf(f, { ...base, id: `${base.id}:text` }, zoom, shape.center, "center")];
|
|
137
|
+
}
|
|
138
|
+
case "ArrowAnnotation":
|
|
139
|
+
return arrowOf(f, base, zoom, byId);
|
|
140
|
+
default:
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function shapeOf(f, base, zoom) {
|
|
145
|
+
const x = num(f.get("x")) ?? 0;
|
|
146
|
+
const y = num(f.get("y")) ?? 0;
|
|
147
|
+
const width = (positive(f.get("width")) ?? 0) / zoom;
|
|
148
|
+
const height = (positive(f.get("height")) ?? 0) / zoom;
|
|
149
|
+
const fill = javaColor(f.get("fillColor"));
|
|
150
|
+
const border = javaColor(f.get("edgeColor")) ?? { color: "#000000", alpha: 1 };
|
|
151
|
+
return {
|
|
152
|
+
...base,
|
|
153
|
+
kind: "shape",
|
|
154
|
+
rotation: num(f.get("rotation")) ?? 0,
|
|
155
|
+
center: { x: x + width / 2, y: -(y + height / 2) },
|
|
156
|
+
width,
|
|
157
|
+
height,
|
|
158
|
+
shape: SHAPES.get((f.get("shapeType") ?? "rectangle").toLowerCase()) ?? "rectangle",
|
|
159
|
+
fill: fill?.color ?? null,
|
|
160
|
+
fillOpacity: fill === null ? 0 : fill.alpha * percent(f.get("fillOpacity")),
|
|
161
|
+
borderColor: border.color,
|
|
162
|
+
borderOpacity: border.alpha * percent(f.get("edgeOpacity")),
|
|
163
|
+
borderWidth: (num(f.get("edgeThickness")) ?? 1) / zoom
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function textOf(f, base, zoom, at, anchor) {
|
|
167
|
+
const style = num(f.get("fontStyle")) ?? 0;
|
|
168
|
+
const color = javaColor(f.get("color")) ?? { color: "#000000", alpha: 1 };
|
|
169
|
+
return {
|
|
170
|
+
...base,
|
|
171
|
+
kind: "text",
|
|
172
|
+
rotation: num(f.get("rotation")) ?? 0,
|
|
173
|
+
text: f.get("text") ?? "",
|
|
174
|
+
at,
|
|
175
|
+
anchor,
|
|
176
|
+
fontSize: (positive(f.get("fontSize")) ?? 12) / zoom,
|
|
177
|
+
fontFamily: f.get("fontFamily") ?? "sans-serif",
|
|
178
|
+
bold: (style & 1) !== 0,
|
|
179
|
+
italic: (style & 2) !== 0,
|
|
180
|
+
color: color.color,
|
|
181
|
+
opacity: color.alpha
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
function arrowOf(f, base, zoom, byId) {
|
|
185
|
+
const sourceBox = boxOf(byId.get(f.get("sourceAnnotation") ?? ""), zoom);
|
|
186
|
+
const targetBox = boxOf(byId.get(f.get("targetAnnotation") ?? ""), zoom);
|
|
187
|
+
const toPoint = point(f.get("targetPoint")) ?? point(f.get("targetNode"));
|
|
188
|
+
const corner = { x: num(f.get("x")) ?? 0, y: num(f.get("y")) ?? 0 };
|
|
189
|
+
const sourceCenter = sourceBox === null ? corner : centerOfBox(sourceBox);
|
|
190
|
+
const aim = toPoint ?? (targetBox === null ? null : centerOfBox(targetBox));
|
|
191
|
+
if (aim === null) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
const from = sourceBox !== null && sourceBox.width > 0 && sourceBox.height > 0 ? facing(sourceBox, aim) : { x: aim.x > corner.x ? corner.x : sourceCenter.x, y: aim.y > corner.y ? corner.y : sourceCenter.y };
|
|
195
|
+
const to = toPoint ?? facing(targetBox ?? { x: aim.x, y: aim.y, width: 0, height: 0 }, sourceCenter);
|
|
196
|
+
const color = javaColor(f.get("lineColor")) ?? { color: "#000000", alpha: 1 };
|
|
197
|
+
const sourceColor = javaColor(f.get("sourceColor"))?.color ?? color.color;
|
|
198
|
+
const targetColor = javaColor(f.get("targetColor"))?.color ?? color.color;
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
...base,
|
|
202
|
+
kind: "arrow",
|
|
203
|
+
from: { x: from.x, y: -from.y },
|
|
204
|
+
to: { x: to.x, y: -to.y },
|
|
205
|
+
color: color.color,
|
|
206
|
+
opacity: color.alpha * percent(f.get("lineOpacity")),
|
|
207
|
+
width: Math.max(1, (positive(f.get("lineThickness")) ?? 1) / zoom / 2),
|
|
208
|
+
sourceArrow: arrowShape(f.get("sourceType")),
|
|
209
|
+
targetArrow: arrowShape(f.get("targetType")),
|
|
210
|
+
sourceSize: positive(f.get("sourceSize")) ?? 1,
|
|
211
|
+
targetSize: positive(f.get("targetSize")) ?? 1,
|
|
212
|
+
sourceColor,
|
|
213
|
+
targetColor,
|
|
214
|
+
...heads("source", f.get("sourceType"), positive(f.get("sourceSize")) ?? 1),
|
|
215
|
+
...heads("target", f.get("targetType"), positive(f.get("targetSize")) ?? 1)
|
|
216
|
+
}
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
function heads(end, type, size) {
|
|
220
|
+
const shape = arrowShape(type);
|
|
221
|
+
if (shape === "none") {
|
|
222
|
+
return {};
|
|
223
|
+
}
|
|
224
|
+
const k = num(type) ?? ARROW_ORDER.indexOf(shape);
|
|
225
|
+
const length = ARROW_LENGTHS[k] ?? ARROW_LENGTHS[1];
|
|
226
|
+
return { [`${end}HeadLength`]: length * size, [`${end}HeadWidth`]: ARROW_WIDTH * size };
|
|
227
|
+
}
|
|
228
|
+
function boxOf(f, zoom) {
|
|
229
|
+
if (f === void 0) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const x = num(f.get("x"));
|
|
233
|
+
const y = num(f.get("y"));
|
|
234
|
+
if (x === null || y === null) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return { x, y, width: (positive(f.get("width")) ?? 0) / zoom, height: (positive(f.get("height")) ?? 0) / zoom };
|
|
238
|
+
}
|
|
239
|
+
function centerOfBox(b) {
|
|
240
|
+
return { x: b.x + b.width / 2, y: b.y + b.height / 2 };
|
|
241
|
+
}
|
|
242
|
+
function facing(b, p) {
|
|
243
|
+
const c = centerOfBox(b);
|
|
244
|
+
const dx = p.x - c.x;
|
|
245
|
+
const dy = p.y - c.y;
|
|
246
|
+
if (Math.abs(dx) * b.height >= Math.abs(dy) * b.width) {
|
|
247
|
+
return { x: c.x + Math.sign(dx) * (b.width / 2), y: c.y };
|
|
248
|
+
}
|
|
249
|
+
return { x: c.x, y: c.y + Math.sign(dy) * (b.height / 2) };
|
|
250
|
+
}
|
|
251
|
+
function arrowShape(raw) {
|
|
252
|
+
if (raw === void 0) {
|
|
253
|
+
return "none";
|
|
254
|
+
}
|
|
255
|
+
const n = num(raw);
|
|
256
|
+
if (n !== null) {
|
|
257
|
+
return ARROW_ORDER[n] ?? "triangle";
|
|
258
|
+
}
|
|
259
|
+
return ARROW_NAMES.get(raw.trim().toLowerCase()) ?? "triangle";
|
|
260
|
+
}
|
|
261
|
+
function point(raw) {
|
|
262
|
+
const [x, y] = (raw ?? "").split(",").map((s) => num(s));
|
|
263
|
+
return x === null || x === void 0 || y === null || y === void 0 ? null : { x, y };
|
|
264
|
+
}
|
|
265
|
+
function javaColor(raw) {
|
|
266
|
+
const n = num(raw);
|
|
267
|
+
if (n === null || !Number.isInteger(n)) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const argb = n >>> 0;
|
|
271
|
+
return {
|
|
272
|
+
color: `#${(argb & 16777215).toString(16).padStart(6, "0")}`,
|
|
273
|
+
alpha: (argb >>> 24) / 255
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function percent(raw) {
|
|
277
|
+
const n = num(raw);
|
|
278
|
+
return n === null ? 1 : Math.min(1, Math.max(0, n / 100));
|
|
279
|
+
}
|
|
280
|
+
function num(raw) {
|
|
281
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
const n = Number(raw);
|
|
285
|
+
return Number.isFinite(n) ? n : null;
|
|
286
|
+
}
|
|
287
|
+
function positive(raw) {
|
|
288
|
+
const n = num(raw);
|
|
289
|
+
return n !== null && n > 0 ? n : null;
|
|
290
|
+
}
|
|
4
291
|
function valueKey(v) {
|
|
5
292
|
return v === null || v === void 0 ? "\0null" : `${typeof v}:${String(v)}`;
|
|
6
293
|
}
|
|
@@ -355,7 +642,19 @@ function rampOf(fam, values, ys0, tolerant, spend) {
|
|
|
355
642
|
}
|
|
356
643
|
const MAX_STYLE_RULES = 16;
|
|
357
644
|
const MAX_FEATURES = 64;
|
|
358
|
-
const LENGTHS = /* @__PURE__ */ new Set([
|
|
645
|
+
const LENGTHS = /* @__PURE__ */ new Set([
|
|
646
|
+
"width",
|
|
647
|
+
"height",
|
|
648
|
+
"borderWidth",
|
|
649
|
+
"labelSize",
|
|
650
|
+
"labelWrapWidth",
|
|
651
|
+
"labelPaddingX",
|
|
652
|
+
"labelPaddingY",
|
|
653
|
+
"labelOffsetX",
|
|
654
|
+
"labelOffsetY",
|
|
655
|
+
"fanSpacing",
|
|
656
|
+
"nodeGap"
|
|
657
|
+
]);
|
|
359
658
|
function planStyles(values, features, options = {}) {
|
|
360
659
|
const notes = options.notes ?? new StyleNotes();
|
|
361
660
|
const budget = options.budget ?? new StyleBudget();
|
|
@@ -386,7 +685,7 @@ function planStyles(values, features, options = {}) {
|
|
|
386
685
|
out,
|
|
387
686
|
allFeatures[target],
|
|
388
687
|
new Set(options.rawColumns?.[target] ?? []),
|
|
389
|
-
toolSet,
|
|
688
|
+
{ set: toolSet, derived: defaults?.derived ?? [] },
|
|
390
689
|
options.signal
|
|
391
690
|
)
|
|
392
691
|
);
|
|
@@ -592,8 +891,9 @@ function passCandidate(plan, fam, truth, infos) {
|
|
|
592
891
|
const raw = Array.from(cols.values()).some((f) => f.raw);
|
|
593
892
|
return { type: "passdata", cols, raw, cost: raw ? 240 : 50 };
|
|
594
893
|
}
|
|
595
|
-
function planTarget(plan, out, features, rawNames,
|
|
894
|
+
function planTarget(plan, out, features, rawNames, tool, signal) {
|
|
596
895
|
const { target, n } = plan;
|
|
896
|
+
const toolSet = tool.set;
|
|
597
897
|
for (const [k, v] of out?.columns ?? []) {
|
|
598
898
|
plan.columns.set(k, v);
|
|
599
899
|
}
|
|
@@ -608,6 +908,7 @@ function planTarget(plan, out, features, rawNames, toolSet, signal) {
|
|
|
608
908
|
set: toolSet
|
|
609
909
|
}
|
|
610
910
|
];
|
|
911
|
+
toolRule.push(...derivedRules(plan, tool.derived, features, out?.rules ?? [], truth));
|
|
611
912
|
const declared = prepareDeclared(plan, out?.rules ?? [], features);
|
|
612
913
|
const declaredProps = new Set(declared.flatMap(writes));
|
|
613
914
|
const { defaults, rest } = splitDefaults(n, truth, declaredProps);
|
|
@@ -694,6 +995,31 @@ function planTarget(plan, out, features, rawNames, toolSet, signal) {
|
|
|
694
995
|
}
|
|
695
996
|
return drafts.map(finish);
|
|
696
997
|
}
|
|
998
|
+
function derivedRules(plan, derived, features, given, truth) {
|
|
999
|
+
const stated = /* @__PURE__ */ new Set([...given.filter((r) => r.origin === "tool").flatMap(writes), ...truth.keys()]);
|
|
1000
|
+
const out = [];
|
|
1001
|
+
for (const d of derived) {
|
|
1002
|
+
if (plan.target !== "node" || d.kind !== "labelFromColumn" || stated.has("label")) {
|
|
1003
|
+
continue;
|
|
1004
|
+
}
|
|
1005
|
+
const { column } = d;
|
|
1006
|
+
const feature = features.find((f) => "data" in f.ref && f.ref.data === column);
|
|
1007
|
+
if (feature?.values.some((v) => v !== null && v !== "") !== true) {
|
|
1008
|
+
continue;
|
|
1009
|
+
}
|
|
1010
|
+
stated.add("label");
|
|
1011
|
+
out.push({
|
|
1012
|
+
id: uniqueId(plan, "node.tool.label"),
|
|
1013
|
+
target: "node",
|
|
1014
|
+
role: "passthrough",
|
|
1015
|
+
origin: "tool",
|
|
1016
|
+
where: { has: { data: column } },
|
|
1017
|
+
map: { label: { kind: "passthrough", by: { data: column } } },
|
|
1018
|
+
facts: { reason: "NODE_NAME" }
|
|
1019
|
+
});
|
|
1020
|
+
}
|
|
1021
|
+
return out;
|
|
1022
|
+
}
|
|
697
1023
|
function splitDefaults(n, truth, declaredProps) {
|
|
698
1024
|
const defaults = {};
|
|
699
1025
|
const rest = [];
|
|
@@ -903,10 +1229,11 @@ function enforceCap(plan, drafts, truth, src) {
|
|
|
903
1229
|
if (cands.length === 0) {
|
|
904
1230
|
break;
|
|
905
1231
|
}
|
|
1232
|
+
const everyone = (r) => r.origin === "tool" && "all" in r.where ? 1 : 0;
|
|
906
1233
|
cands.sort((a, b) => {
|
|
907
1234
|
const pa = a.role === "passthrough" ? 1 : 0;
|
|
908
1235
|
const pb = b.role === "passthrough" ? 1 : 0;
|
|
909
|
-
return pa - pb || (FOLD_ORDER[a.origin] ?? 1) - (FOLD_ORDER[b.origin] ?? 1) || ruleSize(b) - ruleSize(a) || drafts.indexOf(b) - drafts.indexOf(a);
|
|
1236
|
+
return pa - pb || (FOLD_ORDER[a.origin] ?? 1) - (FOLD_ORDER[b.origin] ?? 1) || everyone(a) - everyone(b) || ruleSize(b) - ruleSize(a) || drafts.indexOf(b) - drafts.indexOf(a);
|
|
910
1237
|
});
|
|
911
1238
|
const victim = cands[0];
|
|
912
1239
|
const before = drafts.map(finish);
|
|
@@ -980,34 +1307,32 @@ function replay(plan, drafts, truth, toolSet, tolerated, src) {
|
|
|
980
1307
|
};
|
|
981
1308
|
}
|
|
982
1309
|
const TARGETS = ["node", "edge"];
|
|
983
|
-
const ENUM_KINDS = /* @__PURE__ */ new Set([
|
|
1310
|
+
const ENUM_KINDS = /* @__PURE__ */ new Set([
|
|
1311
|
+
"shape",
|
|
1312
|
+
"borderStyle",
|
|
1313
|
+
"lineStyle",
|
|
1314
|
+
"arrow",
|
|
1315
|
+
"arrowSide",
|
|
1316
|
+
"weight",
|
|
1317
|
+
"position",
|
|
1318
|
+
"labelFit",
|
|
1319
|
+
"borderPosition"
|
|
1320
|
+
]);
|
|
984
1321
|
function extractStyles(importer, snapshot, report, options = {}) {
|
|
985
1322
|
const signal = options.signal ?? void 0;
|
|
986
1323
|
const notes = new StyleNotes();
|
|
987
1324
|
const budget = options.budget ?? new StyleBudget();
|
|
1325
|
+
const pictures = readImageAnnotations(snapshot).length > 0;
|
|
1326
|
+
for (const kind of readAnnotations(snapshot).skipped) {
|
|
1327
|
+
if (!(pictures && kind === "ImageAnnotation")) {
|
|
1328
|
+
notes.add(STYLE_ISSUE.ANNOTATION_SKIPPED, "graph", "annotations", { sample: kind });
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
988
1331
|
const canonical = readStyleValues(importer, snapshot, report, { notes, budget, signal });
|
|
989
1332
|
const fingerprint = styleFingerprint(snapshot);
|
|
990
|
-
const
|
|
991
|
-
if (
|
|
992
|
-
|
|
993
|
-
if (parsed.ok) {
|
|
994
|
-
const truth = canonical === null ? {} : { node: canonical.node.values, edge: canonical.edge.values };
|
|
995
|
-
const fromBlock = blockStyles(
|
|
996
|
-
parsed.block,
|
|
997
|
-
snapshot,
|
|
998
|
-
importer.format,
|
|
999
|
-
truth,
|
|
1000
|
-
canonical?.notes ?? [],
|
|
1001
|
-
canonical?.tool ?? null,
|
|
1002
|
-
canonical?.opacityInColor === true
|
|
1003
|
-
);
|
|
1004
|
-
if (fromBlock !== null) {
|
|
1005
|
-
return fromBlock;
|
|
1006
|
-
}
|
|
1007
|
-
notes.add(STYLE_ISSUE.BLOCK_IGNORED, null, null, { sample: "INVALID" });
|
|
1008
|
-
} else {
|
|
1009
|
-
notes.add(STYLE_ISSUE.BLOCK_IGNORED, null, null, { sample: parsed.reason });
|
|
1010
|
-
}
|
|
1333
|
+
const fromBlock = stylesFromBlock(importer, snapshot, canonical, notes, fingerprint);
|
|
1334
|
+
if (fromBlock !== null) {
|
|
1335
|
+
return fromBlock;
|
|
1011
1336
|
}
|
|
1012
1337
|
if (canonical === null) {
|
|
1013
1338
|
const list = notes.list();
|
|
@@ -1043,6 +1368,33 @@ function extractStyles(importer, snapshot, report, options = {}) {
|
|
|
1043
1368
|
}
|
|
1044
1369
|
return { ...planned, styles: { ...planned.styles, notes: [...canonical.notes, ...planned.styles.notes] } };
|
|
1045
1370
|
}
|
|
1371
|
+
function stylesFromBlock(importer, snapshot, canonical, notes, fingerprint) {
|
|
1372
|
+
const blockText = canonical?.block ?? graphValue(snapshot, STYLE_BLOCK_NAME);
|
|
1373
|
+
if (blockText === void 0) {
|
|
1374
|
+
return null;
|
|
1375
|
+
}
|
|
1376
|
+
const parsed = parseStyleBlock(blockText, fingerprint);
|
|
1377
|
+
if (!parsed.ok) {
|
|
1378
|
+
notes.add(STYLE_ISSUE.BLOCK_IGNORED, null, null, { sample: parsed.reason });
|
|
1379
|
+
return null;
|
|
1380
|
+
}
|
|
1381
|
+
const truth = canonical === null ? {} : { node: canonical.node.values, edge: canonical.edge.values };
|
|
1382
|
+
const fromBlock = blockStyles(
|
|
1383
|
+
parsed.block,
|
|
1384
|
+
snapshot,
|
|
1385
|
+
importer.format,
|
|
1386
|
+
truth,
|
|
1387
|
+
canonical?.notes ?? [],
|
|
1388
|
+
canonical?.tool ?? null,
|
|
1389
|
+
canonical?.opacityInColor === true
|
|
1390
|
+
);
|
|
1391
|
+
if (fromBlock === null) {
|
|
1392
|
+
notes.add(STYLE_ISSUE.BLOCK_IGNORED, null, null, { sample: "INVALID" });
|
|
1393
|
+
return null;
|
|
1394
|
+
}
|
|
1395
|
+
const skipped = notes.list();
|
|
1396
|
+
return skipped.length === 0 ? fromBlock : { ...fromBlock, styles: { ...fromBlock.styles, notes: [...fromBlock.styles.notes, ...skipped] } };
|
|
1397
|
+
}
|
|
1046
1398
|
function readStyleValues(importer, snapshot, report, context) {
|
|
1047
1399
|
const { notes, budget, signal } = context;
|
|
1048
1400
|
signal?.throwIfAborted();
|
|
@@ -1257,6 +1609,8 @@ function canonValue(kind, property, raw, dialect, site) {
|
|
|
1257
1609
|
site,
|
|
1258
1610
|
dialect === "graphviz" && (property === "width" || property === "height") ? DOT_POINTS_PER_INCH : 1
|
|
1259
1611
|
);
|
|
1612
|
+
case "signed":
|
|
1613
|
+
return canonSigned(raw, site);
|
|
1260
1614
|
case "opacity":
|
|
1261
1615
|
return canonOpacity(raw, dialect, site);
|
|
1262
1616
|
case "boolean":
|
|
@@ -1341,7 +1695,9 @@ function channelsColor(v, dtype) {
|
|
|
1341
1695
|
}
|
|
1342
1696
|
export {
|
|
1343
1697
|
MAX_STYLE_RULES as M,
|
|
1698
|
+
readImageAnnotations as a,
|
|
1344
1699
|
extractStyles as e,
|
|
1345
|
-
planStyles as p
|
|
1700
|
+
planStyles as p,
|
|
1701
|
+
readAnnotations as r
|
|
1346
1702
|
};
|
|
1347
|
-
//# sourceMappingURL=generic-
|
|
1703
|
+
//# sourceMappingURL=generic-ymWCETAJ.js.map
|