@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { i as num6, a as canonEnum, b as STYLE_ISSUE, d as canonColor, _ as CSS_COLORS, h as StyleNotes, C as canonicalFor, p as plainCell, W as evalContinuous, X as numberOf, D as degreeValues, Q as refSource, w as STYLE_PROPERTIES, U as resolveRules, V as matches } from "./block-iptrlMBb.js";
|
|
2
|
+
import { d as canonBends, c as canonNodeOffsets, a as flattenQuadSpline } from "./bends-BGXjv_U4.js";
|
|
2
3
|
const STYLE_WORK_BUDGET = 2e8;
|
|
3
4
|
class StyleBudget {
|
|
4
5
|
#used = { node: 0, edge: 0 };
|
|
@@ -41,6 +42,7 @@ const CYJS_PROPERTY_DEFAULTS = /* @__PURE__ */ new Map([
|
|
|
41
42
|
["background-opacity", "1"],
|
|
42
43
|
["opacity", "1"],
|
|
43
44
|
["border-color", "rgb(0,0,0)"],
|
|
45
|
+
["border-opacity", "1"],
|
|
44
46
|
["border-width", "0px"],
|
|
45
47
|
["border-style", "solid"],
|
|
46
48
|
["shape", "ellipse"],
|
|
@@ -56,10 +58,14 @@ const CYJS_PROPERTY_DEFAULTS = /* @__PURE__ */ new Map([
|
|
|
56
58
|
["display", "element"],
|
|
57
59
|
["text-valign", "top"],
|
|
58
60
|
["text-halign", "center"],
|
|
61
|
+
["text-wrap", "none"],
|
|
62
|
+
["text-max-width", "9999px"],
|
|
59
63
|
["line-color", "rgb(153,153,153)"],
|
|
60
64
|
["line-style", "solid"],
|
|
61
65
|
["target-arrow-shape", "none"],
|
|
62
66
|
["source-arrow-shape", "none"],
|
|
67
|
+
["target-arrow-fill", "filled"],
|
|
68
|
+
["source-arrow-fill", "filled"],
|
|
63
69
|
["target-arrow-color", "rgb(153,153,153)"],
|
|
64
70
|
["source-arrow-color", "rgb(153,153,153)"],
|
|
65
71
|
["curve-style", "haystack"],
|
|
@@ -94,6 +100,239 @@ const CYJS_DEFAULT_STYLESHEET = [
|
|
|
94
100
|
style: { "background-color": "rgb(204,225,249)", "border-color": "rgb(174,200,229)" }
|
|
95
101
|
}
|
|
96
102
|
];
|
|
103
|
+
const PIECES = 16;
|
|
104
|
+
const text = (property) => ({ property, type: "text" });
|
|
105
|
+
const color = (property) => ({ property, type: "color" });
|
|
106
|
+
const CYJS_FACE_PROPERTIES = [
|
|
107
|
+
["background-image", text("_bgImage")],
|
|
108
|
+
["background-fit", text("_bgFit")],
|
|
109
|
+
["background-width", text("_bgWidth")],
|
|
110
|
+
["background-height", text("_bgHeight")],
|
|
111
|
+
["background-width-relative-to", text("_bgWidthRel")],
|
|
112
|
+
["background-height-relative-to", text("_bgHeightRel")],
|
|
113
|
+
["background-position-x", text("_bgPosX")],
|
|
114
|
+
["background-position-y", text("_bgPosY")],
|
|
115
|
+
["background-offset-x", text("_bgOffX")],
|
|
116
|
+
["background-offset-y", text("_bgOffY")],
|
|
117
|
+
["background-repeat", text("_bgRepeat")],
|
|
118
|
+
["background-clip", text("_bgClip")],
|
|
119
|
+
["background-image-smoothing", text("_bgSmooth")],
|
|
120
|
+
["background-image-opacity", text("_bgOpacity")],
|
|
121
|
+
["pie-size", text("_pieSize")],
|
|
122
|
+
["pie-hole", text("_pieHole")],
|
|
123
|
+
["pie-start-angle", text("_pieStart")],
|
|
124
|
+
["stripe-size", text("_stripeSize")],
|
|
125
|
+
["stripe-direction", text("_stripeDir")],
|
|
126
|
+
...Array.from({ length: PIECES }, (_, k) => [
|
|
127
|
+
[`pie-${String(k + 1)}-background-color`, color(`_pieC${String(k + 1)}`)],
|
|
128
|
+
[`pie-${String(k + 1)}-background-size`, text(`_pieS${String(k + 1)}`)],
|
|
129
|
+
[`pie-${String(k + 1)}-background-opacity`, text(`_pieO${String(k + 1)}`)],
|
|
130
|
+
[`stripe-${String(k + 1)}-background-color`, color(`_stripeC${String(k + 1)}`)],
|
|
131
|
+
[`stripe-${String(k + 1)}-background-size`, text(`_stripeS${String(k + 1)}`)],
|
|
132
|
+
[`stripe-${String(k + 1)}-background-opacity`, text(`_stripeO${String(k + 1)}`)]
|
|
133
|
+
]).flat()
|
|
134
|
+
];
|
|
135
|
+
function measure(word) {
|
|
136
|
+
const m = /^(-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*([a-z%]*)$/i.exec((word ?? "").trim());
|
|
137
|
+
return m === null ? null : [Number(m[1]), m[2].toLowerCase()];
|
|
138
|
+
}
|
|
139
|
+
const r6 = (v) => Math.round(v * 1e6) / 1e6;
|
|
140
|
+
function length(word, of) {
|
|
141
|
+
const m = measure(word);
|
|
142
|
+
if (m === null) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
let out = null;
|
|
146
|
+
if (m[1] === "%") {
|
|
147
|
+
out = of === null ? null : m[0] / 100 * of;
|
|
148
|
+
} else if (m[1] === "px" || m[1] === "") {
|
|
149
|
+
out = m[0];
|
|
150
|
+
}
|
|
151
|
+
return out === null || out < 0 ? null : r6(out);
|
|
152
|
+
}
|
|
153
|
+
function paddingPixels(word) {
|
|
154
|
+
const x = Number.parseFloat(word ?? "");
|
|
155
|
+
if (!Number.isFinite(x) || x <= 0) {
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
return (word ?? "").trim().endsWith("%") ? x / 100 : x;
|
|
159
|
+
}
|
|
160
|
+
function fraction(word) {
|
|
161
|
+
const m = measure(word);
|
|
162
|
+
if (m === null) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
if (m[1] === "%") {
|
|
166
|
+
return r6(m[0] / 100);
|
|
167
|
+
}
|
|
168
|
+
return m[1] === "" ? r6(m[0]) : null;
|
|
169
|
+
}
|
|
170
|
+
function firstImage(word) {
|
|
171
|
+
const first = (word ?? "").trim().split(/\s+/)[0] ?? "";
|
|
172
|
+
const unwrapped = /^url\((['"]?)(.*)\1\)$/.exec(first)?.[2] ?? first;
|
|
173
|
+
return unwrapped === "" || unwrapped === "none" ? null : unwrapped;
|
|
174
|
+
}
|
|
175
|
+
function degrees(word) {
|
|
176
|
+
const m = measure(word);
|
|
177
|
+
if (m === null) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
if (m[1] !== "rad" && m[1] !== "deg" && m[1] !== "") {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const deg = m[1] === "rad" ? m[0] * 180 / Math.PI : m[0];
|
|
184
|
+
return r6((deg % 360 + 360) % 360);
|
|
185
|
+
}
|
|
186
|
+
function pieces(words, prefix, i) {
|
|
187
|
+
const colors = [];
|
|
188
|
+
const sizes = [];
|
|
189
|
+
const opacities = [];
|
|
190
|
+
for (let k = 1; k <= PIECES; k++) {
|
|
191
|
+
const m = measure(words.get(`${prefix}S${String(k)}`)?.[i]);
|
|
192
|
+
const size = m !== null && (m[1] === "%" || m[1] === "") ? r6(m[0] / 100) : null;
|
|
193
|
+
if (size === null || size <= 0) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
colors.push(words.get(`${prefix}C${String(k)}`)?.[i] ?? "#000000");
|
|
197
|
+
sizes.push(String(size));
|
|
198
|
+
const o = Number(words.get(`${prefix}O${String(k)}`)?.[i] ?? "1");
|
|
199
|
+
opacities.push(String(Number.isFinite(o) ? Math.max(0, Math.min(1, o)) : 1));
|
|
200
|
+
}
|
|
201
|
+
if (colors.length === 0) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
colors: colors.join(" "),
|
|
206
|
+
sizes: sizes.join(" "),
|
|
207
|
+
opacities: opacities.every((o) => o === "1") ? null : opacities.join(" ")
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function combineFace(n, words, values) {
|
|
211
|
+
const col = (property) => values[property] ??= new Array(n).fill(null);
|
|
212
|
+
const num = (property, i) => {
|
|
213
|
+
const v = values[property]?.[i];
|
|
214
|
+
return typeof v === "number" ? v : null;
|
|
215
|
+
};
|
|
216
|
+
for (let i = 0; i < n; i++) {
|
|
217
|
+
const el = {
|
|
218
|
+
word: (part) => words.get(part)?.[i] ?? null,
|
|
219
|
+
put: (property, value) => {
|
|
220
|
+
col(property)[i] = value;
|
|
221
|
+
},
|
|
222
|
+
// Cytoscape.js's default node is 30 x 30
|
|
223
|
+
w: num("width", i) ?? 30,
|
|
224
|
+
h: num("height", i) ?? 30
|
|
225
|
+
};
|
|
226
|
+
faceImage(el);
|
|
227
|
+
const pie = pieces(words, "_pie", i);
|
|
228
|
+
if (pie !== null) {
|
|
229
|
+
facePie(el, pie);
|
|
230
|
+
}
|
|
231
|
+
const stripe = pieces(words, "_stripe", i);
|
|
232
|
+
if (stripe !== null) {
|
|
233
|
+
faceStripes(el, stripe);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
function faceImage(el) {
|
|
238
|
+
const image = firstImage(el.word("_bgImage"));
|
|
239
|
+
if (image === null) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
el.put("image", image);
|
|
243
|
+
const fit = el.word("_bgFit") ?? "none";
|
|
244
|
+
el.put("imageFit", ["none", "contain", "cover"].includes(fit) ? fit : "none");
|
|
245
|
+
imageSize(el);
|
|
246
|
+
imagePlace(el);
|
|
247
|
+
imageLook(el);
|
|
248
|
+
}
|
|
249
|
+
function imageSize(el) {
|
|
250
|
+
const pad = paddingPixels(el.word("_padding"));
|
|
251
|
+
const of = (rel, side) => rel === "inner" ? side : side + 2 * pad;
|
|
252
|
+
const tiled = ["repeat", "repeat-x", "repeat-y"].includes(el.word("_bgRepeat") ?? "");
|
|
253
|
+
const bw = tiled ? null : length(el.word("_bgWidth"), of(el.word("_bgWidthRel"), el.w));
|
|
254
|
+
const bh = tiled ? null : length(el.word("_bgHeight"), of(el.word("_bgHeightRel"), el.h));
|
|
255
|
+
if (bw !== null) {
|
|
256
|
+
el.put("imageWidth", bw);
|
|
257
|
+
}
|
|
258
|
+
if (bh !== null) {
|
|
259
|
+
el.put("imageHeight", bh);
|
|
260
|
+
}
|
|
261
|
+
if (bw === null !== (bh === null)) {
|
|
262
|
+
el.put("imageAutoSize", "natural");
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function imagePlace(el) {
|
|
266
|
+
const px = fraction(el.word("_bgPosX"));
|
|
267
|
+
const py = fraction(el.word("_bgPosY"));
|
|
268
|
+
if (px !== null && px >= 0) {
|
|
269
|
+
el.put("imagePositionX", px);
|
|
270
|
+
}
|
|
271
|
+
if (py !== null && py >= 0) {
|
|
272
|
+
el.put("imagePositionY", py);
|
|
273
|
+
}
|
|
274
|
+
const ox = length(el.word("_bgOffX"), el.w);
|
|
275
|
+
const oy = length(el.word("_bgOffY"), el.h);
|
|
276
|
+
if (ox !== null) {
|
|
277
|
+
el.put("imageOffsetX", ox);
|
|
278
|
+
}
|
|
279
|
+
if (oy !== null) {
|
|
280
|
+
el.put("imageOffsetY", oy);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function imageLook(el) {
|
|
284
|
+
const repeat = el.word("_bgRepeat");
|
|
285
|
+
if (repeat !== null && ["repeat", "repeat-x", "repeat-y", "no-repeat"].includes(repeat)) {
|
|
286
|
+
el.put("imageRepeat", repeat);
|
|
287
|
+
}
|
|
288
|
+
const clip = el.word("_bgClip");
|
|
289
|
+
if (clip !== null) {
|
|
290
|
+
el.put("imageClip", clip === "none" ? "none" : "node");
|
|
291
|
+
}
|
|
292
|
+
const smooth = el.word("_bgSmooth");
|
|
293
|
+
if (smooth === "yes" || smooth === "no") {
|
|
294
|
+
el.put("imageSmoothing", smooth === "yes");
|
|
295
|
+
}
|
|
296
|
+
const opacity = Number(el.word("_bgOpacity") ?? Number.NaN);
|
|
297
|
+
if (Number.isFinite(opacity)) {
|
|
298
|
+
el.put("imageOpacity", Math.max(0, Math.min(1, opacity)));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function facePie(el, pie) {
|
|
302
|
+
el.put("pieColors", pie.colors);
|
|
303
|
+
el.put("pieSizes", pie.sizes);
|
|
304
|
+
if (pie.opacities !== null) {
|
|
305
|
+
el.put("pieOpacities", pie.opacities);
|
|
306
|
+
}
|
|
307
|
+
const size = el.word("_pieSize");
|
|
308
|
+
const px = measure(size)?.[1] === "px" ? length(size, null) : null;
|
|
309
|
+
const r = px === null ? fraction(size) : px / Math.min(el.w, el.h);
|
|
310
|
+
if (r !== null) {
|
|
311
|
+
el.put("pieRadius", r6(r));
|
|
312
|
+
}
|
|
313
|
+
const hole = fraction(el.word("_pieHole"));
|
|
314
|
+
if (hole !== null && hole >= 0 && hole <= 1) {
|
|
315
|
+
el.put("pieHole", hole);
|
|
316
|
+
}
|
|
317
|
+
const start = degrees(el.word("_pieStart"));
|
|
318
|
+
if (start !== null) {
|
|
319
|
+
el.put("pieRotation", start);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function faceStripes(el, stripe) {
|
|
323
|
+
el.put("stripeColors", stripe.colors);
|
|
324
|
+
el.put("stripeSizes", stripe.sizes);
|
|
325
|
+
if (stripe.opacities !== null) {
|
|
326
|
+
el.put("stripeOpacities", stripe.opacities);
|
|
327
|
+
}
|
|
328
|
+
if (el.word("_stripeDir") === "righward") {
|
|
329
|
+
el.put("stripeDirection", "right");
|
|
330
|
+
}
|
|
331
|
+
const size = fraction(el.word("_stripeSize"));
|
|
332
|
+
if (size !== null && size >= 0) {
|
|
333
|
+
el.put("stripeSize", size);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
97
336
|
const NODE_SHAPES = [
|
|
98
337
|
"rectangle",
|
|
99
338
|
"roundrectangle",
|
|
@@ -164,7 +403,7 @@ const FONT_WEIGHTS = [
|
|
|
164
403
|
800,
|
|
165
404
|
900
|
|
166
405
|
];
|
|
167
|
-
const
|
|
406
|
+
const CYJS_CURVE_STYLES = [
|
|
168
407
|
"bezier",
|
|
169
408
|
"unbundled-bezier",
|
|
170
409
|
"haystack",
|
|
@@ -193,18 +432,218 @@ const LABEL = [
|
|
|
193
432
|
["font-style", { property: "labelItalic", type: "enum", enums: ["italic", "normal", "oblique"] }],
|
|
194
433
|
["visibility", { property: "_visibility", type: "enum", enums: ["hidden", "visible"] }],
|
|
195
434
|
["display", { property: "_display", type: "enum", enums: ["element", "none"] }],
|
|
196
|
-
["opacity", { property: "opacity", type: "zeroOne" }]
|
|
435
|
+
["opacity", { property: "opacity", type: "zeroOne" }],
|
|
436
|
+
["text-transform", { property: "_transform", type: "enum", enums: ["none", "uppercase", "lowercase"] }],
|
|
437
|
+
["text-wrap", { property: "_wrap", type: "enum", enums: ["none", "wrap", "ellipsis"] }],
|
|
438
|
+
["text-overflow-wrap", { property: "_overflowWrap", type: "enum", enums: ["whitespace", "anywhere"] }],
|
|
439
|
+
// how the lines line up; `auto` follows the horizontal alignment (`combineLabelText`)
|
|
440
|
+
["text-justification", { property: "_justification", type: "enum", enums: ["auto", "left", "center", "right"] }],
|
|
441
|
+
// a width only `text-wrap: wrap` wraps at, so it is combined with the wrap afterward (`combineParts`)
|
|
442
|
+
["text-max-width", { property: "_maxWidth", type: "size" }],
|
|
443
|
+
// the outline and the background box draw only with a width and an opacity (`combineLabelDress`)
|
|
444
|
+
["text-outline-color", { property: "_outlineColor", type: "color" }],
|
|
445
|
+
["text-outline-width", { property: "_outlineWidth", type: "size" }],
|
|
446
|
+
["text-outline-opacity", { property: "_outlineOpacity", type: "zeroOne" }],
|
|
447
|
+
["text-background-color", { property: "_backgroundColor", type: "color" }],
|
|
448
|
+
["text-background-opacity", { property: "_backgroundOpacity", type: "zeroOne" }],
|
|
449
|
+
["text-background-padding", { property: "_backgroundPadding", type: "size" }],
|
|
450
|
+
[
|
|
451
|
+
"text-background-shape",
|
|
452
|
+
{
|
|
453
|
+
property: "_backgroundShape",
|
|
454
|
+
type: "enum",
|
|
455
|
+
enums: ["rectangle", "round-rectangle", "roundrectangle", "circle"]
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
["text-rotation", { property: "_rotation", type: "text" }],
|
|
459
|
+
// the words' own opacity, drawn times the element's (`combineLabelOpacity`)
|
|
460
|
+
["text-opacity", { property: "_textOpacity", type: "zeroOne" }],
|
|
461
|
+
// the label moved right and down by this many pixels from where its alignment puts it, a node's and an edge's
|
|
462
|
+
["text-margin-x", { property: "labelOffsetX", type: "signedSize" }],
|
|
463
|
+
["text-margin-y", { property: "labelOffsetY", type: "signedSize" }],
|
|
464
|
+
// the line round the label's box draws only with a width and an opacity above 0 (`combineLabelDress`)
|
|
465
|
+
["text-border-color", { property: "_textBorderColor", type: "color" }],
|
|
466
|
+
["text-border-width", { property: "_textBorderWidth", type: "size" }],
|
|
467
|
+
["text-border-opacity", { property: "_textBorderOpacity", type: "zeroOne" }],
|
|
468
|
+
[
|
|
469
|
+
"text-border-style",
|
|
470
|
+
{ property: "_textBorderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }
|
|
471
|
+
]
|
|
472
|
+
];
|
|
473
|
+
const GRADIENT_DIRECTIONS = [
|
|
474
|
+
"to-bottom",
|
|
475
|
+
"to-top",
|
|
476
|
+
"to-left",
|
|
477
|
+
"to-right",
|
|
478
|
+
"to-bottom-right",
|
|
479
|
+
"to-bottom-left",
|
|
480
|
+
"to-top-right",
|
|
481
|
+
"to-top-left",
|
|
482
|
+
"to-right-bottom",
|
|
483
|
+
"to-left-bottom",
|
|
484
|
+
"to-right-top",
|
|
485
|
+
"to-left-top"
|
|
197
486
|
];
|
|
487
|
+
const EM_PX = 16;
|
|
488
|
+
function cyjsPointsToNeutral(text2) {
|
|
489
|
+
const n = text2.trim().split(/[\s,]+/).map(Number);
|
|
490
|
+
if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {
|
|
491
|
+
return null;
|
|
492
|
+
}
|
|
493
|
+
const pairs = [];
|
|
494
|
+
for (let i = 0; i < n.length; i += 2) {
|
|
495
|
+
pairs.push(`${String(round6(n[i]))},${String(round6(-n[i + 1]))}`);
|
|
496
|
+
}
|
|
497
|
+
return pairs.join(" ");
|
|
498
|
+
}
|
|
499
|
+
function neutralPointsToCyjs(points) {
|
|
500
|
+
const n = points.trim().split(/[\s,]+/).map(Number);
|
|
501
|
+
if (n.length < 6 || n.length % 2 !== 0 || !n.every((v) => Number.isFinite(v))) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
const pairs = [];
|
|
505
|
+
for (let i = 0; i < n.length; i += 2) {
|
|
506
|
+
pairs.push(`${String(round6(n[i]))} ${String(round6(-n[i + 1]))}`);
|
|
507
|
+
}
|
|
508
|
+
return pairs.join(" ");
|
|
509
|
+
}
|
|
510
|
+
const round6 = (v) => Math.round(v * 1e6) / 1e6 + 0;
|
|
511
|
+
function fittedHeptagon() {
|
|
512
|
+
const corners = Array.from({ length: 7 }, (_, i) => {
|
|
513
|
+
const angle = Math.PI / 2 + 2 * Math.PI * i / 7;
|
|
514
|
+
return [Math.cos(angle), Math.sin(angle)];
|
|
515
|
+
});
|
|
516
|
+
const [x0, x1] = [Math.min(...corners.map(([x]) => x)), Math.max(...corners.map(([x]) => x))];
|
|
517
|
+
const [y0, y1] = [Math.min(...corners.map(([, y]) => y)), Math.max(...corners.map(([, y]) => y))];
|
|
518
|
+
return corners.map(([x, y]) => `${round6(2 * (x - x0) / (x1 - x0) - 1)},${round6(2 * (y - y0) / (y1 - y0) - 1)}`).join(" ");
|
|
519
|
+
}
|
|
520
|
+
const CYJS_POLYGON_SHAPES = /* @__PURE__ */ new Map([
|
|
521
|
+
["heptagon", fittedHeptagon()],
|
|
522
|
+
["round-heptagon", fittedHeptagon()],
|
|
523
|
+
["tag", "-1,-1 0.25,-1 1,0 0.25,1 -1,1"],
|
|
524
|
+
["round-tag", "-1,-1 0.25,-1 1,0 0.25,1 -1,1"]
|
|
525
|
+
]);
|
|
526
|
+
const CYJS_ROUND_SHAPES = /* @__PURE__ */ new Set([
|
|
527
|
+
"round-triangle",
|
|
528
|
+
"round-diamond",
|
|
529
|
+
"round-pentagon",
|
|
530
|
+
"round-hexagon",
|
|
531
|
+
"round-octagon"
|
|
532
|
+
]);
|
|
533
|
+
function cyjsPolygonShapes(values) {
|
|
534
|
+
const { shape } = values;
|
|
535
|
+
const pointsOf = (v) => typeof v === "string" && v.startsWith("other:") ? CYJS_POLYGON_SHAPES.get(v.slice("other:".length)) : void 0;
|
|
536
|
+
if (Array.isArray(shape)) {
|
|
537
|
+
const col = shape;
|
|
538
|
+
if (!col.some((v) => pointsOf(v) !== void 0)) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
const points = Array.isArray(values.shapePoints) ? [...values.shapePoints] : new Array(col.length).fill(null);
|
|
542
|
+
values.shape = col.map((v, i) => {
|
|
543
|
+
const p2 = pointsOf(v);
|
|
544
|
+
if (p2 === void 0) {
|
|
545
|
+
return v;
|
|
546
|
+
}
|
|
547
|
+
points[i] = p2;
|
|
548
|
+
return polygonOf(v);
|
|
549
|
+
});
|
|
550
|
+
values.shapePoints = points;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
const p = pointsOf(shape);
|
|
554
|
+
if (p !== void 0) {
|
|
555
|
+
values.shape = polygonOf(shape);
|
|
556
|
+
values.shapePoints = p;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function polygonOf(shape) {
|
|
560
|
+
return typeof shape === "string" && shape.startsWith("other:round-") ? "other:round-polygon" : "polygon";
|
|
561
|
+
}
|
|
562
|
+
const GRADIENT_KINDS = /* @__PURE__ */ new Map([
|
|
563
|
+
["solid", "none"],
|
|
564
|
+
["linear-gradient", "linear"],
|
|
565
|
+
["radial-gradient", "radial"]
|
|
566
|
+
]);
|
|
567
|
+
function wordsOutsideParens(text2) {
|
|
568
|
+
const closes = new Array(text2.length + 1).fill(false);
|
|
569
|
+
for (let i2 = text2.length - 1; i2 >= 0; i2--) {
|
|
570
|
+
closes[i2] = text2[i2] === ")" || text2[i2] !== "(" && closes[i2 + 1];
|
|
571
|
+
}
|
|
572
|
+
const words = [];
|
|
573
|
+
let start = 0;
|
|
574
|
+
let i = 0;
|
|
575
|
+
while (i < text2.length) {
|
|
576
|
+
if (!/\s/.test(text2[i])) {
|
|
577
|
+
i++;
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
let end = i + 1;
|
|
581
|
+
while (end < text2.length && /\s/.test(text2[end])) {
|
|
582
|
+
end++;
|
|
583
|
+
}
|
|
584
|
+
if (!closes[end]) {
|
|
585
|
+
words.push(text2.slice(start, i));
|
|
586
|
+
start = end;
|
|
587
|
+
}
|
|
588
|
+
i = end;
|
|
589
|
+
}
|
|
590
|
+
words.push(text2.slice(start));
|
|
591
|
+
return words;
|
|
592
|
+
}
|
|
593
|
+
function gradientColors(text2, site) {
|
|
594
|
+
const hexes = [];
|
|
595
|
+
for (const token of wordsOutsideParens(text2.trim())) {
|
|
596
|
+
const c = token === "" ? null : canonColor(token, "css", site);
|
|
597
|
+
if (c === null) {
|
|
598
|
+
return void 0;
|
|
599
|
+
}
|
|
600
|
+
hexes.push(c.color);
|
|
601
|
+
}
|
|
602
|
+
return hexes.join(" ");
|
|
603
|
+
}
|
|
604
|
+
function gradientStopColors(text2, site) {
|
|
605
|
+
return gradientColors(text2, site)?.split(" ") ?? [];
|
|
606
|
+
}
|
|
607
|
+
function gradientStops(text2) {
|
|
608
|
+
const stops = text2.trim().split(/\s+/).map((t) => t.endsWith("%") ? Number.parseFloat(t) / 100 : Number.parseFloat(t));
|
|
609
|
+
return stops.every((n) => Number.isFinite(n)) ? stops.map((n) => num6(n)).join(" ") : void 0;
|
|
610
|
+
}
|
|
611
|
+
const HALVED = /* @__PURE__ */ new Set(["fanSpacing", "outerBorderOffset"]);
|
|
198
612
|
const CYJS_NODE_PROPERTIES = new Map([
|
|
199
613
|
["background-color", { property: "fill", type: "color" }],
|
|
200
614
|
["background-opacity", { property: "fillOpacity", type: "zeroOne" }],
|
|
201
615
|
["border-color", { property: "borderColor", type: "color" }],
|
|
616
|
+
// the rings are drawn at their own opacity times the node's (`combineNodeOpacity`)
|
|
617
|
+
["border-opacity", { property: "_ringOpacity", type: "zeroOne" }],
|
|
202
618
|
["border-width", { property: "borderWidth", type: "size" }],
|
|
203
619
|
["border-style", { property: "borderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }],
|
|
620
|
+
// the dashes a dashed border is drawn with and their ends, which decide how it looks (`combineDashes`)
|
|
621
|
+
["border-dash-pattern", { property: "_dashPattern", type: "text" }],
|
|
622
|
+
["border-cap", { property: "_dashCap", type: "enum", enums: ["butt", "round", "square"] }],
|
|
623
|
+
// where the border sits against the node's outline: across it, inside it or outside it
|
|
624
|
+
["border-position", { property: "borderPosition", type: "enum", enums: ["center", "inside", "outside"] }],
|
|
625
|
+
["outline-color", { property: "outerBorderColor", type: "color" }],
|
|
626
|
+
["outline-opacity", { property: "_outlineRingOpacity", type: "zeroOne" }],
|
|
627
|
+
["outline-width", { property: "outerBorderWidth", type: "size" }],
|
|
628
|
+
["outline-style", { property: "outerBorderStyle", type: "enum", enums: ["solid", "dotted", "dashed", "double"] }],
|
|
629
|
+
["outline-offset", { property: "outerBorderOffset", type: "size" }],
|
|
630
|
+
["underlay-color", { property: "underlayColor", type: "color" }],
|
|
631
|
+
["underlay-opacity", { property: "underlayOpacity", type: "zeroOne" }],
|
|
632
|
+
["underlay-padding", { property: "underlayPadding", type: "size" }],
|
|
633
|
+
["underlay-shape", { property: "underlayShape", type: "enum", enums: NODE_SHAPES }],
|
|
634
|
+
["underlay-corner-radius", { property: "underlayCornerRadius", type: "size" }],
|
|
635
|
+
["overlay-color", { property: "overlayColor", type: "color" }],
|
|
636
|
+
["overlay-opacity", { property: "overlayOpacity", type: "zeroOne" }],
|
|
637
|
+
["overlay-padding", { property: "overlayPadding", type: "size" }],
|
|
638
|
+
["overlay-shape", { property: "overlayShape", type: "enum", enums: NODE_SHAPES }],
|
|
639
|
+
["overlay-corner-radius", { property: "overlayCornerRadius", type: "size" }],
|
|
204
640
|
["shape", { property: "shape", type: "enum", enums: NODE_SHAPES }],
|
|
641
|
+
["shape-polygon-points", { property: "shapePoints", type: "text" }],
|
|
205
642
|
["corner-radius", { property: "cornerRadius", type: "size" }],
|
|
206
643
|
["width", { property: "width", type: "nodeSize" }],
|
|
207
644
|
["height", { property: "height", type: "nodeSize" }],
|
|
645
|
+
// a node is drawn this much larger on every side (`nodeSizes`)
|
|
646
|
+
["padding", { property: "_padding", type: "text" }],
|
|
208
647
|
[
|
|
209
648
|
"text-valign",
|
|
210
649
|
{ property: "_valign", type: "enum", enums: ["top", "top-inside", "center", "bottom", "bottom-inside"] }
|
|
@@ -213,28 +652,106 @@ const CYJS_NODE_PROPERTIES = new Map([
|
|
|
213
652
|
"text-halign",
|
|
214
653
|
{ property: "_halign", type: "enum", enums: ["left", "left-inside", "center", "right", "right-inside"] }
|
|
215
654
|
],
|
|
655
|
+
// the fill's gradient, combined afterward into `fill`, `fillGradient`, `fillGradientAngle` and the other
|
|
656
|
+
// `fillGradient*` properties
|
|
657
|
+
[
|
|
658
|
+
"background-fill",
|
|
659
|
+
{ property: "_backgroundFill", type: "enum", enums: ["solid", "linear-gradient", "radial-gradient"] }
|
|
660
|
+
],
|
|
661
|
+
["background-gradient-stop-colors", { property: "_backgroundStops", type: "text" }],
|
|
662
|
+
["background-gradient-stop-positions", { property: "_backgroundPositions", type: "text" }],
|
|
663
|
+
["background-gradient-direction", { property: "_backgroundDirection", type: "enum", enums: GRADIENT_DIRECTIONS }],
|
|
664
|
+
...CYJS_FACE_PROPERTIES,
|
|
216
665
|
...LABEL
|
|
217
666
|
]);
|
|
218
667
|
const CYJS_EDGE_PROPERTIES = new Map([
|
|
219
668
|
["line-color", { property: "color", type: "color" }],
|
|
220
669
|
["width", { property: "width", type: "nodeSize" }],
|
|
221
670
|
["line-style", { property: "lineStyle", type: "enum", enums: ["solid", "dotted", "dashed"] }],
|
|
671
|
+
// the dashes a dashed line is drawn with and their ends, which decide how it looks (`combineDashes`)
|
|
672
|
+
["line-dash-pattern", { property: "_dashPattern", type: "text" }],
|
|
673
|
+
["line-cap", { property: "_dashCap", type: "enum", enums: ["butt", "round", "square"] }],
|
|
674
|
+
// the line's own opacity, combined afterward into `opacity`, which the line is drawn at
|
|
675
|
+
["line-opacity", { property: "_lineOpacity", type: "zeroOne" }],
|
|
676
|
+
["line-outline-width", { property: "outlineWidth", type: "size" }],
|
|
677
|
+
["line-fill", { property: "gradientKind", type: "enum", enums: ["solid", "linear-gradient", "radial-gradient"] }],
|
|
678
|
+
["line-gradient-stop-colors", { property: "gradientColors", type: "text" }],
|
|
679
|
+
["line-gradient-stop-positions", { property: "gradientStops", type: "text" }],
|
|
680
|
+
["line-outline-color", { property: "outlineColor", type: "color" }],
|
|
681
|
+
["underlay-color", { property: "underlayColor", type: "color" }],
|
|
682
|
+
["underlay-opacity", { property: "underlayOpacity", type: "zeroOne" }],
|
|
683
|
+
["underlay-padding", { property: "underlayPadding", type: "size" }],
|
|
684
|
+
["overlay-color", { property: "overlayColor", type: "color" }],
|
|
685
|
+
["overlay-opacity", { property: "overlayOpacity", type: "zeroOne" }],
|
|
686
|
+
["overlay-padding", { property: "overlayPadding", type: "size" }],
|
|
222
687
|
["target-arrow-shape", { property: "targetArrow", type: "enum", enums: ARROWS }],
|
|
223
688
|
["source-arrow-shape", { property: "sourceArrow", type: "enum", enums: ARROWS }],
|
|
224
689
|
["target-arrow-color", { property: "targetArrowColor", type: "color" }],
|
|
225
690
|
["source-arrow-color", { property: "sourceArrowColor", type: "color" }],
|
|
226
|
-
["
|
|
691
|
+
["mid-target-arrow-shape", { property: "midTargetArrow", type: "enum", enums: ARROWS }],
|
|
692
|
+
["mid-source-arrow-shape", { property: "midSourceArrow", type: "enum", enums: ARROWS }],
|
|
693
|
+
["mid-target-arrow-color", { property: "midTargetArrowColor", type: "color" }],
|
|
694
|
+
["mid-source-arrow-color", { property: "midSourceArrowColor", type: "color" }],
|
|
695
|
+
// filled or hollow: combined with the shape afterward (`combineParts`), a hollow triangle being `triangle-open`
|
|
696
|
+
["target-arrow-fill", { property: "_targetArrowFill", type: "enum", enums: ["filled", "hollow"] }],
|
|
697
|
+
["source-arrow-fill", { property: "_sourceArrowFill", type: "enum", enums: ["filled", "hollow"] }],
|
|
698
|
+
["mid-target-arrow-fill", { property: "_midTargetArrowFill", type: "enum", enums: ["filled", "hollow"] }],
|
|
699
|
+
["mid-source-arrow-fill", { property: "_midSourceArrowFill", type: "enum", enums: ["filled", "hollow"] }],
|
|
700
|
+
["curve-style", { property: "curved", type: "enum", enums: CYJS_CURVE_STYLES }],
|
|
701
|
+
// a route's settings, read by the routes (`edgeRoutes`) as Cytoscape.js spells them
|
|
702
|
+
["segment-distances", { property: "_segmentDistances", type: "text" }],
|
|
703
|
+
["segment-weights", { property: "_segmentWeights", type: "text" }],
|
|
704
|
+
["control-point-distances", { property: "_controlPointDistances", type: "text" }],
|
|
705
|
+
["control-point-weights", { property: "_controlPointWeights", type: "text" }],
|
|
706
|
+
["taxi-direction", { property: "_taxiDirection", type: "text" }],
|
|
707
|
+
["taxi-turn", { property: "_taxiTurn", type: "text" }],
|
|
708
|
+
["taxi-turn-min-distance", { property: "_taxiTurnMinDistance", type: "size" }],
|
|
709
|
+
["edge-distances", { property: "_edgeDistances", type: "text" }],
|
|
710
|
+
["loop-direction", { property: "_loopDirection", type: "text" }],
|
|
711
|
+
["loop-sweep", { property: "_loopSweep", type: "text" }],
|
|
712
|
+
["segment-radii", { property: "_segmentRadii", type: "text" }],
|
|
713
|
+
["taxi-radius", { property: "_taxiRadius", type: "text" }],
|
|
714
|
+
["radius-type", { property: "_radiusType", type: "text" }],
|
|
715
|
+
// where the ends meet the nodes, read with the routes (`edgePorts`)
|
|
716
|
+
["source-endpoint", { property: "_sourceEndpoint", type: "text" }],
|
|
717
|
+
["target-endpoint", { property: "_targetEndpoint", type: "text" }],
|
|
718
|
+
// a bundle's control points are this far apart, so the curves' middles half of it (see cyjsNeutral)
|
|
719
|
+
["control-point-step-size", { property: "fanSpacing", type: "size" }],
|
|
227
720
|
["arrow-scale", { property: "arrowSize", type: "positive" }],
|
|
228
721
|
["source-label", { property: "sourceLabel", type: "text" }],
|
|
229
722
|
["target-label", { property: "targetLabel", type: "text" }],
|
|
723
|
+
["source-text-offset", { property: "sourceLabelOffset", type: "size" }],
|
|
724
|
+
["target-text-offset", { property: "targetLabelOffset", type: "size" }],
|
|
725
|
+
["source-text-margin-x", { property: "sourceLabelOffsetX", type: "signedSize" }],
|
|
726
|
+
["source-text-margin-y", { property: "sourceLabelOffsetY", type: "signedSize" }],
|
|
727
|
+
["target-text-margin-x", { property: "targetLabelOffsetX", type: "signedSize" }],
|
|
728
|
+
["target-text-margin-y", { property: "targetLabelOffsetY", type: "signedSize" }],
|
|
729
|
+
// an angle, or autorotate along the line, which the routes work out (`autorotateLabels`)
|
|
730
|
+
["source-text-rotation", { property: "_sourceRotation", type: "text" }],
|
|
731
|
+
["target-text-rotation", { property: "_targetRotation", type: "text" }],
|
|
230
732
|
...LABEL
|
|
231
733
|
]);
|
|
232
734
|
function cyjsProperties(target) {
|
|
233
735
|
return target === "node" ? CYJS_NODE_PROPERTIES : CYJS_EDGE_PROPERTIES;
|
|
234
736
|
}
|
|
737
|
+
const CYJS_ALIASES = /* @__PURE__ */ new Map([
|
|
738
|
+
["content", "label"],
|
|
739
|
+
["control-point-distance", "control-point-distances"],
|
|
740
|
+
["control-point-weight", "control-point-weights"],
|
|
741
|
+
["segment-distance", "segment-distances"],
|
|
742
|
+
["segment-weight", "segment-weights"],
|
|
743
|
+
["segment-radius", "segment-radii"],
|
|
744
|
+
["edge-text-rotation", "text-rotation"],
|
|
745
|
+
["padding-left", "padding"],
|
|
746
|
+
["padding-right", "padding"],
|
|
747
|
+
["padding-top", "padding"],
|
|
748
|
+
["padding-bottom", "padding"]
|
|
749
|
+
]);
|
|
750
|
+
function cyjsAliasOf(dashed) {
|
|
751
|
+
return CYJS_ALIASES.get(dashed) ?? dashed;
|
|
752
|
+
}
|
|
235
753
|
function cyjsPropertyName(name) {
|
|
236
|
-
|
|
237
|
-
return dashed === "content" ? "label" : dashed;
|
|
754
|
+
return cyjsAliasOf(name.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`));
|
|
238
755
|
}
|
|
239
756
|
const CYJS_THROWS = "throws";
|
|
240
757
|
const NUM = String.raw`[-+]?(?:(?:\d+|\d*\.\d+)(?:[Ee][+-]?\d+)?)`;
|
|
@@ -357,8 +874,8 @@ function isFontChar(c) {
|
|
|
357
874
|
function isSpace$1(c) {
|
|
358
875
|
return /\s/.test(c);
|
|
359
876
|
}
|
|
360
|
-
function allOf(
|
|
361
|
-
return Array.from(
|
|
877
|
+
function allOf(text2, test) {
|
|
878
|
+
return Array.from(text2).every(test);
|
|
362
879
|
}
|
|
363
880
|
function firstFontPart(part) {
|
|
364
881
|
let a = 0;
|
|
@@ -397,13 +914,14 @@ function parseFlat(spec, raw, rendered = false) {
|
|
|
397
914
|
return ok ? { kind: "number", value: x, units: null, str: String(x) } : null;
|
|
398
915
|
}
|
|
399
916
|
case "size":
|
|
917
|
+
case "signedSize":
|
|
400
918
|
case "nodeSize":
|
|
401
919
|
return parseSizeValue(spec, value, raw);
|
|
402
920
|
case "text":
|
|
403
921
|
return { kind: "word", value: String(value), str: String(value) };
|
|
404
922
|
case "fontFamily": {
|
|
405
|
-
const
|
|
406
|
-
return isFontFamily(
|
|
923
|
+
const text2 = String(value);
|
|
924
|
+
return isFontFamily(text2) ? { kind: "word", value: text2, str: text2 } : null;
|
|
407
925
|
}
|
|
408
926
|
case "fontWeight":
|
|
409
927
|
case "enum": {
|
|
@@ -429,21 +947,21 @@ function parseColorValue(value) {
|
|
|
429
947
|
}
|
|
430
948
|
function parseSizeValue(spec, value, raw) {
|
|
431
949
|
let units = "px";
|
|
432
|
-
let
|
|
950
|
+
let text2 = value;
|
|
433
951
|
if (typeof value === "string") {
|
|
434
952
|
const m = NUMBER_UNITS.exec(value);
|
|
435
953
|
if (m === null) {
|
|
436
954
|
units = null;
|
|
437
955
|
} else {
|
|
438
|
-
|
|
956
|
+
text2 = m[1];
|
|
439
957
|
units = m.at(2) === "em" ? "em" : "px";
|
|
440
958
|
}
|
|
441
959
|
}
|
|
442
|
-
const x = Number.parseFloat(String(
|
|
960
|
+
const x = Number.parseFloat(String(text2));
|
|
443
961
|
if (Number.isNaN(x)) {
|
|
444
962
|
return spec.type === "nodeSize" && raw === "label" ? { kind: "word", value: "label", str: "label" } : null;
|
|
445
963
|
}
|
|
446
|
-
return x < 0 ? null : { kind: "number", value: x, units, str: `${String(x)}${units ?? ""}` };
|
|
964
|
+
return x < 0 && spec.type !== "signedSize" ? null : { kind: "number", value: x, units, str: `${String(x)}${units ?? ""}` };
|
|
447
965
|
}
|
|
448
966
|
function splitArgs(inner) {
|
|
449
967
|
const out = [];
|
|
@@ -514,7 +1032,7 @@ function parseMapData(spec, value, mode) {
|
|
|
514
1032
|
if (mode === "bypass") {
|
|
515
1033
|
return null;
|
|
516
1034
|
}
|
|
517
|
-
const numeric = spec.type === "zeroOne" || spec.type === "positive" || spec.type === "size" || spec.type === "nodeSize";
|
|
1035
|
+
const numeric = spec.type === "zeroOne" || spec.type === "positive" || spec.type === "size" || spec.type === "signedSize" || spec.type === "nodeSize";
|
|
518
1036
|
if (spec.type !== "color" && !numeric) {
|
|
519
1037
|
return null;
|
|
520
1038
|
}
|
|
@@ -575,51 +1093,71 @@ function applyCyjsMapper(spec, m, data) {
|
|
|
575
1093
|
}
|
|
576
1094
|
return null;
|
|
577
1095
|
}
|
|
1096
|
+
function colorNeutral(v, site) {
|
|
1097
|
+
if (v.rgb.some((c) => !Number.isFinite(c) || c < 0 || c > 255)) {
|
|
1098
|
+
site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
|
|
1099
|
+
sample: v.str,
|
|
1100
|
+
element: site.element
|
|
1101
|
+
});
|
|
1102
|
+
return void 0;
|
|
1103
|
+
}
|
|
1104
|
+
return `#${v.rgb.map((c) => Math.round(c).toString(16).padStart(2, "0")).join("")}`;
|
|
1105
|
+
}
|
|
578
1106
|
function cyjsNeutral(spec, v, site) {
|
|
579
1107
|
switch (v.kind) {
|
|
580
|
-
case "color":
|
|
581
|
-
|
|
582
|
-
site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
|
|
583
|
-
sample: v.str,
|
|
584
|
-
element: site.element
|
|
585
|
-
});
|
|
586
|
-
return void 0;
|
|
587
|
-
}
|
|
588
|
-
return `#${v.rgb.map((c) => Math.round(c).toString(16).padStart(2, "0")).join("")}`;
|
|
589
|
-
}
|
|
1108
|
+
case "color":
|
|
1109
|
+
return colorNeutral(v, site);
|
|
590
1110
|
case "number":
|
|
591
|
-
|
|
592
|
-
site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
|
|
593
|
-
sample: v.str,
|
|
594
|
-
element: site.element
|
|
595
|
-
});
|
|
596
|
-
return void 0;
|
|
597
|
-
}
|
|
598
|
-
return num6(v.value);
|
|
1111
|
+
return num6((HALVED.has(spec.property) ? v.value / 2 : v.value) * (v.units === "em" ? EM_PX : 1));
|
|
599
1112
|
}
|
|
600
1113
|
const word = v.value;
|
|
601
1114
|
switch (spec.property) {
|
|
602
1115
|
case "width":
|
|
603
1116
|
case "height":
|
|
604
|
-
|
|
1117
|
+
if (site.target === "edge") {
|
|
1118
|
+
site.notes.add(STYLE_ISSUE.BAD_VALUE, site.target, site.property, {
|
|
1119
|
+
sample: v.str,
|
|
1120
|
+
element: site.element
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
605
1123
|
return void 0;
|
|
606
1124
|
case "label":
|
|
607
1125
|
case "sourceLabel":
|
|
608
1126
|
case "targetLabel":
|
|
609
1127
|
case "labelFont":
|
|
610
1128
|
return String(word);
|
|
1129
|
+
case "gradientKind":
|
|
1130
|
+
return GRADIENT_KINDS.get(String(word)) ?? void 0;
|
|
1131
|
+
case "gradientColors":
|
|
1132
|
+
return gradientColors(String(word), site);
|
|
1133
|
+
case "gradientStops":
|
|
1134
|
+
return gradientStops(String(word));
|
|
611
1135
|
case "labelItalic":
|
|
612
1136
|
return word === "italic" || word === "oblique";
|
|
613
1137
|
case "curved":
|
|
614
1138
|
return !STRAIGHT.has(String(word));
|
|
615
|
-
case "
|
|
1139
|
+
case "shapePoints":
|
|
1140
|
+
return cyjsPointsToNeutral(String(word)) ?? void 0;
|
|
1141
|
+
case "underlayShape":
|
|
1142
|
+
case "overlayShape":
|
|
616
1143
|
return canonEnum("shape", String(word), "cytoscape-js", site) ?? void 0;
|
|
1144
|
+
case "shape": {
|
|
1145
|
+
const polygon = String(word).toLowerCase();
|
|
1146
|
+
if (polygon === "polygon") {
|
|
1147
|
+
return "polygon";
|
|
1148
|
+
}
|
|
1149
|
+
return CYJS_POLYGON_SHAPES.has(polygon) || CYJS_ROUND_SHAPES.has(polygon) ? `other:${polygon}` : canonEnum("shape", String(word), "cytoscape-js", site) ?? void 0;
|
|
1150
|
+
}
|
|
617
1151
|
case "borderStyle":
|
|
618
1152
|
return canonEnum("borderStyle", String(word), "cytoscape-js", site) ?? void 0;
|
|
1153
|
+
case "outerBorderStyle":
|
|
1154
|
+
return word === "double" ? "solid" : canonEnum("borderStyle", String(word), "cytoscape-js", site) ?? void 0;
|
|
619
1155
|
case "lineStyle":
|
|
620
1156
|
return canonEnum("lineStyle", String(word), "cytoscape-js", site) ?? void 0;
|
|
621
1157
|
case "sourceArrow":
|
|
622
1158
|
case "targetArrow":
|
|
1159
|
+
case "midSourceArrow":
|
|
1160
|
+
case "midTargetArrow":
|
|
623
1161
|
return canonEnum("arrow", String(word), "cytoscape-js", site) ?? void 0;
|
|
624
1162
|
case "labelWeight":
|
|
625
1163
|
return canonEnum("weight", String(word), "cytoscape-js", site) ?? void 0;
|
|
@@ -638,6 +1176,236 @@ function cyjsRendered(target, name, str, site) {
|
|
|
638
1176
|
}
|
|
639
1177
|
return cyjsNeutral(spec, v, site);
|
|
640
1178
|
}
|
|
1179
|
+
function cyjsDashLook(dash, width, cap) {
|
|
1180
|
+
const pairs = dash.length % 2 === 1 ? [...dash, ...dash] : [...dash];
|
|
1181
|
+
const grow = cap === "butt" ? 0 : width;
|
|
1182
|
+
const on = pairs.filter((_, i) => i % 2 === 0).map((d) => Math.max(0, d) + grow);
|
|
1183
|
+
const off = pairs.filter((_, i) => i % 2 === 1).map((d) => Math.max(0, d - grow));
|
|
1184
|
+
const sum = (xs) => xs.reduce((a, b) => a + b, 0);
|
|
1185
|
+
if (sum(off) <= 0.1 * (sum(on) + sum(off))) {
|
|
1186
|
+
return "solid";
|
|
1187
|
+
}
|
|
1188
|
+
if (on.every((d) => d <= Math.max(1, width) * 1.5)) {
|
|
1189
|
+
return "dotted";
|
|
1190
|
+
}
|
|
1191
|
+
return Math.max(...on) >= 2 * Math.min(...on) ? "dash-dot" : "dashed";
|
|
1192
|
+
}
|
|
1193
|
+
function lengths(text2) {
|
|
1194
|
+
const out = text2.trim().split(/\s+/).map((t) => Number.parseFloat(t));
|
|
1195
|
+
return out.every((n) => Number.isFinite(n)) ? out : [];
|
|
1196
|
+
}
|
|
1197
|
+
function radians(text2) {
|
|
1198
|
+
const t = text2.trim();
|
|
1199
|
+
const x = Number.parseFloat(t);
|
|
1200
|
+
return t.endsWith("deg") ? x * Math.PI / 180 : x;
|
|
1201
|
+
}
|
|
1202
|
+
function outlinePoint(node, toward) {
|
|
1203
|
+
const [cx, cy] = node.center;
|
|
1204
|
+
const dx = toward[0] - cx;
|
|
1205
|
+
const dy = toward[1] - cy;
|
|
1206
|
+
const [hw, hh] = [node.size[0] / 2, node.size[1] / 2];
|
|
1207
|
+
if (dx === 0 && dy === 0 || hw <= 0 || hh <= 0) {
|
|
1208
|
+
return node.center;
|
|
1209
|
+
}
|
|
1210
|
+
const t = node.ellipse ? 1 / Math.hypot(dx / hw, dy / hh) : Math.min(axisReach(dx, hw), axisReach(dy, hh));
|
|
1211
|
+
return [cx + dx * t, cy + dy * t];
|
|
1212
|
+
}
|
|
1213
|
+
function axisReach(d, half) {
|
|
1214
|
+
return d === 0 ? Infinity : half / Math.abs(d);
|
|
1215
|
+
}
|
|
1216
|
+
function measureLine(edge, src, tgt) {
|
|
1217
|
+
const a0 = outlinePoint(src, tgt.center);
|
|
1218
|
+
const b0 = outlinePoint(tgt, src.center);
|
|
1219
|
+
const dx = b0[0] - a0[0];
|
|
1220
|
+
const dy = b0[1] - a0[1];
|
|
1221
|
+
const l = Math.hypot(dx, dy) || 1;
|
|
1222
|
+
const normal = [-dy / l, dx / l];
|
|
1223
|
+
return edge.edgeDistances === "node-position" ? { a: src.center, b: tgt.center, normal } : { a: a0, b: b0, normal };
|
|
1224
|
+
}
|
|
1225
|
+
function offsetPoints(line, weights, distances) {
|
|
1226
|
+
const n = Math.min(weights.length, distances.length);
|
|
1227
|
+
return Array.from({ length: n }, (_, s) => {
|
|
1228
|
+
const w = weights[s];
|
|
1229
|
+
const d = distances[s];
|
|
1230
|
+
return [
|
|
1231
|
+
line.a[0] * (1 - w) + line.b[0] * w + line.normal[0] * d,
|
|
1232
|
+
line.a[1] * (1 - w) + line.b[1] * w + line.normal[1] * d
|
|
1233
|
+
];
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
function taxiPoints(edge, src, tgt) {
|
|
1237
|
+
const body = edge.edgeDistances !== "node-position";
|
|
1238
|
+
const [x1, y1] = src.center;
|
|
1239
|
+
const [x2, y2] = tgt.center;
|
|
1240
|
+
const [srcW, srcH] = src.size;
|
|
1241
|
+
const [tgtW, tgtH] = tgt.size;
|
|
1242
|
+
const pdx = x2 - x1;
|
|
1243
|
+
const pdy = y2 - y1;
|
|
1244
|
+
const dx = towardZero(pdx, body ? (srcW + tgtW) / 2 : 0);
|
|
1245
|
+
const dy = towardZero(pdy, body ? (srcH + tgtH) / 2 : 0);
|
|
1246
|
+
const raw = edge.taxiDirection ?? "auto";
|
|
1247
|
+
const vertical = raw === "auto" ? Math.abs(dx) <= Math.abs(dy) : raw === "vertical" || raw === "upward" || raw === "downward";
|
|
1248
|
+
const [along, pl] = vertical ? [dy, pdy] : [dx, pdx];
|
|
1249
|
+
const { d, l, sgn, forced } = taxiTurn(edge, raw, along, pl);
|
|
1250
|
+
const minD = edge.taxiTurnMinDistance ?? 10;
|
|
1251
|
+
const tooClose = (v) => Math.abs(v) < minD || Math.abs(v) >= Math.abs(l);
|
|
1252
|
+
if ((tooClose(d) || tooClose(Math.abs(l) - Math.abs(d))) && !forced) {
|
|
1253
|
+
return taxiFallback(vertical, { x1, y1, x2, y2, pl, pdx, pdy }, src.size, tgt.size);
|
|
1254
|
+
}
|
|
1255
|
+
const srcAlong = vertical ? srcH : srcW;
|
|
1256
|
+
const out = body ? srcAlong / 2 * sgn : 0;
|
|
1257
|
+
if (vertical) {
|
|
1258
|
+
const y = y1 + d + out;
|
|
1259
|
+
return [
|
|
1260
|
+
[x1, y],
|
|
1261
|
+
[x2, y]
|
|
1262
|
+
];
|
|
1263
|
+
}
|
|
1264
|
+
const x = x1 + d + out;
|
|
1265
|
+
return [
|
|
1266
|
+
[x, y1],
|
|
1267
|
+
[x, y2]
|
|
1268
|
+
];
|
|
1269
|
+
}
|
|
1270
|
+
function towardZero(v, gap) {
|
|
1271
|
+
return v > 0 ? Math.max(v - gap, 0) : Math.min(v + gap, 0);
|
|
1272
|
+
}
|
|
1273
|
+
function taxiTurn(edge, raw, along, pl) {
|
|
1274
|
+
const explicit = raw !== "auto" && raw !== "vertical" && raw !== "horizontal";
|
|
1275
|
+
const turnText = (edge.taxiTurn ?? "50%").trim();
|
|
1276
|
+
const percent = turnText.endsWith("%");
|
|
1277
|
+
const turn = percent ? Number.parseFloat(turnText) / 100 : Number.parseFloat(turnText);
|
|
1278
|
+
const forced = !(explicit && (percent || turn < 0)) && runsAgainst(raw, pl);
|
|
1279
|
+
const sgn = forced ? -Math.sign(pl) : Math.sign(pl);
|
|
1280
|
+
const l = forced ? sgn * Math.abs(along) : along;
|
|
1281
|
+
if (percent) {
|
|
1282
|
+
return { d: (turn < 0 ? 1 + turn : turn) * l, l, sgn, forced };
|
|
1283
|
+
}
|
|
1284
|
+
return { d: (turn < 0 ? l : 0) + turn * sgn, l, sgn, forced };
|
|
1285
|
+
}
|
|
1286
|
+
function runsAgainst(raw, pl) {
|
|
1287
|
+
return raw === "downward" && pl < 0 || raw === "upward" && pl > 0 || raw === "leftward" && pl > 0 || raw === "rightward" && pl < 0;
|
|
1288
|
+
}
|
|
1289
|
+
function taxiFallback(vertical, p, srcSize, tgtSize) {
|
|
1290
|
+
const { x1, y1, x2, y2, pl, pdx, pdy } = p;
|
|
1291
|
+
const midX = (x1 + x2) / 2;
|
|
1292
|
+
const midY = (y1 + y2) / 2;
|
|
1293
|
+
if (vertical) {
|
|
1294
|
+
if (Math.abs(pl) <= srcSize[1] / 2) {
|
|
1295
|
+
return [
|
|
1296
|
+
[midX, y1],
|
|
1297
|
+
[midX, y2]
|
|
1298
|
+
];
|
|
1299
|
+
}
|
|
1300
|
+
if (Math.abs(pdx) <= tgtSize[0] / 2) {
|
|
1301
|
+
return [
|
|
1302
|
+
[x1, midY],
|
|
1303
|
+
[x2, midY]
|
|
1304
|
+
];
|
|
1305
|
+
}
|
|
1306
|
+
return [[x1, y2]];
|
|
1307
|
+
}
|
|
1308
|
+
if (Math.abs(pl) <= srcSize[0] / 2) {
|
|
1309
|
+
return [
|
|
1310
|
+
[x1, midY],
|
|
1311
|
+
[x2, midY]
|
|
1312
|
+
];
|
|
1313
|
+
}
|
|
1314
|
+
if (Math.abs(pdy) <= tgtSize[1] / 2) {
|
|
1315
|
+
return [
|
|
1316
|
+
[midX, y1],
|
|
1317
|
+
[midX, y2]
|
|
1318
|
+
];
|
|
1319
|
+
}
|
|
1320
|
+
return [[x2, y1]];
|
|
1321
|
+
}
|
|
1322
|
+
function splinePoints(src, tgt, controls) {
|
|
1323
|
+
const start = outlinePoint(src, controls[0]);
|
|
1324
|
+
const end = outlinePoint(tgt, controls.at(-1) ?? tgt.center);
|
|
1325
|
+
return flattenQuadSpline([start, ...controls, end], 0).slice(1, -1);
|
|
1326
|
+
}
|
|
1327
|
+
function cyjsRoute(edge, src, tgt, loopIndex) {
|
|
1328
|
+
const style = edge.curveStyle;
|
|
1329
|
+
if (style === "haystack") {
|
|
1330
|
+
return null;
|
|
1331
|
+
}
|
|
1332
|
+
if (src === tgt) {
|
|
1333
|
+
return loopRoute(edge, src, loopIndex);
|
|
1334
|
+
}
|
|
1335
|
+
let points = [];
|
|
1336
|
+
if (style.endsWith("segments")) {
|
|
1337
|
+
const distances = lengths(edge.segmentDistances ?? "20");
|
|
1338
|
+
const weights = lengths(edge.segmentWeights ?? "0.5");
|
|
1339
|
+
points = offsetPoints(measureLine(edge, src, tgt), weights, distances);
|
|
1340
|
+
} else if (style.endsWith("taxi")) {
|
|
1341
|
+
points = taxiPoints(edge, src, tgt);
|
|
1342
|
+
} else if (style === "unbundled-bezier") {
|
|
1343
|
+
const distances = lengths(edge.controlPointDistances ?? String(edge.controlPointStepSize ?? 40));
|
|
1344
|
+
const weights = lengths(edge.controlPointWeights ?? "0.5");
|
|
1345
|
+
const controls = offsetPoints(measureLine(edge, src, tgt), weights, distances);
|
|
1346
|
+
points = controls.length === 0 ? [] : splinePoints(src, tgt, controls);
|
|
1347
|
+
}
|
|
1348
|
+
if (points.length > 0 && style.startsWith("round-")) {
|
|
1349
|
+
const radii = lengths((style === "round-taxi" ? edge.taxiRadius : edge.segmentRadii) ?? "15");
|
|
1350
|
+
const types = (edge.radiusType ?? "arc-radius").trim().split(/\s+/);
|
|
1351
|
+
const start = outlinePoint(src, points[0]);
|
|
1352
|
+
const end = outlinePoint(tgt, points.at(-1) ?? tgt.center);
|
|
1353
|
+
points = roundedCorners([start, ...points, end], radii, types).slice(1, -1);
|
|
1354
|
+
}
|
|
1355
|
+
return points.length === 0 ? null : canonBends(src.center, tgt.center, points, true);
|
|
1356
|
+
}
|
|
1357
|
+
const ARC_STEPS = 8;
|
|
1358
|
+
function roundedCorners(line, radii, types) {
|
|
1359
|
+
const out = [line[0]];
|
|
1360
|
+
for (let i = 1; i < line.length - 1; i++) {
|
|
1361
|
+
const [p, a, b] = [line[i], line[i - 1], line[i + 1]];
|
|
1362
|
+
const r = radii[Math.min(i - 1, radii.length - 1)] ?? 15;
|
|
1363
|
+
const arc = (types[Math.min(i - 1, types.length - 1)] ?? "arc-radius") !== "influence-radius";
|
|
1364
|
+
const l1 = Math.hypot(a[0] - p[0], a[1] - p[1]);
|
|
1365
|
+
const l2 = Math.hypot(b[0] - p[0], b[1] - p[1]);
|
|
1366
|
+
const u1 = [(a[0] - p[0]) / l1, (a[1] - p[1]) / l1];
|
|
1367
|
+
const u2 = [(b[0] - p[0]) / l2, (b[1] - p[1]) / l2];
|
|
1368
|
+
const angle = Math.acos(Math.max(-1, Math.min(1, u1[0] * u2[0] + u1[1] * u2[1])));
|
|
1369
|
+
const half = angle / 2;
|
|
1370
|
+
const rounds = r > 0 && l1 > 0 && l2 > 0;
|
|
1371
|
+
if (!rounds || Math.abs(Math.PI - angle) < 1e-6) {
|
|
1372
|
+
out.push(p);
|
|
1373
|
+
continue;
|
|
1374
|
+
}
|
|
1375
|
+
const limit = Math.min(l1 / 2, l2 / 2);
|
|
1376
|
+
const back = Math.min(limit, arc ? r / Math.tan(half) : r);
|
|
1377
|
+
const radius = back * Math.tan(half);
|
|
1378
|
+
const bis = [u1[0] + u2[0], u1[1] + u2[1]];
|
|
1379
|
+
const bl = Math.hypot(bis[0], bis[1]);
|
|
1380
|
+
const reach = Math.hypot(back, radius);
|
|
1381
|
+
const c = [p[0] + bis[0] / bl * reach, p[1] + bis[1] / bl * reach];
|
|
1382
|
+
const from = Math.atan2(p[1] + u1[1] * back - c[1], p[0] + u1[0] * back - c[0]);
|
|
1383
|
+
const to = Math.atan2(p[1] + u2[1] * back - c[1], p[0] + u2[0] * back - c[0]);
|
|
1384
|
+
let sweep = to - from;
|
|
1385
|
+
sweep -= 2 * Math.PI * Math.round(sweep / (2 * Math.PI));
|
|
1386
|
+
for (let k = 0; k <= ARC_STEPS; k++) {
|
|
1387
|
+
const t = from + sweep * k / ARC_STEPS;
|
|
1388
|
+
out.push([c[0] + Math.cos(t) * radius, c[1] + Math.sin(t) * radius]);
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
out.push(line.at(-1) ?? line[0]);
|
|
1392
|
+
return out;
|
|
1393
|
+
}
|
|
1394
|
+
function loopRoute(edge, node, loopIndex) {
|
|
1395
|
+
const unbundled = edge.curveStyle === "unbundled-bezier";
|
|
1396
|
+
const dist = unbundled ? lengths(edge.controlPointDistances ?? "").at(0) ?? Number.NaN : edge.controlPointStepSize ?? 40;
|
|
1397
|
+
const dir = radians(edge.loopDirection ?? "-45deg");
|
|
1398
|
+
const sweep = radians(edge.loopSweep ?? "-90deg");
|
|
1399
|
+
if (!Number.isFinite(dist + dir + sweep)) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
const angle = dir - Math.PI / 2;
|
|
1403
|
+
const reach = 1.4 * dist * (loopIndex / 3 + 1);
|
|
1404
|
+
const [cx, cy] = node.center;
|
|
1405
|
+
const at = (a) => [cx + Math.cos(a) * reach, cy + Math.sin(a) * reach];
|
|
1406
|
+
const points = splinePoints(node, node, [at(angle - sweep / 2), at(angle + sweep / 2)]);
|
|
1407
|
+
return canonNodeOffsets(node.center, node.box, points, true);
|
|
1408
|
+
}
|
|
641
1409
|
const CYJS_STATES = /* @__PURE__ */ new Set([
|
|
642
1410
|
"selected",
|
|
643
1411
|
"unselected",
|
|
@@ -684,8 +1452,8 @@ function isSpace(c) {
|
|
|
684
1452
|
return c !== void 0 && /\s/.test(c);
|
|
685
1453
|
}
|
|
686
1454
|
class Cursor {
|
|
687
|
-
constructor(
|
|
688
|
-
this.text =
|
|
1455
|
+
constructor(text2) {
|
|
1456
|
+
this.text = text2;
|
|
689
1457
|
this.pos = 0;
|
|
690
1458
|
}
|
|
691
1459
|
/**
|
|
@@ -828,8 +1596,8 @@ function cleanMeta(raw) {
|
|
|
828
1596
|
}
|
|
829
1597
|
return out;
|
|
830
1598
|
}
|
|
831
|
-
function splitOp(
|
|
832
|
-
let op =
|
|
1599
|
+
function splitOp(text2) {
|
|
1600
|
+
let op = text2;
|
|
833
1601
|
let not = false;
|
|
834
1602
|
let ci = false;
|
|
835
1603
|
if (op.includes("!")) {
|
|
@@ -1066,17 +1834,17 @@ function metaToken(c, i) {
|
|
|
1066
1834
|
const { op: base, not, ci } = splitOp(op.text);
|
|
1067
1835
|
return checkToken(c.spaceEnd(end) + 2, { type: "meta", field, op: base, not, ci, value });
|
|
1068
1836
|
}
|
|
1069
|
-
function isBlank(
|
|
1070
|
-
return /^\s*$/.test(
|
|
1837
|
+
function isBlank(text2) {
|
|
1838
|
+
return /^\s*$/.test(text2.length > 1024 ? text2.slice(0, 1024) : text2) && text2.trim() === "";
|
|
1071
1839
|
}
|
|
1072
|
-
function parseCyjsSelector(
|
|
1073
|
-
if (typeof
|
|
1840
|
+
function parseCyjsSelector(text2) {
|
|
1841
|
+
if (typeof text2 !== "string" || isBlank(text2)) {
|
|
1074
1842
|
return { queries: [], invalid: false };
|
|
1075
1843
|
}
|
|
1076
|
-
if (
|
|
1844
|
+
if (text2.length > MAX_SELECTOR_LENGTH) {
|
|
1077
1845
|
return { queries: [], invalid: true };
|
|
1078
1846
|
}
|
|
1079
|
-
const c = new Cursor(
|
|
1847
|
+
const c = new Cursor(text2);
|
|
1080
1848
|
const first = { checks: [] };
|
|
1081
1849
|
const b = { queries: [first], subject: null, edgeCount: 0, compoundCount: 0, counts: [] };
|
|
1082
1850
|
let current = first;
|
|
@@ -1094,7 +1862,7 @@ function parseCyjsSelector(text) {
|
|
|
1094
1862
|
current = next;
|
|
1095
1863
|
}
|
|
1096
1864
|
c.pos = tok.end;
|
|
1097
|
-
if (c.spaceEnd(c.pos) >=
|
|
1865
|
+
if (c.spaceEnd(c.pos) >= text2.length) {
|
|
1098
1866
|
break;
|
|
1099
1867
|
}
|
|
1100
1868
|
}
|
|
@@ -1104,22 +1872,22 @@ function parseCyjsSelector(text) {
|
|
|
1104
1872
|
}
|
|
1105
1873
|
const LINE = /[\n\r\u2028\u2029]/;
|
|
1106
1874
|
const SPACE = /\s/;
|
|
1107
|
-
function stripComments(
|
|
1875
|
+
function stripComments(text2) {
|
|
1108
1876
|
let out = "";
|
|
1109
1877
|
let from = 0;
|
|
1110
1878
|
for (; ; ) {
|
|
1111
|
-
const open =
|
|
1879
|
+
const open = text2.indexOf("/*", from);
|
|
1112
1880
|
if (open < 0) {
|
|
1113
1881
|
break;
|
|
1114
1882
|
}
|
|
1115
|
-
const close =
|
|
1883
|
+
const close = text2.indexOf("*/", open + 3);
|
|
1116
1884
|
if (close < 0) {
|
|
1117
1885
|
break;
|
|
1118
1886
|
}
|
|
1119
|
-
out +=
|
|
1887
|
+
out += text2.slice(from, open);
|
|
1120
1888
|
from = close + 2;
|
|
1121
1889
|
}
|
|
1122
|
-
return out +
|
|
1890
|
+
return out + text2.slice(from);
|
|
1123
1891
|
}
|
|
1124
1892
|
function skipSpace(s, i) {
|
|
1125
1893
|
let j = i;
|
|
@@ -1176,8 +1944,8 @@ function nextNonSpace(s) {
|
|
|
1176
1944
|
}
|
|
1177
1945
|
return next;
|
|
1178
1946
|
}
|
|
1179
|
-
function parseCyjsStylesheetText(
|
|
1180
|
-
const s = stripComments(
|
|
1947
|
+
function parseCyjsStylesheetText(text2) {
|
|
1948
|
+
const s = stripComments(text2);
|
|
1181
1949
|
const entries = [];
|
|
1182
1950
|
let pos = 0;
|
|
1183
1951
|
while (skipSpace(s, pos) < s.length) {
|
|
@@ -1278,14 +2046,14 @@ function parentsOf(nodes, ids) {
|
|
|
1278
2046
|
if (raw === void 0 || raw === null) {
|
|
1279
2047
|
continue;
|
|
1280
2048
|
}
|
|
1281
|
-
const
|
|
1282
|
-
const p = typeof
|
|
2049
|
+
const text2 = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
|
|
2050
|
+
const p = typeof text2 === "string" ? ids.get(text2) : void 0;
|
|
1283
2051
|
if (p === void 0 || p < 0) {
|
|
1284
2052
|
nodes[i].overrides.set("parent", void 0);
|
|
1285
2053
|
continue;
|
|
1286
2054
|
}
|
|
1287
2055
|
if (typeof raw === "number") {
|
|
1288
|
-
nodes[i].overrides.set("parent",
|
|
2056
|
+
nodes[i].overrides.set("parent", text2);
|
|
1289
2057
|
}
|
|
1290
2058
|
if (rootOf(p) === i) {
|
|
1291
2059
|
nodes[i].overrides.set("parent", void 0);
|
|
@@ -1409,11 +2177,11 @@ function edgeEnds(e, ids, overrides) {
|
|
|
1409
2177
|
const ends = [];
|
|
1410
2178
|
for (const field of ["source", "target"]) {
|
|
1411
2179
|
const raw = e.data[field];
|
|
1412
|
-
const
|
|
2180
|
+
const text2 = typeof raw === "number" && !Number.isNaN(raw) ? String(raw) : raw;
|
|
1413
2181
|
if (typeof raw === "number") {
|
|
1414
|
-
overrides.set(field,
|
|
2182
|
+
overrides.set(field, text2);
|
|
1415
2183
|
}
|
|
1416
|
-
const at = typeof
|
|
2184
|
+
const at = typeof text2 === "string" ? ids.get(text2) : void 0;
|
|
1417
2185
|
if (at !== void 0) {
|
|
1418
2186
|
ends.push(at);
|
|
1419
2187
|
}
|
|
@@ -1967,6 +2735,16 @@ const POSITIONS = /* @__PURE__ */ new Map([
|
|
|
1967
2735
|
["bottom,center", "bottom"],
|
|
1968
2736
|
["bottom,right", "bottom-right"]
|
|
1969
2737
|
]);
|
|
2738
|
+
const INSIDE_POSITIONS = /* @__PURE__ */ new Map([
|
|
2739
|
+
["top,left", "inside-top-left"],
|
|
2740
|
+
["top,center", "inside-top"],
|
|
2741
|
+
["top,right", "inside-top-right"],
|
|
2742
|
+
["center,left", "inside-left"],
|
|
2743
|
+
["center,right", "inside-right"],
|
|
2744
|
+
["bottom,left", "inside-bottom-left"],
|
|
2745
|
+
["bottom,center", "inside-bottom"],
|
|
2746
|
+
["bottom,right", "inside-bottom-right"]
|
|
2747
|
+
]);
|
|
1970
2748
|
function evaluateCytoscapeJs(input) {
|
|
1971
2749
|
const notes = input.notes ?? new StyleNotes();
|
|
1972
2750
|
const budget = input.budget ?? new StyleBudget();
|
|
@@ -2012,8 +2790,8 @@ function evaluateCytoscapeJs(input) {
|
|
|
2012
2790
|
notes.add(STYLE_ISSUE.SELECTOR, null, "selector", { count: deep, sample: "nested too deep" });
|
|
2013
2791
|
}
|
|
2014
2792
|
const matcher = new Matcher(graph, notes);
|
|
2015
|
-
const node = evaluateTarget("node", graph, sheet, matcher, input, notes, budget);
|
|
2016
|
-
const edge = evaluateTarget("edge", graph, sheet, matcher, input, notes, budget);
|
|
2793
|
+
const node = evaluateTarget("node", graph, sheet, matcher, input, { notes, budget, nodes: null });
|
|
2794
|
+
const edge = evaluateTarget("edge", graph, sheet, matcher, input, { notes, budget, nodes: node });
|
|
2017
2795
|
return { node, edge, graph };
|
|
2018
2796
|
}
|
|
2019
2797
|
function outputOrder(kind, graph, snapshot, notes) {
|
|
@@ -2065,7 +2843,8 @@ function cellsOf(cells, name, n) {
|
|
|
2065
2843
|
}
|
|
2066
2844
|
return c;
|
|
2067
2845
|
}
|
|
2068
|
-
function evaluateTarget(kind, graph, sheet, matcher, input,
|
|
2846
|
+
function evaluateTarget(kind, graph, sheet, matcher, input, env) {
|
|
2847
|
+
const { notes, budget } = env;
|
|
2069
2848
|
const els = kind === "node" ? graph.nodes : graph.edges;
|
|
2070
2849
|
const spend = (ops) => {
|
|
2071
2850
|
budget.spend(kind, ops);
|
|
@@ -2083,6 +2862,19 @@ function evaluateTarget(kind, graph, sheet, matcher, input, notes, budget) {
|
|
|
2083
2862
|
forceLoopCurves(graph, cells.get("curve-style"));
|
|
2084
2863
|
}
|
|
2085
2864
|
const drawn = drawnValues(kind, els, cells, order, input.rendered, notes, spend);
|
|
2865
|
+
if (kind === "edge" && input.toolDefaults !== false) {
|
|
2866
|
+
const read = { kind, els, cells, order, rendered: input.rendered, notes };
|
|
2867
|
+
const curves = drawnColumn(read, "curve-style", CURVE_PART);
|
|
2868
|
+
noArrowsOnHaystacks(curves, drawn);
|
|
2869
|
+
if (env.nodes !== null) {
|
|
2870
|
+
edgeRoutes(graph, read, curves, env.nodes, drawn);
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
if (kind === "node") {
|
|
2874
|
+
const read = { kind, els, cells, order, rendered: input.rendered, notes };
|
|
2875
|
+
nodeSizes(graph, read, drawn);
|
|
2876
|
+
mixedLabelPlaces(graph, read, drawn);
|
|
2877
|
+
}
|
|
2086
2878
|
if (kind === "edge") {
|
|
2087
2879
|
straightenUnpairedBeziers(graph, curveStyles(graph, cells, input.rendered), coreToOut, drawn.curved);
|
|
2088
2880
|
}
|
|
@@ -2187,7 +2979,7 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
|
|
|
2187
2979
|
if (spec.property.startsWith("_")) {
|
|
2188
2980
|
words.set(
|
|
2189
2981
|
spec.property,
|
|
2190
|
-
col.map((v) => typeof v === "string" ? v : null)
|
|
2982
|
+
col.map((v) => typeof v === "string" || typeof v === "number" ? String(v) : null)
|
|
2191
2983
|
);
|
|
2192
2984
|
continue;
|
|
2193
2985
|
}
|
|
@@ -2200,6 +2992,9 @@ function drawnValues(kind, els, cells, order, rendered, notes, spend) {
|
|
|
2200
2992
|
});
|
|
2201
2993
|
}
|
|
2202
2994
|
combineParts(kind, out, words, values, notes);
|
|
2995
|
+
if (kind === "node") {
|
|
2996
|
+
cyjsPolygonShapes(values);
|
|
2997
|
+
}
|
|
2203
2998
|
const drawn = {};
|
|
2204
2999
|
for (const [p, col] of Object.entries(values)) {
|
|
2205
3000
|
if (col.some((v) => v !== null)) {
|
|
@@ -2289,7 +3084,7 @@ function forceLoopCurves(graph, col) {
|
|
|
2289
3084
|
function entryProperties(entry, kind, specs, notes, notCarried) {
|
|
2290
3085
|
const out = [];
|
|
2291
3086
|
for (const [name0, value] of entry.properties) {
|
|
2292
|
-
const name = entry.dashOnly ?
|
|
3087
|
+
const name = entry.dashOnly ? cyjsAliasOf(name0) : cyjsPropertyName(name0);
|
|
2293
3088
|
const spec = specs.get(name);
|
|
2294
3089
|
if (spec === void 0) {
|
|
2295
3090
|
if (kind === "node" && !CYJS_EDGE_ONLY.has(name) && !entry.tool) {
|
|
@@ -2308,20 +3103,36 @@ function entryProperties(entry, kind, specs, notes, notCarried) {
|
|
|
2308
3103
|
}
|
|
2309
3104
|
return out;
|
|
2310
3105
|
}
|
|
2311
|
-
function dashOnlyName(name) {
|
|
2312
|
-
return name === "content" ? "label" : name;
|
|
2313
|
-
}
|
|
2314
3106
|
const CYJS_EDGE_ONLY = /* @__PURE__ */ new Set([
|
|
2315
3107
|
"line-color",
|
|
2316
3108
|
"line-style",
|
|
3109
|
+
"line-outline-width",
|
|
3110
|
+
"line-outline-color",
|
|
3111
|
+
"line-fill",
|
|
3112
|
+
"line-gradient-stop-colors",
|
|
3113
|
+
"line-gradient-stop-positions",
|
|
2317
3114
|
"target-arrow-shape",
|
|
2318
3115
|
"source-arrow-shape",
|
|
2319
3116
|
"target-arrow-color",
|
|
2320
3117
|
"source-arrow-color",
|
|
3118
|
+
"mid-target-arrow-shape",
|
|
3119
|
+
"mid-source-arrow-shape",
|
|
3120
|
+
"mid-target-arrow-color",
|
|
3121
|
+
"mid-source-arrow-color",
|
|
3122
|
+
"target-arrow-fill",
|
|
3123
|
+
"source-arrow-fill",
|
|
2321
3124
|
"curve-style",
|
|
2322
3125
|
"arrow-scale",
|
|
2323
3126
|
"source-label",
|
|
2324
|
-
"target-label"
|
|
3127
|
+
"target-label",
|
|
3128
|
+
"source-text-offset",
|
|
3129
|
+
"target-text-offset",
|
|
3130
|
+
"source-text-margin-x",
|
|
3131
|
+
"source-text-margin-y",
|
|
3132
|
+
"target-text-margin-x",
|
|
3133
|
+
"target-text-margin-y",
|
|
3134
|
+
"source-text-rotation",
|
|
3135
|
+
"target-text-rotation"
|
|
2325
3136
|
]);
|
|
2326
3137
|
function matchList(sel, kind, n, matcher, ix) {
|
|
2327
3138
|
if (sel.queries.length === 0) {
|
|
@@ -2402,39 +3213,676 @@ function neutralOfCell(spec, name, c, site) {
|
|
|
2402
3213
|
return cyjsNeutral(spec, flat, site);
|
|
2403
3214
|
}
|
|
2404
3215
|
function combineParts(kind, n, words, values, notes) {
|
|
3216
|
+
const whole = [...values.opacity ?? new Array(n).fill(null)];
|
|
3217
|
+
combineLabelOpacity(n, words, values);
|
|
3218
|
+
if (kind === "node") {
|
|
3219
|
+
combineNodeOpacity(n, words, values);
|
|
3220
|
+
}
|
|
2405
3221
|
const va = words.get("_valign");
|
|
2406
3222
|
const ha = words.get("_halign");
|
|
2407
3223
|
if (kind === "node" && (va !== void 0 || ha !== void 0)) {
|
|
2408
|
-
values.labelPosition = Array.from(
|
|
3224
|
+
values.labelPosition = Array.from({ length: n }, (_, i) => labelPosition(va?.[i] ?? null, ha?.[i] ?? null));
|
|
3225
|
+
}
|
|
3226
|
+
const wrap = words.get("_wrap");
|
|
3227
|
+
const maxWidth = words.get("_maxWidth");
|
|
3228
|
+
const overflow = words.get("_overflowWrap");
|
|
3229
|
+
if (wrap !== void 0) {
|
|
3230
|
+
const cut = (i) => wrap[i] === "wrap" || wrap[i] === "ellipsis";
|
|
3231
|
+
values.labelWrapWidth = Array.from(
|
|
2409
3232
|
{ length: n },
|
|
2410
|
-
(_, i) =>
|
|
2411
|
-
notes.add(STYLE_ISSUE.UNKNOWN_VALUE, kind, "labelPosition", { sample, element: i });
|
|
2412
|
-
})
|
|
3233
|
+
(_, i) => cut(i) && typeof maxWidth?.[i] === "string" ? Number(maxWidth[i]) : null
|
|
2413
3234
|
);
|
|
3235
|
+
if (wrap.includes("ellipsis")) {
|
|
3236
|
+
values.labelWrapEllipsis = wrap.map((w) => w === "ellipsis" ? true : null);
|
|
3237
|
+
}
|
|
3238
|
+
if (overflow?.includes("anywhere") === true) {
|
|
3239
|
+
values.labelWrapAnywhere = wrap.map((w, i) => w === "wrap" && overflow[i] === "anywhere" ? true : null);
|
|
3240
|
+
}
|
|
3241
|
+
}
|
|
3242
|
+
if (kind === "node") {
|
|
3243
|
+
combineFace(n, words, values);
|
|
3244
|
+
combineBackgroundGradient(n, words, values, notes);
|
|
3245
|
+
} else {
|
|
3246
|
+
combineArrowFills(n, words, values, notes);
|
|
3247
|
+
combineLineOpacity(n, words.get("_lineOpacity"), values);
|
|
3248
|
+
}
|
|
3249
|
+
combineDashes(kind, n, words, values);
|
|
3250
|
+
combineLabelText(kind, n, words, values);
|
|
3251
|
+
combineLabelDress(kind, n, words, values, notes, whole);
|
|
3252
|
+
combineVisibility(kind, n, words, values);
|
|
3253
|
+
}
|
|
3254
|
+
function combineLabelOpacity(n, words, values) {
|
|
3255
|
+
const text2 = words.get("_textOpacity");
|
|
3256
|
+
const whole = values.opacity;
|
|
3257
|
+
if (text2 === void 0 && whole === void 0) {
|
|
3258
|
+
return;
|
|
3259
|
+
}
|
|
3260
|
+
const col = new Array(n).fill(null);
|
|
3261
|
+
for (let i = 0; i < n; i++) {
|
|
3262
|
+
const t = text2?.[i] ?? null;
|
|
3263
|
+
const o = whole?.[i];
|
|
3264
|
+
const v = Math.round((t === null ? 1 : Number(t)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
|
|
3265
|
+
col[i] = v === 1 || !Number.isFinite(v) ? null : v;
|
|
3266
|
+
}
|
|
3267
|
+
values.labelOpacity = col;
|
|
3268
|
+
}
|
|
3269
|
+
function combineNodeOpacity(n, words, values) {
|
|
3270
|
+
const whole = values.opacity;
|
|
3271
|
+
for (const [part, p] of [
|
|
3272
|
+
["_ringOpacity", "borderOpacity"],
|
|
3273
|
+
["_outlineRingOpacity", "outerBorderOpacity"]
|
|
3274
|
+
]) {
|
|
3275
|
+
const own = words.get(part);
|
|
3276
|
+
if (own === void 0 && whole === void 0) {
|
|
3277
|
+
continue;
|
|
3278
|
+
}
|
|
3279
|
+
values[p] = Array.from({ length: n }, (_, i) => {
|
|
3280
|
+
const a = own?.[i] ?? null;
|
|
3281
|
+
const o = whole?.[i];
|
|
3282
|
+
const v = Math.round((a === null ? 1 : Number(a)) * (typeof o === "number" ? o : 1) * 1e6) / 1e6;
|
|
3283
|
+
return v === 1 || !Number.isFinite(v) ? null : v;
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
function combineDashes(kind, n, words, values) {
|
|
3288
|
+
const lines = kind === "edge" ? [["lineStyle", "width", 3, "6 3", true]] : [
|
|
3289
|
+
["borderStyle", "borderWidth", 0, "4 2", true],
|
|
3290
|
+
["outerBorderStyle", "outerBorderWidth", 0, "4 2", false]
|
|
3291
|
+
];
|
|
3292
|
+
for (const [style, width, fallback, pattern, own] of lines) {
|
|
3293
|
+
const col = values[style];
|
|
3294
|
+
if (col !== void 0) {
|
|
3295
|
+
dashColumn(col, n, values[width], { fallback, pattern }, own ? words : null);
|
|
3296
|
+
}
|
|
2414
3297
|
}
|
|
3298
|
+
}
|
|
3299
|
+
function dashColumn(col, n, widths, drawn, words) {
|
|
3300
|
+
for (let i = 0; i < n; i++) {
|
|
3301
|
+
if (col[i] !== "dashed") {
|
|
3302
|
+
continue;
|
|
3303
|
+
}
|
|
3304
|
+
const w = widths?.[i];
|
|
3305
|
+
const look = dashedLook(words, i, drawn.pattern, typeof w === "number" ? w : drawn.fallback);
|
|
3306
|
+
if (look !== null) {
|
|
3307
|
+
col[i] = look;
|
|
3308
|
+
}
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
function dashedLook(words, i, pattern, width) {
|
|
3312
|
+
const dashes = (words?.get("_dashPattern")?.[i] ?? pattern).split(/[\s,[\]]+/).filter((t) => t !== "").map((t) => Number.parseFloat(t));
|
|
3313
|
+
if (dashes.length === 0 || !dashes.every((d) => Number.isFinite(d))) {
|
|
3314
|
+
return null;
|
|
3315
|
+
}
|
|
3316
|
+
return cyjsDashLook(dashes, width, words?.get("_dashCap")?.[i] ?? "butt");
|
|
3317
|
+
}
|
|
3318
|
+
function columnOf(values, property, n) {
|
|
3319
|
+
let column = values[property];
|
|
3320
|
+
if (column === void 0) {
|
|
3321
|
+
column = new Array(n).fill(null);
|
|
3322
|
+
values[property] = column;
|
|
3323
|
+
}
|
|
3324
|
+
return column;
|
|
3325
|
+
}
|
|
3326
|
+
function combineVisibility(kind, n, words, values) {
|
|
2415
3327
|
const vis = words.get("_visibility");
|
|
2416
3328
|
const disp = words.get("_display");
|
|
2417
|
-
if (vis
|
|
2418
|
-
|
|
3329
|
+
if (vis === void 0 && disp === void 0) {
|
|
3330
|
+
return;
|
|
3331
|
+
}
|
|
3332
|
+
const col = new Array(n).fill(null);
|
|
3333
|
+
for (let i = 0; i < n; i++) {
|
|
3334
|
+
const a = vis?.[i] ?? null;
|
|
3335
|
+
const b = disp?.[i] ?? null;
|
|
3336
|
+
if (a === null && b === null) {
|
|
3337
|
+
continue;
|
|
3338
|
+
}
|
|
3339
|
+
const keptInvisible = kind === "node" && a === "hidden" && b !== "none";
|
|
3340
|
+
col[i] = keptInvisible || a !== "hidden" && b !== "none";
|
|
3341
|
+
if (keptInvisible) {
|
|
3342
|
+
for (const p of ["opacity", "borderOpacity", "outerBorderOpacity", "labelOpacity"]) {
|
|
3343
|
+
columnOf(values, p, n)[i] = 0;
|
|
3344
|
+
}
|
|
3345
|
+
columnOf(values, "label", n)[i] = "";
|
|
3346
|
+
}
|
|
3347
|
+
}
|
|
3348
|
+
values.visible = col;
|
|
3349
|
+
}
|
|
3350
|
+
function combineLabelText(kind, n, words, values) {
|
|
3351
|
+
transformLabels(n, words.get("_transform"), values.label);
|
|
3352
|
+
const justification = words.get("_justification");
|
|
3353
|
+
if (justification !== void 0 && kind === "edge") {
|
|
3354
|
+
combineEdgeJustification(n, justification, words.get("_wrap"), values);
|
|
3355
|
+
} else if (justification !== void 0) {
|
|
3356
|
+
const halign = words.get("_halign");
|
|
3357
|
+
const AUTO = {
|
|
3358
|
+
left: "right",
|
|
3359
|
+
right: "left",
|
|
3360
|
+
"left-inside": "left",
|
|
3361
|
+
"right-inside": "right"
|
|
3362
|
+
};
|
|
3363
|
+
values.labelTextAlign = justification.map((j, i) => {
|
|
3364
|
+
if (j === null) {
|
|
3365
|
+
return null;
|
|
3366
|
+
}
|
|
3367
|
+
return j === "auto" ? AUTO[halign?.[i] ?? "center"] ?? "center" : j;
|
|
3368
|
+
});
|
|
3369
|
+
}
|
|
3370
|
+
const rotations = [
|
|
3371
|
+
["_rotation", "labelRotation"],
|
|
3372
|
+
["_sourceRotation", "sourceLabelRotation"],
|
|
3373
|
+
["_targetRotation", "targetLabelRotation"]
|
|
3374
|
+
];
|
|
3375
|
+
for (const [part, property] of rotations) {
|
|
3376
|
+
const rotation = words.get(part);
|
|
3377
|
+
if (rotation !== void 0) {
|
|
3378
|
+
values[property] = rotation.map((r) => r === null ? null : cyjsAngleDegrees(r));
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
function transformLabels(n, transform, label) {
|
|
3383
|
+
if (transform === void 0 || label === void 0) {
|
|
3384
|
+
return;
|
|
3385
|
+
}
|
|
3386
|
+
for (let i = 0; i < n; i++) {
|
|
3387
|
+
const text2 = label[i];
|
|
3388
|
+
if (typeof text2 === "string" && transform[i] === "uppercase") {
|
|
3389
|
+
label[i] = text2.toUpperCase();
|
|
3390
|
+
} else if (typeof text2 === "string" && transform[i] === "lowercase") {
|
|
3391
|
+
label[i] = text2.toLowerCase();
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
function combineEdgeJustification(n, justification, wrap, values) {
|
|
3396
|
+
const SHIFT = { left: -0.5, right: 0.5 };
|
|
3397
|
+
for (let i = 0; i < n; i++) {
|
|
3398
|
+
const shift = wrap?.[i] === "wrap" ? SHIFT[justification[i] ?? ""] : void 0;
|
|
3399
|
+
if (shift !== void 0) {
|
|
3400
|
+
columnOf(values, "labelShiftX", n)[i] = shift;
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
}
|
|
3404
|
+
function combineLabelDress(kind, n, words, values, notes, whole) {
|
|
3405
|
+
const num = (part, i, fallback) => {
|
|
3406
|
+
const v = words.get(part)?.[i];
|
|
3407
|
+
return v === null || v === void 0 ? fallback : Number(v);
|
|
3408
|
+
};
|
|
3409
|
+
const col = (p) => values[p] ??= new Array(n).fill(null);
|
|
3410
|
+
const outlined = words.has("_outlineWidth");
|
|
3411
|
+
const boxed = words.has("_backgroundOpacity");
|
|
3412
|
+
const bordered = words.has("_textBorderWidth") && words.has("_textBorderOpacity");
|
|
3413
|
+
const at = (v) => typeof v === "number" ? v : 1;
|
|
3414
|
+
const faded = (v) => {
|
|
3415
|
+
const r = Math.round(v * 1e6) / 1e6;
|
|
3416
|
+
return r < 1 ? r : null;
|
|
3417
|
+
};
|
|
3418
|
+
for (let i = 0; i < n && (outlined || boxed || bordered); i++) {
|
|
3419
|
+
const width = num("_outlineWidth", i, 0);
|
|
3420
|
+
const outlineOpacity = num("_outlineOpacity", i, 1);
|
|
3421
|
+
if (outlined && width > 0 && outlineOpacity > 0) {
|
|
3422
|
+
col("labelOutlineColor")[i] = words.get("_outlineColor")?.[i] ?? "#000000";
|
|
3423
|
+
col("labelOutlineWidth")[i] = 2 * width;
|
|
3424
|
+
col("labelOutlineOpacity")[i] = faded(outlineOpacity * at(values.labelOpacity?.[i]));
|
|
3425
|
+
}
|
|
3426
|
+
const boxOpacity = num("_backgroundOpacity", i, 0);
|
|
3427
|
+
const box = boxed && boxOpacity > 0;
|
|
3428
|
+
if (box) {
|
|
3429
|
+
col("labelBackground")[i] = words.get("_backgroundColor")?.[i] ?? "#000000";
|
|
3430
|
+
col("labelBackgroundOpacity")[i] = faded(boxOpacity * at(whole[i]));
|
|
3431
|
+
}
|
|
3432
|
+
const border = bordered && labelBorder(kind, i, words, col, notes, at(whole[i]));
|
|
3433
|
+
if (box || border) {
|
|
3434
|
+
labelBoxShape(kind, i, words, col, notes);
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
function labelBoxShape(kind, i, words, col, notes) {
|
|
3439
|
+
const padding = words.get("_backgroundPadding")?.[i];
|
|
3440
|
+
col("labelPadding")[i] = padding === null || padding === void 0 ? 0 : Number(padding);
|
|
3441
|
+
col("labelLineHeight")[i] = 1;
|
|
3442
|
+
const shape = words.get("_backgroundShape")?.[i];
|
|
3443
|
+
if (shape === "round-rectangle" || shape === "roundrectangle") {
|
|
3444
|
+
col("labelCornerRadius")[i] = 2;
|
|
3445
|
+
} else if (shape === "circle") {
|
|
3446
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBackground", { sample: "circle", element: i });
|
|
3447
|
+
}
|
|
3448
|
+
}
|
|
3449
|
+
function labelBorder(kind, i, words, col, notes, whole) {
|
|
3450
|
+
const num = (part) => Number(words.get(part)?.[i] ?? 0);
|
|
3451
|
+
const [width, opacity] = [num("_textBorderWidth"), num("_textBorderOpacity")];
|
|
3452
|
+
if (!(width > 0 && opacity > 0)) {
|
|
3453
|
+
return false;
|
|
3454
|
+
}
|
|
3455
|
+
const style = words.get("_textBorderStyle")?.[i] ?? "solid";
|
|
3456
|
+
col("labelBorderColor")[i] = words.get("_textBorderColor")?.[i] ?? "#000000";
|
|
3457
|
+
col("labelBorderWidth")[i] = style === "double" ? width / 4 : width;
|
|
3458
|
+
const drawn = Math.round(opacity * whole * 1e6) / 1e6;
|
|
3459
|
+
col("labelBorderOpacity")[i] = drawn < 1 ? drawn : null;
|
|
3460
|
+
if (style === "dotted" || style === "dashed" || style === "double") {
|
|
3461
|
+
notes.add(STYLE_ISSUE.APPROXIMATED, kind, "labelBorderColor", { sample: style, element: i });
|
|
3462
|
+
}
|
|
3463
|
+
return true;
|
|
3464
|
+
}
|
|
3465
|
+
function lineDegrees(a, b) {
|
|
3466
|
+
const dx = b[0] - a[0];
|
|
3467
|
+
const angle = Math.atan((b[1] - a[1]) / dx);
|
|
3468
|
+
const turn = (dx === 0 ? Math.abs(angle) : angle) * 180 / Math.PI;
|
|
3469
|
+
return Number.isFinite(turn) ? Math.round((turn % 360 + 360) % 360 * 1e6) / 1e6 + 0 : 0;
|
|
3470
|
+
}
|
|
3471
|
+
function cyjsAngleDegrees(text2) {
|
|
3472
|
+
const t = text2.trim();
|
|
3473
|
+
if (t === "none" || t === "autorotate") {
|
|
3474
|
+
return 0;
|
|
3475
|
+
}
|
|
3476
|
+
const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(deg|rad)?$/i.exec(t);
|
|
3477
|
+
if (m === null) {
|
|
3478
|
+
return null;
|
|
3479
|
+
}
|
|
3480
|
+
const x = Number(m[1]);
|
|
3481
|
+
const deg = m[2]?.toLowerCase() === "deg" ? x : x * 180 / Math.PI;
|
|
3482
|
+
return Math.round((deg % 360 + 360) % 360 * 1e6) / 1e6 + 0;
|
|
3483
|
+
}
|
|
3484
|
+
function combineLineOpacity(n, line, values) {
|
|
3485
|
+
if (line === void 0) {
|
|
3486
|
+
return;
|
|
3487
|
+
}
|
|
3488
|
+
const whole = values.opacity;
|
|
3489
|
+
values.opacity = Array.from({ length: n }, (_, i) => {
|
|
3490
|
+
const a = line[i] === null ? null : Number(line[i]);
|
|
3491
|
+
const b = whole?.[i];
|
|
3492
|
+
if (a === null || !Number.isFinite(a)) {
|
|
3493
|
+
return b ?? null;
|
|
3494
|
+
}
|
|
3495
|
+
return Math.round(a * (typeof b === "number" ? b : 1) * 1e6) / 1e6;
|
|
3496
|
+
});
|
|
3497
|
+
}
|
|
3498
|
+
const GRADIENT_ANGLES = /* @__PURE__ */ new Map([
|
|
3499
|
+
["to-bottom", 90],
|
|
3500
|
+
["to-top", 270],
|
|
3501
|
+
["to-left", 180],
|
|
3502
|
+
["to-right", 0],
|
|
3503
|
+
["to-bottom-right", 45],
|
|
3504
|
+
["to-right-bottom", 45],
|
|
3505
|
+
["to-bottom-left", 135],
|
|
3506
|
+
["to-left-bottom", 135],
|
|
3507
|
+
["to-top-right", 315],
|
|
3508
|
+
["to-right-top", 315],
|
|
3509
|
+
["to-top-left", 225],
|
|
3510
|
+
["to-left-top", 225]
|
|
3511
|
+
]);
|
|
3512
|
+
function combineBackgroundGradient(n, words, values, notes) {
|
|
3513
|
+
const fill = words.get("_backgroundFill");
|
|
3514
|
+
if (fill === void 0) {
|
|
3515
|
+
return;
|
|
3516
|
+
}
|
|
3517
|
+
const stops = words.get("_backgroundStops");
|
|
3518
|
+
const positions = words.get("_backgroundPositions");
|
|
3519
|
+
const direction = words.get("_backgroundDirection");
|
|
3520
|
+
const col = (name) => values[name] ??= new Array(n).fill(null);
|
|
3521
|
+
for (let i = 0; i < n; i++) {
|
|
3522
|
+
const radial = fill[i] === "radial-gradient";
|
|
3523
|
+
if (fill[i] !== "linear-gradient" && !radial) {
|
|
3524
|
+
continue;
|
|
3525
|
+
}
|
|
3526
|
+
const colors = gradientStopColors(stops?.[i] ?? "#999", {
|
|
3527
|
+
notes,
|
|
3528
|
+
target: "node",
|
|
3529
|
+
property: "fill",
|
|
3530
|
+
element: i
|
|
3531
|
+
});
|
|
3532
|
+
if (colors.length < 2) {
|
|
3533
|
+
continue;
|
|
3534
|
+
}
|
|
3535
|
+
col("fill")[i] = colors[0];
|
|
3536
|
+
col("fillGradient")[i] = colors.at(-1) ?? null;
|
|
3537
|
+
if (colors.length > 2) {
|
|
3538
|
+
col("fillGradientColors")[i] = colors.join(" ");
|
|
3539
|
+
}
|
|
3540
|
+
const placed = gradientStops(positions?.[i] ?? "");
|
|
3541
|
+
if (placed?.split(" ").length === colors.length) {
|
|
3542
|
+
col("fillGradientStops")[i] = placed;
|
|
3543
|
+
}
|
|
3544
|
+
if (radial) {
|
|
3545
|
+
col("fillGradientKind")[i] = "radial";
|
|
3546
|
+
} else {
|
|
3547
|
+
col("fillGradientAngle")[i] = GRADIENT_ANGLES.get(direction?.[i] ?? "to-bottom") ?? 90;
|
|
3548
|
+
}
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
const ROUTE_PARTS = [
|
|
3552
|
+
["segmentDistances", "segment-distances", { property: "_segmentDistances", type: "text" }],
|
|
3553
|
+
["segmentWeights", "segment-weights", { property: "_segmentWeights", type: "text" }],
|
|
3554
|
+
["controlPointDistances", "control-point-distances", { property: "_controlPointDistances", type: "text" }],
|
|
3555
|
+
["controlPointWeights", "control-point-weights", { property: "_controlPointWeights", type: "text" }],
|
|
3556
|
+
["controlPointStepSize", "control-point-step-size", { property: "_controlPointStepSize", type: "size" }],
|
|
3557
|
+
["taxiDirection", "taxi-direction", { property: "_taxiDirection", type: "text" }],
|
|
3558
|
+
["taxiTurn", "taxi-turn", { property: "_taxiTurn", type: "text" }],
|
|
3559
|
+
["taxiTurnMinDistance", "taxi-turn-min-distance", { property: "_taxiTurnMinDistance", type: "size" }],
|
|
3560
|
+
["edgeDistances", "edge-distances", { property: "_edgeDistances", type: "text" }],
|
|
3561
|
+
["loopDirection", "loop-direction", { property: "_loopDirection", type: "text" }],
|
|
3562
|
+
["loopSweep", "loop-sweep", { property: "_loopSweep", type: "text" }],
|
|
3563
|
+
["segmentRadii", "segment-radii", { property: "_segmentRadii", type: "text" }],
|
|
3564
|
+
["taxiRadius", "taxi-radius", { property: "_taxiRadius", type: "text" }],
|
|
3565
|
+
["radiusType", "radius-type", { property: "_radiusType", type: "text" }]
|
|
3566
|
+
];
|
|
3567
|
+
function edgeRoutes(graph, read, curves, nodes, values) {
|
|
3568
|
+
const words = new Map(ROUTE_PARTS.map(([key, name, spec]) => [key, drawnColumn(read, name, spec)]));
|
|
3569
|
+
const nodeAt = /* @__PURE__ */ new Map();
|
|
3570
|
+
nodes.elements.forEach((el, k) => {
|
|
3571
|
+
if (el !== null) {
|
|
3572
|
+
nodeAt.set(el, k);
|
|
3573
|
+
}
|
|
3574
|
+
});
|
|
3575
|
+
const geometry = (core) => routeNode(graph.nodes[core], nodeAt, nodes);
|
|
3576
|
+
const turned = [
|
|
3577
|
+
["labelRotation", drawnColumn(read, "text-rotation", TEXT_PART)],
|
|
3578
|
+
["sourceLabelRotation", drawnColumn(read, "source-text-rotation", TEXT_PART)],
|
|
3579
|
+
["targetLabelRotation", drawnColumn(read, "target-text-rotation", TEXT_PART)]
|
|
3580
|
+
];
|
|
3581
|
+
const ends = [drawnColumn(read, "source-endpoint", TEXT_PART), drawnColumn(read, "target-endpoint", TEXT_PART)];
|
|
3582
|
+
const loops = /* @__PURE__ */ new Map();
|
|
3583
|
+
const n = read.order.length;
|
|
3584
|
+
let routed = null;
|
|
3585
|
+
for (let k = 0; k < n; k++) {
|
|
3586
|
+
const e = read.order[k];
|
|
3587
|
+
const between = edgeNodes(graph, e, geometry);
|
|
3588
|
+
if (between === null) {
|
|
3589
|
+
continue;
|
|
3590
|
+
}
|
|
3591
|
+
const { src, tgt, loop } = between;
|
|
3592
|
+
if (!loop) {
|
|
3593
|
+
autorotateLabels(values, turned, k, n, lineDegrees(src.center, tgt.center));
|
|
3594
|
+
}
|
|
3595
|
+
const edge = routeSettings(words, k, curves[k]);
|
|
3596
|
+
const bends = cyjsRoute(edge, src, tgt, loop ? nextLoopIndex(loops, graph.source[e], edge) : 0);
|
|
3597
|
+
if (bends !== null) {
|
|
3598
|
+
routed ??= values.bends ?? new Array(n).fill(null);
|
|
3599
|
+
routed[k] = bends;
|
|
3600
|
+
columnOf(values, "curved", n)[k] = false;
|
|
3601
|
+
}
|
|
3602
|
+
if (!loop) {
|
|
3603
|
+
edgePorts(edge.curveStyle, [ends[0][k], ends[1][k]], [src, tgt], (p, port) => {
|
|
3604
|
+
columnOf(values, p, n)[k] = port;
|
|
3605
|
+
});
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
if (routed !== null) {
|
|
3609
|
+
values.bends = routed;
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
function routeNode(el, nodeAt, nodes) {
|
|
3613
|
+
const k = nodeAt.get(el);
|
|
3614
|
+
const pos = el.json.position;
|
|
3615
|
+
if (k === void 0 || !isObject(pos) || typeof pos.x !== "number" || typeof pos.y !== "number") {
|
|
3616
|
+
return null;
|
|
3617
|
+
}
|
|
3618
|
+
const num = (p, fallback) => {
|
|
3619
|
+
const v = nodes.values[p]?.[k];
|
|
3620
|
+
return typeof v === "number" ? v : fallback;
|
|
3621
|
+
};
|
|
3622
|
+
const [w, h, bw] = [num("width", 30), num("height", 30), num("borderWidth", 0)];
|
|
3623
|
+
return {
|
|
3624
|
+
center: [pos.x, pos.y],
|
|
3625
|
+
size: [w + bw, h + bw],
|
|
3626
|
+
box: [w, h],
|
|
3627
|
+
ellipse: (nodes.values.shape?.[k] ?? "ellipse") === "ellipse"
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3630
|
+
function edgeNodes(graph, e, geometry) {
|
|
3631
|
+
if (e < 0) {
|
|
3632
|
+
return null;
|
|
3633
|
+
}
|
|
3634
|
+
const loop = graph.source[e] === graph.target[e];
|
|
3635
|
+
const src = geometry(graph.source[e]);
|
|
3636
|
+
const tgt = loop ? src : geometry(graph.target[e]);
|
|
3637
|
+
return src === null || tgt === null ? null : { src, tgt, loop };
|
|
3638
|
+
}
|
|
3639
|
+
function autorotateLabels(values, turned, k, n, degrees2) {
|
|
3640
|
+
for (const [property, column] of turned) {
|
|
3641
|
+
if (column[k] === "autorotate") {
|
|
3642
|
+
columnOf(values, property, n)[k] = degrees2;
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
function nextLoopIndex(loops, source, edge) {
|
|
3647
|
+
const key = `${String(source)} ${String(edge.loopDirection)} ${String(edge.loopSweep)}`;
|
|
3648
|
+
const index = loops.get(key) ?? 0;
|
|
3649
|
+
loops.set(key, index + 1);
|
|
3650
|
+
return index;
|
|
3651
|
+
}
|
|
3652
|
+
function edgePorts(curve, words, nodes, put) {
|
|
3653
|
+
if (curve === "taxi" || curve === "round-taxi") {
|
|
3654
|
+
return;
|
|
3655
|
+
}
|
|
3656
|
+
["sourcePort", "targetPort"].forEach((p, a) => {
|
|
3657
|
+
const port = curve === "haystack" ? "0,0" : endpointPort(String(words[a] ?? ""), nodes[a]);
|
|
3658
|
+
if (port !== null) {
|
|
3659
|
+
put(p, port);
|
|
3660
|
+
}
|
|
3661
|
+
});
|
|
3662
|
+
}
|
|
3663
|
+
function endpointPort(text2, node) {
|
|
3664
|
+
const t = text2.trim();
|
|
3665
|
+
if (t === "inside-to-node") {
|
|
3666
|
+
return "0,0";
|
|
3667
|
+
}
|
|
3668
|
+
const parts = t.split(/\s+/);
|
|
3669
|
+
const [w, h] = node.size;
|
|
3670
|
+
const r62 = (v) => String(Math.round(v * 1e6) / 1e6 + 0);
|
|
3671
|
+
const fraction2 = (part, size) => {
|
|
3672
|
+
const m2 = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(%|px)?$/.exec(part);
|
|
3673
|
+
if (m2 === null || Number.isNaN(size) || size <= 0) {
|
|
3674
|
+
return null;
|
|
3675
|
+
}
|
|
3676
|
+
const px = m2[2] === "%" ? Number(m2[1]) / 100 * size : Number(m2[1]);
|
|
3677
|
+
return px / (size / 2);
|
|
3678
|
+
};
|
|
3679
|
+
if (parts.length === 2) {
|
|
3680
|
+
const [x, y] = [fraction2(parts[0], w), fraction2(parts[1], h)];
|
|
3681
|
+
return x === null || y === null ? null : `${r62(x)},${r62(-y)}`;
|
|
3682
|
+
}
|
|
3683
|
+
const m = /^(-?(?:\d+(?:\.\d*)?|\.\d+))(deg|rad)$/.exec(t);
|
|
3684
|
+
if (m === null) {
|
|
3685
|
+
return null;
|
|
3686
|
+
}
|
|
3687
|
+
const turn = m[2] === "deg" ? Number(m[1]) * Math.PI / 180 : Number(m[1]);
|
|
3688
|
+
const [dx, dy] = [Math.sin(turn) / (w / 2), Math.cos(turn) / (h / 2)];
|
|
3689
|
+
const reach = node.ellipse ? Math.hypot(dx, dy) : Math.max(Math.abs(dx), Math.abs(dy));
|
|
3690
|
+
return reach > 0 ? `${r62(dx / reach)},${r62(dy / reach)}` : null;
|
|
3691
|
+
}
|
|
3692
|
+
function routeSettings(words, k, curve) {
|
|
3693
|
+
const text2 = (key) => {
|
|
3694
|
+
const v = words.get(key)?.[k];
|
|
3695
|
+
return v === null || v === void 0 ? null : String(v);
|
|
3696
|
+
};
|
|
3697
|
+
const num = (key) => {
|
|
3698
|
+
const v = text2(key);
|
|
3699
|
+
return v === null ? null : Number(v);
|
|
3700
|
+
};
|
|
3701
|
+
return {
|
|
3702
|
+
curveStyle: String(curve ?? "haystack"),
|
|
3703
|
+
segmentDistances: text2("segmentDistances"),
|
|
3704
|
+
segmentWeights: text2("segmentWeights"),
|
|
3705
|
+
controlPointDistances: text2("controlPointDistances"),
|
|
3706
|
+
controlPointWeights: text2("controlPointWeights"),
|
|
3707
|
+
controlPointStepSize: num("controlPointStepSize"),
|
|
3708
|
+
taxiDirection: text2("taxiDirection"),
|
|
3709
|
+
taxiTurn: text2("taxiTurn"),
|
|
3710
|
+
taxiTurnMinDistance: num("taxiTurnMinDistance"),
|
|
3711
|
+
edgeDistances: text2("edgeDistances"),
|
|
3712
|
+
loopDirection: text2("loopDirection"),
|
|
3713
|
+
loopSweep: text2("loopSweep"),
|
|
3714
|
+
segmentRadii: text2("segmentRadii"),
|
|
3715
|
+
taxiRadius: text2("taxiRadius"),
|
|
3716
|
+
radiusType: text2("radiusType")
|
|
3717
|
+
};
|
|
3718
|
+
}
|
|
3719
|
+
const TEXT_PART = { property: "_text", type: "text" };
|
|
3720
|
+
function nodeSizes(graph, read, values) {
|
|
3721
|
+
const padding = drawnColumn(read, "padding", TEXT_PART);
|
|
3722
|
+
const toLabel = ["width", "height"].map((p) => drawnColumn(read, p, SIZE_PART));
|
|
3723
|
+
const n = read.order.length;
|
|
3724
|
+
const col = (p) => values[p] ??= new Array(n).fill(null);
|
|
3725
|
+
for (let k = 0; k < n; k++) {
|
|
3726
|
+
const core = read.order[k];
|
|
3727
|
+
const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
|
|
3728
|
+
const fitted = toLabel.map((c) => c[k] === "label");
|
|
3729
|
+
if (fitted[0] || fitted[1]) {
|
|
3730
|
+
col("labelFit")[k] = "bounds";
|
|
3731
|
+
col("labelPaddingX")[k] = pad;
|
|
3732
|
+
col("labelPaddingY")[k] = pad;
|
|
3733
|
+
["width", "height"].forEach((p, a) => {
|
|
3734
|
+
const v = values[p]?.[k];
|
|
3735
|
+
const side = typeof v === "number" ? v : 30;
|
|
3736
|
+
col(p)[k] = fitted[a] ? 0 : side + 2 * pad;
|
|
3737
|
+
});
|
|
3738
|
+
continue;
|
|
3739
|
+
}
|
|
3740
|
+
if (pad <= 0) {
|
|
3741
|
+
continue;
|
|
3742
|
+
}
|
|
3743
|
+
for (const p of ["width", "height"]) {
|
|
3744
|
+
const v = values[p]?.[k];
|
|
3745
|
+
col(p)[k] = (typeof v === "number" ? v : 30) + 2 * pad;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
}
|
|
3749
|
+
const VALIGN_PART = {
|
|
3750
|
+
property: "_valign",
|
|
3751
|
+
type: "enum",
|
|
3752
|
+
enums: ["top", "top-inside", "center", "bottom", "bottom-inside"]
|
|
3753
|
+
};
|
|
3754
|
+
const HALIGN_PART = {
|
|
3755
|
+
property: "_halign",
|
|
3756
|
+
type: "enum",
|
|
3757
|
+
enums: ["left", "left-inside", "center", "right", "right-inside"]
|
|
3758
|
+
};
|
|
3759
|
+
function pinnedAxis(align, half, pad) {
|
|
3760
|
+
const near2 = /^(left|top)/.test(align);
|
|
3761
|
+
if (!near2 && !/^(right|bottom)/.test(align)) {
|
|
3762
|
+
return { offset: 0, shift: 0 };
|
|
3763
|
+
}
|
|
3764
|
+
const side = near2 ? -1 : 1;
|
|
3765
|
+
return align.endsWith("-inside") ? { offset: side * (half - 2 * pad), shift: -side / 2 } : { offset: side * half, shift: side / 2 };
|
|
3766
|
+
}
|
|
3767
|
+
function mixedLabelPlaces(graph, read, values) {
|
|
3768
|
+
const va = drawnColumn(read, "text-valign", VALIGN_PART);
|
|
3769
|
+
const ha = drawnColumn(read, "text-halign", HALIGN_PART);
|
|
3770
|
+
const padding = drawnColumn(read, "padding", TEXT_PART);
|
|
3771
|
+
const n = read.order.length;
|
|
3772
|
+
const col = (p) => values[p] ??= new Array(n).fill(null);
|
|
3773
|
+
for (let k = 0; k < n; k++) {
|
|
3774
|
+
const v = typeof va[k] === "string" ? String(va[k]) : "top";
|
|
3775
|
+
const h = typeof ha[k] === "string" ? String(ha[k]) : "center";
|
|
3776
|
+
const inside = v.endsWith("-inside") || h.endsWith("-inside");
|
|
3777
|
+
const outside = v === "top" || v === "bottom" || h === "left" || h === "right";
|
|
3778
|
+
if (!inside || !outside) {
|
|
3779
|
+
continue;
|
|
3780
|
+
}
|
|
3781
|
+
if (values.labelFit?.[k] !== void 0 && values.labelFit[k] !== null) {
|
|
3782
|
+
read.notes.add(STYLE_ISSUE.APPROXIMATED, "node", "labelPosition", { sample: `${v} ${h}`, element: k });
|
|
3783
|
+
continue;
|
|
3784
|
+
}
|
|
3785
|
+
const core = read.order[k];
|
|
3786
|
+
const pad = core < 0 || graph.children[core].length > 0 ? 0 : paddingOf(padding[k]);
|
|
3787
|
+
const size = (p) => {
|
|
3788
|
+
const s = values[p]?.[k];
|
|
3789
|
+
return typeof s === "number" ? s : 30 + 2 * pad;
|
|
3790
|
+
};
|
|
3791
|
+
const x = pinnedAxis(h, size("width") / 2, pad);
|
|
3792
|
+
const y = pinnedAxis(v, size("height") / 2, pad);
|
|
3793
|
+
const add = (p, d) => {
|
|
3794
|
+
const was = values[p]?.[k];
|
|
3795
|
+
col(p)[k] = (typeof was === "number" ? was : 0) + d;
|
|
3796
|
+
};
|
|
3797
|
+
col("labelPosition")[k] = "center";
|
|
3798
|
+
add("labelOffsetX", x.offset);
|
|
3799
|
+
add("labelOffsetY", y.offset);
|
|
3800
|
+
col("labelShiftX")[k] = x.shift;
|
|
3801
|
+
col("labelShiftY")[k] = y.shift;
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
const SIZE_PART = { property: "_size", type: "nodeSize" };
|
|
3805
|
+
function paddingOf(text2) {
|
|
3806
|
+
if (typeof text2 !== "string") {
|
|
3807
|
+
return 0;
|
|
3808
|
+
}
|
|
3809
|
+
const x = Number.parseFloat(text2);
|
|
3810
|
+
if (!Number.isFinite(x) || x <= 0) {
|
|
3811
|
+
return 0;
|
|
3812
|
+
}
|
|
3813
|
+
return text2.trim().endsWith("%") ? x / 100 : x;
|
|
3814
|
+
}
|
|
3815
|
+
const CURVE_PART = { property: "_curve", type: "enum", enums: CYJS_CURVE_STYLES };
|
|
3816
|
+
function noArrowsOnHaystacks(curves, values) {
|
|
3817
|
+
const n = curves.length;
|
|
3818
|
+
for (const p of ["targetArrow", "sourceArrow"]) {
|
|
3819
|
+
const col = values[p];
|
|
3820
|
+
if (col === void 0) {
|
|
3821
|
+
continue;
|
|
3822
|
+
}
|
|
3823
|
+
for (let i = 0; i < n; i++) {
|
|
3824
|
+
if ((curves[i] ?? "haystack") === "haystack" && col[i] !== null) {
|
|
3825
|
+
col[i] = "none";
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
const HOLLOW_ARROWS = /* @__PURE__ */ new Map([
|
|
3831
|
+
["triangle", "triangle-open"],
|
|
3832
|
+
["diamond", "diamond-open"],
|
|
3833
|
+
["circle", "circle-open"],
|
|
3834
|
+
["square", "other:open-square"]
|
|
3835
|
+
]);
|
|
3836
|
+
function hollowArrowsOfRule(set, all) {
|
|
3837
|
+
for (const p of all) {
|
|
3838
|
+
const shapeProp = /^_(\w+Arrow)Fill$/.exec(p.spec.property)?.[1];
|
|
3839
|
+
const shape = shapeProp === void 0 ? void 0 : set[shapeProp];
|
|
3840
|
+
if (shapeProp === void 0 || shape === void 0 || p.parsed.kind !== "word") {
|
|
3841
|
+
continue;
|
|
3842
|
+
}
|
|
3843
|
+
const open = HOLLOW_ARROWS.get(shape);
|
|
3844
|
+
if (open !== void 0 && p.parsed.value === "hollow") {
|
|
3845
|
+
set[shapeProp] = open;
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
function combineArrowFills(n, words, values, notes) {
|
|
3850
|
+
for (const p of ["targetArrow", "sourceArrow", "midTargetArrow", "midSourceArrow"]) {
|
|
3851
|
+
const fill = words.get(`_${p}Fill`);
|
|
3852
|
+
const shapes = values[p];
|
|
3853
|
+
if (fill === void 0 || shapes === void 0) {
|
|
3854
|
+
continue;
|
|
3855
|
+
}
|
|
2419
3856
|
for (let i = 0; i < n; i++) {
|
|
2420
|
-
const
|
|
2421
|
-
|
|
2422
|
-
if (a === null && b === null) {
|
|
3857
|
+
const shape = shapes[i];
|
|
3858
|
+
if (fill[i] !== "hollow" || shape === null || shape === "none") {
|
|
2423
3859
|
continue;
|
|
2424
3860
|
}
|
|
2425
|
-
|
|
3861
|
+
const open = HOLLOW_ARROWS.get(shape);
|
|
3862
|
+
if (open !== void 0) {
|
|
3863
|
+
shapes[i] = open;
|
|
3864
|
+
} else if (!String(shape).includes("open")) {
|
|
3865
|
+
const property = p.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`).replace("-arrow", "-arrow-fill");
|
|
3866
|
+
notes.add(STYLE_ISSUE.NOT_CARRIED, "edge", property, { sample: `hollow ${String(shape)}`, element: i });
|
|
3867
|
+
}
|
|
2426
3868
|
}
|
|
2427
|
-
values.visible = col;
|
|
2428
3869
|
}
|
|
2429
3870
|
}
|
|
2430
|
-
function labelPosition(v, h
|
|
3871
|
+
function labelPosition(v, h) {
|
|
2431
3872
|
if (v === null && h === null) {
|
|
2432
3873
|
return null;
|
|
2433
3874
|
}
|
|
3875
|
+
const vIn = (v ?? "").endsWith("-inside");
|
|
3876
|
+
const hIn = (h ?? "").endsWith("-inside");
|
|
2434
3877
|
const vv = (v ?? "top").replace("-inside", "");
|
|
2435
3878
|
const hh = (h ?? "center").replace("-inside", "");
|
|
2436
|
-
if (
|
|
2437
|
-
|
|
3879
|
+
if (vIn || hIn) {
|
|
3880
|
+
const vOut = vv !== "center" && !vIn;
|
|
3881
|
+
const hOut = hh !== "center" && !hIn;
|
|
3882
|
+
if (!vOut && !hOut) {
|
|
3883
|
+
return INSIDE_POSITIONS.get(`${vv},${hh}`) ?? null;
|
|
3884
|
+
}
|
|
3885
|
+
return POSITIONS.get(`${vIn ? "center" : vv},${hIn ? "center" : hh}`) ?? null;
|
|
2438
3886
|
}
|
|
2439
3887
|
return POSITIONS.get(`${vv},${hh}`) ?? null;
|
|
2440
3888
|
}
|
|
@@ -2466,12 +3914,12 @@ function buildRules(kind, applied, core, input, truth, env) {
|
|
|
2466
3914
|
if (props.length === 0 || a.list.length === 0) {
|
|
2467
3915
|
continue;
|
|
2468
3916
|
}
|
|
2469
|
-
drafts.push(draftOf(ctx, a.entry, a.list, props));
|
|
3917
|
+
drafts.push(draftOf(ctx, a.entry, a.list, props, a.props));
|
|
2470
3918
|
}
|
|
2471
3919
|
const rules = collapse(ctx, drafts);
|
|
2472
3920
|
return { rules, columns, rawColumns: [...raw] };
|
|
2473
3921
|
}
|
|
2474
|
-
function draftOf(ctx, entry, list, props) {
|
|
3922
|
+
function draftOf(ctx, entry, list, props, all) {
|
|
2475
3923
|
const setting = /* @__PURE__ */ new Map();
|
|
2476
3924
|
const mapping = /* @__PURE__ */ new Map();
|
|
2477
3925
|
let flattened = false;
|
|
@@ -2500,6 +3948,11 @@ function draftOf(ctx, entry, list, props) {
|
|
|
2500
3948
|
}
|
|
2501
3949
|
}
|
|
2502
3950
|
const set = Object.fromEntries(setting);
|
|
3951
|
+
if (ctx.kind === "node") {
|
|
3952
|
+
cyjsPolygonShapes(set);
|
|
3953
|
+
} else {
|
|
3954
|
+
hollowArrowsOfRule(set, all);
|
|
3955
|
+
}
|
|
2503
3956
|
const map = Object.fromEntries(mapping);
|
|
2504
3957
|
const hasMap = mapping.size > 0;
|
|
2505
3958
|
const rule = () => {
|
|
@@ -2930,7 +4383,8 @@ const SHAPES_TO_CYJS = /* @__PURE__ */ new Map([
|
|
|
2930
4383
|
["octagon", "octagon"],
|
|
2931
4384
|
["parallelogram", "rhomboid"],
|
|
2932
4385
|
["star", "star"],
|
|
2933
|
-
["vee", "vee"]
|
|
4386
|
+
["vee", "vee"],
|
|
4387
|
+
["polygon", "polygon"]
|
|
2934
4388
|
]);
|
|
2935
4389
|
const ARROWS_TO_CYJS = /* @__PURE__ */ new Map([
|
|
2936
4390
|
["none", "none"],
|
|
@@ -2941,10 +4395,23 @@ const ARROWS_TO_CYJS = /* @__PURE__ */ new Map([
|
|
|
2941
4395
|
["circle", "circle"],
|
|
2942
4396
|
["square", "square"]
|
|
2943
4397
|
]);
|
|
2944
|
-
const
|
|
4398
|
+
const LINE_FILLS = /* @__PURE__ */ new Map([
|
|
4399
|
+
["none", "solid"],
|
|
4400
|
+
["linear", "linear-gradient"],
|
|
4401
|
+
["radial", "radial-gradient"]
|
|
4402
|
+
]);
|
|
4403
|
+
const ARROW_PROPERTY = {
|
|
4404
|
+
sourceArrow: "source-arrow-shape",
|
|
4405
|
+
targetArrow: "target-arrow-shape",
|
|
4406
|
+
midSourceArrow: "mid-source-arrow-shape",
|
|
4407
|
+
midTargetArrow: "mid-target-arrow-shape"
|
|
4408
|
+
};
|
|
4409
|
+
const ARROWS_OPEN = /* @__PURE__ */ new Map([
|
|
2945
4410
|
["triangle-open", "triangle"],
|
|
2946
4411
|
["diamond-open", "diamond"],
|
|
2947
|
-
["circle-open", "circle"]
|
|
4412
|
+
["circle-open", "circle"]
|
|
4413
|
+
]);
|
|
4414
|
+
const ARROWS_NEAREST = /* @__PURE__ */ new Map([
|
|
2948
4415
|
["half", "triangle"],
|
|
2949
4416
|
["inverted", "triangle"],
|
|
2950
4417
|
["crow", "vee"]
|
|
@@ -2954,12 +4421,27 @@ function toCyjs(target, property, value) {
|
|
|
2954
4421
|
switch (property) {
|
|
2955
4422
|
case "visible":
|
|
2956
4423
|
return exact({ display: value === false ? "none" : "element" });
|
|
4424
|
+
case "shapePoints":
|
|
4425
|
+
return pointsToCyjs(String(value));
|
|
2957
4426
|
case "labelItalic":
|
|
2958
4427
|
return exact({ "font-style": value === true ? "italic" : "normal" });
|
|
2959
4428
|
case "curved":
|
|
2960
4429
|
return exact({ "curve-style": value === true ? "unbundled-bezier" : "straight" });
|
|
2961
4430
|
case "labelPosition":
|
|
2962
4431
|
return labelPositionToCyjs(String(value));
|
|
4432
|
+
case "fanSpacing":
|
|
4433
|
+
case "labelWrapWidth":
|
|
4434
|
+
return ifNumber(value, (v) => numberToCyjs(property, v));
|
|
4435
|
+
case "gradientKind":
|
|
4436
|
+
return gradientKindToCyjs(String(value));
|
|
4437
|
+
case "gradientStops":
|
|
4438
|
+
return exact({
|
|
4439
|
+
"line-gradient-stop-positions": String(value).trim().split(/\s+/).map((s) => `${num6(Number(s) * 100)}%`).join(" ")
|
|
4440
|
+
});
|
|
4441
|
+
case "outerBorderOffset":
|
|
4442
|
+
return ifNumber(value, (v) => exact({ "outline-offset": num6(v * 2) }));
|
|
4443
|
+
case "outerBorderStyle":
|
|
4444
|
+
return outerBorderStyleToCyjs(String(value));
|
|
2963
4445
|
case "shape":
|
|
2964
4446
|
return enumToCyjs("shape", String(value), SHAPES_TO_CYJS, specs);
|
|
2965
4447
|
case "borderStyle":
|
|
@@ -2968,27 +4450,61 @@ function toCyjs(target, property, value) {
|
|
|
2968
4450
|
return lineStyleToCyjs(String(value));
|
|
2969
4451
|
case "sourceArrow":
|
|
2970
4452
|
case "targetArrow":
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
specs
|
|
2975
|
-
);
|
|
4453
|
+
case "midSourceArrow":
|
|
4454
|
+
case "midTargetArrow":
|
|
4455
|
+
return arrowToCyjs(ARROW_PROPERTY[property], String(value), specs);
|
|
2976
4456
|
case "labelFont":
|
|
2977
4457
|
return isFontFamily(String(value)) ? exact({ "font-family": String(value) }) : null;
|
|
4458
|
+
// a label's box draws only at an opacity above 0, which is 0 unset
|
|
4459
|
+
case "labelBackground":
|
|
4460
|
+
return exact({ "text-background-color": String(value), "text-background-opacity": 1 });
|
|
4461
|
+
// the outline is drawn as a stroke twice text-outline-width (see the reader)
|
|
4462
|
+
case "labelOutlineColor":
|
|
4463
|
+
return exact({ "text-outline-color": String(value) });
|
|
4464
|
+
case "labelOutlineWidth":
|
|
4465
|
+
return ifNumber(value, (v) => exact({ "text-outline-width": num6(v / 2) }));
|
|
4466
|
+
case "labelPadding":
|
|
4467
|
+
return ifNumber(value, (v) => exact({ "text-background-padding": v }));
|
|
4468
|
+
// the line round a label's box draws only at an opacity above 0, which is 0 unset
|
|
4469
|
+
case "labelBorderColor":
|
|
4470
|
+
return exact({ "text-border-color": String(value), "text-border-opacity": 1 });
|
|
4471
|
+
case "labelBorderWidth":
|
|
4472
|
+
return ifNumber(value, (v) => exact({ "text-border-width": v, "text-border-opacity": 1 }));
|
|
2978
4473
|
default:
|
|
2979
4474
|
return propertyToCyjs(property, value, specs);
|
|
2980
4475
|
}
|
|
2981
4476
|
}
|
|
4477
|
+
function ifNumber(value, write) {
|
|
4478
|
+
return typeof value === "number" ? write(value) : null;
|
|
4479
|
+
}
|
|
4480
|
+
function gradientKindToCyjs(kind) {
|
|
4481
|
+
const fill = LINE_FILLS.get(kind);
|
|
4482
|
+
return fill === void 0 ? null : exact({ "line-fill": fill });
|
|
4483
|
+
}
|
|
4484
|
+
function outerBorderStyleToCyjs(style) {
|
|
4485
|
+
const written2 = borderStyleToCyjs(style);
|
|
4486
|
+
return written2 === null ? null : { ...written2, props: { "outline-style": written2.props["border-style"] } };
|
|
4487
|
+
}
|
|
4488
|
+
function pointsToCyjs(points) {
|
|
4489
|
+
const written2 = neutralPointsToCyjs(points);
|
|
4490
|
+
return written2 === null ? null : exact({ "shape-polygon-points": written2 });
|
|
4491
|
+
}
|
|
4492
|
+
function numberToCyjs(property, value) {
|
|
4493
|
+
return property === "fanSpacing" ? exact({ "control-point-step-size": num6(value * 2) }) : exact({ "text-wrap": "wrap", "text-max-width": value });
|
|
4494
|
+
}
|
|
2982
4495
|
function exact(props) {
|
|
2983
4496
|
return { props, approximate: false };
|
|
2984
4497
|
}
|
|
2985
4498
|
function near(props) {
|
|
2986
4499
|
return { props, approximate: true };
|
|
2987
4500
|
}
|
|
2988
|
-
function labelPositionToCyjs(
|
|
2989
|
-
const
|
|
2990
|
-
const
|
|
2991
|
-
|
|
4501
|
+
function labelPositionToCyjs(text2) {
|
|
4502
|
+
const inside = text2.startsWith("inside-");
|
|
4503
|
+
const side = inside ? text2.slice("inside-".length) : text2;
|
|
4504
|
+
const v = ["top", "bottom"].find((x) => side.startsWith(x)) ?? "center";
|
|
4505
|
+
const h = ["left", "right"].find((x) => side.endsWith(x)) ?? "center";
|
|
4506
|
+
const of = (a) => inside && a !== "center" ? `${a}-inside` : a;
|
|
4507
|
+
return exact({ "text-valign": of(v), "text-halign": of(h) });
|
|
2992
4508
|
}
|
|
2993
4509
|
function enumToCyjs(name, value, table, specs) {
|
|
2994
4510
|
const cy = table.get(value);
|
|
@@ -2999,12 +4515,15 @@ function enumToCyjs(name, value, table, specs) {
|
|
|
2999
4515
|
return other !== null && specs.get(name)?.enums?.includes(other) === true ? exact({ [name]: other }) : null;
|
|
3000
4516
|
}
|
|
3001
4517
|
function arrowToCyjs(name, value, specs) {
|
|
3002
|
-
const
|
|
3003
|
-
|
|
3004
|
-
|
|
4518
|
+
const fill = name.replace("-shape", "-fill");
|
|
4519
|
+
const open = ARROWS_OPEN.get(value);
|
|
4520
|
+
if (open !== void 0) {
|
|
4521
|
+
return exact({ [name]: open, [fill]: "hollow" });
|
|
3005
4522
|
}
|
|
4523
|
+
const own = enumToCyjs(name, value, ARROWS_TO_CYJS, specs);
|
|
3006
4524
|
const nearest = ARROWS_NEAREST.get(value);
|
|
3007
|
-
|
|
4525
|
+
const w = own ?? (nearest === void 0 ? null : near({ [name]: nearest }));
|
|
4526
|
+
return w === null || value === "none" ? w : { ...w, props: { ...w.props, [fill]: "filled" } };
|
|
3008
4527
|
}
|
|
3009
4528
|
function borderStyleToCyjs(value) {
|
|
3010
4529
|
if (value === "dash-dot") {
|
|
@@ -3415,13 +4934,81 @@ function exactness(e, rules) {
|
|
|
3415
4934
|
const src = refSource(target, n, extracted.columns[target], extracted.features[target]);
|
|
3416
4935
|
const rows = new Array(n).fill(null);
|
|
3417
4936
|
for (const property of STYLE_PROPERTIES[target].keys()) {
|
|
3418
|
-
const
|
|
3419
|
-
addBypasses(rows, target, property,
|
|
4937
|
+
const want2 = resolveRules(rules, target, property, src);
|
|
4938
|
+
addBypasses(rows, target, property, want2, drawn[target].values[property]);
|
|
4939
|
+
}
|
|
4940
|
+
const want = (p) => resolveRules(rules, target, p, src);
|
|
4941
|
+
if (target === "node") {
|
|
4942
|
+
labelSizedBypasses(rows, want, drawn.node.values);
|
|
4943
|
+
}
|
|
4944
|
+
labelOpacityBypasses(rows, want, drawn[target].values);
|
|
4945
|
+
const parts = [
|
|
4946
|
+
["labelBackgroundOpacity", "text-background-opacity", "opacity", "labelBackground"],
|
|
4947
|
+
["labelBorderOpacity", "text-border-opacity", "opacity", "labelBorderWidth"],
|
|
4948
|
+
["labelOutlineOpacity", "text-outline-opacity", "labelOpacity", "labelOutlineWidth"]
|
|
4949
|
+
];
|
|
4950
|
+
if (target === "node") {
|
|
4951
|
+
parts.push(
|
|
4952
|
+
["borderOpacity", "border-opacity", "opacity", null],
|
|
4953
|
+
["outerBorderOpacity", "outline-opacity", "opacity", null]
|
|
4954
|
+
);
|
|
4955
|
+
}
|
|
4956
|
+
for (const part of parts) {
|
|
4957
|
+
partOpacityBypasses(rows, want, drawn[target].values, part);
|
|
3420
4958
|
}
|
|
3421
4959
|
out[target] = rows;
|
|
3422
4960
|
}
|
|
3423
4961
|
return out;
|
|
3424
4962
|
}
|
|
4963
|
+
function labelOpacityBypasses(rows, want, got) {
|
|
4964
|
+
const label = want("labelOpacity");
|
|
4965
|
+
const whole = want("opacity");
|
|
4966
|
+
const at = (v) => typeof v === "number" ? v : 1;
|
|
4967
|
+
for (let i = 0; i < rows.length; i++) {
|
|
4968
|
+
const [l, o] = [at(label[i]), at(whole[i])];
|
|
4969
|
+
const rewritten = rows[i]?.opacity !== void 0;
|
|
4970
|
+
if (l === at(got.labelOpacity?.[i]) && !rewritten || Number.isNaN(o) || o <= 0) {
|
|
4971
|
+
continue;
|
|
4972
|
+
}
|
|
4973
|
+
if (l === o && rewritten) {
|
|
4974
|
+
continue;
|
|
4975
|
+
}
|
|
4976
|
+
if (l <= o) {
|
|
4977
|
+
rows[i] = { ...rows[i], "text-opacity": num6(l / o) };
|
|
4978
|
+
} else if (l > 0) {
|
|
4979
|
+
rows[i] = { ...rows[i], opacity: num6(l), "line-opacity": num6(o / l), "text-opacity": 1 };
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
function partOpacityBypasses(rows, want, got, part) {
|
|
4984
|
+
const [property, name, by, drawnBy] = part;
|
|
4985
|
+
const own = want(property);
|
|
4986
|
+
const whole = want(by);
|
|
4987
|
+
const shown = drawnBy === null ? null : want(drawnBy);
|
|
4988
|
+
const at = (v) => typeof v === "number" ? v : 1;
|
|
4989
|
+
for (let i = 0; i < rows.length; i++) {
|
|
4990
|
+
if (shown !== null && shown[i] === null) {
|
|
4991
|
+
continue;
|
|
4992
|
+
}
|
|
4993
|
+
const [r, o] = [at(own[i]), at(whole[i])];
|
|
4994
|
+
const rewritten = rows[i]?.opacity !== void 0 || rows[i]?.["text-opacity"] !== void 0;
|
|
4995
|
+
if (r === at(got[property]?.[i]) && !rewritten || Number.isNaN(o) || o <= 0 || r > o) {
|
|
4996
|
+
continue;
|
|
4997
|
+
}
|
|
4998
|
+
rows[i] = { ...rows[i], [name]: num6(r / o) };
|
|
4999
|
+
}
|
|
5000
|
+
}
|
|
5001
|
+
function labelSizedBypasses(rows, want, got) {
|
|
5002
|
+
const fit = want("labelFit");
|
|
5003
|
+
for (const p of ["width", "height"]) {
|
|
5004
|
+
const size = want(p);
|
|
5005
|
+
for (let i = 0; i < rows.length; i++) {
|
|
5006
|
+
if (fit[i] === "bounds" && size[i] === 0 && !(got.labelFit?.[i] === "bounds" && got[p]?.[i] === 0)) {
|
|
5007
|
+
rows[i] = { ...rows[i], [p]: "label" };
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
5011
|
+
}
|
|
3425
5012
|
function addBypasses(rows, target, property, want, got) {
|
|
3426
5013
|
for (let i = 0; i < rows.length; i++) {
|
|
3427
5014
|
const w = want[i];
|
|
@@ -3453,4 +5040,4 @@ export {
|
|
|
3453
5040
|
evaluateCytoscapeJs as e,
|
|
3454
5041
|
toCytoscapeStylesheet as t
|
|
3455
5042
|
};
|
|
3456
|
-
//# sourceMappingURL=emit-
|
|
5043
|
+
//# sourceMappingURL=emit-BwHQkZle.js.map
|