@graphty/graph-io 0.3.48 → 0.3.50
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-C2riR4NT.js → approximations-BRXsll0T.js} +2 -2
- package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-BRXsll0T.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-Cu22ewuS.js → block-yl0f_qLO.js} +931 -164
- package/dist/chunks/block-yl0f_qLO.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-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
- package/dist/chunks/codes-BE2xir2k.js.map +1 -0
- package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
- package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
- package/dist/chunks/{context-cgmmOxZ2.js → context-DizmppHy.js} +5 -4
- package/dist/chunks/{context-cgmmOxZ2.js.map → context-DizmppHy.js.map} +1 -1
- 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-BiQsnMTb.js → credentials-CmvJXYeH.js} +67 -16
- package/dist/chunks/credentials-CmvJXYeH.js.map +1 -0
- package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
- package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
- package/dist/chunks/descriptor-B28U25x4.js +60 -0
- package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
- package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-Dhez_Cew.js} +11 -2
- package/dist/chunks/descriptor-Dhez_Cew.js.map +1 -0
- package/dist/chunks/{emit-CD8xnY8s.js → emit-7Jkpg0yd.js} +1788 -133
- package/dist/chunks/emit-7Jkpg0yd.js.map +1 -0
- package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
- package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
- package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
- package/dist/chunks/export-Cha4dRFz.js.map +1 -0
- package/dist/chunks/{exporter-ChjL5fmP.js → exporter-1Ajud15J.js} +9 -8
- package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-1Ajud15J.js.map} +1 -1
- package/dist/chunks/{exporter-BIdaoIgh.js → exporter-B6yvL3wy.js} +7 -7
- package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-B6yvL3wy.js.map} +1 -1
- package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
- package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
- package/dist/chunks/{exporter-DtVU80Fa.js → exporter-CA5q8ROP.js} +9 -8
- package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-CA5q8ROP.js.map} +1 -1
- package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-CQQZFJ2v.js} +1284 -156
- package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
- package/dist/chunks/format-BXiAb-1h.js +408 -0
- package/dist/chunks/format-BXiAb-1h.js.map +1 -0
- package/dist/chunks/{generic-CP6YD34u.js → generic-Dc21MAdg.js} +387 -31
- package/dist/chunks/generic-Dc21MAdg.js.map +1 -0
- package/dist/chunks/{importer-B87_fmVx.js → importer-C6NVpCXp.js} +327 -84
- package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
- package/dist/chunks/{importer-DPZDN40-.js → importer-CKFe4q54.js} +25 -17
- package/dist/chunks/importer-CKFe4q54.js.map +1 -0
- package/dist/chunks/{importer-Bji2MeWr.js → importer-CKbUbsJA.js} +13 -10
- package/dist/chunks/{importer-Bji2MeWr.js.map → importer-CKbUbsJA.js.map} +1 -1
- package/dist/chunks/{importer-CB_zV5_L.js → importer-ClCsdgTJ.js} +208 -1104
- package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
- package/dist/chunks/{importer-e3huMZbm.js → importer-CyVZTrf0.js} +14 -10
- package/dist/chunks/importer-CyVZTrf0.js.map +1 -0
- package/dist/chunks/{importer-CVT-JyDE.js → importer-DgG4v1Ms.js} +1537 -355
- package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
- package/dist/chunks/{importer-Cyy6UseH.js → importer-asFUrIsj.js} +66 -13
- package/dist/chunks/importer-asFUrIsj.js.map +1 -0
- package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
- package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
- package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
- package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
- package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-IVRq2Uoo.js} +282 -74
- package/dist/chunks/lexicon-IVRq2Uoo.js.map +1 -0
- package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
- package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
- package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
- package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
- package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
- package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
- package/dist/chunks/round-trip-Cy3_SHRZ.js +79 -0
- package/dist/chunks/round-trip-Cy3_SHRZ.js.map +1 -0
- package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-BXwVbza3.js} +5 -5
- package/dist/chunks/sigv4-BXwVbza3.js.map +1 -0
- package/dist/chunks/{styles-CaABMoO1.js → styles-CAVmBLgp.js} +1237 -138
- package/dist/chunks/styles-CAVmBLgp.js.map +1 -0
- package/dist/chunks/styles-CPczw1Jz.js +1928 -0
- package/dist/chunks/styles-CPczw1Jz.js.map +1 -0
- package/dist/chunks/styles-boK6Ln54.js +2847 -0
- package/dist/chunks/styles-boK6Ln54.js.map +1 -0
- package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-XeFBQ6VS.js} +506 -175
- package/dist/chunks/styles-yed-XeFBQ6VS.js.map +1 -0
- package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
- package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
- package/dist/csv.js +7 -7
- package/dist/cx.js +2 -2
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +8 -4
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +42 -12
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +848 -194
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +230 -193
- 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 -6
- 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.js +141 -23
- package/dist/sources-cypher.js.map +1 -1
- package/dist/sources-ndex.js +2 -2
- package/dist/sources-rest.js +32 -6
- package/dist/sources-rest.js.map +1 -1
- package/dist/sources-sparql.d.ts +1 -0
- package/dist/sources-sparql.js +439 -0
- package/dist/sources-sparql.js.map +1 -0
- 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 +117 -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/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +34 -2
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts +6 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +170 -33
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +3 -1
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +2 -1
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/label-places.d.ts +41 -0
- package/dist/src/formats/dot/label-places.d.ts.map +1 -0
- package/dist/src/formats/dot/label-places.js +185 -0
- package/dist/src/formats/dot/label-places.js.map +1 -0
- package/dist/src/formats/dot/names.d.ts +13 -0
- package/dist/src/formats/dot/names.d.ts.map +1 -1
- package/dist/src/formats/dot/names.js +13 -0
- package/dist/src/formats/dot/names.js.map +1 -1
- 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 +72 -2
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +1500 -119
- 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 +58 -31
- package/dist/src/formats/gexf/styles.d.ts.map +1 -1
- package/dist/src/formats/gexf/styles.js +848 -225
- 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 +754 -102
- 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 +6 -10
- 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 +695 -164
- 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 +431 -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 +1843 -136
- package/dist/src/formats/json/styles.js.map +1 -1
- package/dist/src/formats/pajek/draw.d.ts +104 -0
- package/dist/src/formats/pajek/draw.d.ts.map +1 -0
- package/dist/src/formats/pajek/draw.js +382 -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 +1395 -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 +277 -60
- package/dist/src/formats/xgmml/styles.js.map +1 -1
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -5
- 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/sources/builtins.d.ts +1 -1
- package/dist/src/sources/builtins.d.ts.map +1 -1
- package/dist/src/sources/builtins.js +8 -2
- package/dist/src/sources/builtins.js.map +1 -1
- package/dist/src/sources/context.d.ts.map +1 -1
- package/dist/src/sources/context.js +1 -0
- package/dist/src/sources/context.js.map +1 -1
- package/dist/src/sources/credentials.d.ts +50 -1
- package/dist/src/sources/credentials.d.ts.map +1 -1
- package/dist/src/sources/credentials.js +69 -0
- package/dist/src/sources/credentials.js.map +1 -1
- package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
- package/dist/src/sources/cypher/descriptor.js +5 -0
- package/dist/src/sources/cypher/descriptor.js.map +1 -1
- package/dist/src/sources/cypher/index.d.ts.map +1 -1
- package/dist/src/sources/cypher/index.js +125 -18
- package/dist/src/sources/cypher/index.js.map +1 -1
- package/dist/src/sources/cypher/params.d.ts +1 -1
- package/dist/src/sources/cypher/params.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.d.ts +17 -0
- package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
- package/dist/src/sources/cypher/query-builder.js +31 -0
- package/dist/src/sources/cypher/query-builder.js.map +1 -1
- package/dist/src/sources/ids.d.ts +5 -0
- package/dist/src/sources/ids.d.ts.map +1 -1
- package/dist/src/sources/ids.js +5 -0
- package/dist/src/sources/ids.js.map +1 -1
- package/dist/src/sources/params.d.ts +3 -0
- package/dist/src/sources/params.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
- package/dist/src/sources/rest/descriptor.js +9 -0
- package/dist/src/sources/rest/descriptor.js.map +1 -1
- package/dist/src/sources/rest/openalex.d.ts +4 -2
- package/dist/src/sources/rest/openalex.d.ts.map +1 -1
- package/dist/src/sources/rest/openalex.js +4 -2
- package/dist/src/sources/rest/openalex.js.map +1 -1
- package/dist/src/sources/rest/source.d.ts.map +1 -1
- package/dist/src/sources/rest/source.js +38 -0
- package/dist/src/sources/rest/source.js.map +1 -1
- package/dist/src/sources/run.d.ts +2 -0
- package/dist/src/sources/run.d.ts.map +1 -1
- package/dist/src/sources/run.js +30 -3
- package/dist/src/sources/run.js.map +1 -1
- package/dist/src/sources/sigv4.d.ts +5 -3
- package/dist/src/sources/sigv4.d.ts.map +1 -1
- package/dist/src/sources/sigv4.js +6 -4
- package/dist/src/sources/sigv4.js.map +1 -1
- 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 +327 -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 +73 -0
- package/dist/src/sources/sparql/query.d.ts.map +1 -0
- package/dist/src/sources/sparql/query.js +164 -0
- package/dist/src/sources/sparql/query.js.map +1 -0
- package/dist/src/sources/types.d.ts +60 -0
- package/dist/src/sources/types.d.ts.map +1 -1
- 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 +89 -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 +1139 -79
- 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 +4 -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 +232 -10
- 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 +44 -1
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
- package/dist/src/styles/cyjs/mappers.js +475 -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 +156 -48
- package/dist/src/styles/cytoscape/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +387 -77
- 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 +42 -2
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/resolve.js +623 -17
- package/dist/src/styles/cytoscape/resolve.js.map +1 -1
- package/dist/src/styles/defaults.d.ts +46 -26
- package/dist/src/styles/defaults.d.ts.map +1 -1
- package/dist/src/styles/defaults.js +308 -71
- 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/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 +6 -1
- 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 +11 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -1
- package/dist/src/styles/plan/resolve.js +40 -4
- 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 +687 -6
- 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 +224 -0
- package/dist/src/styles/vocabulary.js.map +1 -1
- package/dist/styles.js +30 -239
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/package.json +27 -7
- package/src/formats/cx/importer.ts +6 -1
- package/src/formats/cx/styles.ts +143 -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/exporter.ts +37 -1
- package/src/formats/dot/importer.ts +192 -36
- package/src/formats/dot/index.ts +3 -1
- package/src/formats/dot/label-places.ts +241 -0
- package/src/formats/dot/names.ts +15 -0
- package/src/formats/dot/record.ts +336 -0
- package/src/formats/dot/styles.ts +1702 -149
- 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 +1099 -245
- 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 +852 -110
- package/src/formats/graphml/styles-plain.ts +6 -15
- package/src/formats/graphml/styles-yed.ts +765 -176
- package/src/formats/graphml/styles-yfiles3.ts +487 -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 +2123 -171
- package/src/formats/pajek/draw.ts +469 -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 +1506 -133
- package/src/formats/pajek/syntax.ts +27 -2
- package/src/formats/xgmml/emit.ts +73 -5
- package/src/formats/xgmml/styles.ts +330 -71
- package/src/index.ts +12 -1
- 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/sources/builtins.ts +8 -1
- package/src/sources/context.ts +1 -0
- package/src/sources/credentials.ts +90 -1
- package/src/sources/cypher/descriptor.ts +7 -1
- package/src/sources/cypher/index.ts +149 -18
- package/src/sources/cypher/params.ts +1 -1
- package/src/sources/cypher/query-builder.ts +33 -0
- package/src/sources/ids.ts +6 -0
- package/src/sources/params.ts +3 -0
- package/src/sources/rest/descriptor.ts +9 -0
- package/src/sources/rest/openalex.ts +4 -2
- package/src/sources/rest/source.ts +41 -0
- package/src/sources/run.ts +35 -3
- package/src/sources/sigv4.ts +6 -4
- package/src/sources/sparql/descriptor.ts +67 -0
- package/src/sources/sparql/index.ts +371 -0
- package/src/sources/sparql/ntriples.ts +219 -0
- package/src/sources/sparql/params.ts +28 -0
- package/src/sources/sparql/query.ts +216 -0
- package/src/sources/types.ts +68 -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 +107 -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 +1303 -84
- package/src/styles/cyjs/defaults-table.ts +4 -0
- package/src/styles/cyjs/emit.ts +268 -14
- package/src/styles/cyjs/face.ts +372 -0
- package/src/styles/cyjs/mappers.ts +506 -27
- package/src/styles/cyjs/routes.ts +432 -0
- package/src/styles/cytoscape/charts.ts +684 -0
- package/src/styles/cytoscape/emit.ts +170 -48
- package/src/styles/cytoscape/lexicon.ts +431 -78
- package/src/styles/cytoscape/mappings.ts +108 -0
- package/src/styles/cytoscape/resolve.ts +741 -17
- package/src/styles/defaults.ts +417 -108
- package/src/styles/index.ts +5 -0
- package/src/styles/internal.ts +1 -0
- package/src/styles/io/generic.ts +79 -23
- package/src/styles/io/round-trip.ts +202 -0
- package/src/styles/io/writer.ts +6 -1
- 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 +47 -4
- package/src/styles/slots.ts +25 -0
- package/src/styles/types.ts +698 -5
- package/src/styles/vocabulary.ts +232 -2
- package/dist/chunks/block-Cu22ewuS.js.map +0 -1
- package/dist/chunks/choose-Cdx6Enl2.js +0 -57
- package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
- package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
- package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
- package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
- package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
- package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
- package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
- package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
- package/dist/chunks/format-BMS-1Nxb.js +0 -64
- package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
- package/dist/chunks/generic-CP6YD34u.js.map +0 -1
- package/dist/chunks/importer-B87_fmVx.js.map +0 -1
- package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
- package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
- package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
- package/dist/chunks/importer-DPZDN40-.js.map +0 -1
- package/dist/chunks/importer-e3huMZbm.js.map +0 -1
- package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
- package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
- package/dist/chunks/styles-CaABMoO1.js.map +0 -1
- package/dist/chunks/styles-P_gmFAOi.js +0 -770
- package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
- package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
- package/dist/chunks/writer-DvHTl36J.js +0 -449
- package/dist/chunks/writer-DvHTl36J.js.map +0 -1
package/dist/styles.js
CHANGED
|
@@ -1,226 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const CYTOSCAPE_ANNOTATIONS_COLUMN = "__Annotations";
|
|
8
|
-
const TYPE_PREFIX = "org.cytoscape.view.presentation.annotations.";
|
|
9
|
-
const SHAPES = /* @__PURE__ */ new Map([
|
|
10
|
-
["rectangle", "rectangle"],
|
|
11
|
-
["roundedrectangle", "round-rectangle"],
|
|
12
|
-
["rounded_rectangle", "round-rectangle"],
|
|
13
|
-
["ellipse", "ellipse"],
|
|
14
|
-
["triangle", "triangle"],
|
|
15
|
-
["diamond", "diamond"],
|
|
16
|
-
["pentagon", "pentagon"],
|
|
17
|
-
["hexagon", "hexagon"],
|
|
18
|
-
["octagon", "octagon"],
|
|
19
|
-
["parallelogram", "parallelogram"],
|
|
20
|
-
["star5", "star"],
|
|
21
|
-
["star6", "star"]
|
|
22
|
-
]);
|
|
23
|
-
const ARROW_ORDER = [
|
|
24
|
-
"circle",
|
|
25
|
-
"triangle",
|
|
26
|
-
"vee",
|
|
27
|
-
"diamond",
|
|
28
|
-
"triangle-open",
|
|
29
|
-
"none",
|
|
30
|
-
"tee",
|
|
31
|
-
"triangle",
|
|
32
|
-
"triangle",
|
|
33
|
-
"triangle",
|
|
34
|
-
"tee",
|
|
35
|
-
"other:x"
|
|
36
|
-
];
|
|
37
|
-
const ARROW_NAMES = /* @__PURE__ */ new Map([
|
|
38
|
-
["circle", "circle"],
|
|
39
|
-
["closed arrow", "triangle"],
|
|
40
|
-
["concave arrow", "vee"],
|
|
41
|
-
["diamond", "diamond"],
|
|
42
|
-
["open arrow", "triangle-open"],
|
|
43
|
-
["no arrow", "none"],
|
|
44
|
-
["pipe", "tee"],
|
|
45
|
-
["triangle", "triangle"],
|
|
46
|
-
["t", "tee"],
|
|
47
|
-
["x", "other:x"]
|
|
48
|
-
]);
|
|
49
|
-
function readAnnotations(snapshot) {
|
|
50
|
-
const { graph } = snapshot;
|
|
51
|
-
const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;
|
|
52
|
-
const entries = cellStrings(cell);
|
|
53
|
-
const fields = entries.map(parseEntry);
|
|
54
|
-
const byId = new Map(fields.map((f, i) => [f.get("uuid") ?? String(i), f]));
|
|
55
|
-
const annotations = [];
|
|
56
|
-
const skipped = /* @__PURE__ */ new Set();
|
|
57
|
-
fields.forEach((f, i) => {
|
|
58
|
-
const read = readOne(f, String(i), byId);
|
|
59
|
-
if (read === null) {
|
|
60
|
-
skipped.add((f.get("type") ?? "").replace(TYPE_PREFIX, ""));
|
|
61
|
-
} else {
|
|
62
|
-
annotations.push(...read);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return { annotations, skipped: [...skipped] };
|
|
66
|
-
}
|
|
67
|
-
function cellStrings(cell) {
|
|
68
|
-
if (typeof cell === "string") {
|
|
69
|
-
return cell.split(/[\r\n]+/).filter((s) => s !== "");
|
|
70
|
-
}
|
|
71
|
-
if (cell !== null && typeof cell === "object" && Symbol.iterator in cell) {
|
|
72
|
-
return Array.from(cell).filter((s) => typeof s === "string" && s !== "");
|
|
73
|
-
}
|
|
74
|
-
return [];
|
|
75
|
-
}
|
|
76
|
-
function parseEntry(entry) {
|
|
77
|
-
const out = /* @__PURE__ */ new Map();
|
|
78
|
-
for (const part of entry.split("|")) {
|
|
79
|
-
const eq = part.indexOf("=");
|
|
80
|
-
if (eq > 0) {
|
|
81
|
-
out.set(part.slice(0, eq), part.slice(eq + 1));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return out;
|
|
85
|
-
}
|
|
86
|
-
function readOne(f, index, byId) {
|
|
87
|
-
const type = (f.get("type") ?? "").replace(TYPE_PREFIX, "");
|
|
88
|
-
const zoom = positive(f.get("zoom")) ?? 1;
|
|
89
|
-
const base = {
|
|
90
|
-
id: f.get("uuid") ?? index,
|
|
91
|
-
layer: f.get("canvas") === "background" ? "background" : "foreground",
|
|
92
|
-
z: num(f.get("z")) ?? 0
|
|
93
|
-
};
|
|
94
|
-
switch (type) {
|
|
95
|
-
case "ShapeAnnotation":
|
|
96
|
-
return [shapeOf(f, base, zoom)];
|
|
97
|
-
case "TextAnnotation":
|
|
98
|
-
return [textOf(f, base, zoom, { x: num(f.get("x")) ?? 0, y: -(num(f.get("y")) ?? 0) }, "top-left")];
|
|
99
|
-
case "BoundedTextAnnotation": {
|
|
100
|
-
const shape = shapeOf(f, base, zoom);
|
|
101
|
-
return [shape, textOf(f, { ...base, id: `${base.id}:text` }, zoom, shape.center, "center")];
|
|
102
|
-
}
|
|
103
|
-
case "ArrowAnnotation":
|
|
104
|
-
return arrowOf(f, base, zoom, byId);
|
|
105
|
-
default:
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function shapeOf(f, base, zoom) {
|
|
110
|
-
const x = num(f.get("x")) ?? 0;
|
|
111
|
-
const y = num(f.get("y")) ?? 0;
|
|
112
|
-
const width = (positive(f.get("width")) ?? 0) / zoom;
|
|
113
|
-
const height = (positive(f.get("height")) ?? 0) / zoom;
|
|
114
|
-
const fill = javaColor(f.get("fillColor"));
|
|
115
|
-
const border = javaColor(f.get("edgeColor")) ?? { color: "#000000", alpha: 1 };
|
|
116
|
-
return {
|
|
117
|
-
...base,
|
|
118
|
-
kind: "shape",
|
|
119
|
-
center: { x: x + width / 2, y: -(y + height / 2) },
|
|
120
|
-
width,
|
|
121
|
-
height,
|
|
122
|
-
shape: SHAPES.get((f.get("shapeType") ?? "rectangle").toLowerCase()) ?? "rectangle",
|
|
123
|
-
fill: fill?.color ?? null,
|
|
124
|
-
fillOpacity: fill === null ? 0 : fill.alpha * percent(f.get("fillOpacity")),
|
|
125
|
-
borderColor: border.color,
|
|
126
|
-
borderOpacity: border.alpha * percent(f.get("edgeOpacity")),
|
|
127
|
-
borderWidth: (num(f.get("edgeThickness")) ?? 1) / zoom
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function textOf(f, base, zoom, at, anchor) {
|
|
131
|
-
const style = num(f.get("fontStyle")) ?? 0;
|
|
132
|
-
const color = javaColor(f.get("color")) ?? { color: "#000000", alpha: 1 };
|
|
133
|
-
return {
|
|
134
|
-
...base,
|
|
135
|
-
kind: "text",
|
|
136
|
-
text: f.get("text") ?? "",
|
|
137
|
-
at,
|
|
138
|
-
anchor,
|
|
139
|
-
fontSize: (positive(f.get("fontSize")) ?? 12) / zoom,
|
|
140
|
-
fontFamily: f.get("fontFamily") ?? "sans-serif",
|
|
141
|
-
bold: (style & 1) !== 0,
|
|
142
|
-
italic: (style & 2) !== 0,
|
|
143
|
-
color: color.color,
|
|
144
|
-
opacity: color.alpha
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function arrowOf(f, base, zoom, byId) {
|
|
148
|
-
const target = f.get("targetAnnotation");
|
|
149
|
-
const to = point(f.get("targetPoint")) ?? point(f.get("targetNode")) ?? centerOf(byId.get(target ?? ""), zoom);
|
|
150
|
-
if (to === null) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
const corner = { x: num(f.get("x")) ?? 0, y: num(f.get("y")) ?? 0 };
|
|
154
|
-
const source = centerOf(byId.get(f.get("sourceAnnotation") ?? ""), zoom) ?? corner;
|
|
155
|
-
const from = { x: to.x > corner.x ? corner.x : source.x, y: to.y > corner.y ? corner.y : source.y };
|
|
156
|
-
const color = javaColor(f.get("lineColor")) ?? { color: "#000000", alpha: 1 };
|
|
157
|
-
return [
|
|
158
|
-
{
|
|
159
|
-
...base,
|
|
160
|
-
kind: "arrow",
|
|
161
|
-
from: { x: from.x, y: -from.y },
|
|
162
|
-
to: { x: to.x, y: -to.y },
|
|
163
|
-
color: color.color,
|
|
164
|
-
opacity: color.alpha * percent(f.get("lineOpacity")),
|
|
165
|
-
width: (positive(f.get("lineThickness")) ?? 1) / zoom,
|
|
166
|
-
sourceArrow: arrowShape(f.get("sourceType")),
|
|
167
|
-
targetArrow: arrowShape(f.get("targetType")),
|
|
168
|
-
sourceSize: positive(f.get("sourceSize")) ?? 1,
|
|
169
|
-
targetSize: positive(f.get("targetSize")) ?? 1
|
|
170
|
-
}
|
|
171
|
-
];
|
|
172
|
-
}
|
|
173
|
-
function centerOf(f, zoom) {
|
|
174
|
-
if (f === void 0) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
const x = num(f.get("x"));
|
|
178
|
-
const y = num(f.get("y"));
|
|
179
|
-
if (x === null || y === null) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
return { x: x + (positive(f.get("width")) ?? 0) / zoom / 2, y: y + (positive(f.get("height")) ?? 0) / zoom / 2 };
|
|
183
|
-
}
|
|
184
|
-
function arrowShape(raw) {
|
|
185
|
-
if (raw === void 0) {
|
|
186
|
-
return "none";
|
|
187
|
-
}
|
|
188
|
-
const n = num(raw);
|
|
189
|
-
if (n !== null) {
|
|
190
|
-
return ARROW_ORDER[n] ?? "triangle";
|
|
191
|
-
}
|
|
192
|
-
return ARROW_NAMES.get(raw.trim().toLowerCase()) ?? "triangle";
|
|
193
|
-
}
|
|
194
|
-
function point(raw) {
|
|
195
|
-
const [x, y] = (raw ?? "").split(",").map((s) => num(s));
|
|
196
|
-
return x === null || x === void 0 || y === null || y === void 0 ? null : { x, y };
|
|
197
|
-
}
|
|
198
|
-
function javaColor(raw) {
|
|
199
|
-
const n = num(raw);
|
|
200
|
-
if (n === null || !Number.isInteger(n)) {
|
|
201
|
-
return null;
|
|
202
|
-
}
|
|
203
|
-
const argb = n >>> 0;
|
|
204
|
-
return {
|
|
205
|
-
color: `#${(argb & 16777215).toString(16).padStart(6, "0")}`,
|
|
206
|
-
alpha: (argb >>> 24) / 255
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
function percent(raw) {
|
|
210
|
-
const n = num(raw);
|
|
211
|
-
return n === null ? 1 : Math.min(1, Math.max(0, n / 100));
|
|
212
|
-
}
|
|
213
|
-
function num(raw) {
|
|
214
|
-
if (raw === void 0 || raw.trim() === "") {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
const n = Number(raw);
|
|
218
|
-
return Number.isFinite(n) ? n : null;
|
|
219
|
-
}
|
|
220
|
-
function positive(raw) {
|
|
221
|
-
const n = num(raw);
|
|
222
|
-
return n !== null && n > 0 ? n : null;
|
|
223
|
-
}
|
|
1
|
+
import { p as planStyles } from "./chunks/generic-Dc21MAdg.js";
|
|
2
|
+
import { M, e, r, a } from "./chunks/generic-Dc21MAdg.js";
|
|
3
|
+
import { h as StyleNotes, t as featuresOf, o as styleFingerprint } from "./chunks/block-yl0f_qLO.js";
|
|
4
|
+
import { u, S, v, b, w, T, l, x, r as r2, y } from "./chunks/block-yl0f_qLO.js";
|
|
5
|
+
import { S as StyleBudget, e as evaluateCytoscapeJs } from "./chunks/emit-7Jkpg0yd.js";
|
|
6
|
+
import { C, t } from "./chunks/emit-7Jkpg0yd.js";
|
|
224
7
|
const FUNCTION = () => null;
|
|
225
8
|
function withFunctions(style) {
|
|
226
9
|
if (!Array.isArray(style)) {
|
|
@@ -237,8 +20,8 @@ function withFunctions(style) {
|
|
|
237
20
|
}
|
|
238
21
|
const copy = /* @__PURE__ */ Object.create(null);
|
|
239
22
|
for (const name of Object.keys(props)) {
|
|
240
|
-
const
|
|
241
|
-
copy[name] =
|
|
23
|
+
const v2 = props[name];
|
|
24
|
+
copy[name] = v2 === "fn" ? FUNCTION : v2;
|
|
242
25
|
}
|
|
243
26
|
return { selector: e2.selector, style: copy };
|
|
244
27
|
});
|
|
@@ -268,7 +51,7 @@ function readCytoscapeStyles(input) {
|
|
|
268
51
|
}
|
|
269
52
|
}
|
|
270
53
|
}
|
|
271
|
-
const
|
|
54
|
+
const r3 = evaluateCytoscapeJs({
|
|
272
55
|
elements: input.elements,
|
|
273
56
|
style: withFunctions(input.style),
|
|
274
57
|
snapshot: input.snapshot,
|
|
@@ -285,8 +68,8 @@ function readCytoscapeStyles(input) {
|
|
|
285
68
|
dialect: "cytoscape-js",
|
|
286
69
|
tool: "cytoscape-js",
|
|
287
70
|
units: "px",
|
|
288
|
-
node: { values:
|
|
289
|
-
edge: { values:
|
|
71
|
+
node: { values: r3.node.values, rules: r3.node.rules, columns: r3.node.columns },
|
|
72
|
+
edge: { values: r3.edge.values, rules: r3.edge.rules, columns: r3.edge.columns },
|
|
290
73
|
fingerprint: styleFingerprint(s)
|
|
291
74
|
},
|
|
292
75
|
{ node: featuresOf(s, "node"), edge: featuresOf(s, "edge") },
|
|
@@ -295,28 +78,36 @@ function readCytoscapeStyles(input) {
|
|
|
295
78
|
notes,
|
|
296
79
|
budget,
|
|
297
80
|
signal: input.signal,
|
|
298
|
-
rawColumns: { node:
|
|
81
|
+
rawColumns: { node: r3.node.rawColumns, edge: r3.edge.rawColumns }
|
|
299
82
|
}
|
|
300
83
|
);
|
|
301
84
|
}
|
|
85
|
+
const BYPASS_NAMESPACES = /* @__PURE__ */ new Set(["cx.bypass", "cx2.bypass"]);
|
|
86
|
+
function isStyleSlotColumn(meta) {
|
|
87
|
+
const { origin } = meta;
|
|
88
|
+
return typeof origin?.namespace === "string" && BYPASS_NAMESPACES.has(origin.namespace) || meta.dtype === "json" && origin?.type === "graphics" && origin.namespace === "xgmml";
|
|
89
|
+
}
|
|
302
90
|
export {
|
|
303
|
-
|
|
304
|
-
|
|
91
|
+
C as CYTOSCAPE_IMPORT_KEY,
|
|
92
|
+
u as MAX_STYLE_BLOCK_LENGTH,
|
|
305
93
|
M as MAX_STYLE_RULES,
|
|
306
94
|
S as STYLE_BLOCK_NAME,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
95
|
+
v as STYLE_ENUMS,
|
|
96
|
+
b as STYLE_ISSUE,
|
|
97
|
+
w as STYLE_PROPERTIES,
|
|
310
98
|
T as TOOL_DEFAULTS,
|
|
311
99
|
e as extractStyles,
|
|
312
100
|
featuresOf,
|
|
313
|
-
|
|
101
|
+
isStyleSlotColumn,
|
|
102
|
+
l as isStyleValue,
|
|
103
|
+
x as matchPredicate,
|
|
314
104
|
planStyles,
|
|
315
|
-
readAnnotations,
|
|
105
|
+
r as readAnnotations,
|
|
316
106
|
readCytoscapeStyles,
|
|
317
|
-
|
|
107
|
+
a as readImageAnnotations,
|
|
108
|
+
r2 as resolveStyles,
|
|
318
109
|
styleFingerprint,
|
|
319
|
-
|
|
320
|
-
|
|
110
|
+
t as toCytoscapeStylesheet,
|
|
111
|
+
y as toolDefaults
|
|
321
112
|
};
|
|
322
113
|
//# sourceMappingURL=styles.js.map
|
package/dist/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../src/styles/annotations.ts","../src/styles/cyjs/live.ts"],"sourcesContent":["/**\n * The annotations a file draws beside its graph: shapes, text notes and arrows that are not nodes or edges. Cytoscape\n * desktop keeps them in the network's `__Annotations` column (sessions, XGMML, CX and CX2 all carry it), one\n * `key=value|key=value` string per annotation; this reads them as neutral facts in the position convention (y up,\n * the file's own units), so they line up with `extractPositions()`.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport type { StyleArrowShape, StyleColor, StyleNodeShape } from \"./types.js\";\n\n/**\n * A point in the position convention: y up, in the file's own units.\n * @category Styles\n */\nexport interface AnnotationPoint {\n /** The x coordinate. */\n readonly x: number;\n /** The y coordinate, y up. */\n readonly y: number;\n}\n\n/**\n * What every annotation has.\n * @category Styles\n */\nexport interface AnnotationBase {\n /** The file's id for the annotation, or its index when the file gives none. */\n readonly id: string;\n /** Whether it is drawn behind the graph or in front of it. */\n readonly layer: \"background\" | \"foreground\";\n /** Its drawing order within its layer, lowest first. */\n readonly z: number;\n}\n\n/**\n * A filled, outlined shape.\n * @category Styles\n */\nexport interface ShapeAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"shape\". */\n readonly kind: \"shape\";\n /** The box's center. */\n readonly center: AnnotationPoint;\n /** The box's width. */\n readonly width: number;\n /** The box's height. */\n readonly height: number;\n /** The outline's shape. */\n readonly shape: StyleNodeShape;\n /** The fill color, or null for none. */\n readonly fill: StyleColor | null;\n /** The fill's opacity, 0..1. */\n readonly fillOpacity: number;\n /** The outline's color. */\n readonly borderColor: StyleColor;\n /** The outline's opacity, 0..1. */\n readonly borderOpacity: number;\n /** The outline's width. */\n readonly borderWidth: number;\n}\n\n/**\n * A line of text.\n * @category Styles\n */\nexport interface TextAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"text\". */\n readonly kind: \"text\";\n /** The text. */\n readonly text: string;\n /** Where the text is placed: the top-left corner of its box, or its center. */\n readonly at: AnnotationPoint;\n /** What `at` is. */\n readonly anchor: \"top-left\" | \"center\";\n /** The font size, in the file's units. */\n readonly fontSize: number;\n /** The font family. */\n readonly fontFamily: string;\n /** Whether the text is bold. */\n readonly bold: boolean;\n /** Whether the text is italic. */\n readonly italic: boolean;\n /** The text color. */\n readonly color: StyleColor;\n /** The text's opacity, 0..1. */\n readonly opacity: number;\n}\n\n/**\n * A line between two points, with an arrowhead at either end.\n * @category Styles\n */\nexport interface ArrowAnnotation extends AnnotationBase {\n /** Which kind of annotation this is: always \"arrow\". */\n readonly kind: \"arrow\";\n /** Where the line starts. */\n readonly from: AnnotationPoint;\n /** Where it ends. */\n readonly to: AnnotationPoint;\n /** The line color. */\n readonly color: StyleColor;\n /** The line's opacity, 0..1. */\n readonly opacity: number;\n /** The line width. */\n readonly width: number;\n /** The arrowhead at the start. */\n readonly sourceArrow: StyleArrowShape;\n /** The arrowhead at the end. */\n readonly targetArrow: StyleArrowShape;\n /** The start's arrowhead size as a factor of the normal size. */\n readonly sourceSize: number;\n /** The end's arrowhead size as a factor of the normal size. */\n readonly targetSize: number;\n}\n\n/**\n * One annotation.\n * @category Styles\n */\nexport type GraphAnnotation = ShapeAnnotation | TextAnnotation | ArrowAnnotation;\n\n/**\n * A file's annotations, and the kinds it holds that are not read (images, groups of annotations), by the file's\n * own type name, once each.\n * @category Styles\n */\nexport interface FileAnnotations {\n /** The annotations read, in the file's order. */\n readonly annotations: readonly GraphAnnotation[];\n /** The file's type names of the annotations not read. */\n readonly skipped: readonly string[];\n}\n\n/** The graph column Cytoscape desktop keeps its annotations in. */\nconst CYTOSCAPE_ANNOTATIONS_COLUMN = \"__Annotations\";\n\nconst TYPE_PREFIX = \"org.cytoscape.view.presentation.annotations.\";\n\n/** Cytoscape's annotation shape names, lowercase, as neutral shapes. */\nconst SHAPES: ReadonlyMap<string, StyleNodeShape> = new Map<string, StyleNodeShape>([\n [\"rectangle\", \"rectangle\"],\n [\"roundedrectangle\", \"round-rectangle\"],\n [\"rounded_rectangle\", \"round-rectangle\"],\n [\"ellipse\", \"ellipse\"],\n [\"triangle\", \"triangle\"],\n [\"diamond\", \"diamond\"],\n [\"pentagon\", \"pentagon\"],\n [\"hexagon\", \"hexagon\"],\n [\"octagon\", \"octagon\"],\n [\"parallelogram\", \"parallelogram\"],\n [\"star5\", \"star\"],\n [\"star6\", \"star\"],\n]);\n\n/**\n * Cytoscape's annotation arrowheads, by the position in its `ArrowType` list (older sessions) and by name (newer\n * ones), lowercase.\n */\nconst ARROW_ORDER: readonly StyleArrowShape[] = [\n \"circle\",\n \"triangle\",\n \"vee\",\n \"diamond\",\n \"triangle-open\",\n \"none\",\n \"tee\",\n \"triangle\",\n \"triangle\",\n \"triangle\",\n \"tee\",\n \"other:x\",\n];\nconst ARROW_NAMES: ReadonlyMap<string, StyleArrowShape> = new Map<string, StyleArrowShape>([\n [\"circle\", \"circle\"],\n [\"closed arrow\", \"triangle\"],\n [\"concave arrow\", \"vee\"],\n [\"diamond\", \"diamond\"],\n [\"open arrow\", \"triangle-open\"],\n [\"no arrow\", \"none\"],\n [\"pipe\", \"tee\"],\n [\"triangle\", \"triangle\"],\n [\"t\", \"tee\"],\n [\"x\", \"other:x\"],\n]);\n\n/**\n * The annotations a graph holds, from the column Cytoscape desktop keeps them in.\n * @param snapshot - the graph\n * @returns the annotations; none when the graph has the column empty or not at all\n * @category Styles\n */\nexport function readAnnotations(snapshot: GraphSnapshot): FileAnnotations {\n const { graph } = snapshot;\n const cell = graph.has(CYTOSCAPE_ANNOTATIONS_COLUMN) ? graph.value(CYTOSCAPE_ANNOTATIONS_COLUMN, 0) : null;\n const entries = cellStrings(cell);\n const fields = entries.map(parseEntry);\n const byId = new Map(fields.map((f, i) => [f.get(\"uuid\") ?? String(i), f]));\n const annotations: GraphAnnotation[] = [];\n const skipped = new Set<string>();\n fields.forEach((f, i) => {\n const read = readOne(f, String(i), byId);\n if (read === null) {\n skipped.add((f.get(\"type\") ?? \"\").replace(TYPE_PREFIX, \"\"));\n } else {\n annotations.push(...read);\n }\n });\n return { annotations, skipped: [...skipped] };\n}\n\n/**\n * A cell's strings: a list cell's items, or the lines of a text cell.\n * @param cell - the cell\n * @returns the strings\n */\nfunction cellStrings(cell: unknown): string[] {\n if (typeof cell === \"string\") {\n return cell.split(/[\\r\\n]+/).filter((s) => s !== \"\");\n }\n if (cell !== null && typeof cell === \"object\" && Symbol.iterator in cell) {\n return Array.from(cell as Iterable<unknown>).filter((s): s is string => typeof s === \"string\" && s !== \"\");\n }\n return [];\n}\n\n/**\n * One annotation string's fields.\n * @param entry - `key=value|key=value`\n * @returns the fields\n */\nfunction parseEntry(entry: string): Map<string, string> {\n const out = new Map<string, string>();\n for (const part of entry.split(\"|\")) {\n const eq = part.indexOf(\"=\");\n if (eq > 0) {\n out.set(part.slice(0, eq), part.slice(eq + 1));\n }\n }\n return out;\n}\n\n/**\n * One annotation as neutral facts; a bounded text annotation is a shape and its text.\n * @param f - its fields\n * @param index - its position, its id when it has no uuid\n * @param byId - every annotation's fields by id, for an arrow's ends\n * @returns the annotations, or null for a kind not read\n */\nfunction readOne(\n f: ReadonlyMap<string, string>,\n index: string,\n byId: ReadonlyMap<string, ReadonlyMap<string, string>>,\n): GraphAnnotation[] | null {\n const type = (f.get(\"type\") ?? \"\").replace(TYPE_PREFIX, \"\");\n const zoom = positive(f.get(\"zoom\")) ?? 1;\n const base: AnnotationBase = {\n id: f.get(\"uuid\") ?? index,\n layer: f.get(\"canvas\") === \"background\" ? \"background\" : \"foreground\",\n z: num(f.get(\"z\")) ?? 0,\n };\n switch (type) {\n case \"ShapeAnnotation\":\n return [shapeOf(f, base, zoom)];\n case \"TextAnnotation\":\n return [textOf(f, base, zoom, { x: num(f.get(\"x\")) ?? 0, y: -(num(f.get(\"y\")) ?? 0) }, \"top-left\")];\n case \"BoundedTextAnnotation\": {\n const shape = shapeOf(f, base, zoom);\n return [shape, textOf(f, { ...base, id: `${base.id}:text` }, zoom, shape.center, \"center\")];\n }\n case \"ArrowAnnotation\":\n return arrowOf(f, base, zoom, byId);\n default:\n return null;\n }\n}\n\n/**\n * A shape annotation: `x`, `y` its top-left corner, y down; `width`, `height` and the outline at the saved zoom.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its sizes were saved at\n * @returns the shape\n */\nfunction shapeOf(f: ReadonlyMap<string, string>, base: AnnotationBase, zoom: number): ShapeAnnotation {\n const x = num(f.get(\"x\")) ?? 0;\n const y = num(f.get(\"y\")) ?? 0;\n const width = (positive(f.get(\"width\")) ?? 0) / zoom;\n const height = (positive(f.get(\"height\")) ?? 0) / zoom;\n const fill = javaColor(f.get(\"fillColor\"));\n const border = javaColor(f.get(\"edgeColor\")) ?? { color: \"#000000\", alpha: 1 };\n return {\n ...base,\n kind: \"shape\",\n center: { x: x + width / 2, y: -(y + height / 2) },\n width,\n height,\n shape: SHAPES.get((f.get(\"shapeType\") ?? \"rectangle\").toLowerCase()) ?? \"rectangle\",\n fill: fill?.color ?? null,\n fillOpacity: fill === null ? 0 : fill.alpha * percent(f.get(\"fillOpacity\")),\n borderColor: border.color,\n borderOpacity: border.alpha * percent(f.get(\"edgeOpacity\")),\n borderWidth: (num(f.get(\"edgeThickness\")) ?? 1) / zoom,\n };\n}\n\n/**\n * A text annotation, or the text of a bounded one.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its font size was saved at\n * @param at - where it is placed\n * @param anchor - what `at` is\n * @returns the text\n */\nfunction textOf(\n f: ReadonlyMap<string, string>,\n base: AnnotationBase,\n zoom: number,\n at: AnnotationPoint,\n anchor: TextAnnotation[\"anchor\"],\n): TextAnnotation {\n // java.awt.Font styles: 1 bold, 2 italic, 3 both\n const style = num(f.get(\"fontStyle\")) ?? 0;\n const color = javaColor(f.get(\"color\")) ?? { color: \"#000000\", alpha: 1 };\n return {\n ...base,\n kind: \"text\",\n text: f.get(\"text\") ?? \"\",\n at,\n anchor,\n fontSize: (positive(f.get(\"fontSize\")) ?? 12) / zoom,\n fontFamily: f.get(\"fontFamily\") ?? \"sans-serif\",\n bold: (style & 1) !== 0,\n italic: (style & 2) !== 0,\n color: color.color,\n opacity: color.alpha,\n };\n}\n\n/**\n * An arrow annotation. Cytoscape keeps its start as the annotation it leaves (`sourceAnnotation`) and its end as a\n * point, a node's center at save time (`targetNode`) or another annotation, and saves the arrow's top-left corner\n * as `x`, `y`: the start wherever the end lies right of and below it, which is taken for the start, else the center\n * of the annotation it leaves.\n * @param f - its fields\n * @param base - its id, layer and order\n * @param zoom - the zoom its line width was saved at\n * @param byId - every annotation's fields by id\n * @returns the arrow, or null when it has no end\n */\nfunction arrowOf(\n f: ReadonlyMap<string, string>,\n base: AnnotationBase,\n zoom: number,\n byId: ReadonlyMap<string, ReadonlyMap<string, string>>,\n): ArrowAnnotation[] | null {\n const target = f.get(\"targetAnnotation\");\n const to = point(f.get(\"targetPoint\")) ?? point(f.get(\"targetNode\")) ?? centerOf(byId.get(target ?? \"\"), zoom);\n if (to === null) {\n return null;\n }\n const corner = { x: num(f.get(\"x\")) ?? 0, y: num(f.get(\"y\")) ?? 0 };\n const source = centerOf(byId.get(f.get(\"sourceAnnotation\") ?? \"\"), zoom) ?? corner;\n // ponytail: the start is exact only when the end lies right of and below it; elsewhere the center of the\n // annotation it leaves, as Cytoscape stores no other start. Clip to that annotation's box if it matters.\n const from = { x: to.x > corner.x ? corner.x : source.x, y: to.y > corner.y ? corner.y : source.y };\n const color = javaColor(f.get(\"lineColor\")) ?? { color: \"#000000\", alpha: 1 };\n return [\n {\n ...base,\n kind: \"arrow\",\n from: { x: from.x, y: -from.y },\n to: { x: to.x, y: -to.y },\n color: color.color,\n opacity: color.alpha * percent(f.get(\"lineOpacity\")),\n width: (positive(f.get(\"lineThickness\")) ?? 1) / zoom,\n sourceArrow: arrowShape(f.get(\"sourceType\")),\n targetArrow: arrowShape(f.get(\"targetType\")),\n sourceSize: positive(f.get(\"sourceSize\")) ?? 1,\n targetSize: positive(f.get(\"targetSize\")) ?? 1,\n },\n ];\n}\n\n/**\n * An annotation's center, y down as the file writes it: a shape's box center, a text's corner.\n * @param f - its fields, or undefined\n * @param zoom - the zoom the arrow was saved at\n * @returns the point, or null\n */\nfunction centerOf(f: ReadonlyMap<string, string> | undefined, zoom: number): AnnotationPoint | null {\n if (f === undefined) {\n return null;\n }\n const x = num(f.get(\"x\"));\n const y = num(f.get(\"y\"));\n if (x === null || y === null) {\n return null;\n }\n return { x: x + (positive(f.get(\"width\")) ?? 0) / zoom / 2, y: y + (positive(f.get(\"height\")) ?? 0) / zoom / 2 };\n}\n\n/**\n * An arrowhead by its `ArrowType` position or name.\n * @param raw - the field\n * @returns the shape; a triangle for one not known\n */\nfunction arrowShape(raw: string | undefined): StyleArrowShape {\n if (raw === undefined) {\n return \"none\";\n }\n const n = num(raw);\n if (n !== null) {\n return ARROW_ORDER[n] ?? \"triangle\";\n }\n return ARROW_NAMES.get(raw.trim().toLowerCase()) ?? \"triangle\";\n}\n\n/**\n * A `x,y` point as the file writes it.\n * @param raw - the field\n * @returns the point, or null\n */\nfunction point(raw: string | undefined): AnnotationPoint | null {\n const [x, y] = (raw ?? \"\").split(\",\").map((s) => num(s));\n return x === null || x === undefined || y === null || y === undefined ? null : { x, y };\n}\n\n/**\n * A Java color as a signed ARGB integer.\n * @param raw - the field\n * @returns the color and its alpha, or null\n */\nfunction javaColor(raw: string | undefined): { color: StyleColor; alpha: number } | null {\n const n = num(raw);\n if (n === null || !Number.isInteger(n)) {\n return null;\n }\n const argb = n >>> 0;\n return {\n color: `#${(argb & 0xffffff).toString(16).padStart(6, \"0\")}`,\n alpha: (argb >>> 24) / 255,\n };\n}\n\n/**\n * A 0..100 percentage as 0..1; 1 when absent.\n * @param raw - the field\n * @returns the fraction\n */\nfunction percent(raw: string | undefined): number {\n const n = num(raw);\n return n === null ? 1 : Math.min(1, Math.max(0, n / 100));\n}\n\n/**\n * A finite number.\n * @param raw - the field\n * @returns the number, or null\n */\nfunction num(raw: string | undefined): number | null {\n if (raw === undefined || raw.trim() === \"\") {\n return null;\n }\n const n = Number(raw);\n return Number.isFinite(n) ? n : null;\n}\n\n/**\n * A positive number.\n * @param raw - the field\n * @returns the number, or null\n */\nfunction positive(raw: string | undefined): number | null {\n const n = num(raw);\n return n !== null && n > 0 ? n : null;\n}\n","/**\n * The styles of a live Cytoscape.js core: the rules from its stylesheet (`cy.style().json()`) and, when given, the\n * truth per element from what the core reports it draws (`ele.style()`). Reported values win over the stylesheet\n * where they disagree, so a property whose stylesheet value is a function (which `cy.style().json()` writes as \"fn\")\n * is still exact: it is copied per element from the reported values and noted as `W_STYLE_LAYER_FLATTENED` with the\n * sample (and the rule reason) `FUNCTION`.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { StyleBudget } from \"../budget.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { featuresOf, styleFingerprint } from \"../plan/features.js\";\nimport { planStyles } from \"../plan/plan.js\";\nimport type { ExtractedStyles, StyleWorkBudget } from \"../types.js\";\nimport { evaluateCytoscapeJs } from \"./cascade.js\";\n\n/** The input of `readCytoscapeStyles()`. */\nexport interface CytoscapeLiveInput {\n /** The core's elements: `cy.elements().jsons()`, or `{ nodes, edges }`. */\n readonly elements: unknown;\n /** The core's stylesheet: `cy.style().json()` (a function is written there as \"fn\"), or the one it was given. */\n readonly style: unknown;\n /**\n * What the core draws for each element, `ele.style()`, in the order of `elements` (for `{ nodes, edges }`, the\n * nodes then the edges); optional, and null for an element with none.\n */\n readonly rendered?: readonly (Readonly<Record<string, unknown>> | null | undefined)[];\n /** The graph the styles are for (the core's elements as a snapshot); the values come out indexed like it. */\n readonly snapshot: GraphSnapshot;\n /** The graph-io format id recorded as the styles' source; default \"json\". */\n readonly format?: string;\n /** Whether Cytoscape.js's defaults fill what the stylesheet leaves unset; default true. */\n readonly toolDefaults?: boolean;\n /**\n * Where problems are noted; graph-io's own engine passes its notes here.\n * @internal\n */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /** Cancels the work. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * What a stylesheet function is read as: a function, whatever it returned.\n * @returns nothing\n */\nconst FUNCTION = (): null => null;\n\n/**\n * The stylesheet with every \"fn\" value (how `cy.style().json()` writes a function) read as a function.\n * @param style - the stylesheet\n * @returns the stylesheet to apply\n */\nfunction withFunctions(style: unknown): unknown {\n if (!Array.isArray(style)) {\n return style;\n }\n return style.map((entry: unknown) => {\n if (entry === null || typeof entry !== \"object\") {\n return entry;\n }\n const e = entry as Record<string, unknown>;\n const props = e.style ?? e.css;\n if (props === null || typeof props !== \"object\") {\n return entry;\n }\n const copy = Object.create(null) as Record<string, unknown>;\n for (const name of Object.keys(props)) {\n const v = (props as Record<string, unknown>)[name];\n copy[name] = v === \"fn\" ? FUNCTION : v;\n }\n return { selector: e.selector, style: copy };\n });\n}\n\n/**\n * The element list in order: an array as it is, `{ nodes, edges }` as the nodes then the edges.\n * @param elements - the elements\n * @returns the list\n */\nfunction elementList(elements: unknown): readonly unknown[] {\n if (Array.isArray(elements)) {\n return elements;\n }\n if (elements !== null && typeof elements === \"object\") {\n const e = elements as Record<string, unknown>;\n return [...(Array.isArray(e.nodes) ? e.nodes : []), ...(Array.isArray(e.edges) ? e.edges : [])];\n }\n return [];\n}\n\n/**\n * Reads the styles of a live Cytoscape.js core: the stylesheet's rules, with what the core reports it draws as the\n * truth per element when given.\n * @param input - the elements, the stylesheet, the reported values and the graph\n * @returns the styles, exact for every element\n * @category Styles\n */\nexport function readCytoscapeStyles(input: CytoscapeLiveInput): ExtractedStyles {\n const notes = input.notes ?? new StyleNotes();\n const budget = input.budget ?? new StyleBudget();\n let rendered: Map<object, Readonly<Record<string, unknown>>> | undefined;\n if (input.rendered !== undefined) {\n rendered = new Map();\n const list = elementList(input.elements);\n for (let i = 0; i < list.length && i < input.rendered.length; i++) {\n const json = list[i];\n const r = input.rendered[i];\n if (json !== null && typeof json === \"object\" && r !== null && r !== undefined && typeof r === \"object\") {\n rendered.set(json, r);\n }\n }\n }\n const r = evaluateCytoscapeJs({\n elements: input.elements,\n style: withFunctions(input.style),\n snapshot: input.snapshot,\n toolDefaults: input.toolDefaults,\n rendered,\n notes,\n budget,\n signal: input.signal,\n });\n const s = input.snapshot;\n return planStyles(\n {\n format: input.format ?? \"json\",\n dialect: \"cytoscape-js\",\n tool: \"cytoscape-js\",\n units: \"px\",\n node: { values: r.node.values, rules: r.node.rules, columns: r.node.columns },\n edge: { values: r.edge.values, rules: r.edge.rules, columns: r.edge.columns },\n fingerprint: styleFingerprint(s),\n },\n { node: featuresOf(s, \"node\"), edge: featuresOf(s, \"edge\") },\n {\n toolDefaults: input.toolDefaults,\n notes,\n budget,\n signal: input.signal,\n rawColumns: { node: r.node.rawColumns, edge: r.edge.rawColumns },\n },\n );\n}\n"],"names":["e","r"],"mappings":";;;;;;AAuIA,MAAM,+BAA+B;AAErC,MAAM,cAAc;AAGpB,MAAM,6BAAkD,IAA4B;AAAA,EAChF,CAAC,aAAa,WAAW;AAAA,EACzB,CAAC,oBAAoB,iBAAiB;AAAA,EACtC,CAAC,qBAAqB,iBAAiB;AAAA,EACvC,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,iBAAiB,eAAe;AAAA,EACjC,CAAC,SAAS,MAAM;AAAA,EAChB,CAAC,SAAS,MAAM;AACpB,CAAC;AAMD,MAAM,cAA0C;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACA,MAAM,kCAAwD,IAA6B;AAAA,EACvF,CAAC,UAAU,QAAQ;AAAA,EACnB,CAAC,gBAAgB,UAAU;AAAA,EAC3B,CAAC,iBAAiB,KAAK;AAAA,EACvB,CAAC,WAAW,SAAS;AAAA,EACrB,CAAC,cAAc,eAAe;AAAA,EAC9B,CAAC,YAAY,MAAM;AAAA,EACnB,CAAC,QAAQ,KAAK;AAAA,EACd,CAAC,YAAY,UAAU;AAAA,EACvB,CAAC,KAAK,KAAK;AAAA,EACX,CAAC,KAAK,SAAS;AACnB,CAAC;AAQM,SAAS,gBAAgB,UAA0C;AACtE,QAAM,EAAE,UAAU;AAClB,QAAM,OAAO,MAAM,IAAI,4BAA4B,IAAI,MAAM,MAAM,8BAA8B,CAAC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"styles.js","sources":["../src/styles/cyjs/live.ts","../src/styles/slots.ts"],"sourcesContent":["/**\n * The styles of a live Cytoscape.js core: the rules from its stylesheet (`cy.style().json()`) and, when given, the\n * truth per element from what the core reports it draws (`ele.style()`). Reported values win over the stylesheet\n * where they disagree, so a property whose stylesheet value is a function (which `cy.style().json()` writes as \"fn\")\n * is still exact: it is copied per element from the reported values and noted as `W_STYLE_LAYER_FLATTENED` with the\n * sample (and the rule reason) `FUNCTION`.\n */\n\nimport type { GraphSnapshot } from \"@graphty/graph-format\";\n\nimport { StyleBudget } from \"../budget.js\";\nimport { StyleNotes } from \"../notes.js\";\nimport { featuresOf, styleFingerprint } from \"../plan/features.js\";\nimport { planStyles } from \"../plan/plan.js\";\nimport type { ExtractedStyles, StyleWorkBudget } from \"../types.js\";\nimport { evaluateCytoscapeJs } from \"./cascade.js\";\n\n/** The input of `readCytoscapeStyles()`. */\nexport interface CytoscapeLiveInput {\n /** The core's elements: `cy.elements().jsons()`, or `{ nodes, edges }`. */\n readonly elements: unknown;\n /** The core's stylesheet: `cy.style().json()` (a function is written there as \"fn\"), or the one it was given. */\n readonly style: unknown;\n /**\n * What the core draws for each element, `ele.style()`, in the order of `elements` (for `{ nodes, edges }`, the\n * nodes then the edges); optional, and null for an element with none.\n */\n readonly rendered?: readonly (Readonly<Record<string, unknown>> | null | undefined)[];\n /** The graph the styles are for (the core's elements as a snapshot); the values come out indexed like it. */\n readonly snapshot: GraphSnapshot;\n /** The graph-io format id recorded as the styles' source; default \"json\". */\n readonly format?: string;\n /** Whether Cytoscape.js's defaults fill what the stylesheet leaves unset; default true. */\n readonly toolDefaults?: boolean;\n /**\n * Where problems are noted; graph-io's own engine passes its notes here.\n * @internal\n */\n readonly notes?: StyleNotes;\n /** The counted work budget. */\n readonly budget?: StyleWorkBudget;\n /** Cancels the work. */\n readonly signal?: AbortSignal;\n}\n\n/**\n * What a stylesheet function is read as: a function, whatever it returned.\n * @returns nothing\n */\nconst FUNCTION = (): null => null;\n\n/**\n * The stylesheet with every \"fn\" value (how `cy.style().json()` writes a function) read as a function.\n * @param style - the stylesheet\n * @returns the stylesheet to apply\n */\nfunction withFunctions(style: unknown): unknown {\n if (!Array.isArray(style)) {\n return style;\n }\n return style.map((entry: unknown) => {\n if (entry === null || typeof entry !== \"object\") {\n return entry;\n }\n const e = entry as Record<string, unknown>;\n const props = e.style ?? e.css;\n if (props === null || typeof props !== \"object\") {\n return entry;\n }\n const copy = Object.create(null) as Record<string, unknown>;\n for (const name of Object.keys(props)) {\n const v = (props as Record<string, unknown>)[name];\n copy[name] = v === \"fn\" ? FUNCTION : v;\n }\n return { selector: e.selector, style: copy };\n });\n}\n\n/**\n * The element list in order: an array as it is, `{ nodes, edges }` as the nodes then the edges.\n * @param elements - the elements\n * @returns the list\n */\nfunction elementList(elements: unknown): readonly unknown[] {\n if (Array.isArray(elements)) {\n return elements;\n }\n if (elements !== null && typeof elements === \"object\") {\n const e = elements as Record<string, unknown>;\n return [...(Array.isArray(e.nodes) ? e.nodes : []), ...(Array.isArray(e.edges) ? e.edges : [])];\n }\n return [];\n}\n\n/**\n * Reads the styles of a live Cytoscape.js core: the stylesheet's rules, with what the core reports it draws as the\n * truth per element when given.\n * @param input - the elements, the stylesheet, the reported values and the graph\n * @returns the styles, exact for every element\n * @category Styles\n */\nexport function readCytoscapeStyles(input: CytoscapeLiveInput): ExtractedStyles {\n const notes = input.notes ?? new StyleNotes();\n const budget = input.budget ?? new StyleBudget();\n let rendered: Map<object, Readonly<Record<string, unknown>>> | undefined;\n if (input.rendered !== undefined) {\n rendered = new Map();\n const list = elementList(input.elements);\n for (let i = 0; i < list.length && i < input.rendered.length; i++) {\n const json = list[i];\n const r = input.rendered[i];\n if (json !== null && typeof json === \"object\" && r !== null && r !== undefined && typeof r === \"object\") {\n rendered.set(json, r);\n }\n }\n }\n const r = evaluateCytoscapeJs({\n elements: input.elements,\n style: withFunctions(input.style),\n snapshot: input.snapshot,\n toolDefaults: input.toolDefaults,\n rendered,\n notes,\n budget,\n signal: input.signal,\n });\n const s = input.snapshot;\n return planStyles(\n {\n format: input.format ?? \"json\",\n dialect: \"cytoscape-js\",\n tool: \"cytoscape-js\",\n units: \"px\",\n node: { values: r.node.values, rules: r.node.rules, columns: r.node.columns },\n edge: { values: r.edge.values, rules: r.edge.rules, columns: r.edge.columns },\n fingerprint: styleFingerprint(s),\n },\n { node: featuresOf(s, \"node\"), edge: featuresOf(s, \"edge\") },\n {\n toolDefaults: input.toolDefaults,\n notes,\n budget,\n signal: input.signal,\n rawColumns: { node: r.node.rawColumns, edge: r.edge.rawColumns },\n },\n );\n}\n","/**\n * Which imported columns hold a format's own style slots rather than data.\n */\n\nimport type { ColumnMeta } from \"@graphty/graph-format\";\n\n// spelled out here rather than imported, so the styles entry loads no format module\n/** The origin namespaces of the columns the CX and CX2 importers read a file's bypasses into. */\nconst BYPASS_NAMESPACES: ReadonlySet<string> = new Set([\"cx.bypass\", \"cx2.bypass\"]);\n\n/**\n * Whether an imported column holds the file's own style slots rather than data: the bypasses of a CX or CX2 file,\n * and the `<graphics>` block of an XGMML element (or a Cytoscape session's). An application that draws the file's\n * styles from `extractStyles()` leaves these columns off its records, since the styles carry them.\n * @param meta - the column's metadata\n * @returns true for a style slot\n * @category Styles\n */\nexport function isStyleSlotColumn(meta: ColumnMeta): boolean {\n const { origin } = meta;\n return (\n (typeof origin?.namespace === \"string\" && BYPASS_NAMESPACES.has(origin.namespace)) ||\n (meta.dtype === \"json\" && origin?.type === \"graphics\" && origin.namespace === \"xgmml\")\n );\n}\n"],"names":["e","v","r"],"mappings":";;;;;;AAiDA,MAAM,WAAW,MAAY;AAO7B,SAAS,cAAc,OAAyB;AAC5C,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AACvB,WAAO;AAAA,EACX;AACA,SAAO,MAAM,IAAI,CAAC,UAAmB;AACjC,QAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC7C,aAAO;AAAA,IACX;AACA,UAAMA,KAAI;AACV,UA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B,OAAO,cAAc,MAAM,KAAK;AAAA,IAChC,UAAU,MAAM;AAAA,IAChB,cAAc,MAAM;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ,MAAM;AAAA,EAAA,CACjB;AACD,QAAM,IAAI,MAAM;AAChB,SAAO;AAAA,IACH;AAAA,MACI,QAAQ,MAAM,UAAU;AAAA,MACxB,SAAS;AAAA,MACT,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM,EAAE,QAAQA,GAAE,KAAK,QAAQ,OAAOA,GAAE,KAAK,OAAO,SAASA,GAAE,KAAK,QAAA;AAAA,MACpE,MAAM,EAAE,QAAQA,GAAE,KAAK,QAAQ,OAAOA,GAAE,KAAK,OAAO,SAASA,GAAE,KAAK,QAAA;AAAA,MACpE,aAAa,iBAAiB,CAAC;AAAA,IAAA;AAAA,IAEnC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,WAAW,GAAG,MAAM,EAAA;AAAA,IACzD;AAAA,MACI,cAAc,MAAM;AAAA,MACpB;AAAA,MACA;AAAA,MACA,QAAQ,MAAM;AAAA,MACd,YAAY,EAAE,MAAMA,GAAE,KAAK,YAAY,MAAMA,GAAE,KAAK,WAAA;AAAA,IAAW;AAAA,EACnE;AAER;AC1IA,MAAM,oBAAyC,oBAAI,IAAI,CAAC,aAAa,YAAY,CAAC;AAU3E,SAAS,kBAAkB,MAA2B;AACzD,QAAM,EAAE,WAAW;AACnB,SACK,OAAO,QAAQ,cAAc,YAAY,kBAAkB,IAAI,OAAO,SAAS,KAC/E,KAAK,UAAU,UAAU,QAAQ,SAAS,cAAc,OAAO,cAAc;AAEtF;"}
|
package/dist/xgmml.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { X, a } from "./chunks/styles-
|
|
2
|
-
import { x } from "./chunks/exporter-
|
|
3
|
-
import { x as x2 } from "./chunks/importer-
|
|
1
|
+
import { X, a } from "./chunks/styles-CAVmBLgp.js";
|
|
2
|
+
import { x } from "./chunks/exporter-B6yvL3wy.js";
|
|
3
|
+
import { x as x2 } from "./chunks/importer-asFUrIsj.js";
|
|
4
4
|
export {
|
|
5
5
|
X as XGMML_ISSUE,
|
|
6
6
|
a as XGMML_LOSS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphty/graph-io",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.50",
|
|
4
4
|
"description": "Read and write 13 graph file formats (JSON, GraphML, GEXF, CSV, GML, DOT, Pajek, Neo4j CSV, XGMML, CX2, CX, OBO, Cytoscape sessions) as @graphty/graph-format snapshots",
|
|
5
5
|
"author": "Adam Powers <apowers@ato.ms>",
|
|
6
6
|
"type": "module",
|
|
@@ -92,6 +92,11 @@
|
|
|
92
92
|
"import": "./dist/sources-rest.js",
|
|
93
93
|
"default": "./dist/sources-rest.js"
|
|
94
94
|
},
|
|
95
|
+
"./sources/sparql": {
|
|
96
|
+
"types": "./dist/sources-sparql.d.ts",
|
|
97
|
+
"import": "./dist/sources-sparql.js",
|
|
98
|
+
"default": "./dist/sources-sparql.js"
|
|
99
|
+
},
|
|
95
100
|
"./styles": {
|
|
96
101
|
"types": "./dist/styles.d.ts",
|
|
97
102
|
"import": "./dist/styles.js",
|
|
@@ -146,7 +151,7 @@
|
|
|
146
151
|
},
|
|
147
152
|
"homepage": "https://graphty.app/docs/graph-io/",
|
|
148
153
|
"dependencies": {
|
|
149
|
-
"@graphty/graph-format": "^1.4.
|
|
154
|
+
"@graphty/graph-format": "^1.4.9"
|
|
150
155
|
},
|
|
151
156
|
"peerDependencies": {
|
|
152
157
|
"@graphty/graph-format": "^1.0.0",
|
|
@@ -158,39 +163,54 @@
|
|
|
158
163
|
}
|
|
159
164
|
},
|
|
160
165
|
"devDependencies": {
|
|
166
|
+
"@resvg/resvg-js": "2.6.2",
|
|
167
|
+
"@sigma/export-image": "4.0.0",
|
|
168
|
+
"@storybook/addon-vitest": "^9.1.21",
|
|
169
|
+
"@storybook/web-components-vite": "^9.0.11",
|
|
161
170
|
"@vitest/browser-playwright": "4.1.11",
|
|
162
171
|
"@vitest/coverage-v8": "4.1.11",
|
|
163
172
|
"@vitest/ui": "4.1.11",
|
|
164
|
-
"cytoscape": "
|
|
173
|
+
"cytoscape": "3.34.3",
|
|
174
|
+
"esbuild": "0.25.10",
|
|
165
175
|
"eslint": "^9.29.0",
|
|
166
176
|
"fast-check": "^4.2.0",
|
|
167
177
|
"fast-xml-parser": "^5.11.1",
|
|
178
|
+
"graphology": "0.26.0",
|
|
179
|
+
"lit": "^3.3.1",
|
|
168
180
|
"neo4j-driver": "^5.28.3",
|
|
169
181
|
"playwright": "^1.53.0",
|
|
170
182
|
"prettier": "^3.4.2",
|
|
183
|
+
"sigma": "4.0.1",
|
|
184
|
+
"storybook": "^9.1.21",
|
|
185
|
+
"svgcanvas": "2.6.0",
|
|
171
186
|
"tsx": "^4.20.3",
|
|
172
187
|
"typedoc": "^0.28.15",
|
|
173
188
|
"typescript": "^5.9.3",
|
|
174
|
-
"
|
|
189
|
+
"vis-data": "7.1.9",
|
|
190
|
+
"vis-network": "9.1.9",
|
|
191
|
+
"vite": "^7.3.7",
|
|
175
192
|
"vitest": "4.1.11"
|
|
176
193
|
},
|
|
177
194
|
"scripts": {
|
|
178
195
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
179
196
|
"build:bundle": "node scripts/build-bundle.js",
|
|
180
197
|
"build:all": "npm run build && npm run build:bundle",
|
|
181
|
-
"lint": "eslint && tsc --noEmit -p tsconfig.json",
|
|
198
|
+
"lint": "eslint && tsc --noEmit -p tsconfig.json && tsc --noEmit -p fidelity-stories/tsconfig.json",
|
|
182
199
|
"lint:fix": "eslint --fix",
|
|
183
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
200
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p fidelity-stories/tsconfig.json",
|
|
184
201
|
"typecheck:strict-consumer": "tsc -p tsconfig.strict-consumer.json",
|
|
185
202
|
"test": "vitest",
|
|
186
203
|
"test:ui": "vitest --ui",
|
|
187
204
|
"test:run": "vitest run",
|
|
205
|
+
"test:storybook": "vitest run --config vitest.storybook.config.ts",
|
|
188
206
|
"coverage": "vitest run --coverage",
|
|
189
207
|
"coverage:preview": "npx serve coverage -p ${PORT:?start it through servherd, which sets PORT}",
|
|
190
208
|
"benchmark": "tsx benchmarks/run.ts",
|
|
191
209
|
"docs:reference": "tsx scripts/docs-reference.ts",
|
|
192
210
|
"docs:api": "tsx scripts/docs-reference.ts --check && typedoc && node ../tools/sanitize-api-docs.js docs/api/generated",
|
|
193
211
|
"ready:commit": "npm run build:all && npm run lint && npm run typecheck:strict-consumer && npm run test:run",
|
|
194
|
-
"test:browser": "vitest run --config vitest.browser.config.ts"
|
|
212
|
+
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
213
|
+
"storybook": "storybook dev -c fidelity-stories/.storybook -p ${PORT:?start it through servherd, which sets PORT} --host ${HOST:-localhost} ${HTTPS_CERT_PATH:+--https --ssl-cert $HTTPS_CERT_PATH --ssl-key $HTTPS_KEY_PATH} --no-open",
|
|
214
|
+
"build-storybook": "git lfs pull --include \"graph-io/test/fidelity/oracles/*.png\" && storybook build -c fidelity-stories/.storybook -o fidelity-stories/storybook-static"
|
|
195
215
|
}
|
|
196
216
|
}
|
|
@@ -2936,7 +2936,12 @@ class CxReader {
|
|
|
2936
2936
|
}
|
|
2937
2937
|
return true;
|
|
2938
2938
|
});
|
|
2939
|
-
const
|
|
2939
|
+
const { weightFrom } = this.options;
|
|
2940
|
+
const collection = aspect(this.doc, "cySubNetworks").length > 0;
|
|
2941
|
+
const source: CxStyleSource =
|
|
2942
|
+
others.size > 0
|
|
2943
|
+
? { entries: kept, otherViews: others.size, weightFrom, collection }
|
|
2944
|
+
: { entries: kept, weightFrom, collection };
|
|
2940
2945
|
this.report.keepForStyles(source);
|
|
2941
2946
|
}
|
|
2942
2947
|
|