@graphty/graph-io 0.3.43 → 0.3.45
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-DJMHdDvv.js +40 -0
- package/dist/chunks/approximations-DJMHdDvv.js.map +1 -0
- package/dist/chunks/block-CPCHkX42.js +2777 -0
- package/dist/chunks/block-CPCHkX42.js.map +1 -0
- package/dist/chunks/{choose-DvpbdRuz.js → choose--jM0yYCo.js} +3 -2
- package/dist/chunks/{choose-DvpbdRuz.js.map → choose--jM0yYCo.js.map} +1 -1
- package/dist/chunks/{constants-fT3E8JYY.js → constants-BKwqelYD.js} +6 -2
- package/dist/chunks/constants-BKwqelYD.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-DZy6JgdA.js +3456 -0
- package/dist/chunks/emit-DZy6JgdA.js.map +1 -0
- package/dist/chunks/{escape-B62ZGM_a.js → escape-CgzxiYPg.js} +44 -21
- package/dist/chunks/escape-CgzxiYPg.js.map +1 -0
- package/dist/chunks/{export-rKLeGQMo.js → export-BvqAXCKh.js} +196 -792
- package/dist/chunks/export-BvqAXCKh.js.map +1 -0
- package/dist/chunks/{exporter-yLxKBvLE.js → exporter--Mk9gXCJ.js} +4 -3
- package/dist/chunks/{exporter-yLxKBvLE.js.map → exporter--Mk9gXCJ.js.map} +1 -1
- package/dist/chunks/{exporter-RVtXVetw.js → exporter-C-9cgZKa.js} +1805 -287
- package/dist/chunks/exporter-C-9cgZKa.js.map +1 -0
- package/dist/chunks/{exporter-8hLNemFk.js → exporter-DFqJhBnj.js} +133 -74
- package/dist/chunks/exporter-DFqJhBnj.js.map +1 -0
- package/dist/chunks/{exporter-BWwEuOPT.js → exporter-DteVeJki.js} +22 -12
- package/dist/chunks/exporter-DteVeJki.js.map +1 -0
- package/dist/chunks/format-BpQBx8MZ.js +676 -0
- package/dist/chunks/format-BpQBx8MZ.js.map +1 -0
- package/dist/chunks/generic-BGO71QBv.js +1347 -0
- package/dist/chunks/generic-BGO71QBv.js.map +1 -0
- package/dist/chunks/{importer-C98dpSH4.js → importer-B-9Rc1zO.js} +141 -82
- package/dist/chunks/importer-B-9Rc1zO.js.map +1 -0
- package/dist/chunks/{importer-D794XUTe.js → importer-BVVR740x.js} +31 -8
- package/dist/chunks/importer-BVVR740x.js.map +1 -0
- package/dist/chunks/{importer-WrGRZb0N.js → importer-C0AjA3Ax.js} +449 -102
- package/dist/chunks/importer-C0AjA3Ax.js.map +1 -0
- package/dist/chunks/{importer-BbNb7eNg.js → importer-C7pvJe1L.js} +1398 -129
- package/dist/chunks/importer-C7pvJe1L.js.map +1 -0
- package/dist/chunks/{importer-xZ-3suY1.js → importer-ClwoVx3O.js} +791 -135
- package/dist/chunks/importer-ClwoVx3O.js.map +1 -0
- package/dist/chunks/{importer-Ht7LNg8L.js → importer-D0sC_6bO.js} +116 -296
- package/dist/chunks/importer-D0sC_6bO.js.map +1 -0
- package/dist/chunks/{importer-Dz7tI8Sa.js → importer-EHQk1jbM.js} +617 -115
- package/dist/chunks/importer-EHQk1jbM.js.map +1 -0
- package/dist/chunks/{json-elements-DKSqpNW1.js → json-elements-DJZRZ6jd.js} +123 -32
- package/dist/chunks/json-elements-DJZRZ6jd.js.map +1 -0
- package/dist/chunks/lexicon-WMsNddyU.js +509 -0
- package/dist/chunks/lexicon-WMsNddyU.js.map +1 -0
- package/dist/chunks/{ontology-export-CtRXjg_i.js → ontology-export-G4MqRdux.js} +3 -2
- package/dist/chunks/{ontology-export-CtRXjg_i.js.map → ontology-export-G4MqRdux.js.map} +1 -1
- package/dist/chunks/{records-Cu4bxYOm.js → records-CiaWZrFH.js} +2 -2
- package/dist/chunks/{records-Cu4bxYOm.js.map → records-CiaWZrFH.js.map} +1 -1
- package/dist/chunks/styles-DvoFBKCK.js +690 -0
- package/dist/chunks/styles-DvoFBKCK.js.map +1 -0
- package/dist/chunks/styles-yed-Cz9rLBCP.js +842 -0
- package/dist/chunks/styles-yed-Cz9rLBCP.js.map +1 -0
- package/dist/chunks/styles-zNTmz5R7.js +2102 -0
- package/dist/chunks/styles-zNTmz5R7.js.map +1 -0
- package/dist/chunks/{text-DHOJXnED.js → text-CzJNFOS9.js} +2 -2
- package/dist/chunks/{text-DHOJXnED.js.map → text-CzJNFOS9.js.map} +1 -1
- package/dist/chunks/units-XMZFIFe1.js +19 -0
- package/dist/chunks/units-XMZFIFe1.js.map +1 -0
- package/dist/chunks/writer-gQ8kx99H.js +448 -0
- package/dist/chunks/writer-gQ8kx99H.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 +927 -74
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +351 -236
- 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 +1496 -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 +791 -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 +605 -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 +89 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -0
- package/dist/src/styles/io/writer.js +626 -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 +1755 -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 +952 -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 +658 -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 +780 -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
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { GraphFormatError, INVALID_INDEX, MAX_COUNT } from "@graphty/graph-format";
|
|
2
2
|
import { c as childrenCsr } from "./children-CA4coBi0.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { c as capabilities, r as resolveExportOptions, L as LOSS, G as sanitizeIds, a as checkCapabilities, p as pairFolding, a9 as isNmtoken, aa as mangleNmtoken, e as explicitWeights, O as isCanonicalIntegerText, g as resolveImportOptions, j as reportSinkOptions, i as reportUnusedOptions, t as textChunks, h as throwIfAborted, I as IdCoercer, l as DirectionResolver, o as isWeightField, q as declareAttribute, u as uniqueColumnName, d as declareResolved, ae as takenIn, s as parseWeightText, z as parseDeclaredValue, A as losesPrecision, v as overflowsToInfinity } from "./export-BvqAXCKh.js";
|
|
4
|
+
import { i as isWhitespace, a as escapeXmlText, p as isXmlName, e as escapeXmlAttribute, l as localName, x as xmlIllegalTextNotes, t as tokenizeXml, b as xmlDeclaredEncoding, X as XmlEmptyInputError, c as XmlSyntaxError, d as XmlNestingError, s as sniffXmlText } from "./escape-CgzxiYPg.js";
|
|
5
|
+
import { p as plural, a as agree, ad as formatInteger, a0 as formatF64, $ as formatF32, Z as ImportReportBuilder, P as PRECISION_CODE } from "./format-BpQBx8MZ.js";
|
|
5
6
|
import { j as joinText, e as encodeChunks } from "./writer-DxjgHwSe.js";
|
|
6
|
-
import { F as FORMAT, a as GRAPHML_LOSS, Y as YFILES_NAMESPACE, X as XSI_NAMESPACE,
|
|
7
|
+
import { F as FORMAT, O as ORIGINAL_ID_ATTRIBUTE, a as GRAPHML_LOSS, Y as YFILES_NAMESPACE, X as XSI_NAMESPACE, b as GRAPHML_NAMESPACE, S as SCHEMA_LOCATION, M as META_KEY, L as LABEL_COLUMN, R as RESERVED_NODE_NAMES, c as RESERVED_EDGE_NAMES, P as PARENT_COLUMN, T as TARGET_PORT_COLUMN, d as SOURCE_PORT_COLUMN, E as EDGE_ID_COLUMN, e as MIME_TYPES, f as EXTENSIONS, G as GRAPHML_ISSUE, g as ORIGINAL_ID_COLUMN, H as HYPEREDGE_HUB_COLUMN } from "./constants-BKwqelYD.js";
|
|
8
|
+
import { G as GRAPHML_STYLE_CAPABILITIES, h as graphmlStyledExport, t as treeChildren, i as isTree, l as localOf, j as treeAttr, k as treeChild, m as treeText, v as valueColumns, n as yfilesColumns, r as readYedStyles, o as exactFromBlock } from "./styles-yed-Cz9rLBCP.js";
|
|
9
|
+
import { p as plainCell, a as STYLE_ISSUE, M as MAX_STYLE_VALUE_LENGTH, h as canonNumber, o as canonText, l as canonEnum, n as noteAt, g as canonColor, x as colorOpacity, t as StyleNotes, S as STYLE_BLOCK_NAME, u as parseStyleBlock, s as styleFingerprint, v as blockStyles, r as resolveStyles } from "./block-CPCHkX42.js";
|
|
10
|
+
import { r as gephiRules } from "./styles-DvoFBKCK.js";
|
|
7
11
|
const ATTRIBUTE_PREFIX = "@_";
|
|
8
12
|
const TEXT_KEY = "#text";
|
|
9
13
|
class XmlTreeBuilder {
|
|
@@ -84,9 +88,9 @@ function valueOf(frame) {
|
|
|
84
88
|
}
|
|
85
89
|
function attachChild(parent, name, value) {
|
|
86
90
|
parent.hasChildren = true;
|
|
87
|
-
const existing = parent.node[name];
|
|
91
|
+
const existing = Object.hasOwn(parent.node, name) ? parent.node[name] : void 0;
|
|
88
92
|
if (existing === void 0) {
|
|
89
|
-
parent.node
|
|
93
|
+
Object.defineProperty(parent.node, name, { value, writable: true, enumerable: true, configurable: true });
|
|
90
94
|
} else if (Array.isArray(existing)) {
|
|
91
95
|
existing.push(value);
|
|
92
96
|
} else {
|
|
@@ -170,38 +174,38 @@ function writeElements(name, value, indent, out) {
|
|
|
170
174
|
}
|
|
171
175
|
return;
|
|
172
176
|
}
|
|
177
|
+
const brk = indent === null ? "" : `
|
|
178
|
+
${indent}`;
|
|
173
179
|
if (value === null || typeof value !== "object") {
|
|
174
|
-
const
|
|
175
|
-
out.push(
|
|
176
|
-
${indent}<${name}/>` : `
|
|
177
|
-
${indent}<${name}>${escapeXmlText(text22)}</${name}>`);
|
|
180
|
+
const text2 = scalarText(value);
|
|
181
|
+
out.push(text2.length === 0 ? `${brk}<${name}/>` : `${brk}<${name}>${escapeXmlText(text2)}</${name}>`);
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
180
|
-
|
|
181
|
-
|
|
184
|
+
writeObjectElement(name, value, indent, out);
|
|
185
|
+
}
|
|
186
|
+
function writeObjectElement(name, object, indent, out) {
|
|
187
|
+
const brk = indent === null ? "" : `
|
|
188
|
+
${indent}`;
|
|
189
|
+
const { attrs, text: text2, hasChildren } = elementParts(object);
|
|
182
190
|
if (!hasChildren) {
|
|
183
191
|
out.push(
|
|
184
|
-
text2 === null || text2.length === 0 ?
|
|
185
|
-
${indent}<${name}${attrs}/>` : `
|
|
186
|
-
${indent}<${name}${attrs}>${escapeXmlText(text2)}</${name}>`
|
|
192
|
+
text2 === null || text2.length === 0 ? `${brk}<${name}${attrs}/>` : `${brk}<${name}${attrs}>${escapeXmlText(text2)}</${name}>`
|
|
187
193
|
);
|
|
188
194
|
return;
|
|
189
195
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
const inner = indent === null || text2 !== null ? null : `${indent} `;
|
|
197
|
+
out.push(`${brk}<${name}${attrs}>`);
|
|
198
|
+
if (text2 !== null) {
|
|
199
|
+
out.push(escapeXmlText(text2));
|
|
200
|
+
}
|
|
193
201
|
for (const [key, child2] of Object.entries(object)) {
|
|
194
202
|
if (key !== TEXT_KEY && !key.startsWith(ATTRIBUTE_PREFIX)) {
|
|
195
203
|
writeElements(key, child2, inner, out);
|
|
196
204
|
}
|
|
197
205
|
}
|
|
198
|
-
|
|
199
|
-
out.push(escapeXmlText(text2));
|
|
200
|
-
}
|
|
201
|
-
out.push(`
|
|
202
|
-
${indent}</${name}>`);
|
|
206
|
+
out.push(inner === null ? `</${name}>` : `${brk}</${name}>`);
|
|
203
207
|
}
|
|
204
|
-
function
|
|
208
|
+
function elementParts(object) {
|
|
205
209
|
let attrs = "";
|
|
206
210
|
let text2 = null;
|
|
207
211
|
let hasChildren = false;
|
|
@@ -230,7 +234,20 @@ function scalarText(value) {
|
|
|
230
234
|
}
|
|
231
235
|
const YFILES_COLUMN_PREFIX = "yfiles.";
|
|
232
236
|
const NODE_FIELDS = {
|
|
233
|
-
|
|
237
|
+
// yEd writes the top-left corner of the node's box, y growing downward, in pixels
|
|
238
|
+
position: {
|
|
239
|
+
dtype: "f64",
|
|
240
|
+
components: 3,
|
|
241
|
+
role: "position",
|
|
242
|
+
mutable: true,
|
|
243
|
+
extra: {
|
|
244
|
+
units: "px",
|
|
245
|
+
yAxis: "down",
|
|
246
|
+
anchor: "top-left",
|
|
247
|
+
width: `${YFILES_COLUMN_PREFIX}width`,
|
|
248
|
+
height: `${YFILES_COLUMN_PREFIX}height`
|
|
249
|
+
}
|
|
250
|
+
},
|
|
234
251
|
width: { dtype: "f64" },
|
|
235
252
|
height: { dtype: "f64" },
|
|
236
253
|
color: { dtype: "string" },
|
|
@@ -261,6 +278,9 @@ function graphicsDecl(domain, field, keyId) {
|
|
|
261
278
|
}
|
|
262
279
|
};
|
|
263
280
|
}
|
|
281
|
+
function yfilesPositions(snapshot) {
|
|
282
|
+
return snapshot.nodes.byRole("position")?.meta.origin?.namespace === "yfiles" ? { tool: "yed" } : null;
|
|
283
|
+
}
|
|
264
284
|
function isGraphicsColumn(meta) {
|
|
265
285
|
return meta.dtype !== "json" && meta.origin?.namespace === "yfiles" && meta.name.startsWith(YFILES_COLUMN_PREFIX);
|
|
266
286
|
}
|
|
@@ -300,7 +320,9 @@ function graphicsValues(domain, tree, unmapped = []) {
|
|
|
300
320
|
const out = [];
|
|
301
321
|
if (domain === "node") {
|
|
302
322
|
const shape = child(tree, "ShapeNode");
|
|
303
|
-
if (shape
|
|
323
|
+
if (shape === void 0) {
|
|
324
|
+
geometryValues(child(geometryNode(tree), "Geometry"), out, unmapped);
|
|
325
|
+
} else {
|
|
304
326
|
shapeNodeValues(shape, out, unmapped);
|
|
305
327
|
}
|
|
306
328
|
} else {
|
|
@@ -312,14 +334,7 @@ function graphicsValues(domain, tree, unmapped = []) {
|
|
|
312
334
|
return out;
|
|
313
335
|
}
|
|
314
336
|
function shapeNodeValues(shape, out, unmapped) {
|
|
315
|
-
|
|
316
|
-
const x = checked(attr(geometry, "x"), "x", unmapped);
|
|
317
|
-
const y = checked(attr(geometry, "y"), "y", unmapped);
|
|
318
|
-
if (x !== void 0 && y !== void 0) {
|
|
319
|
-
out.push(["position", [x, y, 0]]);
|
|
320
|
-
}
|
|
321
|
-
push(out, "width", checked(attr(geometry, "width"), "width", unmapped));
|
|
322
|
-
push(out, "height", checked(attr(geometry, "height"), "height", unmapped));
|
|
337
|
+
geometryValues(child(shape, "Geometry"), out, unmapped);
|
|
323
338
|
push(out, "color", color(attr(child(shape, "Fill"), "color")));
|
|
324
339
|
const border = child(shape, "BorderStyle");
|
|
325
340
|
push(out, "borderColor", color(attr(border, "color")));
|
|
@@ -330,6 +345,33 @@ function shapeNodeValues(shape, out, unmapped) {
|
|
|
330
345
|
}
|
|
331
346
|
push(out, "shape", nonEmpty(attr(child(shape, "Shape"), "type")));
|
|
332
347
|
}
|
|
348
|
+
function geometryValues(geometry, out, unmapped) {
|
|
349
|
+
const x = checked(attr(geometry, "x"), "x", unmapped);
|
|
350
|
+
const y = checked(attr(geometry, "y"), "y", unmapped);
|
|
351
|
+
if (x !== void 0 && y !== void 0) {
|
|
352
|
+
out.push(["position", [x, y, 0]]);
|
|
353
|
+
}
|
|
354
|
+
push(out, "width", checked(attr(geometry, "width"), "width", unmapped));
|
|
355
|
+
push(out, "height", checked(attr(geometry, "height"), "height", unmapped));
|
|
356
|
+
}
|
|
357
|
+
const GEOMETRY_NODES = ["GenericNode", "ImageNode", "SVGNode"];
|
|
358
|
+
function geometryNode(tree) {
|
|
359
|
+
for (const local of GEOMETRY_NODES) {
|
|
360
|
+
const node = child(tree, local);
|
|
361
|
+
if (node !== void 0) {
|
|
362
|
+
return node;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
const realizers = child(child(tree, "ProxyAutoBoundsNode"), "Realizers");
|
|
366
|
+
const active = Number.parseInt(attr(realizers, "active") ?? "0", 10);
|
|
367
|
+
return elements(realizers)[Number.isNaN(active) ? 0 : active];
|
|
368
|
+
}
|
|
369
|
+
function elements(node) {
|
|
370
|
+
if (typeof node !== "object" || node === null) {
|
|
371
|
+
return [];
|
|
372
|
+
}
|
|
373
|
+
return Object.entries(node).filter(([key]) => !key.startsWith("@_") && key !== "#text").flatMap(([, value]) => Array.isArray(value) ? value : [value]);
|
|
374
|
+
}
|
|
333
375
|
function polyLineEdgeValues(edge, out, unmapped) {
|
|
334
376
|
const line = child(edge, "LineStyle");
|
|
335
377
|
push(out, "color", color(attr(line, "color")));
|
|
@@ -504,7 +546,7 @@ function graphmlMetaOf(snapshot) {
|
|
|
504
546
|
}
|
|
505
547
|
return { graphId, edgedefault, namespaces };
|
|
506
548
|
}
|
|
507
|
-
function planExport(snapshot, options, format) {
|
|
549
|
+
function planExport(snapshot, options, format, keyOrdered = false) {
|
|
508
550
|
const graphics = new Set(
|
|
509
551
|
[...snapshot.nodes, ...snapshot.edges].filter((c) => isGraphicsColumn(c.meta)).map((c) => c.meta.name)
|
|
510
552
|
);
|
|
@@ -522,6 +564,12 @@ function planExport(snapshot, options, format) {
|
|
|
522
564
|
const nodeColumns = planTable(snapshot.nodes, "node", notes, note);
|
|
523
565
|
const edgeColumns = planTable(snapshot.edges, "edge", notes, note);
|
|
524
566
|
const keys = planKeys([...graphColumns, ...nodeColumns, ...edgeColumns], keyIds);
|
|
567
|
+
if (keyOrdered) {
|
|
568
|
+
const keyOrder = new Map(keys.map((k, i) => [k.id, i]));
|
|
569
|
+
const byKey = (a, b) => (keyOrder.get(a.keyId) ?? 0) - (keyOrder.get(b.keyId) ?? 0);
|
|
570
|
+
nodeColumns.sort(byKey);
|
|
571
|
+
edgeColumns.sort(byKey);
|
|
572
|
+
}
|
|
525
573
|
reservedNameNotes(nodeColumns, RESERVED_NODE_NAMES, note);
|
|
526
574
|
reservedNameNotes(edgeColumns, RESERVED_EDGE_NAMES, note);
|
|
527
575
|
const weight = planWeight(snapshot, edgeColumns, keyIds, keys, note);
|
|
@@ -1133,7 +1181,8 @@ function keyElement(key, indent) {
|
|
|
1133
1181
|
text2 += ` attr.type="${escapeXmlAttribute(key.attrType)}"`;
|
|
1134
1182
|
}
|
|
1135
1183
|
if (key.yfilesType !== null) {
|
|
1136
|
-
|
|
1184
|
+
const uri = key.yfilesType.includes("://");
|
|
1185
|
+
text2 += ` ${uri ? "y:attr.uri" : "yfiles.type"}="${escapeXmlAttribute(key.yfilesType)}"`;
|
|
1137
1186
|
}
|
|
1138
1187
|
const { column } = key;
|
|
1139
1188
|
const desc = column?.meta.extra.desc;
|
|
@@ -1201,21 +1250,7 @@ function* writeGraphml(snapshot, plan) {
|
|
|
1201
1250
|
const i3 = plan.pretty ? " " : "";
|
|
1202
1251
|
const step = plan.pretty ? " " : "";
|
|
1203
1252
|
yield '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
1204
|
-
|
|
1205
|
-
const namespaces = { ...plan.meta?.namespaces };
|
|
1206
|
-
if ((plan.nodeColumns.some((c) => c.yfiles) || plan.edgeColumns.some((c) => c.yfiles) || plan.graphColumns.some((c) => c.yfiles)) && !Object.values(namespaces).includes(YFILES_NAMESPACE)) {
|
|
1207
|
-
namespaces.y = YFILES_NAMESPACE;
|
|
1208
|
-
}
|
|
1209
|
-
if (!Object.values(namespaces).includes(XSI_NAMESPACE)) {
|
|
1210
|
-
namespaces.xsi = XSI_NAMESPACE;
|
|
1211
|
-
}
|
|
1212
|
-
for (const [prefix, uri] of Object.entries(namespaces)) {
|
|
1213
|
-
root += ` xmlns:${prefix}="${escapeXmlAttribute(uri)}"`;
|
|
1214
|
-
}
|
|
1215
|
-
const xsiPrefix = Object.entries(namespaces).find(([, uri]) => uri === XSI_NAMESPACE)?.[0] ?? "xsi";
|
|
1216
|
-
root += ` ${xsiPrefix}:schemaLocation="${SCHEMA_LOCATION}">
|
|
1217
|
-
`;
|
|
1218
|
-
yield root;
|
|
1253
|
+
yield rootElement(plan);
|
|
1219
1254
|
for (const key of plan.keys) {
|
|
1220
1255
|
yield keyElement(key, i1);
|
|
1221
1256
|
}
|
|
@@ -1248,58 +1283,80 @@ ${i2}<desc>${escapeXmlText(description)}</desc>`;
|
|
|
1248
1283
|
yield* writeNodeSubtree(rootNode, plan, ids, i2, step, walk);
|
|
1249
1284
|
}
|
|
1250
1285
|
const list = snapshot.edgeList();
|
|
1251
|
-
const { folding } = plan;
|
|
1252
1286
|
for (let e = 0; e < snapshot.edgeCount; e++) {
|
|
1253
|
-
if (folding.folded(e)) {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
const parts = [`
|
|
1257
|
-
${i2}<edge`];
|
|
1258
|
-
const id = edgeIds[e];
|
|
1259
|
-
if (id !== null) {
|
|
1260
|
-
parts.push(` id="${escapeXmlAttribute(id)}"`);
|
|
1261
|
-
}
|
|
1262
|
-
parts.push(
|
|
1263
|
-
` source="${escapeXmlAttribute(String(ids.idAt(list.src[e])))}" target="${escapeXmlAttribute(String(ids.idAt(list.dst[e])))}"`
|
|
1264
|
-
);
|
|
1265
|
-
const directed = snapshot.directed && isDirectedEdge(folding, e);
|
|
1266
|
-
if (directed !== (plan.edgedefault === "directed")) {
|
|
1267
|
-
parts.push(` directed="${directed ? "true" : "false"}"`);
|
|
1287
|
+
if (!plan.folding.folded(e)) {
|
|
1288
|
+
const start = edgeStartTag(snapshot, plan, e, String(ids.idAt(list.src[e])), String(ids.idAt(list.dst[e])));
|
|
1289
|
+
yield edgeElement(plan, e, edgeIds[e], start, [i2, i3]);
|
|
1268
1290
|
}
|
|
1269
|
-
const sourcePort = portText(plan.sourcePortColumn, e);
|
|
1270
|
-
if (sourcePort !== null) {
|
|
1271
|
-
parts.push(` sourceport="${escapeXmlAttribute(sourcePort)}"`);
|
|
1272
|
-
}
|
|
1273
|
-
const targetPort = portText(plan.targetPortColumn, e);
|
|
1274
|
-
if (targetPort !== null) {
|
|
1275
|
-
parts.push(` targetport="${escapeXmlAttribute(targetPort)}"`);
|
|
1276
|
-
}
|
|
1277
|
-
const open = parts.length;
|
|
1278
|
-
if (plan.weight !== null) {
|
|
1279
|
-
const { keyId, attrType } = plan.weight;
|
|
1280
|
-
const weight = plan.weight.weights.text(e, attrType === "int" || attrType === "long");
|
|
1281
|
-
if (weight !== null) {
|
|
1282
|
-
parts.push(`
|
|
1283
|
-
${i3}<data key="${keyId}">${escapeXmlText(weight)}</data>`);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
for (const column of plan.edgeColumns) {
|
|
1287
|
-
writeData(column, e, i3, parts);
|
|
1288
|
-
}
|
|
1289
|
-
if (parts.length === open) {
|
|
1290
|
-
parts.push("/>");
|
|
1291
|
-
} else {
|
|
1292
|
-
parts.splice(open, 0, ">");
|
|
1293
|
-
parts.push(`
|
|
1294
|
-
${i2}</edge>`);
|
|
1295
|
-
}
|
|
1296
|
-
yield parts.join("");
|
|
1297
1291
|
}
|
|
1298
1292
|
yield `
|
|
1299
1293
|
${i1}</graph>
|
|
1300
1294
|
</graphml>
|
|
1301
1295
|
`;
|
|
1302
1296
|
}
|
|
1297
|
+
function rootElement(plan) {
|
|
1298
|
+
const namespaces = { ...plan.meta?.namespaces };
|
|
1299
|
+
const yfilesColumns2 = plan.nodeColumns.some((c) => c.yfiles) || plan.edgeColumns.some((c) => c.yfiles) || plan.graphColumns.some((c) => c.yfiles);
|
|
1300
|
+
if (plan.yedGraphics === true || yfilesColumns2 && !Object.values(namespaces).includes(YFILES_NAMESPACE) && // a yFiles 3 file binds `y` to its own namespace, which its kept trees are written in
|
|
1301
|
+
namespaces.y === void 0) {
|
|
1302
|
+
namespaces.y = YFILES_NAMESPACE;
|
|
1303
|
+
}
|
|
1304
|
+
if (!Object.values(namespaces).includes(XSI_NAMESPACE)) {
|
|
1305
|
+
namespaces.xsi = XSI_NAMESPACE;
|
|
1306
|
+
}
|
|
1307
|
+
let root = `<graphml xmlns="${GRAPHML_NAMESPACE}"`;
|
|
1308
|
+
for (const [prefix, uri] of Object.entries(namespaces)) {
|
|
1309
|
+
root += ` xmlns:${prefix}="${escapeXmlAttribute(uri)}"`;
|
|
1310
|
+
}
|
|
1311
|
+
const xsiPrefix = Object.entries(namespaces).find(([, uri]) => uri === XSI_NAMESPACE)?.[0] ?? "xsi";
|
|
1312
|
+
return `${root} ${xsiPrefix}:schemaLocation="${SCHEMA_LOCATION}">
|
|
1313
|
+
`;
|
|
1314
|
+
}
|
|
1315
|
+
function edgeStartTag(snapshot, plan, e, source, target) {
|
|
1316
|
+
let text2 = ` source="${escapeXmlAttribute(source)}" target="${escapeXmlAttribute(target)}"`;
|
|
1317
|
+
const directed = snapshot.directed && isDirectedEdge(plan.folding, e);
|
|
1318
|
+
if (directed !== (plan.edgedefault === "directed")) {
|
|
1319
|
+
text2 += ` directed="${directed ? "true" : "false"}"`;
|
|
1320
|
+
}
|
|
1321
|
+
const sourcePort = portText(plan.sourcePortColumn, e);
|
|
1322
|
+
if (sourcePort !== null) {
|
|
1323
|
+
text2 += ` sourceport="${escapeXmlAttribute(sourcePort)}"`;
|
|
1324
|
+
}
|
|
1325
|
+
const targetPort = portText(plan.targetPortColumn, e);
|
|
1326
|
+
if (targetPort !== null) {
|
|
1327
|
+
text2 += ` targetport="${escapeXmlAttribute(targetPort)}"`;
|
|
1328
|
+
}
|
|
1329
|
+
return text2;
|
|
1330
|
+
}
|
|
1331
|
+
function edgeElement(plan, e, id, start, indents) {
|
|
1332
|
+
const [i2, i3] = indents;
|
|
1333
|
+
const parts = [`
|
|
1334
|
+
${i2}<edge`];
|
|
1335
|
+
if (id !== null) {
|
|
1336
|
+
parts.push(` id="${escapeXmlAttribute(id)}"`);
|
|
1337
|
+
}
|
|
1338
|
+
parts.push(start);
|
|
1339
|
+
const open = parts.length;
|
|
1340
|
+
if (plan.weight !== null) {
|
|
1341
|
+
const { keyId, attrType } = plan.weight;
|
|
1342
|
+
const weight = plan.weight.weights.text(e, attrType === "int" || attrType === "long");
|
|
1343
|
+
if (weight !== null) {
|
|
1344
|
+
parts.push(`
|
|
1345
|
+
${i3}<data key="${keyId}">${escapeXmlText(weight)}</data>`);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
for (const column of plan.edgeColumns) {
|
|
1349
|
+
writeData(column, e, i3, parts);
|
|
1350
|
+
}
|
|
1351
|
+
if (parts.length === open) {
|
|
1352
|
+
parts.push("/>");
|
|
1353
|
+
} else {
|
|
1354
|
+
parts.splice(open, 0, ">");
|
|
1355
|
+
parts.push(`
|
|
1356
|
+
${i2}</edge>`);
|
|
1357
|
+
}
|
|
1358
|
+
return parts.join("");
|
|
1359
|
+
}
|
|
1303
1360
|
function portText(column, e) {
|
|
1304
1361
|
if (!column?.isSet(e)) {
|
|
1305
1362
|
return null;
|
|
@@ -1385,6 +1442,7 @@ const graphmlExporter = Object.freeze({
|
|
|
1385
1442
|
format: FORMAT,
|
|
1386
1443
|
options: Object.freeze(["edgedefault", "pretty"]),
|
|
1387
1444
|
capabilities: CAPABILITIES,
|
|
1445
|
+
styles: Object.freeze({ capabilities: GRAPHML_STYLE_CAPABILITIES }),
|
|
1388
1446
|
/**
|
|
1389
1447
|
* Pre-flight: every loss the export would incur.
|
|
1390
1448
|
* @param snapshot - the snapshot
|
|
@@ -1392,8 +1450,8 @@ const graphmlExporter = Object.freeze({
|
|
|
1392
1450
|
* @returns the notes
|
|
1393
1451
|
*/
|
|
1394
1452
|
check(snapshot, options) {
|
|
1395
|
-
const plan =
|
|
1396
|
-
return Object.freeze(plan.notes);
|
|
1453
|
+
const { plan, styled } = prepare(snapshot, options);
|
|
1454
|
+
return Object.freeze([...plan.notes, ...styled?.notes ?? []]);
|
|
1397
1455
|
},
|
|
1398
1456
|
/**
|
|
1399
1457
|
* Write the document as UTF-8 chunks.
|
|
@@ -1402,8 +1460,8 @@ const graphmlExporter = Object.freeze({
|
|
|
1402
1460
|
* @returns the chunks
|
|
1403
1461
|
*/
|
|
1404
1462
|
export(snapshot, options) {
|
|
1405
|
-
const plan =
|
|
1406
|
-
return encodeChunks(writeGraphml(
|
|
1463
|
+
const { plan, written } = prepare(snapshot, options);
|
|
1464
|
+
return encodeChunks(writeGraphml(written, plan));
|
|
1407
1465
|
},
|
|
1408
1466
|
/**
|
|
1409
1467
|
* Write the document as one string.
|
|
@@ -1412,10 +1470,576 @@ const graphmlExporter = Object.freeze({
|
|
|
1412
1470
|
* @returns the document
|
|
1413
1471
|
*/
|
|
1414
1472
|
exportToString(snapshot, options) {
|
|
1415
|
-
const plan =
|
|
1416
|
-
return joinText(writeGraphml(
|
|
1473
|
+
const { plan, written } = prepare(snapshot, options);
|
|
1474
|
+
return joinText(writeGraphml(written, plan));
|
|
1417
1475
|
}
|
|
1418
1476
|
});
|
|
1477
|
+
function prepare(snapshot, options) {
|
|
1478
|
+
const styled = graphmlStyledExport(snapshot, options?.styles);
|
|
1479
|
+
const written = styled?.snapshot ?? snapshot;
|
|
1480
|
+
const plan = planExport(written, resolveExportOptions(options), resolveFormatOptions(options), styled !== null);
|
|
1481
|
+
if (styled === null) {
|
|
1482
|
+
return { plan, written, styled };
|
|
1483
|
+
}
|
|
1484
|
+
const position = written.nodes.byRole("position")?.meta.name;
|
|
1485
|
+
const notes = plan.notes.filter((n) => n.code !== LOSS.POSITIONS || n.column !== position);
|
|
1486
|
+
return { plan: { ...plan, notes, yedGraphics: true }, written, styled };
|
|
1487
|
+
}
|
|
1488
|
+
const MAX_REFERENCE_DEPTH = 16;
|
|
1489
|
+
const NULL = /* @__PURE__ */ Symbol("x:Null");
|
|
1490
|
+
const REFERENCE = /^\{\s*[\w.-]*:?GraphMLReference\s+([^\s}]+)\s*\}$/;
|
|
1491
|
+
const NULL_MARKUP = /^\{\s*[\w.-]*:?Null\s*\}$/;
|
|
1492
|
+
const KINDS = /* @__PURE__ */ new Set(["NodeStyle", "EdgeStyle", "NodeLabels", "EdgeLabels", "NodeGeometry"]);
|
|
1493
|
+
function keyKind(type) {
|
|
1494
|
+
if (typeof type !== "string" || !type.includes("://")) {
|
|
1495
|
+
return null;
|
|
1496
|
+
}
|
|
1497
|
+
const last = type.slice(type.lastIndexOf("/") + 1);
|
|
1498
|
+
return KINDS.has(last) || last === "SharedData" ? last : null;
|
|
1499
|
+
}
|
|
1500
|
+
function columnsByKind(table) {
|
|
1501
|
+
const out = /* @__PURE__ */ new Map();
|
|
1502
|
+
for (const col of table) {
|
|
1503
|
+
const kind = col.dtype === "json" && col.meta.origin?.namespace === "yfiles" ? keyKind(col.meta.origin.type) : null;
|
|
1504
|
+
if (kind !== null && !out.has(kind)) {
|
|
1505
|
+
out.set(kind, col.meta.name);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
return out;
|
|
1509
|
+
}
|
|
1510
|
+
class References {
|
|
1511
|
+
/**
|
|
1512
|
+
* Collects the shared objects of the graph's `SharedData` value.
|
|
1513
|
+
* @param data - the `<data>` content of the SharedData key
|
|
1514
|
+
*/
|
|
1515
|
+
constructor(data) {
|
|
1516
|
+
this.shared = /* @__PURE__ */ new Map();
|
|
1517
|
+
this.cycles = 0;
|
|
1518
|
+
for (const sd of treeChildren(data, "SharedData")) {
|
|
1519
|
+
if (isTree(sd)) {
|
|
1520
|
+
this.collect(sd);
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Collects the shared objects of one SharedData element: the first of each key wins.
|
|
1526
|
+
* @param sd - the element
|
|
1527
|
+
*/
|
|
1528
|
+
collect(sd) {
|
|
1529
|
+
for (const key of Object.keys(sd).filter((k) => !k.startsWith("@_") && k !== "#text")) {
|
|
1530
|
+
for (const e of treeChildren(sd, localOf(key))) {
|
|
1531
|
+
const name = sharedKey(e);
|
|
1532
|
+
if (name !== null && !this.shared.has(name)) {
|
|
1533
|
+
this.shared.set(name, { tag: localOf(key), e });
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Whether a walk has gone too deep; counts it once when it has.
|
|
1540
|
+
* @param depth - the walk's depth
|
|
1541
|
+
* @returns true past the limit
|
|
1542
|
+
*/
|
|
1543
|
+
tooDeep(depth) {
|
|
1544
|
+
if (depth > MAX_REFERENCE_DEPTH) {
|
|
1545
|
+
this.cycles++;
|
|
1546
|
+
return true;
|
|
1547
|
+
}
|
|
1548
|
+
return false;
|
|
1549
|
+
}
|
|
1550
|
+
/**
|
|
1551
|
+
* A style object, following a `<y:GraphMLReference ResourceKey>` element to what it names.
|
|
1552
|
+
* @param tag - the element's local name
|
|
1553
|
+
* @param e - the element
|
|
1554
|
+
* @returns the object, or null when the reference names nothing
|
|
1555
|
+
*/
|
|
1556
|
+
object(tag, e) {
|
|
1557
|
+
if (tag === "GraphMLReference") {
|
|
1558
|
+
return this.shared.get(treeAttr(e, "ResourceKey") ?? "") ?? null;
|
|
1559
|
+
}
|
|
1560
|
+
return { tag, e };
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* The first child element of a property element, as a style object.
|
|
1564
|
+
* @param d - the property element (or a `<data>` content)
|
|
1565
|
+
* @returns the object, or null
|
|
1566
|
+
*/
|
|
1567
|
+
first(d) {
|
|
1568
|
+
if (!isTree(d)) {
|
|
1569
|
+
return null;
|
|
1570
|
+
}
|
|
1571
|
+
for (const key of Object.keys(d)) {
|
|
1572
|
+
if (!key.startsWith("@_") && key !== "#text") {
|
|
1573
|
+
return this.object(localOf(key), treeChildren(d, localOf(key))[0]);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
return null;
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* A property value resolved through references: a style object, text, `{x:Null}` or nothing.
|
|
1580
|
+
* @param v - an attribute's text or a property element
|
|
1581
|
+
* @param depth - the walk's depth
|
|
1582
|
+
* @returns the resolved value
|
|
1583
|
+
*/
|
|
1584
|
+
deref(v, depth = 0) {
|
|
1585
|
+
if (v === void 0 || v === null || this.tooDeep(depth)) {
|
|
1586
|
+
return null;
|
|
1587
|
+
}
|
|
1588
|
+
if (typeof v === "object") {
|
|
1589
|
+
return this.first(v);
|
|
1590
|
+
}
|
|
1591
|
+
if (typeof v !== "string") {
|
|
1592
|
+
return null;
|
|
1593
|
+
}
|
|
1594
|
+
const t = v.trim();
|
|
1595
|
+
if (t.length > MAX_STYLE_VALUE_LENGTH) {
|
|
1596
|
+
return t;
|
|
1597
|
+
}
|
|
1598
|
+
if (NULL_MARKUP.test(t)) {
|
|
1599
|
+
return NULL;
|
|
1600
|
+
}
|
|
1601
|
+
const m = REFERENCE.exec(t);
|
|
1602
|
+
if (m !== null) {
|
|
1603
|
+
return this.shared.get(m[1]) ?? null;
|
|
1604
|
+
}
|
|
1605
|
+
return t;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
function sharedKey(e) {
|
|
1609
|
+
if (!isTree(e)) {
|
|
1610
|
+
return null;
|
|
1611
|
+
}
|
|
1612
|
+
for (const key of Object.keys(e)) {
|
|
1613
|
+
if (key.startsWith("@_") && localOf(key.slice(2)) === "Key") {
|
|
1614
|
+
const value = e[key];
|
|
1615
|
+
return typeof value === "string" ? value : null;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1619
|
+
}
|
|
1620
|
+
function prop(st, name) {
|
|
1621
|
+
const attr2 = treeAttr(st.e, name);
|
|
1622
|
+
if (attr2 !== void 0) {
|
|
1623
|
+
return attr2;
|
|
1624
|
+
}
|
|
1625
|
+
return treeChild(st.e, `${st.tag}.${name}`);
|
|
1626
|
+
}
|
|
1627
|
+
function paintOf(refs, v, gradient, depth = 0) {
|
|
1628
|
+
if (refs.tooDeep(depth)) {
|
|
1629
|
+
return null;
|
|
1630
|
+
}
|
|
1631
|
+
const x = refs.deref(v, depth);
|
|
1632
|
+
if (x === null || x === NULL) {
|
|
1633
|
+
return x;
|
|
1634
|
+
}
|
|
1635
|
+
if (typeof x === "string") {
|
|
1636
|
+
return { raw: x, dialect: "yfiles3" };
|
|
1637
|
+
}
|
|
1638
|
+
const { tag } = x;
|
|
1639
|
+
if (tag === "SolidColorFill") {
|
|
1640
|
+
return paintOf(refs, prop(x, "color"), gradient, depth + 1);
|
|
1641
|
+
}
|
|
1642
|
+
if (tag === "Color") {
|
|
1643
|
+
return paintOf(refs, treeAttr(x.e, "value"), gradient, depth + 1);
|
|
1644
|
+
}
|
|
1645
|
+
if (tag === "CssFill") {
|
|
1646
|
+
const css = treeAttr(x.e, "cssString");
|
|
1647
|
+
return css === void 0 ? null : { raw: css, dialect: "css" };
|
|
1648
|
+
}
|
|
1649
|
+
if (tag.endsWith("Gradient")) {
|
|
1650
|
+
gradient?.();
|
|
1651
|
+
const stop = treeChildren(x.e, "GradientStop")[0] ?? treeChildren(treeChild(x.e, `${tag}.GradientStops`), "GradientStop")[0];
|
|
1652
|
+
return stop === void 0 ? null : paintOf(refs, treeAttr(stop, "color"), null, depth + 1);
|
|
1653
|
+
}
|
|
1654
|
+
if (tag === "Stroke") {
|
|
1655
|
+
return paintOf(refs, prop(x, "fill"), gradient, depth + 1);
|
|
1656
|
+
}
|
|
1657
|
+
return null;
|
|
1658
|
+
}
|
|
1659
|
+
const DASHES = /* @__PURE__ */ new Map([
|
|
1660
|
+
["solid", "solid"],
|
|
1661
|
+
["dash", "dashed"],
|
|
1662
|
+
["dot", "dotted"],
|
|
1663
|
+
["dashdot", "dash-dot"],
|
|
1664
|
+
["dashdotdot", "dash-dot"]
|
|
1665
|
+
]);
|
|
1666
|
+
function strokeOf(refs, v) {
|
|
1667
|
+
const x = refs.deref(v);
|
|
1668
|
+
if (x === null || x === NULL) {
|
|
1669
|
+
return x;
|
|
1670
|
+
}
|
|
1671
|
+
if (typeof x === "string" || x.tag !== "Stroke") {
|
|
1672
|
+
return { color: paintOf(refs, v, null), width: 1, line: "solid" };
|
|
1673
|
+
}
|
|
1674
|
+
let line = "solid";
|
|
1675
|
+
const d = refs.deref(prop(x, "dashStyle"), 1);
|
|
1676
|
+
if (typeof d === "string") {
|
|
1677
|
+
const lower = d.slice(0, MAX_STYLE_VALUE_LENGTH).toLowerCase().replaceAll("_", "");
|
|
1678
|
+
line = DASHES.get(lower) ?? `other:${lower}`;
|
|
1679
|
+
} else if (d !== null && d !== NULL) {
|
|
1680
|
+
const dashes = (treeAttr(d.e, "dashes") ?? "").slice(0, MAX_STYLE_VALUE_LENGTH).trim().split(/[\s,]+/).map(Number).filter(Number.isFinite);
|
|
1681
|
+
if (dashes.length === 2) {
|
|
1682
|
+
line = dashes[0] <= 1 ? "dotted" : "dashed";
|
|
1683
|
+
} else if (dashes.length === 4) {
|
|
1684
|
+
line = "dash-dot";
|
|
1685
|
+
} else if (dashes.length > 0) {
|
|
1686
|
+
line = `other:dashes ${dashes.slice(0, 8).join(" ")}`;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
const w = prop(x, "thickness");
|
|
1690
|
+
return { color: paintOf(refs, prop(x, "fill"), null), width: typeof w === "string" ? w : 1, line };
|
|
1691
|
+
}
|
|
1692
|
+
function putPaint(pt, property, opacity, put, at) {
|
|
1693
|
+
if (pt === null || pt === NULL) {
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const c = canonColor(pt.raw, pt.dialect, at(property));
|
|
1697
|
+
if (c === null) {
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
put(property, c.color);
|
|
1701
|
+
const alpha = colorOpacity(c, null, at(property), opacity !== null);
|
|
1702
|
+
if (opacity !== null) {
|
|
1703
|
+
put(opacity, alpha);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
function readNodeStyle(refs, data, put, at) {
|
|
1707
|
+
const st = unwrapped(refs, refs.first(data));
|
|
1708
|
+
if (st === null || typeof st !== "object") {
|
|
1709
|
+
if (data !== null && data !== void 0 && data !== "") {
|
|
1710
|
+
noteAt(at("fill"), STYLE_ISSUE.UNRESOLVED, "NodeStyle");
|
|
1711
|
+
}
|
|
1712
|
+
return;
|
|
1713
|
+
}
|
|
1714
|
+
const style = st;
|
|
1715
|
+
putPaint(
|
|
1716
|
+
paintOf(refs, prop(style, "fill"), () => {
|
|
1717
|
+
noteAt(at("fill"), STYLE_ISSUE.GRADIENT, style.tag);
|
|
1718
|
+
}),
|
|
1719
|
+
"fill",
|
|
1720
|
+
"fillOpacity",
|
|
1721
|
+
put,
|
|
1722
|
+
at
|
|
1723
|
+
);
|
|
1724
|
+
const stroke = strokeOf(refs, prop(style, "stroke"));
|
|
1725
|
+
if (stroke === NULL) {
|
|
1726
|
+
put("borderWidth", 0);
|
|
1727
|
+
} else if (stroke !== null) {
|
|
1728
|
+
putPaint(stroke.color, "borderColor", null, put, at);
|
|
1729
|
+
put("borderWidth", canonNumber(stroke.width, at("borderWidth")));
|
|
1730
|
+
put("borderStyle", canonEnum("borderStyle", stroke.line, "yfiles3", at("borderStyle")));
|
|
1731
|
+
}
|
|
1732
|
+
put("shape", nodeShapeOf(style, at));
|
|
1733
|
+
const cornerSize = style.tag === "RectangleNodeStyle" ? treeAttr(style.e, "cornerSize") : void 0;
|
|
1734
|
+
if (cornerSize !== void 0) {
|
|
1735
|
+
put("cornerRadius", canonNumber(cornerSize, at("cornerRadius")));
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
function unwrapped(refs, first) {
|
|
1739
|
+
let st = first;
|
|
1740
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1741
|
+
while (st !== null && typeof st === "object" && st.tag === "CollapsibleNodeStyleDecorator") {
|
|
1742
|
+
if (seen.has(st.e) || refs.tooDeep(seen.size)) {
|
|
1743
|
+
refs.cycles++;
|
|
1744
|
+
return null;
|
|
1745
|
+
}
|
|
1746
|
+
seen.add(st.e);
|
|
1747
|
+
st = refs.deref(prop(st, "wrappedStyle"));
|
|
1748
|
+
}
|
|
1749
|
+
return st;
|
|
1750
|
+
}
|
|
1751
|
+
function nodeShapeOf(style, at) {
|
|
1752
|
+
const shape = treeAttr(style.e, "shape");
|
|
1753
|
+
if (shape !== void 0) {
|
|
1754
|
+
return canonEnum("shape", shape, "yfiles3", at("shape"));
|
|
1755
|
+
}
|
|
1756
|
+
if (style.tag === "RectangleNodeStyle") {
|
|
1757
|
+
return treeAttr(style.e, "cornerSize") === void 0 ? "rectangle" : "round-rectangle";
|
|
1758
|
+
}
|
|
1759
|
+
if (style.tag === "ShapeNodeStyle") {
|
|
1760
|
+
return "rectangle";
|
|
1761
|
+
}
|
|
1762
|
+
noteAt(at("shape"), STYLE_ISSUE.UNKNOWN_VALUE, style.tag);
|
|
1763
|
+
return `other:${style.tag}`;
|
|
1764
|
+
}
|
|
1765
|
+
function readEdgeStyle(refs, data, put, at) {
|
|
1766
|
+
const st = refs.first(data);
|
|
1767
|
+
if (st === null) {
|
|
1768
|
+
return;
|
|
1769
|
+
}
|
|
1770
|
+
const stroke = strokeOf(refs, prop(st, "stroke"));
|
|
1771
|
+
if (stroke === NULL) {
|
|
1772
|
+
noteAt(at("color"), STYLE_ISSUE.NO_STROKE, "{x:Null}");
|
|
1773
|
+
} else if (stroke !== null) {
|
|
1774
|
+
putPaint(stroke.color, "color", "opacity", put, at);
|
|
1775
|
+
put("width", canonNumber(stroke.width, at("width")));
|
|
1776
|
+
put("lineStyle", canonEnum("lineStyle", stroke.line, "yfiles3", at("lineStyle")));
|
|
1777
|
+
}
|
|
1778
|
+
for (const end of ["source", "target"]) {
|
|
1779
|
+
const a = refs.deref(prop(st, `${end}Arrow`));
|
|
1780
|
+
const property = `${end}Arrow`;
|
|
1781
|
+
let type = null;
|
|
1782
|
+
if (a !== null && a !== NULL && typeof a === "object") {
|
|
1783
|
+
type = treeAttr(a.e, "type") ?? "DEFAULT";
|
|
1784
|
+
putPaint(paintOf(refs, prop(a, "fill"), null), `${end}ArrowColor`, null, put, at);
|
|
1785
|
+
} else if (typeof a === "string") {
|
|
1786
|
+
type = a;
|
|
1787
|
+
}
|
|
1788
|
+
if (type !== null) {
|
|
1789
|
+
put(property, canonEnum("arrow", /^default$/i.test(type) ? "triangle" : type, "yfiles3", at(property)));
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
function readLabels(refs, data, put, at) {
|
|
1794
|
+
let label = void 0;
|
|
1795
|
+
let text2 = "";
|
|
1796
|
+
let extra = 0;
|
|
1797
|
+
for (const l of treeChildren(treeChild(data, "List"), "Label")) {
|
|
1798
|
+
const raw = treeAttr(l, "Text") ?? treeText(treeChild(l, "Label.Text")) ?? "";
|
|
1799
|
+
if (raw.trim().length === 0) {
|
|
1800
|
+
continue;
|
|
1801
|
+
}
|
|
1802
|
+
if (label === void 0) {
|
|
1803
|
+
label = l;
|
|
1804
|
+
text2 = raw;
|
|
1805
|
+
} else {
|
|
1806
|
+
extra++;
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
if (label === void 0) {
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
if (extra > 0) {
|
|
1813
|
+
noteAt(at("label"), STYLE_ISSUE.EXTRA_LABELS, `${String(extra + 1)} labels`);
|
|
1814
|
+
}
|
|
1815
|
+
put("label", canonText(text2, at("label")));
|
|
1816
|
+
const ls = refs.deref(treeAttr(label, "Style") ?? treeChild(label, "Label.Style"));
|
|
1817
|
+
if (ls === null || ls === NULL || typeof ls !== "object" || !ls.tag.endsWith("LabelStyle")) {
|
|
1818
|
+
return;
|
|
1819
|
+
}
|
|
1820
|
+
putPaint(paintOf(refs, prop(ls, "textFill"), null), "labelColor", null, put, at);
|
|
1821
|
+
const f = refs.deref(prop(ls, "font"));
|
|
1822
|
+
if (f !== null && f !== NULL && typeof f === "object" && f.tag === "Font") {
|
|
1823
|
+
put("labelSize", canonNumber(treeAttr(f.e, "fontSize"), at("labelSize")));
|
|
1824
|
+
const family = treeAttr(f.e, "fontFamily");
|
|
1825
|
+
if (family !== void 0) {
|
|
1826
|
+
put("labelFont", canonText(family.replaceAll(/(^['"])|(['"]$)/g, ""), at("labelFont")));
|
|
1827
|
+
}
|
|
1828
|
+
const weight = treeAttr(f.e, "fontWeight");
|
|
1829
|
+
if (weight !== void 0) {
|
|
1830
|
+
put("labelWeight", canonEnum("weight", weight, "yfiles3", at("labelWeight")));
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function readYfiles3Styles(snapshot, notes, budget) {
|
|
1835
|
+
const nodeKinds = columnsByKind(snapshot.nodes);
|
|
1836
|
+
const edgeKinds = columnsByKind(snapshot.edges);
|
|
1837
|
+
const styled = [...nodeKinds.keys(), ...edgeKinds.keys()].some((k) => k !== "SharedData");
|
|
1838
|
+
if (!styled) {
|
|
1839
|
+
return null;
|
|
1840
|
+
}
|
|
1841
|
+
const graphKinds = columnsByKind(snapshot.graph);
|
|
1842
|
+
const sharedName = graphKinds.get("SharedData");
|
|
1843
|
+
const refs = new References(sharedName === void 0 ? null : plainCell(snapshot.graph.value(sharedName, 0)));
|
|
1844
|
+
const read = (target, kinds) => {
|
|
1845
|
+
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1846
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1847
|
+
const out = valueColumns(n);
|
|
1848
|
+
const style = kinds.get(target === "node" ? "NodeStyle" : "EdgeStyle");
|
|
1849
|
+
const labels = kinds.get(target === "node" ? "NodeLabels" : "EdgeLabels");
|
|
1850
|
+
const geometry = target === "node" ? kinds.get("NodeGeometry") : void 0;
|
|
1851
|
+
const readStyle = target === "node" ? readNodeStyle : readEdgeStyle;
|
|
1852
|
+
const cell = (name, i) => name === void 0 ? void 0 : plainCell(table.value(name, i));
|
|
1853
|
+
for (let i = 0; i < n; i++) {
|
|
1854
|
+
budget.spend(target, 1);
|
|
1855
|
+
const at = (property) => ({ notes, target, property, element: i, budget });
|
|
1856
|
+
const put = (property, value) => {
|
|
1857
|
+
out.put(i, property, value);
|
|
1858
|
+
};
|
|
1859
|
+
if (style !== void 0) {
|
|
1860
|
+
readStyle(refs, cell(style, i), put, at);
|
|
1861
|
+
}
|
|
1862
|
+
if (labels !== void 0) {
|
|
1863
|
+
readLabels(refs, cell(labels, i), put, at);
|
|
1864
|
+
}
|
|
1865
|
+
if (geometry !== void 0) {
|
|
1866
|
+
const rect = treeChild(cell(geometry, i), "RectD");
|
|
1867
|
+
put("width", canonNumber(treeAttr(rect, "Width"), at("width")));
|
|
1868
|
+
put("height", canonNumber(treeAttr(rect, "Height"), at("height")));
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
return out.values;
|
|
1872
|
+
};
|
|
1873
|
+
const node = read("node", nodeKinds);
|
|
1874
|
+
const edge = read("edge", edgeKinds);
|
|
1875
|
+
if (refs.cycles > 0) {
|
|
1876
|
+
notes.add(STYLE_ISSUE.REFERENCE_CYCLE, null, null, {
|
|
1877
|
+
sample: `references deeper than ${String(MAX_REFERENCE_DEPTH)} or circular (${String(refs.cycles)})`
|
|
1878
|
+
});
|
|
1879
|
+
}
|
|
1880
|
+
return { node, edge };
|
|
1881
|
+
}
|
|
1882
|
+
const GEPHI_COLUMNS = ["r", "g", "b", "size"];
|
|
1883
|
+
function hasRgb(table) {
|
|
1884
|
+
return table.has("r") && table.has("g") && table.has("b");
|
|
1885
|
+
}
|
|
1886
|
+
function readGephi(snapshot, notes, context) {
|
|
1887
|
+
const read = (target) => {
|
|
1888
|
+
const table = target === "node" ? snapshot.nodes : snapshot.edges;
|
|
1889
|
+
const n = target === "node" ? snapshot.nodeCount : snapshot.edgeCount;
|
|
1890
|
+
const out = valueColumns(n);
|
|
1891
|
+
const has = { rgb: hasRgb(table), size: target === "node" && table.has("size"), label: table.has("label") };
|
|
1892
|
+
for (let i = 0; i < n; i++) {
|
|
1893
|
+
context.budget.spend(target, 1);
|
|
1894
|
+
const at = (property) => ({
|
|
1895
|
+
notes,
|
|
1896
|
+
target,
|
|
1897
|
+
property,
|
|
1898
|
+
element: i,
|
|
1899
|
+
budget: context.budget
|
|
1900
|
+
});
|
|
1901
|
+
readGephiRow(
|
|
1902
|
+
table,
|
|
1903
|
+
target,
|
|
1904
|
+
i,
|
|
1905
|
+
has,
|
|
1906
|
+
(property, value) => {
|
|
1907
|
+
out.put(i, property, value);
|
|
1908
|
+
},
|
|
1909
|
+
at
|
|
1910
|
+
);
|
|
1911
|
+
}
|
|
1912
|
+
return out.values;
|
|
1913
|
+
};
|
|
1914
|
+
return { node: read("node"), edge: read("edge") };
|
|
1915
|
+
}
|
|
1916
|
+
function readGephiRow(table, target, i, has, put, at) {
|
|
1917
|
+
if (has.rgb) {
|
|
1918
|
+
const [r, g, b] = ["r", "g", "b"].map((c) => plainCell(table.value(c, i)));
|
|
1919
|
+
if (r !== null && g !== null && b !== null) {
|
|
1920
|
+
const property = target === "node" ? "fill" : "color";
|
|
1921
|
+
put(property, canonColor({ r, g, b }, "gephi", at(property))?.color ?? null);
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
if (has.size) {
|
|
1925
|
+
const v = canonNumber(plainCell(table.value("size", i)), at("width"));
|
|
1926
|
+
put("width", v);
|
|
1927
|
+
put("height", v);
|
|
1928
|
+
}
|
|
1929
|
+
if (has.label) {
|
|
1930
|
+
put("label", canonText(plainCell(table.value("label", i)), at("label")));
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
function exactFromGraphtyBlock(snapshot, yed) {
|
|
1934
|
+
const text2 = snapshot.graph.has(STYLE_BLOCK_NAME) ? plainCell(snapshot.graph.value(STYLE_BLOCK_NAME, 0)) : null;
|
|
1935
|
+
if (typeof text2 !== "string") {
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
const parsed = parseStyleBlock(text2, styleFingerprint(snapshot));
|
|
1939
|
+
const ex = parsed.ok ? blockStyles(parsed.block, snapshot, "graphml") : null;
|
|
1940
|
+
if (ex === null) {
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
exactFromBlock(
|
|
1944
|
+
yed,
|
|
1945
|
+
(target, property) => resolveStyles(ex, target, property, snapshot),
|
|
1946
|
+
{ node: snapshot.nodeCount, edge: snapshot.edgeCount },
|
|
1947
|
+
new StyleNotes()
|
|
1948
|
+
);
|
|
1949
|
+
}
|
|
1950
|
+
function graphmlStyles(snapshot, context) {
|
|
1951
|
+
const notes = new StyleNotes();
|
|
1952
|
+
const readFrom = { node: yfilesColumns(snapshot.nodes), edge: yfilesColumns(snapshot.edges) };
|
|
1953
|
+
const yfiles3 = readYfiles3Styles(snapshot, notes, context.budget);
|
|
1954
|
+
if (yfiles3 !== null) {
|
|
1955
|
+
return {
|
|
1956
|
+
canonical: true,
|
|
1957
|
+
dialect: "yfiles3",
|
|
1958
|
+
tool: "yfiles3",
|
|
1959
|
+
units: "px",
|
|
1960
|
+
node: { values: yfiles3.node },
|
|
1961
|
+
edge: { values: yfiles3.edge },
|
|
1962
|
+
notes: notes.list(),
|
|
1963
|
+
readFrom
|
|
1964
|
+
};
|
|
1965
|
+
}
|
|
1966
|
+
const yed = readYedStyles(snapshot, notes, context.budget);
|
|
1967
|
+
if (yed !== null) {
|
|
1968
|
+
exactFromGraphtyBlock(snapshot, yed);
|
|
1969
|
+
return {
|
|
1970
|
+
canonical: true,
|
|
1971
|
+
dialect: "yed",
|
|
1972
|
+
tool: "yed",
|
|
1973
|
+
units: "px",
|
|
1974
|
+
node: { values: yed.node },
|
|
1975
|
+
edge: { values: yed.edge },
|
|
1976
|
+
notes: notes.list(),
|
|
1977
|
+
opacityInColor: true,
|
|
1978
|
+
readFrom
|
|
1979
|
+
};
|
|
1980
|
+
}
|
|
1981
|
+
if (hasRgb(snapshot.nodes)) {
|
|
1982
|
+
const gephi = readGephi(snapshot, notes, context);
|
|
1983
|
+
const { rules, columns } = gephiRules(
|
|
1984
|
+
snapshot,
|
|
1985
|
+
gephi.node.fill,
|
|
1986
|
+
gephi.edge.color,
|
|
1987
|
+
context.budget,
|
|
1988
|
+
gephi.edge.width
|
|
1989
|
+
);
|
|
1990
|
+
const used = (table) => GEPHI_COLUMNS.filter((c) => table.has(c));
|
|
1991
|
+
return {
|
|
1992
|
+
canonical: true,
|
|
1993
|
+
dialect: "gephi",
|
|
1994
|
+
tool: "gephi",
|
|
1995
|
+
units: "relative",
|
|
1996
|
+
node: { values: gephi.node },
|
|
1997
|
+
edge: { values: gephi.edge, rules, columns },
|
|
1998
|
+
notes: notes.list(),
|
|
1999
|
+
readFrom: { node: used(snapshot.nodes), edge: used(snapshot.edges) }
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
if (snapshot.nodes.has("SUID") && snapshot.nodes.has("shared name")) {
|
|
2003
|
+
const label = valueColumns(snapshot.nodeCount);
|
|
2004
|
+
if (snapshot.nodes.has("name")) {
|
|
2005
|
+
for (let i = 0; i < snapshot.nodeCount; i++) {
|
|
2006
|
+
label.put(
|
|
2007
|
+
i,
|
|
2008
|
+
"label",
|
|
2009
|
+
canonText(plainCell(snapshot.nodes.value("name", i)), {
|
|
2010
|
+
notes,
|
|
2011
|
+
target: "node",
|
|
2012
|
+
property: "label",
|
|
2013
|
+
element: i,
|
|
2014
|
+
budget: context.budget
|
|
2015
|
+
})
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return {
|
|
2020
|
+
canonical: true,
|
|
2021
|
+
dialect: "cytoscape",
|
|
2022
|
+
tool: "cytoscape",
|
|
2023
|
+
units: "px",
|
|
2024
|
+
node: { values: label.values },
|
|
2025
|
+
edge: { values: {} },
|
|
2026
|
+
notes: notes.list()
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
return null;
|
|
2030
|
+
}
|
|
2031
|
+
function isPassedAttribute(kind, name) {
|
|
2032
|
+
return name === "xmlns" || /^(xmlns|xml|xsi):/.test(name) || isAttributeUri(kind, name);
|
|
2033
|
+
}
|
|
2034
|
+
function unreadAttributeMessage(kind, name, hint2) {
|
|
2035
|
+
if (hint2) {
|
|
2036
|
+
return `the <${kind}> parse hint ${name} is ignored`;
|
|
2037
|
+
}
|
|
2038
|
+
if (SCHEMA_ATTRIBUTES.has(name)) {
|
|
2039
|
+
return `the <${kind}> attribute ${name} is not kept`;
|
|
2040
|
+
}
|
|
2041
|
+
return `the <${kind}> attribute ${name} is not a GraphML attribute; it is not kept`;
|
|
2042
|
+
}
|
|
1419
2043
|
const GRAPH_ATTRIBUTES = /* @__PURE__ */ new Set(["id", "edgedefault", "parse.nodes", "parse.edges"]);
|
|
1420
2044
|
const NODE_ATTRIBUTES = /* @__PURE__ */ new Set(["id"]);
|
|
1421
2045
|
const KEY_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -1432,6 +2056,17 @@ const HYPEREDGE_ATTRIBUTES = /* @__PURE__ */ new Set(["id"]);
|
|
|
1432
2056
|
const ENDPOINT_ATTRIBUTES = /* @__PURE__ */ new Set(["node", "type"]);
|
|
1433
2057
|
const PORT_ATTRIBUTES = /* @__PURE__ */ new Set(["name"]);
|
|
1434
2058
|
const NO_ATTRIBUTES = /* @__PURE__ */ new Set();
|
|
2059
|
+
function isAttributeUri(kind, name) {
|
|
2060
|
+
return kind === "key" && name.endsWith(":attr.uri");
|
|
2061
|
+
}
|
|
2062
|
+
function attributeUri(attrs) {
|
|
2063
|
+
for (const [name, value] of attrs) {
|
|
2064
|
+
if (isAttributeUri("key", name) && value.length > 0) {
|
|
2065
|
+
return value;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
return null;
|
|
2069
|
+
}
|
|
1435
2070
|
const SCHEMA_ATTRIBUTES = /* @__PURE__ */ new Set(["id", "port", "parse.order", "parse.nodeids", "parse.edgeids"]);
|
|
1436
2071
|
const MAX_UNKNOWN_ATTRIBUTE_NAMES = 16;
|
|
1437
2072
|
const EDGE_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -2200,30 +2835,38 @@ class GraphmlReader {
|
|
|
2200
2835
|
*/
|
|
2201
2836
|
reportUnreadAttributes(kind, attrs, known, line) {
|
|
2202
2837
|
for (const name of attrs.keys()) {
|
|
2203
|
-
if (known.has(name)
|
|
2204
|
-
|
|
2205
|
-
}
|
|
2206
|
-
const hint2 = name.startsWith("parse.");
|
|
2207
|
-
const code = hint2 ? GRAPHML_ISSUE.PARSE_HINT_IGNORED : GRAPHML_ISSUE.UNKNOWN_XML_ATTRIBUTE;
|
|
2208
|
-
let names = this.unknownNames.get(kind);
|
|
2209
|
-
if (names === void 0) {
|
|
2210
|
-
names = /* @__PURE__ */ new Set();
|
|
2211
|
-
this.unknownNames.set(kind, names);
|
|
2212
|
-
}
|
|
2213
|
-
if (names.has(name)) {
|
|
2214
|
-
continue;
|
|
2838
|
+
if (!known.has(name) && !isPassedAttribute(kind, name)) {
|
|
2839
|
+
this.reportUnreadAttribute(kind, name, line);
|
|
2215
2840
|
}
|
|
2216
|
-
if (names.size >= MAX_UNKNOWN_ATTRIBUTE_NAMES && !hint2) {
|
|
2217
|
-
this.unknownOverflow.set(kind, (this.unknownOverflow.get(kind) ?? 0) + 1);
|
|
2218
|
-
}
|
|
2219
|
-
names.add(name);
|
|
2220
|
-
if (names.size > MAX_UNKNOWN_ATTRIBUTE_NAMES && !hint2) {
|
|
2221
|
-
continue;
|
|
2222
|
-
}
|
|
2223
|
-
const message = unreadAttributeMessage(kind, name, hint2);
|
|
2224
|
-
this.report.warning("unsupported", code, message, { line, element: name });
|
|
2225
2841
|
}
|
|
2226
2842
|
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Report one attribute reportUnreadAttributes() found, unless its name was reported for this
|
|
2845
|
+
* element kind already or the kind is past MAX_UNKNOWN_ATTRIBUTE_NAMES names (then it is counted).
|
|
2846
|
+
* @param kind - the element name
|
|
2847
|
+
* @param name - the attribute's name
|
|
2848
|
+
* @param line - the line
|
|
2849
|
+
*/
|
|
2850
|
+
reportUnreadAttribute(kind, name, line) {
|
|
2851
|
+
const hint2 = name.startsWith("parse.");
|
|
2852
|
+
let names = this.unknownNames.get(kind);
|
|
2853
|
+
if (names === void 0) {
|
|
2854
|
+
names = /* @__PURE__ */ new Set();
|
|
2855
|
+
this.unknownNames.set(kind, names);
|
|
2856
|
+
}
|
|
2857
|
+
if (names.has(name)) {
|
|
2858
|
+
return;
|
|
2859
|
+
}
|
|
2860
|
+
if (names.size >= MAX_UNKNOWN_ATTRIBUTE_NAMES && !hint2) {
|
|
2861
|
+
this.unknownOverflow.set(kind, (this.unknownOverflow.get(kind) ?? 0) + 1);
|
|
2862
|
+
}
|
|
2863
|
+
names.add(name);
|
|
2864
|
+
if (names.size > MAX_UNKNOWN_ATTRIBUTE_NAMES && !hint2) {
|
|
2865
|
+
return;
|
|
2866
|
+
}
|
|
2867
|
+
const code = hint2 ? GRAPHML_ISSUE.PARSE_HINT_IGNORED : GRAPHML_ISSUE.UNKNOWN_XML_ATTRIBUTE;
|
|
2868
|
+
this.report.warning("unsupported", code, unreadAttributeMessage(kind, name, hint2), { line, element: name });
|
|
2869
|
+
}
|
|
2227
2870
|
/**
|
|
2228
2871
|
* Open a `<graph>`: the top-level one sets the sink's direction (rule 1 of design section
|
|
2229
2872
|
* 8.4); a nested one records its container as the parent of its nodes.
|
|
@@ -2381,6 +3024,9 @@ class GraphmlReader {
|
|
|
2381
3024
|
case "all":
|
|
2382
3025
|
domains = ["graph", "node", "edge"];
|
|
2383
3026
|
break;
|
|
3027
|
+
case "graphml":
|
|
3028
|
+
domains = ["graph"];
|
|
3029
|
+
break;
|
|
2384
3030
|
case "graph":
|
|
2385
3031
|
case "node":
|
|
2386
3032
|
case "edge":
|
|
@@ -2406,12 +3052,13 @@ class GraphmlReader {
|
|
|
2406
3052
|
);
|
|
2407
3053
|
domains = [];
|
|
2408
3054
|
}
|
|
3055
|
+
const attrType = attrs.get("attr.type") ?? attrs.get("type") ?? null;
|
|
2409
3056
|
this.pendingKey = {
|
|
2410
3057
|
id,
|
|
2411
|
-
// `name` / `type` without the `attr.` prefix are written by some tools; the spec's spelling wins
|
|
2412
3058
|
attrName: attrs.get("attr.name") ?? attrs.get("name") ?? null,
|
|
2413
|
-
attrType
|
|
2414
|
-
|
|
3059
|
+
attrType,
|
|
3060
|
+
// yFiles 3 declares its untyped keys with `y:attr.uri` instead of `yfiles.type`: their data is nested XML
|
|
3061
|
+
yfilesType: attrs.get("yfiles.type") ?? (attrType === null ? attributeUri(attrs) : null),
|
|
2415
3062
|
domains,
|
|
2416
3063
|
line,
|
|
2417
3064
|
desc: "",
|
|
@@ -2929,6 +3576,18 @@ class GraphmlReader {
|
|
|
2929
3576
|
}
|
|
2930
3577
|
return value;
|
|
2931
3578
|
}
|
|
3579
|
+
if (typeof value !== "string" && target.spec.declared === "") {
|
|
3580
|
+
this.report.warnOnce(
|
|
3581
|
+
"validation-error",
|
|
3582
|
+
GRAPHML_ISSUE.DATA_STRUCTURED,
|
|
3583
|
+
`<data> of the untyped attribute "${target.name}" holds elements; they are kept as XML text`,
|
|
3584
|
+
{ line: where.line, element: target.name },
|
|
3585
|
+
`${GRAPHML_ISSUE.DATA_STRUCTURED}:${target.name}`
|
|
3586
|
+
);
|
|
3587
|
+
const parts = [];
|
|
3588
|
+
writeXmlTree(value, "", parts);
|
|
3589
|
+
return parts.join("").trim();
|
|
3590
|
+
}
|
|
2932
3591
|
if (typeof value !== "string") {
|
|
2933
3592
|
this.report.error(
|
|
2934
3593
|
"validation-error",
|
|
@@ -3659,7 +4318,11 @@ async function importGraphml(input, sink, options) {
|
|
|
3659
4318
|
report.fail(GRAPHML_ISSUE.EMPTY_INPUT, "the input is empty (no markup at all)", { line: err.line });
|
|
3660
4319
|
}
|
|
3661
4320
|
if (err instanceof XmlSyntaxError) {
|
|
3662
|
-
report.fail(
|
|
4321
|
+
report.fail(
|
|
4322
|
+
err instanceof XmlNestingError ? GRAPHML_ISSUE.XML_NESTING : GRAPHML_ISSUE.XML_SYNTAX,
|
|
4323
|
+
err.message,
|
|
4324
|
+
{ line: err.line }
|
|
4325
|
+
);
|
|
3663
4326
|
}
|
|
3664
4327
|
throw err;
|
|
3665
4328
|
}
|
|
@@ -3673,6 +4336,8 @@ const graphmlImporter = Object.freeze({
|
|
|
3673
4336
|
extensions: EXTENSIONS,
|
|
3674
4337
|
mimeTypes: MIME_TYPES,
|
|
3675
4338
|
sniff: sniffGraphml,
|
|
4339
|
+
styles: graphmlStyles,
|
|
4340
|
+
positions: yfilesPositions,
|
|
3676
4341
|
import: importGraphml
|
|
3677
4342
|
});
|
|
3678
4343
|
const GRAPHML_ELEMENTS = /* @__PURE__ */ new Set([
|
|
@@ -3695,17 +4360,8 @@ function unknownElementMessage(name) {
|
|
|
3695
4360
|
}
|
|
3696
4361
|
return GRAPHML_ELEMENTS.has(name) ? `element <${name}> is not allowed at this place in a GraphML file and was skipped` : `element <${name}> is not GraphML and was skipped`;
|
|
3697
4362
|
}
|
|
3698
|
-
function unreadAttributeMessage(kind, name, hint2) {
|
|
3699
|
-
if (hint2) {
|
|
3700
|
-
return `the <${kind}> parse hint ${name} is ignored`;
|
|
3701
|
-
}
|
|
3702
|
-
if (SCHEMA_ATTRIBUTES.has(name)) {
|
|
3703
|
-
return `the <${kind}> attribute ${name} is not kept`;
|
|
3704
|
-
}
|
|
3705
|
-
return `the <${kind}> attribute ${name} is not a GraphML attribute; it is not kept`;
|
|
3706
|
-
}
|
|
3707
4363
|
export {
|
|
3708
4364
|
graphmlImporter as a,
|
|
3709
4365
|
graphmlExporter as g
|
|
3710
4366
|
};
|
|
3711
|
-
//# sourceMappingURL=importer-
|
|
4367
|
+
//# sourceMappingURL=importer-ClwoVx3O.js.map
|