@graphty/graph-io 0.3.48 → 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-C2riR4NT.js → approximations-BRXsll0T.js} +2 -2
- package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-BRXsll0T.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-yl0f_qLO.js} +931 -164
- package/dist/chunks/block-yl0f_qLO.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-DizmppHy.js} +5 -4
- package/dist/chunks/{context-cgmmOxZ2.js.map → context-DizmppHy.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-CmvJXYeH.js} +67 -16
- package/dist/chunks/credentials-CmvJXYeH.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-Dhez_Cew.js} +11 -2
- package/dist/chunks/descriptor-Dhez_Cew.js.map +1 -0
- package/dist/chunks/{emit-CD8xnY8s.js → emit-7Jkpg0yd.js} +1788 -133
- package/dist/chunks/emit-7Jkpg0yd.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-ChjL5fmP.js → exporter-1Ajud15J.js} +9 -8
- package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-1Ajud15J.js.map} +1 -1
- package/dist/chunks/{exporter-BIdaoIgh.js → exporter-B6yvL3wy.js} +7 -7
- package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-B6yvL3wy.js.map} +1 -1
- 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-DtVU80Fa.js → exporter-CA5q8ROP.js} +9 -8
- package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-CA5q8ROP.js.map} +1 -1
- package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-CQQZFJ2v.js} +1284 -156
- package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
- 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-Dc21MAdg.js} +387 -31
- package/dist/chunks/generic-Dc21MAdg.js.map +1 -0
- package/dist/chunks/{importer-B87_fmVx.js → importer-C6NVpCXp.js} +327 -84
- package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
- package/dist/chunks/{importer-DPZDN40-.js → importer-CKFe4q54.js} +25 -17
- package/dist/chunks/importer-CKFe4q54.js.map +1 -0
- package/dist/chunks/{importer-Bji2MeWr.js → importer-CKbUbsJA.js} +13 -10
- package/dist/chunks/{importer-Bji2MeWr.js.map → importer-CKbUbsJA.js.map} +1 -1
- package/dist/chunks/{importer-CB_zV5_L.js → importer-ClCsdgTJ.js} +208 -1104
- package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
- package/dist/chunks/{importer-e3huMZbm.js → importer-CyVZTrf0.js} +14 -10
- package/dist/chunks/importer-CyVZTrf0.js.map +1 -0
- package/dist/chunks/{importer-CVT-JyDE.js → importer-DgG4v1Ms.js} +1537 -355
- package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
- package/dist/chunks/{importer-Cyy6UseH.js → importer-asFUrIsj.js} +66 -13
- package/dist/chunks/importer-asFUrIsj.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-IVRq2Uoo.js} +282 -74
- package/dist/chunks/lexicon-IVRq2Uoo.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-Cy3_SHRZ.js +79 -0
- package/dist/chunks/round-trip-Cy3_SHRZ.js.map +1 -0
- package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-BXwVbza3.js} +5 -5
- package/dist/chunks/sigv4-BXwVbza3.js.map +1 -0
- package/dist/chunks/{styles-CaABMoO1.js → styles-CAVmBLgp.js} +1237 -138
- package/dist/chunks/styles-CAVmBLgp.js.map +1 -0
- package/dist/chunks/styles-CPczw1Jz.js +1928 -0
- package/dist/chunks/styles-CPczw1Jz.js.map +1 -0
- package/dist/chunks/styles-boK6Ln54.js +2847 -0
- package/dist/chunks/styles-boK6Ln54.js.map +1 -0
- package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-XeFBQ6VS.js} +506 -175
- package/dist/chunks/styles-yed-XeFBQ6VS.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 +8 -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 +848 -194
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +230 -193
- 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 +141 -23
- package/dist/sources-cypher.js.map +1 -1
- package/dist/sources-ndex.js +2 -2
- package/dist/sources-rest.js +32 -6
- package/dist/sources-rest.js.map +1 -1
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +439 -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/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 +170 -33
- 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 +41 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +185 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- 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/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 +72 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1500 -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 +754 -102
- 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 +695 -164
- 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 +431 -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 +1843 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +104 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +382 -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 +1395 -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 +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -5
- 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/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/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 +125 -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 +9 -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 +38 -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/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 +327 -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 +73 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +164 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/types.d.ts +60 -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 +89 -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 +1139 -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 +4 -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 +232 -10
- 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 +475 -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 +687 -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 +224 -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/exporter.ts +37 -1
- package/src/formats/dot/importer.ts +192 -36
- package/src/formats/dot/index.ts +3 -1
- package/src/formats/dot/label-places.ts +241 -0
- package/src/formats/dot/names.ts +15 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1702 -149
- 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 +852 -110
- package/src/formats/graphml/styles-plain.ts +6 -15
- package/src/formats/graphml/styles-yed.ts +765 -176
- package/src/formats/graphml/styles-yfiles3.ts +487 -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 +2123 -171
- package/src/formats/pajek/draw.ts +469 -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 +1506 -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 +12 -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/credentials.ts +90 -1
- package/src/sources/cypher/descriptor.ts +7 -1
- package/src/sources/cypher/index.ts +149 -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 +9 -0
- package/src/sources/rest/openalex.ts +4 -2
- package/src/sources/rest/source.ts +41 -0
- package/src/sources/run.ts +35 -3
- package/src/sources/sigv4.ts +6 -4
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +371 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +216 -0
- package/src/sources/types.ts +68 -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 +107 -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 +1303 -84
- package/src/styles/cyjs/defaults-table.ts +4 -0
- package/src/styles/cyjs/emit.ts +268 -14
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +506 -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 +698 -5
- package/src/styles/vocabulary.ts +232 -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
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { e as explicitWeights } from "./export-Cha4dRFz.js";
|
|
2
|
+
import { b as STYLE_ISSUE, h as StyleNotes, Q as refSource, U as resolveRules, w as STYLE_PROPERTIES, i as num6, D as degreeValues, C as canonicalFor, y as toolDefaults, l as isStyleValue, W as evalContinuous, X as numberOf, Z as discreteLookup, n as noteAt, S as STYLE_BLOCK_NAME, p as plainCell } from "./block-yl0f_qLO.js";
|
|
3
|
+
import { e as escapeXmlAttribute } from "./escape-CuCIzNMB.js";
|
|
4
|
+
import { j as javaFamily, J as JAVA_MONO, a as JAVA_SERIF, b as JAVA_SANS, v as vpStep, c as colorParser, C as CYTOSCAPE_LEXICON, s as sizeParser, d as cytoscapeLabelPlace, i as isUncarriedVp, e as arrowSizeParser, f as arrowProportion, g as arrowGap, o as opacityParser, h as cytoscapeLabelMove, k as cytoscapeLabelBase, l as halfBack, N as NODE_SIZE_VP, n as normalizeVisualProperties } from "./lexicon-IVRq2Uoo.js";
|
|
5
|
+
import { d as canonBends } from "./bends-BGXjv_U4.js";
|
|
6
|
+
import { t as takeFromBlock } from "./round-trip-Cy3_SHRZ.js";
|
|
7
|
+
import { M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, b as DIRECTION_REFUSED_CODE, S as SINK_OPTION_CODE, O as OPTION_IGNORED_CODE, I as ID_MERGED_CODE, R as ROLE_TAKEN_CODE, C as COLUMN_RENAMED_CODE, W as AMBIGUOUS_GRAPH_NAME_CODE, Y as GRAPH_NOT_FOUND_CODE, i as MULTIPLE_GRAPHS_CODE, c as STRAY_TEXT_CODE, d as UNKNOWN_ELEMENT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, aA as EQUATION_AS_TEXT_CODE, a1 as PARENT_CYCLE_CODE, m as UNKNOWN_PARENT_CODE, l as DUPLICATE_ATTRIBUTE_CODE, f as DANGLING_REFERENCE_CODE, P as PRECISION_CODE, a2 as WIDENED_CODE, T as BAD_VALUE_CODE, j as DUPLICATE_EDGE_ID_CODE, k as DUPLICATE_NODE_CODE, n as MISSING_ENDPOINT_CODE, o as MISSING_ID_CODE, N as NO_GRAPH_CODE, r as ENCODING_CONFLICT_CODE, s as UNKNOWN_ENCODING_CODE, t as ENCODING_FALLBACK_CODE, u as INVALID_ENCODING_CODE, v as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, X as XML_NESTING_CODE, w as XML_SYNTAX_CODE, y as ELEMENT_ISSUE, z as INPUT_ISSUE, aH as STORAGE_CLASS_CODE, ak as WEIGHT_KEY_CLASH_CODE, a9 as ROLE_ASSUMED_CODE, aw as COLUMN_RENAMED_LOSS_CODE, A as ID_TEXT_TYPE_CODE, al as MUTUAL_EXPANDED_CODE, G as PARENTS_DROPPED_CODE, F as ROLE_DROPPED_CODE, aJ as TEMPORAL_TEXT_DROPPED_CODE, aI as TEMPORAL_DROPPED_CODE, ab as XML_ILLEGAL_CHAR_CODE } from "./report-CwMfYa9J.js";
|
|
5
8
|
function emptyCytoscapeStyle() {
|
|
6
9
|
const target = () => ({
|
|
7
10
|
defaults: /* @__PURE__ */ new Map(),
|
|
@@ -11,6 +14,54 @@ function emptyCytoscapeStyle() {
|
|
|
11
14
|
});
|
|
12
15
|
return { network: { defaults: /* @__PURE__ */ new Map() }, node: target(), edge: target() };
|
|
13
16
|
}
|
|
17
|
+
const SHARED_COLUMNS = /* @__PURE__ */ new Map([
|
|
18
|
+
["shared name", "name"],
|
|
19
|
+
["shared interaction", "interaction"]
|
|
20
|
+
]);
|
|
21
|
+
function sharedColumnFallback(style, has) {
|
|
22
|
+
for (const [vp, m] of style.mappings) {
|
|
23
|
+
const plain = SHARED_COLUMNS.get(m.column);
|
|
24
|
+
if (plain !== void 0 && !has(m.column) && has(plain)) {
|
|
25
|
+
style.mappings.set(vp, { ...m, column: plain });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function weightColumnFallback(style, weightFrom, table) {
|
|
30
|
+
const kept = weightFrom === null || table.has(weightFrom) ? void 0 : table.byRole("weight")?.meta.name;
|
|
31
|
+
if (kept === void 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
for (const [vp, m] of style.mappings) {
|
|
35
|
+
if (m.column === weightFrom) {
|
|
36
|
+
style.mappings.set(vp, { ...m, column: kept });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function numericFamily(type) {
|
|
41
|
+
const t = (type ?? "").toLowerCase().replace(/^list_of_/, "").replace(/^java\.lang\./, "");
|
|
42
|
+
if (t === "integer" || t === "long" || t === "int" || t === "short") {
|
|
43
|
+
return "integral";
|
|
44
|
+
}
|
|
45
|
+
if (t === "double" || t === "float" || t === "real") {
|
|
46
|
+
return "floating";
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function dropMismatchedKeys(style, typeOf2, notes, target) {
|
|
51
|
+
for (const [vp, m] of style.mappings) {
|
|
52
|
+
if (m.kind !== "discrete" || m.table.length === 0) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const key = numericFamily(m.type);
|
|
56
|
+
const column = numericFamily(typeOf2(m.column));
|
|
57
|
+
if (key !== null && column !== null && key !== column) {
|
|
58
|
+
style.mappings.set(vp, { ...m, table: [] });
|
|
59
|
+
notes.add(STYLE_ISSUE.BAD_MAPPING, target, m.column, {
|
|
60
|
+
sample: `${vp}: ${key} keys on a ${column} column`
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
14
65
|
const NUMERIC_TYPES = /* @__PURE__ */ new Set(["integer", "long", "double", "float", "int", "short"]);
|
|
15
66
|
const DECIMAL = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
16
67
|
function typedKey(raw, type) {
|
|
@@ -297,6 +348,7 @@ function cytoscapeStyleFromCx2(visualProperties, visualEditorProperties, notes)
|
|
|
297
348
|
}
|
|
298
349
|
style.node.dependencies.set("nodeSizeLocked", own(editor, "nodeSizeLocked") === true);
|
|
299
350
|
style.edge.dependencies.set("arrowColorMatchesEdge", own(editor, "arrowColorMatchesEdge") === true);
|
|
351
|
+
style.node.dependencies.set("nodeCustomGraphicsSizeSync", own(editor, "nodeCustomGraphicsSizeSync") !== false);
|
|
300
352
|
for (const [target, key] of [
|
|
301
353
|
["node", "nodeMapping"],
|
|
302
354
|
["edge", "edgeMapping"]
|
|
@@ -312,6 +364,12 @@ function cytoscapeStyleFromCx2(visualProperties, visualEditorProperties, notes)
|
|
|
312
364
|
}
|
|
313
365
|
}
|
|
314
366
|
lockedSizeFromWidth(style.node);
|
|
367
|
+
for (const part of [style.edge.defaults, style.edge.mappings]) {
|
|
368
|
+
if (part.has("EDGE_CONTROL_POINTS") && !part.has("EDGE_BEND")) {
|
|
369
|
+
part.set("EDGE_BEND", part.get("EDGE_CONTROL_POINTS"));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
style.edge.bypassAliases.set("EDGE_CONTROL_POINTS", "EDGE_BEND");
|
|
315
373
|
return style;
|
|
316
374
|
}
|
|
317
375
|
function lockedSizeFromWidth(node) {
|
|
@@ -346,6 +404,22 @@ function enumOut(table, near, upper, cytoscape = /* @__PURE__ */ new Set()) {
|
|
|
346
404
|
return Object.hasOwn(near, s) ? near[s] : Object.values(table)[0];
|
|
347
405
|
};
|
|
348
406
|
}
|
|
407
|
+
const BORDER_POSITION = "borderPosition";
|
|
408
|
+
const FIXED = {
|
|
409
|
+
node: /* @__PURE__ */ new Map([
|
|
410
|
+
[BORDER_POSITION, "inside"],
|
|
411
|
+
["borderWaveAmplitude", 10],
|
|
412
|
+
["borderWavePeriod", 20],
|
|
413
|
+
["labelPadding", 0],
|
|
414
|
+
["labelLineHeight", 1]
|
|
415
|
+
]),
|
|
416
|
+
edge: /* @__PURE__ */ new Map([
|
|
417
|
+
["waveAmplitude", 10],
|
|
418
|
+
["wavePeriod", 20],
|
|
419
|
+
["labelPadding", 0],
|
|
420
|
+
["labelLineHeight", 1]
|
|
421
|
+
])
|
|
422
|
+
};
|
|
349
423
|
const DESKTOP_SHAPES = {
|
|
350
424
|
ellipse: "ELLIPSE",
|
|
351
425
|
rectangle: "RECTANGLE",
|
|
@@ -382,7 +456,6 @@ const NEAR_LINES = { "dash-dot": "dashed", "long-dash": "dashed", zigzag: "solid
|
|
|
382
456
|
const DESKTOP_ARROWS = {
|
|
383
457
|
none: "NONE",
|
|
384
458
|
triangle: "DELTA",
|
|
385
|
-
vee: "ARROW",
|
|
386
459
|
tee: "T",
|
|
387
460
|
diamond: "DIAMOND",
|
|
388
461
|
circle: "CIRCLE",
|
|
@@ -390,7 +463,9 @@ const DESKTOP_ARROWS = {
|
|
|
390
463
|
"triangle-open": "OPEN_DELTA",
|
|
391
464
|
"diamond-open": "OPEN_DIAMOND",
|
|
392
465
|
"circle-open": "OPEN_CIRCLE",
|
|
393
|
-
half: "HALF_TOP"
|
|
466
|
+
half: "HALF_TOP",
|
|
467
|
+
"other:cross-delta": "CROSS_DELTA",
|
|
468
|
+
"other:cross-open-delta": "CROSS_OPEN_DELTA"
|
|
394
469
|
};
|
|
395
470
|
const CX2_ARROWS = {
|
|
396
471
|
none: "none",
|
|
@@ -403,10 +478,14 @@ const CX2_ARROWS = {
|
|
|
403
478
|
"triangle-open": "open-triangle",
|
|
404
479
|
"diamond-open": "open-diamond",
|
|
405
480
|
"circle-open": "open-circle",
|
|
406
|
-
half: "half-top"
|
|
481
|
+
half: "half-top",
|
|
482
|
+
// as Cytoscape 3.10.5 writes CROSS_DELTA and CROSS_OPEN_DELTA in CX2
|
|
483
|
+
"other:cross-delta": "triangle-cross",
|
|
484
|
+
"other:cross-open-delta": "cross_open_delta"
|
|
407
485
|
};
|
|
408
486
|
const NEAR_ARROWS = { crow: "vee", inverted: "triangle" };
|
|
409
|
-
const
|
|
487
|
+
const DESKTOP_NEAR_ARROWS = { crow: "ARROW", inverted: "DELTA", vee: "ARROW" };
|
|
488
|
+
const CY_OTHER_ARROWS = /* @__PURE__ */ new Set(["open-square", "open-half-circle", "half-circle", "half-bottom"]);
|
|
410
489
|
const CY_OTHER_LINES = /* @__PURE__ */ new Set([
|
|
411
490
|
"backward-slash",
|
|
412
491
|
"forward-slash",
|
|
@@ -415,28 +494,38 @@ const CY_OTHER_LINES = /* @__PURE__ */ new Set([
|
|
|
415
494
|
"contiguous-arrow"
|
|
416
495
|
]);
|
|
417
496
|
const CY_OTHER_BORDERS = /* @__PURE__ */ new Set([...CY_OTHER_LINES, "zigzag", "sinewave"]);
|
|
418
|
-
const
|
|
419
|
-
center: "C,C
|
|
420
|
-
top: "N,S
|
|
421
|
-
bottom: "S,N
|
|
422
|
-
left: "W,E
|
|
423
|
-
right: "E,W
|
|
424
|
-
"top-left": "NW,SE
|
|
425
|
-
"top-right": "NE,SW
|
|
426
|
-
"bottom-left": "SW,NE
|
|
427
|
-
"bottom-right": "SE,NW
|
|
428
|
-
"inside-top": "N,N,
|
|
497
|
+
const POSITION_ANCHORS = {
|
|
498
|
+
center: ["C", "C"],
|
|
499
|
+
top: ["N", "S"],
|
|
500
|
+
bottom: ["S", "N"],
|
|
501
|
+
left: ["W", "E"],
|
|
502
|
+
right: ["E", "W"],
|
|
503
|
+
"top-left": ["NW", "SE"],
|
|
504
|
+
"top-right": ["NE", "SW"],
|
|
505
|
+
"bottom-left": ["SW", "NE"],
|
|
506
|
+
"bottom-right": ["SE", "NW"],
|
|
507
|
+
"inside-top": ["N", "N"],
|
|
508
|
+
"inside-bottom": ["S", "S"],
|
|
509
|
+
"inside-left": ["W", "W"],
|
|
510
|
+
"inside-right": ["E", "E"],
|
|
511
|
+
"inside-top-left": ["NW", "NW"],
|
|
512
|
+
"inside-top-right": ["NE", "NE"],
|
|
513
|
+
"inside-bottom-left": ["SW", "SW"],
|
|
514
|
+
"inside-bottom-right": ["SE", "SE"]
|
|
429
515
|
};
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
516
|
+
const DESKTOP_POSITIONS = Object.fromEntries(
|
|
517
|
+
Object.entries(POSITION_ANCHORS).map(([k, [node, label]]) => [k, `${node},${label},c,0.00,0.00`])
|
|
518
|
+
);
|
|
519
|
+
const CX2_WORDS = {
|
|
520
|
+
C: ["center", "center"],
|
|
521
|
+
N: ["center", "top"],
|
|
522
|
+
S: ["center", "bottom"],
|
|
523
|
+
W: ["left", "center"],
|
|
524
|
+
E: ["right", "center"],
|
|
525
|
+
NW: ["left", "top"],
|
|
526
|
+
NE: ["right", "top"],
|
|
527
|
+
SW: ["left", "bottom"],
|
|
528
|
+
SE: ["right", "bottom"]
|
|
440
529
|
};
|
|
441
530
|
const desktopNumber = String;
|
|
442
531
|
const cx2Number = (v) => v;
|
|
@@ -463,6 +552,7 @@ const WRITERS = {
|
|
|
463
552
|
["fill", { vp: "NODE_FILL_COLOR", write: colorOut }],
|
|
464
553
|
["fillOpacity", { vp: "NODE_TRANSPARENCY", write: opacity255 }],
|
|
465
554
|
["borderColor", { vp: "NODE_BORDER_PAINT", write: colorOut }],
|
|
555
|
+
["borderOpacity", { vp: "NODE_BORDER_TRANSPARENCY", write: opacity255 }],
|
|
466
556
|
["borderWidth", { vp: "NODE_BORDER_WIDTH", write: desktopNumber }],
|
|
467
557
|
[
|
|
468
558
|
"borderStyle",
|
|
@@ -477,7 +567,9 @@ const WRITERS = {
|
|
|
477
567
|
["label", { vp: "NODE_LABEL", write: textOut }],
|
|
478
568
|
["labelColor", { vp: "NODE_LABEL_COLOR", write: colorOut }],
|
|
479
569
|
["labelSize", { vp: "NODE_LABEL_FONT_SIZE", write: whole(desktopNumber) }],
|
|
570
|
+
["labelWrapWidth", { vp: "NODE_LABEL_WIDTH", write: desktopNumber }],
|
|
480
571
|
["labelPosition", { vp: "NODE_LABEL_POSITION", write: enumOut(DESKTOP_POSITIONS, {}, false) }],
|
|
572
|
+
["labelRotation", { vp: "NODE_LABEL_ROTATION", write: desktopNumber }],
|
|
481
573
|
["tooltip", { vp: "NODE_TOOLTIP", write: textOut }],
|
|
482
574
|
["visible", { vp: "NODE_VISIBLE", write: desktopBool }]
|
|
483
575
|
]),
|
|
@@ -496,14 +588,14 @@ const WRITERS = {
|
|
|
496
588
|
"sourceArrow",
|
|
497
589
|
{
|
|
498
590
|
vp: "EDGE_SOURCE_ARROW_SHAPE",
|
|
499
|
-
write: enumOut(DESKTOP_ARROWS,
|
|
591
|
+
write: enumOut(DESKTOP_ARROWS, DESKTOP_NEAR_ARROWS, true, CY_OTHER_ARROWS)
|
|
500
592
|
}
|
|
501
593
|
],
|
|
502
594
|
[
|
|
503
595
|
"targetArrow",
|
|
504
596
|
{
|
|
505
597
|
vp: "EDGE_TARGET_ARROW_SHAPE",
|
|
506
|
-
write: enumOut(DESKTOP_ARROWS,
|
|
598
|
+
write: enumOut(DESKTOP_ARROWS, DESKTOP_NEAR_ARROWS, true, CY_OTHER_ARROWS)
|
|
507
599
|
}
|
|
508
600
|
],
|
|
509
601
|
["sourceArrowColor", { vp: "EDGE_SOURCE_ARROW_UNSELECTED_PAINT", write: colorOut }],
|
|
@@ -521,6 +613,7 @@ const WRITERS = {
|
|
|
521
613
|
["fill", { vp: "NODE_BACKGROUND_COLOR", write: colorOut }],
|
|
522
614
|
["fillOpacity", { vp: "NODE_BACKGROUND_OPACITY", write: cx2Number }],
|
|
523
615
|
["borderColor", { vp: "NODE_BORDER_COLOR", write: colorOut }],
|
|
616
|
+
["borderOpacity", { vp: "NODE_BORDER_OPACITY", write: cx2Number }],
|
|
524
617
|
["borderWidth", { vp: "NODE_BORDER_WIDTH", write: cx2Number }],
|
|
525
618
|
[
|
|
526
619
|
"borderStyle",
|
|
@@ -541,7 +634,9 @@ const WRITERS = {
|
|
|
541
634
|
["label", { vp: "NODE_LABEL", write: textOut }],
|
|
542
635
|
["labelColor", { vp: "NODE_LABEL_COLOR", write: colorOut }],
|
|
543
636
|
["labelSize", { vp: "NODE_LABEL_FONT_SIZE", write: whole(cx2Number) }],
|
|
637
|
+
["labelWrapWidth", { vp: "NODE_LABEL_MAX_WIDTH", write: cx2Number }],
|
|
544
638
|
["labelPosition", { vp: "NODE_LABEL_POSITION", write: cx2Position }],
|
|
639
|
+
["labelRotation", { vp: "NODE_LABEL_ROTATION", write: cx2Number }],
|
|
545
640
|
["visible", { vp: "NODE_VISIBILITY", write: (v) => v === true ? "element" : "none" }]
|
|
546
641
|
]),
|
|
547
642
|
edge: /* @__PURE__ */ new Map([
|
|
@@ -579,15 +674,13 @@ const WRITERS = {
|
|
|
579
674
|
])
|
|
580
675
|
}
|
|
581
676
|
};
|
|
582
|
-
function cx2Position(v
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
const [h, vert] = Object.hasOwn(CX2_ANCHORS, String(v)) ? CX2_ANCHORS[String(v)] : ["center", "center"];
|
|
677
|
+
function cx2Position(v) {
|
|
678
|
+
const [node, label] = Object.hasOwn(POSITION_ANCHORS, String(v)) ? POSITION_ANCHORS[String(v)] : ["C", "C"];
|
|
679
|
+
const [h, vert] = CX2_WORDS[node];
|
|
680
|
+
const [ha, va] = CX2_WORDS[label];
|
|
588
681
|
return {
|
|
589
|
-
HORIZONTAL_ALIGN:
|
|
590
|
-
VERTICAL_ALIGN:
|
|
682
|
+
HORIZONTAL_ALIGN: ha,
|
|
683
|
+
VERTICAL_ALIGN: va,
|
|
591
684
|
HORIZONTAL_ANCHOR: h,
|
|
592
685
|
VERTICAL_ANCHOR: vert,
|
|
593
686
|
MARGIN_X: 0,
|
|
@@ -598,9 +691,10 @@ function cx2Position(v, approx) {
|
|
|
598
691
|
const FONT_PROPS = ["labelFont", "labelWeight", "labelItalic"];
|
|
599
692
|
const FONT_VP = { node: "NODE_LABEL_FONT_FACE", edge: "EDGE_LABEL_FONT_FACE" };
|
|
600
693
|
const CSS_TO_JAVA = {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
694
|
+
// the families the reader gives Java's logical fonts
|
|
695
|
+
[JAVA_SANS]: "SansSerif",
|
|
696
|
+
[JAVA_SERIF]: "Serif",
|
|
697
|
+
[JAVA_MONO]: "Monospaced"
|
|
604
698
|
};
|
|
605
699
|
function fontOut(dialect, family, weight, italic, approx) {
|
|
606
700
|
const bold = weight === "bold";
|
|
@@ -613,11 +707,14 @@ function fontOut(dialect, family, weight, italic, approx) {
|
|
|
613
707
|
return { FONT_FAMILY: fam, FONT_STYLE: it ? "italic" : "normal", FONT_WEIGHT: bold ? "bold" : "normal" };
|
|
614
708
|
}
|
|
615
709
|
const first = fam.includes(",") ? fam.split(",")[0].trim() : fam;
|
|
616
|
-
const
|
|
710
|
+
const asWritten = Object.hasOwn(CSS_TO_JAVA, first) ? CSS_TO_JAVA[first] : first;
|
|
711
|
+
const java = Object.hasOwn(CSS_TO_JAVA, fam) ? CSS_TO_JAVA[fam] : asWritten;
|
|
617
712
|
if (fontReadsAs(java) !== fam) {
|
|
618
713
|
approx();
|
|
619
714
|
}
|
|
620
|
-
|
|
715
|
+
const style = javaFontStyle(bold, it);
|
|
716
|
+
const face = style === "plain" ? java : `${java}.${style}`;
|
|
717
|
+
return `${face},${bold ? "bold" : "plain"},12`;
|
|
621
718
|
}
|
|
622
719
|
function javaFontStyle(bold, italic) {
|
|
623
720
|
if (!bold && !italic) {
|
|
@@ -626,8 +723,7 @@ function javaFontStyle(bold, italic) {
|
|
|
626
723
|
return (bold ? "bold" : "") + (italic ? "italic" : "");
|
|
627
724
|
}
|
|
628
725
|
function fontReadsAs(name) {
|
|
629
|
-
|
|
630
|
-
return JAVA_FONTS.get(family.toLowerCase()) ?? family;
|
|
726
|
+
return javaFamily(name.replace(/\.(?:bold|italic|plain|bolditalic)$/i, ""));
|
|
631
727
|
}
|
|
632
728
|
function defaultColumnName(target, ref) {
|
|
633
729
|
if ("style" in ref) {
|
|
@@ -685,11 +781,27 @@ function targetEmit(target, extracted, snapshot, options, notes) {
|
|
|
685
781
|
}
|
|
686
782
|
};
|
|
687
783
|
}
|
|
784
|
+
const DRAWN_SO = /* @__PURE__ */ new Map([
|
|
785
|
+
// it measures each word with a space after it when it wraps a label
|
|
786
|
+
["labelWrapTrailingSpace", true],
|
|
787
|
+
// it curves an edge through its bends' midpoints
|
|
788
|
+
["bendCurve", "midpoints"]
|
|
789
|
+
]);
|
|
790
|
+
function drawnSo(p, values) {
|
|
791
|
+
const way = DRAWN_SO.get(p);
|
|
792
|
+
return way !== void 0 && values.every((v) => v === null || v === way);
|
|
793
|
+
}
|
|
688
794
|
function emitTarget(e, style, bypasses, columns) {
|
|
689
795
|
const { target, notes, truth } = e;
|
|
690
796
|
const writers = WRITERS[e.options.dialect][target];
|
|
691
797
|
for (const [p, values] of truth) {
|
|
692
|
-
|
|
798
|
+
const fixed = FIXED[target].get(p);
|
|
799
|
+
if (fixed !== void 0) {
|
|
800
|
+
const other = values.filter((v) => v !== null && v !== fixed).length;
|
|
801
|
+
if (other > 0) {
|
|
802
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, target, p, { count: other });
|
|
803
|
+
}
|
|
804
|
+
} else if (!writers.has(p) && !FONT_PROPS.includes(p) && !drawnSo(p, values)) {
|
|
693
805
|
const count = values.filter((v) => v !== null).length;
|
|
694
806
|
notes.add(STYLE_ISSUE.NOT_WRITTEN, target, p, { count: Math.max(count, 1) });
|
|
695
807
|
}
|
|
@@ -842,7 +954,11 @@ function cytoscapeMapping(e, p, m, w, columns) {
|
|
|
842
954
|
return {
|
|
843
955
|
kind: "discrete",
|
|
844
956
|
column,
|
|
845
|
-
type:
|
|
957
|
+
type: keyType(
|
|
958
|
+
e,
|
|
959
|
+
m.by,
|
|
960
|
+
m.table.map(([k]) => k)
|
|
961
|
+
),
|
|
846
962
|
table: m.table.map(([k, v]) => [k, write(v)])
|
|
847
963
|
};
|
|
848
964
|
}
|
|
@@ -892,7 +1008,16 @@ function passthroughMapping(e, p, by, column, write) {
|
|
|
892
1008
|
}
|
|
893
1009
|
}
|
|
894
1010
|
const table = Array.from(seen);
|
|
895
|
-
return {
|
|
1011
|
+
return {
|
|
1012
|
+
kind: "discrete",
|
|
1013
|
+
column,
|
|
1014
|
+
type: keyType(
|
|
1015
|
+
e,
|
|
1016
|
+
by,
|
|
1017
|
+
table.map(([k]) => k)
|
|
1018
|
+
),
|
|
1019
|
+
table
|
|
1020
|
+
};
|
|
896
1021
|
}
|
|
897
1022
|
function cx2Points(m, approx) {
|
|
898
1023
|
let changed = false;
|
|
@@ -912,6 +1037,18 @@ function cx2Points(m, approx) {
|
|
|
912
1037
|
function isScalar(v) {
|
|
913
1038
|
return typeof v === "string" || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v);
|
|
914
1039
|
}
|
|
1040
|
+
function keyType(e, by, keys) {
|
|
1041
|
+
const type = typeOf(keys);
|
|
1042
|
+
if (type !== "integer") {
|
|
1043
|
+
return type;
|
|
1044
|
+
}
|
|
1045
|
+
if (!("data" in by)) {
|
|
1046
|
+
return "double";
|
|
1047
|
+
}
|
|
1048
|
+
const meta = (e.target === "node" ? e.snapshot.nodes : e.snapshot.edges).get(by.data)?.meta;
|
|
1049
|
+
const floating = (meta?.dtype === "f32" || meta?.dtype === "f64") && meta.origin?.type !== "long";
|
|
1050
|
+
return floating ? "double" : type;
|
|
1051
|
+
}
|
|
915
1052
|
function typeOf(values) {
|
|
916
1053
|
let numbers = 0;
|
|
917
1054
|
let integers = 0;
|
|
@@ -1114,7 +1251,12 @@ function mappingXml(m) {
|
|
|
1114
1251
|
];
|
|
1115
1252
|
}
|
|
1116
1253
|
function cytoscapeWritableProperties(target, dialect) {
|
|
1117
|
-
return [
|
|
1254
|
+
return [
|
|
1255
|
+
...WRITERS[dialect][target].keys(),
|
|
1256
|
+
...FONT_PROPS,
|
|
1257
|
+
...FIXED[target].keys(),
|
|
1258
|
+
...target === "node" ? ["labelWrapTrailingSpace"] : ["bendCurve"]
|
|
1259
|
+
];
|
|
1118
1260
|
}
|
|
1119
1261
|
function cytoscapeElementProperties(target, value, dialect, approx) {
|
|
1120
1262
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -1140,7 +1282,396 @@ function cytoscapeElementProperties(target, value, dialect, approx) {
|
|
|
1140
1282
|
}
|
|
1141
1283
|
return out;
|
|
1142
1284
|
}
|
|
1285
|
+
const CHART_ACROSS = 0.9;
|
|
1286
|
+
const RING_HOLE = 0.4;
|
|
1287
|
+
const SLOTS = Array.from({ length: 9 }, (_, k) => `NODE_CUSTOMGRAPHICS_${String(k + 1)}`);
|
|
1288
|
+
const CHART_CLASS = /^org\.cytoscape\.(PieChart|RingChart|BarChart|LineChart|BoxChart|HeatMapChart)$/;
|
|
1289
|
+
function chartOf(raw) {
|
|
1290
|
+
if (typeof raw === "object" && raw !== null && !Array.isArray(raw)) {
|
|
1291
|
+
const o = raw;
|
|
1292
|
+
const kind2 = CHART_CLASS.exec(typeof o.name === "string" ? o.name : "")?.[1];
|
|
1293
|
+
return kind2 !== void 0 && typeof o.properties === "object" && o.properties !== null ? { kind: kind2, ring: kind2 === "RingChart", options: o.properties } : null;
|
|
1294
|
+
}
|
|
1295
|
+
if (typeof raw !== "string") {
|
|
1296
|
+
return null;
|
|
1297
|
+
}
|
|
1298
|
+
const m = /^(org\.cytoscape\.\w+):(\{.*\})\s*$/s.exec(raw.trim());
|
|
1299
|
+
const kind = m === null ? void 0 : CHART_CLASS.exec(m[1])?.[1];
|
|
1300
|
+
if (m === null || kind === void 0) {
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
try {
|
|
1304
|
+
const options = JSON.parse(m[2]);
|
|
1305
|
+
return typeof options === "object" && options !== null ? { kind, ring: kind === "RingChart", options } : null;
|
|
1306
|
+
} catch {
|
|
1307
|
+
return null;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
const ANCHORS = {
|
|
1311
|
+
C: [0, 0],
|
|
1312
|
+
N: [0, -1],
|
|
1313
|
+
NE: [1, -1],
|
|
1314
|
+
E: [1, 0],
|
|
1315
|
+
SE: [1, 1],
|
|
1316
|
+
S: [0, 1],
|
|
1317
|
+
SW: [-1, 1],
|
|
1318
|
+
W: [-1, 0],
|
|
1319
|
+
NW: [-1, -1]
|
|
1320
|
+
};
|
|
1321
|
+
function positionOf(raw) {
|
|
1322
|
+
let parts;
|
|
1323
|
+
if (typeof raw === "string") {
|
|
1324
|
+
const p = raw.split(",");
|
|
1325
|
+
parts = [p[0], p[1], p[3], p[4]];
|
|
1326
|
+
} else if (typeof raw === "object" && raw !== null) {
|
|
1327
|
+
const o = raw;
|
|
1328
|
+
parts = [o.ENTITY_ANCHOR, o.GRAPHICS_ANCHOR, o.MARGIN_X, o.MARGIN_Y];
|
|
1329
|
+
} else {
|
|
1330
|
+
return null;
|
|
1331
|
+
}
|
|
1332
|
+
const anchor = (v) => typeof v === "string" ? ANCHORS[v.trim().toUpperCase()] : void 0;
|
|
1333
|
+
const [node, chart] = [anchor(parts[0]), anchor(parts[1])];
|
|
1334
|
+
const [x, y] = [Number(parts[2] ?? 0), Number(parts[3] ?? 0)];
|
|
1335
|
+
return node === void 0 || chart === void 0 ? null : { node, chart, x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
1336
|
+
}
|
|
1337
|
+
function valuesOf(columns, value) {
|
|
1338
|
+
const first = columns.length === 1 ? value(columns[0]) : void 0;
|
|
1339
|
+
const raw = Array.isArray(first) ? first : columns.map((c) => value(c));
|
|
1340
|
+
return raw.map((v) => typeof v === "number" ? v : Number(v));
|
|
1341
|
+
}
|
|
1342
|
+
function readCytoscapeCharts(out, n, graphicOf, value, sizeSync) {
|
|
1343
|
+
const col = (property) => {
|
|
1344
|
+
const existing = out[property];
|
|
1345
|
+
if (existing !== void 0) {
|
|
1346
|
+
return existing;
|
|
1347
|
+
}
|
|
1348
|
+
const fresh = new Array(n).fill(null);
|
|
1349
|
+
out[property] = fresh;
|
|
1350
|
+
return fresh;
|
|
1351
|
+
};
|
|
1352
|
+
for (let i = 0; i < n; i++) {
|
|
1353
|
+
const slot = SLOTS.findIndex((vp) => chartOf(graphicOf(vp, i)) !== null);
|
|
1354
|
+
const chart = slot < 0 ? null : chartOf(graphicOf(SLOTS[slot], i));
|
|
1355
|
+
if (chart === null) {
|
|
1356
|
+
continue;
|
|
1357
|
+
}
|
|
1358
|
+
const [w, h] = [out.width?.[i], out.height?.[i]];
|
|
1359
|
+
chartOnNode(
|
|
1360
|
+
chart,
|
|
1361
|
+
{
|
|
1362
|
+
put: (property, v) => {
|
|
1363
|
+
col(property)[i] = v;
|
|
1364
|
+
},
|
|
1365
|
+
get: (property) => out[property]?.[i],
|
|
1366
|
+
graphic: (name) => graphicOf(`${name}_${String(slot + 1)}`, i),
|
|
1367
|
+
value: (column) => value(column, i),
|
|
1368
|
+
w: typeof w === "number" ? w : null,
|
|
1369
|
+
h: typeof h === "number" ? h : null
|
|
1370
|
+
},
|
|
1371
|
+
sizeSync
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function shorterSide(node) {
|
|
1376
|
+
return node.w !== null && node.h !== null ? Math.min(node.w, node.h) : null;
|
|
1377
|
+
}
|
|
1378
|
+
function chartOnNode(chart, node, sizeSync) {
|
|
1379
|
+
const { options } = chart;
|
|
1380
|
+
const colors = Array.isArray(options.cy_colors) ? options.cy_colors.map(String) : [];
|
|
1381
|
+
const columns = Array.isArray(options.cy_dataColumns) ? options.cy_dataColumns.map(String) : [];
|
|
1382
|
+
const values = valuesOf(columns, node.value);
|
|
1383
|
+
if (chart.kind === "PieChart" || chart.kind === "RingChart") {
|
|
1384
|
+
pieOnNode(chart.ring, options, values, colors, node, sizeSync);
|
|
1385
|
+
return;
|
|
1386
|
+
}
|
|
1387
|
+
const own2 = Number(node.graphic("NODE_CUSTOMGRAPHICS_SIZE"));
|
|
1388
|
+
const side = shorterSide(node);
|
|
1389
|
+
const ownSize = own2 > 0;
|
|
1390
|
+
const fitted = sizeSync || !ownSize;
|
|
1391
|
+
const box = side === null ? null : { disc: CHART_ACROSS * (fitted ? side : own2), side };
|
|
1392
|
+
for (const [property, v] of Object.entries(plotChart(chart.kind, options, values, colors, box))) {
|
|
1393
|
+
node.put(property, v);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
function pieSlices(values, colors) {
|
|
1397
|
+
const total = values.reduce((sum, v) => sum + (Number.isFinite(v) && v > 0 ? v : 0), 0);
|
|
1398
|
+
return values.flatMap(
|
|
1399
|
+
(v, k) => Number.isFinite(v) && v > 0 && colors[k] !== void 0 ? [{ color: colors[k].toLowerCase(), size: v / total }] : []
|
|
1400
|
+
);
|
|
1401
|
+
}
|
|
1402
|
+
function pieOnNode(ring, options, values, colors, node, sizeSync) {
|
|
1403
|
+
const slices = pieSlices(values, colors);
|
|
1404
|
+
if (slices.length === 0) {
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
const start = Number(options.cy_startAngle ?? 0);
|
|
1408
|
+
const from = Number.isFinite(start) ? start : 0;
|
|
1409
|
+
const reversed = [...slices].reverse();
|
|
1410
|
+
node.put("pieColors", reversed.map((s) => s.color).join(" "));
|
|
1411
|
+
node.put("pieSizes", reversed.map((s) => String(num6(s.size))).join(" "));
|
|
1412
|
+
const own2 = Number(node.graphic("NODE_CUSTOMGRAPHICS_SIZE"));
|
|
1413
|
+
const side = shorterSide(node);
|
|
1414
|
+
const ownSize = own2 > 0;
|
|
1415
|
+
const fitted = sizeSync || !ownSize || side === null || side <= 0;
|
|
1416
|
+
node.put("pieRadius", fitted ? CHART_ACROSS : num6(CHART_ACROSS * own2 / side));
|
|
1417
|
+
pieOffset(node, fitted, own2);
|
|
1418
|
+
node.put("pieRotation", num6(((90 - from) % 360 + 360) % 360));
|
|
1419
|
+
const texts = pieItemLabels(options, values, colors, node.value, {
|
|
1420
|
+
start: from,
|
|
1421
|
+
radius: CHART_ACROSS * (fitted || side === null ? 1 : own2 / side) * (side ?? 0) / 2,
|
|
1422
|
+
dx: Number(node.get("pieOffsetX") ?? 0),
|
|
1423
|
+
dy: Number(node.get("pieOffsetY") ?? 0),
|
|
1424
|
+
w: node.w,
|
|
1425
|
+
h: node.h
|
|
1426
|
+
});
|
|
1427
|
+
if (texts !== null && (node.get("shapeTexts") ?? null) === null) {
|
|
1428
|
+
node.put("shapeTexts", texts);
|
|
1429
|
+
}
|
|
1430
|
+
if (ring) {
|
|
1431
|
+
const hole = Number(options.cy_holeSize ?? RING_HOLE);
|
|
1432
|
+
node.put("pieHole", Number.isFinite(hole) ? Math.max(0, Math.min(1, hole)) : RING_HOLE);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
function pieOffset(node, fitted, own2) {
|
|
1436
|
+
const at = positionOf(node.graphic("NODE_CUSTOMGRAPHICS_POSITION"));
|
|
1437
|
+
const { w, h } = node;
|
|
1438
|
+
if (at === null || w === null || h === null) {
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const disc = CHART_ACROSS * (fitted ? Math.min(w, h) : own2);
|
|
1442
|
+
const dx = at.node[0] * disc / 2 - at.chart[0] * w / 2 + at.x;
|
|
1443
|
+
const dy = at.node[1] * disc / 2 - at.chart[1] * h / 2 + at.y;
|
|
1444
|
+
if (dx !== 0 || dy !== 0) {
|
|
1445
|
+
node.put("pieOffsetX", num6(dx));
|
|
1446
|
+
node.put("pieOffsetY", num6(dy));
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
const ITEM_LABEL_RADIUS = 0.62;
|
|
1450
|
+
const ITEM_LABEL_FONT_SIZE = 1;
|
|
1451
|
+
const CHART_LABEL_COLOR = "#404040";
|
|
1452
|
+
function itemLabelsOf(options, value) {
|
|
1453
|
+
if (options.cy_showItemLabels !== true) {
|
|
1454
|
+
return null;
|
|
1455
|
+
}
|
|
1456
|
+
const column = typeof options.cy_itemLabelsColumn === "string" ? value(options.cy_itemLabelsColumn) : void 0;
|
|
1457
|
+
const list = Array.isArray(column) ? column : options.cy_itemLabels;
|
|
1458
|
+
return Array.isArray(list) ? list.map((v) => v === null || v === void 0 ? "" : String(v)) : null;
|
|
1459
|
+
}
|
|
1460
|
+
function pieItemLabels(options, values, colors, value, at) {
|
|
1461
|
+
const labels = itemLabelsOf(options, value);
|
|
1462
|
+
const { w, h } = at;
|
|
1463
|
+
if (labels === null || w === null || h === null) {
|
|
1464
|
+
return null;
|
|
1465
|
+
}
|
|
1466
|
+
const drawn = w > 0 && h > 0 && at.radius > 0;
|
|
1467
|
+
if (!drawn) {
|
|
1468
|
+
return null;
|
|
1469
|
+
}
|
|
1470
|
+
const shown = values.map((v, k) => Number.isFinite(v) && v > 0 && colors[k] !== void 0);
|
|
1471
|
+
const total = values.reduce((sum, v, k) => sum + (shown[k] ? v : 0), 0);
|
|
1472
|
+
const size = Number(options.cy_itemLabelFontSize ?? ITEM_LABEL_FONT_SIZE);
|
|
1473
|
+
const texts = [];
|
|
1474
|
+
let from = at.start;
|
|
1475
|
+
values.forEach((v, k) => {
|
|
1476
|
+
if (!shown[k]) {
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
const sweep = 360 * v / total;
|
|
1480
|
+
const mid = (from + sweep / 2) * Math.PI / 180;
|
|
1481
|
+
from += sweep;
|
|
1482
|
+
const text = labels[k] ?? "";
|
|
1483
|
+
if (text === "") {
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
const x = at.dx + ITEM_LABEL_RADIUS * at.radius * Math.cos(mid);
|
|
1487
|
+
const y = -at.dy + ITEM_LABEL_RADIUS * at.radius * Math.sin(mid);
|
|
1488
|
+
texts.push([
|
|
1489
|
+
num6(x / (w / 2)),
|
|
1490
|
+
num6(y / (h / 2)),
|
|
1491
|
+
text,
|
|
1492
|
+
{
|
|
1493
|
+
size: num6((Number.isFinite(size) && size > 0 ? size : ITEM_LABEL_FONT_SIZE) / h),
|
|
1494
|
+
color: CHART_LABEL_COLOR
|
|
1495
|
+
}
|
|
1496
|
+
]);
|
|
1497
|
+
});
|
|
1498
|
+
return texts.length === 0 ? null : JSON.stringify(texts);
|
|
1499
|
+
}
|
|
1500
|
+
const CHART_UNIT = 0.5;
|
|
1501
|
+
const CHART_INSET = 0.9;
|
|
1502
|
+
const PLOT_INSET = 1;
|
|
1503
|
+
const HEAT_MAP_INSET = 2;
|
|
1504
|
+
const BAR_OUTLINE = { color: "#404040", width: 0.25 };
|
|
1505
|
+
const BAR_MARGIN = 0.025;
|
|
1506
|
+
const LINE_MARGIN = -0.0125;
|
|
1507
|
+
const RANGE_HEADROOM = 0.1;
|
|
1508
|
+
function mix(a, b, t) {
|
|
1509
|
+
const rgb = (c) => [1, 3, 5].map((k) => Number.parseInt(c.slice(k, k + 2), 16));
|
|
1510
|
+
const [x, y] = [rgb(a), rgb(b)];
|
|
1511
|
+
if ([...x, ...y].some((v) => !Number.isFinite(v))) {
|
|
1512
|
+
return a;
|
|
1513
|
+
}
|
|
1514
|
+
const u = Math.max(0, Math.min(1, t));
|
|
1515
|
+
return `#${x.map(
|
|
1516
|
+
(v, k) => Math.round(v + (y[k] - v) * u).toString(16).padStart(2, "0")
|
|
1517
|
+
).join("")}`;
|
|
1518
|
+
}
|
|
1519
|
+
function scaleColor(colors, v, range) {
|
|
1520
|
+
const [up, zero, down] = [colors[0], colors[1] ?? colors[0], colors[2] ?? colors[0]];
|
|
1521
|
+
if (v >= 0) {
|
|
1522
|
+
return mix(zero, up, range[1] > 0 ? v / range[1] : 0);
|
|
1523
|
+
}
|
|
1524
|
+
return mix(zero, down, range[0] < 0 ? v / range[0] : 0);
|
|
1525
|
+
}
|
|
1526
|
+
function boxStats(values) {
|
|
1527
|
+
const v = [...values].sort((a, b) => a - b);
|
|
1528
|
+
const median = (list) => {
|
|
1529
|
+
const m = list.length / 2;
|
|
1530
|
+
return list.length % 2 === 1 ? list[Math.floor(m)] : (list[m - 1] + list[m]) / 2;
|
|
1531
|
+
};
|
|
1532
|
+
const half = Math.ceil(v.length / 2);
|
|
1533
|
+
const [q1, q3] = [median(v.slice(0, half)), median(v.slice(v.length - half))];
|
|
1534
|
+
const reach = 1.5 * (q3 - q1);
|
|
1535
|
+
const inside = v.filter((x) => x >= q1 - reach && x <= q3 + reach);
|
|
1536
|
+
return [inside[0], q1, median(v), q3, inside.at(-1) ?? q3];
|
|
1537
|
+
}
|
|
1538
|
+
function plotSize(kind, box) {
|
|
1539
|
+
const sized = box !== null && box.side > 0;
|
|
1540
|
+
if (!sized) {
|
|
1541
|
+
return {};
|
|
1542
|
+
}
|
|
1543
|
+
const inset = CHART_INSET + (kind === "HeatMapChart" ? HEAT_MAP_INSET : PLOT_INSET);
|
|
1544
|
+
return { chartSize: num6(Math.max(0, box.disc - inset) / box.side) };
|
|
1545
|
+
}
|
|
1546
|
+
function chartOutline(options) {
|
|
1547
|
+
const color = typeof options.cy_borderColor === "string" ? options.cy_borderColor : BAR_OUTLINE.color;
|
|
1548
|
+
return {
|
|
1549
|
+
chartBorderColor: color.toLowerCase(),
|
|
1550
|
+
chartBorderWidth: num6(CHART_UNIT * (Number(options.cy_borderWidth ?? BAR_OUTLINE.width) || 0))
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
function barChart(options, finite, colors, range, horizontal) {
|
|
1554
|
+
const type = typeof options.cy_type === "string" ? options.cy_type : "GROUPED";
|
|
1555
|
+
const stacked = type === "STACKED";
|
|
1556
|
+
return {
|
|
1557
|
+
chartKind: stacked ? "stacked-bar" : "bar",
|
|
1558
|
+
chartValues: finite.join(" "),
|
|
1559
|
+
chartColors: finite.map((v, k) => barColor(type, colors, v, k, range)).join(" "),
|
|
1560
|
+
chartMin: range[0],
|
|
1561
|
+
chartMax: range[1],
|
|
1562
|
+
// Cytoscape lays a stacked bar's values across the node when its orientation says up
|
|
1563
|
+
chartHorizontal: stacked ? !horizontal : horizontal,
|
|
1564
|
+
chartMargin: BAR_MARGIN,
|
|
1565
|
+
chartGap: num6(Math.max(0, Math.min(1, Number(options.cy_separation ?? 0) || 0)))
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
function barColor(type, colors, v, k, range) {
|
|
1569
|
+
if (type === "HEAT_STRIPS") {
|
|
1570
|
+
return scaleColor(colors, v, range);
|
|
1571
|
+
}
|
|
1572
|
+
if (type === "UP_DOWN") {
|
|
1573
|
+
return colors[v >= 0 ? 0 : colors.length - 1].toLowerCase();
|
|
1574
|
+
}
|
|
1575
|
+
return colors[Math.min(k, colors.length - 1)].toLowerCase();
|
|
1576
|
+
}
|
|
1577
|
+
function plotChart(kind, options, values, colors, box) {
|
|
1578
|
+
const finite = values.filter((v) => Number.isFinite(v));
|
|
1579
|
+
if (finite.length === 0 || colors.length === 0) {
|
|
1580
|
+
return {};
|
|
1581
|
+
}
|
|
1582
|
+
const given = Array.isArray(options.cy_range) ? options.cy_range.map(Number) : [];
|
|
1583
|
+
const global = options.cy_globalRange !== false && given.length === 2 && given.every((v) => Number.isFinite(v));
|
|
1584
|
+
const auto = [Math.min(0, ...finite), Math.max(0, ...finite)];
|
|
1585
|
+
auto[1] += RANGE_HEADROOM * (auto[1] - auto[0]);
|
|
1586
|
+
const range = global ? [given[0], given[1]] : auto;
|
|
1587
|
+
const horizontal = options.cy_orientation === "HORIZONTAL";
|
|
1588
|
+
const out = plotSize(kind, box);
|
|
1589
|
+
const outline = chartOutline(options);
|
|
1590
|
+
switch (kind) {
|
|
1591
|
+
case "BarChart":
|
|
1592
|
+
Object.assign(out, outline, barChart(options, finite, colors, range, horizontal));
|
|
1593
|
+
break;
|
|
1594
|
+
case "LineChart":
|
|
1595
|
+
Object.assign(out, {
|
|
1596
|
+
chartKind: "line",
|
|
1597
|
+
chartValues: finite.join(" "),
|
|
1598
|
+
chartColors: colors[0].toLowerCase(),
|
|
1599
|
+
chartMin: range[0],
|
|
1600
|
+
chartMax: num6(range[1] + (global ? RANGE_HEADROOM * (range[1] - range[0]) : 0)),
|
|
1601
|
+
chartMargin: LINE_MARGIN,
|
|
1602
|
+
chartLineWidth: num6(CHART_UNIT * (Number(options.cy_lineWidth ?? 1) || 0))
|
|
1603
|
+
});
|
|
1604
|
+
break;
|
|
1605
|
+
case "BoxChart":
|
|
1606
|
+
Object.assign(out, outline, {
|
|
1607
|
+
chartKind: "box",
|
|
1608
|
+
chartValues: boxStats(finite).map(num6).join(" "),
|
|
1609
|
+
chartColors: `${colors[0].toLowerCase()} #000000`,
|
|
1610
|
+
chartMin: range[0],
|
|
1611
|
+
chartMax: range[1],
|
|
1612
|
+
chartHorizontal: horizontal,
|
|
1613
|
+
chartMargin: BAR_MARGIN,
|
|
1614
|
+
chartLineWidth: num6(CHART_UNIT * BAR_OUTLINE.width)
|
|
1615
|
+
});
|
|
1616
|
+
break;
|
|
1617
|
+
case "HeatMapChart": {
|
|
1618
|
+
const cells = horizontal ? [...finite].reverse() : finite;
|
|
1619
|
+
Object.assign(out, {
|
|
1620
|
+
chartKind: "cells",
|
|
1621
|
+
chartValues: cells.join(" "),
|
|
1622
|
+
chartColors: cells.map((v) => scaleColor(colors, v, range)).join(" "),
|
|
1623
|
+
chartHorizontal: !horizontal
|
|
1624
|
+
});
|
|
1625
|
+
break;
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
return out;
|
|
1629
|
+
}
|
|
1630
|
+
const EDGE_STACKING_DENSITY_VP = "EDGE_STACKING_DENSITY";
|
|
1631
|
+
const EDGE_STACKING_VP = "EDGE_STACKING";
|
|
1632
|
+
const AUTOROTATE_VP = "EDGE_LABEL_AUTOROTATE";
|
|
1633
|
+
function withoutKey(m, key) {
|
|
1634
|
+
return new Map([...m].filter(([k]) => k !== key));
|
|
1635
|
+
}
|
|
1636
|
+
const EDGE_STACKING_DENSITY_DEFAULT = 0.5;
|
|
1637
|
+
function edgeEnds(snapshot, nodes) {
|
|
1638
|
+
const nodeSize = Array.from({ length: snapshot.nodeCount }, (_, i) => {
|
|
1639
|
+
const sides = [nodes.width?.[i], nodes.height?.[i]].filter((v) => typeof v === "number");
|
|
1640
|
+
return sides.length === 0 ? null : Math.max(...sides);
|
|
1641
|
+
});
|
|
1642
|
+
const nodeBox = Array.from({ length: snapshot.nodeCount }, (_, i) => {
|
|
1643
|
+
const [w, h, b] = [nodes.width?.[i], nodes.height?.[i], nodes.borderWidth?.[i]];
|
|
1644
|
+
return typeof w === "number" && typeof h === "number" ? [w, h, typeof b === "number" ? b : 0] : null;
|
|
1645
|
+
});
|
|
1646
|
+
const position = snapshot.nodes.byRole("position");
|
|
1647
|
+
const down = position?.meta.extra?.yAxis === "down";
|
|
1648
|
+
const nodeAt = Array.from({ length: snapshot.nodeCount }, (_, i) => {
|
|
1649
|
+
const v = position?.isSet(i) === true ? position.value(i) : null;
|
|
1650
|
+
return v === null ? null : [v[0], down ? v[1] : -v[1]];
|
|
1651
|
+
});
|
|
1652
|
+
const { src, dst } = snapshot.edgeList();
|
|
1653
|
+
return { source: src, target: dst, nodeSize, nodeBox, nodeAt };
|
|
1654
|
+
}
|
|
1143
1655
|
const NODE_SIZE_FALLBACK = 50;
|
|
1656
|
+
const LOCK_PARENT = /* @__PURE__ */ new Map([
|
|
1657
|
+
["NODE_FILL_COLOR", "NODE_PAINT"],
|
|
1658
|
+
["NODE_BORDER_PAINT", "NODE_PAINT"],
|
|
1659
|
+
["NODE_WIDTH", "NODE_SIZE"],
|
|
1660
|
+
["NODE_HEIGHT", "NODE_SIZE"],
|
|
1661
|
+
["EDGE_UNSELECTED_PAINT", "EDGE_PAINT"],
|
|
1662
|
+
["EDGE_STROKE_UNSELECTED_PAINT", "EDGE_UNSELECTED_PAINT"],
|
|
1663
|
+
["EDGE_SOURCE_ARROW_UNSELECTED_PAINT", "EDGE_UNSELECTED_PAINT"],
|
|
1664
|
+
["EDGE_TARGET_ARROW_UNSELECTED_PAINT", "EDGE_UNSELECTED_PAINT"]
|
|
1665
|
+
]);
|
|
1666
|
+
function lockedValue(b, vp) {
|
|
1667
|
+
for (let p = vp; p !== void 0; p = LOCK_PARENT.get(p)) {
|
|
1668
|
+
const v = b.get(p);
|
|
1669
|
+
if (v !== void 0 && v !== null) {
|
|
1670
|
+
return v;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
return void 0;
|
|
1674
|
+
}
|
|
1144
1675
|
function vpUsage(style, bypasses) {
|
|
1145
1676
|
const bypassed = /* @__PURE__ */ new Set();
|
|
1146
1677
|
for (const b of bypasses) {
|
|
@@ -1155,6 +1686,11 @@ function vpUsage(style, bypasses) {
|
|
|
1155
1686
|
bypassed.add(to);
|
|
1156
1687
|
}
|
|
1157
1688
|
}
|
|
1689
|
+
for (const [child, parent] of LOCK_PARENT) {
|
|
1690
|
+
if (bypassed.has(parent)) {
|
|
1691
|
+
bypassed.add(child);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1158
1694
|
const used = /* @__PURE__ */ new Set([...style.defaults.keys(), ...style.mappings.keys(), ...bypassed]);
|
|
1159
1695
|
return { used, bypassed };
|
|
1160
1696
|
}
|
|
@@ -1171,7 +1707,7 @@ function chooseVps(target, style, used) {
|
|
|
1171
1707
|
chosen.delete("height");
|
|
1172
1708
|
}
|
|
1173
1709
|
if (target === "edge" && style.dependencies.get("arrowColorMatchesEdge") === true) {
|
|
1174
|
-
if (used.has("EDGE_UNSELECTED_PAINT")) {
|
|
1710
|
+
if (used.has("EDGE_UNSELECTED_PAINT") || used.has("EDGE_STROKE_UNSELECTED_PAINT")) {
|
|
1175
1711
|
chosen.set("color", ["EDGE_UNSELECTED_PAINT", colorParser]);
|
|
1176
1712
|
}
|
|
1177
1713
|
chosen.delete("sourceArrowColor");
|
|
@@ -1254,7 +1790,7 @@ function resolver(target, style, elements, notes, budget) {
|
|
|
1254
1790
|
return b.get(from);
|
|
1255
1791
|
}
|
|
1256
1792
|
}
|
|
1257
|
-
return
|
|
1793
|
+
return lockedValue(b, vp);
|
|
1258
1794
|
};
|
|
1259
1795
|
const mappingOf = (vp, parse, property) => {
|
|
1260
1796
|
const raw = style.mappings.get(vp);
|
|
@@ -1293,7 +1829,7 @@ function resolveCytoscape(target, style, elements, options = {}) {
|
|
|
1293
1829
|
const n = elements.count;
|
|
1294
1830
|
const { used, bypassed } = vpUsage(s, elements.bypasses ?? []);
|
|
1295
1831
|
const chosen = chooseVps(target, s, used);
|
|
1296
|
-
const { one } = resolver(target, s, elements, notes, options.budget);
|
|
1832
|
+
const { one, bypass } = resolver(target, s, elements, notes, options.budget);
|
|
1297
1833
|
const out = {};
|
|
1298
1834
|
const column = (vp, parse, property) => {
|
|
1299
1835
|
options.budget?.spend(target, n);
|
|
@@ -1308,24 +1844,352 @@ function resolveCytoscape(target, style, elements, options = {}) {
|
|
|
1308
1844
|
}
|
|
1309
1845
|
if (target === "node" && s.dependencies.get("nodeSizeLocked") === true) {
|
|
1310
1846
|
const size = column(NODE_SIZE_VP, sizeParser, "width").map((v) => v ?? NODE_SIZE_FALLBACK);
|
|
1311
|
-
|
|
1312
|
-
|
|
1847
|
+
const own2 = (vp, property) => size.map((v, i) => {
|
|
1848
|
+
const b = bypass(i, vp);
|
|
1849
|
+
const parsed = b === void 0 || b === null ? null : sizeParser(b, { notes, target, property, element: i });
|
|
1850
|
+
return parsed ?? v;
|
|
1851
|
+
});
|
|
1852
|
+
out.width = own2("NODE_WIDTH", "width");
|
|
1853
|
+
out.height = own2("NODE_HEIGHT", "height");
|
|
1854
|
+
}
|
|
1855
|
+
labelDress(target, out, one, n, elements.ends);
|
|
1856
|
+
if (target === "node") {
|
|
1857
|
+
squashHexagons(out);
|
|
1858
|
+
const raw = (v) => {
|
|
1859
|
+
if (typeof v === "string" || typeof v === "number") {
|
|
1860
|
+
return String(v);
|
|
1861
|
+
}
|
|
1862
|
+
return typeof v === "object" && v !== null ? JSON.stringify(v) : null;
|
|
1863
|
+
};
|
|
1864
|
+
readCytoscapeCharts(
|
|
1865
|
+
out,
|
|
1866
|
+
n,
|
|
1867
|
+
(slot, i) => {
|
|
1868
|
+
const v = one(slot, raw, "pieColors", i);
|
|
1869
|
+
return typeof v === "string" && v.startsWith("{") ? JSON.parse(v) : v;
|
|
1870
|
+
},
|
|
1871
|
+
(column2, i) => elements.value(column2, i),
|
|
1872
|
+
s.dependencies.get("nodeCustomGraphicsSizeSync") !== false
|
|
1873
|
+
);
|
|
1874
|
+
}
|
|
1875
|
+
if (target === "edge" && s.dependencies.get("arrowColorMatchesEdge") === true && !used.has("EDGE_UNSELECTED_PAINT") && used.has("EDGE_STROKE_UNSELECTED_PAINT")) {
|
|
1876
|
+
const paint = toolDefaults("cytoscape-fallbacks")?.edge.color?.value ?? null;
|
|
1877
|
+
out.color = Array.from({ length: n }, (_, i) => one("EDGE_UNSELECTED_PAINT", colorParser, "color", i) ?? paint);
|
|
1313
1878
|
}
|
|
1314
1879
|
if (target === "edge" && s.dependencies.get("arrowColorMatchesEdge") === true && out.color !== void 0) {
|
|
1315
|
-
|
|
1316
|
-
|
|
1880
|
+
const lineVp = chosen.get("color")?.[0];
|
|
1881
|
+
const unbypassed = resolver(target, s, { ...elements, bypasses: [] }, notes, options.budget).one;
|
|
1882
|
+
const arrows = lineVp === "EDGE_LINE_COLOR" ? Array.from({ length: n }, (_, i) => unbypassed(lineVp, colorParser, "color", i)) : out.color;
|
|
1883
|
+
out.sourceArrowColor = arrows.slice();
|
|
1884
|
+
out.targetArrowColor = arrows.slice();
|
|
1885
|
+
const own2 = [
|
|
1886
|
+
["color", "EDGE_STROKE_UNSELECTED_PAINT"],
|
|
1887
|
+
["sourceArrowColor", "EDGE_SOURCE_ARROW_UNSELECTED_PAINT"],
|
|
1888
|
+
["targetArrowColor", "EDGE_TARGET_ARROW_UNSELECTED_PAINT"],
|
|
1889
|
+
["sourceArrowColor", "EDGE_SOURCE_ARROW_COLOR"],
|
|
1890
|
+
["targetArrowColor", "EDGE_TARGET_ARROW_COLOR"]
|
|
1891
|
+
];
|
|
1892
|
+
for (const [prop, vp] of own2) {
|
|
1893
|
+
out[prop] = (out[prop] ?? []).map((v, i) => {
|
|
1894
|
+
const b = bypass(i, vp);
|
|
1895
|
+
const site = { notes, target, property: prop, element: i };
|
|
1896
|
+
return (b === void 0 || b === null ? null : colorParser(b, site)) ?? v;
|
|
1897
|
+
});
|
|
1898
|
+
}
|
|
1317
1899
|
}
|
|
1318
1900
|
noteUncarried(target, s, used, bypassed, notes);
|
|
1319
|
-
fillToolDefaults(target, out, n, options.defaults ?? null);
|
|
1320
1901
|
if (target === "edge") {
|
|
1321
|
-
|
|
1902
|
+
const bends = column(EDGE_BEND_VP, bendsParser, "bends");
|
|
1903
|
+
if (bends.some((v) => v !== null)) {
|
|
1904
|
+
out.bends = bends;
|
|
1905
|
+
}
|
|
1906
|
+
const curvedAsSet = out.curved?.slice();
|
|
1907
|
+
straightenBendless(out, one, n, elements.ends);
|
|
1908
|
+
loopHandles(out, one, curvedAsSet, elements.ends);
|
|
1909
|
+
arrowProportions(out, column);
|
|
1322
1910
|
}
|
|
1911
|
+
fillToolDefaults(target, out, n, options.defaults ?? null);
|
|
1323
1912
|
return out;
|
|
1324
1913
|
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1914
|
+
const rawText = (v) => {
|
|
1915
|
+
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") {
|
|
1916
|
+
return String(v);
|
|
1917
|
+
}
|
|
1918
|
+
return typeof v === "object" && v !== null ? JSON.stringify(v) : null;
|
|
1919
|
+
};
|
|
1920
|
+
function labelDress(target, out, one, n, ends) {
|
|
1921
|
+
const vp = (name) => `${target === "node" ? "NODE" : "EDGE"}_LABEL_${name}`;
|
|
1922
|
+
const columns = {};
|
|
1923
|
+
const put = (property, i, v) => {
|
|
1924
|
+
let column = columns[property];
|
|
1925
|
+
if (column === void 0) {
|
|
1926
|
+
column = new Array(n).fill(null);
|
|
1927
|
+
columns[property] = column;
|
|
1928
|
+
}
|
|
1929
|
+
column[i] = v;
|
|
1930
|
+
};
|
|
1931
|
+
for (let i = 0; i < n; i++) {
|
|
1932
|
+
labelBox(vp, one, i, put);
|
|
1933
|
+
const placed = one(vp("POSITION"), rawText, "labelPlace", i);
|
|
1934
|
+
const raw = typeof placed === "string" && placed.startsWith("{") ? JSON.parse(placed) : placed;
|
|
1935
|
+
const place = cytoscapeLabelPlace(raw, { notes: new StyleNotes(), target, property: "labelPosition" });
|
|
1936
|
+
if (place !== null) {
|
|
1937
|
+
placeLabel(target, place, i, out, put, ends);
|
|
1938
|
+
}
|
|
1939
|
+
if (target === "edge") {
|
|
1940
|
+
autorotate(one, i, out, n, ends);
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
const kept = (property, v) => v !== null && v !== 0 && (v !== "center" || property === "labelPosition" && target === "edge");
|
|
1944
|
+
for (const [property, values] of Object.entries(columns)) {
|
|
1945
|
+
if (values.some((v) => kept(property, v))) {
|
|
1946
|
+
out[property] = values;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
function labelBox(vp, one, i, put) {
|
|
1951
|
+
const shape = one(vp("BACKGROUND_SHAPE"), rawText, "labelBackgroundShape", i);
|
|
1952
|
+
if (typeof shape !== "string" || shape.trim().toUpperCase() === "NONE") {
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
put("labelBackground", i, one(vp("BACKGROUND_COLOR"), colorParser, "labelBackground", i) ?? "#b6b6b6");
|
|
1956
|
+
const [t, o] = [vp("BACKGROUND_TRANSPARENCY"), vp("BACKGROUND_OPACITY")];
|
|
1957
|
+
const opacity = one(t, opacityParser(t), "labelBackgroundOpacity", i) ?? one(o, opacityParser(o), "labelBackgroundOpacity", i);
|
|
1958
|
+
put("labelBackgroundOpacity", i, opacity ?? 1);
|
|
1959
|
+
if (shape.trim().toUpperCase().replace("-", "_") === "ROUND_RECTANGLE") {
|
|
1960
|
+
const size = one(vp("FONT_SIZE"), sizeParser, "labelSize", i);
|
|
1961
|
+
const defaultSize = vp("FONT_SIZE").startsWith("EDGE") ? 10 : 12;
|
|
1962
|
+
put("labelCornerRadius", i, num6(LABEL_CORNER_PER_SIZE * (typeof size === "number" ? size : defaultSize)));
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
const LABEL_CORNER_PER_SIZE = 0.1455;
|
|
1966
|
+
function placeLabel(target, place, i, out, put, ends) {
|
|
1967
|
+
let move;
|
|
1968
|
+
if (target === "node") {
|
|
1969
|
+
const [w, h] = [out.width?.[i], out.height?.[i]];
|
|
1970
|
+
move = cytoscapeLabelMove(place, typeof w === "number" ? w : 0, typeof h === "number" ? h : 0);
|
|
1971
|
+
put("labelPosition", i, cytoscapeLabelBase(place));
|
|
1972
|
+
} else {
|
|
1973
|
+
const [ax, ay] = lineEnd(ends, i, place.node[0]);
|
|
1974
|
+
move = {
|
|
1975
|
+
offset: [ax + place.offset[0], ay + place.offset[1]],
|
|
1976
|
+
shift: [halfBack(place.label[0]), halfBack(place.label[1])]
|
|
1977
|
+
};
|
|
1978
|
+
put("labelPosition", i, "center");
|
|
1979
|
+
}
|
|
1980
|
+
put("labelOffsetX", i, num6(move.offset[0]));
|
|
1981
|
+
put("labelOffsetY", i, num6(move.offset[1]));
|
|
1982
|
+
put("labelShiftX", i, move.shift[0]);
|
|
1983
|
+
put("labelShiftY", i, move.shift[1]);
|
|
1984
|
+
put("labelTextAlign", i, place.justify);
|
|
1985
|
+
}
|
|
1986
|
+
function autorotate(one, e, out, n, ends) {
|
|
1987
|
+
const on = one(AUTOROTATE_VP, rawText, "labelRotation", e);
|
|
1988
|
+
const [si, ti] = [ends?.source[e], ends?.target[e]];
|
|
1989
|
+
const [s, t] = [si === void 0 ? null : ends?.nodeAt?.[si], ti === void 0 ? null : ends?.nodeAt?.[ti]];
|
|
1990
|
+
if (String(on).toLowerCase() !== "true" || !s || !t || s[0] === t[0] && s[1] === t[1]) {
|
|
1991
|
+
return;
|
|
1992
|
+
}
|
|
1993
|
+
const a = Math.atan2(t[1] - s[1], t[0] - s[0]) * 180 / Math.PI;
|
|
1994
|
+
let upright = a;
|
|
1995
|
+
if (a > 90) {
|
|
1996
|
+
upright = a - 180;
|
|
1997
|
+
} else if (a <= -90) {
|
|
1998
|
+
upright = a + 180;
|
|
1999
|
+
}
|
|
2000
|
+
out.labelRotation ??= new Array(n).fill(null);
|
|
2001
|
+
const column = out.labelRotation;
|
|
2002
|
+
const own2 = column[e];
|
|
2003
|
+
column[e] = num6(((upright + (typeof own2 === "number" ? own2 : 0)) % 360 + 360) % 360);
|
|
2004
|
+
}
|
|
2005
|
+
function lineEnd(ends, e, side) {
|
|
2006
|
+
const [si, ti] = [ends?.source[e], ends?.target[e]];
|
|
2007
|
+
const [s, t] = [si === void 0 ? null : ends?.nodeAt?.[si], ti === void 0 ? null : ends?.nodeAt?.[ti]];
|
|
2008
|
+
if (side === 0 || s === null || s === void 0 || t === null || t === void 0) {
|
|
2009
|
+
return [0, 0];
|
|
2010
|
+
}
|
|
2011
|
+
const length = Math.hypot(t[0] - s[0], t[1] - s[1]);
|
|
2012
|
+
if (length === 0) {
|
|
2013
|
+
return [0, 0];
|
|
2014
|
+
}
|
|
2015
|
+
const [ux, uy] = [(t[0] - s[0]) / length, (t[1] - s[1]) / length];
|
|
2016
|
+
const reach = (node) => {
|
|
2017
|
+
const box = node === void 0 ? null : ends?.nodeBox?.[node];
|
|
2018
|
+
if (box === null || box === void 0) {
|
|
2019
|
+
return 0;
|
|
2020
|
+
}
|
|
2021
|
+
const [a, b] = [box[0] / 2, box[1] / 2];
|
|
2022
|
+
return a === 0 || b === 0 ? 0 : a * b / Math.hypot(b * ux, a * uy);
|
|
2023
|
+
};
|
|
2024
|
+
const from = reach(si);
|
|
2025
|
+
const to = length - reach(ti);
|
|
2026
|
+
const along = (side < 0 ? from : to) - (from + to) / 2;
|
|
2027
|
+
return [ux * along, uy * along];
|
|
2028
|
+
}
|
|
2029
|
+
const HEXAGON_ASPECT = Math.sqrt(3) / 2;
|
|
2030
|
+
function squashHexagons(out) {
|
|
2031
|
+
const { shape, height } = out;
|
|
2032
|
+
if (shape === void 0 || height === void 0 || !shape.includes("hexagon")) {
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
const border = out.borderWidth;
|
|
2036
|
+
out.height = height.map((h, i) => {
|
|
2037
|
+
if (shape[i] !== "hexagon" || typeof h !== "number") {
|
|
2038
|
+
return h;
|
|
2039
|
+
}
|
|
2040
|
+
const b = border?.[i];
|
|
2041
|
+
const w = typeof b === "number" ? Math.min(b, h) : 0;
|
|
2042
|
+
return (h - w) * HEXAGON_ASPECT + w;
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
function arrowProportions(out, column) {
|
|
2046
|
+
const size = out.arrowSize;
|
|
2047
|
+
const own2 = column("EDGE_SOURCE_ARROW_SIZE", arrowSizeParser, "sourceArrowSize").map((v) => v ?? 1);
|
|
2048
|
+
if (own2.some((v, i) => v !== (size?.[i] ?? 1))) {
|
|
2049
|
+
out.sourceArrowSize = own2;
|
|
2050
|
+
}
|
|
2051
|
+
for (const [prop, vp, side] of [
|
|
2052
|
+
["sourceArrowLength", "EDGE_SOURCE_ARROW_SHAPE", "length"],
|
|
2053
|
+
["targetArrowLength", "EDGE_TARGET_ARROW_SHAPE", "length"],
|
|
2054
|
+
["sourceArrowWidth", "EDGE_SOURCE_ARROW_SHAPE", "width"],
|
|
2055
|
+
["targetArrowWidth", "EDGE_TARGET_ARROW_SHAPE", "width"]
|
|
2056
|
+
]) {
|
|
2057
|
+
const values = column(vp, arrowProportion(side), prop).map((v) => v === 1 ? null : v);
|
|
2058
|
+
if (values.some((v) => v !== null)) {
|
|
2059
|
+
out[prop] = values;
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
for (const [prop, vp] of [
|
|
2063
|
+
["sourceArrowGap", "EDGE_SOURCE_ARROW_SHAPE"],
|
|
2064
|
+
["targetArrowGap", "EDGE_TARGET_ARROW_SHAPE"]
|
|
2065
|
+
]) {
|
|
2066
|
+
const values = column(vp, arrowGap, prop).map((v) => v === 0 ? null : v);
|
|
2067
|
+
if (values.some((v) => v !== null)) {
|
|
2068
|
+
out[prop] = values;
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
function straightenBendless(out, one, n, ends) {
|
|
2073
|
+
const curved = out.curved ?? new Array(n).fill(null);
|
|
2074
|
+
const bent = (i) => one(EDGE_BEND_VP, bendParser, "curved", i) === true;
|
|
2075
|
+
const haystack = (i) => String(one(EDGE_STACKING_VP, rawText, "fanned", i) ?? "").toUpperCase() === "HAYSTACK";
|
|
2076
|
+
const place = ends === void 0 ? /* @__PURE__ */ new Map() : fanPlaces(ends, curved.length, bent, haystack);
|
|
2077
|
+
const fanned = new Set(place.keys());
|
|
2078
|
+
const rounds = (i) => fanned.has(i) || bent(i);
|
|
2079
|
+
const rounded = curved.map((c, i) => {
|
|
2080
|
+
if (c === null) {
|
|
2081
|
+
return rounds(i) ? true : null;
|
|
2082
|
+
}
|
|
2083
|
+
return c === true || fanned.has(i) ? rounds(i) : c;
|
|
2084
|
+
});
|
|
2085
|
+
if (out.curved !== void 0 || rounded.includes(true)) {
|
|
2086
|
+
out.curved = rounded;
|
|
2087
|
+
}
|
|
2088
|
+
if (ends?.nodeSize === void 0 || fanned.size === 0) {
|
|
2089
|
+
return;
|
|
2090
|
+
}
|
|
2091
|
+
const { source, target, nodeSize } = ends;
|
|
2092
|
+
out.fanSpacing = curved.map((_, i) => {
|
|
2093
|
+
const size = Math.max(nodeSize[source[i]] ?? Number.NaN, nodeSize[target[i]] ?? Number.NaN);
|
|
2094
|
+
if (out.curved?.[i] !== true || !fanned.has(i) || bent(i) || !Number.isFinite(size)) {
|
|
2095
|
+
return null;
|
|
2096
|
+
}
|
|
2097
|
+
const read = one(EDGE_STACKING_DENSITY_VP, sizeParser, "fanSpacing", i);
|
|
2098
|
+
const density = Math.min(1, typeof read === "number" ? read : EDGE_STACKING_DENSITY_DEFAULT);
|
|
2099
|
+
return size * density;
|
|
2100
|
+
});
|
|
2101
|
+
fanAnchors(out, ends, place);
|
|
2102
|
+
}
|
|
2103
|
+
function fanPlaces(ends, count, bent, haystack) {
|
|
2104
|
+
const place = /* @__PURE__ */ new Map();
|
|
2105
|
+
const first = /* @__PURE__ */ new Map();
|
|
2106
|
+
for (const i of newestFirst(count, ends.created?.edge)) {
|
|
2107
|
+
const [s, t] = [ends.source[i], ends.target[i]];
|
|
2108
|
+
if (s === t || haystack(i)) {
|
|
2109
|
+
continue;
|
|
2110
|
+
}
|
|
2111
|
+
const key = `${Math.min(s, t)},${Math.max(s, t)}`;
|
|
2112
|
+
const f = first.get(key);
|
|
2113
|
+
if (f === void 0) {
|
|
2114
|
+
first.set(key, { f: i, k: 0 });
|
|
2115
|
+
} else if (!bent(f.f)) {
|
|
2116
|
+
f.k++;
|
|
2117
|
+
place.set(i, f.k);
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
return place;
|
|
2121
|
+
}
|
|
2122
|
+
function newestFirst(count, created) {
|
|
2123
|
+
const walk = Array.from({ length: count }, (_, i) => i);
|
|
2124
|
+
walk.sort(created === void 0 ? (a, b) => b - a : (a, b) => created[b] - created[a]);
|
|
2125
|
+
return walk;
|
|
2126
|
+
}
|
|
2127
|
+
function fanAnchors(out, ends, place) {
|
|
2128
|
+
const { created, nodeAt, source, target } = ends;
|
|
2129
|
+
const spacing = out.fanSpacing?.slice();
|
|
2130
|
+
if (created === void 0 || nodeAt === void 0 || spacing === void 0) {
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
const bends = out.bends?.slice() ?? new Array(source.length).fill(null);
|
|
2134
|
+
const bendCurve = out.bendCurve?.slice() ?? new Array(source.length).fill(null);
|
|
2135
|
+
let changed = false;
|
|
2136
|
+
for (const [i, k] of place) {
|
|
2137
|
+
const [s, t] = [source[i], target[i]];
|
|
2138
|
+
const [ps, pt, f] = [nodeAt[s], nodeAt[t], spacing[i]];
|
|
2139
|
+
if (ps === null || ps === void 0 || pt === null || pt === void 0 || typeof f !== "number") {
|
|
2140
|
+
continue;
|
|
2141
|
+
}
|
|
2142
|
+
const len = Math.hypot(pt[0] - ps[0], pt[1] - ps[1]);
|
|
2143
|
+
if (len === 0) {
|
|
2144
|
+
continue;
|
|
2145
|
+
}
|
|
2146
|
+
const sign = created.node[s] > created.node[t] ? 1 : -1;
|
|
2147
|
+
const [nx, ny] = [sign * (pt[0] - ps[0]) / len, sign * (pt[1] - ps[1]) / len];
|
|
2148
|
+
const offset = Math.ceil(k / 2) * (k % 2 === 0 ? 1 : -1) * 2 * f;
|
|
2149
|
+
const [vx, vy] = [offset * ny, -offset * nx];
|
|
2150
|
+
const across = (vx * (pt[1] - ps[1]) - vy * (pt[0] - ps[0])) / (len * len);
|
|
2151
|
+
bends[i] = `0.5,${String(Math.round(across * 1e6) / 1e6 || 0)}`;
|
|
2152
|
+
bendCurve[i] = "bezier";
|
|
2153
|
+
spacing[i] = null;
|
|
2154
|
+
changed = true;
|
|
2155
|
+
}
|
|
2156
|
+
if (changed) {
|
|
2157
|
+
out.bends = bends;
|
|
2158
|
+
out.bendCurve = bendCurve;
|
|
2159
|
+
out.fanSpacing = spacing;
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
function loopHandles(out, one, curvedAsSet, ends) {
|
|
2163
|
+
const box = ends?.nodeBox;
|
|
2164
|
+
if (ends === void 0 || box === void 0) {
|
|
2165
|
+
return;
|
|
2166
|
+
}
|
|
2167
|
+
const bends = out.bends?.slice() ?? new Array(ends.source.length).fill(null);
|
|
2168
|
+
const curved = out.curved?.slice() ?? new Array(ends.source.length).fill(null);
|
|
2169
|
+
const earlier = /* @__PURE__ */ new Map();
|
|
2170
|
+
const fraction = (v) => String(Math.round(v * 1e4) / 1e4 || 0);
|
|
2171
|
+
let changed = false;
|
|
2172
|
+
for (let i = ends.source.length - 1; i >= 0; i--) {
|
|
2173
|
+
const node = ends.source[i];
|
|
2174
|
+
const b = box[node];
|
|
2175
|
+
if (node !== ends.target[i] || bends[i] !== null) {
|
|
2176
|
+
continue;
|
|
2177
|
+
}
|
|
2178
|
+
const rank = earlier.get(node) ?? 0;
|
|
2179
|
+
earlier.set(node, rank + 1);
|
|
2180
|
+
if (b === null || b === void 0 || b[0] <= 0 || b[1] <= 0) {
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
const read = one(EDGE_STACKING_DENSITY_VP, sizeParser, "fanSpacing", i);
|
|
2184
|
+
const density = Math.min(1, typeof read === "number" ? read : EDGE_STACKING_DENSITY_DEFAULT);
|
|
2185
|
+
const reach = (rank + 3) * (Math.max(b[0], b[1]) + b[2]) / 2 * 2 * density;
|
|
2186
|
+
bends[i] = `${fraction(-reach / (b[0] / 2))},0 0,${fraction(reach / (b[1] / 2))}`;
|
|
2187
|
+
curved[i] = curvedAsSet?.[i] !== false;
|
|
2188
|
+
changed = true;
|
|
2189
|
+
}
|
|
2190
|
+
if (changed) {
|
|
2191
|
+
out.bends = bends;
|
|
2192
|
+
out.curved = curved;
|
|
1329
2193
|
}
|
|
1330
2194
|
}
|
|
1331
2195
|
const EDGE_BEND_VP = "EDGE_BEND";
|
|
@@ -1336,6 +2200,26 @@ const bendParser = (raw) => {
|
|
|
1336
2200
|
}
|
|
1337
2201
|
return Array.isArray(raw) ? raw.length > 0 : raw !== null && raw !== void 0 && typeof raw === "object";
|
|
1338
2202
|
};
|
|
2203
|
+
const bendsParser = (input, site) => {
|
|
2204
|
+
const raw = Array.isArray(input) ? input.map((h) => {
|
|
2205
|
+
const o = h ?? {};
|
|
2206
|
+
return `${Number(o.sin)},${Number(o.cos)},${Number(o.ratio)}`;
|
|
2207
|
+
}).join("|") : input;
|
|
2208
|
+
if (typeof raw !== "string" || !bendParser(raw)) {
|
|
2209
|
+
return null;
|
|
2210
|
+
}
|
|
2211
|
+
const points = [];
|
|
2212
|
+
for (const handle of raw.trim().split("|")) {
|
|
2213
|
+
const [c, sin, ratio] = handle.split(",").map((t) => Number(t.trim()));
|
|
2214
|
+
if (![c, sin, ratio].every((v) => Number.isFinite(v))) {
|
|
2215
|
+
noteAt(site, STYLE_ISSUE.BAD_VALUE, raw.slice(0, 64));
|
|
2216
|
+
return null;
|
|
2217
|
+
}
|
|
2218
|
+
const fraction = (v) => String(Math.round(v * 1e4) / 1e4 || 0);
|
|
2219
|
+
points.push(`${fraction(ratio * c)},${fraction(-ratio * sin)}`);
|
|
2220
|
+
}
|
|
2221
|
+
return points.join(" ");
|
|
2222
|
+
};
|
|
1339
2223
|
const INERT_DEFAULT = /NullCustomGraphics|^255$|^0(?:\.0+)?$|^$|^C,C,c,0\.00,0\.00$|^false$/;
|
|
1340
2224
|
function noteUncarried(target, s, used, bypassed, notes) {
|
|
1341
2225
|
for (const vp of used) {
|
|
@@ -1379,7 +2263,15 @@ function cytoscapeBackground(style, notes) {
|
|
|
1379
2263
|
function resolveCytoscapeBypasses(target, maps, options = {}) {
|
|
1380
2264
|
const notes = options.notes ?? new StyleNotes();
|
|
1381
2265
|
const style = emptyCytoscapeStyle();
|
|
1382
|
-
const elements = {
|
|
2266
|
+
const elements = {
|
|
2267
|
+
count: maps.length,
|
|
2268
|
+
value: options.value ?? (() => null),
|
|
2269
|
+
// Cytoscape 3.10.5 draws an XGMML edge's EDGE_LABEL_AUTOROTATE true level, where it turns the same edge read
|
|
2270
|
+
// from CX, CX2 or a session along its line (the label-autorotate-true edge of the edge-labels and
|
|
2271
|
+
// mappings-bypass-p13 sheets in its SVG): its XGMML reader does not apply it, so neither does graph-io
|
|
2272
|
+
bypasses: maps.map((m) => m?.has(AUTOROTATE_VP) === true ? withoutKey(m, AUTOROTATE_VP) : m),
|
|
2273
|
+
ends: options.ends
|
|
2274
|
+
};
|
|
1383
2275
|
const out = resolveCytoscape(target, style, elements, { notes, budget: options.budget });
|
|
1384
2276
|
if (target === "node" && out.width === void 0) {
|
|
1385
2277
|
const size = maps.map((m) => {
|
|
@@ -1770,8 +2662,13 @@ function readXgmmlStyles(snapshot, context, settings) {
|
|
|
1770
2662
|
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1771
2663
|
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1772
2664
|
const maps = graphicsBypasses(table, target, n, notes);
|
|
1773
|
-
const values = maps.some((m) => m !== null) ? resolveCytoscapeBypasses(target, maps, {
|
|
1774
|
-
|
|
2665
|
+
const values = maps.some((m) => m !== null) ? resolveCytoscapeBypasses(target, maps, {
|
|
2666
|
+
notes,
|
|
2667
|
+
budget: context.budget,
|
|
2668
|
+
value: (column, i) => table.has(column) ? plainCell(table.value(column, i)) : null,
|
|
2669
|
+
...target === "edge" ? { ends: edgeEnds(snapshot, out.node.values) } : {}
|
|
2670
|
+
}) : {};
|
|
2671
|
+
drawnAsDesktop(snapshot, target, out.node.values, values, settings);
|
|
1775
2672
|
exactFromBlock(snapshot, target, values);
|
|
1776
2673
|
out[target] = { values: nonEmpty(values) };
|
|
1777
2674
|
}
|
|
@@ -1786,56 +2683,111 @@ function readXgmmlStyles(snapshot, context, settings) {
|
|
|
1786
2683
|
notes: notes.list()
|
|
1787
2684
|
};
|
|
1788
2685
|
}
|
|
1789
|
-
function
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
return;
|
|
2686
|
+
function drawnAsDesktop(snapshot, target, nodes, values, settings) {
|
|
2687
|
+
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
2688
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2689
|
+
const desktop = settings.tool === "cytoscape";
|
|
2690
|
+
if (target === "edge" && desktop) {
|
|
2691
|
+
bendsAtOrigin(snapshot, values);
|
|
1796
2692
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
if (
|
|
2693
|
+
hiddenToVisible(table, settings.hiddenColumn ?? null, n, values);
|
|
2694
|
+
hideWhatCytoscapeHides(snapshot, target, nodes, values);
|
|
2695
|
+
if (target === "node") {
|
|
2696
|
+
if (desktop && values.label === void 0 && !snapshot.graph.has(STYLE_BLOCK_NAME)) {
|
|
2697
|
+
nameLabels(table, n, values);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
function bendsAtOrigin(snapshot, values) {
|
|
2702
|
+
const { bends } = values;
|
|
2703
|
+
const position = snapshot.nodes.byRole("position");
|
|
2704
|
+
if (bends === void 0 || position === null) {
|
|
1800
2705
|
return;
|
|
1801
2706
|
}
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
let held = want.get(property);
|
|
1806
|
-
if (held === void 0) {
|
|
1807
|
-
held = resolveStyles(ex, target, property, snapshot);
|
|
1808
|
-
want.set(property, held);
|
|
1809
|
-
}
|
|
1810
|
-
return held;
|
|
2707
|
+
const center = (i) => {
|
|
2708
|
+
const v = position.isSet(i) ? position.value(i) : null;
|
|
2709
|
+
return v === null ? null : [v[0], v[1]];
|
|
1811
2710
|
};
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
dialect,
|
|
1818
|
-
() => void 0
|
|
1819
|
-
)
|
|
1820
|
-
);
|
|
1821
|
-
const readBack = resolveCytoscapeBypasses(target, written, { notes: new StyleNotes() });
|
|
1822
|
-
for (const [property, native] of Object.entries(values)) {
|
|
1823
|
-
const back = readBack[property];
|
|
1824
|
-
if (native !== void 0 && back !== void 0) {
|
|
1825
|
-
values[property] = withBlockValues(native, back, exact(property));
|
|
2711
|
+
const { src, dst } = snapshot.edgeList();
|
|
2712
|
+
values.bends = bends.map((v, e) => {
|
|
2713
|
+
const [s, t] = [center(src[e]), center(dst[e])];
|
|
2714
|
+
if (typeof v !== "string" || s === null || t === null) {
|
|
2715
|
+
return v;
|
|
1826
2716
|
}
|
|
2717
|
+
const handles = v.trim().split(/\s+/).length;
|
|
2718
|
+
return canonBends(
|
|
2719
|
+
s,
|
|
2720
|
+
t,
|
|
2721
|
+
Array.from({ length: handles }, () => [0, 0]),
|
|
2722
|
+
false
|
|
2723
|
+
) ?? v;
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
function nameLabels(table, n, values) {
|
|
2727
|
+
const label = table.byRole("label")?.meta.name ?? null;
|
|
2728
|
+
const text = (column, i) => {
|
|
2729
|
+
const v = column !== null && table.has(column) ? plainCell(table.value(column, i)) : null;
|
|
2730
|
+
return typeof v === "string" || typeof v === "number" ? String(v) : null;
|
|
2731
|
+
};
|
|
2732
|
+
const labels = Array.from({ length: n }, (_v, i) => text("name", i) ?? text(label, i));
|
|
2733
|
+
if (labels.some((v) => v !== null)) {
|
|
2734
|
+
values.label = labels;
|
|
1827
2735
|
}
|
|
1828
2736
|
}
|
|
1829
|
-
function
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2737
|
+
function readXgmmlFileStyles(snapshot, context) {
|
|
2738
|
+
return readXgmmlStyles(snapshot, context, { tool: "cytoscape" });
|
|
2739
|
+
}
|
|
2740
|
+
function exactFromBlock(snapshot, target, values, dialect = "desktop", created) {
|
|
2741
|
+
const text = snapshot.graph.has(STYLE_BLOCK_NAME) ? plainCell(snapshot.graph.value(STYLE_BLOCK_NAME, 0)) : null;
|
|
2742
|
+
if (typeof text !== "string") {
|
|
2743
|
+
return;
|
|
1836
2744
|
}
|
|
1837
|
-
|
|
2745
|
+
takeFromBlock(snapshot, text, "xgmml", (t, block) => {
|
|
2746
|
+
if (t !== target) {
|
|
2747
|
+
return null;
|
|
2748
|
+
}
|
|
2749
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
2750
|
+
const written = Array.from(
|
|
2751
|
+
{ length: n },
|
|
2752
|
+
(_v, i) => cytoscapeElementProperties(
|
|
2753
|
+
target,
|
|
2754
|
+
(property) => block(target, property)[i] ?? null,
|
|
2755
|
+
dialect,
|
|
2756
|
+
() => void 0
|
|
2757
|
+
)
|
|
2758
|
+
);
|
|
2759
|
+
const ends = target === "edge" ? {
|
|
2760
|
+
ends: {
|
|
2761
|
+
...edgeEnds(snapshot, {
|
|
2762
|
+
width: block("node", "width"),
|
|
2763
|
+
height: block("node", "height"),
|
|
2764
|
+
borderWidth: block("node", "borderWidth")
|
|
2765
|
+
}),
|
|
2766
|
+
...created === void 0 ? {} : { created }
|
|
2767
|
+
}
|
|
2768
|
+
} : {};
|
|
2769
|
+
const readBack = resolveCytoscapeBypasses(target, written, { notes: new StyleNotes(), ...ends });
|
|
2770
|
+
return {
|
|
2771
|
+
values,
|
|
2772
|
+
properties: Object.keys(values).filter((p) => values[p] !== void 0 && readBack[p] !== void 0),
|
|
2773
|
+
readBack: (i) => (property) => readBack[property]?.[i] ?? null,
|
|
2774
|
+
// a fan spacing, a curve or a loop's handles only desktop's fanning and looping give (graphty wrote none:
|
|
2775
|
+
// EDGE_CURVED defaults to true there) is graphty's own default again, and so is a label's place beside its
|
|
2776
|
+
// node, which desktop's anchors spell as an offset and a shift
|
|
2777
|
+
take: (property, wanted) => wanted !== null || BLOCK_DEFAULTED.has(property)
|
|
2778
|
+
};
|
|
2779
|
+
});
|
|
1838
2780
|
}
|
|
2781
|
+
const BLOCK_DEFAULTED = /* @__PURE__ */ new Set([
|
|
2782
|
+
"fanSpacing",
|
|
2783
|
+
"curved",
|
|
2784
|
+
"bends",
|
|
2785
|
+
"bendCurve",
|
|
2786
|
+
"labelOffsetX",
|
|
2787
|
+
"labelOffsetY",
|
|
2788
|
+
"labelShiftX",
|
|
2789
|
+
"labelShiftY"
|
|
2790
|
+
]);
|
|
1839
2791
|
function hiddenToVisible(table, column, n, values) {
|
|
1840
2792
|
if (column === null || !table.has(column)) {
|
|
1841
2793
|
return;
|
|
@@ -1851,6 +2803,82 @@ function hiddenToVisible(table, column, n, values) {
|
|
|
1851
2803
|
values.visible = visible;
|
|
1852
2804
|
}
|
|
1853
2805
|
}
|
|
2806
|
+
function hideGroupsCytoscapeHides(snapshot, values) {
|
|
2807
|
+
const parent = snapshot.nodes.byRole("parent");
|
|
2808
|
+
if (parent === null || snapshot.graph.has(STYLE_BLOCK_NAME)) {
|
|
2809
|
+
return;
|
|
2810
|
+
}
|
|
2811
|
+
const n = snapshot.nodeCount;
|
|
2812
|
+
const members = membersOf(parent, n);
|
|
2813
|
+
if (members.size === 0) {
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2816
|
+
const network = snapshot.meta.extra?.xgmml?.graphId;
|
|
2817
|
+
const visible = values.visible === void 0 ? new Array(n).fill(null) : [...values.visible];
|
|
2818
|
+
for (const [group, inside] of members) {
|
|
2819
|
+
if (!collapsedIn(snapshot, group, network)) {
|
|
2820
|
+
visible[group] = false;
|
|
2821
|
+
continue;
|
|
2822
|
+
}
|
|
2823
|
+
for (const i of insideAtAnyDepth(group, inside, members)) {
|
|
2824
|
+
visible[i] = false;
|
|
2825
|
+
}
|
|
2826
|
+
}
|
|
2827
|
+
values.visible = visible;
|
|
2828
|
+
}
|
|
2829
|
+
function hideWhatCytoscapeHides(snapshot, target, nodes, values) {
|
|
2830
|
+
if (target === "node") {
|
|
2831
|
+
hideGroupsCytoscapeHides(snapshot, values);
|
|
2832
|
+
} else {
|
|
2833
|
+
hideEdgesOfHiddenNodes(snapshot, nodes, values);
|
|
2834
|
+
}
|
|
2835
|
+
}
|
|
2836
|
+
function hideEdgesOfHiddenNodes(snapshot, nodes, values) {
|
|
2837
|
+
const shown = nodes.visible;
|
|
2838
|
+
if (shown === void 0 || !shown.includes(false) || snapshot.graph.has(STYLE_BLOCK_NAME)) {
|
|
2839
|
+
return;
|
|
2840
|
+
}
|
|
2841
|
+
const { src, dst } = snapshot.edgeList();
|
|
2842
|
+
const visible = values.visible === void 0 ? new Array(src.length).fill(null) : [...values.visible];
|
|
2843
|
+
for (let e = 0; e < src.length; e++) {
|
|
2844
|
+
if (shown[src[e]] === false || shown[dst[e]] === false) {
|
|
2845
|
+
visible[e] = false;
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
values.visible = visible;
|
|
2849
|
+
}
|
|
2850
|
+
function membersOf(parent, n) {
|
|
2851
|
+
const members = /* @__PURE__ */ new Map();
|
|
2852
|
+
for (let i = 0; i < n; i++) {
|
|
2853
|
+
const g = parent.isSet(i) ? plainCell(parent.value(i)) : null;
|
|
2854
|
+
if (typeof g === "number" && g !== i) {
|
|
2855
|
+
members.set(g, [...members.get(g) ?? [], i]);
|
|
2856
|
+
}
|
|
2857
|
+
}
|
|
2858
|
+
return members;
|
|
2859
|
+
}
|
|
2860
|
+
function insideAtAnyDepth(group, inside, members) {
|
|
2861
|
+
const stack = [...inside];
|
|
2862
|
+
const seen = /* @__PURE__ */ new Set([group]);
|
|
2863
|
+
const out = /* @__PURE__ */ new Set();
|
|
2864
|
+
for (let i = stack.pop(); i !== void 0; i = stack.pop()) {
|
|
2865
|
+
if (!seen.has(i)) {
|
|
2866
|
+
seen.add(i);
|
|
2867
|
+
out.add(i);
|
|
2868
|
+
stack.push(...members.get(i) ?? []);
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
return out;
|
|
2872
|
+
}
|
|
2873
|
+
function collapsedIn(snapshot, group, network) {
|
|
2874
|
+
if (typeof network !== "string" || !snapshot.nodes.has(SUBGRAPH_COLUMN)) {
|
|
2875
|
+
return false;
|
|
2876
|
+
}
|
|
2877
|
+
const sub = plainCell(snapshot.nodes.value(SUBGRAPH_COLUMN, group));
|
|
2878
|
+
const atts = sub !== null && typeof sub === "object" ? sub.atts : null;
|
|
2879
|
+
const collapsed = atts !== null && typeof atts === "object" ? atts["__groupCollapsed.SUID"] : null;
|
|
2880
|
+
return Array.isArray(collapsed) && collapsed.some((v) => String(v) === network);
|
|
2881
|
+
}
|
|
1854
2882
|
function nonEmpty(values) {
|
|
1855
2883
|
const out = {};
|
|
1856
2884
|
for (const [p, col] of Object.entries(values)) {
|
|
@@ -1860,21 +2888,28 @@ function nonEmpty(values) {
|
|
|
1860
2888
|
}
|
|
1861
2889
|
return out;
|
|
1862
2890
|
}
|
|
1863
|
-
function graphStyleOf(snapshot, notes) {
|
|
1864
|
-
const
|
|
1865
|
-
const
|
|
1866
|
-
|
|
1867
|
-
return {};
|
|
2891
|
+
function graphStyleOf(snapshot, notes, style) {
|
|
2892
|
+
const merged = emptyCytoscapeStyle();
|
|
2893
|
+
for (const [k, v] of style?.network.defaults ?? []) {
|
|
2894
|
+
merged.network.defaults.set(k, v);
|
|
1868
2895
|
}
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
if (k.startsWith("NETWORK_")) {
|
|
1872
|
-
style.network.defaults.set(k, v);
|
|
1873
|
-
}
|
|
2896
|
+
for (const [k, v] of networkBypasses(snapshot, notes)) {
|
|
2897
|
+
merged.network.defaults.set(k, v);
|
|
1874
2898
|
}
|
|
1875
|
-
const background = cytoscapeBackground(
|
|
2899
|
+
const background = cytoscapeBackground(merged, notes);
|
|
1876
2900
|
return background === null ? {} : { background };
|
|
1877
2901
|
}
|
|
2902
|
+
function networkBypasses(snapshot, notes) {
|
|
2903
|
+
const name = graphicsColumnOf(snapshot.graph);
|
|
2904
|
+
const g = name === null ? null : plainCell(snapshot.graph.value(name, 0));
|
|
2905
|
+
if (g === null || typeof g !== "object" || Array.isArray(g)) {
|
|
2906
|
+
return [];
|
|
2907
|
+
}
|
|
2908
|
+
const locked = Object.hasOwn(g, "lockedVisualProperties") ? g.lockedVisualProperties : void 0;
|
|
2909
|
+
return [g, locked].flatMap(
|
|
2910
|
+
(layer) => [...normalizeVisualProperties("node", layer, notes)].filter(([k]) => k.startsWith("NETWORK_"))
|
|
2911
|
+
);
|
|
2912
|
+
}
|
|
1878
2913
|
const XGMML_STYLE_CAPABILITIES = Object.freeze({
|
|
1879
2914
|
tool: "cytoscape",
|
|
1880
2915
|
node: Object.freeze(cytoscapeWritableProperties("node", "desktop")),
|
|
@@ -1977,27 +3012,83 @@ function bypassesOf(table, n, namespace) {
|
|
|
1977
3012
|
}
|
|
1978
3013
|
return { maps, names: columns.map((c) => c.meta.name) };
|
|
1979
3014
|
}
|
|
1980
|
-
function
|
|
3015
|
+
function fitMappingsToColumns(style, target, table, read) {
|
|
3016
|
+
const { notes } = read;
|
|
3017
|
+
sharedColumnFallback(style[target], (column) => table.has(column));
|
|
3018
|
+
if (target === "edge") {
|
|
3019
|
+
weightColumnFallback(style.edge, read.weightFrom, table);
|
|
3020
|
+
}
|
|
3021
|
+
if (read.dialect !== "cx2") {
|
|
3022
|
+
dropMismatchedKeys(style[target], (column) => table.get(column)?.meta.origin?.type ?? null, notes, target);
|
|
3023
|
+
}
|
|
3024
|
+
for (const m of style[target].mappings.values()) {
|
|
3025
|
+
if (!table.has(m.column) && !(target === "edge" && read.weights !== null && m.column === read.weightFrom)) {
|
|
3026
|
+
notes.add(STYLE_ISSUE.MAPPING_COLUMN_MISSING, target, m.column, { sample: m.kind });
|
|
3027
|
+
}
|
|
3028
|
+
}
|
|
3029
|
+
}
|
|
3030
|
+
function keptWeights(snapshot, weightFrom) {
|
|
3031
|
+
if (weightFrom === null || snapshot.edges.has(weightFrom) || snapshot.edges.byRole("weight") !== null) {
|
|
3032
|
+
return null;
|
|
3033
|
+
}
|
|
3034
|
+
const weights = explicitWeights(snapshot);
|
|
3035
|
+
return weights.weighted ? weights : null;
|
|
3036
|
+
}
|
|
3037
|
+
function javaHashOrder(ids) {
|
|
3038
|
+
const keys = ids.map((k) => typeof k === "string" && /^\d{1,15}$/.test(k) ? Number(k) : k);
|
|
3039
|
+
if (!keys.every((k) => typeof k === "number" && Number.isSafeInteger(k) && k >= 0)) {
|
|
3040
|
+
return null;
|
|
3041
|
+
}
|
|
3042
|
+
let capacity = 16;
|
|
3043
|
+
while (keys.length > 0.75 * capacity) {
|
|
3044
|
+
capacity *= 2;
|
|
3045
|
+
}
|
|
3046
|
+
const bucket = (k) => {
|
|
3047
|
+
const h = (k % 2 ** 32 ^ Math.floor(k / 2 ** 32)) >>> 0;
|
|
3048
|
+
return (h ^ h >>> 16) & capacity - 1;
|
|
3049
|
+
};
|
|
3050
|
+
const order = keys.map((_, i) => i).sort((a, b) => bucket(keys[a]) - bucket(keys[b]) || a - b);
|
|
3051
|
+
const rank = new Array(keys.length);
|
|
3052
|
+
order.forEach((i, r) => {
|
|
3053
|
+
rank[i] = r;
|
|
3054
|
+
});
|
|
3055
|
+
return rank;
|
|
3056
|
+
}
|
|
3057
|
+
function hashCreationOrder(snapshot) {
|
|
3058
|
+
const ids = snapshot.edges.byRole("id");
|
|
3059
|
+
if (ids === null) {
|
|
3060
|
+
return null;
|
|
3061
|
+
}
|
|
3062
|
+
const node = javaHashOrder(Array.from({ length: snapshot.nodeCount }, (_, i) => snapshot.ids.idOf(i)));
|
|
3063
|
+
const edge = javaHashOrder(Array.from({ length: snapshot.edgeCount }, (_, i) => ids.value(i)));
|
|
3064
|
+
return node === null || edge === null ? null : { node, edge };
|
|
3065
|
+
}
|
|
3066
|
+
function readDeclaredStyles(snapshot, context, style, namespace, notes, dialect = "desktop", read = {}) {
|
|
3067
|
+
const weightFrom = read.weightFrom ?? null;
|
|
3068
|
+
const created = read.hashOrder === true ? hashCreationOrder(snapshot) ?? void 0 : void 0;
|
|
1981
3069
|
const out = { node: { values: {} }, edge: { values: {} } };
|
|
1982
3070
|
const readFrom = { node: [], edge: [] };
|
|
1983
3071
|
for (const target of ["node", "edge"]) {
|
|
1984
3072
|
context.signal?.throwIfAborted();
|
|
1985
3073
|
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1986
3074
|
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
notes.add(STYLE_ISSUE.MAPPING_COLUMN_MISSING, target, m.column, { sample: m.kind });
|
|
1990
|
-
}
|
|
1991
|
-
}
|
|
3075
|
+
const weights = target === "edge" ? keptWeights(snapshot, weightFrom) : null;
|
|
3076
|
+
fitMappingsToColumns(style, target, table, { notes, dialect, weightFrom, weights });
|
|
1992
3077
|
const { maps, names } = bypassesOf(table, n, namespace);
|
|
1993
3078
|
readFrom[target] = names;
|
|
1994
3079
|
const elements = {
|
|
1995
3080
|
count: n,
|
|
1996
|
-
value: (column, i) =>
|
|
1997
|
-
|
|
3081
|
+
value: (column, i) => {
|
|
3082
|
+
if (weights !== null && column === weightFrom) {
|
|
3083
|
+
return weights.isExplicit(i) ? weights.value(i) : null;
|
|
3084
|
+
}
|
|
3085
|
+
return table.has(column) ? plainCell(table.value(column, i)) : null;
|
|
3086
|
+
},
|
|
3087
|
+
bypasses: maps,
|
|
3088
|
+
...target === "edge" ? { ends: { ...edgeEnds(snapshot, out.node.values), ...created === void 0 ? {} : { created } } } : {}
|
|
1998
3089
|
};
|
|
1999
3090
|
const values = resolveCytoscape(target, style, elements, { notes, budget: context.budget });
|
|
2000
|
-
exactFromBlock(snapshot, target, values, dialect);
|
|
3091
|
+
exactFromBlock(snapshot, target, values, dialect, created);
|
|
2001
3092
|
const { rules, columns } = cytoscapeRules(target, style, elements, { notes, budget: context.budget });
|
|
2002
3093
|
out[target] = { values: nonEmpty(values), rules, columns };
|
|
2003
3094
|
}
|
|
@@ -2025,7 +3116,10 @@ function readCxStyles(snapshot, context) {
|
|
|
2025
3116
|
count: otherViews
|
|
2026
3117
|
});
|
|
2027
3118
|
}
|
|
2028
|
-
return readDeclaredStyles(snapshot, context, style, "cx.bypass", notes
|
|
3119
|
+
return readDeclaredStyles(snapshot, context, style, "cx.bypass", notes, "desktop", {
|
|
3120
|
+
weightFrom: kept?.weightFrom ?? null,
|
|
3121
|
+
hashOrder: kept?.collection !== true
|
|
3122
|
+
});
|
|
2029
3123
|
}
|
|
2030
3124
|
function cytoscapeWriteCapabilities(dialect) {
|
|
2031
3125
|
return Object.freeze({
|
|
@@ -2079,6 +3173,7 @@ function withMappedColumns(snapshot, styled) {
|
|
|
2079
3173
|
return out;
|
|
2080
3174
|
}
|
|
2081
3175
|
export {
|
|
3176
|
+
exactFromBlock as $,
|
|
2082
3177
|
EXTENSIONS as A,
|
|
2083
3178
|
emitCytoscapeStyle as B,
|
|
2084
3179
|
CX_STYLE_CAPABILITIES as C,
|
|
@@ -2089,23 +3184,27 @@ export {
|
|
|
2089
3184
|
cytoscapeVizmapXml as H,
|
|
2090
3185
|
INTERACTION_COLUMN as I,
|
|
2091
3186
|
readXgmmlStyles as J,
|
|
2092
|
-
|
|
3187
|
+
weightColumnFallback as K,
|
|
2093
3188
|
LABEL_COLUMN as L,
|
|
2094
3189
|
META_KEY as M,
|
|
2095
3190
|
NESTED_NETWORK_COLUMN as N,
|
|
2096
|
-
|
|
3191
|
+
graphStyleOf as O,
|
|
2097
3192
|
POSITION_COLUMN as P,
|
|
2098
|
-
|
|
2099
|
-
|
|
3193
|
+
emptyCytoscapeStyle as Q,
|
|
3194
|
+
sharedColumnFallback as R,
|
|
2100
3195
|
SUBGRAPH_COLUMN as S,
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
3196
|
+
dropMismatchedKeys as T,
|
|
3197
|
+
edgeEnds as U,
|
|
3198
|
+
graphicsBypasses as V,
|
|
3199
|
+
resolveCytoscape as W,
|
|
2105
3200
|
XGMML_ISSUE as X,
|
|
2106
|
-
|
|
3201
|
+
hiddenToVisible as Y,
|
|
2107
3202
|
Z_COLUMN as Z,
|
|
3203
|
+
hideWhatCytoscapeHides as _,
|
|
2108
3204
|
XGMML_LOSS as a,
|
|
3205
|
+
cytoscapeRules as a0,
|
|
3206
|
+
nonEmpty as a1,
|
|
3207
|
+
typedKey as a2,
|
|
2109
3208
|
blockAspect as b,
|
|
2110
3209
|
cytoscapeStyledExport as c,
|
|
2111
3210
|
cytoscapeCxAspect as d,
|
|
@@ -2132,4 +3231,4 @@ export {
|
|
|
2132
3231
|
readXgmmlFileStyles as y,
|
|
2133
3232
|
MIME_TYPES as z
|
|
2134
3233
|
};
|
|
2135
|
-
//# sourceMappingURL=styles-
|
|
3234
|
+
//# sourceMappingURL=styles-CAVmBLgp.js.map
|