@graphty/graph-io 0.3.47 → 0.3.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{approximations-wWjCRzKj.js → approximations-Bzn3L-je.js} +2 -2
- package/dist/chunks/{approximations-wWjCRzKj.js.map → approximations-Bzn3L-je.js.map} +1 -1
- package/dist/chunks/bends-BGXjv_U4.js +129 -0
- package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
- package/dist/chunks/{block-DiGq58c3.js → block-iptrlMBb.js} +947 -134
- package/dist/chunks/block-iptrlMBb.js.map +1 -0
- package/dist/chunks/choose-CczZJaX_.js +717 -0
- package/dist/chunks/choose-CczZJaX_.js.map +1 -0
- package/dist/chunks/codes-BE2xir2k.js +157 -0
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-BKwqelYD.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-BKwqelYD.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/context-C3p0RQxR.js +664 -0
- package/dist/chunks/context-C3p0RQxR.js.map +1 -0
- package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
- package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
- package/dist/chunks/credentials-DXHx7nwR.js +349 -0
- package/dist/chunks/credentials-DXHx7nwR.js.map +1 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js +259 -0
- package/dist/chunks/cx-export-Bt6NoqTQ.js.map +1 -0
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/descriptor-C-YDhtsn.js +48 -0
- package/dist/chunks/descriptor-C-YDhtsn.js.map +1 -0
- package/dist/chunks/descriptor-DLA5kINx.js +142 -0
- package/dist/chunks/descriptor-DLA5kINx.js.map +1 -0
- package/dist/chunks/{emit-CwU8cUmG.js → emit-BwHQkZle.js} +1690 -103
- package/dist/chunks/emit-BwHQkZle.js.map +1 -0
- package/dist/chunks/{escape-CgzxiYPg.js → escape-CuCIzNMB.js} +12 -12
- package/dist/chunks/{escape-CgzxiYPg.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-BvqAXCKh.js → export-Cha4dRFz.js} +48 -1780
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter--Mk9gXCJ.js → exporter-BP6otMO6.js} +6 -4
- package/dist/chunks/{exporter--Mk9gXCJ.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-CrDWIyiq.js → exporter-D2CETOMK.js} +1222 -154
- package/dist/chunks/exporter-D2CETOMK.js.map +1 -0
- package/dist/chunks/{exporter-DndFlGSa.js → exporter-D9yMtocA.js} +7 -6
- package/dist/chunks/{exporter-DndFlGSa.js.map → exporter-D9yMtocA.js.map} +1 -1
- package/dist/chunks/exporter-_jrBTnos.js +1009 -0
- package/dist/chunks/exporter-_jrBTnos.js.map +1 -0
- package/dist/chunks/{exporter-CJgfhF-l.js → exporter-nDfxIK5D.js} +9 -7
- package/dist/chunks/{exporter-CJgfhF-l.js.map → exporter-nDfxIK5D.js.map} +1 -1
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-Dq1ntt9q.js → generic-ymWCETAJ.js} +387 -31
- package/dist/chunks/generic-ymWCETAJ.js.map +1 -0
- package/dist/chunks/{importer-CMmeMWlC.js → importer-B92x1xY5.js} +15 -263
- package/dist/chunks/importer-B92x1xY5.js.map +1 -0
- package/dist/chunks/{importer-DiZRmOQG.js → importer-CT9mJ1nn.js} +328 -90
- package/dist/chunks/importer-CT9mJ1nn.js.map +1 -0
- package/dist/chunks/{importer-COTK9Tsl.js → importer-DaLTjbds.js} +116 -1099
- package/dist/chunks/importer-DaLTjbds.js.map +1 -0
- package/dist/chunks/{importer-iFYPEKaJ.js → importer-GREKMdIf.js} +28 -16
- package/dist/chunks/importer-GREKMdIf.js.map +1 -0
- package/dist/chunks/{importer-BSvfrX_h.js → importer-PqaaKKnY.js} +23 -1016
- package/dist/chunks/importer-PqaaKKnY.js.map +1 -0
- package/dist/chunks/{importer-yh_aBCU6.js → importer-Vn5QvmmJ.js} +66 -12
- package/dist/chunks/importer-Vn5QvmmJ.js.map +1 -0
- package/dist/chunks/{importer-e6LGpqHB.js → importer-vRq4h3j5.js} +1470 -354
- package/dist/chunks/importer-vRq4h3j5.js.map +1 -0
- package/dist/chunks/input-CAxt_aV-.js +1397 -0
- package/dist/chunks/input-CAxt_aV-.js.map +1 -0
- package/dist/chunks/{json-elements-DJZRZ6jd.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-DJZRZ6jd.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-CT69Kd87.js → lexicon-Clf4QIyl.js} +299 -77
- package/dist/chunks/lexicon-Clf4QIyl.js.map +1 -0
- package/dist/chunks/{ontology-export-G4MqRdux.js → ontology-export-OMo91mb0.js} +4 -3
- package/dist/chunks/{ontology-export-G4MqRdux.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-CiaWZrFH.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-CiaWZrFH.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{format-BpQBx8MZ.js → report-CwMfYa9J.js} +70 -127
- package/dist/chunks/report-CwMfYa9J.js.map +1 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js +79 -0
- package/dist/chunks/round-trip-Zm3_ivgq.js.map +1 -0
- package/dist/chunks/sigv4-EokFic1V.js +247 -0
- package/dist/chunks/sigv4-EokFic1V.js.map +1 -0
- package/dist/chunks/{styles-BQnsga7p.js → styles-CCs214_3.js} +1300 -168
- package/dist/chunks/styles-CCs214_3.js.map +1 -0
- package/dist/chunks/styles-Cm62yyQX.js +2812 -0
- package/dist/chunks/styles-Cm62yyQX.js.map +1 -0
- package/dist/chunks/styles-DPQQIig4.js +1928 -0
- package/dist/chunks/styles-DPQQIig4.js.map +1 -0
- package/dist/chunks/styles-yed-UMFdNqze.js +1213 -0
- package/dist/chunks/styles-yed-UMFdNqze.js.map +1 -0
- package/dist/chunks/{text-CzJNFOS9.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-CzJNFOS9.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -5
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +5 -4
- package/dist/cx.js.map +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -10
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +850 -193
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +1189 -220
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +3 -2
- package/dist/neo4j.js +6 -4
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/positions.js +45 -3
- package/dist/positions.js.map +1 -1
- package/dist/sources-cypher.d.ts +1 -0
- package/dist/sources-cypher.js +1351 -0
- package/dist/sources-cypher.js.map +1 -0
- package/dist/sources-ndex.d.ts +1 -0
- package/dist/sources-ndex.js +278 -0
- package/dist/sources-ndex.js.map +1 -0
- package/dist/sources-rest.d.ts +1 -0
- package/dist/sources-rest.js +1377 -0
- package/dist/sources-rest.js.map +1 -0
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +405 -0
- package/dist/sources-sparql.js.map +1 -0
- package/dist/src/common/report.d.ts +6 -3
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +15 -9
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +5 -1
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +24 -1
- package/dist/src/formats/cx/styles.d.ts.map +1 -1
- package/dist/src/formats/cx/styles.js +118 -11
- package/dist/src/formats/cx/styles.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +1 -0
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts.map +1 -1
- package/dist/src/formats/cx2/styles.js +3 -1
- package/dist/src/formats/cx2/styles.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +1 -0
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +2 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -1
- package/dist/src/formats/cys/styles.js +15 -7
- package/dist/src/formats/cys/styles.js.map +1 -1
- package/dist/src/formats/dot/drawing.d.ts +98 -0
- package/dist/src/formats/dot/drawing.d.ts.map +1 -0
- package/dist/src/formats/dot/drawing.js +734 -0
- package/dist/src/formats/dot/drawing.js.map +1 -0
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +108 -31
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +34 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +179 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/record.d.ts +50 -0
- package/dist/src/formats/dot/record.d.ts.map +1 -0
- package/dist/src/formats/dot/record.js +275 -0
- package/dist/src/formats/dot/record.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +62 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1457 -120
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
- package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
- package/dist/src/formats/gexf/dialog-metrics.js +59 -0
- package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
- package/dist/src/formats/gexf/importer.d.ts +7 -0
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +41 -5
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/preview.d.ts +77 -0
- package/dist/src/formats/gexf/preview.d.ts.map +1 -0
- package/dist/src/formats/gexf/preview.js +191 -0
- package/dist/src/formats/gexf/preview.js.map +1 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +2 -1
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +60 -16
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +883 -131
- package/dist/src/formats/gexf/styles.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts +5 -2
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +258 -71
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +1 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +1 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +7 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -1
- package/dist/src/formats/gml/positions.js +29 -7
- package/dist/src/formats/gml/positions.js.map +1 -1
- package/dist/src/formats/gml/styles.d.ts.map +1 -1
- package/dist/src/formats/gml/styles.js +756 -103
- package/dist/src/formats/gml/styles.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-plain.js +8 -12
- package/dist/src/formats/graphml/styles-plain.js.map +1 -1
- package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yed.js +749 -148
- package/dist/src/formats/graphml/styles-yed.js.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
- package/dist/src/formats/graphml/styles-yfiles3.js +429 -64
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +3 -3
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +16 -6
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/dialect.d.ts +3 -2
- package/dist/src/formats/json/dialect.d.ts.map +1 -1
- package/dist/src/formats/json/dialect.js +39 -5
- package/dist/src/formats/json/dialect.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +13 -2
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +42 -6
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/index.d.ts +1 -1
- package/dist/src/formats/json/index.d.ts.map +1 -1
- package/dist/src/formats/json/index.js +1 -1
- package/dist/src/formats/json/index.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +5 -2
- package/dist/src/formats/json/positions.d.ts.map +1 -1
- package/dist/src/formats/json/positions.js +20 -4
- package/dist/src/formats/json/positions.js.map +1 -1
- package/dist/src/formats/json/styles.d.ts +12 -1
- package/dist/src/formats/json/styles.d.ts.map +1 -1
- package/dist/src/formats/json/styles.js +1755 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +96 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +372 -0
- package/dist/src/formats/pajek/draw.js.map +1 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +70 -51
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +9 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +233 -102
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +1 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +15 -7
- package/dist/src/formats/pajek/styles.d.ts.map +1 -1
- package/dist/src/formats/pajek/styles.js +1279 -114
- package/dist/src/formats/pajek/styles.js.map +1 -1
- package/dist/src/formats/pajek/syntax.d.ts +10 -1
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +26 -2
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts +1 -0
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +65 -5
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +23 -3
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
- package/dist/src/formats/xgmml/styles.js +278 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +10 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/convert.d.ts.map +1 -1
- package/dist/src/positions/convert.js +11 -1
- package/dist/src/positions/convert.js.map +1 -1
- package/dist/src/positions/extract.d.ts.map +1 -1
- package/dist/src/positions/extract.js +53 -1
- package/dist/src/positions/extract.js.map +1 -1
- package/dist/src/positions/index.d.ts +1 -1
- package/dist/src/positions/index.d.ts.map +1 -1
- package/dist/src/positions/types.d.ts +59 -0
- package/dist/src/positions/types.d.ts.map +1 -1
- package/dist/src/registry.d.ts +173 -1
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +196 -1
- package/dist/src/registry.js.map +1 -1
- package/dist/src/sources/builtins.d.ts +11 -0
- package/dist/src/sources/builtins.d.ts.map +1 -0
- package/dist/src/sources/builtins.js +53 -0
- package/dist/src/sources/builtins.js.map +1 -0
- package/dist/src/sources/codes.d.ts +230 -0
- package/dist/src/sources/codes.d.ts.map +1 -0
- package/dist/src/sources/codes.js +58 -0
- package/dist/src/sources/codes.js.map +1 -0
- package/dist/src/sources/context.d.ts +112 -0
- package/dist/src/sources/context.d.ts.map +1 -0
- package/dist/src/sources/context.js +740 -0
- package/dist/src/sources/context.js.map +1 -0
- package/dist/src/sources/credentials.d.ts +179 -0
- package/dist/src/sources/credentials.d.ts.map +1 -0
- package/dist/src/sources/credentials.js +301 -0
- package/dist/src/sources/credentials.js.map +1 -0
- package/dist/src/sources/cypher/descriptor.d.ts +21 -0
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -0
- package/dist/src/sources/cypher/descriptor.js +124 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -0
- package/dist/src/sources/cypher/flatten.d.ts +72 -0
- package/dist/src/sources/cypher/flatten.d.ts.map +1 -0
- package/dist/src/sources/cypher/flatten.js +279 -0
- package/dist/src/sources/cypher/flatten.js.map +1 -0
- package/dist/src/sources/cypher/index.d.ts +33 -0
- package/dist/src/sources/cypher/index.d.ts.map +1 -0
- package/dist/src/sources/cypher/index.js +511 -0
- package/dist/src/sources/cypher/index.js.map +1 -0
- package/dist/src/sources/cypher/params.d.ts +40 -0
- package/dist/src/sources/cypher/params.d.ts.map +1 -0
- package/dist/src/sources/cypher/params.js +6 -0
- package/dist/src/sources/cypher/params.js.map +1 -0
- package/dist/src/sources/cypher/profiles.d.ts +44 -0
- package/dist/src/sources/cypher/profiles.d.ts.map +1 -0
- package/dist/src/sources/cypher/profiles.js +61 -0
- package/dist/src/sources/cypher/profiles.js.map +1 -0
- package/dist/src/sources/cypher/query-builder.d.ts +123 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -0
- package/dist/src/sources/cypher/query-builder.js +267 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts +21 -0
- package/dist/src/sources/cypher/transports/bolt.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/bolt.js +185 -0
- package/dist/src/sources/cypher/transports/bolt.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts +15 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js +38 -0
- package/dist/src/sources/cypher/transports/neptune-analytics.js.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts +31 -0
- package/dist/src/sources/cypher/transports/neptune-https.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/neptune-https.js +104 -0
- package/dist/src/sources/cypher/transports/neptune-https.js.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts +14 -0
- package/dist/src/sources/cypher/transports/query-api.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/query-api.js +80 -0
- package/dist/src/sources/cypher/transports/query-api.js.map +1 -0
- package/dist/src/sources/cypher/transports/transport.d.ts +78 -0
- package/dist/src/sources/cypher/transports/transport.d.ts.map +1 -0
- package/dist/src/sources/cypher/transports/transport.js +77 -0
- package/dist/src/sources/cypher/transports/transport.js.map +1 -0
- package/dist/src/sources/cypher/types-map.d.ts +91 -0
- package/dist/src/sources/cypher/types-map.d.ts.map +1 -0
- package/dist/src/sources/cypher/types-map.js +306 -0
- package/dist/src/sources/cypher/types-map.js.map +1 -0
- package/dist/src/sources/define.d.ts +47 -0
- package/dist/src/sources/define.d.ts.map +1 -0
- package/dist/src/sources/define.js +173 -0
- package/dist/src/sources/define.js.map +1 -0
- package/dist/src/sources/fail.d.ts +33 -0
- package/dist/src/sources/fail.d.ts.map +1 -0
- package/dist/src/sources/fail.js +49 -0
- package/dist/src/sources/fail.js.map +1 -0
- package/dist/src/sources/ids.d.ts +69 -0
- package/dist/src/sources/ids.d.ts.map +1 -0
- package/dist/src/sources/ids.js +69 -0
- package/dist/src/sources/ids.js.map +1 -0
- package/dist/src/sources/ndex/client.d.ts +31 -0
- package/dist/src/sources/ndex/client.d.ts.map +1 -0
- package/dist/src/sources/ndex/client.js +90 -0
- package/dist/src/sources/ndex/client.js.map +1 -0
- package/dist/src/sources/ndex/descriptor.d.ts +10 -0
- package/dist/src/sources/ndex/descriptor.d.ts.map +1 -0
- package/dist/src/sources/ndex/descriptor.js +55 -0
- package/dist/src/sources/ndex/descriptor.js.map +1 -0
- package/dist/src/sources/ndex/expand.d.ts +20 -0
- package/dist/src/sources/ndex/expand.d.ts.map +1 -0
- package/dist/src/sources/ndex/expand.js +87 -0
- package/dist/src/sources/ndex/expand.js.map +1 -0
- package/dist/src/sources/ndex/index.d.ts +25 -0
- package/dist/src/sources/ndex/index.d.ts.map +1 -0
- package/dist/src/sources/ndex/index.js +191 -0
- package/dist/src/sources/ndex/index.js.map +1 -0
- package/dist/src/sources/ndex/params.d.ts +17 -0
- package/dist/src/sources/ndex/params.d.ts.map +1 -0
- package/dist/src/sources/ndex/params.js +6 -0
- package/dist/src/sources/ndex/params.js.map +1 -0
- package/dist/src/sources/ndex/share-url.d.ts +40 -0
- package/dist/src/sources/ndex/share-url.d.ts.map +1 -0
- package/dist/src/sources/ndex/share-url.js +64 -0
- package/dist/src/sources/ndex/share-url.js.map +1 -0
- package/dist/src/sources/params.d.ts +31 -0
- package/dist/src/sources/params.d.ts.map +1 -0
- package/dist/src/sources/params.js +6 -0
- package/dist/src/sources/params.js.map +1 -0
- package/dist/src/sources/registry.d.ts +118 -0
- package/dist/src/sources/registry.d.ts.map +1 -0
- package/dist/src/sources/registry.js +193 -0
- package/dist/src/sources/registry.js.map +1 -0
- package/dist/src/sources/rest/descriptor.d.ts +16 -0
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -0
- package/dist/src/sources/rest/descriptor.js +76 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -0
- package/dist/src/sources/rest/index.d.ts +14 -0
- package/dist/src/sources/rest/index.d.ts.map +1 -0
- package/dist/src/sources/rest/index.js +13 -0
- package/dist/src/sources/rest/index.js.map +1 -0
- package/dist/src/sources/rest/mapping.d.ts +30 -0
- package/dist/src/sources/rest/mapping.d.ts.map +1 -0
- package/dist/src/sources/rest/mapping.js +362 -0
- package/dist/src/sources/rest/mapping.js.map +1 -0
- package/dist/src/sources/rest/openalex.d.ts +27 -0
- package/dist/src/sources/rest/openalex.d.ts.map +1 -0
- package/dist/src/sources/rest/openalex.js +269 -0
- package/dist/src/sources/rest/openalex.js.map +1 -0
- package/dist/src/sources/rest/paging.d.ts +53 -0
- package/dist/src/sources/rest/paging.d.ts.map +1 -0
- package/dist/src/sources/rest/paging.js +138 -0
- package/dist/src/sources/rest/paging.js.map +1 -0
- package/dist/src/sources/rest/params.d.ts +216 -0
- package/dist/src/sources/rest/params.d.ts.map +1 -0
- package/dist/src/sources/rest/params.js +7 -0
- package/dist/src/sources/rest/params.js.map +1 -0
- package/dist/src/sources/rest/records.d.ts +41 -0
- package/dist/src/sources/rest/records.d.ts.map +1 -0
- package/dist/src/sources/rest/records.js +240 -0
- package/dist/src/sources/rest/records.js.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts +10 -0
- package/dist/src/sources/rest/samples/deps-dev.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/deps-dev.js +47 -0
- package/dist/src/sources/rest/samples/deps-dev.js.map +1 -0
- package/dist/src/sources/rest/samples/string.d.ts +9 -0
- package/dist/src/sources/rest/samples/string.d.ts.map +1 -0
- package/dist/src/sources/rest/samples/string.js +42 -0
- package/dist/src/sources/rest/samples/string.js.map +1 -0
- package/dist/src/sources/rest/selectors.d.ts +41 -0
- package/dist/src/sources/rest/selectors.d.ts.map +1 -0
- package/dist/src/sources/rest/selectors.js +81 -0
- package/dist/src/sources/rest/selectors.js.map +1 -0
- package/dist/src/sources/rest/source.d.ts +67 -0
- package/dist/src/sources/rest/source.d.ts.map +1 -0
- package/dist/src/sources/rest/source.js +650 -0
- package/dist/src/sources/rest/source.js.map +1 -0
- package/dist/src/sources/rest/templates.d.ts +38 -0
- package/dist/src/sources/rest/templates.d.ts.map +1 -0
- package/dist/src/sources/rest/templates.js +125 -0
- package/dist/src/sources/rest/templates.js.map +1 -0
- package/dist/src/sources/run.d.ts +93 -0
- package/dist/src/sources/run.d.ts.map +1 -0
- package/dist/src/sources/run.js +673 -0
- package/dist/src/sources/run.js.map +1 -0
- package/dist/src/sources/sha256.d.ts +12 -0
- package/dist/src/sources/sha256.d.ts.map +1 -0
- package/dist/src/sources/sha256.js +95 -0
- package/dist/src/sources/sha256.js.map +1 -0
- package/dist/src/sources/sigv4.d.ts +26 -0
- package/dist/src/sources/sigv4.d.ts.map +1 -0
- package/dist/src/sources/sigv4.js +184 -0
- package/dist/src/sources/sigv4.js.map +1 -0
- package/dist/src/sources/sparql/descriptor.d.ts +10 -0
- package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
- package/dist/src/sources/sparql/descriptor.js +64 -0
- package/dist/src/sources/sparql/descriptor.js.map +1 -0
- package/dist/src/sources/sparql/index.d.ts +28 -0
- package/dist/src/sources/sparql/index.d.ts.map +1 -0
- package/dist/src/sources/sparql/index.js +314 -0
- package/dist/src/sources/sparql/index.js.map +1 -0
- package/dist/src/sources/sparql/ntriples.d.ts +69 -0
- package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
- package/dist/src/sources/sparql/ntriples.js +180 -0
- package/dist/src/sources/sparql/ntriples.js.map +1 -0
- package/dist/src/sources/sparql/params.d.ts +27 -0
- package/dist/src/sources/sparql/params.d.ts.map +1 -0
- package/dist/src/sources/sparql/params.js +5 -0
- package/dist/src/sources/sparql/params.js.map +1 -0
- package/dist/src/sources/sparql/query.d.ts +72 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +113 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/testing.d.ts +96 -0
- package/dist/src/sources/testing.d.ts.map +1 -0
- package/dist/src/sources/testing.js +138 -0
- package/dist/src/sources/testing.js.map +1 -0
- package/dist/src/sources/types.d.ts +696 -0
- package/dist/src/sources/types.d.ts.map +1 -0
- package/dist/src/sources/types.js +10 -0
- package/dist/src/sources/types.js.map +1 -0
- package/dist/src/styles/annotations.d.ts +61 -5
- package/dist/src/styles/annotations.d.ts.map +1 -1
- package/dist/src/styles/annotations.js +130 -22
- package/dist/src/styles/annotations.js.map +1 -1
- package/dist/src/styles/canon/bends.d.ts +46 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -1
- package/dist/src/styles/canon/bends.js +123 -0
- package/dist/src/styles/canon/bends.js.map +1 -1
- package/dist/src/styles/canon/color-tables.d.ts +6 -1
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
- package/dist/src/styles/canon/color-tables.js +10 -4
- package/dist/src/styles/canon/color-tables.js.map +1 -1
- package/dist/src/styles/canon/color.d.ts +3 -1
- package/dist/src/styles/canon/color.d.ts.map +1 -1
- package/dist/src/styles/canon/color.js +103 -3
- package/dist/src/styles/canon/color.js.map +1 -1
- package/dist/src/styles/canon/enums.d.ts +2 -2
- package/dist/src/styles/canon/enums.d.ts.map +1 -1
- package/dist/src/styles/canon/enums.js +82 -7
- package/dist/src/styles/canon/enums.js.map +1 -1
- package/dist/src/styles/canon/graphviz.d.ts +12 -3
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
- package/dist/src/styles/canon/graphviz.js +57 -9
- package/dist/src/styles/canon/graphviz.js.map +1 -1
- package/dist/src/styles/canon/number.d.ts +8 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -1
- package/dist/src/styles/canon/number.js +18 -0
- package/dist/src/styles/canon/number.js.map +1 -1
- package/dist/src/styles/canon/text.d.ts +29 -2
- package/dist/src/styles/canon/text.d.ts.map +1 -1
- package/dist/src/styles/canon/text.js +156 -16
- package/dist/src/styles/canon/text.js.map +1 -1
- package/dist/src/styles/codes.d.ts +2 -0
- package/dist/src/styles/codes.d.ts.map +1 -1
- package/dist/src/styles/codes.js +2 -0
- package/dist/src/styles/codes.js.map +1 -1
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
- package/dist/src/styles/cyjs/cascade.js +1037 -35
- package/dist/src/styles/cyjs/cascade.js.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
- package/dist/src/styles/cyjs/defaults-table.js +5 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +216 -12
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cyjs/face.d.ts +20 -0
- package/dist/src/styles/cyjs/face.d.ts.map +1 -0
- package/dist/src/styles/cyjs/face.js +332 -0
- package/dist/src/styles/cyjs/face.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +48 -2
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +463 -26
- package/dist/src/styles/cyjs/mappers.js.map +1 -1
- package/dist/src/styles/cyjs/routes.d.ts +53 -0
- package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
- package/dist/src/styles/cyjs/routes.js +360 -0
- package/dist/src/styles/cyjs/routes.js.map +1 -0
- package/dist/src/styles/cytoscape/charts.d.ts +23 -0
- package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/charts.js +560 -0
- package/dist/src/styles/cytoscape/charts.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/emit.js +204 -44
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +97 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +413 -79
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/mappings.js +92 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -1
- package/dist/src/styles/cytoscape/resolve.d.ts +46 -3
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +632 -22
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/translate.js +10 -10
- package/dist/src/styles/cytoscape/translate.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +50 -0
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +315 -37
- package/dist/src/styles/defaults.js.map +1 -1
- package/dist/src/styles/index.d.ts +4 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +3 -2
- package/dist/src/styles/index.js.map +1 -1
- package/dist/src/styles/internal.d.ts +1 -0
- package/dist/src/styles/internal.d.ts.map +1 -1
- package/dist/src/styles/internal.js +1 -0
- package/dist/src/styles/internal.js.map +1 -1
- package/dist/src/styles/io/block.d.ts.map +1 -1
- package/dist/src/styles/io/block.js +9 -0
- package/dist/src/styles/io/block.js.map +1 -1
- package/dist/src/styles/io/generic.d.ts.map +1 -1
- package/dist/src/styles/io/generic.js +56 -16
- package/dist/src/styles/io/generic.js.map +1 -1
- package/dist/src/styles/io/round-trip.d.ts +56 -0
- package/dist/src/styles/io/round-trip.d.ts.map +1 -0
- package/dist/src/styles/io/round-trip.js +138 -0
- package/dist/src/styles/io/round-trip.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +13 -4
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/src/styles/notes.d.ts.map +1 -1
- package/dist/src/styles/notes.js +1 -0
- package/dist/src/styles/notes.js.map +1 -1
- package/dist/src/styles/plan/features.d.ts +1 -1
- package/dist/src/styles/plan/features.d.ts.map +1 -1
- package/dist/src/styles/plan/features.js +22 -2
- package/dist/src/styles/plan/features.js.map +1 -1
- package/dist/src/styles/plan/index.d.ts +1 -1
- package/dist/src/styles/plan/index.d.ts.map +1 -1
- package/dist/src/styles/plan/index.js +1 -1
- package/dist/src/styles/plan/index.js.map +1 -1
- package/dist/src/styles/plan/plan.d.ts.map +1 -1
- package/dist/src/styles/plan/plan.js +61 -4
- package/dist/src/styles/plan/plan.js.map +1 -1
- package/dist/src/styles/plan/resolve.d.ts +13 -1
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +53 -6
- package/dist/src/styles/plan/resolve.js.map +1 -1
- package/dist/src/styles/slots.d.ts +14 -0
- package/dist/src/styles/slots.d.ts.map +1 -0
- package/dist/src/styles/slots.js +20 -0
- package/dist/src/styles/slots.js.map +1 -0
- package/dist/src/styles/types.d.ts +638 -5
- package/dist/src/styles/types.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.d.ts +3 -2
- package/dist/src/styles/vocabulary.d.ts.map +1 -1
- package/dist/src/styles/vocabulary.js +218 -1
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/src/types.d.ts +19 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.js +29 -238
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/docs/samples/people.json +6 -0
- package/package.json +53 -8
- package/src/common/report.ts +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +144 -9
- package/src/formats/cx2/importer.ts +1 -0
- package/src/formats/cx2/styles.ts +3 -1
- package/src/formats/cys/importer.ts +1 -0
- package/src/formats/cys/styles.ts +27 -5
- package/src/formats/dot/drawing.ts +799 -0
- package/src/formats/dot/importer.ts +120 -35
- package/src/formats/dot/label-places.ts +228 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1657 -154
- package/src/formats/gexf/dialog-metrics.ts +61 -0
- package/src/formats/gexf/importer.ts +50 -5
- package/src/formats/gexf/preview.ts +217 -0
- package/src/formats/gexf/schema.ts +2 -1
- package/src/formats/gexf/styles.ts +1144 -142
- package/src/formats/gml/importer.ts +291 -76
- package/src/formats/gml/index.ts +1 -1
- package/src/formats/gml/positions.ts +29 -7
- package/src/formats/gml/styles.ts +854 -111
- package/src/formats/graphml/styles-plain.ts +8 -23
- package/src/formats/graphml/styles-yed.ts +821 -159
- package/src/formats/graphml/styles-yfiles3.ts +485 -63
- package/src/formats/graphml/yfiles.ts +19 -6
- package/src/formats/json/dialect.ts +41 -5
- package/src/formats/json/importer.ts +59 -7
- package/src/formats/json/index.ts +1 -0
- package/src/formats/json/positions.ts +22 -5
- package/src/formats/json/styles.ts +2041 -185
- package/src/formats/pajek/draw.ts +458 -0
- package/src/formats/pajek/exporter.ts +81 -49
- package/src/formats/pajek/importer.ts +278 -103
- package/src/formats/pajek/index.ts +1 -0
- package/src/formats/pajek/styles.ts +1382 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +331 -71
- package/src/index.ts +94 -0
- package/src/positions/convert.ts +12 -1
- package/src/positions/extract.ts +55 -1
- package/src/positions/index.ts +1 -0
- package/src/positions/types.ts +60 -0
- package/src/registry.ts +326 -1
- package/src/sources/builtins.ts +63 -0
- package/src/sources/codes.ts +235 -0
- package/src/sources/context.ts +894 -0
- package/src/sources/credentials.ts +409 -0
- package/src/sources/cypher/descriptor.ts +131 -0
- package/src/sources/cypher/flatten.ts +323 -0
- package/src/sources/cypher/index.ts +628 -0
- package/src/sources/cypher/params.ts +41 -0
- package/src/sources/cypher/profiles.ts +78 -0
- package/src/sources/cypher/query-builder.ts +327 -0
- package/src/sources/cypher/transports/bolt.ts +228 -0
- package/src/sources/cypher/transports/neptune-analytics.ts +41 -0
- package/src/sources/cypher/transports/neptune-https.ts +122 -0
- package/src/sources/cypher/transports/query-api.ts +100 -0
- package/src/sources/cypher/transports/transport.ts +139 -0
- package/src/sources/cypher/types-map.ts +418 -0
- package/src/sources/define.ts +195 -0
- package/src/sources/fail.ts +70 -0
- package/src/sources/ids.ts +80 -0
- package/src/sources/ndex/client.ts +102 -0
- package/src/sources/ndex/descriptor.ts +64 -0
- package/src/sources/ndex/expand.ts +100 -0
- package/src/sources/ndex/index.ts +235 -0
- package/src/sources/ndex/params.ts +17 -0
- package/src/sources/ndex/share-url.ts +84 -0
- package/src/sources/params.ts +32 -0
- package/src/sources/registry.ts +325 -0
- package/src/sources/rest/descriptor.ts +79 -0
- package/src/sources/rest/index.ts +22 -0
- package/src/sources/rest/mapping.ts +401 -0
- package/src/sources/rest/openalex.ts +288 -0
- package/src/sources/rest/paging.ts +180 -0
- package/src/sources/rest/params.ts +243 -0
- package/src/sources/rest/records.ts +289 -0
- package/src/sources/rest/samples/deps-dev.ts +49 -0
- package/src/sources/rest/samples/string.ts +44 -0
- package/src/sources/rest/selectors.ts +91 -0
- package/src/sources/rest/source.ts +776 -0
- package/src/sources/rest/templates.ts +151 -0
- package/src/sources/run.ts +793 -0
- package/src/sources/sha256.ts +99 -0
- package/src/sources/sigv4.ts +209 -0
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +356 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +162 -0
- package/src/sources/testing.ts +210 -0
- package/src/sources/types.ts +776 -0
- package/src/styles/annotations.ts +201 -27
- package/src/styles/canon/bends.ts +137 -0
- package/src/styles/canon/color-tables.ts +10 -4
- package/src/styles/canon/color.ts +105 -3
- package/src/styles/canon/enums.ts +99 -8
- package/src/styles/canon/graphviz.ts +71 -10
- package/src/styles/canon/number.ts +19 -0
- package/src/styles/canon/text.ts +187 -16
- package/src/styles/codes.ts +2 -0
- package/src/styles/cyjs/cascade.ts +1193 -38
- package/src/styles/cyjs/defaults-table.ts +5 -0
- package/src/styles/cyjs/emit.ts +247 -16
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +498 -28
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +220 -44
- package/src/styles/cytoscape/lexicon.ts +459 -80
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +763 -23
- package/src/styles/cytoscape/translate.ts +11 -11
- package/src/styles/defaults.ts +436 -38
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/block.ts +10 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +14 -4
- package/src/styles/notes.ts +1 -0
- package/src/styles/plan/features.ts +23 -2
- package/src/styles/plan/index.ts +1 -1
- package/src/styles/plan/plan.ts +69 -5
- package/src/styles/plan/resolve.ts +61 -6
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +658 -4
- package/src/styles/vocabulary.ts +226 -3
- package/src/types.ts +19 -5
- package/dist/chunks/block-DiGq58c3.js.map +0 -1
- package/dist/chunks/choose--jM0yYCo.js +0 -57
- package/dist/chunks/choose--jM0yYCo.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/emit-CwU8cUmG.js.map +0 -1
- package/dist/chunks/export-BvqAXCKh.js.map +0 -1
- package/dist/chunks/exporter-CrDWIyiq.js.map +0 -1
- package/dist/chunks/format-BpQBx8MZ.js.map +0 -1
- package/dist/chunks/generic-Dq1ntt9q.js.map +0 -1
- package/dist/chunks/importer-BSvfrX_h.js.map +0 -1
- package/dist/chunks/importer-CMmeMWlC.js.map +0 -1
- package/dist/chunks/importer-COTK9Tsl.js.map +0 -1
- package/dist/chunks/importer-DiZRmOQG.js.map +0 -1
- package/dist/chunks/importer-e6LGpqHB.js.map +0 -1
- package/dist/chunks/importer-iFYPEKaJ.js.map +0 -1
- package/dist/chunks/importer-yh_aBCU6.js.map +0 -1
- package/dist/chunks/lexicon-CT69Kd87.js.map +0 -1
- package/dist/chunks/styles-BQnsga7p.js.map +0 -1
- package/dist/chunks/styles-D3fRphrO.js +0 -690
- package/dist/chunks/styles-D3fRphrO.js.map +0 -1
- package/dist/chunks/styles-yed-BF5x3_Y5.js +0 -842
- package/dist/chunks/styles-yed-BF5x3_Y5.js.map +0 -1
- package/dist/chunks/writer-DMKvthQE.js +0 -448
- package/dist/chunks/writer-DMKvthQE.js.map +0 -1
|
@@ -36,7 +36,9 @@ import { STYLE_ISSUE } from "../codes.js";
|
|
|
36
36
|
import { StyleNotes } from "../notes.js";
|
|
37
37
|
import { canonicalFor, degreeValues, evalContinuous, numberOf, plainCell } from "../plan/resolve.js";
|
|
38
38
|
import { CYJS_DEFAULT_STYLESHEET, CYJS_PROPERTY_DEFAULTS } from "./defaults-table.js";
|
|
39
|
-
import {
|
|
39
|
+
import { combineFace } from "./face.js";
|
|
40
|
+
import { applyCyjsMapper, CYJS_CURVE_STYLES, CYJS_THROWS, cyjsAliasOf, cyjsDashLook, cyjsNeutral, cyjsPolygonShapes, cyjsProperties, cyjsPropertyName, cyjsRendered, gradientStopColors, gradientStops, parseCyjsValue, } from "./mappers.js";
|
|
41
|
+
import { cyjsRoute } from "./routes.js";
|
|
40
42
|
import { parseCyjsSelector } from "./selector.js";
|
|
41
43
|
import { parseCyjsStylesheetText } from "./stylesheet-text.js";
|
|
42
44
|
/**
|
|
@@ -927,6 +929,17 @@ const POSITIONS = new Map([
|
|
|
927
929
|
["bottom,center", "bottom"],
|
|
928
930
|
["bottom,right", "bottom-right"],
|
|
929
931
|
]);
|
|
932
|
+
/** The positions inside the node, by the sides the `-inside` alignments name (`center` for neither). */
|
|
933
|
+
const INSIDE_POSITIONS = new Map([
|
|
934
|
+
["top,left", "inside-top-left"],
|
|
935
|
+
["top,center", "inside-top"],
|
|
936
|
+
["top,right", "inside-top-right"],
|
|
937
|
+
["center,left", "inside-left"],
|
|
938
|
+
["center,right", "inside-right"],
|
|
939
|
+
["bottom,left", "inside-bottom-left"],
|
|
940
|
+
["bottom,center", "inside-bottom"],
|
|
941
|
+
["bottom,right", "inside-bottom-right"],
|
|
942
|
+
]);
|
|
930
943
|
/**
|
|
931
944
|
* Applies a Cytoscape.js stylesheet to its elements as Cytoscape.js 3.34 does.
|
|
932
945
|
* @param input - the elements, the stylesheet, the graph and the options
|
|
@@ -977,8 +990,8 @@ export function evaluateCytoscapeJs(input) {
|
|
|
977
990
|
notes.add(STYLE_ISSUE.SELECTOR, null, "selector", { count: deep, sample: "nested too deep" });
|
|
978
991
|
}
|
|
979
992
|
const matcher = new Matcher(graph, notes);
|
|
980
|
-
const node = evaluateTarget("node", graph, sheet, matcher, input, notes, budget);
|
|
981
|
-
const edge = evaluateTarget("edge", graph, sheet, matcher, input, notes, budget);
|
|
993
|
+
const node = evaluateTarget("node", graph, sheet, matcher, input, { notes, budget, nodes: null });
|
|
994
|
+
const edge = evaluateTarget("edge", graph, sheet, matcher, input, { notes, budget, nodes: node });
|
|
982
995
|
return { node, edge, graph };
|
|
983
996
|
}
|
|
984
997
|
/**
|
|
@@ -1059,11 +1072,14 @@ function cellsOf(cells, name, n) {
|
|
|
1059
1072
|
* @param sheet - the entries
|
|
1060
1073
|
* @param matcher - the selector evaluator
|
|
1061
1074
|
* @param input - the input
|
|
1062
|
-
* @param
|
|
1063
|
-
* @param
|
|
1075
|
+
* @param env - where problems are noted, the counted budget, and for edges the nodes' values
|
|
1076
|
+
* @param env.notes - where problems are noted
|
|
1077
|
+
* @param env.budget - the counted budget
|
|
1078
|
+
* @param env.nodes - the nodes' values, which edge routes are measured against (null for nodes)
|
|
1064
1079
|
* @returns the target's values and rules
|
|
1065
1080
|
*/
|
|
1066
|
-
function evaluateTarget(kind, graph, sheet, matcher, input,
|
|
1081
|
+
function evaluateTarget(kind, graph, sheet, matcher, input, env) {
|
|
1082
|
+
const { notes, budget } = env;
|
|
1067
1083
|
const els = kind === "node" ? graph.nodes : graph.edges;
|
|
1068
1084
|
const spend = (ops) => {
|
|
1069
1085
|
budget.spend(kind, ops);
|
|
@@ -1081,6 +1097,21 @@ function evaluateTarget(kind, graph, sheet, matcher, input, notes, budget) {
|
|
|
1081
1097
|
forceLoopCurves(graph, cells.get("curve-style"));
|
|
1082
1098
|
}
|
|
1083
1099
|
const drawn = drawnValues(kind, els, cells, order, input.rendered, notes, spend);
|
|
1100
|
+
// a file read with Cytoscape.js's own defaults draws an edge no rule curves as a haystack (a file graphty wrote
|
|
1101
|
+
// is read with graphty's)
|
|
1102
|
+
if (kind === "edge" && input.toolDefaults !== false) {
|
|
1103
|
+
const read = { kind, els, cells, order, rendered: input.rendered, notes };
|
|
1104
|
+
const curves = drawnColumn(read, "curve-style", CURVE_PART);
|
|
1105
|
+
noArrowsOnHaystacks(curves, drawn);
|
|
1106
|
+
if (env.nodes !== null) {
|
|
1107
|
+
edgeRoutes(graph, read, curves, env.nodes, drawn);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
if (kind === "node") {
|
|
1111
|
+
const read = { kind, els, cells, order, rendered: input.rendered, notes };
|
|
1112
|
+
nodeSizes(graph, read, drawn);
|
|
1113
|
+
mixedLabelPlaces(graph, read, drawn);
|
|
1114
|
+
}
|
|
1084
1115
|
if (kind === "edge") {
|
|
1085
1116
|
straightenUnpairedBeziers(graph, curveStyles(graph, cells, input.rendered), coreToOut, drawn.curved);
|
|
1086
1117
|
}
|
|
@@ -1231,7 +1262,7 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
|
|
|
1231
1262
|
const col = drawnColumn(drawnOf, name, spec);
|
|
1232
1263
|
spend(2 * out);
|
|
1233
1264
|
if (spec.property.startsWith("_")) {
|
|
1234
|
-
words.set(spec.property, col.map((v) => (typeof v === "string" ? v : null)));
|
|
1265
|
+
words.set(spec.property, col.map((v) => (typeof v === "string" || typeof v === "number" ? String(v) : null)));
|
|
1235
1266
|
continue;
|
|
1236
1267
|
}
|
|
1237
1268
|
values[_a = spec.property] ?? (values[_a] = new Array(out).fill(null));
|
|
@@ -1243,6 +1274,9 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
|
|
|
1243
1274
|
});
|
|
1244
1275
|
}
|
|
1245
1276
|
combineParts(kind, out, words, values, notes);
|
|
1277
|
+
if (kind === "node") {
|
|
1278
|
+
cyjsPolygonShapes(values);
|
|
1279
|
+
}
|
|
1246
1280
|
const drawn = {};
|
|
1247
1281
|
for (const [p, col] of Object.entries(values)) {
|
|
1248
1282
|
if (col.some((v) => v !== null)) {
|
|
@@ -1389,7 +1423,7 @@ function forceLoopCurves(graph, col) {
|
|
|
1389
1423
|
function entryProperties(entry, kind, specs, notes, notCarried) {
|
|
1390
1424
|
const out = [];
|
|
1391
1425
|
for (const [name0, value] of entry.properties) {
|
|
1392
|
-
const name = entry.dashOnly ?
|
|
1426
|
+
const name = entry.dashOnly ? cyjsAliasOf(name0) : cyjsPropertyName(name0);
|
|
1393
1427
|
const spec = specs.get(name);
|
|
1394
1428
|
if (spec === undefined) {
|
|
1395
1429
|
if (kind === "node" && !CYJS_EDGE_ONLY.has(name) && !entry.tool) {
|
|
@@ -1409,26 +1443,37 @@ function entryProperties(entry, kind, specs, notes, notCarried) {
|
|
|
1409
1443
|
}
|
|
1410
1444
|
return out;
|
|
1411
1445
|
}
|
|
1412
|
-
/**
|
|
1413
|
-
* A property name of an entry Cytoscape.js reads in dash form only: `content` is `label`, any other name as it is.
|
|
1414
|
-
* @param name - the name as written
|
|
1415
|
-
* @returns the name
|
|
1416
|
-
*/
|
|
1417
|
-
function dashOnlyName(name) {
|
|
1418
|
-
return name === "content" ? "label" : name;
|
|
1419
|
-
}
|
|
1420
1446
|
/** Edge properties a node never carries: not noted as dropped on nodes. */
|
|
1421
1447
|
const CYJS_EDGE_ONLY = new Set([
|
|
1422
1448
|
"line-color",
|
|
1423
1449
|
"line-style",
|
|
1450
|
+
"line-outline-width",
|
|
1451
|
+
"line-outline-color",
|
|
1452
|
+
"line-fill",
|
|
1453
|
+
"line-gradient-stop-colors",
|
|
1454
|
+
"line-gradient-stop-positions",
|
|
1424
1455
|
"target-arrow-shape",
|
|
1425
1456
|
"source-arrow-shape",
|
|
1426
1457
|
"target-arrow-color",
|
|
1427
1458
|
"source-arrow-color",
|
|
1459
|
+
"mid-target-arrow-shape",
|
|
1460
|
+
"mid-source-arrow-shape",
|
|
1461
|
+
"mid-target-arrow-color",
|
|
1462
|
+
"mid-source-arrow-color",
|
|
1463
|
+
"target-arrow-fill",
|
|
1464
|
+
"source-arrow-fill",
|
|
1428
1465
|
"curve-style",
|
|
1429
1466
|
"arrow-scale",
|
|
1430
1467
|
"source-label",
|
|
1431
1468
|
"target-label",
|
|
1469
|
+
"source-text-offset",
|
|
1470
|
+
"target-text-offset",
|
|
1471
|
+
"source-text-margin-x",
|
|
1472
|
+
"source-text-margin-y",
|
|
1473
|
+
"target-text-margin-x",
|
|
1474
|
+
"target-text-margin-y",
|
|
1475
|
+
"source-text-rotation",
|
|
1476
|
+
"target-text-rotation",
|
|
1432
1477
|
]);
|
|
1433
1478
|
/**
|
|
1434
1479
|
* The elements of a target a selector matches, in order.
|
|
@@ -1546,7 +1591,8 @@ function neutralOfCell(spec, name, c, site) {
|
|
|
1546
1591
|
return cyjsNeutral(spec, flat, site);
|
|
1547
1592
|
}
|
|
1548
1593
|
/**
|
|
1549
|
-
* Combines the label alignments into `labelPosition`
|
|
1594
|
+
* Combines the label alignments into `labelPosition`, `text-wrap` with `text-max-width` and `text-overflow-wrap` into
|
|
1595
|
+
* `labelWrapWidth`, `labelWrapEllipsis` and `labelWrapAnywhere`, and `visibility` with `display` into `visible`.
|
|
1550
1596
|
* @param kind - the target
|
|
1551
1597
|
* @param n - the element count
|
|
1552
1598
|
* @param words - the parts by internal name
|
|
@@ -1554,44 +1600,993 @@ function neutralOfCell(spec, name, c, site) {
|
|
|
1554
1600
|
* @param notes - where problems are noted
|
|
1555
1601
|
*/
|
|
1556
1602
|
function combineParts(kind, n, words, values, notes) {
|
|
1603
|
+
// the element's own opacity, before an edge's line opacity is multiplied in: its label is drawn at it
|
|
1604
|
+
const whole = [...(values.opacity ?? new Array(n).fill(null))];
|
|
1605
|
+
combineLabelOpacity(n, words, values);
|
|
1606
|
+
if (kind === "node") {
|
|
1607
|
+
combineNodeOpacity(n, words, values);
|
|
1608
|
+
}
|
|
1557
1609
|
const va = words.get("_valign");
|
|
1558
1610
|
const ha = words.get("_halign");
|
|
1559
1611
|
if (kind === "node" && (va !== undefined || ha !== undefined)) {
|
|
1560
|
-
values.labelPosition = Array.from({ length: n }, (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null
|
|
1561
|
-
|
|
1562
|
-
|
|
1612
|
+
values.labelPosition = Array.from({ length: n }, (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null));
|
|
1613
|
+
}
|
|
1614
|
+
// `text-max-width` wraps a label only under `text-wrap: wrap`; unset there, it is 9999 (cytoscape.js 3.34.3
|
|
1615
|
+
// dist/cytoscape.cjs.js line 18484), which wraps nothing but the label's own line breaks.
|
|
1616
|
+
// `text-wrap: ellipsis` cuts the label at the same width instead (3.34.3 line 25254), and
|
|
1617
|
+
// `text-overflow-wrap: anywhere` breaks a wrapped one between any two letters (line 25204).
|
|
1618
|
+
const wrap = words.get("_wrap");
|
|
1619
|
+
const maxWidth = words.get("_maxWidth");
|
|
1620
|
+
const overflow = words.get("_overflowWrap");
|
|
1621
|
+
if (wrap !== undefined) {
|
|
1622
|
+
const cut = (i) => wrap[i] === "wrap" || wrap[i] === "ellipsis";
|
|
1623
|
+
values.labelWrapWidth = Array.from({ length: n }, (_, i) => cut(i) && typeof maxWidth?.[i] === "string" ? Number(maxWidth[i]) : null);
|
|
1624
|
+
if (wrap.includes("ellipsis")) {
|
|
1625
|
+
values.labelWrapEllipsis = wrap.map((w) => (w === "ellipsis" ? true : null));
|
|
1626
|
+
}
|
|
1627
|
+
if (overflow?.includes("anywhere") === true) {
|
|
1628
|
+
values.labelWrapAnywhere = wrap.map((w, i) => (w === "wrap" && overflow[i] === "anywhere" ? true : null));
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
if (kind === "node") {
|
|
1632
|
+
combineFace(n, words, values);
|
|
1633
|
+
combineBackgroundGradient(n, words, values, notes);
|
|
1634
|
+
}
|
|
1635
|
+
else {
|
|
1636
|
+
combineArrowFills(n, words, values, notes);
|
|
1637
|
+
combineLineOpacity(n, words.get("_lineOpacity"), values);
|
|
1638
|
+
}
|
|
1639
|
+
combineDashes(kind, n, words, values);
|
|
1640
|
+
combineLabelText(kind, n, words, values);
|
|
1641
|
+
combineLabelDress(kind, n, words, values, notes, whole);
|
|
1642
|
+
combineVisibility(kind, n, words, values);
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* A label's opacity as Cytoscape.js draws it: its `text-opacity` times the element's `opacity` (cytoscape.js 3.34.3
|
|
1646
|
+
* `drawText`: `effectiveOpacity() * text-opacity`), which the label's box and its line round it are drawn at too.
|
|
1647
|
+
* ponytail: a compound parent's opacity, which Cytoscape.js multiplies in as well, is left out
|
|
1648
|
+
* @param n - the element count
|
|
1649
|
+
* @param words - the parts by internal name
|
|
1650
|
+
* @param values - the values, `opacity` still the element's own; changed in place
|
|
1651
|
+
*/
|
|
1652
|
+
function combineLabelOpacity(n, words, values) {
|
|
1653
|
+
const text = words.get("_textOpacity");
|
|
1654
|
+
const whole = values.opacity;
|
|
1655
|
+
if (text === undefined && whole === undefined) {
|
|
1656
|
+
return;
|
|
1657
|
+
}
|
|
1658
|
+
const col = new Array(n).fill(null);
|
|
1659
|
+
for (let i = 0; i < n; i++) {
|
|
1660
|
+
const t = text?.[i] ?? null;
|
|
1661
|
+
const o = whole?.[i];
|
|
1662
|
+
const v = Math.round((t === null ? 1 : Number(t)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
|
|
1663
|
+
// a label at full strength is left unset, as one no rule fades
|
|
1664
|
+
col[i] = v === 1 || !Number.isFinite(v) ? null : v;
|
|
1665
|
+
}
|
|
1666
|
+
values.labelOpacity = col;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* A node's border and outline as Cytoscape.js draws them: at their own `border-opacity` / `outline-opacity` times the
|
|
1670
|
+
* node's `opacity` (cytoscape.js 3.34.3 `drawNode`: `parentOpacity * borderOpacity`). A ring at full strength is left
|
|
1671
|
+
* unset.
|
|
1672
|
+
* @param n - the element count
|
|
1673
|
+
* @param words - the parts by internal name
|
|
1674
|
+
* @param values - the values, `opacity` still the node's own; changed in place
|
|
1675
|
+
*/
|
|
1676
|
+
function combineNodeOpacity(n, words, values) {
|
|
1677
|
+
const whole = values.opacity;
|
|
1678
|
+
for (const [part, p] of [
|
|
1679
|
+
["_ringOpacity", "borderOpacity"],
|
|
1680
|
+
["_outlineRingOpacity", "outerBorderOpacity"],
|
|
1681
|
+
]) {
|
|
1682
|
+
const own = words.get(part);
|
|
1683
|
+
if (own === undefined && whole === undefined) {
|
|
1684
|
+
continue;
|
|
1685
|
+
}
|
|
1686
|
+
values[p] = Array.from({ length: n }, (_, i) => {
|
|
1687
|
+
const a = own?.[i] ?? null;
|
|
1688
|
+
const o = whole?.[i];
|
|
1689
|
+
const v = Math.round((a === null ? 1 : Number(a)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
|
|
1690
|
+
return v === 1 || !Number.isFinite(v) ? null : v;
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* A dashed line or border as the line it looks like. Cytoscape.js draws `dashed` with `line-dash-pattern` (6 3) or
|
|
1696
|
+
* `border-dash-pattern` (4 2) in pixels whatever the width, and `dotted` as 1 1 (cytoscape.js 3.34.3 `drawEdgePath`,
|
|
1697
|
+
* `drawNode`), so a wide dashed line shows dots and a pattern of long and short dashes a dash-dot. The class is read
|
|
1698
|
+
* from the dashes and gaps against the width, a round or square cap lengthening each dash by the width.
|
|
1699
|
+
* ponytail: the neutral line styles name a class, not a pattern; a dash pattern slot would carry the lengths exactly
|
|
1700
|
+
* @param kind - the target
|
|
1701
|
+
* @param n - the element count
|
|
1702
|
+
* @param words - the parts by internal name
|
|
1703
|
+
* @param values - the values; changed in place
|
|
1704
|
+
*/
|
|
1705
|
+
function combineDashes(kind, n, words, values) {
|
|
1706
|
+
// the line or border, and a node's outline, which is always dashed 4 2 with butt ends (`drawOutline`)
|
|
1707
|
+
const lines = kind === "edge"
|
|
1708
|
+
? [["lineStyle", "width", 3, "6 3", true]]
|
|
1709
|
+
: [
|
|
1710
|
+
["borderStyle", "borderWidth", 0, "4 2", true],
|
|
1711
|
+
["outerBorderStyle", "outerBorderWidth", 0, "4 2", false],
|
|
1712
|
+
];
|
|
1713
|
+
for (const [style, width, fallback, pattern, own] of lines) {
|
|
1714
|
+
const col = values[style];
|
|
1715
|
+
if (col !== undefined) {
|
|
1716
|
+
dashColumn(col, n, values[width], { fallback, pattern }, own ? words : null);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* One line style's dashed lines as the lines they look like.
|
|
1722
|
+
* @param col - the line styles; changed in place
|
|
1723
|
+
* @param n - the element count
|
|
1724
|
+
* @param widths - the lines' widths, when set
|
|
1725
|
+
* @param drawn - what Cytoscape.js draws when they are not set: the width and the dash pattern
|
|
1726
|
+
* @param drawn.fallback - the width
|
|
1727
|
+
* @param drawn.pattern - the dash pattern
|
|
1728
|
+
* @param words - the parts by internal name, or null for an outline, which has no pattern or cap of its own
|
|
1729
|
+
*/
|
|
1730
|
+
function dashColumn(col, n, widths, drawn, words) {
|
|
1731
|
+
for (let i = 0; i < n; i++) {
|
|
1732
|
+
if (col[i] !== "dashed") {
|
|
1733
|
+
continue;
|
|
1734
|
+
}
|
|
1735
|
+
const w = widths?.[i];
|
|
1736
|
+
const look = dashedLook(words, i, drawn.pattern, typeof w === "number" ? w : drawn.fallback);
|
|
1737
|
+
if (look !== null) {
|
|
1738
|
+
col[i] = look;
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* One dashed line's look, from its dash pattern (its own `line-dash-pattern` when it has one) and cap.
|
|
1744
|
+
* @param words - the parts by internal name, or null for an outline, which has no pattern or cap of its own
|
|
1745
|
+
* @param i - the element
|
|
1746
|
+
* @param pattern - the pattern Cytoscape.js draws when none is given
|
|
1747
|
+
* @param width - the line's width
|
|
1748
|
+
* @returns the line style, or null when the pattern is not a list of numbers
|
|
1749
|
+
*/
|
|
1750
|
+
function dashedLook(words, i, pattern, width) {
|
|
1751
|
+
const dashes = (words?.get("_dashPattern")?.[i] ?? pattern)
|
|
1752
|
+
.split(/[\s,[\]]+/)
|
|
1753
|
+
.filter((t) => t !== "")
|
|
1754
|
+
.map((t) => Number.parseFloat(t));
|
|
1755
|
+
if (dashes.length === 0 || !dashes.every((d) => Number.isFinite(d))) {
|
|
1756
|
+
return null;
|
|
1757
|
+
}
|
|
1758
|
+
return cyjsDashLook(dashes, width, words?.get("_dashCap")?.[i] ?? "butt");
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* A property's values, created (all null) when it has none yet.
|
|
1762
|
+
* @param values - the values by property; changed in place
|
|
1763
|
+
* @param property - the property
|
|
1764
|
+
* @param n - the element count
|
|
1765
|
+
* @returns its values
|
|
1766
|
+
*/
|
|
1767
|
+
function columnOf(values, property, n) {
|
|
1768
|
+
let column = values[property];
|
|
1769
|
+
if (column === undefined) {
|
|
1770
|
+
column = new Array(n).fill(null);
|
|
1771
|
+
values[property] = column;
|
|
1563
1772
|
}
|
|
1773
|
+
return column;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* `visibility` with `display` into `visible`. Cytoscape.js leaves the edges of a node hidden with `visibility:
|
|
1777
|
+
* hidden` drawn (only `display: none` takes them away), so such a node is kept and drawn at opacity 0 (its border and
|
|
1778
|
+
* outline too), with no label.
|
|
1779
|
+
* @param kind - the target
|
|
1780
|
+
* @param n - the element count
|
|
1781
|
+
* @param words - the parts by internal name
|
|
1782
|
+
* @param values - the values; changed in place
|
|
1783
|
+
*/
|
|
1784
|
+
function combineVisibility(kind, n, words, values) {
|
|
1564
1785
|
const vis = words.get("_visibility");
|
|
1565
1786
|
const disp = words.get("_display");
|
|
1566
|
-
if (vis
|
|
1567
|
-
|
|
1787
|
+
if (vis === undefined && disp === undefined) {
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
const col = new Array(n).fill(null);
|
|
1791
|
+
for (let i = 0; i < n; i++) {
|
|
1792
|
+
const a = vis?.[i] ?? null;
|
|
1793
|
+
const b = disp?.[i] ?? null;
|
|
1794
|
+
if (a === null && b === null) {
|
|
1795
|
+
continue;
|
|
1796
|
+
}
|
|
1797
|
+
const keptInvisible = kind === "node" && a === "hidden" && b !== "none";
|
|
1798
|
+
col[i] = keptInvisible || (a !== "hidden" && b !== "none");
|
|
1799
|
+
if (keptInvisible) {
|
|
1800
|
+
// nothing of it is drawn: its body, its border, its outline or its label
|
|
1801
|
+
for (const p of ["opacity", "borderOpacity", "outerBorderOpacity", "labelOpacity"]) {
|
|
1802
|
+
columnOf(values, p, n)[i] = 0;
|
|
1803
|
+
}
|
|
1804
|
+
columnOf(values, "label", n)[i] = "";
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
values.visible = col;
|
|
1808
|
+
}
|
|
1809
|
+
/**
|
|
1810
|
+
* The label's words as Cytoscape.js draws them: `text-transform`, `text-justification`, and `text-rotation` (an
|
|
1811
|
+
* edge's end labels' `source-` / `target-text-rotation` too) as `labelRotation`, `sourceLabelRotation` and
|
|
1812
|
+
* `targetLabelRotation`.
|
|
1813
|
+
* @param kind - the target
|
|
1814
|
+
* @param n - the element count
|
|
1815
|
+
* @param words - the parts by internal name
|
|
1816
|
+
* @param values - the values; changed in place
|
|
1817
|
+
*/
|
|
1818
|
+
function combineLabelText(kind, n, words, values) {
|
|
1819
|
+
transformLabels(n, words.get("_transform"), values.label);
|
|
1820
|
+
// cytoscape.js 3.34.3 `labelJustification`: auto lines the lines up against the node, a label beside it on the
|
|
1821
|
+
// left to its right edge
|
|
1822
|
+
const justification = words.get("_justification");
|
|
1823
|
+
if (justification !== undefined && kind === "edge") {
|
|
1824
|
+
combineEdgeJustification(n, justification, words.get("_wrap"), values);
|
|
1825
|
+
}
|
|
1826
|
+
else if (justification !== undefined) {
|
|
1827
|
+
const halign = words.get("_halign");
|
|
1828
|
+
const AUTO = {
|
|
1829
|
+
left: "right",
|
|
1830
|
+
right: "left",
|
|
1831
|
+
"left-inside": "left",
|
|
1832
|
+
"right-inside": "right",
|
|
1833
|
+
};
|
|
1834
|
+
values.labelTextAlign = justification.map((j, i) => {
|
|
1835
|
+
if (j === null) {
|
|
1836
|
+
return null;
|
|
1837
|
+
}
|
|
1838
|
+
return j === "auto" ? (AUTO[halign?.[i] ?? "center"] ?? "center") : j;
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
// an edge's `autorotate` follows its line, which the routes work out (`autorotateLabels`)
|
|
1842
|
+
const rotations = [
|
|
1843
|
+
["_rotation", "labelRotation"],
|
|
1844
|
+
["_sourceRotation", "sourceLabelRotation"],
|
|
1845
|
+
["_targetRotation", "targetLabelRotation"],
|
|
1846
|
+
];
|
|
1847
|
+
for (const [part, property] of rotations) {
|
|
1848
|
+
const rotation = words.get(part);
|
|
1849
|
+
if (rotation !== undefined) {
|
|
1850
|
+
values[property] = rotation.map((r) => (r === null ? null : cyjsAngleDegrees(r)));
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
/**
|
|
1855
|
+
* A label's `text-transform`: `uppercase` and `lowercase` change its words; anything else leaves them.
|
|
1856
|
+
* @param n - the element count
|
|
1857
|
+
* @param transform - each element's transform
|
|
1858
|
+
* @param label - each element's label; changed in place
|
|
1859
|
+
*/
|
|
1860
|
+
function transformLabels(n, transform, label) {
|
|
1861
|
+
if (transform === undefined || label === undefined) {
|
|
1862
|
+
return;
|
|
1863
|
+
}
|
|
1864
|
+
for (let i = 0; i < n; i++) {
|
|
1865
|
+
const text = label[i];
|
|
1866
|
+
if (typeof text === "string" && transform[i] === "uppercase") {
|
|
1867
|
+
label[i] = text.toUpperCase();
|
|
1868
|
+
}
|
|
1869
|
+
else if (typeof text === "string" && transform[i] === "lowercase") {
|
|
1870
|
+
label[i] = text.toLowerCase();
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* An edge label's `text-justification` as Cytoscape.js draws it: every line centered (an edge's text is always
|
|
1876
|
+
* centered, cytoscape.js 3.34.3 `setupTextStyle`), the block moved half its width left for `left` and right for
|
|
1877
|
+
* `right`, and only for a wrapped label (`drawText`), as `labelShiftX`.
|
|
1878
|
+
* @param n - the element count
|
|
1879
|
+
* @param justification - each edge's justification
|
|
1880
|
+
* @param wrap - each edge's `text-wrap`
|
|
1881
|
+
* @param values - the values; changed in place
|
|
1882
|
+
*/
|
|
1883
|
+
function combineEdgeJustification(n, justification, wrap, values) {
|
|
1884
|
+
const SHIFT = { left: -0.5, right: 0.5 };
|
|
1885
|
+
for (let i = 0; i < n; i++) {
|
|
1886
|
+
const shift = wrap?.[i] === "wrap" ? SHIFT[justification[i] ?? ""] : undefined;
|
|
1887
|
+
if (shift !== undefined) {
|
|
1888
|
+
columnOf(values, "labelShiftX", n)[i] = shift;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* A label's outline and background box as Cytoscape.js draws them: the outline only with a `text-outline-width` and
|
|
1894
|
+
* a `text-outline-opacity` above 0, a stroke of twice that width centered on the letters' edges (cytoscape.js
|
|
1895
|
+
* 3.34.3 `drawText`: `lineWidth = 2 * text-outline-width`); the box only with a `text-background-opacity` above 0
|
|
1896
|
+
* (its default is 0), and the line round the box (`labelBorder`); the box and the line reach `text-background-padding`
|
|
1897
|
+
* past the words.
|
|
1898
|
+
* @param kind - the target
|
|
1899
|
+
* @param n - the element count
|
|
1900
|
+
* @param words - the parts by internal name
|
|
1901
|
+
* @param values - the values; changed in place
|
|
1902
|
+
* @param notes - where problems are noted
|
|
1903
|
+
* @param whole - each element's own opacity, which the box is drawn at too
|
|
1904
|
+
*/
|
|
1905
|
+
function combineLabelDress(kind, n, words, values, notes, whole) {
|
|
1906
|
+
const num = (part, i, fallback) => {
|
|
1907
|
+
const v = words.get(part)?.[i];
|
|
1908
|
+
return v === null || v === undefined ? fallback : Number(v);
|
|
1909
|
+
};
|
|
1910
|
+
const col = (p) => (values[p] ?? (values[p] = new Array(n).fill(null)));
|
|
1911
|
+
const outlined = words.has("_outlineWidth");
|
|
1912
|
+
const boxed = words.has("_backgroundOpacity");
|
|
1913
|
+
const bordered = words.has("_textBorderWidth") && words.has("_textBorderOpacity");
|
|
1914
|
+
// each part is drawn at its own opacity times the element's; the outline at the words' opacity too (drawText)
|
|
1915
|
+
const at = (v) => (typeof v === "number" ? v : 1);
|
|
1916
|
+
const faded = (v) => {
|
|
1917
|
+
const r = Math.round(v * 1e6) / 1e6;
|
|
1918
|
+
return r < 1 ? r : null;
|
|
1919
|
+
};
|
|
1920
|
+
for (let i = 0; i < n && (outlined || boxed || bordered); i++) {
|
|
1921
|
+
const width = num("_outlineWidth", i, 0);
|
|
1922
|
+
const outlineOpacity = num("_outlineOpacity", i, 1);
|
|
1923
|
+
if (outlined && width > 0 && outlineOpacity > 0) {
|
|
1924
|
+
col("labelOutlineColor")[i] = words.get("_outlineColor")?.[i] ?? "#000000";
|
|
1925
|
+
col("labelOutlineWidth")[i] = 2 * width;
|
|
1926
|
+
col("labelOutlineOpacity")[i] = faded(outlineOpacity * at(values.labelOpacity?.[i]));
|
|
1927
|
+
}
|
|
1928
|
+
const boxOpacity = num("_backgroundOpacity", i, 0);
|
|
1929
|
+
const box = boxed && boxOpacity > 0;
|
|
1930
|
+
if (box) {
|
|
1931
|
+
col("labelBackground")[i] = words.get("_backgroundColor")?.[i] ?? "#000000";
|
|
1932
|
+
col("labelBackgroundOpacity")[i] = faded(boxOpacity * at(whole[i]));
|
|
1933
|
+
}
|
|
1934
|
+
const border = bordered && labelBorder(kind, i, words, col, notes, at(whole[i]));
|
|
1935
|
+
if (box || border) {
|
|
1936
|
+
labelBoxShape(kind, i, words, col, notes);
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
/**
|
|
1941
|
+
* A label's box or line round it, sized and shaped: it reaches `text-background-padding` past the words on every
|
|
1942
|
+
* side (0 unset), one font size tall a line (cytoscape.js 3.34.3 `calculateLabelDimensions`), its corners rounded
|
|
1943
|
+
* 2px for round-rectangle (`drawText`); a circle is noted.
|
|
1944
|
+
* @param kind - the target
|
|
1945
|
+
* @param i - the element
|
|
1946
|
+
* @param words - the parts by internal name
|
|
1947
|
+
* @param col - a property's values, created when absent
|
|
1948
|
+
* @param notes - where problems are noted
|
|
1949
|
+
*/
|
|
1950
|
+
function labelBoxShape(kind, i, words, col, notes) {
|
|
1951
|
+
const padding = words.get("_backgroundPadding")?.[i];
|
|
1952
|
+
col("labelPadding")[i] = padding === null || padding === undefined ? 0 : Number(padding);
|
|
1953
|
+
col("labelLineHeight")[i] = 1;
|
|
1954
|
+
const shape = words.get("_backgroundShape")?.[i];
|
|
1955
|
+
if (shape === "round-rectangle" || shape === "roundrectangle") {
|
|
1956
|
+
col("labelCornerRadius")[i] = 2;
|
|
1957
|
+
}
|
|
1958
|
+
else if (shape === "circle") {
|
|
1959
|
+
// a disc as tall as the box, centered on it: no neutral box has that shape
|
|
1960
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBackground", { sample: "circle", element: i });
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
/**
|
|
1964
|
+
* The line Cytoscape.js draws round a label's box: only with a `text-border-width` and a `text-border-opacity` above
|
|
1965
|
+
* 0 (both default to 0), in `text-border-color` (black unset), at its opacity times the element's. A double one is
|
|
1966
|
+
* one line a quarter of the width, where `drawText` strokes two such lines half the width apart (cytoscape.js 3.34.3),
|
|
1967
|
+
* noted; dotted and dashed are drawn solid, noted.
|
|
1968
|
+
* @param kind - the target
|
|
1969
|
+
* @param i - the element
|
|
1970
|
+
* @param words - the parts by internal name
|
|
1971
|
+
* @param col - a property's values, created when absent
|
|
1972
|
+
* @param notes - where problems are noted
|
|
1973
|
+
* @param whole - the element's opacity
|
|
1974
|
+
* @returns whether a line is drawn
|
|
1975
|
+
*/
|
|
1976
|
+
function labelBorder(kind, i, words, col, notes, whole) {
|
|
1977
|
+
const num = (part) => Number(words.get(part)?.[i] ?? 0);
|
|
1978
|
+
const [width, opacity] = [num("_textBorderWidth"), num("_textBorderOpacity")];
|
|
1979
|
+
if (!(width > 0 && opacity > 0)) {
|
|
1980
|
+
return false;
|
|
1981
|
+
}
|
|
1982
|
+
const style = words.get("_textBorderStyle")?.[i] ?? "solid";
|
|
1983
|
+
col("labelBorderColor")[i] = words.get("_textBorderColor")?.[i] ?? "#000000";
|
|
1984
|
+
col("labelBorderWidth")[i] = style === "double" ? width / 4 : width;
|
|
1985
|
+
const drawn = Math.round(opacity * whole * 1e6) / 1e6;
|
|
1986
|
+
col("labelBorderOpacity")[i] = drawn < 1 ? drawn : null;
|
|
1987
|
+
if (style === "dotted" || style === "dashed" || style === "double") {
|
|
1988
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBorderColor", { sample: style, element: i });
|
|
1989
|
+
}
|
|
1990
|
+
return true;
|
|
1991
|
+
}
|
|
1992
|
+
/**
|
|
1993
|
+
* An autorotated label's turn: along the line between two centers, kept upright (cytoscape.js 3.34.3
|
|
1994
|
+
* `lineAngleFromDelta`: atan(dy / dx), a vertical line turned to +90 whichever way it runs), from 0 up to 360.
|
|
1995
|
+
* @param a - the source's center
|
|
1996
|
+
* @param b - the target's center
|
|
1997
|
+
* @returns the degrees
|
|
1998
|
+
*/
|
|
1999
|
+
function lineDegrees(a, b) {
|
|
2000
|
+
const dx = b[0] - a[0];
|
|
2001
|
+
const angle = Math.atan((b[1] - a[1]) / dx);
|
|
2002
|
+
const turn = ((dx === 0 ? Math.abs(angle) : angle) * 180) / Math.PI;
|
|
2003
|
+
return Number.isFinite(turn) ? Math.round((((turn % 360) + 360) % 360) * 1e6) / 1e6 + 0 : 0;
|
|
2004
|
+
}
|
|
2005
|
+
/**
|
|
2006
|
+
* A Cytoscape.js angle (`30deg`, `0.5rad`, a number of radians) in degrees; `none` and `autorotate` (which turns
|
|
2007
|
+
* only an edge's label) are 0.
|
|
2008
|
+
* @param text - the value
|
|
2009
|
+
* @returns the degrees, or null when it is not an angle
|
|
2010
|
+
*/
|
|
2011
|
+
function cyjsAngleDegrees(text) {
|
|
2012
|
+
const t = text.trim();
|
|
2013
|
+
if (t === "none" || t === "autorotate") {
|
|
2014
|
+
return 0;
|
|
2015
|
+
}
|
|
2016
|
+
const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(deg|rad)?$/i.exec(t);
|
|
2017
|
+
if (m === null) {
|
|
2018
|
+
return null;
|
|
2019
|
+
}
|
|
2020
|
+
const x = Number(m[1]);
|
|
2021
|
+
const deg = m[2]?.toLowerCase() === "deg" ? x : (x * 180) / Math.PI;
|
|
2022
|
+
// the neutral rotation runs from 0 up to 360
|
|
2023
|
+
return Math.round((((deg % 360) + 360) % 360) * 1e6) / 1e6 + 0;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* An edge's `line-opacity` times its `opacity`, which the line is drawn at (cytoscape.js 3.34.3 `drawEdge`:
|
|
2027
|
+
* `effectiveLineOpacity`).
|
|
2028
|
+
* @param n - the element count
|
|
2029
|
+
* @param line - the line opacities, as text
|
|
2030
|
+
* @param values - the values; changed in place
|
|
2031
|
+
*/
|
|
2032
|
+
function combineLineOpacity(n, line, values) {
|
|
2033
|
+
if (line === undefined) {
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
const whole = values.opacity;
|
|
2037
|
+
values.opacity = Array.from({ length: n }, (_, i) => {
|
|
2038
|
+
const a = line[i] === null ? null : Number(line[i]);
|
|
2039
|
+
const b = whole?.[i];
|
|
2040
|
+
if (a === null || !Number.isFinite(a)) {
|
|
2041
|
+
return b ?? null;
|
|
2042
|
+
}
|
|
2043
|
+
return Math.round(a * (typeof b === "number" ? b : 1) * 1e6) / 1e6;
|
|
2044
|
+
});
|
|
2045
|
+
}
|
|
2046
|
+
/** Where each `background-gradient-direction` runs, in the neutral `fillGradientAngle` degrees. */
|
|
2047
|
+
const GRADIENT_ANGLES = new Map([
|
|
2048
|
+
["to-bottom", 90],
|
|
2049
|
+
["to-top", 270],
|
|
2050
|
+
["to-left", 180],
|
|
2051
|
+
["to-right", 0],
|
|
2052
|
+
["to-bottom-right", 45],
|
|
2053
|
+
["to-right-bottom", 45],
|
|
2054
|
+
["to-bottom-left", 135],
|
|
2055
|
+
["to-left-bottom", 135],
|
|
2056
|
+
["to-top-right", 315],
|
|
2057
|
+
["to-right-top", 315],
|
|
2058
|
+
["to-top-left", 225],
|
|
2059
|
+
["to-left-top", 225],
|
|
2060
|
+
]);
|
|
2061
|
+
/**
|
|
2062
|
+
* A node's `background-fill: linear-gradient` or `radial-gradient` as `fill` (its first stop), `fillGradient` (its
|
|
2063
|
+
* last), `fillGradientAngle` (a linear one's direction), `fillGradientKind`, `fillGradientColors` (every stop, when
|
|
2064
|
+
* there are more than two) and `fillGradientStops` (`background-gradient-stop-positions`, when there is one per
|
|
2065
|
+
* color, as Cytoscape.js uses them).
|
|
2066
|
+
* @param n - the element count
|
|
2067
|
+
* @param words - the parts by internal name
|
|
2068
|
+
* @param values - the values; changed in place
|
|
2069
|
+
* @param notes - where problems are noted
|
|
2070
|
+
*/
|
|
2071
|
+
function combineBackgroundGradient(n, words, values, notes) {
|
|
2072
|
+
const fill = words.get("_backgroundFill");
|
|
2073
|
+
if (fill === undefined) {
|
|
2074
|
+
return;
|
|
2075
|
+
}
|
|
2076
|
+
const stops = words.get("_backgroundStops");
|
|
2077
|
+
const positions = words.get("_backgroundPositions");
|
|
2078
|
+
const direction = words.get("_backgroundDirection");
|
|
2079
|
+
const col = (name) => (values[name] ?? (values[name] = new Array(n).fill(null)));
|
|
2080
|
+
for (let i = 0; i < n; i++) {
|
|
2081
|
+
const radial = fill[i] === "radial-gradient";
|
|
2082
|
+
if (fill[i] !== "linear-gradient" && !radial) {
|
|
2083
|
+
continue;
|
|
2084
|
+
}
|
|
2085
|
+
// Cytoscape.js's default stop colors are one gray, which draws flat
|
|
2086
|
+
const colors = gradientStopColors(stops?.[i] ?? "#999", {
|
|
2087
|
+
notes,
|
|
2088
|
+
target: "node",
|
|
2089
|
+
property: "fill",
|
|
2090
|
+
element: i,
|
|
2091
|
+
});
|
|
2092
|
+
if (colors.length < 2) {
|
|
2093
|
+
continue;
|
|
2094
|
+
}
|
|
2095
|
+
col("fill")[i] = colors[0];
|
|
2096
|
+
col("fillGradient")[i] = colors.at(-1) ?? null;
|
|
2097
|
+
if (colors.length > 2) {
|
|
2098
|
+
col("fillGradientColors")[i] = colors.join(" ");
|
|
2099
|
+
}
|
|
2100
|
+
const placed = gradientStops(positions?.[i] ?? "");
|
|
2101
|
+
if (placed?.split(" ").length === colors.length) {
|
|
2102
|
+
col("fillGradientStops")[i] = placed;
|
|
2103
|
+
}
|
|
2104
|
+
if (radial) {
|
|
2105
|
+
col("fillGradientKind")[i] = "radial";
|
|
2106
|
+
}
|
|
2107
|
+
else {
|
|
2108
|
+
col("fillGradientAngle")[i] = GRADIENT_ANGLES.get(direction?.[i] ?? "to-bottom") ?? 90;
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
/** An edge's routing settings, each read as Cytoscape.js spells it. */
|
|
2113
|
+
const ROUTE_PARTS = [
|
|
2114
|
+
["segmentDistances", "segment-distances", { property: "_segmentDistances", type: "text" }],
|
|
2115
|
+
["segmentWeights", "segment-weights", { property: "_segmentWeights", type: "text" }],
|
|
2116
|
+
["controlPointDistances", "control-point-distances", { property: "_controlPointDistances", type: "text" }],
|
|
2117
|
+
["controlPointWeights", "control-point-weights", { property: "_controlPointWeights", type: "text" }],
|
|
2118
|
+
["controlPointStepSize", "control-point-step-size", { property: "_controlPointStepSize", type: "size" }],
|
|
2119
|
+
["taxiDirection", "taxi-direction", { property: "_taxiDirection", type: "text" }],
|
|
2120
|
+
["taxiTurn", "taxi-turn", { property: "_taxiTurn", type: "text" }],
|
|
2121
|
+
["taxiTurnMinDistance", "taxi-turn-min-distance", { property: "_taxiTurnMinDistance", type: "size" }],
|
|
2122
|
+
["edgeDistances", "edge-distances", { property: "_edgeDistances", type: "text" }],
|
|
2123
|
+
["loopDirection", "loop-direction", { property: "_loopDirection", type: "text" }],
|
|
2124
|
+
["loopSweep", "loop-sweep", { property: "_loopSweep", type: "text" }],
|
|
2125
|
+
["segmentRadii", "segment-radii", { property: "_segmentRadii", type: "text" }],
|
|
2126
|
+
["taxiRadius", "taxi-radius", { property: "_taxiRadius", type: "text" }],
|
|
2127
|
+
["radiusType", "radius-type", { property: "_radiusType", type: "text" }],
|
|
2128
|
+
];
|
|
2129
|
+
/**
|
|
2130
|
+
* The routes of the edges Cytoscape.js does not draw straight (`segments`, `taxi`, an `unbundled-bezier` with
|
|
2131
|
+
* control points, a loop) as `bends`, drawn straight through them (`curved` false).
|
|
2132
|
+
* @param graph - the core's elements
|
|
2133
|
+
* @param read - the edges' cells
|
|
2134
|
+
* @param curves - each edge's curve style, in output order
|
|
2135
|
+
* @param nodes - the nodes' values
|
|
2136
|
+
* @param values - the edges' values; changed in place
|
|
2137
|
+
*/
|
|
2138
|
+
function edgeRoutes(graph, read, curves, nodes, values) {
|
|
2139
|
+
const words = new Map(ROUTE_PARTS.map(([key, name, spec]) => [key, drawnColumn(read, name, spec)]));
|
|
2140
|
+
const nodeAt = new Map();
|
|
2141
|
+
nodes.elements.forEach((el, k) => {
|
|
2142
|
+
if (el !== null) {
|
|
2143
|
+
nodeAt.set(el, k);
|
|
2144
|
+
}
|
|
2145
|
+
});
|
|
2146
|
+
const geometry = (core) => routeNode(graph.nodes[core], nodeAt, nodes);
|
|
2147
|
+
// an end label's autorotate turns it as the main label's does (cytoscape.js 3.34.3 `calculateLabelAngle`)
|
|
2148
|
+
const turned = [
|
|
2149
|
+
["labelRotation", drawnColumn(read, "text-rotation", TEXT_PART)],
|
|
2150
|
+
["sourceLabelRotation", drawnColumn(read, "source-text-rotation", TEXT_PART)],
|
|
2151
|
+
["targetLabelRotation", drawnColumn(read, "target-text-rotation", TEXT_PART)],
|
|
2152
|
+
];
|
|
2153
|
+
const ends = [drawnColumn(read, "source-endpoint", TEXT_PART), drawnColumn(read, "target-endpoint", TEXT_PART)];
|
|
2154
|
+
const loops = new Map();
|
|
2155
|
+
const n = read.order.length;
|
|
2156
|
+
let routed = null;
|
|
2157
|
+
for (let k = 0; k < n; k++) {
|
|
2158
|
+
const e = read.order[k];
|
|
2159
|
+
const between = edgeNodes(graph, e, geometry);
|
|
2160
|
+
if (between === null) {
|
|
2161
|
+
continue;
|
|
2162
|
+
}
|
|
2163
|
+
const { src, tgt, loop } = between;
|
|
2164
|
+
if (!loop) {
|
|
2165
|
+
autorotateLabels(values, turned, k, n, lineDegrees(src.center, tgt.center));
|
|
2166
|
+
}
|
|
2167
|
+
const edge = routeSettings(words, k, curves[k]);
|
|
2168
|
+
const bends = cyjsRoute(edge, src, tgt, loop ? nextLoopIndex(loops, graph.source[e], edge) : 0);
|
|
2169
|
+
if (bends !== null) {
|
|
2170
|
+
routed ?? (routed = values.bends ?? new Array(n).fill(null));
|
|
2171
|
+
routed[k] = bends;
|
|
2172
|
+
columnOf(values, "curved", n)[k] = false;
|
|
2173
|
+
}
|
|
2174
|
+
if (!loop) {
|
|
2175
|
+
edgePorts(edge.curveStyle, [ends[0][k], ends[1][k]], [src, tgt], (p, port) => {
|
|
2176
|
+
columnOf(values, p, n)[k] = port;
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
if (routed !== null) {
|
|
2181
|
+
values.bends = routed;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* A node's geometry as the routes measure it: its center, its outer size (its border taken in), its box and whether
|
|
2186
|
+
* it is an ellipse.
|
|
2187
|
+
* @param el - the node
|
|
2188
|
+
* @param nodeAt - each node's output index
|
|
2189
|
+
* @param nodes - the nodes' values
|
|
2190
|
+
* @returns the geometry, or null when the node has no position
|
|
2191
|
+
*/
|
|
2192
|
+
function routeNode(el, nodeAt, nodes) {
|
|
2193
|
+
const k = nodeAt.get(el);
|
|
2194
|
+
const pos = el.json.position;
|
|
2195
|
+
if (k === undefined || !isObject(pos) || typeof pos.x !== "number" || typeof pos.y !== "number") {
|
|
2196
|
+
return null;
|
|
2197
|
+
}
|
|
2198
|
+
const num = (p, fallback) => {
|
|
2199
|
+
const v = nodes.values[p]?.[k];
|
|
2200
|
+
return typeof v === "number" ? v : fallback;
|
|
2201
|
+
};
|
|
2202
|
+
const [w, h, bw] = [num("width", 30), num("height", 30), num("borderWidth", 0)];
|
|
2203
|
+
return {
|
|
2204
|
+
center: [pos.x, pos.y],
|
|
2205
|
+
size: [w + bw, h + bw],
|
|
2206
|
+
box: [w, h],
|
|
2207
|
+
ellipse: (nodes.values.shape?.[k] ?? "ellipse") === "ellipse",
|
|
2208
|
+
};
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* An edge's two nodes' geometry, and whether it is a loop.
|
|
2212
|
+
* @param graph - the core's elements
|
|
2213
|
+
* @param e - the edge's core index, below 0 for none
|
|
2214
|
+
* @param geometry - a node's geometry
|
|
2215
|
+
* @returns the source's and the target's geometry, or null when either is not known
|
|
2216
|
+
*/
|
|
2217
|
+
function edgeNodes(graph, e, geometry) {
|
|
2218
|
+
if (e < 0) {
|
|
2219
|
+
return null;
|
|
2220
|
+
}
|
|
2221
|
+
const loop = graph.source[e] === graph.target[e];
|
|
2222
|
+
const src = geometry(graph.source[e]);
|
|
2223
|
+
const tgt = loop ? src : geometry(graph.target[e]);
|
|
2224
|
+
return src === null || tgt === null ? null : { src, tgt, loop };
|
|
2225
|
+
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Turns each of an edge's labels set to `autorotate` along its line.
|
|
2228
|
+
* @param values - the edges' values; changed in place
|
|
2229
|
+
* @param turned - each label's rotation property and its `text-rotation` words
|
|
2230
|
+
* @param k - the edge's output index
|
|
2231
|
+
* @param n - the edge count
|
|
2232
|
+
* @param degrees - the line's turn
|
|
2233
|
+
*/
|
|
2234
|
+
function autorotateLabels(values, turned, k, n, degrees) {
|
|
2235
|
+
for (const [property, column] of turned) {
|
|
2236
|
+
if (column[k] === "autorotate") {
|
|
2237
|
+
columnOf(values, property, n)[k] = degrees;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* A loop's place among the loops drawn before it on the same node in the same direction and sweep, which fans them.
|
|
2243
|
+
* @param loops - how many loops each node, direction and sweep has so far; changed in place
|
|
2244
|
+
* @param source - the loop's node
|
|
2245
|
+
* @param edge - the loop's settings
|
|
2246
|
+
* @returns its place, from 0
|
|
2247
|
+
*/
|
|
2248
|
+
function nextLoopIndex(loops, source, edge) {
|
|
2249
|
+
const key = `${String(source)} ${String(edge.loopDirection)} ${String(edge.loopSweep)}`;
|
|
2250
|
+
const index = loops.get(key) ?? 0;
|
|
2251
|
+
loops.set(key, index + 1);
|
|
2252
|
+
return index;
|
|
2253
|
+
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Where an edge's ends meet its nodes, when not where the line from the centers crosses the outlines (cytoscape.js
|
|
2256
|
+
* 3.34.3 `findEndpoints`, `manualEndptToPx`): `inside-to-node` at the center, `x y` offsets from the center (pixels,
|
|
2257
|
+
* or percentages of the node's outer size), an angle clockwise from 12 o'clock on the outline. A `haystack` edge
|
|
2258
|
+
* runs between points `haystack-radius` of the way from the centers to the outlines in a random direction
|
|
2259
|
+
* (`findHaystackPoints`), drawn from the centers, where a radius of 0 (the default) puts them; a taxi edge ignores its
|
|
2260
|
+
* endpoints.
|
|
2261
|
+
* ponytail: an angle meets a polygon's outline where it meets its box; per-shape outlines if a file angles one
|
|
2262
|
+
* @param curve - the curve style
|
|
2263
|
+
* @param words - the source endpoint and the target endpoint, as Cytoscape.js spells them
|
|
2264
|
+
* @param nodes - the source's and the target's geometry
|
|
2265
|
+
* @param put - sets `sourcePort` or `targetPort`
|
|
2266
|
+
*/
|
|
2267
|
+
function edgePorts(curve, words, nodes, put) {
|
|
2268
|
+
if (curve === "taxi" || curve === "round-taxi") {
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
["sourcePort", "targetPort"].forEach((p, a) => {
|
|
2272
|
+
const port = curve === "haystack" ? "0,0" : endpointPort(String(words[a] ?? ""), nodes[a]);
|
|
2273
|
+
if (port !== null) {
|
|
2274
|
+
put(p, port);
|
|
2275
|
+
}
|
|
2276
|
+
});
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* One `source-endpoint` / `target-endpoint` as a neutral port.
|
|
2280
|
+
* @param text - the value
|
|
2281
|
+
* @param node - the node's geometry
|
|
2282
|
+
* @returns the port, or null where the line meets the outline as it does by default
|
|
2283
|
+
*/
|
|
2284
|
+
function endpointPort(text, node) {
|
|
2285
|
+
const t = text.trim();
|
|
2286
|
+
if (t === "inside-to-node") {
|
|
2287
|
+
return "0,0";
|
|
2288
|
+
}
|
|
2289
|
+
const parts = t.split(/\s+/);
|
|
2290
|
+
const [w, h] = node.size;
|
|
2291
|
+
const r6 = (v) => String(Math.round(v * 1e6) / 1e6 + 0);
|
|
2292
|
+
const fraction = (part, size) => {
|
|
2293
|
+
const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(%|px)?$/.exec(part);
|
|
2294
|
+
if (m === null || Number.isNaN(size) || size <= 0) {
|
|
2295
|
+
return null;
|
|
2296
|
+
}
|
|
2297
|
+
const px = m[2] === "%" ? (Number(m[1]) / 100) * size : Number(m[1]);
|
|
2298
|
+
return px / (size / 2);
|
|
2299
|
+
};
|
|
2300
|
+
if (parts.length === 2) {
|
|
2301
|
+
const [x, y] = [fraction(parts[0], w), fraction(parts[1], h)];
|
|
2302
|
+
return x === null || y === null ? null : `${r6(x)},${r6(-y)}`;
|
|
2303
|
+
}
|
|
2304
|
+
const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(deg|rad)$/.exec(t);
|
|
2305
|
+
if (m === null) {
|
|
2306
|
+
return null;
|
|
2307
|
+
}
|
|
2308
|
+
const turn = m[2] === "deg" ? (Number(m[1]) * Math.PI) / 180 : Number(m[1]);
|
|
2309
|
+
// the direction in half sizes, y up, from 12 o'clock clockwise; scaled until it meets the outline
|
|
2310
|
+
const [dx, dy] = [Math.sin(turn) / (w / 2), Math.cos(turn) / (h / 2)];
|
|
2311
|
+
const reach = node.ellipse ? Math.hypot(dx, dy) : Math.max(Math.abs(dx), Math.abs(dy));
|
|
2312
|
+
return reach > 0 ? `${r6(dx / reach)},${r6(dy / reach)}` : null;
|
|
2313
|
+
}
|
|
2314
|
+
/**
|
|
2315
|
+
* One edge's routing settings.
|
|
2316
|
+
* @param words - each setting's values, in output order
|
|
2317
|
+
* @param k - the edge's output index
|
|
2318
|
+
* @param curve - its curve style
|
|
2319
|
+
* @returns the settings
|
|
2320
|
+
*/
|
|
2321
|
+
function routeSettings(words, k, curve) {
|
|
2322
|
+
const text = (key) => {
|
|
2323
|
+
const v = words.get(key)?.[k];
|
|
2324
|
+
return v === null || v === undefined ? null : String(v);
|
|
2325
|
+
};
|
|
2326
|
+
const num = (key) => {
|
|
2327
|
+
const v = text(key);
|
|
2328
|
+
return v === null ? null : Number(v);
|
|
2329
|
+
};
|
|
2330
|
+
return {
|
|
2331
|
+
curveStyle: String(curve ?? "haystack"),
|
|
2332
|
+
segmentDistances: text("segmentDistances"),
|
|
2333
|
+
segmentWeights: text("segmentWeights"),
|
|
2334
|
+
controlPointDistances: text("controlPointDistances"),
|
|
2335
|
+
controlPointWeights: text("controlPointWeights"),
|
|
2336
|
+
controlPointStepSize: num("controlPointStepSize"),
|
|
2337
|
+
taxiDirection: text("taxiDirection"),
|
|
2338
|
+
taxiTurn: text("taxiTurn"),
|
|
2339
|
+
taxiTurnMinDistance: num("taxiTurnMinDistance"),
|
|
2340
|
+
edgeDistances: text("edgeDistances"),
|
|
2341
|
+
loopDirection: text("loopDirection"),
|
|
2342
|
+
loopSweep: text("loopSweep"),
|
|
2343
|
+
segmentRadii: text("segmentRadii"),
|
|
2344
|
+
taxiRadius: text("taxiRadius"),
|
|
2345
|
+
radiusType: text("radiusType"),
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
/** A padding read as Cytoscape.js spells it. */
|
|
2349
|
+
const TEXT_PART = { property: "_text", type: "text" };
|
|
2350
|
+
/**
|
|
2351
|
+
* A node's size as Cytoscape.js draws it: a node that is no compound parent is drawn `padding` larger on every side
|
|
2352
|
+
* (cytoscape.js 3.34.3 draws its shape `width() + 2 * padding()` across).
|
|
2353
|
+
* @param graph - the core's elements
|
|
2354
|
+
* @param read - the nodes' cells
|
|
2355
|
+
* @param values - the nodes' values; changed in place
|
|
2356
|
+
*/
|
|
2357
|
+
function nodeSizes(graph, read, values) {
|
|
2358
|
+
const padding = drawnColumn(read, "padding", TEXT_PART);
|
|
2359
|
+
const toLabel = ["width", "height"].map((p) => drawnColumn(read, p, SIZE_PART));
|
|
2360
|
+
const n = read.order.length;
|
|
2361
|
+
const col = (p) => (values[p] ?? (values[p] = new Array(n).fill(null)));
|
|
2362
|
+
for (let k = 0; k < n; k++) {
|
|
2363
|
+
const core = read.order[k];
|
|
2364
|
+
const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
|
|
2365
|
+
const fitted = toLabel.map((c) => c[k] === "label");
|
|
2366
|
+
if (fitted[0] || fitted[1]) {
|
|
2367
|
+
// `width: label` sizes the node to its label's box (cytoscape.js 3.34.3 `width()` reads the label's
|
|
2368
|
+
// width), padding on each side: the label's side is a minimum of 0, the other keeps its own size
|
|
2369
|
+
col("labelFit")[k] = "bounds";
|
|
2370
|
+
col("labelPaddingX")[k] = pad;
|
|
2371
|
+
col("labelPaddingY")[k] = pad;
|
|
2372
|
+
["width", "height"].forEach((p, a) => {
|
|
2373
|
+
const v = values[p]?.[k];
|
|
2374
|
+
const side = typeof v === "number" ? v : 30;
|
|
2375
|
+
col(p)[k] = fitted[a] ? 0 : side + 2 * pad;
|
|
2376
|
+
});
|
|
2377
|
+
continue;
|
|
2378
|
+
}
|
|
2379
|
+
if (pad <= 0) {
|
|
2380
|
+
continue;
|
|
2381
|
+
}
|
|
2382
|
+
for (const p of ["width", "height"]) {
|
|
2383
|
+
const v = values[p]?.[k];
|
|
2384
|
+
col(p)[k] = (typeof v === "number" ? v : 30) + 2 * pad;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
/** The label alignments read as Cytoscape.js's words. */
|
|
2389
|
+
const VALIGN_PART = {
|
|
2390
|
+
property: "_valign",
|
|
2391
|
+
type: "enum",
|
|
2392
|
+
enums: ["top", "top-inside", "center", "bottom", "bottom-inside"],
|
|
2393
|
+
};
|
|
2394
|
+
const HALIGN_PART = {
|
|
2395
|
+
property: "_halign",
|
|
2396
|
+
type: "enum",
|
|
2397
|
+
enums: ["left", "left-inside", "center", "right", "right-inside"],
|
|
2398
|
+
};
|
|
2399
|
+
/**
|
|
2400
|
+
* Where Cytoscape.js pins a label on one axis (cytoscape.js 3.34.3 `recalculateNodeLabelProjection` and
|
|
2401
|
+
* `labelHalign` / `labelValign`): outside, `padding` past the node's side with the label's far edge there; inside,
|
|
2402
|
+
* `padding` short of it with the label's near edge there; centered, at the node's middle.
|
|
2403
|
+
* @param align - the alignment (`left`, `left-inside`, `top`, ...)
|
|
2404
|
+
* @param half - half the node's drawn size on that axis, `padding` included
|
|
2405
|
+
* @param pad - the node's padding
|
|
2406
|
+
* @returns the offset from the node's center and the shift by the label's own size
|
|
2407
|
+
*/
|
|
2408
|
+
function pinnedAxis(align, half, pad) {
|
|
2409
|
+
const near = /^(left|top)/.test(align);
|
|
2410
|
+
if (!near && !/^(right|bottom)/.test(align)) {
|
|
2411
|
+
return { offset: 0, shift: 0 };
|
|
2412
|
+
}
|
|
2413
|
+
const side = near ? -1 : 1;
|
|
2414
|
+
return align.endsWith("-inside")
|
|
2415
|
+
? { offset: side * (half - 2 * pad), shift: -side / 2 }
|
|
2416
|
+
: { offset: side * half, shift: side / 2 };
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* A node label with one alignment inside the node and the other outside it (`text-valign: bottom-inside` with
|
|
2420
|
+
* `text-halign: left`): no neutral position says that, so the label is centered, moved to the point Cytoscape.js
|
|
2421
|
+
* puts it at by `labelOffsetX` / `labelOffsetY` (its `text-margin` added) and pinned there by `labelShiftX` /
|
|
2422
|
+
* `labelShiftY`. A node sized to its label keeps the outside side's position, noted.
|
|
2423
|
+
* @param graph - the core's elements
|
|
2424
|
+
* @param read - the nodes' cells
|
|
2425
|
+
* @param values - the nodes' values, sizes already drawn (`nodeSizes`); changed in place
|
|
2426
|
+
*/
|
|
2427
|
+
function mixedLabelPlaces(graph, read, values) {
|
|
2428
|
+
const va = drawnColumn(read, "text-valign", VALIGN_PART);
|
|
2429
|
+
const ha = drawnColumn(read, "text-halign", HALIGN_PART);
|
|
2430
|
+
const padding = drawnColumn(read, "padding", TEXT_PART);
|
|
2431
|
+
const n = read.order.length;
|
|
2432
|
+
const col = (p) => (values[p] ?? (values[p] = new Array(n).fill(null)));
|
|
2433
|
+
for (let k = 0; k < n; k++) {
|
|
2434
|
+
const v = typeof va[k] === "string" ? String(va[k]) : "top";
|
|
2435
|
+
const h = typeof ha[k] === "string" ? String(ha[k]) : "center";
|
|
2436
|
+
const inside = v.endsWith("-inside") || h.endsWith("-inside");
|
|
2437
|
+
const outside = v === "top" || v === "bottom" || h === "left" || h === "right";
|
|
2438
|
+
if (!inside || !outside) {
|
|
2439
|
+
continue;
|
|
2440
|
+
}
|
|
2441
|
+
if (values.labelFit?.[k] !== undefined && values.labelFit[k] !== null) {
|
|
2442
|
+
read.notes.add(STYLE_ISSUE.APPROXIMATED, "node", "labelPosition", { sample: `${v} ${h}`, element: k });
|
|
2443
|
+
continue;
|
|
2444
|
+
}
|
|
2445
|
+
const core = read.order[k];
|
|
2446
|
+
const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
|
|
2447
|
+
const size = (p) => {
|
|
2448
|
+
const s = values[p]?.[k];
|
|
2449
|
+
return typeof s === "number" ? s : 30 + 2 * pad;
|
|
2450
|
+
};
|
|
2451
|
+
const x = pinnedAxis(h, size("width") / 2, pad);
|
|
2452
|
+
const y = pinnedAxis(v, size("height") / 2, pad);
|
|
2453
|
+
const add = (p, d) => {
|
|
2454
|
+
const was = values[p]?.[k];
|
|
2455
|
+
col(p)[k] = (typeof was === "number" ? was : 0) + d;
|
|
2456
|
+
};
|
|
2457
|
+
col("labelPosition")[k] = "center";
|
|
2458
|
+
add("labelOffsetX", x.offset);
|
|
2459
|
+
add("labelOffsetY", y.offset);
|
|
2460
|
+
col("labelShiftX")[k] = x.shift;
|
|
2461
|
+
col("labelShiftY")[k] = y.shift;
|
|
2462
|
+
}
|
|
2463
|
+
}
|
|
2464
|
+
/** A node size read as Cytoscape.js's word, so `label` is seen. */
|
|
2465
|
+
const SIZE_PART = { property: "_size", type: "nodeSize" };
|
|
2466
|
+
/**
|
|
2467
|
+
* A node's padding in pixels. A percentage is relative only on a compound parent; on any other node Cytoscape.js
|
|
2468
|
+
* draws its fraction as pixels (`padding()` returns the property's `pfValue`, 0.2 for `20%`).
|
|
2469
|
+
* @param text - the padding as Cytoscape.js spells it, or null
|
|
2470
|
+
* @returns the pixels, 0 for none
|
|
2471
|
+
*/
|
|
2472
|
+
function paddingOf(text) {
|
|
2473
|
+
if (typeof text !== "string") {
|
|
2474
|
+
return 0;
|
|
2475
|
+
}
|
|
2476
|
+
const x = Number.parseFloat(text);
|
|
2477
|
+
if (!Number.isFinite(x) || x <= 0) {
|
|
2478
|
+
return 0;
|
|
2479
|
+
}
|
|
2480
|
+
return text.trim().endsWith("%") ? x / 100 : x;
|
|
2481
|
+
}
|
|
2482
|
+
/** The curve style read as Cytoscape.js's word. */
|
|
2483
|
+
const CURVE_PART = { property: "_curve", type: "enum", enums: CYJS_CURVE_STYLES };
|
|
2484
|
+
/**
|
|
2485
|
+
* Cytoscape.js draws no source or target arrow on a `haystack` edge, its default curve style (cytoscape.js 3.34.3
|
|
2486
|
+
* `drawArrowheads` skips them on haystacks, but still draws the mid arrows): each end arrow of one is `none`.
|
|
2487
|
+
* @param curves - each edge's curve style, null where no rule sets it
|
|
2488
|
+
* @param values - the values; changed in place
|
|
2489
|
+
*/
|
|
2490
|
+
function noArrowsOnHaystacks(curves, values) {
|
|
2491
|
+
const n = curves.length;
|
|
2492
|
+
for (const p of ["targetArrow", "sourceArrow"]) {
|
|
2493
|
+
const col = values[p];
|
|
2494
|
+
if (col === undefined) {
|
|
2495
|
+
continue;
|
|
2496
|
+
}
|
|
2497
|
+
for (let i = 0; i < n; i++) {
|
|
2498
|
+
if ((curves[i] ?? "haystack") === "haystack" && col[i] !== null) {
|
|
2499
|
+
col[i] = "none";
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
/**
|
|
2505
|
+
* The outline arrow a hollow `*-arrow-fill` draws for each filled shape that has one (cytoscape.js 3.34.3 strokes the
|
|
2506
|
+
* arrow's path instead of filling it). A hollow square has no outline cap of its own in the neutral vocabulary;
|
|
2507
|
+
* `other:open-square` is drawn as the nearest one.
|
|
2508
|
+
*/
|
|
2509
|
+
const HOLLOW_ARROWS = new Map([
|
|
2510
|
+
["triangle", "triangle-open"],
|
|
2511
|
+
["diamond", "diamond-open"],
|
|
2512
|
+
["circle", "circle-open"],
|
|
2513
|
+
["square", "other:open-square"],
|
|
2514
|
+
]);
|
|
2515
|
+
/**
|
|
2516
|
+
* A rule that sets an arrow shape and makes it hollow sets the outline shape (`combineArrowFills` does the same per
|
|
2517
|
+
* element, for a fill and a shape set by different rules).
|
|
2518
|
+
* @param set - the rule's values; changed in place
|
|
2519
|
+
* @param all - every property of the rule
|
|
2520
|
+
*/
|
|
2521
|
+
function hollowArrowsOfRule(set, all) {
|
|
2522
|
+
for (const p of all) {
|
|
2523
|
+
const shapeProp = /^_(\w+Arrow)Fill$/.exec(p.spec.property)?.[1];
|
|
2524
|
+
const shape = shapeProp === undefined ? undefined : set[shapeProp];
|
|
2525
|
+
if (shapeProp === undefined || shape === undefined || p.parsed.kind !== "word") {
|
|
2526
|
+
continue;
|
|
2527
|
+
}
|
|
2528
|
+
const open = HOLLOW_ARROWS.get(shape);
|
|
2529
|
+
if (open !== undefined && p.parsed.value === "hollow") {
|
|
2530
|
+
set[shapeProp] = open;
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Turns each arrow whose `*-arrow-fill` is `hollow` into its outline shape. A hollow arrow the vocabulary has no
|
|
2536
|
+
* outline shape for keeps its filled shape and is noted.
|
|
2537
|
+
* @param n - the element count
|
|
2538
|
+
* @param words - the parts by internal name
|
|
2539
|
+
* @param values - the values; changed in place
|
|
2540
|
+
* @param notes - where a hollow arrow drawn filled is noted
|
|
2541
|
+
*/
|
|
2542
|
+
function combineArrowFills(n, words, values, notes) {
|
|
2543
|
+
for (const p of ["targetArrow", "sourceArrow", "midTargetArrow", "midSourceArrow"]) {
|
|
2544
|
+
const fill = words.get(`_${p}Fill`);
|
|
2545
|
+
const shapes = values[p];
|
|
2546
|
+
if (fill === undefined || shapes === undefined) {
|
|
2547
|
+
continue;
|
|
2548
|
+
}
|
|
1568
2549
|
for (let i = 0; i < n; i++) {
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
if (a === null && b === null) {
|
|
2550
|
+
const shape = shapes[i];
|
|
2551
|
+
if (fill[i] !== "hollow" || shape === null || shape === "none") {
|
|
1572
2552
|
continue;
|
|
1573
2553
|
}
|
|
1574
|
-
|
|
2554
|
+
const open = HOLLOW_ARROWS.get(shape);
|
|
2555
|
+
if (open !== undefined) {
|
|
2556
|
+
shapes[i] = open;
|
|
2557
|
+
}
|
|
2558
|
+
else if (!String(shape).includes("open")) {
|
|
2559
|
+
const property = p.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace("-arrow", "-arrow-fill");
|
|
2560
|
+
notes.add(STYLE_ISSUE.NOT_CARRIED, "edge", property, { sample: `hollow ${String(shape)}`, element: i });
|
|
2561
|
+
}
|
|
1575
2562
|
}
|
|
1576
|
-
values.visible = col;
|
|
1577
2563
|
}
|
|
1578
2564
|
}
|
|
1579
2565
|
/**
|
|
1580
|
-
* A node label's position from its vertical and horizontal alignments
|
|
1581
|
-
*
|
|
2566
|
+
* A node label's position from its vertical and horizontal alignments. Cytoscape.js 3.34 places an `-inside`
|
|
2567
|
+
* alignment against that side of the node, inside it (`recalculateNodeLabelProjection`): `top-inside` with
|
|
2568
|
+
* `center` is `inside-top`, `top-inside` with `left-inside` is `inside-top-left`. One inside and one outside
|
|
2569
|
+
* alignment have no neutral position of their own: the outside side here, its inside part read as centered, which
|
|
2570
|
+
* `mixedLabelPlaces()` replaces with the pinned place once the node's size is known.
|
|
1582
2571
|
* @param v - the vertical alignment, or null
|
|
1583
2572
|
* @param h - the horizontal alignment, or null
|
|
1584
|
-
* @param note - notes an alignment read as another
|
|
1585
2573
|
* @returns the position, or null
|
|
1586
2574
|
*/
|
|
1587
|
-
function labelPosition(v, h
|
|
2575
|
+
function labelPosition(v, h) {
|
|
1588
2576
|
if (v === null && h === null) {
|
|
1589
2577
|
return null;
|
|
1590
2578
|
}
|
|
2579
|
+
const vIn = (v ?? "").endsWith("-inside");
|
|
2580
|
+
const hIn = (h ?? "").endsWith("-inside");
|
|
1591
2581
|
const vv = (v ?? "top").replace("-inside", "");
|
|
1592
2582
|
const hh = (h ?? "center").replace("-inside", "");
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
2583
|
+
if (vIn || hIn) {
|
|
2584
|
+
const vOut = vv !== "center" && !vIn;
|
|
2585
|
+
const hOut = hh !== "center" && !hIn;
|
|
2586
|
+
if (!vOut && !hOut) {
|
|
2587
|
+
return INSIDE_POSITIONS.get(`${vv},${hh}`) ?? null;
|
|
2588
|
+
}
|
|
2589
|
+
return POSITIONS.get(`${vIn ? "center" : vv},${hIn ? "center" : hh}`) ?? null;
|
|
1595
2590
|
}
|
|
1596
2591
|
return POSITIONS.get(`${vv},${hh}`) ?? null;
|
|
1597
2592
|
}
|
|
@@ -1641,7 +2636,7 @@ function buildRules(kind, applied, core, input, truth, env) {
|
|
|
1641
2636
|
if (props.length === 0 || a.list.length === 0) {
|
|
1642
2637
|
continue;
|
|
1643
2638
|
}
|
|
1644
|
-
drafts.push(draftOf(ctx, a.entry, a.list, props));
|
|
2639
|
+
drafts.push(draftOf(ctx, a.entry, a.list, props, a.props));
|
|
1645
2640
|
}
|
|
1646
2641
|
const rules = collapse(ctx, drafts);
|
|
1647
2642
|
return { rules, columns, rawColumns: [...raw] };
|
|
@@ -1652,9 +2647,10 @@ function buildRules(kind, applied, core, input, truth, env) {
|
|
|
1652
2647
|
* @param entry - the entry
|
|
1653
2648
|
* @param list - the matched core elements
|
|
1654
2649
|
* @param props - the carried properties
|
|
2650
|
+
* @param all - every property of the entry, the parts combined afterward too
|
|
1655
2651
|
* @returns the draft
|
|
1656
2652
|
*/
|
|
1657
|
-
function draftOf(ctx, entry, list, props) {
|
|
2653
|
+
function draftOf(ctx, entry, list, props, all) {
|
|
1658
2654
|
const setting = new Map();
|
|
1659
2655
|
const mapping = new Map();
|
|
1660
2656
|
let flattened = false;
|
|
@@ -1688,6 +2684,12 @@ function draftOf(ctx, entry, list, props) {
|
|
|
1688
2684
|
}
|
|
1689
2685
|
}
|
|
1690
2686
|
const set = Object.fromEntries(setting);
|
|
2687
|
+
if (ctx.kind === "node") {
|
|
2688
|
+
cyjsPolygonShapes(set);
|
|
2689
|
+
}
|
|
2690
|
+
else {
|
|
2691
|
+
hollowArrowsOfRule(set, all);
|
|
2692
|
+
}
|
|
1691
2693
|
const map = Object.fromEntries(mapping);
|
|
1692
2694
|
const hasMap = mapping.size > 0;
|
|
1693
2695
|
// the predicate is built only for a rule that is not collapsed into a run: a run's rules need no column each
|