@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
package/dist/styles.js
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { j as StyleNotes, q as featuresOf, k as styleFingerprint } from "./chunks/block-JQiwViEt.js";
|
|
2
|
+
import { t, S, u, a, v, T, i, r, w } from "./chunks/block-JQiwViEt.js";
|
|
3
|
+
import { S as StyleBudget, e as evaluateCytoscapeJs } from "./chunks/emit-DCwFLts5.js";
|
|
4
|
+
import { C, t as t2 } from "./chunks/emit-DCwFLts5.js";
|
|
5
|
+
import { p as planStyles } from "./chunks/generic-BL06jrJf.js";
|
|
6
|
+
import { M, e } from "./chunks/generic-BL06jrJf.js";
|
|
7
|
+
const CYTOSCAPE_ANNOTATIONS_COLUMN = "__Annotations";
|
|
8
|
+
const TYPE_PREFIX = "org.cytoscape.view.presentation.annotations.";
|
|
9
|
+
const SHAPES = /* @__PURE__ */ new Map([
|
|
10
|
+
["rectangle", "rectangle"],
|
|
11
|
+
["roundedrectangle", "round-rectangle"],
|
|
12
|
+
["rounded_rectangle", "round-rectangle"],
|
|
13
|
+
["ellipse", "ellipse"],
|
|
14
|
+
["triangle", "triangle"],
|
|
15
|
+
["diamond", "diamond"],
|
|
16
|
+
["pentagon", "pentagon"],
|
|
17
|
+
["hexagon", "hexagon"],
|
|
18
|
+
["octagon", "octagon"],
|
|
19
|
+
["parallelogram", "parallelogram"],
|
|
20
|
+
["star5", "star"],
|
|
21
|
+
["star6", "star"]
|
|
22
|
+
]);
|
|
23
|
+
const ARROW_ORDER = [
|
|
24
|
+
"circle",
|
|
25
|
+
"triangle",
|
|
26
|
+
"vee",
|
|
27
|
+
"diamond",
|
|
28
|
+
"triangle-open",
|
|
29
|
+
"none",
|
|
30
|
+
"tee",
|
|
31
|
+
"triangle",
|
|
32
|
+
"triangle",
|
|
33
|
+
"triangle",
|
|
34
|
+
"tee",
|
|
35
|
+
"other:x"
|
|
36
|
+
];
|
|
37
|
+
const ARROW_NAMES = /* @__PURE__ */ new Map([
|
|
38
|
+
["circle", "circle"],
|
|
39
|
+
["closed arrow", "triangle"],
|
|
40
|
+
["concave arrow", "vee"],
|
|
41
|
+
["diamond", "diamond"],
|
|
42
|
+
["open arrow", "triangle-open"],
|
|
43
|
+
["no arrow", "none"],
|
|
44
|
+
["pipe", "tee"],
|
|
45
|
+
["triangle", "triangle"],
|
|
46
|
+
["t", "tee"],
|
|
47
|
+
["x", "other:x"]
|
|
48
|
+
]);
|
|
49
|
+
function readAnnotations(snapshot) {
|
|
50
|
+
const { graph } = snapshot;
|
|
51
|
+
const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;
|
|
52
|
+
const entries = cellStrings(cell);
|
|
53
|
+
const fields = entries.map(parseEntry);
|
|
54
|
+
const byId = new Map(fields.map((f, i2) => [f.get("uuid") ?? String(i2), f]));
|
|
55
|
+
const annotations = [];
|
|
56
|
+
const skipped = /* @__PURE__ */ new Set();
|
|
57
|
+
fields.forEach((f, i2) => {
|
|
58
|
+
const read = readOne(f, String(i2), byId);
|
|
59
|
+
if (read === null) {
|
|
60
|
+
skipped.add((f.get("type") ?? "").replace(TYPE_PREFIX, ""));
|
|
61
|
+
} else {
|
|
62
|
+
annotations.push(...read);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return { annotations, skipped: [...skipped] };
|
|
66
|
+
}
|
|
67
|
+
function cellStrings(cell) {
|
|
68
|
+
if (typeof cell === "string") {
|
|
69
|
+
return cell.split(/[\r\n]+/).filter((s) => s !== "");
|
|
70
|
+
}
|
|
71
|
+
if (cell !== null && typeof cell === "object" && Symbol.iterator in cell) {
|
|
72
|
+
return Array.from(cell).filter((s) => typeof s === "string" && s !== "");
|
|
73
|
+
}
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
function parseEntry(entry) {
|
|
77
|
+
const out = /* @__PURE__ */ new Map();
|
|
78
|
+
for (const part of entry.split("|")) {
|
|
79
|
+
const eq = part.indexOf("=");
|
|
80
|
+
if (eq > 0) {
|
|
81
|
+
out.set(part.slice(0, eq), part.slice(eq + 1));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
function readOne(f, index, byId) {
|
|
87
|
+
const type = (f.get("type") ?? "").replace(TYPE_PREFIX, "");
|
|
88
|
+
const zoom = positive(f.get("zoom")) ?? 1;
|
|
89
|
+
const base = {
|
|
90
|
+
id: f.get("uuid") ?? index,
|
|
91
|
+
layer: f.get("canvas") === "background" ? "background" : "foreground",
|
|
92
|
+
z: num(f.get("z")) ?? 0
|
|
93
|
+
};
|
|
94
|
+
switch (type) {
|
|
95
|
+
case "ShapeAnnotation":
|
|
96
|
+
return [shapeOf(f, base, zoom)];
|
|
97
|
+
case "TextAnnotation":
|
|
98
|
+
return [textOf(f, base, zoom, { x: num(f.get("x")) ?? 0, y: -(num(f.get("y")) ?? 0) }, "top-left")];
|
|
99
|
+
case "BoundedTextAnnotation": {
|
|
100
|
+
const shape = shapeOf(f, base, zoom);
|
|
101
|
+
return [shape, textOf(f, { ...base, id: `${base.id}:text` }, zoom, shape.center, "center")];
|
|
102
|
+
}
|
|
103
|
+
case "ArrowAnnotation":
|
|
104
|
+
return arrowOf(f, base, zoom, byId);
|
|
105
|
+
default:
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function shapeOf(f, base, zoom) {
|
|
110
|
+
const x = num(f.get("x")) ?? 0;
|
|
111
|
+
const y = num(f.get("y")) ?? 0;
|
|
112
|
+
const width = (positive(f.get("width")) ?? 0) / zoom;
|
|
113
|
+
const height = (positive(f.get("height")) ?? 0) / zoom;
|
|
114
|
+
const fill = javaColor(f.get("fillColor"));
|
|
115
|
+
const border = javaColor(f.get("edgeColor")) ?? { color: "#000000", alpha: 1 };
|
|
116
|
+
return {
|
|
117
|
+
...base,
|
|
118
|
+
kind: "shape",
|
|
119
|
+
center: { x: x + width / 2, y: -(y + height / 2) },
|
|
120
|
+
width,
|
|
121
|
+
height,
|
|
122
|
+
shape: SHAPES.get((f.get("shapeType") ?? "rectangle").toLowerCase()) ?? "rectangle",
|
|
123
|
+
fill: fill?.color ?? null,
|
|
124
|
+
fillOpacity: fill === null ? 0 : fill.alpha * percent(f.get("fillOpacity")),
|
|
125
|
+
borderColor: border.color,
|
|
126
|
+
borderOpacity: border.alpha * percent(f.get("edgeOpacity")),
|
|
127
|
+
borderWidth: (num(f.get("edgeThickness")) ?? 1) / zoom
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function textOf(f, base, zoom, at, anchor) {
|
|
131
|
+
const style = num(f.get("fontStyle")) ?? 0;
|
|
132
|
+
const color = javaColor(f.get("color")) ?? { color: "#000000", alpha: 1 };
|
|
133
|
+
return {
|
|
134
|
+
...base,
|
|
135
|
+
kind: "text",
|
|
136
|
+
text: f.get("text") ?? "",
|
|
137
|
+
at,
|
|
138
|
+
anchor,
|
|
139
|
+
fontSize: (positive(f.get("fontSize")) ?? 12) / zoom,
|
|
140
|
+
fontFamily: f.get("fontFamily") ?? "sans-serif",
|
|
141
|
+
bold: (style & 1) !== 0,
|
|
142
|
+
italic: (style & 2) !== 0,
|
|
143
|
+
color: color.color,
|
|
144
|
+
opacity: color.alpha
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function arrowOf(f, base, zoom, byId) {
|
|
148
|
+
const target = f.get("targetAnnotation");
|
|
149
|
+
const to = point(f.get("targetPoint")) ?? point(f.get("targetNode")) ?? centerOf(byId.get(target ?? ""), zoom);
|
|
150
|
+
if (to === null) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
const corner = { x: num(f.get("x")) ?? 0, y: num(f.get("y")) ?? 0 };
|
|
154
|
+
const source = centerOf(byId.get(f.get("sourceAnnotation") ?? ""), zoom) ?? corner;
|
|
155
|
+
const from = { x: to.x > corner.x ? corner.x : source.x, y: to.y > corner.y ? corner.y : source.y };
|
|
156
|
+
const color = javaColor(f.get("lineColor")) ?? { color: "#000000", alpha: 1 };
|
|
157
|
+
return [
|
|
158
|
+
{
|
|
159
|
+
...base,
|
|
160
|
+
kind: "arrow",
|
|
161
|
+
from: { x: from.x, y: -from.y },
|
|
162
|
+
to: { x: to.x, y: -to.y },
|
|
163
|
+
color: color.color,
|
|
164
|
+
opacity: color.alpha * percent(f.get("lineOpacity")),
|
|
165
|
+
width: (positive(f.get("lineThickness")) ?? 1) / zoom,
|
|
166
|
+
sourceArrow: arrowShape(f.get("sourceType")),
|
|
167
|
+
targetArrow: arrowShape(f.get("targetType")),
|
|
168
|
+
sourceSize: positive(f.get("sourceSize")) ?? 1,
|
|
169
|
+
targetSize: positive(f.get("targetSize")) ?? 1
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
function centerOf(f, zoom) {
|
|
174
|
+
if (f === void 0) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
const x = num(f.get("x"));
|
|
178
|
+
const y = num(f.get("y"));
|
|
179
|
+
if (x === null || y === null) {
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return { x: x + (positive(f.get("width")) ?? 0) / zoom / 2, y: y + (positive(f.get("height")) ?? 0) / zoom / 2 };
|
|
183
|
+
}
|
|
184
|
+
function arrowShape(raw) {
|
|
185
|
+
if (raw === void 0) {
|
|
186
|
+
return "none";
|
|
187
|
+
}
|
|
188
|
+
const n = num(raw);
|
|
189
|
+
if (n !== null) {
|
|
190
|
+
return ARROW_ORDER[n] ?? "triangle";
|
|
191
|
+
}
|
|
192
|
+
return ARROW_NAMES.get(raw.trim().toLowerCase()) ?? "triangle";
|
|
193
|
+
}
|
|
194
|
+
function point(raw) {
|
|
195
|
+
const [x, y] = (raw ?? "").split(",").map((s) => num(s));
|
|
196
|
+
return x === null || x === void 0 || y === null || y === void 0 ? null : { x, y };
|
|
197
|
+
}
|
|
198
|
+
function javaColor(raw) {
|
|
199
|
+
const n = num(raw);
|
|
200
|
+
if (n === null || !Number.isInteger(n)) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
const argb = n >>> 0;
|
|
204
|
+
return {
|
|
205
|
+
color: `#${(argb & 16777215).toString(16).padStart(6, "0")}`,
|
|
206
|
+
alpha: (argb >>> 24) / 255
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function percent(raw) {
|
|
210
|
+
const n = num(raw);
|
|
211
|
+
return n === null ? 1 : Math.min(1, Math.max(0, n / 100));
|
|
212
|
+
}
|
|
213
|
+
function num(raw) {
|
|
214
|
+
if (raw === void 0 || raw.trim() === "") {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
const n = Number(raw);
|
|
218
|
+
return Number.isFinite(n) ? n : null;
|
|
219
|
+
}
|
|
220
|
+
function positive(raw) {
|
|
221
|
+
const n = num(raw);
|
|
222
|
+
return n !== null && n > 0 ? n : null;
|
|
223
|
+
}
|
|
224
|
+
const FUNCTION = () => null;
|
|
225
|
+
function withFunctions(style) {
|
|
226
|
+
if (!Array.isArray(style)) {
|
|
227
|
+
return style;
|
|
228
|
+
}
|
|
229
|
+
return style.map((entry) => {
|
|
230
|
+
if (entry === null || typeof entry !== "object") {
|
|
231
|
+
return entry;
|
|
232
|
+
}
|
|
233
|
+
const e2 = entry;
|
|
234
|
+
const props = e2.style ?? e2.css;
|
|
235
|
+
if (props === null || typeof props !== "object") {
|
|
236
|
+
return entry;
|
|
237
|
+
}
|
|
238
|
+
const copy = /* @__PURE__ */ Object.create(null);
|
|
239
|
+
for (const name of Object.keys(props)) {
|
|
240
|
+
const v2 = props[name];
|
|
241
|
+
copy[name] = v2 === "fn" ? FUNCTION : v2;
|
|
242
|
+
}
|
|
243
|
+
return { selector: e2.selector, style: copy };
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function elementList(elements) {
|
|
247
|
+
if (Array.isArray(elements)) {
|
|
248
|
+
return elements;
|
|
249
|
+
}
|
|
250
|
+
if (elements !== null && typeof elements === "object") {
|
|
251
|
+
const e2 = elements;
|
|
252
|
+
return [...Array.isArray(e2.nodes) ? e2.nodes : [], ...Array.isArray(e2.edges) ? e2.edges : []];
|
|
253
|
+
}
|
|
254
|
+
return [];
|
|
255
|
+
}
|
|
256
|
+
function readCytoscapeStyles(input) {
|
|
257
|
+
const notes = input.notes ?? new StyleNotes();
|
|
258
|
+
const budget = input.budget ?? new StyleBudget();
|
|
259
|
+
let rendered;
|
|
260
|
+
if (input.rendered !== void 0) {
|
|
261
|
+
rendered = /* @__PURE__ */ new Map();
|
|
262
|
+
const list = elementList(input.elements);
|
|
263
|
+
for (let i2 = 0; i2 < list.length && i2 < input.rendered.length; i2++) {
|
|
264
|
+
const json = list[i2];
|
|
265
|
+
const r22 = input.rendered[i2];
|
|
266
|
+
if (json !== null && typeof json === "object" && r22 !== null && r22 !== void 0 && typeof r22 === "object") {
|
|
267
|
+
rendered.set(json, r22);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const r2 = evaluateCytoscapeJs({
|
|
272
|
+
elements: input.elements,
|
|
273
|
+
style: withFunctions(input.style),
|
|
274
|
+
snapshot: input.snapshot,
|
|
275
|
+
toolDefaults: input.toolDefaults,
|
|
276
|
+
rendered,
|
|
277
|
+
notes,
|
|
278
|
+
budget,
|
|
279
|
+
signal: input.signal
|
|
280
|
+
});
|
|
281
|
+
const s = input.snapshot;
|
|
282
|
+
return planStyles(
|
|
283
|
+
{
|
|
284
|
+
format: input.format ?? "json",
|
|
285
|
+
dialect: "cytoscape-js",
|
|
286
|
+
tool: "cytoscape-js",
|
|
287
|
+
units: "px",
|
|
288
|
+
node: { values: r2.node.values, rules: r2.node.rules, columns: r2.node.columns },
|
|
289
|
+
edge: { values: r2.edge.values, rules: r2.edge.rules, columns: r2.edge.columns },
|
|
290
|
+
fingerprint: styleFingerprint(s)
|
|
291
|
+
},
|
|
292
|
+
{ node: featuresOf(s, "node"), edge: featuresOf(s, "edge") },
|
|
293
|
+
{
|
|
294
|
+
toolDefaults: input.toolDefaults,
|
|
295
|
+
notes,
|
|
296
|
+
budget,
|
|
297
|
+
signal: input.signal,
|
|
298
|
+
rawColumns: { node: r2.node.rawColumns, edge: r2.edge.rawColumns }
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
export {
|
|
303
|
+
C as CYTOSCAPE_IMPORT_KEY,
|
|
304
|
+
t as MAX_STYLE_BLOCK_LENGTH,
|
|
305
|
+
M as MAX_STYLE_RULES,
|
|
306
|
+
S as STYLE_BLOCK_NAME,
|
|
307
|
+
u as STYLE_ENUMS,
|
|
308
|
+
a as STYLE_ISSUE,
|
|
309
|
+
v as STYLE_PROPERTIES,
|
|
310
|
+
T as TOOL_DEFAULTS,
|
|
311
|
+
e as extractStyles,
|
|
312
|
+
featuresOf,
|
|
313
|
+
i as isStyleValue,
|
|
314
|
+
planStyles,
|
|
315
|
+
readAnnotations,
|
|
316
|
+
readCytoscapeStyles,
|
|
317
|
+
r as resolveStyles,
|
|
318
|
+
styleFingerprint,
|
|
319
|
+
t2 as toCytoscapeStylesheet,
|
|
320
|
+
w as toolDefaults
|
|
321
|
+
};
|
|
322
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../src/styles/annotations.ts","../src/styles/cyjs/live.ts"],"sourcesContent":["/**\n * The annotations a file draws beside its graph: shapes, text notes and arrows that are not nodes or edges. Cytoscape\n * desktop keeps them in the network's `__Annotations` column (sessions, XGMML, CX and CX2 all carry it), one\n * `key=value|key=value` string per annotation; this reads them as neutral facts in the position convention (y up,\n * the file's own units), so they line up with `extractPositions()`.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport type { StyleArrowShape, StyleColor, StyleNodeShape } from \"./types.js\";\n\n/**\n * A point in the position convention: y up, in the file's own units.\n * @category Styles\n */\nexport interface AnnotationPoint {\n /** The x coordinate. */\n readonly x: number;\n /** The y coordinate, y up. */\n readonly y: number;\n}\n\n/**\n * What every annotation has.\n * @category Styles\n */\nexport interface AnnotationBase {\n /** The file's id for the annotation, or its index when the file gives none. */\n readonly id: string;\n /** Whether it is drawn behind the graph or in front of it. */\n readonly layer: \"background\" | \"foreground\";\n /** Its drawing order within its layer, lowest first. */\n readonly z: number;\n}\n\n/**\n * A filled, outlined shape.\n * @category Styles\n */\nexport interface ShapeAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"shape\". */\n readonly kind: \"shape\";\n /** The box's center. */\n readonly center: AnnotationPoint;\n /** The box's width. */\n readonly width: number;\n /** The box's height. */\n readonly height: number;\n /** The outline's shape. */\n readonly shape: StyleNodeShape;\n /** The fill color, or null for none. */\n readonly fill: StyleColor | null;\n /** The fill's opacity, 0..1. */\n readonly fillOpacity: number;\n /** The outline's color. */\n readonly borderColor: StyleColor;\n /** The outline's opacity, 0..1. */\n readonly borderOpacity: number;\n /** The outline's width. */\n readonly borderWidth: number;\n}\n\n/**\n * A line of text.\n * @category Styles\n */\nexport interface TextAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"text\". */\n readonly kind: \"text\";\n /** The text. */\n readonly text: string;\n /** Where the text is placed: the top-left corner of its box, or its center. */\n readonly at: AnnotationPoint;\n /** What `at` is. */\n readonly anchor: \"top-left\" | \"center\";\n /** The font size, in the file's units. */\n readonly fontSize: number;\n /** The font family. */\n readonly fontFamily: string;\n /** Whether the text is bold. */\n readonly bold: boolean;\n /** Whether the text is italic. */\n readonly italic: boolean;\n /** The text color. */\n readonly color: StyleColor;\n /** The text's opacity, 0..1. */\n readonly opacity: number;\n}\n\n/**\n * A line between two points, with an arrowhead at either end.\n * @category Styles\n */\nexport interface ArrowAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"arrow\". */\n readonly kind: \"arrow\";\n /** Where the line starts. */\n readonly from: AnnotationPoint;\n /** Where it ends. */\n readonly to: AnnotationPoint;\n /** The line color. */\n readonly color: StyleColor;\n /** The line's opacity, 0..1. */\n readonly opacity: number;\n /** The line width. */\n readonly width: number;\n /** The arrowhead at the start. */\n readonly sourceArrow: StyleArrowShape;\n /** The arrowhead at the end. */\n readonly targetArrow: StyleArrowShape;\n /** The start's arrowhead size as a factor of the normal size. */\n readonly sourceSize: number;\n /** The end's arrowhead size as a factor of the normal size. */\n readonly targetSize: number;\n}\n\n/**\n * One annotation.\n * @category Styles\n */\nexport type GraphAnnotation = ShapeAnnotation | TextAnnotation | ArrowAnnotation;\n\n/**\n * A file's annotations, and the kinds it holds that are not read (images, groups of annotations), by the file's\n * own type name, once each.\n * @category Styles\n */\nexport interface FileAnnotations {\n /** The annotations read, in the file's order. */\n readonly annotations: readonly GraphAnnotation[];\n /** The file's type names of the annotations not read. */\n readonly skipped: readonly string[];\n}\n\n/** The graph column Cytoscape desktop keeps its annotations in. */\nconst CYTOSCAPE_ANNOTATIONS_COLUMN = \"__Annotations\";\n\nconst TYPE_PREFIX = \"org.cytoscape.view.presentation.annotations.\";\n\n/** Cytoscape's annotation shape names, lowercase, as neutral shapes. */\nconst SHAPES: ReadonlyMap<string, StyleNodeShape> = new Map<string, StyleNodeShape>([\n [\"rectangle\", \"rectangle\"],\n [\"roundedrectangle\", \"round-rectangle\"],\n [\"rounded_rectangle\", \"round-rectangle\"],\n [\"ellipse\", \"ellipse\"],\n [\"triangle\", \"triangle\"],\n [\"diamond\", \"diamond\"],\n [\"pentagon\", \"pentagon\"],\n [\"hexagon\", \"hexagon\"],\n [\"octagon\", \"octagon\"],\n [\"parallelogram\", \"parallelogram\"],\n [\"star5\", \"star\"],\n [\"star6\", \"star\"],\n]);\n\n/**\n * Cytoscape's annotation arrowheads, by the position in its `ArrowType` list (older sessions) and by name (newer\n * ones), lowercase.\n */\nconst ARROW_ORDER: readonly StyleArrowShape[] = [\n \"circle\",\n \"triangle\",\n \"vee\",\n \"diamond\",\n \"triangle-open\",\n \"none\",\n \"tee\",\n \"triangle\",\n \"triangle\",\n \"triangle\",\n \"tee\",\n \"other:x\",\n];\nconst ARROW_NAMES: ReadonlyMap<string, StyleArrowShape> = new Map<string, StyleArrowShape>([\n [\"circle\", \"circle\"],\n [\"closed arrow\", \"triangle\"],\n [\"concave arrow\", \"vee\"],\n [\"diamond\", \"diamond\"],\n [\"open arrow\", \"triangle-open\"],\n [\"no arrow\", \"none\"],\n [\"pipe\", \"tee\"],\n [\"triangle\", \"triangle\"],\n [\"t\", \"tee\"],\n [\"x\", \"other:x\"],\n]);\n\n/**\n * The annotations a graph holds, from the column Cytoscape desktop keeps them in.\n * @param snapshot - the graph\n * @returns the annotations; none when the graph has the column empty or not at all\n * @category Styles\n */\nexport function readAnnotations(snapshot: GraphSnapshot): FileAnnotations {\n const { graph } = snapshot;\n const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;\n const entries = cellStrings(cell);\n const fields = entries.map(parseEntry);\n const byId = new Map(fields.map((f, i) => [f.get(\"uuid\") ?? String(i), f]));\n const annotations: GraphAnnotation[] = [];\n const skipped = new Set<string>();\n fields.forEach((f, i) => {\n const read = readOne(f, String(i), byId);\n if (read === null) {\n skipped.add((f.get(\"type\") ?? \"\").replace(TYPE_PREFIX, \"\"));\n } else {\n annotations.push(...read);\n }\n });\n return { annotations, skipped: [...skipped] };\n}\n\n/**\n * A cell's strings: a list cell's items, or the lines of a text cell.\n * @param cell - the cell\n * @returns the strings\n */\nfunction cellStrings(cell: unknown): string[] {\n if (typeof cell === \"string\") {\n return cell.split(/[\\r\\n]+/).filter((s) => s !== \"\");\n }\n if (cell !== null && typeof cell === \"object\" && Symbol.iterator in cell) {\n return Array.from(cell as Iterable<unknown>).filter((s): s is string => typeof s === \"string\" && s !== \"\");\n }\n return [];\n}\n\n/**\n * One annotation string's fields.\n * @param entry - `key=value|key=value`\n * @returns the fields\n */\nfunction parseEntry(entry: string): Map<string, string> {\n const out = new Map<string, string>();\n for (const part of entry.split(\"|\")) {\n const eq = part.indexOf(\"=\");\n if (eq > 0) {\n out.set(part.slice(0, eq), part.slice(eq + 1));\n }\n }\n return out;\n}\n\n/**\n * One annotation as neutral facts; a bounded text annotation is a shape and its text.\n * @param f - its fields\n * @param index - its position, its id when it has no uuid\n * @param byId - every annotation's fields by id, for an arrow's ends\n * @returns the annotations, or null for a kind not read\n */\nfunction readOne(\n f: ReadonlyMap<string, string>,\n index: string,\n byId: ReadonlyMap<string, ReadonlyMap<string, string>>,\n): GraphAnnotation[] | null {\n const type = (f.get(\"type\") ?? \"\").replace(TYPE_PREFIX, \"\");\n const zoom = positive(f.get(\"zoom\")) ?? 1;\n const base: AnnotationBase = {\n id: f.get(\"uuid\") ?? index,\n layer: f.get(\"canvas\") === \"background\" ? \"background\" : \"foreground\",\n z: num(f.get(\"z\")) ?? 0,\n };\n switch (type) {\n case \"ShapeAnnotation\":\n return [shapeOf(f, base, zoom)];\n case \"TextAnnotation\":\n return [textOf(f, base, zoom, { x: num(f.get(\"x\")) ?? 0, y: -(num(f.get(\"y\")) ?? 0) }, \"top-left\")];\n case \"BoundedTextAnnotation\": {\n const shape = shapeOf(f, base, zoom);\n return [shape, textOf(f, { ...base, id: `${base.id}:text` }, zoom, shape.center, \"center\")];\n }\n case \"ArrowAnnotation\":\n return arrowOf(f, base, zoom, byId);\n default:\n return null;\n }\n}\n\n/**\n * A shape annotation: `x`, `y` its top-left corner, y down; `width`, `height` and the outline at the saved zoom.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its sizes were saved at\n * @returns the shape\n */\nfunction shapeOf(f: ReadonlyMap<string, string>, base: AnnotationBase, zoom: number): ShapeAnnotation {\n const x = num(f.get(\"x\")) ?? 0;\n const y = num(f.get(\"y\")) ?? 0;\n const width = (positive(f.get(\"width\")) ?? 0) / zoom;\n const height = (positive(f.get(\"height\")) ?? 0) / zoom;\n const fill = javaColor(f.get(\"fillColor\"));\n const border = javaColor(f.get(\"edgeColor\")) ?? { color: \"#000000\", alpha: 1 };\n return {\n ...base,\n kind: \"shape\",\n center: { x: x + width / 2, y: -(y + height / 2) },\n width,\n height,\n shape: SHAPES.get((f.get(\"shapeType\") ?? \"rectangle\").toLowerCase()) ?? \"rectangle\",\n fill: fill?.color ?? null,\n fillOpacity: fill === null ? 0 : fill.alpha * percent(f.get(\"fillOpacity\")),\n borderColor: border.color,\n borderOpacity: border.alpha * percent(f.get(\"edgeOpacity\")),\n borderWidth: (num(f.get(\"edgeThickness\")) ?? 1) / zoom,\n };\n}\n\n/**\n * A text annotation, or the text of a bounded one.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its font size was saved at\n * @param at - where it is placed\n * @param anchor - what `at` is\n * @returns the text\n */\nfunction textOf(\n f: ReadonlyMap<string, string>,\n base: AnnotationBase,\n zoom: number,\n at: AnnotationPoint,\n anchor: TextAnnotation[\"anchor\"],\n): TextAnnotation {\n // java.awt.Font styles: 1 bold, 2 italic, 3 both\n const style = num(f.get(\"fontStyle\")) ?? 0;\n const color = javaColor(f.get(\"color\")) ?? { color: \"#000000\", alpha: 1 };\n return {\n ...base,\n kind: \"text\",\n text: f.get(\"text\") ?? \"\",\n at,\n anchor,\n fontSize: (positive(f.get(\"fontSize\")) ?? 12) / zoom,\n fontFamily: f.get(\"fontFamily\") ?? \"sans-serif\",\n bold: (style & 1) !== 0,\n italic: (style & 2) !== 0,\n color: color.color,\n opacity: color.alpha,\n };\n}\n\n/**\n * An arrow annotation. Cytoscape keeps its start as the annotation it leaves (`sourceAnnotation`) and its end as a\n * point, a node's center at save time (`targetNode`) or another annotation, and saves the arrow's top-left corner\n * as `x`, `y`: the start wherever the end lies right of and below it, which is taken for the start, else the center\n * of the annotation it leaves.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its line width was saved at\n * @param byId - every annotation's fields by id\n * @returns the arrow, or null when it has no end\n */\nfunction arrowOf(\n f: ReadonlyMap<string, string>,\n base: AnnotationBase,\n zoom: number,\n byId: ReadonlyMap<string, ReadonlyMap<string, string>>,\n): ArrowAnnotation[] | null {\n const target = f.get(\"targetAnnotation\");\n const to = point(f.get(\"targetPoint\")) ?? point(f.get(\"targetNode\")) ?? centerOf(byId.get(target ?? \"\"), zoom);\n if (to === null) {\n return null;\n }\n const corner = { x: num(f.get(\"x\")) ?? 0, y: num(f.get(\"y\")) ?? 0 };\n const source = centerOf(byId.get(f.get(\"sourceAnnotation\") ?? \"\"), zoom) ?? corner;\n // ponytail: the start is exact only when the end lies right of and below it; elsewhere the center of the\n // annotation it leaves, as Cytoscape stores no other start. Clip to that annotation's box if it matters.\n const from = { x: to.x > corner.x ? corner.x : source.x, y: to.y > corner.y ? corner.y : source.y };\n const color = javaColor(f.get(\"lineColor\")) ?? { color: \"#000000\", alpha: 1 };\n return [\n {\n ...base,\n kind: \"arrow\",\n from: { x: from.x, y: -from.y },\n to: { x: to.x, y: -to.y },\n color: color.color,\n opacity: color.alpha * percent(f.get(\"lineOpacity\")),\n width: (positive(f.get(\"lineThickness\")) ?? 1) / zoom,\n sourceArrow: arrowShape(f.get(\"sourceType\")),\n targetArrow: arrowShape(f.get(\"targetType\")),\n sourceSize: positive(f.get(\"sourceSize\")) ?? 1,\n targetSize: positive(f.get(\"targetSize\")) ?? 1,\n },\n ];\n}\n\n/**\n * An annotation's center, y down as the file writes it: a shape's box center, a text's corner.\n * @param f - its fields, or undefined\n * @param zoom - the zoom the arrow was saved at\n * @returns the point, or null\n */\nfunction centerOf(f: ReadonlyMap<string, string> | undefined, zoom: number): AnnotationPoint | null {\n if (f === undefined) {\n return null;\n }\n const x = num(f.get(\"x\"));\n const y = num(f.get(\"y\"));\n if (x === null || y === null) {\n return null;\n }\n return { x: x + (positive(f.get(\"width\")) ?? 0) / zoom / 2, y: y + (positive(f.get(\"height\")) ?? 0) / zoom / 2 };\n}\n\n/**\n * An arrowhead by its `ArrowType` position or name.\n * @param raw - the field\n * @returns the shape; a triangle for one not known\n */\nfunction arrowShape(raw: string | undefined): StyleArrowShape {\n if (raw === undefined) {\n return \"none\";\n }\n const n = num(raw);\n if (n !== null) {\n return ARROW_ORDER[n] ?? \"triangle\";\n }\n return ARROW_NAMES.get(raw.trim().toLowerCase()) ?? \"triangle\";\n}\n\n/**\n * A `x,y` point as the file writes it.\n * @param raw - the field\n * @returns the point, or null\n */\nfunction point(raw: string | undefined): AnnotationPoint | null {\n const [x, y] = (raw ?? \"\").split(\",\").map((s) => num(s));\n return x === null || x === undefined || y === null || y === undefined ? null : { x, y };\n}\n\n/**\n * A Java color as a signed ARGB integer.\n * @param raw - the field\n * @returns the color and its alpha, or null\n */\nfunction javaColor(raw: string | undefined): { color: StyleColor; alpha: number } | null {\n const n = num(raw);\n if (n === null || !Number.isInteger(n)) {\n return null;\n }\n const argb = n >>> 0;\n return {\n color: `#${(argb & 0xffffff).toString(16).padStart(6, \"0\")}`,\n alpha: (argb >>> 24) / 255,\n };\n}\n\n/**\n * A 0..100 percentage as 0..1; 1 when absent.\n * @param raw - the field\n * @returns the fraction\n */\nfunction percent(raw: string | undefined): number {\n const n = num(raw);\n return n === null ? 1 : Math.min(1, Math.max(0, n / 100));\n}\n\n/**\n * A finite number.\n * @param raw - the field\n * @returns the number, or null\n */\nfunction num(raw: string | undefined): number | null {\n if (raw === undefined || raw.trim() === \"\") {\n return null;\n }\n const n = Number(raw);\n return Number.isFinite(n) ? n : null;\n}\n\n/**\n * A positive number.\n * @param raw - the field\n * @returns the number, or null\n */\nfunction positive(raw: string | undefined): number | null {\n const n = num(raw);\n return n !== null && n > 0 ? n : null;\n}\n","/**\n * The styles of a live Cytoscape.js core: the rules from its stylesheet (`cy.style().json()`) and, when given, the\n * truth per element from what the core reports it draws (`ele.style()`). Reported values win over the stylesheet\n * where they disagree, so a property whose stylesheet value is a function (which `cy.style().json()` writes as \"fn\")\n * is still exact: it is copied per element from the reported values and noted as `W_STYLE_LAYER_FLATTENED` with the\n * sample (and the rule reason) `FUNCTION`.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { StyleBudget } from \"../budget.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { featuresOf, styleFingerprint } from \"../plan/features.js\";\nimport { planStyles } from \"../plan/plan.js\";\nimport type { ExtractedStyles, StyleWorkBudget } from \"../types.js\";\nimport { evaluateCytoscapeJs } from \"./cascade.js\";\n\n/** The input of `readCytoscapeStyles()`. */\nexport interface CytoscapeLiveInput {\n /** The core's elements: `cy.elements().jsons()`, or `{ nodes, edges }`. */\n readonly elements: unknown;\n /** The core's stylesheet: `cy.style().json()` (a function is written there as \"fn\"), or the one it was given. */\n readonly style: unknown;\n /**\n * What the core draws for each element, `ele.style()`, in the order of `elements` (for `{ nodes, edges }`, the\n * nodes then the edges); optional, and null for an element with none.\n */\n readonly rendered?: readonly (Readonly<Record<string, unknown>> | null | undefined)[];\n /** The graph the styles are for (the core's elements as a snapshot); the values come out indexed like it. */\n readonly snapshot: GraphSnapshot;\n /** The graph-io format id recorded as the styles' source; default \"json\". */\n readonly format?: string;\n /** Whether Cytoscape.js's defaults fill what the stylesheet leaves unset; default true. */\n readonly toolDefaults?: boolean;\n /**\n * Where problems are noted; graph-io's own engine passes its notes here.\n * @internal\n */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /** Cancels the work. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * What a stylesheet function is read as: a function, whatever it returned.\n * @returns nothing\n */\nconst FUNCTION = (): null => null;\n\n/**\n * The stylesheet with every \"fn\" value (how `cy.style().json()` writes a function) read as a function.\n * @param style - the stylesheet\n * @returns the stylesheet to apply\n */\nfunction withFunctions(style: unknown): unknown {\n if (!Array.isArray(style)) {\n return style;\n }\n return style.map((entry: unknown) => {\n if (entry === null || typeof entry !== \"object\") {\n return entry;\n }\n const e = entry as Record<string, unknown>;\n const props = e.style ?? e.css;\n if (props === null || typeof props !== \"object\") {\n return entry;\n }\n const copy = Object.create(null) as Record<string, unknown>;\n for (const name of Object.keys(props)) {\n const v = (props as Record<string, unknown>)[name];\n copy[name] = v === \"fn\" ? FUNCTION : v;\n }\n return { selector: e.selector, style: copy };\n });\n}\n\n/**\n * The element list in order: an array as it is, `{ nodes, edges }` as the nodes then the edges.\n * @param elements - the elements\n * @returns the list\n */\nfunction elementList(elements: unknown): readonly unknown[] {\n if (Array.isArray(elements)) {\n return elements;\n }\n if (elements !== null && typeof elements === \"object\") {\n const e = elements as Record<string, unknown>;\n return [...(Array.isArray(e.nodes) ? e.nodes : []), ...(Array.isArray(e.edges) ? e.edges : [])];\n }\n return [];\n}\n\n/**\n * Reads the styles of a live Cytoscape.js core: the stylesheet's rules, with what the core reports it draws as the\n * truth per element when given.\n * @param input - the elements, the stylesheet, the reported values and the graph\n * @returns the styles, exact for every element\n * @category Styles\n */\nexport function readCytoscapeStyles(input: CytoscapeLiveInput): ExtractedStyles {\n const notes = input.notes ?? new StyleNotes();\n const budget = input.budget ?? new StyleBudget();\n let rendered: Map<object, Readonly<Record<string, unknown>>> | undefined;\n if (input.rendered !== undefined) {\n rendered = new Map();\n const list = elementList(input.elements);\n for (let i = 0; i < list.length && i < input.rendered.length; i++) {\n const json = list[i];\n const r = input.rendered[i];\n if (json !== null && typeof json === \"object\" && r !== null && r !== undefined && typeof r === \"object\") {\n rendered.set(json, r);\n }\n }\n }\n const r = evaluateCytoscapeJs({\n elements: input.elements,\n style: withFunctions(input.style),\n snapshot: input.snapshot,\n toolDefaults: input.toolDefaults,\n rendered,\n notes,\n budget,\n signal: input.signal,\n });\n const s = input.snapshot;\n return planStyles(\n {\n format: input.format ?? \"json\",\n dialect: \"cytoscape-js\",\n tool: \"cytoscape-js\",\n units: \"px\",\n node: { values: r.node.values, rules: r.node.rules, columns: r.node.columns },\n edge: { values: r.edge.values, rules: r.edge.rules, columns: r.edge.columns },\n fingerprint: styleFingerprint(s),\n },\n { node: featuresOf(s, \"node\"), edge: featuresOf(s, \"edge\") },\n {\n toolDefaults: input.toolDefaults,\n notes,\n budget,\n signal: input.signal,\n rawColumns: { node: r.node.rawColumns, edge: r.edge.rawColumns },\n },\n );\n}\n"],"names":["i","e","v","r"],"mappings":";;;;;;AAuIA,MAAM,+BAA+B;AAErC,MAAM,cAAc;AAGpB,MAAM,6BAAkD,IAA4B;AAAA,EAChF,CAAC,aAAa,WAAW;AAAA,EACzB,CAAC,oBAAoB,iBAAiB;AAAA,EACtC,CAAC,qBAAqB,iBAAiB;AAAA,EACvC,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,iBAAiB,eAAe;AAAA,EACjC,CAAC,SAAS,MAAM;AAAA,EAChB,CAAC,SAAS,MAAM;AACpB,CAAC;AAMD,MAAM,cAA0C;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACA,MAAM,kCAAwD,IAA6B;AAAA,EACvF,CAAC,UAAU,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,MACpE,MAAM,EAAE,QAAQA,GAAE,KAAK,QAAQ,OAAOA,GAAE,KAAK,OAAO,SAASA,GAAE,KAAK,QAAA;AAAA,MACpE,aAAa,iBAAiB,CAAC;AAAA,IAAA;AAAA,IAEnC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,WAAW,GAAG,MAAM,EAAA;AAAA,IACzD;AAAA,MACI,cAAc,MAAM;AAAA,MACpB;AAAA,MACA;AAAA,MACA,QAAQ,MAAM;AAAA,MACd,YAAY,EAAE,MAAMA,GAAE,KAAK,YAAY,MAAMA,GAAE,KAAK,WAAA;AAAA,IAAW;AAAA,EACnE;AAER;"}
|
package/dist/xgmml.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { X, a
|
|
2
|
-
import { x
|
|
1
|
+
import { X, a } from "./chunks/styles-_N-C8S-U.js";
|
|
2
|
+
import { x } from "./chunks/exporter-BtnqYuuj.js";
|
|
3
|
+
import { x as x2 } from "./chunks/importer-BFmOP96W.js";
|
|
3
4
|
export {
|
|
4
5
|
X as XGMML_ISSUE,
|
|
5
6
|
a as XGMML_LOSS,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
x as xgmmlExporter,
|
|
8
|
+
x2 as xgmmlImporter
|
|
8
9
|
};
|
|
9
10
|
//# sourceMappingURL=xgmml.js.map
|
package/dist/xgmml.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xgmml.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"xgmml.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphty/graph-io",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.44",
|
|
4
4
|
"description": "Read and write 13 graph file formats (JSON, GraphML, GEXF, CSV, GML, DOT, Pajek, Neo4j CSV, XGMML, CX2, CX, OBO, Cytoscape sessions) as @graphty/graph-format snapshots",
|
|
5
5
|
"author": "Adam Powers <apowers@ato.ms>",
|
|
6
6
|
"type": "module",
|
|
@@ -76,6 +76,16 @@
|
|
|
76
76
|
"types": "./dist/cys.d.ts",
|
|
77
77
|
"import": "./dist/cys.js",
|
|
78
78
|
"default": "./dist/cys.js"
|
|
79
|
+
},
|
|
80
|
+
"./styles": {
|
|
81
|
+
"types": "./dist/styles.d.ts",
|
|
82
|
+
"import": "./dist/styles.js",
|
|
83
|
+
"default": "./dist/styles.js"
|
|
84
|
+
},
|
|
85
|
+
"./positions": {
|
|
86
|
+
"types": "./dist/positions.d.ts",
|
|
87
|
+
"import": "./dist/positions.js",
|
|
88
|
+
"default": "./dist/positions.js"
|
|
79
89
|
}
|
|
80
90
|
},
|
|
81
91
|
"sideEffects": false,
|
|
@@ -121,7 +131,7 @@
|
|
|
121
131
|
},
|
|
122
132
|
"homepage": "https://graphty.app/docs/graph-io/",
|
|
123
133
|
"dependencies": {
|
|
124
|
-
"@graphty/graph-format": "^1.4.
|
|
134
|
+
"@graphty/graph-format": "^1.4.5"
|
|
125
135
|
},
|
|
126
136
|
"peerDependencies": {
|
|
127
137
|
"@graphty/graph-format": "^1.0.0"
|
|
@@ -129,6 +139,7 @@
|
|
|
129
139
|
"devDependencies": {
|
|
130
140
|
"@vitest/coverage-v8": "4.1.11",
|
|
131
141
|
"@vitest/ui": "4.1.11",
|
|
142
|
+
"cytoscape": "^3.34.3",
|
|
132
143
|
"eslint": "^9.29.0",
|
|
133
144
|
"fast-check": "^4.2.0",
|
|
134
145
|
"fast-xml-parser": "^5.11.1",
|
package/src/common/codes.ts
CHANGED
|
@@ -68,6 +68,13 @@ export const SYNTAX_CODE = "E_SYNTAX";
|
|
|
68
68
|
*/
|
|
69
69
|
export const XML_SYNTAX_CODE = "E_XML_SYNTAX";
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Elements are nested deeper than graph-io reads (`MAX_XML_DEPTH`, 100,000 levels); the message says where. The import
|
|
73
|
+
* stops.
|
|
74
|
+
* @category Issue and loss codes
|
|
75
|
+
*/
|
|
76
|
+
export const XML_NESTING_CODE = "E_XML_NESTING";
|
|
77
|
+
|
|
71
78
|
/**
|
|
72
79
|
* An element the format does not define at that place was skipped.
|
|
73
80
|
* @category Issue and loss codes
|
package/src/common/escape.ts
CHANGED
|
@@ -165,7 +165,8 @@ export function isBareDotId(text: string): boolean {
|
|
|
165
165
|
|
|
166
166
|
/**
|
|
167
167
|
* Whether a text is a DOT identifier: a letter, underscore or any character of code 128 and
|
|
168
|
-
* above, followed by letters, digits, underscores or
|
|
168
|
+
* above other than U+FEFF, followed by letters, digits, underscores or characters of code 128 and
|
|
169
|
+
* above.
|
|
169
170
|
* @param text - the text
|
|
170
171
|
* @returns true for a bare identifier
|
|
171
172
|
*/
|
|
@@ -175,7 +176,9 @@ function isDotIdentifier(text: string): boolean {
|
|
|
175
176
|
}
|
|
176
177
|
for (let i = 0; i < text.length; i++) {
|
|
177
178
|
const c = text.charCodeAt(i);
|
|
178
|
-
|
|
179
|
+
// A leading U+FEFF is read back as whitespace between tokens, so it must be quoted.
|
|
180
|
+
const letter =
|
|
181
|
+
(c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95 || (c >= 128 && (i > 0 || c !== 0xfeff));
|
|
179
182
|
const digit = c >= 48 && c <= 57;
|
|
180
183
|
if (!letter && (i === 0 || !digit)) {
|
|
181
184
|
return false;
|