@graphty/graph-io 0.3.43 → 0.3.44
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-3Q4TsdTh.js +40 -0
- package/dist/chunks/approximations-3Q4TsdTh.js.map +1 -0
- package/dist/chunks/block-JQiwViEt.js +2777 -0
- package/dist/chunks/block-JQiwViEt.js.map +1 -0
- package/dist/chunks/{choose-DvpbdRuz.js → choose-BemygfH8.js} +3 -2
- package/dist/chunks/{choose-DvpbdRuz.js.map → choose-BemygfH8.js.map} +1 -1
- package/dist/chunks/{constants-fT3E8JYY.js → constants-BFUR_CtU.js} +6 -2
- package/dist/chunks/constants-BFUR_CtU.js.map +1 -0
- package/dist/chunks/convert-BcQ8_jMo.js +59 -0
- package/dist/chunks/convert-BcQ8_jMo.js.map +1 -0
- package/dist/chunks/emit-DCwFLts5.js +3456 -0
- package/dist/chunks/emit-DCwFLts5.js.map +1 -0
- package/dist/chunks/{escape-B62ZGM_a.js → escape-B1rMftd9.js} +43 -20
- package/dist/chunks/escape-B1rMftd9.js.map +1 -0
- package/dist/chunks/{export-rKLeGQMo.js → export-D7IGzTG4.js} +196 -792
- package/dist/chunks/export-D7IGzTG4.js.map +1 -0
- package/dist/chunks/{exporter-BWwEuOPT.js → exporter-BtnqYuuj.js} +22 -12
- package/dist/chunks/exporter-BtnqYuuj.js.map +1 -0
- package/dist/chunks/{exporter-yLxKBvLE.js → exporter-ChPyhBOv.js} +4 -3
- package/dist/chunks/{exporter-yLxKBvLE.js.map → exporter-ChPyhBOv.js.map} +1 -1
- package/dist/chunks/{exporter-8hLNemFk.js → exporter-KEPxYUXD.js} +133 -74
- package/dist/chunks/exporter-KEPxYUXD.js.map +1 -0
- package/dist/chunks/{exporter-RVtXVetw.js → exporter-quPUCBiC.js} +1805 -287
- package/dist/chunks/exporter-quPUCBiC.js.map +1 -0
- package/dist/chunks/format-GDmO6m6Q.js +676 -0
- package/dist/chunks/format-GDmO6m6Q.js.map +1 -0
- package/dist/chunks/generic-BL06jrJf.js +1347 -0
- package/dist/chunks/generic-BL06jrJf.js.map +1 -0
- package/dist/chunks/{importer-WrGRZb0N.js → importer-B7r2owVf.js} +449 -102
- package/dist/chunks/importer-B7r2owVf.js.map +1 -0
- package/dist/chunks/{importer-Ht7LNg8L.js → importer-BFmOP96W.js} +116 -296
- package/dist/chunks/importer-BFmOP96W.js.map +1 -0
- package/dist/chunks/{importer-BbNb7eNg.js → importer-C2nzGhdV.js} +1390 -129
- package/dist/chunks/importer-C2nzGhdV.js.map +1 -0
- package/dist/chunks/{importer-Dz7tI8Sa.js → importer-CbX2_rNF.js} +617 -115
- package/dist/chunks/importer-CbX2_rNF.js.map +1 -0
- package/dist/chunks/{importer-D794XUTe.js → importer-CdzeN6X4.js} +31 -8
- package/dist/chunks/importer-CdzeN6X4.js.map +1 -0
- package/dist/chunks/{importer-xZ-3suY1.js → importer-ChKNC_GN.js} +791 -135
- package/dist/chunks/importer-ChKNC_GN.js.map +1 -0
- package/dist/chunks/{importer-C98dpSH4.js → importer-dwoYpSqb.js} +141 -82
- package/dist/chunks/importer-dwoYpSqb.js.map +1 -0
- package/dist/chunks/index-B9fdNpTA.js +4310 -0
- package/dist/chunks/index-B9fdNpTA.js.map +1 -0
- package/dist/chunks/{json-elements-DKSqpNW1.js → json-elements-C4FwgnH5.js} +123 -32
- package/dist/chunks/json-elements-C4FwgnH5.js.map +1 -0
- package/dist/chunks/lexicon-B-knUi-l.js +508 -0
- package/dist/chunks/lexicon-B-knUi-l.js.map +1 -0
- package/dist/chunks/{ontology-export-CtRXjg_i.js → ontology-export-BSpbY5FL.js} +3 -2
- package/dist/chunks/{ontology-export-CtRXjg_i.js.map → ontology-export-BSpbY5FL.js.map} +1 -1
- package/dist/chunks/{records-Cu4bxYOm.js → records-Nwz_rbNt.js} +2 -2
- package/dist/chunks/{records-Cu4bxYOm.js.map → records-Nwz_rbNt.js.map} +1 -1
- package/dist/chunks/styles-Brt9JMfs.js +690 -0
- package/dist/chunks/styles-Brt9JMfs.js.map +1 -0
- package/dist/chunks/styles-_N-C8S-U.js +2102 -0
- package/dist/chunks/styles-_N-C8S-U.js.map +1 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js +842 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js.map +1 -0
- package/dist/chunks/{text-DHOJXnED.js → text-CgzMqHQb.js} +2 -2
- package/dist/chunks/{text-DHOJXnED.js.map → text-CgzMqHQb.js.map} +1 -1
- package/dist/chunks/units-XMZFIFe1.js +19 -0
- package/dist/chunks/units-XMZFIFe1.js.map +1 -0
- package/dist/csv.js +5 -4
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -2
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +292 -412
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +8 -3031
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +354 -240
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +4 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -3
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +4 -2
- package/dist/positions.d.ts +1 -0
- package/dist/positions.js +427 -0
- package/dist/positions.js.map +1 -0
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +4 -2
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +10 -0
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +123 -100
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +8 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +12 -9
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +160 -37
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/notes.d.ts +42 -0
- package/dist/src/common/notes.d.ts.map +1 -0
- package/dist/src/common/notes.js +72 -0
- package/dist/src/common/notes.js.map +1 -0
- package/dist/src/common/report.d.ts +18 -0
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +36 -1
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/units.d.ts +24 -0
- package/dist/src/common/units.d.ts.map +1 -0
- package/dist/src/common/units.js +26 -0
- package/dist/src/common/units.js.map +1 -0
- package/dist/src/common/xml.d.ts +18 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +42 -5
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +6 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx/exporter.js +71 -8
- package/dist/src/formats/cx/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts +5 -2
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +102 -72
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +102 -0
- package/dist/src/formats/cx/styles.d.ts.map +1 -0
- package/dist/src/formats/cx/styles.js +225 -0
- package/dist/src/formats/cx/styles.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +5 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +181 -71
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +4 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +19 -1
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts +18 -0
- package/dist/src/formats/cx2/styles.d.ts.map +1 -0
- package/dist/src/formats/cx2/styles.js +24 -0
- package/dist/src/formats/cx2/styles.js.map +1 -0
- package/dist/src/formats/cys/constants.d.ts +2 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +2 -0
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +6 -2
- package/dist/src/formats/cys/exporter.d.ts.map +1 -1
- package/dist/src/formats/cys/exporter.js +215 -53
- package/dist/src/formats/cys/exporter.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts +2 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +119 -6
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +2 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +5 -0
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +38 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -0
- package/dist/src/formats/cys/styles.js +213 -0
- package/dist/src/formats/cys/styles.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +8 -3
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +88 -34
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +2 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +195 -81
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +100 -20
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +1 -0
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +1 -0
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/positions.d.ts +14 -0
- package/dist/src/formats/dot/positions.d.ts.map +1 -0
- package/dist/src/formats/dot/positions.js +70 -0
- package/dist/src/formats/dot/positions.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +82 -0
- package/dist/src/formats/dot/styles.d.ts.map +1 -0
- package/dist/src/formats/dot/styles.js +1484 -0
- package/dist/src/formats/dot/styles.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +20 -5
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +8 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +251 -131
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +8 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +10 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +5 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +5 -0
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +74 -0
- package/dist/src/formats/gexf/styles.d.ts.map +1 -0
- package/dist/src/formats/gexf/styles.js +604 -0
- package/dist/src/formats/gexf/styles.js.map +1 -0
- package/dist/src/formats/gml/exporter.d.ts +1 -5
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +19 -8
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +4 -0
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +2 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +2 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +14 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -0
- package/dist/src/formats/gml/positions.js +46 -0
- package/dist/src/formats/gml/positions.js.map +1 -0
- package/dist/src/formats/gml/styles.d.ts +59 -0
- package/dist/src/formats/gml/styles.d.ts.map +1 -0
- package/dist/src/formats/gml/styles.js +1056 -0
- package/dist/src/formats/gml/styles.js.map +1 -0
- package/dist/src/formats/gml/syntax.d.ts +11 -0
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +151 -62
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +4 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +5 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +133 -65
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +4 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +100 -44
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +1 -0
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +1 -0
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts +19 -0
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-plain.js +187 -0
- package/dist/src/formats/graphml/styles-plain.js.map +1 -0
- package/dist/src/formats/graphml/styles-yed.d.ts +179 -0
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yed.js +1086 -0
- package/dist/src/formats/graphml/styles-yed.js.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +19 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.js +508 -0
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -0
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +34 -19
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +16 -2
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +83 -12
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +5 -0
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +68 -25
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +22 -3
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +439 -264
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +16 -0
- package/dist/src/formats/json/positions.d.ts.map +1 -0
- package/dist/src/formats/json/positions.js +44 -0
- package/dist/src/formats/json/positions.js.map +1 -0
- package/dist/src/formats/json/styles.d.ts +102 -0
- package/dist/src/formats/json/styles.d.ts.map +1 -0
- package/dist/src/formats/json/styles.js +1753 -0
- package/dist/src/formats/json/styles.js.map +1 -0
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +2 -1
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +142 -76
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +4 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +60 -6
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -0
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +50 -0
- package/dist/src/formats/pajek/styles.d.ts.map +1 -0
- package/dist/src/formats/pajek/styles.js +569 -0
- package/dist/src/formats/pajek/styles.js.map +1 -0
- package/dist/src/formats/pajek/syntax.d.ts +6 -0
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +6 -0
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +34 -9
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +2 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +3 -1
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +12 -8
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +56 -13
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +12 -6
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +3 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +22 -9
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +2 -1
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +31 -24
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +104 -0
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -0
- package/dist/src/formats/xgmml/styles.js +310 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -0
- package/dist/src/index.d.ts +9 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/codes.d.ts +31 -0
- package/dist/src/positions/codes.d.ts.map +1 -0
- package/dist/src/positions/codes.js +26 -0
- package/dist/src/positions/codes.js.map +1 -0
- package/dist/src/positions/convert.d.ts +58 -0
- package/dist/src/positions/convert.d.ts.map +1 -0
- package/dist/src/positions/convert.js +107 -0
- package/dist/src/positions/convert.js.map +1 -0
- package/dist/src/positions/extract.d.ts +27 -0
- package/dist/src/positions/extract.d.ts.map +1 -0
- package/dist/src/positions/extract.js +526 -0
- package/dist/src/positions/extract.js.map +1 -0
- package/dist/src/positions/index.d.ts +10 -0
- package/dist/src/positions/index.d.ts.map +1 -0
- package/dist/src/positions/index.js +9 -0
- package/dist/src/positions/index.js.map +1 -0
- package/dist/src/positions/types.d.ts +208 -0
- package/dist/src/positions/types.d.ts.map +1 -0
- package/dist/src/positions/types.js +10 -0
- package/dist/src/positions/types.js.map +1 -0
- package/dist/src/registry.d.ts +30 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +130 -9
- package/dist/src/registry.js.map +1 -1
- package/dist/src/styles/annotations.d.ts +132 -0
- package/dist/src/styles/annotations.d.ts.map +1 -0
- package/dist/src/styles/annotations.js +320 -0
- package/dist/src/styles/annotations.js.map +1 -0
- package/dist/src/styles/budget.d.ts +45 -0
- package/dist/src/styles/budget.d.ts.map +1 -0
- package/dist/src/styles/budget.js +58 -0
- package/dist/src/styles/budget.js.map +1 -0
- package/dist/src/styles/canon/bends.d.ts +32 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -0
- package/dist/src/styles/canon/bends.js +74 -0
- package/dist/src/styles/canon/bends.js.map +1 -0
- package/dist/src/styles/canon/color-tables.d.ts +22 -0
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -0
- package/dist/src/styles/canon/color-tables.js +369 -0
- package/dist/src/styles/canon/color-tables.js.map +1 -0
- package/dist/src/styles/canon/color.d.ts +66 -0
- package/dist/src/styles/canon/color.d.ts.map +1 -0
- package/dist/src/styles/canon/color.js +548 -0
- package/dist/src/styles/canon/color.js.map +1 -0
- package/dist/src/styles/canon/enums.d.ts +25 -0
- package/dist/src/styles/canon/enums.d.ts.map +1 -0
- package/dist/src/styles/canon/enums.js +187 -0
- package/dist/src/styles/canon/enums.js.map +1 -0
- package/dist/src/styles/canon/graphviz.d.ts +48 -0
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -0
- package/dist/src/styles/canon/graphviz.js +160 -0
- package/dist/src/styles/canon/graphviz.js.map +1 -0
- package/dist/src/styles/canon/index.d.ts +13 -0
- package/dist/src/styles/canon/index.d.ts.map +1 -0
- package/dist/src/styles/canon/index.js +13 -0
- package/dist/src/styles/canon/index.js.map +1 -0
- package/dist/src/styles/canon/number.d.ts +59 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -0
- package/dist/src/styles/canon/number.js +142 -0
- package/dist/src/styles/canon/number.js.map +1 -0
- package/dist/src/styles/canon/site.d.ts +51 -0
- package/dist/src/styles/canon/site.d.ts.map +1 -0
- package/dist/src/styles/canon/site.js +63 -0
- package/dist/src/styles/canon/site.js.map +1 -0
- package/dist/src/styles/canon/text.d.ts +61 -0
- package/dist/src/styles/canon/text.d.ts.map +1 -0
- package/dist/src/styles/canon/text.js +199 -0
- package/dist/src/styles/canon/text.js.map +1 -0
- package/dist/src/styles/codes.d.ts +95 -0
- package/dist/src/styles/codes.d.ts.map +1 -0
- package/dist/src/styles/codes.js +97 -0
- package/dist/src/styles/codes.js.map +1 -0
- package/dist/src/styles/cyjs/cascade.d.ts +134 -0
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -0
- package/dist/src/styles/cyjs/cascade.js +2252 -0
- package/dist/src/styles/cyjs/cascade.js.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts +25 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.js +76 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -0
- package/dist/src/styles/cyjs/emit.d.ts +82 -0
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -0
- package/dist/src/styles/cyjs/emit.js +790 -0
- package/dist/src/styles/cyjs/emit.js.map +1 -0
- package/dist/src/styles/cyjs/index.d.ts +13 -0
- package/dist/src/styles/cyjs/index.d.ts.map +1 -0
- package/dist/src/styles/cyjs/index.js +13 -0
- package/dist/src/styles/cyjs/index.js.map +1 -0
- package/dist/src/styles/cyjs/live.d.ts +46 -0
- package/dist/src/styles/cyjs/live.d.ts.map +1 -0
- package/dist/src/styles/cyjs/live.js +108 -0
- package/dist/src/styles/cyjs/live.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +147 -0
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -0
- package/dist/src/styles/cyjs/mappers.js +744 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -0
- package/dist/src/styles/cyjs/selector.d.ts +113 -0
- package/dist/src/styles/cyjs/selector.d.ts.map +1 -0
- package/dist/src/styles/cyjs/selector.js +611 -0
- package/dist/src/styles/cyjs/selector.js.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts +37 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.js +181 -0
- package/dist/src/styles/cyjs/stylesheet-text.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts +125 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/emit.js +1025 -0
- package/dist/src/styles/cytoscape/emit.js.map +1 -0
- package/dist/src/styles/cytoscape/index.d.ts +10 -0
- package/dist/src/styles/cytoscape/index.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/index.js +10 -0
- package/dist/src/styles/cytoscape/index.js.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts +49 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.js +603 -0
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -0
- package/dist/src/styles/cytoscape/mappings.d.ts +171 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/mappings.js +460 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -0
- package/dist/src/styles/cytoscape/resolve.d.ts +137 -0
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/resolve.js +381 -0
- package/dist/src/styles/cytoscape/resolve.js.map +1 -0
- package/dist/src/styles/cytoscape/translate.d.ts +50 -0
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/translate.js +156 -0
- package/dist/src/styles/cytoscape/translate.js.map +1 -0
- package/dist/src/styles/defaults.d.ts +90 -0
- package/dist/src/styles/defaults.d.ts.map +1 -0
- package/dist/src/styles/defaults.js +414 -0
- package/dist/src/styles/defaults.js.map +1 -0
- package/dist/src/styles/index.d.ts +15 -0
- package/dist/src/styles/index.d.ts.map +1 -0
- package/dist/src/styles/index.js +14 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/styles/internal.d.ts +17 -0
- package/dist/src/styles/internal.d.ts.map +1 -0
- package/dist/src/styles/internal.js +16 -0
- package/dist/src/styles/internal.js.map +1 -0
- package/dist/src/styles/io/approximations.d.ts +24 -0
- package/dist/src/styles/io/approximations.d.ts.map +1 -0
- package/dist/src/styles/io/approximations.js +51 -0
- package/dist/src/styles/io/approximations.js.map +1 -0
- package/dist/src/styles/io/block.d.ts +166 -0
- package/dist/src/styles/io/block.d.ts.map +1 -0
- package/dist/src/styles/io/block.js +930 -0
- package/dist/src/styles/io/block.js.map +1 -0
- package/dist/src/styles/io/generic.d.ts +88 -0
- package/dist/src/styles/io/generic.d.ts.map +1 -0
- package/dist/src/styles/io/generic.js +516 -0
- package/dist/src/styles/io/generic.js.map +1 -0
- package/dist/src/styles/io/index.d.ts +8 -0
- package/dist/src/styles/io/index.d.ts.map +1 -0
- package/dist/src/styles/io/index.js +7 -0
- package/dist/src/styles/io/index.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts +80 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -0
- package/dist/src/styles/io/writer.js +596 -0
- package/dist/src/styles/io/writer.js.map +1 -0
- package/dist/src/styles/notes.d.ts +47 -0
- package/dist/src/styles/notes.d.ts.map +1 -0
- package/dist/src/styles/notes.js +140 -0
- package/dist/src/styles/notes.js.map +1 -0
- package/dist/src/styles/plan/classes.d.ts +31 -0
- package/dist/src/styles/plan/classes.d.ts.map +1 -0
- package/dist/src/styles/plan/classes.js +139 -0
- package/dist/src/styles/plan/classes.js.map +1 -0
- package/dist/src/styles/plan/continuous.d.ts +32 -0
- package/dist/src/styles/plan/continuous.d.ts.map +1 -0
- package/dist/src/styles/plan/continuous.js +165 -0
- package/dist/src/styles/plan/continuous.js.map +1 -0
- package/dist/src/styles/plan/discrete.d.ts +39 -0
- package/dist/src/styles/plan/discrete.d.ts.map +1 -0
- package/dist/src/styles/plan/discrete.js +127 -0
- package/dist/src/styles/plan/discrete.js.map +1 -0
- package/dist/src/styles/plan/families.d.ts +31 -0
- package/dist/src/styles/plan/families.d.ts.map +1 -0
- package/dist/src/styles/plan/families.js +95 -0
- package/dist/src/styles/plan/families.js.map +1 -0
- package/dist/src/styles/plan/features.d.ts +58 -0
- package/dist/src/styles/plan/features.d.ts.map +1 -0
- package/dist/src/styles/plan/features.js +185 -0
- package/dist/src/styles/plan/features.js.map +1 -0
- package/dist/src/styles/plan/index.d.ts +7 -0
- package/dist/src/styles/plan/index.d.ts.map +1 -0
- package/dist/src/styles/plan/index.js +7 -0
- package/dist/src/styles/plan/index.js.map +1 -0
- package/dist/src/styles/plan/plan.d.ts +71 -0
- package/dist/src/styles/plan/plan.d.ts.map +1 -0
- package/dist/src/styles/plan/plan.js +893 -0
- package/dist/src/styles/plan/plan.js.map +1 -0
- package/dist/src/styles/plan/resolve.d.ts +137 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -0
- package/dist/src/styles/plan/resolve.js +587 -0
- package/dist/src/styles/plan/resolve.js.map +1 -0
- package/dist/src/styles/types.d.ts +702 -0
- package/dist/src/styles/types.d.ts.map +1 -0
- package/dist/src/styles/types.js +10 -0
- package/dist/src/styles/types.js.map +1 -0
- package/dist/src/styles/vocabulary.d.ts +41 -0
- package/dist/src/styles/vocabulary.d.ts.map +1 -0
- package/dist/src/styles/vocabulary.js +140 -0
- package/dist/src/styles/vocabulary.js.map +1 -0
- package/dist/src/types.d.ts +64 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +322 -0
- package/dist/styles.js.map +1 -0
- package/dist/xgmml.js +5 -4
- package/dist/xgmml.js.map +1 -1
- package/package.json +13 -2
- package/src/common/codes.ts +7 -0
- package/src/common/escape.ts +5 -2
- package/src/common/export.ts +179 -140
- package/src/common/input.ts +8 -4
- package/src/common/json-elements.ts +169 -38
- package/src/common/notes.ts +94 -0
- package/src/common/report.ts +41 -1
- package/src/common/units.ts +42 -0
- package/src/common/xml.ts +45 -5
- package/src/formats/cx/exporter.ts +95 -11
- package/src/formats/cx/importer.ts +126 -90
- package/src/formats/cx/styles.ts +304 -0
- package/src/formats/cx2/exporter.ts +234 -77
- package/src/formats/cx2/importer.ts +19 -1
- package/src/formats/cx2/styles.ts +29 -0
- package/src/formats/cys/constants.ts +3 -0
- package/src/formats/cys/exporter.ts +246 -60
- package/src/formats/cys/importer.ts +125 -9
- package/src/formats/cys/session.ts +6 -0
- package/src/formats/cys/styles.ts +254 -0
- package/src/formats/cys/tables.ts +117 -48
- package/src/formats/dot/exporter.ts +262 -126
- package/src/formats/dot/importer.ts +111 -20
- package/src/formats/dot/index.ts +1 -0
- package/src/formats/dot/positions.ts +77 -0
- package/src/formats/dot/styles.ts +1741 -0
- package/src/formats/gexf/exporter.ts +27 -11
- package/src/formats/gexf/importer.ts +308 -158
- package/src/formats/gexf/index.ts +10 -0
- package/src/formats/gexf/schema.ts +5 -0
- package/src/formats/gexf/styles.ts +719 -0
- package/src/formats/gml/exporter.ts +33 -14
- package/src/formats/gml/importer.ts +4 -0
- package/src/formats/gml/index.ts +2 -1
- package/src/formats/gml/positions.ts +52 -0
- package/src/formats/gml/styles.ts +1248 -0
- package/src/formats/gml/syntax.ts +173 -62
- package/src/formats/graphml/constants.ts +5 -0
- package/src/formats/graphml/exporter.ts +163 -71
- package/src/formats/graphml/importer.ts +119 -45
- package/src/formats/graphml/index.ts +1 -0
- package/src/formats/graphml/styles-plain.ts +236 -0
- package/src/formats/graphml/styles-yed.ts +1221 -0
- package/src/formats/graphml/styles-yfiles3.ts +573 -0
- package/src/formats/graphml/tree.ts +36 -20
- package/src/formats/graphml/yfiles.ts +89 -13
- package/src/formats/json/exporter.ts +76 -26
- package/src/formats/json/importer.ts +541 -322
- package/src/formats/json/positions.ts +50 -0
- package/src/formats/json/styles.ts +2082 -0
- package/src/formats/neo4j/exporter.ts +2 -1
- package/src/formats/pajek/exporter.ts +195 -106
- package/src/formats/pajek/importer.ts +78 -9
- package/src/formats/pajek/index.ts +2 -0
- package/src/formats/pajek/styles.ts +685 -0
- package/src/formats/pajek/syntax.ts +7 -0
- package/src/formats/xgmml/columns.ts +39 -9
- package/src/formats/xgmml/constants.ts +3 -0
- package/src/formats/xgmml/document.ts +54 -12
- package/src/formats/xgmml/emit.ts +11 -6
- package/src/formats/xgmml/exporter.ts +32 -13
- package/src/formats/xgmml/importer.ts +43 -29
- package/src/formats/xgmml/styles.ts +400 -0
- package/src/index.ts +16 -0
- package/src/positions/codes.ts +32 -0
- package/src/positions/convert.ts +123 -0
- package/src/positions/extract.ts +619 -0
- package/src/positions/index.ts +23 -0
- package/src/positions/types.ts +221 -0
- package/src/registry.ts +179 -8
- package/src/styles/annotations.ts +478 -0
- package/src/styles/budget.ts +60 -0
- package/src/styles/canon/bends.ts +84 -0
- package/src/styles/canon/color-tables.ts +386 -0
- package/src/styles/canon/color.ts +624 -0
- package/src/styles/canon/enums.ts +211 -0
- package/src/styles/canon/graphviz.ts +189 -0
- package/src/styles/canon/index.ts +13 -0
- package/src/styles/canon/number.ts +152 -0
- package/src/styles/canon/site.ts +87 -0
- package/src/styles/canon/text.ts +221 -0
- package/src/styles/codes.ts +104 -0
- package/src/styles/cyjs/cascade.ts +2670 -0
- package/src/styles/cyjs/defaults-table.ts +82 -0
- package/src/styles/cyjs/emit.ts +951 -0
- package/src/styles/cyjs/index.ts +37 -0
- package/src/styles/cyjs/live.ts +147 -0
- package/src/styles/cyjs/mappers.ts +879 -0
- package/src/styles/cyjs/selector.ts +778 -0
- package/src/styles/cyjs/stylesheet-text.ts +214 -0
- package/src/styles/cytoscape/emit.ts +1264 -0
- package/src/styles/cytoscape/index.ts +40 -0
- package/src/styles/cytoscape/lexicon.ts +656 -0
- package/src/styles/cytoscape/mappings.ts +603 -0
- package/src/styles/cytoscape/resolve.ts +521 -0
- package/src/styles/cytoscape/translate.ts +237 -0
- package/src/styles/defaults.ts +504 -0
- package/src/styles/index.ts +57 -0
- package/src/styles/internal.ts +17 -0
- package/src/styles/io/approximations.ts +47 -0
- package/src/styles/io/block.ts +1138 -0
- package/src/styles/io/generic.ts +687 -0
- package/src/styles/io/index.ts +18 -0
- package/src/styles/io/writer.ts +745 -0
- package/src/styles/notes.ts +165 -0
- package/src/styles/plan/classes.ts +166 -0
- package/src/styles/plan/continuous.ts +218 -0
- package/src/styles/plan/discrete.ts +165 -0
- package/src/styles/plan/families.ts +115 -0
- package/src/styles/plan/features.ts +234 -0
- package/src/styles/plan/index.ts +7 -0
- package/src/styles/plan/plan.ts +1129 -0
- package/src/styles/plan/resolve.ts +685 -0
- package/src/styles/types.ts +814 -0
- package/src/styles/vocabulary.ts +172 -0
- package/src/types.ts +76 -1
- package/dist/chunks/constants-fT3E8JYY.js.map +0 -1
- package/dist/chunks/escape-B62ZGM_a.js.map +0 -1
- package/dist/chunks/export-rKLeGQMo.js.map +0 -1
- package/dist/chunks/exporter-8hLNemFk.js.map +0 -1
- package/dist/chunks/exporter-BWwEuOPT.js.map +0 -1
- package/dist/chunks/exporter-RVtXVetw.js.map +0 -1
- package/dist/chunks/importer-BbNb7eNg.js.map +0 -1
- package/dist/chunks/importer-C98dpSH4.js.map +0 -1
- package/dist/chunks/importer-D794XUTe.js.map +0 -1
- package/dist/chunks/importer-Dz7tI8Sa.js.map +0 -1
- package/dist/chunks/importer-Ht7LNg8L.js.map +0 -1
- package/dist/chunks/importer-WrGRZb0N.js.map +0 -1
- package/dist/chunks/importer-xZ-3suY1.js.map +0 -1
- package/dist/chunks/json-elements-DKSqpNW1.js.map +0 -1
|
@@ -0,0 +1,2102 @@
|
|
|
1
|
+
import { a as STYLE_ISSUE, j as StyleNotes, H as refSource, J as resolveRules, d as num6, U as degreeValues, v as STYLE_PROPERTIES, O as canonicalFor, w as toolDefaults, i as isStyleValue, L as evalContinuous, N as numberOf, V as discreteLookup, S as STYLE_BLOCK_NAME, m as plainCell, p as parseStyleBlock, k as styleFingerprint, l as blockStyles, r as resolveStyles } from "./block-JQiwViEt.js";
|
|
2
|
+
import { e as escapeXmlAttribute } from "./escape-B1rMftd9.js";
|
|
3
|
+
import { J as JAVA_FONTS, c as colorParser, N as NODE_SIZE_VP, s as sizeParser, C as CYTOSCAPE_LEXICON, i as isUncarriedVp, n as normalizeVisualProperties } from "./lexicon-B-knUi-l.js";
|
|
4
|
+
import { M as MIXED_DIRECTION_CODE, D as DIRECTION_FORCED_CODE, a 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, a2 as AMBIGUOUS_GRAPH_NAME_CODE, a3 as GRAPH_NOT_FOUND_CODE, h as MULTIPLE_GRAPHS_CODE, b as STRAY_TEXT_CODE, c as UNKNOWN_ELEMENT_CODE, U as UNKNOWN_ATTR_TYPE_CODE, ay as EQUATION_AS_TEXT_CODE, a6 as PARENT_CYCLE_CODE, l as UNKNOWN_PARENT_CODE, k as DUPLICATE_ATTRIBUTE_CODE, e as DANGLING_REFERENCE_CODE, P as PRECISION_CODE, a7 as WIDENED_CODE, Y as BAD_VALUE_CODE, i as DUPLICATE_EDGE_ID_CODE, j as DUPLICATE_NODE_CODE, m as MISSING_ENDPOINT_CODE, n as MISSING_ID_CODE, N as NO_GRAPH_CODE, q as ENCODING_CONFLICT_CODE, r as UNKNOWN_ENCODING_CODE, s as ENCODING_FALLBACK_CODE, t as INVALID_ENCODING_CODE, u as INVALID_UTF8_CODE, E as EMPTY_INPUT_CODE, X as XML_NESTING_CODE, v as XML_SYNTAX_CODE, x as ELEMENT_ISSUE, y as INPUT_ISSUE, aI as STORAGE_CLASS_CODE, aN as WEIGHT_KEY_CLASH_CODE, aa as ROLE_ASSUMED_CODE, at as COLUMN_RENAMED_LOSS_CODE, z as ID_TEXT_TYPE_CODE, aD as MUTUAL_EXPANDED_CODE, F as PARENTS_DROPPED_CODE, A as ROLE_DROPPED_CODE, aK as TEMPORAL_TEXT_DROPPED_CODE, aJ as TEMPORAL_DROPPED_CODE, ac as XML_ILLEGAL_CHAR_CODE } from "./format-GDmO6m6Q.js";
|
|
5
|
+
function emptyCytoscapeStyle() {
|
|
6
|
+
const target = () => ({
|
|
7
|
+
defaults: /* @__PURE__ */ new Map(),
|
|
8
|
+
mappings: /* @__PURE__ */ new Map(),
|
|
9
|
+
dependencies: /* @__PURE__ */ new Map(),
|
|
10
|
+
bypassAliases: /* @__PURE__ */ new Map()
|
|
11
|
+
});
|
|
12
|
+
return { network: { defaults: /* @__PURE__ */ new Map() }, node: target(), edge: target() };
|
|
13
|
+
}
|
|
14
|
+
const NUMERIC_TYPES = /* @__PURE__ */ new Set(["integer", "long", "double", "float", "int", "short"]);
|
|
15
|
+
const DECIMAL = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
|
|
16
|
+
function typedKey(raw, type) {
|
|
17
|
+
if (typeof raw === "number") {
|
|
18
|
+
return Number.isFinite(raw) ? raw : null;
|
|
19
|
+
}
|
|
20
|
+
if (typeof raw === "boolean") {
|
|
21
|
+
return raw;
|
|
22
|
+
}
|
|
23
|
+
if (typeof raw !== "string") {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const t = (type ?? "").toLowerCase().replace(/^list_of_/, "").replace(/^java\.lang\./, "");
|
|
27
|
+
if (NUMERIC_TYPES.has(t) && raw.length <= 64 && DECIMAL.test(raw.trim())) {
|
|
28
|
+
return Number(raw.trim());
|
|
29
|
+
}
|
|
30
|
+
if (t === "boolean") {
|
|
31
|
+
const b = raw.trim().toLowerCase();
|
|
32
|
+
if (b === "true" || b === "false") {
|
|
33
|
+
return b === "true";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return raw;
|
|
37
|
+
}
|
|
38
|
+
const INDEXED = /* @__PURE__ */ new Set(["K", "V", "L", "E", "G", "OV"]);
|
|
39
|
+
function definitionTokens(def) {
|
|
40
|
+
const tokens = [];
|
|
41
|
+
let parts = [];
|
|
42
|
+
let start = 0;
|
|
43
|
+
let i = def.indexOf(",");
|
|
44
|
+
while (i >= 0) {
|
|
45
|
+
parts.push(def.slice(start, i));
|
|
46
|
+
if (def[i + 1] === ",") {
|
|
47
|
+
parts.push(",");
|
|
48
|
+
i++;
|
|
49
|
+
} else {
|
|
50
|
+
tokens.push(parts.join(""));
|
|
51
|
+
parts = [];
|
|
52
|
+
}
|
|
53
|
+
start = i + 1;
|
|
54
|
+
i = def.indexOf(",", start);
|
|
55
|
+
}
|
|
56
|
+
parts.push(def.slice(start));
|
|
57
|
+
tokens.push(parts.join(""));
|
|
58
|
+
return tokens;
|
|
59
|
+
}
|
|
60
|
+
function indexedEntry(t) {
|
|
61
|
+
const eq1 = t.indexOf("=");
|
|
62
|
+
const eq2 = eq1 < 0 ? -1 : t.indexOf("=", eq1 + 1);
|
|
63
|
+
const tag = t.slice(0, eq1);
|
|
64
|
+
if (eq2 < 0 || !INDEXED.has(tag)) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const indexText = t.slice(eq1 + 1, eq2);
|
|
68
|
+
return /^\d{1,15}$/.test(indexText) ? { tag, index: Number(indexText), value: t.slice(eq2 + 1) } : null;
|
|
69
|
+
}
|
|
70
|
+
function parseCx1Definition(def, notes, target = null) {
|
|
71
|
+
const tokens = definitionTokens(def);
|
|
72
|
+
const entries = /* @__PURE__ */ new Map();
|
|
73
|
+
let column = null;
|
|
74
|
+
let type = null;
|
|
75
|
+
let beyond = 0;
|
|
76
|
+
for (const t of tokens) {
|
|
77
|
+
if (t.startsWith("COL=")) {
|
|
78
|
+
column = t.slice(4);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (t.startsWith("T=")) {
|
|
82
|
+
type = t.slice(2);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const indexed = indexedEntry(t);
|
|
86
|
+
if (indexed === null) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const { tag, index, value } = indexed;
|
|
90
|
+
if (index > tokens.length) {
|
|
91
|
+
beyond++;
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
let byIndex = entries.get(tag);
|
|
95
|
+
if (byIndex === void 0) {
|
|
96
|
+
byIndex = /* @__PURE__ */ new Map();
|
|
97
|
+
entries.set(tag, byIndex);
|
|
98
|
+
}
|
|
99
|
+
byIndex.set(index, value);
|
|
100
|
+
}
|
|
101
|
+
if (beyond > 0) {
|
|
102
|
+
notes?.add(STYLE_ISSUE.BAD_MAPPING, target, column ?? "definition", {
|
|
103
|
+
sample: `${beyond} entries with an index beyond the definition`,
|
|
104
|
+
count: beyond
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return { column, type, entries };
|
|
108
|
+
}
|
|
109
|
+
function indexesOf(d, tag) {
|
|
110
|
+
return Array.from(d.entries.get(tag)?.keys() ?? []).sort((a, b) => a - b);
|
|
111
|
+
}
|
|
112
|
+
function finiteOf(v) {
|
|
113
|
+
if (typeof v === "number") {
|
|
114
|
+
return Number.isFinite(v) ? v : null;
|
|
115
|
+
}
|
|
116
|
+
if (typeof v === "string" && v.length <= 64 && DECIMAL.test(v.trim())) {
|
|
117
|
+
return Number(v.trim());
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
function mappingFromCx1(m, notes, target = null) {
|
|
122
|
+
if (m === null || typeof m !== "object" || typeof m.definition !== "string") {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
const { type: kind, definition } = m;
|
|
126
|
+
const d = parseCx1Definition(definition, notes, target);
|
|
127
|
+
if (d.column === null) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
const at = (tag, i) => d.entries.get(tag)?.get(i);
|
|
131
|
+
switch (String(kind).toUpperCase()) {
|
|
132
|
+
case "PASSTHROUGH":
|
|
133
|
+
return { kind: "passthrough", column: d.column, type: d.type };
|
|
134
|
+
case "DISCRETE": {
|
|
135
|
+
const table = [];
|
|
136
|
+
for (const i of indexesOf(d, "K")) {
|
|
137
|
+
const key = typedKey(at("K", i), d.type);
|
|
138
|
+
const value = at("V", i);
|
|
139
|
+
if (key !== null && value !== void 0) {
|
|
140
|
+
table.push([key, value]);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return { kind: "discrete", column: d.column, type: d.type, table };
|
|
144
|
+
}
|
|
145
|
+
case "CONTINUOUS": {
|
|
146
|
+
const points = [];
|
|
147
|
+
for (const i of indexesOf(d, "OV")) {
|
|
148
|
+
const x = finiteOf(at("OV", i));
|
|
149
|
+
if (x !== null) {
|
|
150
|
+
points.push({ at: x, below: at("L", i), value: at("E", i), above: at("G", i) });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return { kind: "continuous", column: d.column, type: d.type, points };
|
|
154
|
+
}
|
|
155
|
+
default:
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function own(o, k) {
|
|
160
|
+
return o !== null && typeof o === "object" && Object.hasOwn(o, k) ? o[k] : void 0;
|
|
161
|
+
}
|
|
162
|
+
function mappingFromCx2(m) {
|
|
163
|
+
const def = own(m, "definition");
|
|
164
|
+
const column = own(def, "attribute");
|
|
165
|
+
if (typeof column !== "string") {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const declared = own(def, "type");
|
|
169
|
+
const type = typeof declared === "string" ? declared : null;
|
|
170
|
+
const map = own(def, "map");
|
|
171
|
+
const entries = Array.isArray(map) ? map : [];
|
|
172
|
+
switch (String(own(m, "type")).toUpperCase()) {
|
|
173
|
+
case "PASSTHROUGH":
|
|
174
|
+
return { kind: "passthrough", column, type };
|
|
175
|
+
case "DISCRETE": {
|
|
176
|
+
const table = [];
|
|
177
|
+
for (const e of entries) {
|
|
178
|
+
const key = typedKey(own(e, "v"), type);
|
|
179
|
+
const value = own(e, "vp");
|
|
180
|
+
if (key !== null && value !== void 0) {
|
|
181
|
+
table.push([key, value]);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return { kind: "discrete", column, type, table };
|
|
185
|
+
}
|
|
186
|
+
case "CONTINUOUS":
|
|
187
|
+
return { kind: "continuous", column, type, points: cx2Points$1(entries) };
|
|
188
|
+
default:
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function cx2Points$1(entries) {
|
|
193
|
+
const byAt = /* @__PURE__ */ new Map();
|
|
194
|
+
const point = (x) => {
|
|
195
|
+
let p = byAt.get(x);
|
|
196
|
+
if (p === void 0) {
|
|
197
|
+
p = { at: x };
|
|
198
|
+
byAt.set(x, p);
|
|
199
|
+
}
|
|
200
|
+
return p;
|
|
201
|
+
};
|
|
202
|
+
for (const iv of entries) {
|
|
203
|
+
if (iv !== null && typeof iv === "object") {
|
|
204
|
+
addInterval(iv, point);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return Array.from(byAt.values()).sort((a, b) => a.at - b.at).map((p) => {
|
|
208
|
+
const below = p.below ?? p.value ?? p.above;
|
|
209
|
+
const above = p.above ?? p.value ?? below;
|
|
210
|
+
return { at: p.at, below, value: p.value ?? below, above };
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function addInterval(iv, point) {
|
|
214
|
+
const lo = finiteOf(own(iv, "min"));
|
|
215
|
+
const hi = finiteOf(own(iv, "max"));
|
|
216
|
+
const minValue = own(iv, "minVPValue") ?? own(iv, "maxVPValue");
|
|
217
|
+
const maxValue = own(iv, "maxVPValue") ?? own(iv, "minVPValue");
|
|
218
|
+
if (lo !== null) {
|
|
219
|
+
const p = point(lo);
|
|
220
|
+
p.above = minValue;
|
|
221
|
+
if (own(iv, "includeMin") !== false) {
|
|
222
|
+
p.value = minValue;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (hi !== null) {
|
|
226
|
+
const p = point(hi);
|
|
227
|
+
p.below = maxValue;
|
|
228
|
+
if (own(iv, "includeMax") !== false && p.value === void 0) {
|
|
229
|
+
p.value = maxValue;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function record(x) {
|
|
234
|
+
return x !== null && typeof x === "object" && !Array.isArray(x) ? x : {};
|
|
235
|
+
}
|
|
236
|
+
function cytoscapeStyleFromCx(entries, notes) {
|
|
237
|
+
const style = emptyCytoscapeStyle();
|
|
238
|
+
const viewOf = (v) => own(v, "applies_to") ?? own(v, "view") ?? null;
|
|
239
|
+
const views = [];
|
|
240
|
+
for (const v of entries) {
|
|
241
|
+
if (/default|network/.test(String(own(v, "properties_of"))) && !views.includes(viewOf(v))) {
|
|
242
|
+
views.push(viewOf(v));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (views.length > 1) {
|
|
246
|
+
notes?.add(STYLE_ISSUE.OTHER_VIEWS, null, "cyVisualProperties", {
|
|
247
|
+
sample: `${views.length - 1} more`,
|
|
248
|
+
count: views.length - 1
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
for (const v of entries) {
|
|
252
|
+
const target = v !== null && typeof v === "object" && viewOf(v) === views[0] ? CX_SECTIONS.get(String(own(v, "properties_of"))) : void 0;
|
|
253
|
+
if (target === void 0) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const props = record(own(v, "properties"));
|
|
257
|
+
for (const k of Object.keys(props)) {
|
|
258
|
+
style[target].defaults.set(k, props[k]);
|
|
259
|
+
}
|
|
260
|
+
if (target !== "network") {
|
|
261
|
+
readCxMappings(style, target, v, notes);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return style;
|
|
265
|
+
}
|
|
266
|
+
const CX_SECTIONS = /* @__PURE__ */ new Map([
|
|
267
|
+
["nodes:default", "node"],
|
|
268
|
+
["edges:default", "edge"],
|
|
269
|
+
["network", "network"]
|
|
270
|
+
]);
|
|
271
|
+
function readCxMappings(style, target, v, notes) {
|
|
272
|
+
const mappings = record(own(v, "mappings"));
|
|
273
|
+
for (const vp of Object.keys(mappings)) {
|
|
274
|
+
const m = mappingFromCx1(mappings[vp], notes, target);
|
|
275
|
+
if (m === null) {
|
|
276
|
+
notes?.add(STYLE_ISSUE.BAD_MAPPING, target, vp, { sample: mappings[vp] });
|
|
277
|
+
} else {
|
|
278
|
+
style[target].mappings.set(vp, m);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const deps = record(own(v, "dependencies"));
|
|
282
|
+
for (const d of Object.keys(deps)) {
|
|
283
|
+
style[target].dependencies.set(d, String(deps[d]).toLowerCase() === "true");
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function cytoscapeStyleFromCx2(visualProperties, visualEditorProperties, notes) {
|
|
287
|
+
const style = emptyCytoscapeStyle();
|
|
288
|
+
const first = (x) => Array.isArray(x) ? x[0] : x;
|
|
289
|
+
const vp = record(first(visualProperties));
|
|
290
|
+
const editor = record(own(record(first(visualEditorProperties)), "properties"));
|
|
291
|
+
const defaults = record(own(vp, "default"));
|
|
292
|
+
for (const target of ["network", "node", "edge"]) {
|
|
293
|
+
const d = record(own(defaults, target));
|
|
294
|
+
for (const k of Object.keys(d)) {
|
|
295
|
+
style[target].defaults.set(k, d[k]);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
style.node.dependencies.set("nodeSizeLocked", own(editor, "nodeSizeLocked") === true);
|
|
299
|
+
style.edge.dependencies.set("arrowColorMatchesEdge", own(editor, "arrowColorMatchesEdge") === true);
|
|
300
|
+
for (const [target, key] of [
|
|
301
|
+
["node", "nodeMapping"],
|
|
302
|
+
["edge", "edgeMapping"]
|
|
303
|
+
]) {
|
|
304
|
+
const mappings = record(own(vp, key));
|
|
305
|
+
for (const name of Object.keys(mappings)) {
|
|
306
|
+
const m = mappingFromCx2(mappings[name]);
|
|
307
|
+
if (m === null) {
|
|
308
|
+
notes?.add(STYLE_ISSUE.BAD_MAPPING, target, name, { sample: mappings[name] });
|
|
309
|
+
} else {
|
|
310
|
+
style[target].mappings.set(name, m);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
lockedSizeFromWidth(style.node);
|
|
315
|
+
return style;
|
|
316
|
+
}
|
|
317
|
+
function lockedSizeFromWidth(node) {
|
|
318
|
+
if (node.dependencies.get("nodeSizeLocked") !== true || node.defaults.has("NODE_SIZE") || node.mappings.has("NODE_SIZE")) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (node.defaults.has("NODE_WIDTH")) {
|
|
322
|
+
node.defaults.set("NODE_SIZE", node.defaults.get("NODE_WIDTH"));
|
|
323
|
+
}
|
|
324
|
+
const width = node.mappings.get("NODE_WIDTH");
|
|
325
|
+
if (width !== void 0) {
|
|
326
|
+
node.mappings.set("NODE_SIZE", width);
|
|
327
|
+
}
|
|
328
|
+
node.bypassAliases.set("NODE_WIDTH", "NODE_SIZE");
|
|
329
|
+
}
|
|
330
|
+
const colorOut = (v) => String(v).toUpperCase();
|
|
331
|
+
function enumOut(table, near, upper, cytoscape = /* @__PURE__ */ new Set()) {
|
|
332
|
+
return (v, approx) => {
|
|
333
|
+
const s = String(v);
|
|
334
|
+
if (Object.hasOwn(table, s)) {
|
|
335
|
+
return table[s];
|
|
336
|
+
}
|
|
337
|
+
if (s.startsWith("other:") && cytoscape.has(s.slice("other:".length).toLowerCase().replaceAll("_", "-"))) {
|
|
338
|
+
const raw = s.slice("other:".length);
|
|
339
|
+
const out = upper ? raw.toUpperCase().replaceAll("-", "_") : raw;
|
|
340
|
+
if (out !== raw) {
|
|
341
|
+
approx();
|
|
342
|
+
}
|
|
343
|
+
return out;
|
|
344
|
+
}
|
|
345
|
+
approx();
|
|
346
|
+
return Object.hasOwn(near, s) ? near[s] : Object.values(table)[0];
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
const DESKTOP_SHAPES = {
|
|
350
|
+
ellipse: "ELLIPSE",
|
|
351
|
+
rectangle: "RECTANGLE",
|
|
352
|
+
"round-rectangle": "ROUND_RECTANGLE",
|
|
353
|
+
triangle: "TRIANGLE",
|
|
354
|
+
diamond: "DIAMOND",
|
|
355
|
+
hexagon: "HEXAGON",
|
|
356
|
+
octagon: "OCTAGON",
|
|
357
|
+
parallelogram: "PARALLELOGRAM",
|
|
358
|
+
vee: "V"
|
|
359
|
+
};
|
|
360
|
+
const NEAR_SHAPES = {
|
|
361
|
+
pentagon: "hexagon",
|
|
362
|
+
star: "octagon",
|
|
363
|
+
trapezoid: "parallelogram",
|
|
364
|
+
none: "ellipse",
|
|
365
|
+
// Graphviz shapes no canonical shape names
|
|
366
|
+
"other:invtrapezium": "parallelogram",
|
|
367
|
+
"other:house": "hexagon",
|
|
368
|
+
"other:invhouse": "hexagon"
|
|
369
|
+
};
|
|
370
|
+
const lower = (t) => Object.fromEntries(Object.entries(t).map(([k, v]) => [k, v === "V" ? "vee" : v.toLowerCase()]));
|
|
371
|
+
const nearIn = (t, near) => Object.fromEntries(Object.entries(near).map(([k, v]) => [k, t[v]]));
|
|
372
|
+
const DESKTOP_BORDERS = {
|
|
373
|
+
solid: "SOLID",
|
|
374
|
+
dashed: "EQUAL_DASH",
|
|
375
|
+
dotted: "DOT",
|
|
376
|
+
"dash-dot": "DASH_DOT",
|
|
377
|
+
double: "PARALLEL_LINES"
|
|
378
|
+
};
|
|
379
|
+
const DESKTOP_LINES = { ...DESKTOP_BORDERS, zigzag: "ZIGZAG", sinewave: "SINEWAVE" };
|
|
380
|
+
const CX2_LINES = { solid: "solid", dashed: "dashed", dotted: "dotted", double: "double" };
|
|
381
|
+
const NEAR_LINES = { "dash-dot": "dashed", "long-dash": "dashed", zigzag: "solid", sinewave: "solid" };
|
|
382
|
+
const DESKTOP_ARROWS = {
|
|
383
|
+
none: "NONE",
|
|
384
|
+
triangle: "DELTA",
|
|
385
|
+
vee: "ARROW",
|
|
386
|
+
tee: "T",
|
|
387
|
+
diamond: "DIAMOND",
|
|
388
|
+
circle: "CIRCLE",
|
|
389
|
+
square: "SQUARE",
|
|
390
|
+
"triangle-open": "OPEN_DELTA",
|
|
391
|
+
"diamond-open": "OPEN_DIAMOND",
|
|
392
|
+
"circle-open": "OPEN_CIRCLE",
|
|
393
|
+
half: "HALF_TOP"
|
|
394
|
+
};
|
|
395
|
+
const CX2_ARROWS = {
|
|
396
|
+
none: "none",
|
|
397
|
+
triangle: "triangle",
|
|
398
|
+
vee: "vee",
|
|
399
|
+
tee: "tee",
|
|
400
|
+
diamond: "diamond",
|
|
401
|
+
circle: "circle",
|
|
402
|
+
square: "square",
|
|
403
|
+
"triangle-open": "open-triangle",
|
|
404
|
+
"diamond-open": "open-diamond",
|
|
405
|
+
"circle-open": "open-circle",
|
|
406
|
+
half: "half-top"
|
|
407
|
+
};
|
|
408
|
+
const NEAR_ARROWS = { crow: "vee", inverted: "triangle" };
|
|
409
|
+
const CY_OTHER_ARROWS = /* @__PURE__ */ new Set(["open-square", "open-half-circle", "half-circle"]);
|
|
410
|
+
const CY_OTHER_LINES = /* @__PURE__ */ new Set([
|
|
411
|
+
"backward-slash",
|
|
412
|
+
"forward-slash",
|
|
413
|
+
"vertical-slash",
|
|
414
|
+
"separate-arrow",
|
|
415
|
+
"contiguous-arrow"
|
|
416
|
+
]);
|
|
417
|
+
const CY_OTHER_BORDERS = /* @__PURE__ */ new Set([...CY_OTHER_LINES, "zigzag", "sinewave"]);
|
|
418
|
+
const DESKTOP_POSITIONS = {
|
|
419
|
+
center: "C,C,c,0.00,0.00",
|
|
420
|
+
top: "N,S,c,0.00,0.00",
|
|
421
|
+
bottom: "S,N,c,0.00,0.00",
|
|
422
|
+
left: "W,E,c,0.00,0.00",
|
|
423
|
+
right: "E,W,c,0.00,0.00",
|
|
424
|
+
"top-left": "NW,SE,c,0.00,0.00",
|
|
425
|
+
"top-right": "NE,SW,c,0.00,0.00",
|
|
426
|
+
"bottom-left": "SW,NE,c,0.00,0.00",
|
|
427
|
+
"bottom-right": "SE,NW,c,0.00,0.00"
|
|
428
|
+
};
|
|
429
|
+
const CX2_ANCHORS = {
|
|
430
|
+
center: ["center", "center"],
|
|
431
|
+
top: ["center", "top"],
|
|
432
|
+
bottom: ["center", "bottom"],
|
|
433
|
+
left: ["left", "center"],
|
|
434
|
+
right: ["right", "center"],
|
|
435
|
+
"top-left": ["left", "top"],
|
|
436
|
+
"top-right": ["right", "top"],
|
|
437
|
+
"bottom-left": ["left", "bottom"],
|
|
438
|
+
"bottom-right": ["right", "bottom"]
|
|
439
|
+
};
|
|
440
|
+
const desktopNumber = String;
|
|
441
|
+
const cx2Number = (v) => v;
|
|
442
|
+
const textOut = String;
|
|
443
|
+
const desktopBool = (v) => String(v === true);
|
|
444
|
+
const opacity255 = (v, approx) => {
|
|
445
|
+
const b = Math.round(Number(v) * 255);
|
|
446
|
+
if (num6(b / 255) !== v) {
|
|
447
|
+
approx();
|
|
448
|
+
}
|
|
449
|
+
return String(b);
|
|
450
|
+
};
|
|
451
|
+
const WRITERS = {
|
|
452
|
+
desktop: {
|
|
453
|
+
node: /* @__PURE__ */ new Map([
|
|
454
|
+
["fill", { vp: "NODE_FILL_COLOR", write: colorOut }],
|
|
455
|
+
["fillOpacity", { vp: "NODE_TRANSPARENCY", write: opacity255 }],
|
|
456
|
+
["borderColor", { vp: "NODE_BORDER_PAINT", write: colorOut }],
|
|
457
|
+
["borderWidth", { vp: "NODE_BORDER_WIDTH", write: desktopNumber }],
|
|
458
|
+
[
|
|
459
|
+
"borderStyle",
|
|
460
|
+
{
|
|
461
|
+
vp: "NODE_BORDER_LINE_TYPE",
|
|
462
|
+
write: enumOut(DESKTOP_BORDERS, nearIn(DESKTOP_BORDERS, NEAR_LINES), true, CY_OTHER_BORDERS)
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
["shape", { vp: "NODE_SHAPE", write: enumOut(DESKTOP_SHAPES, nearIn(DESKTOP_SHAPES, NEAR_SHAPES), true) }],
|
|
466
|
+
["width", { vp: "NODE_WIDTH", write: desktopNumber }],
|
|
467
|
+
["height", { vp: "NODE_HEIGHT", write: desktopNumber }],
|
|
468
|
+
["label", { vp: "NODE_LABEL", write: textOut }],
|
|
469
|
+
["labelColor", { vp: "NODE_LABEL_COLOR", write: colorOut }],
|
|
470
|
+
["labelSize", { vp: "NODE_LABEL_FONT_SIZE", write: desktopNumber }],
|
|
471
|
+
["labelPosition", { vp: "NODE_LABEL_POSITION", write: enumOut(DESKTOP_POSITIONS, {}, false) }],
|
|
472
|
+
["tooltip", { vp: "NODE_TOOLTIP", write: textOut }],
|
|
473
|
+
["visible", { vp: "NODE_VISIBLE", write: desktopBool }]
|
|
474
|
+
]),
|
|
475
|
+
edge: /* @__PURE__ */ new Map([
|
|
476
|
+
["color", { vp: "EDGE_STROKE_UNSELECTED_PAINT", write: colorOut }],
|
|
477
|
+
["opacity", { vp: "EDGE_TRANSPARENCY", write: opacity255 }],
|
|
478
|
+
["width", { vp: "EDGE_WIDTH", write: desktopNumber }],
|
|
479
|
+
[
|
|
480
|
+
"lineStyle",
|
|
481
|
+
{
|
|
482
|
+
vp: "EDGE_LINE_TYPE",
|
|
483
|
+
write: enumOut(DESKTOP_LINES, nearIn(DESKTOP_LINES, NEAR_LINES), true, CY_OTHER_LINES)
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"sourceArrow",
|
|
488
|
+
{
|
|
489
|
+
vp: "EDGE_SOURCE_ARROW_SHAPE",
|
|
490
|
+
write: enumOut(DESKTOP_ARROWS, nearIn(DESKTOP_ARROWS, NEAR_ARROWS), true, CY_OTHER_ARROWS)
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
[
|
|
494
|
+
"targetArrow",
|
|
495
|
+
{
|
|
496
|
+
vp: "EDGE_TARGET_ARROW_SHAPE",
|
|
497
|
+
write: enumOut(DESKTOP_ARROWS, nearIn(DESKTOP_ARROWS, NEAR_ARROWS), true, CY_OTHER_ARROWS)
|
|
498
|
+
}
|
|
499
|
+
],
|
|
500
|
+
["sourceArrowColor", { vp: "EDGE_SOURCE_ARROW_UNSELECTED_PAINT", write: colorOut }],
|
|
501
|
+
["targetArrowColor", { vp: "EDGE_TARGET_ARROW_UNSELECTED_PAINT", write: colorOut }],
|
|
502
|
+
["curved", { vp: "EDGE_CURVED", write: desktopBool }],
|
|
503
|
+
["label", { vp: "EDGE_LABEL", write: textOut }],
|
|
504
|
+
["labelColor", { vp: "EDGE_LABEL_COLOR", write: colorOut }],
|
|
505
|
+
["labelSize", { vp: "EDGE_LABEL_FONT_SIZE", write: desktopNumber }],
|
|
506
|
+
["tooltip", { vp: "EDGE_TOOLTIP", write: textOut }],
|
|
507
|
+
["visible", { vp: "EDGE_VISIBLE", write: desktopBool }]
|
|
508
|
+
])
|
|
509
|
+
},
|
|
510
|
+
cx2: {
|
|
511
|
+
node: /* @__PURE__ */ new Map([
|
|
512
|
+
["fill", { vp: "NODE_BACKGROUND_COLOR", write: colorOut }],
|
|
513
|
+
["fillOpacity", { vp: "NODE_BACKGROUND_OPACITY", write: cx2Number }],
|
|
514
|
+
["borderColor", { vp: "NODE_BORDER_COLOR", write: colorOut }],
|
|
515
|
+
["borderWidth", { vp: "NODE_BORDER_WIDTH", write: cx2Number }],
|
|
516
|
+
[
|
|
517
|
+
"borderStyle",
|
|
518
|
+
{
|
|
519
|
+
vp: "NODE_BORDER_STYLE",
|
|
520
|
+
write: enumOut(CX2_LINES, nearIn(CX2_LINES, NEAR_LINES), false, CY_OTHER_BORDERS)
|
|
521
|
+
}
|
|
522
|
+
],
|
|
523
|
+
[
|
|
524
|
+
"shape",
|
|
525
|
+
{
|
|
526
|
+
vp: "NODE_SHAPE",
|
|
527
|
+
write: enumOut(lower(DESKTOP_SHAPES), nearIn(lower(DESKTOP_SHAPES), NEAR_SHAPES), false)
|
|
528
|
+
}
|
|
529
|
+
],
|
|
530
|
+
["width", { vp: "NODE_WIDTH", write: cx2Number }],
|
|
531
|
+
["height", { vp: "NODE_HEIGHT", write: cx2Number }],
|
|
532
|
+
["label", { vp: "NODE_LABEL", write: textOut }],
|
|
533
|
+
["labelColor", { vp: "NODE_LABEL_COLOR", write: colorOut }],
|
|
534
|
+
["labelSize", { vp: "NODE_LABEL_FONT_SIZE", write: cx2Number }],
|
|
535
|
+
["labelPosition", { vp: "NODE_LABEL_POSITION", write: cx2Position }],
|
|
536
|
+
["visible", { vp: "NODE_VISIBILITY", write: (v) => v === true ? "element" : "none" }]
|
|
537
|
+
]),
|
|
538
|
+
edge: /* @__PURE__ */ new Map([
|
|
539
|
+
["color", { vp: "EDGE_LINE_COLOR", write: colorOut }],
|
|
540
|
+
["opacity", { vp: "EDGE_OPACITY", write: cx2Number }],
|
|
541
|
+
["width", { vp: "EDGE_WIDTH", write: cx2Number }],
|
|
542
|
+
[
|
|
543
|
+
"lineStyle",
|
|
544
|
+
{
|
|
545
|
+
vp: "EDGE_LINE_STYLE",
|
|
546
|
+
write: enumOut(CX2_LINES, nearIn(CX2_LINES, NEAR_LINES), false, CY_OTHER_LINES)
|
|
547
|
+
}
|
|
548
|
+
],
|
|
549
|
+
[
|
|
550
|
+
"sourceArrow",
|
|
551
|
+
{
|
|
552
|
+
vp: "EDGE_SOURCE_ARROW_SHAPE",
|
|
553
|
+
write: enumOut(CX2_ARROWS, nearIn(CX2_ARROWS, NEAR_ARROWS), false, CY_OTHER_ARROWS)
|
|
554
|
+
}
|
|
555
|
+
],
|
|
556
|
+
[
|
|
557
|
+
"targetArrow",
|
|
558
|
+
{
|
|
559
|
+
vp: "EDGE_TARGET_ARROW_SHAPE",
|
|
560
|
+
write: enumOut(CX2_ARROWS, nearIn(CX2_ARROWS, NEAR_ARROWS), false, CY_OTHER_ARROWS)
|
|
561
|
+
}
|
|
562
|
+
],
|
|
563
|
+
["sourceArrowColor", { vp: "EDGE_SOURCE_ARROW_COLOR", write: colorOut }],
|
|
564
|
+
["targetArrowColor", { vp: "EDGE_TARGET_ARROW_COLOR", write: colorOut }],
|
|
565
|
+
["curved", { vp: "EDGE_CURVED", write: (v) => v === true }],
|
|
566
|
+
["label", { vp: "EDGE_LABEL", write: textOut }],
|
|
567
|
+
["labelColor", { vp: "EDGE_LABEL_COLOR", write: colorOut }],
|
|
568
|
+
["labelSize", { vp: "EDGE_LABEL_FONT_SIZE", write: cx2Number }],
|
|
569
|
+
["visible", { vp: "EDGE_VISIBILITY", write: (v) => v === true ? "element" : "none" }]
|
|
570
|
+
])
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
function cx2Position(v) {
|
|
574
|
+
const [h, vert] = Object.hasOwn(CX2_ANCHORS, String(v)) ? CX2_ANCHORS[String(v)] : ["center", "center"];
|
|
575
|
+
return {
|
|
576
|
+
HORIZONTAL_ALIGN: "center",
|
|
577
|
+
VERTICAL_ALIGN: "center",
|
|
578
|
+
HORIZONTAL_ANCHOR: h,
|
|
579
|
+
VERTICAL_ANCHOR: vert,
|
|
580
|
+
MARGIN_X: 0,
|
|
581
|
+
MARGIN_Y: 0,
|
|
582
|
+
JUSTIFICATION: "center"
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
const FONT_PROPS = ["labelFont", "labelWeight", "labelItalic"];
|
|
586
|
+
const FONT_VP = { node: "NODE_LABEL_FONT_FACE", edge: "EDGE_LABEL_FONT_FACE" };
|
|
587
|
+
const CSS_TO_JAVA = {
|
|
588
|
+
"sans-serif": "SansSerif",
|
|
589
|
+
serif: "Serif",
|
|
590
|
+
monospace: "Monospaced"
|
|
591
|
+
};
|
|
592
|
+
function fontOut(dialect, family, weight, italic, approx) {
|
|
593
|
+
const bold = weight === "bold";
|
|
594
|
+
const it = italic === true;
|
|
595
|
+
const fam = family === null ? "sans-serif" : String(family);
|
|
596
|
+
if (dialect === "cx2") {
|
|
597
|
+
if (fontReadsAs(fam) !== fam) {
|
|
598
|
+
approx();
|
|
599
|
+
}
|
|
600
|
+
return { FONT_FAMILY: fam, FONT_STYLE: it ? "italic" : "normal", FONT_WEIGHT: bold ? "bold" : "normal" };
|
|
601
|
+
}
|
|
602
|
+
const first = fam.includes(",") ? fam.split(",")[0].trim() : fam;
|
|
603
|
+
const java = Object.hasOwn(CSS_TO_JAVA, first) ? CSS_TO_JAVA[first] : first;
|
|
604
|
+
if (fontReadsAs(java) !== fam) {
|
|
605
|
+
approx();
|
|
606
|
+
}
|
|
607
|
+
return `${java},${javaFontStyle(bold, it)},12`;
|
|
608
|
+
}
|
|
609
|
+
function javaFontStyle(bold, italic) {
|
|
610
|
+
if (!bold && !italic) {
|
|
611
|
+
return "plain";
|
|
612
|
+
}
|
|
613
|
+
return (bold ? "bold" : "") + (italic ? "italic" : "");
|
|
614
|
+
}
|
|
615
|
+
function fontReadsAs(name) {
|
|
616
|
+
const family = name.replace(/\.(?:bold|italic|plain|bolditalic)$/i, "");
|
|
617
|
+
return JAVA_FONTS.get(family.toLowerCase()) ?? family;
|
|
618
|
+
}
|
|
619
|
+
function defaultColumnName(target, ref) {
|
|
620
|
+
if ("style" in ref) {
|
|
621
|
+
return `graphty.style.${target}.${ref.style}`;
|
|
622
|
+
}
|
|
623
|
+
return `graphty.style.${target}.${"computed" in ref ? ref.computed : ref.data}`;
|
|
624
|
+
}
|
|
625
|
+
const PASSTHROUGH_SAFE = /* @__PURE__ */ new Set(["color", "number", "text", "boolean"]);
|
|
626
|
+
function emitCytoscapeStyle(extracted, snapshot, options) {
|
|
627
|
+
const notes = options.notes ?? new StyleNotes();
|
|
628
|
+
const style = emptyCytoscapeStyle();
|
|
629
|
+
const bypasses = {
|
|
630
|
+
node: new Array(snapshot.nodeCount).fill(null),
|
|
631
|
+
edge: new Array(snapshot.edgeCount).fill(null)
|
|
632
|
+
};
|
|
633
|
+
const columns = {
|
|
634
|
+
node: /* @__PURE__ */ new Map(),
|
|
635
|
+
edge: /* @__PURE__ */ new Map()
|
|
636
|
+
};
|
|
637
|
+
for (const target of ["node", "edge"]) {
|
|
638
|
+
emitTarget(targetEmit(target, extracted, snapshot, options, notes), style, bypasses[target], columns[target]);
|
|
639
|
+
}
|
|
640
|
+
const bg = extracted.styles.graph.background;
|
|
641
|
+
if (bg !== void 0) {
|
|
642
|
+
style.network.defaults.set(
|
|
643
|
+
options.dialect === "cx2" ? "NETWORK_BACKGROUND_COLOR" : "NETWORK_BACKGROUND_PAINT",
|
|
644
|
+
bg.toUpperCase()
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
return { style, bypasses, columns };
|
|
648
|
+
}
|
|
649
|
+
function targetEmit(target, extracted, snapshot, options, notes) {
|
|
650
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
651
|
+
const src = refSource(target, n, extracted.columns[target], extracted.features[target], snapshot);
|
|
652
|
+
const rules = extracted.styles.rules.filter((r) => r.target === target);
|
|
653
|
+
const written = new Set(rules.flatMap((r) => [...Object.keys(r.set ?? {}), ...Object.keys(r.map ?? {})]));
|
|
654
|
+
const truth = new Map(Array.from(written, (p) => [p, resolveRules(rules, target, p, src)]));
|
|
655
|
+
return {
|
|
656
|
+
target,
|
|
657
|
+
extracted,
|
|
658
|
+
snapshot,
|
|
659
|
+
options,
|
|
660
|
+
notes,
|
|
661
|
+
n,
|
|
662
|
+
src,
|
|
663
|
+
rules,
|
|
664
|
+
truth,
|
|
665
|
+
approx: (p) => () => {
|
|
666
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, target, p);
|
|
667
|
+
},
|
|
668
|
+
// a default written as an approximation changes every element that draws it
|
|
669
|
+
approxDefault: (p, value) => () => {
|
|
670
|
+
const count = (truth.get(p) ?? []).filter((v) => v === value).length;
|
|
671
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, target, p, { count: Math.max(count, 1) });
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function emitTarget(e, style, bypasses, columns) {
|
|
676
|
+
const { target, notes, truth } = e;
|
|
677
|
+
const writers = WRITERS[e.options.dialect][target];
|
|
678
|
+
for (const [p, values] of truth) {
|
|
679
|
+
if (!writers.has(p) && !FONT_PROPS.includes(p)) {
|
|
680
|
+
const count = values.filter((v) => v !== null).length;
|
|
681
|
+
notes.add(STYLE_ISSUE.NOT_WRITTEN, target, p, { count: Math.max(count, 1) });
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
const counted = /* @__PURE__ */ new Set();
|
|
685
|
+
const carrying = (p) => {
|
|
686
|
+
if (counted.has(p)) {
|
|
687
|
+
return 0;
|
|
688
|
+
}
|
|
689
|
+
counted.add(p);
|
|
690
|
+
return Math.max((truth.get(p) ?? []).filter((v) => v !== null).length, 1);
|
|
691
|
+
};
|
|
692
|
+
const model = buildModel(target, e.rules, writers, notes, carrying);
|
|
693
|
+
const s = style[target];
|
|
694
|
+
s.dependencies.set(target === "node" ? "nodeSizeLocked" : "arrowColorMatchesEdge", false);
|
|
695
|
+
for (const [p, w] of writers) {
|
|
696
|
+
if (truth.has(p)) {
|
|
697
|
+
emitProperty(e, s, model, p, w, columns, carrying);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
addBypasses(e, model, writers, bypasses);
|
|
701
|
+
emitFont(e, model, s, bypasses);
|
|
702
|
+
}
|
|
703
|
+
function emitProperty(e, s, model, p, w, columns, carrying) {
|
|
704
|
+
const set = model.set.get(p);
|
|
705
|
+
if (set !== void 0) {
|
|
706
|
+
s.defaults.set(w.vp, w.write(set, e.approxDefault(p, set)));
|
|
707
|
+
}
|
|
708
|
+
let m = model.map.get(p);
|
|
709
|
+
if (m === void 0) {
|
|
710
|
+
return;
|
|
711
|
+
}
|
|
712
|
+
if (e.options.dialect === "cx2" && m.kind === "continuous") {
|
|
713
|
+
m = cx2Points(m, e.approx(p));
|
|
714
|
+
model.map.set(p, m);
|
|
715
|
+
}
|
|
716
|
+
const cm = cytoscapeMapping(e, p, m, w, columns);
|
|
717
|
+
if (cm === null) {
|
|
718
|
+
e.notes.add(STYLE_ISSUE.LAYER_FLATTENED, e.target, p, { sample: model.mappedBy.get(p), count: carrying(p) });
|
|
719
|
+
model.map.delete(p);
|
|
720
|
+
} else {
|
|
721
|
+
s.mappings.set(w.vp, cm);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function addBypasses(e, model, writers, bypasses) {
|
|
725
|
+
const { target } = e;
|
|
726
|
+
const modelRules = [
|
|
727
|
+
{
|
|
728
|
+
id: "defaults",
|
|
729
|
+
target,
|
|
730
|
+
role: "defaults",
|
|
731
|
+
origin: "declared",
|
|
732
|
+
where: { all: true },
|
|
733
|
+
set: Object.fromEntries(model.set)
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
id: "mappings",
|
|
737
|
+
target,
|
|
738
|
+
role: "mapping",
|
|
739
|
+
origin: "declared",
|
|
740
|
+
where: { all: true },
|
|
741
|
+
map: Object.fromEntries(model.map)
|
|
742
|
+
}
|
|
743
|
+
];
|
|
744
|
+
for (const [p, w] of writers) {
|
|
745
|
+
const want = e.truth.get(p);
|
|
746
|
+
if (want === void 0) {
|
|
747
|
+
continue;
|
|
748
|
+
}
|
|
749
|
+
const drawn = resolveRules(modelRules, target, p, e.src);
|
|
750
|
+
for (let i = 0; i < e.n; i++) {
|
|
751
|
+
const v = want[i];
|
|
752
|
+
if (v !== null && v !== drawn[i]) {
|
|
753
|
+
bypasses[i] ??= /* @__PURE__ */ new Map();
|
|
754
|
+
bypasses[i]?.set(w.vp, w.write(v, e.approx(p)));
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
function buildModel(target, rules, writers, notes, carrying) {
|
|
760
|
+
const model = { set: /* @__PURE__ */ new Map(), map: /* @__PURE__ */ new Map(), mappedBy: /* @__PURE__ */ new Map() };
|
|
761
|
+
const flatten = (p, id) => {
|
|
762
|
+
notes.add(STYLE_ISSUE.LAYER_FLATTENED, target, p, { sample: id, count: carrying(p) });
|
|
763
|
+
};
|
|
764
|
+
const holds = (p) => writers.has(p) || FONT_PROPS.includes(p);
|
|
765
|
+
const applySet = (r, all) => {
|
|
766
|
+
for (const [p, v] of Object.entries(r.set ?? {})) {
|
|
767
|
+
if (v === void 0 || !holds(p)) {
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
if (!all) {
|
|
771
|
+
flatten(p, r.id);
|
|
772
|
+
continue;
|
|
773
|
+
}
|
|
774
|
+
model.set.set(p, v);
|
|
775
|
+
model.map.delete(p);
|
|
776
|
+
model.mappedBy.delete(p);
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
const applyMap = (r, all) => {
|
|
780
|
+
for (const [p, m] of Object.entries(r.map ?? {})) {
|
|
781
|
+
if (m === void 0 || !holds(p)) {
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (!all || FONT_PROPS.includes(p)) {
|
|
785
|
+
flatten(p, r.id);
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
const below = model.mappedBy.get(p);
|
|
789
|
+
if (below !== void 0) {
|
|
790
|
+
flatten(p, below);
|
|
791
|
+
}
|
|
792
|
+
model.map.set(p, m);
|
|
793
|
+
model.mappedBy.set(p, r.id);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
for (const r of rules) {
|
|
797
|
+
const all = "all" in r.where && r.where.all;
|
|
798
|
+
applySet(r, all);
|
|
799
|
+
applyMap(r, all);
|
|
800
|
+
}
|
|
801
|
+
return model;
|
|
802
|
+
}
|
|
803
|
+
function cytoscapeMapping(e, p, m, w, columns) {
|
|
804
|
+
const column = mappingColumn(e, m.by, columns);
|
|
805
|
+
if (column === null) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
const approx = e.approx(p);
|
|
809
|
+
const write = (v) => w.write(v, approx);
|
|
810
|
+
if (m.kind === "passthrough") {
|
|
811
|
+
return passthroughMapping(e, p, m.by, column, write);
|
|
812
|
+
}
|
|
813
|
+
if (m.kind === "discrete") {
|
|
814
|
+
return {
|
|
815
|
+
kind: "discrete",
|
|
816
|
+
column,
|
|
817
|
+
type: typeOf(m.table.map(([k]) => k)),
|
|
818
|
+
table: m.table.map(([k, v]) => [k, write(v)])
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
if (m.kind === "continuous") {
|
|
822
|
+
const points = m.points.map((pt) => ({
|
|
823
|
+
at: pt.at,
|
|
824
|
+
below: write(pt.below),
|
|
825
|
+
value: write(pt.value),
|
|
826
|
+
above: write(pt.above)
|
|
827
|
+
}));
|
|
828
|
+
return { kind: "continuous", column, type: "double", points };
|
|
829
|
+
}
|
|
830
|
+
return null;
|
|
831
|
+
}
|
|
832
|
+
function mappingColumn(e, ref, columns) {
|
|
833
|
+
if ("data" in ref) {
|
|
834
|
+
return ref.data;
|
|
835
|
+
}
|
|
836
|
+
const { target } = e;
|
|
837
|
+
const column = (e.options.columnName ?? defaultColumnName)(target, ref);
|
|
838
|
+
let values = null;
|
|
839
|
+
if ("style" in ref) {
|
|
840
|
+
values = e.extracted.columns[target].get(ref.style) ?? null;
|
|
841
|
+
} else if ("computed" in ref && target === "node") {
|
|
842
|
+
values = degreeValues(e.snapshot, ref.computed);
|
|
843
|
+
}
|
|
844
|
+
if (values === null) {
|
|
845
|
+
return null;
|
|
846
|
+
}
|
|
847
|
+
columns.set(column, values);
|
|
848
|
+
return column;
|
|
849
|
+
}
|
|
850
|
+
function passthroughMapping(e, p, by, column, write) {
|
|
851
|
+
const { target } = e;
|
|
852
|
+
const kind = STYLE_PROPERTIES[target].get(p) ?? "";
|
|
853
|
+
const cells = e.src.column(by) ?? [];
|
|
854
|
+
if (PASSTHROUGH_SAFE.has(kind)) {
|
|
855
|
+
return { kind: "passthrough", column, type: typeOf(Array.from(cells)) };
|
|
856
|
+
}
|
|
857
|
+
const read = "style" in by ? (v) => isScalar(v) ? v : null : canonicalFor(target, p);
|
|
858
|
+
const seen = /* @__PURE__ */ new Map();
|
|
859
|
+
for (let i = 0; i < cells.length; i++) {
|
|
860
|
+
const raw = cells[i];
|
|
861
|
+
const v = isScalar(raw) && !seen.has(raw) ? read(raw) : null;
|
|
862
|
+
if (v !== null) {
|
|
863
|
+
seen.set(raw, write(v));
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const table = Array.from(seen);
|
|
867
|
+
return { kind: "discrete", column, type: typeOf(table.map(([k]) => k)), table };
|
|
868
|
+
}
|
|
869
|
+
function cx2Points(m, approx) {
|
|
870
|
+
let changed = false;
|
|
871
|
+
const points = m.points.map((pt) => {
|
|
872
|
+
if (pt.value === pt.below || pt.value === pt.above) {
|
|
873
|
+
return pt;
|
|
874
|
+
}
|
|
875
|
+
changed = true;
|
|
876
|
+
return { ...pt, value: pt.below };
|
|
877
|
+
});
|
|
878
|
+
if (!changed) {
|
|
879
|
+
return m;
|
|
880
|
+
}
|
|
881
|
+
approx();
|
|
882
|
+
return { ...m, points };
|
|
883
|
+
}
|
|
884
|
+
function isScalar(v) {
|
|
885
|
+
return typeof v === "string" || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v);
|
|
886
|
+
}
|
|
887
|
+
function typeOf(values) {
|
|
888
|
+
let numbers = 0;
|
|
889
|
+
let integers = 0;
|
|
890
|
+
let booleans = 0;
|
|
891
|
+
let all = 0;
|
|
892
|
+
for (const v of values) {
|
|
893
|
+
if (v === null || v === void 0) {
|
|
894
|
+
continue;
|
|
895
|
+
}
|
|
896
|
+
all++;
|
|
897
|
+
if (typeof v === "number") {
|
|
898
|
+
numbers++;
|
|
899
|
+
if (Number.isInteger(v)) {
|
|
900
|
+
integers++;
|
|
901
|
+
}
|
|
902
|
+
} else if (typeof v === "boolean") {
|
|
903
|
+
booleans++;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
if (all > 0 && numbers === all) {
|
|
907
|
+
return integers === all ? "integer" : "double";
|
|
908
|
+
}
|
|
909
|
+
if (all > 0 && booleans === all) {
|
|
910
|
+
return "boolean";
|
|
911
|
+
}
|
|
912
|
+
return "string";
|
|
913
|
+
}
|
|
914
|
+
function emitFont(e, model, s, bypasses) {
|
|
915
|
+
const { target, truth, n, approx, approxDefault } = e;
|
|
916
|
+
const { dialect } = e.options;
|
|
917
|
+
if (!FONT_PROPS.some((p) => truth.has(p))) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
const [fd, wd, id] = FONT_PROPS.map((p) => model.set.get(p) ?? null);
|
|
921
|
+
const vp = FONT_VP[target];
|
|
922
|
+
if (fd !== null || wd !== null || id !== null) {
|
|
923
|
+
s.defaults.set(
|
|
924
|
+
vp,
|
|
925
|
+
fontOut(dialect, fd, wd, id, fd === null ? approx("labelFont") : approxDefault("labelFont", fd))
|
|
926
|
+
);
|
|
927
|
+
}
|
|
928
|
+
const [ft, wt, it] = FONT_PROPS.map((p) => truth.get(p) ?? null);
|
|
929
|
+
for (let i = 0; i < n; i++) {
|
|
930
|
+
const f = ft?.[i] ?? null;
|
|
931
|
+
const w = wt?.[i] ?? null;
|
|
932
|
+
const t = it?.[i] ?? null;
|
|
933
|
+
const differs = f !== null && f !== fd || w !== null && w !== wd || t !== null && t !== id;
|
|
934
|
+
if (differs) {
|
|
935
|
+
bypasses[i] ??= /* @__PURE__ */ new Map();
|
|
936
|
+
bypasses[i]?.set(vp, fontOut(dialect, f ?? fd, w ?? wd, t ?? id, approx("labelFont")));
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
function defText(v) {
|
|
941
|
+
return String(v).replaceAll(",", ",,");
|
|
942
|
+
}
|
|
943
|
+
function cx1Definition(m) {
|
|
944
|
+
const parts = [`COL=${defText(m.column)}`, `T=${m.type ?? "string"}`];
|
|
945
|
+
if (m.kind === "discrete") {
|
|
946
|
+
m.table.forEach(([k, v], i) => {
|
|
947
|
+
parts.push(`K=${i}=${defText(k)}`, `V=${i}=${defText(v)}`);
|
|
948
|
+
});
|
|
949
|
+
} else if (m.kind === "continuous") {
|
|
950
|
+
m.points.forEach((p, i) => {
|
|
951
|
+
parts.push(
|
|
952
|
+
`L=${i}=${defText(p.below)}`,
|
|
953
|
+
`E=${i}=${defText(p.value)}`,
|
|
954
|
+
`G=${i}=${defText(p.above)}`,
|
|
955
|
+
`OV=${i}=${p.at}`
|
|
956
|
+
);
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
return parts.join(",");
|
|
960
|
+
}
|
|
961
|
+
function recordOf(map, value) {
|
|
962
|
+
const out = {};
|
|
963
|
+
for (const [k, v] of map) {
|
|
964
|
+
Object.defineProperty(out, k, { value: value(v), enumerable: true, writable: true, configurable: true });
|
|
965
|
+
}
|
|
966
|
+
return out;
|
|
967
|
+
}
|
|
968
|
+
function cytoscapeCxAspect(style) {
|
|
969
|
+
const entry = (of, t) => ({
|
|
970
|
+
properties_of: of,
|
|
971
|
+
properties: recordOf(t.defaults, String),
|
|
972
|
+
dependencies: recordOf(t.dependencies, String),
|
|
973
|
+
mappings: recordOf(t.mappings, (m) => ({ type: m.kind.toUpperCase(), definition: cx1Definition(m) }))
|
|
974
|
+
});
|
|
975
|
+
return [
|
|
976
|
+
{ properties_of: "network", properties: recordOf(style.network.defaults, String) },
|
|
977
|
+
entry("nodes:default", style.node),
|
|
978
|
+
entry("edges:default", style.edge)
|
|
979
|
+
];
|
|
980
|
+
}
|
|
981
|
+
function cx2Intervals(points) {
|
|
982
|
+
const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
983
|
+
const out = [];
|
|
984
|
+
for (let i = 0; i <= points.length; i++) {
|
|
985
|
+
const lo = points.at(i - 1);
|
|
986
|
+
const hi = points.at(i);
|
|
987
|
+
const iv = {};
|
|
988
|
+
if (i > 0 && lo !== void 0) {
|
|
989
|
+
iv.min = lo.at;
|
|
990
|
+
iv.minVPValue = lo.above;
|
|
991
|
+
iv.includeMin = same(lo.value, lo.above);
|
|
992
|
+
}
|
|
993
|
+
if (i < points.length && hi !== void 0) {
|
|
994
|
+
iv.max = hi.at;
|
|
995
|
+
iv.maxVPValue = hi.below;
|
|
996
|
+
iv.includeMax = !same(hi.value, hi.above) && same(hi.value, hi.below);
|
|
997
|
+
}
|
|
998
|
+
out.push(iv);
|
|
999
|
+
}
|
|
1000
|
+
return out;
|
|
1001
|
+
}
|
|
1002
|
+
function cytoscapeCx2Aspects(style) {
|
|
1003
|
+
const mapping = (m) => {
|
|
1004
|
+
if (m.kind === "passthrough") {
|
|
1005
|
+
return { type: "PASSTHROUGH", definition: { attribute: m.column } };
|
|
1006
|
+
}
|
|
1007
|
+
if (m.kind === "discrete") {
|
|
1008
|
+
return {
|
|
1009
|
+
type: "DISCRETE",
|
|
1010
|
+
definition: { attribute: m.column, map: m.table.map(([v, vp]) => ({ v, vp })) }
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
return { type: "CONTINUOUS", definition: { attribute: m.column, map: cx2Intervals(m.points) } };
|
|
1014
|
+
};
|
|
1015
|
+
const id = (v) => v;
|
|
1016
|
+
return {
|
|
1017
|
+
visualProperties: [
|
|
1018
|
+
{
|
|
1019
|
+
default: {
|
|
1020
|
+
network: recordOf(style.network.defaults, id),
|
|
1021
|
+
node: recordOf(style.node.defaults, id),
|
|
1022
|
+
edge: recordOf(style.edge.defaults, id)
|
|
1023
|
+
},
|
|
1024
|
+
nodeMapping: recordOf(style.node.mappings, mapping),
|
|
1025
|
+
edgeMapping: recordOf(style.edge.mappings, mapping)
|
|
1026
|
+
}
|
|
1027
|
+
],
|
|
1028
|
+
visualEditorProperties: [
|
|
1029
|
+
{
|
|
1030
|
+
properties: {
|
|
1031
|
+
nodeSizeLocked: style.node.dependencies.get("nodeSizeLocked") === true,
|
|
1032
|
+
arrowColorMatchesEdge: style.edge.dependencies.get("arrowColorMatchesEdge") === true
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
]
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
function attr(name, value) {
|
|
1039
|
+
return ` ${name}="${escapeXmlAttribute(String(value))}"`;
|
|
1040
|
+
}
|
|
1041
|
+
function cytoscapeVizmapXml(style, name) {
|
|
1042
|
+
const lines = [`<visualStyle${attr("name", name)}>`];
|
|
1043
|
+
const section = (tag, defaults, t) => {
|
|
1044
|
+
lines.push(` <${tag}>`);
|
|
1045
|
+
for (const [dep, on] of t?.dependencies ?? []) {
|
|
1046
|
+
lines.push(` <dependency${attr("name", dep)}${attr("value", on)}/>`);
|
|
1047
|
+
}
|
|
1048
|
+
const vps = /* @__PURE__ */ new Set([...defaults.keys(), ...t?.mappings.keys() ?? []]);
|
|
1049
|
+
for (const vp of vps) {
|
|
1050
|
+
const d = defaults.has(vp) ? attr("default", defaults.get(vp)) : "";
|
|
1051
|
+
const m = t?.mappings.get(vp);
|
|
1052
|
+
if (m === void 0) {
|
|
1053
|
+
lines.push(` <visualProperty${attr("name", vp)}${d}/>`);
|
|
1054
|
+
} else {
|
|
1055
|
+
lines.push(` <visualProperty${attr("name", vp)}${d}>`, ...mappingXml(m), " </visualProperty>");
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
lines.push(` </${tag}>`);
|
|
1059
|
+
};
|
|
1060
|
+
section("network", style.network.defaults);
|
|
1061
|
+
section("node", style.node.defaults, style.node);
|
|
1062
|
+
section("edge", style.edge.defaults, style.edge);
|
|
1063
|
+
lines.push("</visualStyle>");
|
|
1064
|
+
return lines.join("\n");
|
|
1065
|
+
}
|
|
1066
|
+
function mappingXml(m) {
|
|
1067
|
+
const head = `${attr("attributeName", m.column)}${attr("attributeType", m.kind === "continuous" ? "float" : m.type ?? "string")}`;
|
|
1068
|
+
if (m.kind === "passthrough") {
|
|
1069
|
+
return [` <passthroughMapping${head}/>`];
|
|
1070
|
+
}
|
|
1071
|
+
if (m.kind === "discrete") {
|
|
1072
|
+
return [
|
|
1073
|
+
` <discreteMapping${head}>`,
|
|
1074
|
+
...m.table.map(
|
|
1075
|
+
([k, v]) => ` <discreteMappingEntry${attr("attributeValue", k)}${attr("value", v)}/>`
|
|
1076
|
+
),
|
|
1077
|
+
" </discreteMapping>"
|
|
1078
|
+
];
|
|
1079
|
+
}
|
|
1080
|
+
return [
|
|
1081
|
+
` <continuousMapping${head}>`,
|
|
1082
|
+
...m.points.map(
|
|
1083
|
+
(p) => ` <continuousMappingPoint${attr("attrValue", p.at)}${attr("lesserValue", p.below)}${attr("equalValue", p.value)}${attr("greaterValue", p.above)}/>`
|
|
1084
|
+
),
|
|
1085
|
+
" </continuousMapping>"
|
|
1086
|
+
];
|
|
1087
|
+
}
|
|
1088
|
+
function cytoscapeWritableProperties(target, dialect) {
|
|
1089
|
+
return [...WRITERS[dialect][target].keys(), ...FONT_PROPS];
|
|
1090
|
+
}
|
|
1091
|
+
function cytoscapeElementProperties(target, value, dialect, approx) {
|
|
1092
|
+
const out = /* @__PURE__ */ new Map();
|
|
1093
|
+
for (const [p, w] of WRITERS[dialect][target]) {
|
|
1094
|
+
const v = value(p);
|
|
1095
|
+
if (v !== null) {
|
|
1096
|
+
out.set(
|
|
1097
|
+
w.vp,
|
|
1098
|
+
w.write(v, () => {
|
|
1099
|
+
approx(p);
|
|
1100
|
+
})
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
const [f, wt, it] = FONT_PROPS.map((p) => value(p));
|
|
1105
|
+
if (f !== null || wt !== null || it !== null) {
|
|
1106
|
+
out.set(
|
|
1107
|
+
FONT_VP[target],
|
|
1108
|
+
fontOut(dialect, f, wt, it, () => {
|
|
1109
|
+
approx("labelFont");
|
|
1110
|
+
})
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
return out;
|
|
1114
|
+
}
|
|
1115
|
+
const NODE_SIZE_FALLBACK = 50;
|
|
1116
|
+
function vpUsage(style, bypasses) {
|
|
1117
|
+
const bypassed = /* @__PURE__ */ new Set();
|
|
1118
|
+
for (const b of bypasses) {
|
|
1119
|
+
if (b) {
|
|
1120
|
+
for (const k of b.keys()) {
|
|
1121
|
+
bypassed.add(k);
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
for (const [from, to] of style.bypassAliases) {
|
|
1126
|
+
if (bypassed.has(from)) {
|
|
1127
|
+
bypassed.add(to);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
const used = /* @__PURE__ */ new Set([...style.defaults.keys(), ...style.mappings.keys(), ...bypassed]);
|
|
1131
|
+
return { used, bypassed };
|
|
1132
|
+
}
|
|
1133
|
+
function chooseVps(target, style, used) {
|
|
1134
|
+
const chosen = /* @__PURE__ */ new Map();
|
|
1135
|
+
for (const [prop, list] of CYTOSCAPE_LEXICON[target]) {
|
|
1136
|
+
const hit = list.find(([vp]) => used.has(vp));
|
|
1137
|
+
if (hit !== void 0) {
|
|
1138
|
+
chosen.set(prop, hit);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
if (target === "node" && style.dependencies.get("nodeSizeLocked") === true) {
|
|
1142
|
+
chosen.delete("width");
|
|
1143
|
+
chosen.delete("height");
|
|
1144
|
+
}
|
|
1145
|
+
if (target === "edge" && style.dependencies.get("arrowColorMatchesEdge") === true) {
|
|
1146
|
+
if (used.has("EDGE_UNSELECTED_PAINT")) {
|
|
1147
|
+
chosen.set("color", ["EDGE_UNSELECTED_PAINT", colorParser]);
|
|
1148
|
+
}
|
|
1149
|
+
chosen.delete("sourceArrowColor");
|
|
1150
|
+
chosen.delete("targetArrowColor");
|
|
1151
|
+
}
|
|
1152
|
+
return chosen;
|
|
1153
|
+
}
|
|
1154
|
+
function parseMapping(m, parse, site) {
|
|
1155
|
+
switch (m.kind) {
|
|
1156
|
+
case "passthrough":
|
|
1157
|
+
return { kind: "passthrough", column: m.column };
|
|
1158
|
+
case "discrete": {
|
|
1159
|
+
const table = [];
|
|
1160
|
+
for (const [k, raw] of m.table) {
|
|
1161
|
+
const v = parse(raw, site);
|
|
1162
|
+
if (v !== null) {
|
|
1163
|
+
table.push([k, v]);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return { kind: "discrete", column: m.column, table };
|
|
1167
|
+
}
|
|
1168
|
+
default:
|
|
1169
|
+
return { kind: "continuous", column: m.column, points: parsePoints(m.points, parse, site) };
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
function parsePoints(raw, parse, site) {
|
|
1173
|
+
const parsed = [];
|
|
1174
|
+
for (const p of raw) {
|
|
1175
|
+
const below = parse(p.below, site);
|
|
1176
|
+
const value = parse(p.value, site);
|
|
1177
|
+
const above = parse(p.above, site);
|
|
1178
|
+
if (below !== null && value !== null && above !== null) {
|
|
1179
|
+
parsed.push({ at: p.at, below, value, above });
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
parsed.sort((a, b) => a.at - b.at);
|
|
1183
|
+
const points = [];
|
|
1184
|
+
for (const p of parsed) {
|
|
1185
|
+
if (points.at(-1)?.at === p.at) {
|
|
1186
|
+
points[points.length - 1] = p;
|
|
1187
|
+
} else {
|
|
1188
|
+
points.push(p);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
return points;
|
|
1192
|
+
}
|
|
1193
|
+
function evalMapping(m, value, parse, site) {
|
|
1194
|
+
if (value === null || value === void 0) {
|
|
1195
|
+
return null;
|
|
1196
|
+
}
|
|
1197
|
+
switch (m.kind) {
|
|
1198
|
+
case "passthrough":
|
|
1199
|
+
return Array.isArray(value) ? null : parse(value, site);
|
|
1200
|
+
case "discrete": {
|
|
1201
|
+
const j = discreteLookup(m.table)(value);
|
|
1202
|
+
return j < 0 ? null : m.table[j][1];
|
|
1203
|
+
}
|
|
1204
|
+
default:
|
|
1205
|
+
return evalContinuous(m.points, numberOf(value));
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
function resolver(target, style, elements, notes, budget) {
|
|
1209
|
+
const bypasses = elements.bypasses ?? [];
|
|
1210
|
+
const parsed = /* @__PURE__ */ new Map();
|
|
1211
|
+
const ruleSite = (property) => ({ notes, target, property, budget });
|
|
1212
|
+
const bypass = (i, vp) => {
|
|
1213
|
+
const b = bypasses[i];
|
|
1214
|
+
if (!b) {
|
|
1215
|
+
return void 0;
|
|
1216
|
+
}
|
|
1217
|
+
const v = b.get(vp);
|
|
1218
|
+
if (v !== void 0 && v !== null) {
|
|
1219
|
+
return v;
|
|
1220
|
+
}
|
|
1221
|
+
for (const [from, to] of style.bypassAliases) {
|
|
1222
|
+
if (to === vp && !b.has(to)) {
|
|
1223
|
+
return b.get(from);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
return void 0;
|
|
1227
|
+
};
|
|
1228
|
+
const mappingOf = (vp, parse, property) => {
|
|
1229
|
+
const raw = style.mappings.get(vp);
|
|
1230
|
+
if (raw === void 0) {
|
|
1231
|
+
return void 0;
|
|
1232
|
+
}
|
|
1233
|
+
const key = `${vp}\0${property}`;
|
|
1234
|
+
let m = parsed.get(key);
|
|
1235
|
+
if (m === void 0) {
|
|
1236
|
+
const entries = raw.kind === "discrete" ? raw.table.length : 0;
|
|
1237
|
+
budget?.spend(target, 1 + entries + (raw.kind === "continuous" ? raw.points.length : 0));
|
|
1238
|
+
m = parseMapping(raw, parse, ruleSite(property));
|
|
1239
|
+
parsed.set(key, m);
|
|
1240
|
+
}
|
|
1241
|
+
return m;
|
|
1242
|
+
};
|
|
1243
|
+
const one = (vp, parse, property, i) => {
|
|
1244
|
+
const site = { notes, target, property, element: i, budget };
|
|
1245
|
+
const b = bypass(i, vp);
|
|
1246
|
+
const fromBypass = b === void 0 || b === null ? null : parse(b, site);
|
|
1247
|
+
if (fromBypass !== null) {
|
|
1248
|
+
return fromBypass;
|
|
1249
|
+
}
|
|
1250
|
+
const m = mappingOf(vp, parse, property);
|
|
1251
|
+
const mapped = m === void 0 ? null : evalMapping(m, elements.value(m.column, i), parse, site);
|
|
1252
|
+
if (mapped !== null) {
|
|
1253
|
+
return mapped;
|
|
1254
|
+
}
|
|
1255
|
+
return style.defaults.has(vp) ? parse(style.defaults.get(vp), ruleSite(property)) : null;
|
|
1256
|
+
};
|
|
1257
|
+
return { bypass, one };
|
|
1258
|
+
}
|
|
1259
|
+
function resolveCytoscape(target, style, elements, options = {}) {
|
|
1260
|
+
const notes = options.notes ?? new StyleNotes();
|
|
1261
|
+
const s = style[target];
|
|
1262
|
+
const n = elements.count;
|
|
1263
|
+
const { used, bypassed } = vpUsage(s, elements.bypasses ?? []);
|
|
1264
|
+
const chosen = chooseVps(target, s, used);
|
|
1265
|
+
const { one } = resolver(target, s, elements, notes, options.budget);
|
|
1266
|
+
const out = {};
|
|
1267
|
+
const column = (vp, parse, property) => {
|
|
1268
|
+
options.budget?.spend(target, n);
|
|
1269
|
+
const values = new Array(n);
|
|
1270
|
+
for (let i = 0; i < n; i++) {
|
|
1271
|
+
values[i] = one(vp, parse, property, i);
|
|
1272
|
+
}
|
|
1273
|
+
return values;
|
|
1274
|
+
};
|
|
1275
|
+
for (const [prop, [vp, parse]] of chosen) {
|
|
1276
|
+
out[prop] = column(vp, parse, prop);
|
|
1277
|
+
}
|
|
1278
|
+
if (target === "node" && s.dependencies.get("nodeSizeLocked") === true) {
|
|
1279
|
+
const size = column(NODE_SIZE_VP, sizeParser, "width").map((v) => v ?? NODE_SIZE_FALLBACK);
|
|
1280
|
+
out.width = size;
|
|
1281
|
+
out.height = size.slice();
|
|
1282
|
+
}
|
|
1283
|
+
if (target === "edge" && s.dependencies.get("arrowColorMatchesEdge") === true && out.color !== void 0) {
|
|
1284
|
+
out.sourceArrowColor = out.color.slice();
|
|
1285
|
+
out.targetArrowColor = out.color.slice();
|
|
1286
|
+
}
|
|
1287
|
+
noteUncarried(target, s, used, bypassed, notes);
|
|
1288
|
+
fillToolDefaults(target, out, n, options.defaults ?? null);
|
|
1289
|
+
if (target === "edge") {
|
|
1290
|
+
straightenBendless(out, one);
|
|
1291
|
+
}
|
|
1292
|
+
return out;
|
|
1293
|
+
}
|
|
1294
|
+
function straightenBendless(out, one) {
|
|
1295
|
+
const { curved } = out;
|
|
1296
|
+
if (curved !== void 0) {
|
|
1297
|
+
out.curved = curved.map((c, i) => c === true ? one(EDGE_BEND_VP, bendParser, "curved", i) === true : c);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
const EDGE_BEND_VP = "EDGE_BEND";
|
|
1301
|
+
const bendParser = (raw) => {
|
|
1302
|
+
if (typeof raw === "string") {
|
|
1303
|
+
const text = raw.trim();
|
|
1304
|
+
return text !== "" && text !== '""';
|
|
1305
|
+
}
|
|
1306
|
+
return Array.isArray(raw) ? raw.length > 0 : raw !== null && raw !== void 0 && typeof raw === "object";
|
|
1307
|
+
};
|
|
1308
|
+
const INERT_DEFAULT = /NullCustomGraphics|^255$|^0(?:\.0+)?$|^$|^C,C,c,0\.00,0\.00$|^false$/;
|
|
1309
|
+
function noteUncarried(target, s, used, bypassed, notes) {
|
|
1310
|
+
for (const vp of used) {
|
|
1311
|
+
if (!isUncarriedVp(vp)) {
|
|
1312
|
+
continue;
|
|
1313
|
+
}
|
|
1314
|
+
const d = s.defaults.get(vp);
|
|
1315
|
+
const text = typeof d === "string" || typeof d === "number" || typeof d === "boolean" ? String(d) : "";
|
|
1316
|
+
if (INERT_DEFAULT.test(text.slice(0, 64)) && !s.mappings.has(vp) && !bypassed.has(vp)) {
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
notes.add(STYLE_ISSUE.NOT_CARRIED, target, vp, { sample: text });
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
function fillToolDefaults(target, out, n, tool) {
|
|
1323
|
+
const d = tool === null ? null : toolDefaults(tool);
|
|
1324
|
+
if (d === null) {
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
for (const [prop, entry] of Object.entries(d[target])) {
|
|
1328
|
+
if (entry === void 0 || !isStyleValue(target, prop, entry.value)) {
|
|
1329
|
+
continue;
|
|
1330
|
+
}
|
|
1331
|
+
const value = entry.value;
|
|
1332
|
+
const values = out[prop] === void 0 ? new Array(n).fill(null) : out[prop].slice();
|
|
1333
|
+
for (let i = 0; i < n; i++) {
|
|
1334
|
+
values[i] ??= value;
|
|
1335
|
+
}
|
|
1336
|
+
out[prop] = values;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
function cytoscapeBackground(style, notes) {
|
|
1340
|
+
const d = style.network.defaults;
|
|
1341
|
+
const raw = d.get("NETWORK_BACKGROUND_PAINT") ?? d.get("NETWORK_BACKGROUND_COLOR");
|
|
1342
|
+
if (raw === void 0) {
|
|
1343
|
+
return null;
|
|
1344
|
+
}
|
|
1345
|
+
const v = colorParser(raw, { notes: notes ?? new StyleNotes(), target: "graph", property: "background" });
|
|
1346
|
+
return typeof v === "string" ? v : null;
|
|
1347
|
+
}
|
|
1348
|
+
function resolveCytoscapeBypasses(target, maps, options = {}) {
|
|
1349
|
+
const notes = options.notes ?? new StyleNotes();
|
|
1350
|
+
const style = emptyCytoscapeStyle();
|
|
1351
|
+
const elements = { count: maps.length, value: () => null, bypasses: maps };
|
|
1352
|
+
const out = resolveCytoscape(target, style, elements, { notes, budget: options.budget });
|
|
1353
|
+
if (target === "node" && out.width === void 0) {
|
|
1354
|
+
const size = maps.map((m) => {
|
|
1355
|
+
const raw = m?.get(NODE_SIZE_VP);
|
|
1356
|
+
return raw === void 0 ? null : sizeParser(raw, { notes, target, property: "width" });
|
|
1357
|
+
});
|
|
1358
|
+
if (size.some((v) => v !== null)) {
|
|
1359
|
+
out.width = size;
|
|
1360
|
+
out.height = size.slice();
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
for (const m of maps) {
|
|
1364
|
+
if (!m) {
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
for (const [k, v] of m) {
|
|
1368
|
+
if (k.startsWith("?")) {
|
|
1369
|
+
notes.add(STYLE_ISSUE.NOT_CARRIED, target, k.slice(1), { sample: v });
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
fillToolDefaults(target, out, maps.length, options.defaults ?? null);
|
|
1374
|
+
return out;
|
|
1375
|
+
}
|
|
1376
|
+
function cytoscapeRules(target, style, elements, options = {}) {
|
|
1377
|
+
const notes = options.notes ?? new StyleNotes();
|
|
1378
|
+
const refOf = options.columnRef ?? ((column) => ({ data: column }));
|
|
1379
|
+
const s = style[target];
|
|
1380
|
+
const { used } = vpUsage(s, elements.bypasses ?? []);
|
|
1381
|
+
const chosen = chooseVps(target, s, used);
|
|
1382
|
+
const site = (property) => ({ notes, target, property, budget: options.budget });
|
|
1383
|
+
const locked = target === "node" && s.dependencies.get("nodeSizeLocked") === true;
|
|
1384
|
+
const matched = target === "edge" && s.dependencies.get("arrowColorMatchesEdge") === true;
|
|
1385
|
+
const set = defaultValues(s, chosen, site, { locked, matched });
|
|
1386
|
+
const columns = /* @__PURE__ */ new Map();
|
|
1387
|
+
const byColumn = /* @__PURE__ */ new Map();
|
|
1388
|
+
const reading = { target, refOf, elements, columns, notes, budget: options.budget };
|
|
1389
|
+
const add = (props, raw, parse) => {
|
|
1390
|
+
const parsed = parseMapping(raw, parse, site(props[0]));
|
|
1391
|
+
const mapping = neutralMapping(parsed, props[0], parse, reading);
|
|
1392
|
+
const key = `${raw.kind}\0${raw.column}`;
|
|
1393
|
+
let rule = byColumn.get(key);
|
|
1394
|
+
if (rule === void 0) {
|
|
1395
|
+
rule = { id: `${target}.${raw.kind}.${raw.column}`, map: {} };
|
|
1396
|
+
byColumn.set(key, rule);
|
|
1397
|
+
}
|
|
1398
|
+
for (const p of props) {
|
|
1399
|
+
rule.map[p] = mapping;
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
for (const [prop, [vp, parse]] of chosen) {
|
|
1403
|
+
const raw = s.mappings.get(vp);
|
|
1404
|
+
if (raw !== void 0) {
|
|
1405
|
+
add(matched && prop === "color" ? ["color", "sourceArrowColor", "targetArrowColor"] : [prop], raw, parse);
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
const size = locked ? s.mappings.get(NODE_SIZE_VP) : void 0;
|
|
1409
|
+
if (size !== void 0) {
|
|
1410
|
+
add(["width", "height"], size, sizeParser);
|
|
1411
|
+
}
|
|
1412
|
+
const rules = [];
|
|
1413
|
+
if (Object.keys(set).length > 0) {
|
|
1414
|
+
rules.push({
|
|
1415
|
+
id: `${target}.defaults`,
|
|
1416
|
+
target,
|
|
1417
|
+
role: "defaults",
|
|
1418
|
+
origin: "declared",
|
|
1419
|
+
where: { all: true },
|
|
1420
|
+
set
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
for (const r of byColumn.values()) {
|
|
1424
|
+
rules.push({ id: r.id, target, role: "mapping", origin: "declared", where: { all: true }, map: r.map });
|
|
1425
|
+
}
|
|
1426
|
+
return { rules, columns };
|
|
1427
|
+
}
|
|
1428
|
+
function defaultValues(s, chosen, site, deps) {
|
|
1429
|
+
const set = {};
|
|
1430
|
+
for (const [prop, [vp, parse]] of chosen) {
|
|
1431
|
+
const v = s.defaults.has(vp) ? parse(s.defaults.get(vp), site(prop)) : null;
|
|
1432
|
+
if (v !== null) {
|
|
1433
|
+
set[prop] = v;
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
if (deps.locked) {
|
|
1437
|
+
const size = s.defaults.has(NODE_SIZE_VP) ? sizeParser(s.defaults.get(NODE_SIZE_VP), site("width")) : null;
|
|
1438
|
+
set.width = size ?? 50;
|
|
1439
|
+
set.height = size ?? 50;
|
|
1440
|
+
}
|
|
1441
|
+
if (deps.matched && set.color !== void 0) {
|
|
1442
|
+
set.sourceArrowColor = set.color;
|
|
1443
|
+
set.targetArrowColor = set.color;
|
|
1444
|
+
}
|
|
1445
|
+
if (set.curved === true && bendParser(s.defaults.get(EDGE_BEND_VP), site("curved")) !== true) {
|
|
1446
|
+
set.curved = false;
|
|
1447
|
+
}
|
|
1448
|
+
return set;
|
|
1449
|
+
}
|
|
1450
|
+
function neutralMapping(m, property, parse, reading) {
|
|
1451
|
+
const { target, elements, columns, notes, budget } = reading;
|
|
1452
|
+
const by = reading.refOf(m.column);
|
|
1453
|
+
if (m.kind === "discrete") {
|
|
1454
|
+
return { kind: "discrete", by, table: m.table };
|
|
1455
|
+
}
|
|
1456
|
+
if (m.kind === "continuous") {
|
|
1457
|
+
return { kind: "continuous", by, points: m.points };
|
|
1458
|
+
}
|
|
1459
|
+
const plain = "style" in by ? styleCell : canonicalFor(target, property);
|
|
1460
|
+
const n = elements.count;
|
|
1461
|
+
budget?.spend(target, n);
|
|
1462
|
+
const values = new Array(n);
|
|
1463
|
+
let same = true;
|
|
1464
|
+
for (let i = 0; i < n; i++) {
|
|
1465
|
+
const raw = elements.value(m.column, i);
|
|
1466
|
+
const cy = raw === null || raw === void 0 || Array.isArray(raw) ? null : parse(raw, { notes, target, property, element: i });
|
|
1467
|
+
values[i] = cy;
|
|
1468
|
+
if (same && cy !== (raw === null || raw === void 0 || Array.isArray(raw) ? null : plain(raw))) {
|
|
1469
|
+
same = false;
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
if (same) {
|
|
1473
|
+
return { kind: "passthrough", by };
|
|
1474
|
+
}
|
|
1475
|
+
const key = `cytoscape.${property}`;
|
|
1476
|
+
columns.set(key, values);
|
|
1477
|
+
return { kind: "passthrough", by: { style: key } };
|
|
1478
|
+
}
|
|
1479
|
+
function styleCell(raw) {
|
|
1480
|
+
return typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? raw : null;
|
|
1481
|
+
}
|
|
1482
|
+
const FORMAT = "xgmml";
|
|
1483
|
+
const EXTENSIONS = Object.freeze([".xgmml", ".xml"]);
|
|
1484
|
+
const MIME_TYPES = Object.freeze(["application/xgmml", "text/xgmml", "text/xgmml+xml"]);
|
|
1485
|
+
const XGMML_NAMESPACE = "http://www.cs.rpi.edu/XGMML";
|
|
1486
|
+
const CY_NAMESPACE = "http://www.cytoscape.org";
|
|
1487
|
+
const XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
|
|
1488
|
+
const META_KEY = "xgmml";
|
|
1489
|
+
const LABEL_COLUMN = "label";
|
|
1490
|
+
const EDGE_ID_COLUMN = "id";
|
|
1491
|
+
const POSITION_COLUMN = "position";
|
|
1492
|
+
const Z_COLUMN = "z";
|
|
1493
|
+
const GRAPHICS_COLUMN = "graphics";
|
|
1494
|
+
const PARENT_COLUMN = "parent";
|
|
1495
|
+
const PARENTS_COLUMN = "parents";
|
|
1496
|
+
const SUBGRAPH_COLUMN = "xgmml.subgraph";
|
|
1497
|
+
const NESTED_NETWORK_COLUMN = "cytoscape.nestedNetwork";
|
|
1498
|
+
const NETWORK_POINTER_COLUMN = "xgmml.networkPointer";
|
|
1499
|
+
const NETWORKS_COLUMN = "xgmml.networks";
|
|
1500
|
+
const INTERACTION_COLUMN = "interaction";
|
|
1501
|
+
const XGMML_ORIGIN_NAMESPACE = "xgmml";
|
|
1502
|
+
const CYTOSCAPE_ORIGIN_NAMESPACE = "cytoscape";
|
|
1503
|
+
const XGMML_ISSUE = Object.freeze({
|
|
1504
|
+
...INPUT_ISSUE,
|
|
1505
|
+
...ELEMENT_ISSUE,
|
|
1506
|
+
/** The input is not well-formed XML. The import stops. */
|
|
1507
|
+
XML_SYNTAX: XML_SYNTAX_CODE,
|
|
1508
|
+
/** Elements are nested more than 100,000 deep. The import stops. */
|
|
1509
|
+
XML_NESTING: XML_NESTING_CODE,
|
|
1510
|
+
/** The input is empty or whitespace only. The import stops. */
|
|
1511
|
+
EMPTY_INPUT: EMPTY_INPUT_CODE,
|
|
1512
|
+
/** The input is not valid UTF-8. The import stops. */
|
|
1513
|
+
INVALID_UTF8: INVALID_UTF8_CODE,
|
|
1514
|
+
/**
|
|
1515
|
+
* Some bytes are not valid in the encoding that was chosen (by a byte order mark, the file's declaration or the
|
|
1516
|
+
* `encoding` option). The import stops.
|
|
1517
|
+
*/
|
|
1518
|
+
INVALID_ENCODING: INVALID_ENCODING_CODE,
|
|
1519
|
+
/** Undeclared non-UTF-8 bytes were read as windows-1252. */
|
|
1520
|
+
ENCODING_FALLBACK: ENCODING_FALLBACK_CODE,
|
|
1521
|
+
/** A declared encoding the platform cannot decode was ignored. */
|
|
1522
|
+
UNKNOWN_ENCODING: UNKNOWN_ENCODING_CODE,
|
|
1523
|
+
/** A declared encoding the byte order mark contradicts (the mark wins). */
|
|
1524
|
+
ENCODING_CONFLICT: ENCODING_CONFLICT_CODE,
|
|
1525
|
+
/**
|
|
1526
|
+
* The root element is not `<graph>` (it may be an XHTML page with a graph inside, or a GraphML file). The import
|
|
1527
|
+
* stops.
|
|
1528
|
+
*/
|
|
1529
|
+
NO_GRAPH: NO_GRAPH_CODE,
|
|
1530
|
+
/**
|
|
1531
|
+
* The file is a Cytoscape session view (`cy:view="1"`), which holds only view settings and no nodes or edges. The
|
|
1532
|
+
* import stops.
|
|
1533
|
+
*/
|
|
1534
|
+
VIEW_DOCUMENT: "E_XGMML_VIEW_DOCUMENT",
|
|
1535
|
+
/** A node with neither an id nor a label; it is skipped with its subtree. */
|
|
1536
|
+
MISSING_ID: MISSING_ID_CODE,
|
|
1537
|
+
/** A node without an id; its label is used as the id. */
|
|
1538
|
+
ID_FROM_LABEL: "W_XGMML_ID_FROM_LABEL",
|
|
1539
|
+
/** A node or edge with both an id and an `xlink:href`; it is read as the reference. */
|
|
1540
|
+
ID_AND_HREF: "W_XGMML_ID_AND_HREF",
|
|
1541
|
+
/** An edge without a source or a target that no label alias resolves. */
|
|
1542
|
+
MISSING_ENDPOINT: MISSING_ENDPOINT_CODE,
|
|
1543
|
+
/** An edge endpoint that names no node (addMissingNodes false); the edge is skipped. */
|
|
1544
|
+
UNKNOWN_NODE: "E_UNKNOWN_NODE",
|
|
1545
|
+
/** Endpoints resolved through Cytoscape's `"a (pp) b"` label aliases; interactions filled from labels. */
|
|
1546
|
+
LABEL_ALIAS: "W_XGMML_LABEL_ALIAS",
|
|
1547
|
+
/** A node id declared twice; the declarations are merged. */
|
|
1548
|
+
DUPLICATE_NODE: DUPLICATE_NODE_CODE,
|
|
1549
|
+
/** An edge id used twice; the second edge is skipped. */
|
|
1550
|
+
DUPLICATE_EDGE_ID: DUPLICATE_EDGE_ID_CODE,
|
|
1551
|
+
/**
|
|
1552
|
+
* Cytoscape 2.x writes each edge of a group a second time, inside the group. The repeats are dropped, so every edge
|
|
1553
|
+
* is read once; nothing is lost.
|
|
1554
|
+
*/
|
|
1555
|
+
GROUP_DUPLICATE_EDGE: "W_XGMML_GROUP_DUPLICATE_EDGE",
|
|
1556
|
+
/** A `directed` or `cy:directed` value other than 0 / 1. */
|
|
1557
|
+
BAD_DIRECTED: "W_XGMML_BAD_DIRECTED",
|
|
1558
|
+
/** A `documentVersion` that does not parse; the dialect is chosen from the content. */
|
|
1559
|
+
DOCUMENT_VERSION: "W_XGMML_DOCUMENT_VERSION",
|
|
1560
|
+
/** A root `<graph>` with neither the XGMML namespace nor an XGMML DOCTYPE. */
|
|
1561
|
+
NO_NAMESPACE: "W_XGMML_NO_NAMESPACE",
|
|
1562
|
+
/** A malformed `<att>`: a list with a value, a scalar with child atts, an att with no name. */
|
|
1563
|
+
BAD_ATT: "W_XGMML_BAD_ATT",
|
|
1564
|
+
/** A bare `&` read as `&` under repairBareAmpersands. */
|
|
1565
|
+
AMPERSAND_REPAIRED: "W_XGMML_AMPERSAND_REPAIRED",
|
|
1566
|
+
/** Two surrogate character references joined under pairSurrogateReferences. */
|
|
1567
|
+
SURROGATE_PAIRED: "W_XGMML_SURROGATE_PAIRED",
|
|
1568
|
+
/** An empty list whose element type nothing states; a list of strings is assumed. */
|
|
1569
|
+
EMPTY_LIST_TYPE: "W_XGMML_EMPTY_LIST_TYPE",
|
|
1570
|
+
/**
|
|
1571
|
+
* An attribute holds a structure a single column cannot (a list of records, a list of lists, a Cytoscape 2.x map
|
|
1572
|
+
* or XML from another tool). Its value is kept as a JSON value, which a save as XGMML writes back.
|
|
1573
|
+
*/
|
|
1574
|
+
RECORD_LIST: "W_XGMML_RECORD_LIST",
|
|
1575
|
+
/** A pointer into another file (`file.xgmml#id`); kept as text. */
|
|
1576
|
+
CROSS_FILE_REFERENCE: "W_XGMML_CROSS_FILE_REFERENCE",
|
|
1577
|
+
/** A graph nested in an edge's att; there is no model for it. */
|
|
1578
|
+
EDGE_NESTED_GRAPH: "W_XGMML_EDGE_NESTED_GRAPH",
|
|
1579
|
+
/**
|
|
1580
|
+
* Some nodes or edges of a Cytoscape session belong to none of its networks (Cytoscape keeps group meta-edges and
|
|
1581
|
+
* the members of collapsed groups this way). They are not read; the message counts them.
|
|
1582
|
+
*/
|
|
1583
|
+
ROOT_ONLY_ELEMENTS: "W_XGMML_ROOT_ONLY_ELEMENTS",
|
|
1584
|
+
/** A value that does not parse as its declared type; the cell is unset. */
|
|
1585
|
+
BAD_VALUE: BAD_VALUE_CODE,
|
|
1586
|
+
/**
|
|
1587
|
+
* An attribute's type was widened because a later value did not fit: an integer above 2^31 in an integer column,
|
|
1588
|
+
* or two declared types for one attribute.
|
|
1589
|
+
*/
|
|
1590
|
+
WIDENED: WIDENED_CODE,
|
|
1591
|
+
/** An integer beyond 2^53 was stored as the nearest 64-bit float; pass `long: "string"` to keep every digit. */
|
|
1592
|
+
PRECISION: PRECISION_CODE,
|
|
1593
|
+
/** A reference (xlink:href, nested-network pointer) that names nothing. */
|
|
1594
|
+
DANGLING_REFERENCE: DANGLING_REFERENCE_CODE,
|
|
1595
|
+
/** The same attribute twice on one element; the later value wins. */
|
|
1596
|
+
DUPLICATE_ATTRIBUTE: DUPLICATE_ATTRIBUTE_CODE,
|
|
1597
|
+
/** A group membership naming no node. */
|
|
1598
|
+
UNKNOWN_PARENT: UNKNOWN_PARENT_CODE,
|
|
1599
|
+
/** A group membership that would close a parent cycle; that link is dropped. */
|
|
1600
|
+
PARENT_CYCLE: PARENT_CYCLE_CODE,
|
|
1601
|
+
/** A Cytoscape formula kept as its text. */
|
|
1602
|
+
EQUATION_AS_TEXT: EQUATION_AS_TEXT_CODE,
|
|
1603
|
+
/** An att type XGMML and Cytoscape do not define; kept as text. */
|
|
1604
|
+
UNKNOWN_ATTR_TYPE: UNKNOWN_ATTR_TYPE_CODE,
|
|
1605
|
+
/** An element XGMML does not define at that place; skipped with its subtree. */
|
|
1606
|
+
UNKNOWN_ELEMENT: UNKNOWN_ELEMENT_CODE,
|
|
1607
|
+
/** Character data where XGMML allows only elements, or inside an att. */
|
|
1608
|
+
STRAY_TEXT: STRAY_TEXT_CODE,
|
|
1609
|
+
/**
|
|
1610
|
+
* The file holds several graphs and only the first was read. It is not added when `graphIndex` or `graphName` chose the graph.
|
|
1611
|
+
* `importAllGraphs()` reads every one.
|
|
1612
|
+
*/
|
|
1613
|
+
MULTIPLE_GRAPHS: MULTIPLE_GRAPHS_CODE,
|
|
1614
|
+
/** `graphIndex` or `graphName` matches no network in the session. The import stops. */
|
|
1615
|
+
GRAPH_NOT_FOUND: GRAPH_NOT_FOUND_CODE,
|
|
1616
|
+
/** `graphName` matches several networks in the session. The import stops. */
|
|
1617
|
+
AMBIGUOUS_GRAPH_NAME: AMBIGUOUS_GRAPH_NAME_CODE,
|
|
1618
|
+
/**
|
|
1619
|
+
* An attribute was renamed `<name>#<suffix>` because another attribute already has its name, for example
|
|
1620
|
+
* two attributes declared with the same name.
|
|
1621
|
+
*/
|
|
1622
|
+
COLUMN_RENAMED: COLUMN_RENAMED_CODE,
|
|
1623
|
+
/**
|
|
1624
|
+
* You read into a graph builder that already has an id, label or position attribute, so this file's one is kept as
|
|
1625
|
+
* a plain attribute.
|
|
1626
|
+
*/
|
|
1627
|
+
ROLE_TAKEN: ROLE_TAKEN_CODE,
|
|
1628
|
+
/** Two different id texts became the same number because `ids` is "number", so their nodes were merged. */
|
|
1629
|
+
ID_MERGED: ID_MERGED_CODE,
|
|
1630
|
+
/** You set an option this format does not use; it had no effect. The message names the option. */
|
|
1631
|
+
OPTION_IGNORED: OPTION_IGNORED_CODE,
|
|
1632
|
+
/**
|
|
1633
|
+
* You read into your own graph builder, which was created with a different `addMissingNodes`, `duplicateEdges`,
|
|
1634
|
+
* `selfLoops` or `weightDtype` than the option you passed; the builder's setting applies.
|
|
1635
|
+
*/
|
|
1636
|
+
SINK_OPTION: SINK_OPTION_CODE,
|
|
1637
|
+
/**
|
|
1638
|
+
* You read into a graph builder whose direction is already set, or which already holds edges, so the file is read
|
|
1639
|
+
* with the builder's direction instead of its own.
|
|
1640
|
+
*/
|
|
1641
|
+
DIRECTION_REFUSED: DIRECTION_REFUSED_CODE,
|
|
1642
|
+
/** Edges of the other direction were read with the direction `onMixedDirection` chose. */
|
|
1643
|
+
DIRECTION_FORCED: DIRECTION_FORCED_CODE,
|
|
1644
|
+
/**
|
|
1645
|
+
* The graph has both directed and undirected edges and `onMixedDirection` is "error". An import stops; a save to a
|
|
1646
|
+
* format that holds one direction per file fails with E_DIRECTED. Pass "directed" or "undirected" to read or write
|
|
1647
|
+
* it anyway.
|
|
1648
|
+
*/
|
|
1649
|
+
MIXED_DIRECTION: MIXED_DIRECTION_CODE
|
|
1650
|
+
});
|
|
1651
|
+
const XGMML_LOSS = Object.freeze({
|
|
1652
|
+
/** A json or nested-list column written as a string att. */
|
|
1653
|
+
JSON_AS_STRING: "W_XGMML_JSON_AS_STRING",
|
|
1654
|
+
/**
|
|
1655
|
+
* An attribute type Cytoscape does not have is written as a wider one (a 32-bit float as Double, a large unsigned
|
|
1656
|
+
* integer as Long, a byte as Integer, a dictionary as String).
|
|
1657
|
+
*/
|
|
1658
|
+
WIDENED_TYPE: "W_XGMML_WIDENED_TYPE",
|
|
1659
|
+
/** A text value holds a character XML 1.0 forbids (most control characters); the save fails with E_COLUMN_TYPE. */
|
|
1660
|
+
XML_ILLEGAL_CHAR: XML_ILLEGAL_CHAR_CODE,
|
|
1661
|
+
/** A temporal column written as plain numbers. */
|
|
1662
|
+
TEMPORAL_DROPPED: TEMPORAL_DROPPED_CODE,
|
|
1663
|
+
/** A temporal text companion written as a plain string att. */
|
|
1664
|
+
TEMPORAL_TEXT_DROPPED: TEMPORAL_TEXT_DROPPED_CODE,
|
|
1665
|
+
/** An attribute with a role the format has no place for is written as a plain attribute; the role is lost. */
|
|
1666
|
+
ROLE_DROPPED: ROLE_DROPPED_CODE,
|
|
1667
|
+
/**
|
|
1668
|
+
* A `parents` attribute (several parents per node) is not written because the graph also has a `parent` attribute.
|
|
1669
|
+
*/
|
|
1670
|
+
PARENTS_DROPPED: PARENTS_DROPPED_CODE,
|
|
1671
|
+
/** A mutual pair written as two directed edges. */
|
|
1672
|
+
MUTUAL_EXPANDED: MUTUAL_EXPANDED_CODE,
|
|
1673
|
+
/** Node ids whose text reads back as the other type. */
|
|
1674
|
+
ID_TEXT_TYPE: ID_TEXT_TYPE_CODE,
|
|
1675
|
+
/** Edge ids that are not text are written as text and read back as text. */
|
|
1676
|
+
EDGE_ID_TEXT: "W_XGMML_EDGE_ID_TEXT",
|
|
1677
|
+
/** Strings holding a literal backslash-n or backslash-t read back as newline / tab (Cytoscape's escapes). */
|
|
1678
|
+
BACKSLASH_ESCAPE: "W_XGMML_BACKSLASH_ESCAPE",
|
|
1679
|
+
/** A position that cannot be written as it is: another shape, a non-finite coordinate, a z read back in the z column. */
|
|
1680
|
+
POSITION: "W_XGMML_POSITION",
|
|
1681
|
+
/** Nodes whose parent chain never reaches a root are written at the top level. */
|
|
1682
|
+
PARENT_CYCLE: "W_XGMML_PARENT_CYCLE",
|
|
1683
|
+
/**
|
|
1684
|
+
* An attribute with a role (for example, the label) is written where the format keeps that role, and reads back under the
|
|
1685
|
+
* name the format's importer gives it.
|
|
1686
|
+
*/
|
|
1687
|
+
COLUMN_NAME_CHANGED: COLUMN_RENAMED_LOSS_CODE,
|
|
1688
|
+
/**
|
|
1689
|
+
* An attribute without a role is written where the format keeps a role (for example, a `name` column as the label), and
|
|
1690
|
+
* reads back with that role.
|
|
1691
|
+
*/
|
|
1692
|
+
ROLE_ASSUMED: ROLE_ASSUMED_CODE,
|
|
1693
|
+
/** An attribute named `weight` without the weight role reads back as the edge weight. */
|
|
1694
|
+
WEIGHT_KEY_CLASH: WEIGHT_KEY_CLASH_CODE,
|
|
1695
|
+
/**
|
|
1696
|
+
* A text attribute reads back as a dictionary attribute, or the reverse, because the importer chooses by how often
|
|
1697
|
+
* its values repeat. The values are the same.
|
|
1698
|
+
*/
|
|
1699
|
+
STORAGE_CLASS_CHANGED: STORAGE_CLASS_CODE,
|
|
1700
|
+
/** Edge labels shaped `a (i) b` read back with an `interaction` column (Cytoscape's label alias). */
|
|
1701
|
+
INTERACTION_FROM_LABEL: "W_XGMML_INTERACTION_FROM_LABEL"
|
|
1702
|
+
});
|
|
1703
|
+
function graphicsColumnOf(table) {
|
|
1704
|
+
for (const col of table) {
|
|
1705
|
+
const { origin } = col.meta;
|
|
1706
|
+
if (col.dtype === "json" && origin?.type === "graphics" && origin.namespace === XGMML_ORIGIN_NAMESPACE) {
|
|
1707
|
+
return col.meta.name;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
return table.get(GRAPHICS_COLUMN)?.dtype === "json" ? GRAPHICS_COLUMN : null;
|
|
1711
|
+
}
|
|
1712
|
+
function graphicsBypasses(table, target, n, notes) {
|
|
1713
|
+
const out = new Array(n).fill(null);
|
|
1714
|
+
const name = graphicsColumnOf(table);
|
|
1715
|
+
if (name === null) {
|
|
1716
|
+
return out;
|
|
1717
|
+
}
|
|
1718
|
+
for (let i = 0; i < n; i++) {
|
|
1719
|
+
const g = plainCell(table.value(name, i));
|
|
1720
|
+
if (g === null || typeof g !== "object" || Array.isArray(g)) {
|
|
1721
|
+
continue;
|
|
1722
|
+
}
|
|
1723
|
+
const map = normalizeVisualProperties(target, g, notes);
|
|
1724
|
+
const locked = Object.hasOwn(g, "lockedVisualProperties") ? g.lockedVisualProperties : void 0;
|
|
1725
|
+
if (locked !== null && typeof locked === "object") {
|
|
1726
|
+
for (const [k, v] of normalizeVisualProperties(target, locked, notes)) {
|
|
1727
|
+
map.set(k, v);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
out[i] = map.size > 0 ? map : null;
|
|
1731
|
+
}
|
|
1732
|
+
return out;
|
|
1733
|
+
}
|
|
1734
|
+
function readXgmmlStyles(snapshot, context, settings) {
|
|
1735
|
+
const notes = new StyleNotes();
|
|
1736
|
+
const out = { node: { values: {} }, edge: { values: {} } };
|
|
1737
|
+
for (const target of ["node", "edge"]) {
|
|
1738
|
+
context.signal?.throwIfAborted();
|
|
1739
|
+
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1740
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1741
|
+
const maps = graphicsBypasses(table, target, n, notes);
|
|
1742
|
+
const values = maps.some((m) => m !== null) ? resolveCytoscapeBypasses(target, maps, { notes, budget: context.budget }) : {};
|
|
1743
|
+
hiddenToVisible(table, settings.hiddenColumn ?? null, n, values);
|
|
1744
|
+
exactFromBlock(snapshot, target, values);
|
|
1745
|
+
out[target] = { values: nonEmpty(values) };
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
canonical: true,
|
|
1749
|
+
dialect: "cytoscape",
|
|
1750
|
+
tool: settings.tool,
|
|
1751
|
+
units: "px",
|
|
1752
|
+
node: out.node,
|
|
1753
|
+
edge: out.edge,
|
|
1754
|
+
graph: graphStyleOf(snapshot, notes),
|
|
1755
|
+
notes: notes.list()
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
function readXgmmlFileStyles(snapshot, context) {
|
|
1759
|
+
return readXgmmlStyles(snapshot, context, { tool: "cytoscape" });
|
|
1760
|
+
}
|
|
1761
|
+
function exactFromBlock(snapshot, target, values, dialect = "desktop") {
|
|
1762
|
+
const text = snapshot.graph.has(STYLE_BLOCK_NAME) ? plainCell(snapshot.graph.value(STYLE_BLOCK_NAME, 0)) : null;
|
|
1763
|
+
if (typeof text !== "string") {
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
const parsed = parseStyleBlock(text, styleFingerprint(snapshot));
|
|
1767
|
+
const ex = parsed.ok ? blockStyles(parsed.block, snapshot, "xgmml") : null;
|
|
1768
|
+
if (ex === null) {
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1772
|
+
const want = /* @__PURE__ */ new Map();
|
|
1773
|
+
const exact = (property) => {
|
|
1774
|
+
let held = want.get(property);
|
|
1775
|
+
if (held === void 0) {
|
|
1776
|
+
held = resolveStyles(ex, target, property, snapshot);
|
|
1777
|
+
want.set(property, held);
|
|
1778
|
+
}
|
|
1779
|
+
return held;
|
|
1780
|
+
};
|
|
1781
|
+
const written = Array.from(
|
|
1782
|
+
{ length: n },
|
|
1783
|
+
(_v, i) => cytoscapeElementProperties(
|
|
1784
|
+
target,
|
|
1785
|
+
(property) => exact(property)[i] ?? null,
|
|
1786
|
+
dialect,
|
|
1787
|
+
() => void 0
|
|
1788
|
+
)
|
|
1789
|
+
);
|
|
1790
|
+
const readBack = resolveCytoscapeBypasses(target, written, { notes: new StyleNotes() });
|
|
1791
|
+
for (const [property, native] of Object.entries(values)) {
|
|
1792
|
+
const back = readBack[property];
|
|
1793
|
+
if (native !== void 0 && back !== void 0) {
|
|
1794
|
+
values[property] = withBlockValues(native, back, exact(property));
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
function withBlockValues(native, back, w) {
|
|
1799
|
+
let changed = null;
|
|
1800
|
+
for (let i = 0; i < native.length; i++) {
|
|
1801
|
+
if (w[i] !== null && native[i] !== w[i] && native[i] === back[i]) {
|
|
1802
|
+
changed ??= [...native];
|
|
1803
|
+
changed[i] = w[i];
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
return changed ?? native;
|
|
1807
|
+
}
|
|
1808
|
+
function hiddenToVisible(table, column, n, values) {
|
|
1809
|
+
if (column === null || !table.has(column)) {
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
let visible = null;
|
|
1813
|
+
for (let i = 0; i < n; i++) {
|
|
1814
|
+
if (plainCell(table.value(column, i)) === true) {
|
|
1815
|
+
visible ??= values.visible === void 0 ? new Array(n).fill(null) : [...values.visible];
|
|
1816
|
+
visible[i] = false;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
if (visible !== null) {
|
|
1820
|
+
values.visible = visible;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
function nonEmpty(values) {
|
|
1824
|
+
const out = {};
|
|
1825
|
+
for (const [p, col] of Object.entries(values)) {
|
|
1826
|
+
if (col?.some((v) => v !== null) === true) {
|
|
1827
|
+
out[p] = col;
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
return out;
|
|
1831
|
+
}
|
|
1832
|
+
function graphStyleOf(snapshot, notes) {
|
|
1833
|
+
const name = graphicsColumnOf(snapshot.graph);
|
|
1834
|
+
const g = name === null ? null : plainCell(snapshot.graph.value(name, 0));
|
|
1835
|
+
if (g === null || typeof g !== "object") {
|
|
1836
|
+
return {};
|
|
1837
|
+
}
|
|
1838
|
+
const style = emptyCytoscapeStyle();
|
|
1839
|
+
for (const [k, v] of normalizeVisualProperties("node", g, notes)) {
|
|
1840
|
+
if (k.startsWith("NETWORK_")) {
|
|
1841
|
+
style.network.defaults.set(k, v);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
const background = cytoscapeBackground(style, notes);
|
|
1845
|
+
return background === null ? {} : { background };
|
|
1846
|
+
}
|
|
1847
|
+
const XGMML_STYLE_CAPABILITIES = Object.freeze({
|
|
1848
|
+
node: Object.freeze(cytoscapeWritableProperties("node", "desktop")),
|
|
1849
|
+
edge: Object.freeze(cytoscapeWritableProperties("edge", "desktop")),
|
|
1850
|
+
graph: Object.freeze(["background"]),
|
|
1851
|
+
block: "attributes"
|
|
1852
|
+
});
|
|
1853
|
+
const XML_ATTRIBUTES = {
|
|
1854
|
+
node: [
|
|
1855
|
+
["NODE_SHAPE", "type"],
|
|
1856
|
+
["NODE_HEIGHT", "h"],
|
|
1857
|
+
["NODE_WIDTH", "w"],
|
|
1858
|
+
["NODE_FILL_COLOR", "fill"],
|
|
1859
|
+
["NODE_BORDER_WIDTH", "width"],
|
|
1860
|
+
["NODE_BORDER_PAINT", "outline"]
|
|
1861
|
+
],
|
|
1862
|
+
edge: [
|
|
1863
|
+
["EDGE_WIDTH", "width"],
|
|
1864
|
+
["EDGE_STROKE_UNSELECTED_PAINT", "fill"]
|
|
1865
|
+
]
|
|
1866
|
+
};
|
|
1867
|
+
function styledGraphics(target, styles, i, kept) {
|
|
1868
|
+
const vps = cytoscapeElementProperties(
|
|
1869
|
+
target,
|
|
1870
|
+
(p) => styles.picture(target, p)[i] ?? null,
|
|
1871
|
+
"desktop",
|
|
1872
|
+
() => void 0
|
|
1873
|
+
);
|
|
1874
|
+
const out = {};
|
|
1875
|
+
for (const [vp, attribute] of XML_ATTRIBUTES[target]) {
|
|
1876
|
+
if (vps.has(vp)) {
|
|
1877
|
+
out[attribute] = String(vps.get(vp));
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
for (const [k, v] of Object.entries(kept ?? {})) {
|
|
1881
|
+
if (k === "Line" || /^[A-Z][A-Z_0-9]+$/.test(k) && !vps.has(k)) {
|
|
1882
|
+
out[k] = v;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
for (const [vp, v] of vps) {
|
|
1886
|
+
out[vp] = String(v);
|
|
1887
|
+
}
|
|
1888
|
+
return Object.keys(out).length === 0 ? null : out;
|
|
1889
|
+
}
|
|
1890
|
+
function styledGraphicsNotes(styles, snapshot) {
|
|
1891
|
+
const notes = new StyleNotes();
|
|
1892
|
+
for (const target of ["node", "edge"]) {
|
|
1893
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1894
|
+
for (let i = 0; i < n; i++) {
|
|
1895
|
+
cytoscapeElementProperties(
|
|
1896
|
+
target,
|
|
1897
|
+
(p) => styles.picture(target, p)[i] ?? null,
|
|
1898
|
+
"desktop",
|
|
1899
|
+
(p) => {
|
|
1900
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, target, p, { element: i });
|
|
1901
|
+
}
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1905
|
+
return notes.list().map(lossOf);
|
|
1906
|
+
}
|
|
1907
|
+
function styledGraphGraphics(styles, kept) {
|
|
1908
|
+
const { background } = styles.rules.styles.graph;
|
|
1909
|
+
const out = { ...kept };
|
|
1910
|
+
if (background !== void 0) {
|
|
1911
|
+
out.NETWORK_BACKGROUND_PAINT = background.toUpperCase();
|
|
1912
|
+
}
|
|
1913
|
+
return Object.keys(out).length === 0 ? null : out;
|
|
1914
|
+
}
|
|
1915
|
+
function blockOfAspect(elements) {
|
|
1916
|
+
const first = elements?.[0];
|
|
1917
|
+
if (first === null || typeof first !== "object" || !Object.hasOwn(first, "block")) {
|
|
1918
|
+
return null;
|
|
1919
|
+
}
|
|
1920
|
+
const text = first.block;
|
|
1921
|
+
return typeof text === "string" ? text : null;
|
|
1922
|
+
}
|
|
1923
|
+
function blockAspect(block) {
|
|
1924
|
+
return [{ block }];
|
|
1925
|
+
}
|
|
1926
|
+
function snapshotBlock(snapshot) {
|
|
1927
|
+
const column = snapshot.graph.get(STYLE_BLOCK_NAME);
|
|
1928
|
+
const value = column?.isSet(0) ? column.value(0) : null;
|
|
1929
|
+
return typeof value === "string" ? value : null;
|
|
1930
|
+
}
|
|
1931
|
+
function bypassesOf(table, n, namespace) {
|
|
1932
|
+
const columns = [...table].filter((c) => c.meta.origin?.namespace === namespace);
|
|
1933
|
+
const maps = new Array(n).fill(null);
|
|
1934
|
+
for (let i = 0; i < n; i++) {
|
|
1935
|
+
let m = null;
|
|
1936
|
+
for (const c of columns) {
|
|
1937
|
+
const v = plainCell(c.isSet(i) ? c.value(i) : null);
|
|
1938
|
+
if (v !== null) {
|
|
1939
|
+
m ??= /* @__PURE__ */ new Map();
|
|
1940
|
+
const id = c.meta.origin?.id;
|
|
1941
|
+
m.set(typeof id === "string" && id.length > 0 ? id : c.meta.name, v);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
maps[i] = m;
|
|
1945
|
+
}
|
|
1946
|
+
return { maps, names: columns.map((c) => c.meta.name) };
|
|
1947
|
+
}
|
|
1948
|
+
function readDeclaredStyles(snapshot, context, style, namespace, notes, dialect = "desktop") {
|
|
1949
|
+
const out = { node: { values: {} }, edge: { values: {} } };
|
|
1950
|
+
const readFrom = { node: [], edge: [] };
|
|
1951
|
+
for (const target of ["node", "edge"]) {
|
|
1952
|
+
context.signal?.throwIfAborted();
|
|
1953
|
+
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1954
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1955
|
+
for (const m of style[target].mappings.values()) {
|
|
1956
|
+
if (!table.has(m.column)) {
|
|
1957
|
+
notes.add(STYLE_ISSUE.MAPPING_COLUMN_MISSING, target, m.column, { sample: m.kind });
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
const { maps, names } = bypassesOf(table, n, namespace);
|
|
1961
|
+
readFrom[target] = names;
|
|
1962
|
+
const elements = {
|
|
1963
|
+
count: n,
|
|
1964
|
+
value: (column, i) => table.has(column) ? plainCell(table.value(column, i)) : null,
|
|
1965
|
+
bypasses: maps
|
|
1966
|
+
};
|
|
1967
|
+
const values = resolveCytoscape(target, style, elements, { notes, budget: context.budget });
|
|
1968
|
+
exactFromBlock(snapshot, target, values, dialect);
|
|
1969
|
+
const { rules, columns } = cytoscapeRules(target, style, elements, { notes, budget: context.budget });
|
|
1970
|
+
out[target] = { values: nonEmpty(values), rules, columns };
|
|
1971
|
+
}
|
|
1972
|
+
const background = cytoscapeBackground(style, notes);
|
|
1973
|
+
return {
|
|
1974
|
+
canonical: true,
|
|
1975
|
+
dialect: "cytoscape",
|
|
1976
|
+
tool: "cytoscape",
|
|
1977
|
+
units: "px",
|
|
1978
|
+
node: out.node,
|
|
1979
|
+
edge: out.edge,
|
|
1980
|
+
graph: background === null ? {} : { background },
|
|
1981
|
+
notes: notes.list(),
|
|
1982
|
+
readFrom
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
function readCxStyles(snapshot, context) {
|
|
1986
|
+
const notes = new StyleNotes();
|
|
1987
|
+
const kept = context.kept;
|
|
1988
|
+
const style = cytoscapeStyleFromCx(kept?.entries ?? [], notes);
|
|
1989
|
+
const otherViews = kept?.otherViews ?? 0;
|
|
1990
|
+
if (otherViews > 0) {
|
|
1991
|
+
notes.add(STYLE_ISSUE.OTHER_VIEWS, null, "cyVisualProperties", {
|
|
1992
|
+
sample: `${otherViews} more`,
|
|
1993
|
+
count: otherViews
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
return readDeclaredStyles(snapshot, context, style, "cx.bypass", notes);
|
|
1997
|
+
}
|
|
1998
|
+
function cytoscapeWriteCapabilities(dialect) {
|
|
1999
|
+
return Object.freeze({
|
|
2000
|
+
node: Object.freeze(cytoscapeWritableProperties("node", dialect)),
|
|
2001
|
+
edge: Object.freeze(cytoscapeWritableProperties("edge", dialect)),
|
|
2002
|
+
graph: Object.freeze(["background"]),
|
|
2003
|
+
// graph-io adds the block as a graph attribute (the writer moves it into an aspect of its own) and the style
|
|
2004
|
+
// values the rules read as element attributes
|
|
2005
|
+
block: "attributes"
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
const CX_STYLE_CAPABILITIES = cytoscapeWriteCapabilities("desktop");
|
|
2009
|
+
function valuesDtype(col) {
|
|
2010
|
+
const kinds = new Set(col.filter((v) => v !== null).map((v) => typeof v));
|
|
2011
|
+
if (kinds.size === 1 && kinds.has("number")) {
|
|
2012
|
+
return "f64";
|
|
2013
|
+
}
|
|
2014
|
+
return kinds.size === 1 && kinds.has("boolean") ? "bool" : "string";
|
|
2015
|
+
}
|
|
2016
|
+
function lossOf(n) {
|
|
2017
|
+
return Object.freeze({
|
|
2018
|
+
code: n.code,
|
|
2019
|
+
message: n.message,
|
|
2020
|
+
column: null,
|
|
2021
|
+
count: n.params.count,
|
|
2022
|
+
style: n.params.target === null || n.params.property === null || n.params.target === "graph" ? void 0 : Object.freeze({ target: n.params.target, property: n.params.property })
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
function cytoscapeStyledExport(snapshot, input, dialect) {
|
|
2026
|
+
if (input === void 0) {
|
|
2027
|
+
return null;
|
|
2028
|
+
}
|
|
2029
|
+
const notes = new StyleNotes();
|
|
2030
|
+
const styled = emitCytoscapeStyle(input.rules, snapshot, { dialect, notes });
|
|
2031
|
+
return { snapshot: withMappedColumns(snapshot, styled), styled, notes: notes.list().map(lossOf) };
|
|
2032
|
+
}
|
|
2033
|
+
function withMappedColumns(snapshot, styled) {
|
|
2034
|
+
const missing = ["node", "edge"].flatMap(
|
|
2035
|
+
(target) => [...styled.columns[target]].filter(([name]) => !(target === "node" ? snapshot.nodes : snapshot.edges).has(name)).map(([name, values]) => ({ target, name, values }))
|
|
2036
|
+
);
|
|
2037
|
+
if (missing.length === 0) {
|
|
2038
|
+
return snapshot;
|
|
2039
|
+
}
|
|
2040
|
+
const out = snapshot.withColumns();
|
|
2041
|
+
for (const { target, name, values } of missing) {
|
|
2042
|
+
const dtype = valuesDtype(values);
|
|
2043
|
+
const col = dtype === "string" ? values.map((v) => v === null ? null : String(v)) : values;
|
|
2044
|
+
(target === "node" ? out.nodes : out.edges).set(name, col, { dtype });
|
|
2045
|
+
}
|
|
2046
|
+
return out;
|
|
2047
|
+
}
|
|
2048
|
+
export {
|
|
2049
|
+
EXTENSIONS as A,
|
|
2050
|
+
emitCytoscapeStyle as B,
|
|
2051
|
+
CY_NAMESPACE as C,
|
|
2052
|
+
lossOf as D,
|
|
2053
|
+
EDGE_ID_COLUMN as E,
|
|
2054
|
+
FORMAT as F,
|
|
2055
|
+
GRAPHICS_COLUMN as G,
|
|
2056
|
+
cytoscapeVizmapXml as H,
|
|
2057
|
+
INTERACTION_COLUMN as I,
|
|
2058
|
+
readXgmmlStyles as J,
|
|
2059
|
+
cytoscapeBackground as K,
|
|
2060
|
+
LABEL_COLUMN as L,
|
|
2061
|
+
META_KEY as M,
|
|
2062
|
+
NESTED_NETWORK_COLUMN as N,
|
|
2063
|
+
emptyCytoscapeStyle as O,
|
|
2064
|
+
POSITION_COLUMN as P,
|
|
2065
|
+
graphicsBypasses as Q,
|
|
2066
|
+
resolveCytoscape as R,
|
|
2067
|
+
SUBGRAPH_COLUMN as S,
|
|
2068
|
+
hiddenToVisible as T,
|
|
2069
|
+
exactFromBlock as U,
|
|
2070
|
+
cytoscapeRules as V,
|
|
2071
|
+
nonEmpty as W,
|
|
2072
|
+
XGMML_ISSUE as X,
|
|
2073
|
+
typedKey as Y,
|
|
2074
|
+
Z_COLUMN as Z,
|
|
2075
|
+
XGMML_LOSS as a,
|
|
2076
|
+
cytoscapeCx2Aspects as b,
|
|
2077
|
+
cytoscapeStyledExport as c,
|
|
2078
|
+
blockAspect as d,
|
|
2079
|
+
styledGraphicsNotes as e,
|
|
2080
|
+
XGMML_STYLE_CAPABILITIES as f,
|
|
2081
|
+
XLINK_NAMESPACE as g,
|
|
2082
|
+
XGMML_NAMESPACE as h,
|
|
2083
|
+
styledGraphGraphics as i,
|
|
2084
|
+
styledGraphics as j,
|
|
2085
|
+
PARENT_COLUMN as k,
|
|
2086
|
+
PARENTS_COLUMN as l,
|
|
2087
|
+
NETWORK_POINTER_COLUMN as m,
|
|
2088
|
+
NETWORKS_COLUMN as n,
|
|
2089
|
+
XGMML_ORIGIN_NAMESPACE as o,
|
|
2090
|
+
CYTOSCAPE_ORIGIN_NAMESPACE as p,
|
|
2091
|
+
CX_STYLE_CAPABILITIES as q,
|
|
2092
|
+
cytoscapeCxAspect as r,
|
|
2093
|
+
snapshotBlock as s,
|
|
2094
|
+
readCxStyles as t,
|
|
2095
|
+
blockOfAspect as u,
|
|
2096
|
+
cytoscapeWriteCapabilities as v,
|
|
2097
|
+
cytoscapeStyleFromCx2 as w,
|
|
2098
|
+
readDeclaredStyles as x,
|
|
2099
|
+
readXgmmlFileStyles as y,
|
|
2100
|
+
MIME_TYPES as z
|
|
2101
|
+
};
|
|
2102
|
+
//# sourceMappingURL=styles-_N-C8S-U.js.map
|