@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.
Files changed (600) hide show
  1. package/dist/chunks/{approximations-C2riR4NT.js → approximations-BRXsll0T.js} +2 -2
  2. package/dist/chunks/{approximations-C2riR4NT.js.map → approximations-BRXsll0T.js.map} +1 -1
  3. package/dist/chunks/bends-BGXjv_U4.js +129 -0
  4. package/dist/chunks/bends-BGXjv_U4.js.map +1 -0
  5. package/dist/chunks/{block-Cu22ewuS.js → block-yl0f_qLO.js} +931 -164
  6. package/dist/chunks/block-yl0f_qLO.js.map +1 -0
  7. package/dist/chunks/choose-CczZJaX_.js +717 -0
  8. package/dist/chunks/choose-CczZJaX_.js.map +1 -0
  9. package/dist/chunks/{codes-CV_Bhcyi.js → codes-BE2xir2k.js} +6 -2
  10. package/dist/chunks/codes-BE2xir2k.js.map +1 -0
  11. package/dist/chunks/{constants-D0LqcsLJ.js → constants-CKkYLPtt.js} +2 -2
  12. package/dist/chunks/{constants-D0LqcsLJ.js.map → constants-CKkYLPtt.js.map} +1 -1
  13. package/dist/chunks/{context-cgmmOxZ2.js → context-DizmppHy.js} +5 -4
  14. package/dist/chunks/{context-cgmmOxZ2.js.map → context-DizmppHy.js.map} +1 -1
  15. package/dist/chunks/{convert-BcQ8_jMo.js → convert-Ct2zelbQ.js} +7 -2
  16. package/dist/chunks/convert-Ct2zelbQ.js.map +1 -0
  17. package/dist/chunks/{credentials-BiQsnMTb.js → credentials-CmvJXYeH.js} +67 -16
  18. package/dist/chunks/credentials-CmvJXYeH.js.map +1 -0
  19. package/dist/chunks/{cx-export-BEeF6ymo.js → cx-export-Bt6NoqTQ.js} +3 -3
  20. package/dist/chunks/{cx-export-BEeF6ymo.js.map → cx-export-Bt6NoqTQ.js.map} +1 -1
  21. package/dist/chunks/descriptor-B28U25x4.js +60 -0
  22. package/dist/chunks/descriptor-B28U25x4.js.map +1 -0
  23. package/dist/chunks/{descriptor-BJ-W0Jd-.js → descriptor-Dhez_Cew.js} +11 -2
  24. package/dist/chunks/descriptor-Dhez_Cew.js.map +1 -0
  25. package/dist/chunks/{emit-CD8xnY8s.js → emit-7Jkpg0yd.js} +1788 -133
  26. package/dist/chunks/emit-7Jkpg0yd.js.map +1 -0
  27. package/dist/chunks/{escape-DH2Egt-l.js → escape-CuCIzNMB.js} +8 -8
  28. package/dist/chunks/{escape-DH2Egt-l.js.map → escape-CuCIzNMB.js.map} +1 -1
  29. package/dist/chunks/{export-CZ7VRm4I.js → export-Cha4dRFz.js} +45 -387
  30. package/dist/chunks/export-Cha4dRFz.js.map +1 -0
  31. package/dist/chunks/{exporter-ChjL5fmP.js → exporter-1Ajud15J.js} +9 -8
  32. package/dist/chunks/{exporter-ChjL5fmP.js.map → exporter-1Ajud15J.js.map} +1 -1
  33. package/dist/chunks/{exporter-BIdaoIgh.js → exporter-B6yvL3wy.js} +7 -7
  34. package/dist/chunks/{exporter-BIdaoIgh.js.map → exporter-B6yvL3wy.js.map} +1 -1
  35. package/dist/chunks/{exporter-Dcw7Ldtq.js → exporter-BP6otMO6.js} +6 -6
  36. package/dist/chunks/{exporter-Dcw7Ldtq.js.map → exporter-BP6otMO6.js.map} +1 -1
  37. package/dist/chunks/{exporter-DtVU80Fa.js → exporter-CA5q8ROP.js} +9 -8
  38. package/dist/chunks/{exporter-DtVU80Fa.js.map → exporter-CA5q8ROP.js.map} +1 -1
  39. package/dist/chunks/{exporter-bxxjOrDZ.js → exporter-CQQZFJ2v.js} +1284 -156
  40. package/dist/chunks/exporter-CQQZFJ2v.js.map +1 -0
  41. package/dist/chunks/format-BXiAb-1h.js +408 -0
  42. package/dist/chunks/format-BXiAb-1h.js.map +1 -0
  43. package/dist/chunks/{generic-CP6YD34u.js → generic-Dc21MAdg.js} +387 -31
  44. package/dist/chunks/generic-Dc21MAdg.js.map +1 -0
  45. package/dist/chunks/{importer-B87_fmVx.js → importer-C6NVpCXp.js} +327 -84
  46. package/dist/chunks/importer-C6NVpCXp.js.map +1 -0
  47. package/dist/chunks/{importer-DPZDN40-.js → importer-CKFe4q54.js} +25 -17
  48. package/dist/chunks/importer-CKFe4q54.js.map +1 -0
  49. package/dist/chunks/{importer-Bji2MeWr.js → importer-CKbUbsJA.js} +13 -10
  50. package/dist/chunks/{importer-Bji2MeWr.js.map → importer-CKbUbsJA.js.map} +1 -1
  51. package/dist/chunks/{importer-CB_zV5_L.js → importer-ClCsdgTJ.js} +208 -1104
  52. package/dist/chunks/importer-ClCsdgTJ.js.map +1 -0
  53. package/dist/chunks/{importer-e3huMZbm.js → importer-CyVZTrf0.js} +14 -10
  54. package/dist/chunks/importer-CyVZTrf0.js.map +1 -0
  55. package/dist/chunks/{importer-CVT-JyDE.js → importer-DgG4v1Ms.js} +1537 -355
  56. package/dist/chunks/importer-DgG4v1Ms.js.map +1 -0
  57. package/dist/chunks/{importer-Cyy6UseH.js → importer-asFUrIsj.js} +66 -13
  58. package/dist/chunks/importer-asFUrIsj.js.map +1 -0
  59. package/dist/chunks/{input-Ccg9I22A.js → input-CAxt_aV-.js} +4 -4
  60. package/dist/chunks/{input-Ccg9I22A.js.map → input-CAxt_aV-.js.map} +1 -1
  61. package/dist/chunks/{json-elements-By172SVq.js → json-elements-Cq76WjnZ.js} +4 -4
  62. package/dist/chunks/{json-elements-By172SVq.js.map → json-elements-Cq76WjnZ.js.map} +1 -1
  63. package/dist/chunks/{lexicon-u2SI5xcx.js → lexicon-IVRq2Uoo.js} +282 -74
  64. package/dist/chunks/lexicon-IVRq2Uoo.js.map +1 -0
  65. package/dist/chunks/{ontology-export-BwgMyuF0.js → ontology-export-OMo91mb0.js} +4 -4
  66. package/dist/chunks/{ontology-export-BwgMyuF0.js.map → ontology-export-OMo91mb0.js.map} +1 -1
  67. package/dist/chunks/{records-Cgvxz-Vx.js → records-NJiYvekn.js} +2 -2
  68. package/dist/chunks/{records-Cgvxz-Vx.js.map → records-NJiYvekn.js.map} +1 -1
  69. package/dist/chunks/{report-CgdsL9Hb.js → report-CwMfYa9J.js} +23 -23
  70. package/dist/chunks/{report-CgdsL9Hb.js.map → report-CwMfYa9J.js.map} +1 -1
  71. package/dist/chunks/round-trip-Cy3_SHRZ.js +79 -0
  72. package/dist/chunks/round-trip-Cy3_SHRZ.js.map +1 -0
  73. package/dist/chunks/{sigv4-LkAzsLAu.js → sigv4-BXwVbza3.js} +5 -5
  74. package/dist/chunks/sigv4-BXwVbza3.js.map +1 -0
  75. package/dist/chunks/{styles-CaABMoO1.js → styles-CAVmBLgp.js} +1237 -138
  76. package/dist/chunks/styles-CAVmBLgp.js.map +1 -0
  77. package/dist/chunks/styles-CPczw1Jz.js +1928 -0
  78. package/dist/chunks/styles-CPczw1Jz.js.map +1 -0
  79. package/dist/chunks/styles-boK6Ln54.js +2847 -0
  80. package/dist/chunks/styles-boK6Ln54.js.map +1 -0
  81. package/dist/chunks/{styles-yed-Cs1nmrjn.js → styles-yed-XeFBQ6VS.js} +506 -175
  82. package/dist/chunks/styles-yed-XeFBQ6VS.js.map +1 -0
  83. package/dist/chunks/{text-BuKQVMz2.js → text-ystE2bYi.js} +2 -2
  84. package/dist/chunks/{text-BuKQVMz2.js.map → text-ystE2bYi.js.map} +1 -1
  85. package/dist/csv.js +7 -7
  86. package/dist/cx.js +2 -2
  87. package/dist/cx2.js +2 -2
  88. package/dist/cys.js +1 -1
  89. package/dist/dot.js +8 -4
  90. package/dist/dot.js.map +1 -1
  91. package/dist/gexf.js +42 -12
  92. package/dist/gexf.js.map +1 -1
  93. package/dist/gml.js +848 -194
  94. package/dist/gml.js.map +1 -1
  95. package/dist/graph-io.js +230 -193
  96. package/dist/graph-io.js.map +1 -1
  97. package/dist/graphml.js +3 -3
  98. package/dist/json.js +3 -2
  99. package/dist/neo4j.js +6 -6
  100. package/dist/obo.js +1 -1
  101. package/dist/pajek.js +1 -1
  102. package/dist/positions.js +45 -3
  103. package/dist/positions.js.map +1 -1
  104. package/dist/sources-cypher.js +141 -23
  105. package/dist/sources-cypher.js.map +1 -1
  106. package/dist/sources-ndex.js +2 -2
  107. package/dist/sources-rest.js +32 -6
  108. package/dist/sources-rest.js.map +1 -1
  109. package/dist/sources-sparql.d.ts +1 -0
  110. package/dist/sources-sparql.js +439 -0
  111. package/dist/sources-sparql.js.map +1 -0
  112. package/dist/src/formats/cx/importer.d.ts.map +1 -1
  113. package/dist/src/formats/cx/importer.js +5 -1
  114. package/dist/src/formats/cx/importer.js.map +1 -1
  115. package/dist/src/formats/cx/styles.d.ts +24 -1
  116. package/dist/src/formats/cx/styles.d.ts.map +1 -1
  117. package/dist/src/formats/cx/styles.js +117 -11
  118. package/dist/src/formats/cx/styles.js.map +1 -1
  119. package/dist/src/formats/cx2/importer.d.ts.map +1 -1
  120. package/dist/src/formats/cx2/importer.js +1 -0
  121. package/dist/src/formats/cx2/importer.js.map +1 -1
  122. package/dist/src/formats/cx2/styles.d.ts.map +1 -1
  123. package/dist/src/formats/cx2/styles.js +3 -1
  124. package/dist/src/formats/cx2/styles.js.map +1 -1
  125. package/dist/src/formats/cys/importer.d.ts.map +1 -1
  126. package/dist/src/formats/cys/importer.js +1 -0
  127. package/dist/src/formats/cys/importer.js.map +1 -1
  128. package/dist/src/formats/cys/styles.d.ts +2 -0
  129. package/dist/src/formats/cys/styles.d.ts.map +1 -1
  130. package/dist/src/formats/cys/styles.js +15 -7
  131. package/dist/src/formats/cys/styles.js.map +1 -1
  132. package/dist/src/formats/dot/drawing.d.ts +98 -0
  133. package/dist/src/formats/dot/drawing.d.ts.map +1 -0
  134. package/dist/src/formats/dot/drawing.js +734 -0
  135. package/dist/src/formats/dot/drawing.js.map +1 -0
  136. package/dist/src/formats/dot/exporter.d.ts.map +1 -1
  137. package/dist/src/formats/dot/exporter.js +34 -2
  138. package/dist/src/formats/dot/exporter.js.map +1 -1
  139. package/dist/src/formats/dot/importer.d.ts +6 -1
  140. package/dist/src/formats/dot/importer.d.ts.map +1 -1
  141. package/dist/src/formats/dot/importer.js +170 -33
  142. package/dist/src/formats/dot/importer.js.map +1 -1
  143. package/dist/src/formats/dot/index.d.ts +3 -1
  144. package/dist/src/formats/dot/index.d.ts.map +1 -1
  145. package/dist/src/formats/dot/index.js +2 -1
  146. package/dist/src/formats/dot/index.js.map +1 -1
  147. package/dist/src/formats/dot/label-places.d.ts +41 -0
  148. package/dist/src/formats/dot/label-places.d.ts.map +1 -0
  149. package/dist/src/formats/dot/label-places.js +185 -0
  150. package/dist/src/formats/dot/label-places.js.map +1 -0
  151. package/dist/src/formats/dot/names.d.ts +13 -0
  152. package/dist/src/formats/dot/names.d.ts.map +1 -1
  153. package/dist/src/formats/dot/names.js +13 -0
  154. package/dist/src/formats/dot/names.js.map +1 -1
  155. package/dist/src/formats/dot/record.d.ts +50 -0
  156. package/dist/src/formats/dot/record.d.ts.map +1 -0
  157. package/dist/src/formats/dot/record.js +275 -0
  158. package/dist/src/formats/dot/record.js.map +1 -0
  159. package/dist/src/formats/dot/styles.d.ts +72 -2
  160. package/dist/src/formats/dot/styles.d.ts.map +1 -1
  161. package/dist/src/formats/dot/styles.js +1500 -119
  162. package/dist/src/formats/dot/styles.js.map +1 -1
  163. package/dist/src/formats/gexf/dialog-metrics.d.ts +15 -0
  164. package/dist/src/formats/gexf/dialog-metrics.d.ts.map +1 -0
  165. package/dist/src/formats/gexf/dialog-metrics.js +59 -0
  166. package/dist/src/formats/gexf/dialog-metrics.js.map +1 -0
  167. package/dist/src/formats/gexf/importer.d.ts +7 -0
  168. package/dist/src/formats/gexf/importer.d.ts.map +1 -1
  169. package/dist/src/formats/gexf/importer.js +41 -5
  170. package/dist/src/formats/gexf/importer.js.map +1 -1
  171. package/dist/src/formats/gexf/preview.d.ts +77 -0
  172. package/dist/src/formats/gexf/preview.d.ts.map +1 -0
  173. package/dist/src/formats/gexf/preview.js +191 -0
  174. package/dist/src/formats/gexf/preview.js.map +1 -0
  175. package/dist/src/formats/gexf/schema.d.ts.map +1 -1
  176. package/dist/src/formats/gexf/schema.js +2 -1
  177. package/dist/src/formats/gexf/schema.js.map +1 -1
  178. package/dist/src/formats/gexf/styles.d.ts +58 -31
  179. package/dist/src/formats/gexf/styles.d.ts.map +1 -1
  180. package/dist/src/formats/gexf/styles.js +848 -225
  181. package/dist/src/formats/gexf/styles.js.map +1 -1
  182. package/dist/src/formats/gml/importer.d.ts +5 -2
  183. package/dist/src/formats/gml/importer.d.ts.map +1 -1
  184. package/dist/src/formats/gml/importer.js +258 -71
  185. package/dist/src/formats/gml/importer.js.map +1 -1
  186. package/dist/src/formats/gml/index.d.ts +1 -1
  187. package/dist/src/formats/gml/index.d.ts.map +1 -1
  188. package/dist/src/formats/gml/index.js +1 -1
  189. package/dist/src/formats/gml/index.js.map +1 -1
  190. package/dist/src/formats/gml/positions.d.ts +7 -0
  191. package/dist/src/formats/gml/positions.d.ts.map +1 -1
  192. package/dist/src/formats/gml/positions.js +29 -7
  193. package/dist/src/formats/gml/positions.js.map +1 -1
  194. package/dist/src/formats/gml/styles.d.ts.map +1 -1
  195. package/dist/src/formats/gml/styles.js +754 -102
  196. package/dist/src/formats/gml/styles.js.map +1 -1
  197. package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -1
  198. package/dist/src/formats/graphml/styles-plain.js +6 -10
  199. package/dist/src/formats/graphml/styles-plain.js.map +1 -1
  200. package/dist/src/formats/graphml/styles-yed.d.ts +21 -15
  201. package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -1
  202. package/dist/src/formats/graphml/styles-yed.js +695 -164
  203. package/dist/src/formats/graphml/styles-yed.js.map +1 -1
  204. package/dist/src/formats/graphml/styles-yfiles3.d.ts +1 -1
  205. package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -1
  206. package/dist/src/formats/graphml/styles-yfiles3.js +431 -64
  207. package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -1
  208. package/dist/src/formats/graphml/yfiles.d.ts +3 -3
  209. package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
  210. package/dist/src/formats/graphml/yfiles.js +16 -6
  211. package/dist/src/formats/graphml/yfiles.js.map +1 -1
  212. package/dist/src/formats/json/dialect.d.ts +3 -2
  213. package/dist/src/formats/json/dialect.d.ts.map +1 -1
  214. package/dist/src/formats/json/dialect.js +39 -5
  215. package/dist/src/formats/json/dialect.js.map +1 -1
  216. package/dist/src/formats/json/importer.d.ts +13 -2
  217. package/dist/src/formats/json/importer.d.ts.map +1 -1
  218. package/dist/src/formats/json/importer.js +42 -6
  219. package/dist/src/formats/json/importer.js.map +1 -1
  220. package/dist/src/formats/json/index.d.ts +1 -1
  221. package/dist/src/formats/json/index.d.ts.map +1 -1
  222. package/dist/src/formats/json/index.js +1 -1
  223. package/dist/src/formats/json/index.js.map +1 -1
  224. package/dist/src/formats/json/positions.d.ts +5 -2
  225. package/dist/src/formats/json/positions.d.ts.map +1 -1
  226. package/dist/src/formats/json/positions.js +20 -4
  227. package/dist/src/formats/json/positions.js.map +1 -1
  228. package/dist/src/formats/json/styles.d.ts +12 -1
  229. package/dist/src/formats/json/styles.d.ts.map +1 -1
  230. package/dist/src/formats/json/styles.js +1843 -136
  231. package/dist/src/formats/json/styles.js.map +1 -1
  232. package/dist/src/formats/pajek/draw.d.ts +104 -0
  233. package/dist/src/formats/pajek/draw.d.ts.map +1 -0
  234. package/dist/src/formats/pajek/draw.js +382 -0
  235. package/dist/src/formats/pajek/draw.js.map +1 -0
  236. package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
  237. package/dist/src/formats/pajek/exporter.js +70 -51
  238. package/dist/src/formats/pajek/exporter.js.map +1 -1
  239. package/dist/src/formats/pajek/importer.d.ts +9 -0
  240. package/dist/src/formats/pajek/importer.d.ts.map +1 -1
  241. package/dist/src/formats/pajek/importer.js +233 -102
  242. package/dist/src/formats/pajek/importer.js.map +1 -1
  243. package/dist/src/formats/pajek/index.d.ts +1 -0
  244. package/dist/src/formats/pajek/index.d.ts.map +1 -1
  245. package/dist/src/formats/pajek/index.js.map +1 -1
  246. package/dist/src/formats/pajek/styles.d.ts +15 -7
  247. package/dist/src/formats/pajek/styles.d.ts.map +1 -1
  248. package/dist/src/formats/pajek/styles.js +1395 -114
  249. package/dist/src/formats/pajek/styles.js.map +1 -1
  250. package/dist/src/formats/pajek/syntax.d.ts +10 -1
  251. package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
  252. package/dist/src/formats/pajek/syntax.js +26 -2
  253. package/dist/src/formats/pajek/syntax.js.map +1 -1
  254. package/dist/src/formats/xgmml/emit.d.ts +1 -0
  255. package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
  256. package/dist/src/formats/xgmml/emit.js +65 -5
  257. package/dist/src/formats/xgmml/emit.js.map +1 -1
  258. package/dist/src/formats/xgmml/styles.d.ts +23 -3
  259. package/dist/src/formats/xgmml/styles.d.ts.map +1 -1
  260. package/dist/src/formats/xgmml/styles.js +277 -60
  261. package/dist/src/formats/xgmml/styles.js.map +1 -1
  262. package/dist/src/index.d.ts +6 -5
  263. package/dist/src/index.d.ts.map +1 -1
  264. package/dist/src/index.js +6 -5
  265. package/dist/src/index.js.map +1 -1
  266. package/dist/src/positions/convert.d.ts.map +1 -1
  267. package/dist/src/positions/convert.js +11 -1
  268. package/dist/src/positions/convert.js.map +1 -1
  269. package/dist/src/positions/extract.d.ts.map +1 -1
  270. package/dist/src/positions/extract.js +53 -1
  271. package/dist/src/positions/extract.js.map +1 -1
  272. package/dist/src/positions/index.d.ts +1 -1
  273. package/dist/src/positions/index.d.ts.map +1 -1
  274. package/dist/src/positions/types.d.ts +59 -0
  275. package/dist/src/positions/types.d.ts.map +1 -1
  276. package/dist/src/sources/builtins.d.ts +1 -1
  277. package/dist/src/sources/builtins.d.ts.map +1 -1
  278. package/dist/src/sources/builtins.js +8 -2
  279. package/dist/src/sources/builtins.js.map +1 -1
  280. package/dist/src/sources/context.d.ts.map +1 -1
  281. package/dist/src/sources/context.js +1 -0
  282. package/dist/src/sources/context.js.map +1 -1
  283. package/dist/src/sources/credentials.d.ts +50 -1
  284. package/dist/src/sources/credentials.d.ts.map +1 -1
  285. package/dist/src/sources/credentials.js +69 -0
  286. package/dist/src/sources/credentials.js.map +1 -1
  287. package/dist/src/sources/cypher/descriptor.d.ts.map +1 -1
  288. package/dist/src/sources/cypher/descriptor.js +5 -0
  289. package/dist/src/sources/cypher/descriptor.js.map +1 -1
  290. package/dist/src/sources/cypher/index.d.ts.map +1 -1
  291. package/dist/src/sources/cypher/index.js +125 -18
  292. package/dist/src/sources/cypher/index.js.map +1 -1
  293. package/dist/src/sources/cypher/params.d.ts +1 -1
  294. package/dist/src/sources/cypher/params.d.ts.map +1 -1
  295. package/dist/src/sources/cypher/query-builder.d.ts +17 -0
  296. package/dist/src/sources/cypher/query-builder.d.ts.map +1 -1
  297. package/dist/src/sources/cypher/query-builder.js +31 -0
  298. package/dist/src/sources/cypher/query-builder.js.map +1 -1
  299. package/dist/src/sources/ids.d.ts +5 -0
  300. package/dist/src/sources/ids.d.ts.map +1 -1
  301. package/dist/src/sources/ids.js +5 -0
  302. package/dist/src/sources/ids.js.map +1 -1
  303. package/dist/src/sources/params.d.ts +3 -0
  304. package/dist/src/sources/params.d.ts.map +1 -1
  305. package/dist/src/sources/rest/descriptor.d.ts.map +1 -1
  306. package/dist/src/sources/rest/descriptor.js +9 -0
  307. package/dist/src/sources/rest/descriptor.js.map +1 -1
  308. package/dist/src/sources/rest/openalex.d.ts +4 -2
  309. package/dist/src/sources/rest/openalex.d.ts.map +1 -1
  310. package/dist/src/sources/rest/openalex.js +4 -2
  311. package/dist/src/sources/rest/openalex.js.map +1 -1
  312. package/dist/src/sources/rest/source.d.ts.map +1 -1
  313. package/dist/src/sources/rest/source.js +38 -0
  314. package/dist/src/sources/rest/source.js.map +1 -1
  315. package/dist/src/sources/run.d.ts +2 -0
  316. package/dist/src/sources/run.d.ts.map +1 -1
  317. package/dist/src/sources/run.js +30 -3
  318. package/dist/src/sources/run.js.map +1 -1
  319. package/dist/src/sources/sigv4.d.ts +5 -3
  320. package/dist/src/sources/sigv4.d.ts.map +1 -1
  321. package/dist/src/sources/sigv4.js +6 -4
  322. package/dist/src/sources/sigv4.js.map +1 -1
  323. package/dist/src/sources/sparql/descriptor.d.ts +10 -0
  324. package/dist/src/sources/sparql/descriptor.d.ts.map +1 -0
  325. package/dist/src/sources/sparql/descriptor.js +64 -0
  326. package/dist/src/sources/sparql/descriptor.js.map +1 -0
  327. package/dist/src/sources/sparql/index.d.ts +28 -0
  328. package/dist/src/sources/sparql/index.d.ts.map +1 -0
  329. package/dist/src/sources/sparql/index.js +327 -0
  330. package/dist/src/sources/sparql/index.js.map +1 -0
  331. package/dist/src/sources/sparql/ntriples.d.ts +69 -0
  332. package/dist/src/sources/sparql/ntriples.d.ts.map +1 -0
  333. package/dist/src/sources/sparql/ntriples.js +180 -0
  334. package/dist/src/sources/sparql/ntriples.js.map +1 -0
  335. package/dist/src/sources/sparql/params.d.ts +27 -0
  336. package/dist/src/sources/sparql/params.d.ts.map +1 -0
  337. package/dist/src/sources/sparql/params.js +5 -0
  338. package/dist/src/sources/sparql/params.js.map +1 -0
  339. package/dist/src/sources/sparql/query.d.ts +73 -0
  340. package/dist/src/sources/sparql/query.d.ts.map +1 -0
  341. package/dist/src/sources/sparql/query.js +164 -0
  342. package/dist/src/sources/sparql/query.js.map +1 -0
  343. package/dist/src/sources/types.d.ts +60 -0
  344. package/dist/src/sources/types.d.ts.map +1 -1
  345. package/dist/src/styles/annotations.d.ts +61 -5
  346. package/dist/src/styles/annotations.d.ts.map +1 -1
  347. package/dist/src/styles/annotations.js +130 -22
  348. package/dist/src/styles/annotations.js.map +1 -1
  349. package/dist/src/styles/canon/bends.d.ts +46 -0
  350. package/dist/src/styles/canon/bends.d.ts.map +1 -1
  351. package/dist/src/styles/canon/bends.js +123 -0
  352. package/dist/src/styles/canon/bends.js.map +1 -1
  353. package/dist/src/styles/canon/color-tables.d.ts +6 -1
  354. package/dist/src/styles/canon/color-tables.d.ts.map +1 -1
  355. package/dist/src/styles/canon/color-tables.js +10 -4
  356. package/dist/src/styles/canon/color-tables.js.map +1 -1
  357. package/dist/src/styles/canon/color.d.ts +3 -1
  358. package/dist/src/styles/canon/color.d.ts.map +1 -1
  359. package/dist/src/styles/canon/color.js +103 -3
  360. package/dist/src/styles/canon/color.js.map +1 -1
  361. package/dist/src/styles/canon/enums.d.ts +2 -2
  362. package/dist/src/styles/canon/enums.d.ts.map +1 -1
  363. package/dist/src/styles/canon/enums.js +89 -7
  364. package/dist/src/styles/canon/enums.js.map +1 -1
  365. package/dist/src/styles/canon/graphviz.d.ts +12 -3
  366. package/dist/src/styles/canon/graphviz.d.ts.map +1 -1
  367. package/dist/src/styles/canon/graphviz.js +57 -9
  368. package/dist/src/styles/canon/graphviz.js.map +1 -1
  369. package/dist/src/styles/canon/number.d.ts +8 -0
  370. package/dist/src/styles/canon/number.d.ts.map +1 -1
  371. package/dist/src/styles/canon/number.js +18 -0
  372. package/dist/src/styles/canon/number.js.map +1 -1
  373. package/dist/src/styles/canon/text.d.ts +29 -2
  374. package/dist/src/styles/canon/text.d.ts.map +1 -1
  375. package/dist/src/styles/canon/text.js +156 -16
  376. package/dist/src/styles/canon/text.js.map +1 -1
  377. package/dist/src/styles/codes.d.ts +2 -0
  378. package/dist/src/styles/codes.d.ts.map +1 -1
  379. package/dist/src/styles/codes.js +2 -0
  380. package/dist/src/styles/codes.js.map +1 -1
  381. package/dist/src/styles/cyjs/cascade.d.ts.map +1 -1
  382. package/dist/src/styles/cyjs/cascade.js +1139 -79
  383. package/dist/src/styles/cyjs/cascade.js.map +1 -1
  384. package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -1
  385. package/dist/src/styles/cyjs/defaults-table.js +4 -0
  386. package/dist/src/styles/cyjs/defaults-table.js.map +1 -1
  387. package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
  388. package/dist/src/styles/cyjs/emit.js +232 -10
  389. package/dist/src/styles/cyjs/emit.js.map +1 -1
  390. package/dist/src/styles/cyjs/face.d.ts +20 -0
  391. package/dist/src/styles/cyjs/face.d.ts.map +1 -0
  392. package/dist/src/styles/cyjs/face.js +332 -0
  393. package/dist/src/styles/cyjs/face.js.map +1 -0
  394. package/dist/src/styles/cyjs/mappers.d.ts +44 -1
  395. package/dist/src/styles/cyjs/mappers.d.ts.map +1 -1
  396. package/dist/src/styles/cyjs/mappers.js +475 -26
  397. package/dist/src/styles/cyjs/mappers.js.map +1 -1
  398. package/dist/src/styles/cyjs/routes.d.ts +53 -0
  399. package/dist/src/styles/cyjs/routes.d.ts.map +1 -0
  400. package/dist/src/styles/cyjs/routes.js +360 -0
  401. package/dist/src/styles/cyjs/routes.js.map +1 -0
  402. package/dist/src/styles/cytoscape/charts.d.ts +23 -0
  403. package/dist/src/styles/cytoscape/charts.d.ts.map +1 -0
  404. package/dist/src/styles/cytoscape/charts.js +560 -0
  405. package/dist/src/styles/cytoscape/charts.js.map +1 -0
  406. package/dist/src/styles/cytoscape/emit.d.ts.map +1 -1
  407. package/dist/src/styles/cytoscape/emit.js +156 -48
  408. package/dist/src/styles/cytoscape/emit.js.map +1 -1
  409. package/dist/src/styles/cytoscape/lexicon.d.ts +91 -3
  410. package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
  411. package/dist/src/styles/cytoscape/lexicon.js +387 -77
  412. package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
  413. package/dist/src/styles/cytoscape/mappings.d.ts +30 -0
  414. package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -1
  415. package/dist/src/styles/cytoscape/mappings.js +92 -0
  416. package/dist/src/styles/cytoscape/mappings.js.map +1 -1
  417. package/dist/src/styles/cytoscape/resolve.d.ts +42 -2
  418. package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -1
  419. package/dist/src/styles/cytoscape/resolve.js +623 -17
  420. package/dist/src/styles/cytoscape/resolve.js.map +1 -1
  421. package/dist/src/styles/defaults.d.ts +46 -26
  422. package/dist/src/styles/defaults.d.ts.map +1 -1
  423. package/dist/src/styles/defaults.js +308 -71
  424. package/dist/src/styles/defaults.js.map +1 -1
  425. package/dist/src/styles/index.d.ts +4 -3
  426. package/dist/src/styles/index.d.ts.map +1 -1
  427. package/dist/src/styles/index.js +3 -2
  428. package/dist/src/styles/index.js.map +1 -1
  429. package/dist/src/styles/internal.d.ts +1 -0
  430. package/dist/src/styles/internal.d.ts.map +1 -1
  431. package/dist/src/styles/internal.js +1 -0
  432. package/dist/src/styles/internal.js.map +1 -1
  433. package/dist/src/styles/io/generic.d.ts.map +1 -1
  434. package/dist/src/styles/io/generic.js +56 -16
  435. package/dist/src/styles/io/generic.js.map +1 -1
  436. package/dist/src/styles/io/round-trip.d.ts +56 -0
  437. package/dist/src/styles/io/round-trip.d.ts.map +1 -0
  438. package/dist/src/styles/io/round-trip.js +138 -0
  439. package/dist/src/styles/io/round-trip.js.map +1 -0
  440. package/dist/src/styles/io/writer.d.ts.map +1 -1
  441. package/dist/src/styles/io/writer.js +6 -1
  442. package/dist/src/styles/io/writer.js.map +1 -1
  443. package/dist/src/styles/notes.d.ts.map +1 -1
  444. package/dist/src/styles/notes.js +1 -0
  445. package/dist/src/styles/notes.js.map +1 -1
  446. package/dist/src/styles/plan/features.d.ts +1 -1
  447. package/dist/src/styles/plan/features.d.ts.map +1 -1
  448. package/dist/src/styles/plan/features.js +22 -2
  449. package/dist/src/styles/plan/features.js.map +1 -1
  450. package/dist/src/styles/plan/index.d.ts +1 -1
  451. package/dist/src/styles/plan/index.d.ts.map +1 -1
  452. package/dist/src/styles/plan/index.js +1 -1
  453. package/dist/src/styles/plan/index.js.map +1 -1
  454. package/dist/src/styles/plan/plan.d.ts.map +1 -1
  455. package/dist/src/styles/plan/plan.js +61 -4
  456. package/dist/src/styles/plan/plan.js.map +1 -1
  457. package/dist/src/styles/plan/resolve.d.ts +11 -0
  458. package/dist/src/styles/plan/resolve.d.ts.map +1 -1
  459. package/dist/src/styles/plan/resolve.js +40 -4
  460. package/dist/src/styles/plan/resolve.js.map +1 -1
  461. package/dist/src/styles/slots.d.ts +14 -0
  462. package/dist/src/styles/slots.d.ts.map +1 -0
  463. package/dist/src/styles/slots.js +20 -0
  464. package/dist/src/styles/slots.js.map +1 -0
  465. package/dist/src/styles/types.d.ts +687 -6
  466. package/dist/src/styles/types.d.ts.map +1 -1
  467. package/dist/src/styles/vocabulary.d.ts +3 -2
  468. package/dist/src/styles/vocabulary.d.ts.map +1 -1
  469. package/dist/src/styles/vocabulary.js +224 -0
  470. package/dist/src/styles/vocabulary.js.map +1 -1
  471. package/dist/styles.js +30 -239
  472. package/dist/styles.js.map +1 -1
  473. package/dist/xgmml.js +3 -3
  474. package/package.json +27 -7
  475. package/src/formats/cx/importer.ts +6 -1
  476. package/src/formats/cx/styles.ts +143 -9
  477. package/src/formats/cx2/importer.ts +1 -0
  478. package/src/formats/cx2/styles.ts +3 -1
  479. package/src/formats/cys/importer.ts +1 -0
  480. package/src/formats/cys/styles.ts +27 -5
  481. package/src/formats/dot/drawing.ts +799 -0
  482. package/src/formats/dot/exporter.ts +37 -1
  483. package/src/formats/dot/importer.ts +192 -36
  484. package/src/formats/dot/index.ts +3 -1
  485. package/src/formats/dot/label-places.ts +241 -0
  486. package/src/formats/dot/names.ts +15 -0
  487. package/src/formats/dot/record.ts +336 -0
  488. package/src/formats/dot/styles.ts +1702 -149
  489. package/src/formats/gexf/dialog-metrics.ts +61 -0
  490. package/src/formats/gexf/importer.ts +50 -5
  491. package/src/formats/gexf/preview.ts +217 -0
  492. package/src/formats/gexf/schema.ts +2 -1
  493. package/src/formats/gexf/styles.ts +1099 -245
  494. package/src/formats/gml/importer.ts +291 -76
  495. package/src/formats/gml/index.ts +1 -1
  496. package/src/formats/gml/positions.ts +29 -7
  497. package/src/formats/gml/styles.ts +852 -110
  498. package/src/formats/graphml/styles-plain.ts +6 -15
  499. package/src/formats/graphml/styles-yed.ts +765 -176
  500. package/src/formats/graphml/styles-yfiles3.ts +487 -63
  501. package/src/formats/graphml/yfiles.ts +19 -6
  502. package/src/formats/json/dialect.ts +41 -5
  503. package/src/formats/json/importer.ts +59 -7
  504. package/src/formats/json/index.ts +1 -0
  505. package/src/formats/json/positions.ts +22 -5
  506. package/src/formats/json/styles.ts +2123 -171
  507. package/src/formats/pajek/draw.ts +469 -0
  508. package/src/formats/pajek/exporter.ts +81 -49
  509. package/src/formats/pajek/importer.ts +278 -103
  510. package/src/formats/pajek/index.ts +1 -0
  511. package/src/formats/pajek/styles.ts +1506 -133
  512. package/src/formats/pajek/syntax.ts +27 -2
  513. package/src/formats/xgmml/emit.ts +73 -5
  514. package/src/formats/xgmml/styles.ts +330 -71
  515. package/src/index.ts +12 -1
  516. package/src/positions/convert.ts +12 -1
  517. package/src/positions/extract.ts +55 -1
  518. package/src/positions/index.ts +1 -0
  519. package/src/positions/types.ts +60 -0
  520. package/src/sources/builtins.ts +8 -1
  521. package/src/sources/context.ts +1 -0
  522. package/src/sources/credentials.ts +90 -1
  523. package/src/sources/cypher/descriptor.ts +7 -1
  524. package/src/sources/cypher/index.ts +149 -18
  525. package/src/sources/cypher/params.ts +1 -1
  526. package/src/sources/cypher/query-builder.ts +33 -0
  527. package/src/sources/ids.ts +6 -0
  528. package/src/sources/params.ts +3 -0
  529. package/src/sources/rest/descriptor.ts +9 -0
  530. package/src/sources/rest/openalex.ts +4 -2
  531. package/src/sources/rest/source.ts +41 -0
  532. package/src/sources/run.ts +35 -3
  533. package/src/sources/sigv4.ts +6 -4
  534. package/src/sources/sparql/descriptor.ts +67 -0
  535. package/src/sources/sparql/index.ts +371 -0
  536. package/src/sources/sparql/ntriples.ts +219 -0
  537. package/src/sources/sparql/params.ts +28 -0
  538. package/src/sources/sparql/query.ts +216 -0
  539. package/src/sources/types.ts +68 -0
  540. package/src/styles/annotations.ts +201 -27
  541. package/src/styles/canon/bends.ts +137 -0
  542. package/src/styles/canon/color-tables.ts +10 -4
  543. package/src/styles/canon/color.ts +105 -3
  544. package/src/styles/canon/enums.ts +107 -8
  545. package/src/styles/canon/graphviz.ts +71 -10
  546. package/src/styles/canon/number.ts +19 -0
  547. package/src/styles/canon/text.ts +187 -16
  548. package/src/styles/codes.ts +2 -0
  549. package/src/styles/cyjs/cascade.ts +1303 -84
  550. package/src/styles/cyjs/defaults-table.ts +4 -0
  551. package/src/styles/cyjs/emit.ts +268 -14
  552. package/src/styles/cyjs/face.ts +372 -0
  553. package/src/styles/cyjs/mappers.ts +506 -27
  554. package/src/styles/cyjs/routes.ts +432 -0
  555. package/src/styles/cytoscape/charts.ts +684 -0
  556. package/src/styles/cytoscape/emit.ts +170 -48
  557. package/src/styles/cytoscape/lexicon.ts +431 -78
  558. package/src/styles/cytoscape/mappings.ts +108 -0
  559. package/src/styles/cytoscape/resolve.ts +741 -17
  560. package/src/styles/defaults.ts +417 -108
  561. package/src/styles/index.ts +5 -0
  562. package/src/styles/internal.ts +1 -0
  563. package/src/styles/io/generic.ts +79 -23
  564. package/src/styles/io/round-trip.ts +202 -0
  565. package/src/styles/io/writer.ts +6 -1
  566. package/src/styles/notes.ts +1 -0
  567. package/src/styles/plan/features.ts +23 -2
  568. package/src/styles/plan/index.ts +1 -1
  569. package/src/styles/plan/plan.ts +69 -5
  570. package/src/styles/plan/resolve.ts +47 -4
  571. package/src/styles/slots.ts +25 -0
  572. package/src/styles/types.ts +698 -5
  573. package/src/styles/vocabulary.ts +232 -2
  574. package/dist/chunks/block-Cu22ewuS.js.map +0 -1
  575. package/dist/chunks/choose-Cdx6Enl2.js +0 -57
  576. package/dist/chunks/choose-Cdx6Enl2.js.map +0 -1
  577. package/dist/chunks/codes-CV_Bhcyi.js.map +0 -1
  578. package/dist/chunks/convert-BcQ8_jMo.js.map +0 -1
  579. package/dist/chunks/credentials-BiQsnMTb.js.map +0 -1
  580. package/dist/chunks/descriptor-BJ-W0Jd-.js.map +0 -1
  581. package/dist/chunks/emit-CD8xnY8s.js.map +0 -1
  582. package/dist/chunks/export-CZ7VRm4I.js.map +0 -1
  583. package/dist/chunks/exporter-bxxjOrDZ.js.map +0 -1
  584. package/dist/chunks/format-BMS-1Nxb.js +0 -64
  585. package/dist/chunks/format-BMS-1Nxb.js.map +0 -1
  586. package/dist/chunks/generic-CP6YD34u.js.map +0 -1
  587. package/dist/chunks/importer-B87_fmVx.js.map +0 -1
  588. package/dist/chunks/importer-CB_zV5_L.js.map +0 -1
  589. package/dist/chunks/importer-CVT-JyDE.js.map +0 -1
  590. package/dist/chunks/importer-Cyy6UseH.js.map +0 -1
  591. package/dist/chunks/importer-DPZDN40-.js.map +0 -1
  592. package/dist/chunks/importer-e3huMZbm.js.map +0 -1
  593. package/dist/chunks/lexicon-u2SI5xcx.js.map +0 -1
  594. package/dist/chunks/sigv4-LkAzsLAu.js.map +0 -1
  595. package/dist/chunks/styles-CaABMoO1.js.map +0 -1
  596. package/dist/chunks/styles-P_gmFAOi.js +0 -770
  597. package/dist/chunks/styles-P_gmFAOi.js.map +0 -1
  598. package/dist/chunks/styles-yed-Cs1nmrjn.js.map +0 -1
  599. package/dist/chunks/writer-DvHTl36J.js +0 -449
  600. package/dist/chunks/writer-DvHTl36J.js.map +0 -1
@@ -82,3 +82,140 @@ export function bendsToPoints(source: BendPoint, target: BendPoint, value: strin
82
82
  }
83
83
  return out.length === 0 ? null : out;
84
84
  }
85
+
86
+ /**
87
+ * The points a piecewise cubic Bezier curve passes through, sampled evenly in its parameter: the first control point,
88
+ * then `steps` points along each segment, its last control point included. The input is `3n + 1` control points
89
+ * (a Graphviz spline, a cubic path), each segment sharing its first point with the one before.
90
+ * @param controls - the control points
91
+ * @param steps - how many points each segment is sampled at
92
+ * @returns the points, or null when the count is not `3n + 1` for some n >= 1
93
+ * @category Styles
94
+ */
95
+ export function flattenCubic(controls: readonly BendPoint[], steps = 8): BendPoint[] | null {
96
+ if (controls.length < 4 || (controls.length - 1) % 3 !== 0) {
97
+ return null;
98
+ }
99
+ const out: BendPoint[] = [controls[0]];
100
+ for (let s = 0; s + 3 < controls.length; s += 3) {
101
+ const [p0, p1, p2, p3] = controls.slice(s, s + 4);
102
+ for (let k = 1; k <= steps; k++) {
103
+ const t = k / steps;
104
+ const u = 1 - t;
105
+ const w = [u * u * u, 3 * u * u * t, 3 * u * t * t, t * t * t];
106
+ out.push([
107
+ w[0] * p0[0] + w[1] * p1[0] + w[2] * p2[0] + w[3] * p3[0],
108
+ w[0] * p0[1] + w[1] * p1[1] + w[2] * p2[1] + w[3] * p3[1],
109
+ ]);
110
+ }
111
+ }
112
+ return out;
113
+ }
114
+
115
+ /**
116
+ * Points placed on and around one node, each relative to its center as fractions of its half width and half height,
117
+ * y up: `"1,0"` is the middle of its right side, `"0,1"` the middle of its top. The value of an edge end's port
118
+ * (`sourcePort`, `targetPort`) and of a self-loop's `bends`, which have no line between two centers to be relative
119
+ * to. Relative to the node's size, so a drawing that draws the node larger keeps the point on the same spot.
120
+ * @param center - the node's center
121
+ * @param size - its width and height
122
+ * @param points - the points
123
+ * @param yDown - true when the file's y axis points down (the value is always y up)
124
+ * @returns the value, or null with no points, a size that is not positive, or a coordinate that is not finite
125
+ * @category Styles
126
+ */
127
+ export function canonNodeOffsets(
128
+ center: BendPoint,
129
+ size: BendPoint,
130
+ points: readonly BendPoint[],
131
+ yDown: boolean,
132
+ ): string | null {
133
+ const [hw, hh] = [size[0] / 2, size[1] / 2];
134
+ if (points.length === 0 || Number.isNaN(hw + hh) || hw <= 0 || hh <= 0) {
135
+ return null;
136
+ }
137
+ const flip = yDown ? -1 : 1;
138
+ const out: string[] = [];
139
+ for (const [px, py] of points) {
140
+ const x = (px - center[0]) / hw;
141
+ const y = ((py - center[1]) * flip) / hh;
142
+ if (!Number.isFinite(x) || !Number.isFinite(y)) {
143
+ return null;
144
+ }
145
+ out.push(`${fraction(x)},${fraction(y)}`);
146
+ }
147
+ return out.join(" ");
148
+ }
149
+
150
+ /**
151
+ * The points a node-relative value places around a node: the inverse of {@link canonNodeOffsets}.
152
+ * @param center - the node's center
153
+ * @param size - its width and height
154
+ * @param value - the value
155
+ * @param yDown - true when the points are wanted in a y-down file's coordinates
156
+ * @returns the points, or null when the value is not `x,y` pairs or a coordinate is not finite
157
+ * @category Styles
158
+ */
159
+ export function nodeOffsetsToPoints(
160
+ center: BendPoint,
161
+ size: BendPoint,
162
+ value: string,
163
+ yDown: boolean,
164
+ ): BendPoint[] | null {
165
+ const flip = yDown ? -1 : 1;
166
+ const out: BendPoint[] = [];
167
+ for (const pair of value.trim().split(/\s+/)) {
168
+ const [a, b, extra] = pair.split(",").map(Number);
169
+ const x = center[0] + (a * size[0]) / 2;
170
+ const y = center[1] + (b * size[1] * flip) / 2;
171
+ if (extra !== undefined || !Number.isFinite(x) || !Number.isFinite(y)) {
172
+ return null;
173
+ }
174
+ out.push([x, y]);
175
+ }
176
+ return out.length === 0 ? null : out;
177
+ }
178
+
179
+ /**
180
+ * The points a quadratic spline passes through, as yEd draws a quad curve edge: its first and last control points are
181
+ * the ends, every control point between them pulls the curve without lying on it, and the curve runs from the middle
182
+ * of the leg before such a point to the middle of the leg after it (from the end itself on the first and last legs).
183
+ * `straightness` (0..1) keeps that share of every leg straight, so each curved piece covers only the part of its two
184
+ * legs nearest its control point: 0 is the smooth spline, 1 the control polygon.
185
+ * @param controls - the control points, ends included
186
+ * @param straightness - how straight the legs stay, 0..1
187
+ * @param steps - how many points each curved piece is sampled at
188
+ * @returns the points, ends included; the controls themselves with fewer than three
189
+ * @category Styles
190
+ */
191
+ export function flattenQuadSpline(controls: readonly BendPoint[], straightness: number, steps = 8): BendPoint[] {
192
+ if (controls.length < 3) {
193
+ return [...controls];
194
+ }
195
+ const s = Math.min(1, Math.max(0, Number.isFinite(straightness) ? straightness : 0));
196
+ const lerp = (a: BendPoint, b: BendPoint, t: number): BendPoint => [
197
+ a[0] + (b[0] - a[0]) * t,
198
+ a[1] + (b[1] - a[1]) * t,
199
+ ];
200
+ const last = controls.length - 1;
201
+ const out: BendPoint[] = [controls[0]];
202
+ for (let i = 1; i < last; i++) {
203
+ const c = controls[i];
204
+ // the joins either side: the middle of each leg, or the end itself on the first and last
205
+ const before = i === 1 ? controls[0] : lerp(controls[i - 1], c, 0.5);
206
+ const after = i === last - 1 ? controls[last] : lerp(c, controls[i + 1], 0.5);
207
+ const from = lerp(c, before, 1 - s);
208
+ const to = lerp(c, after, 1 - s);
209
+ for (let k = 0; k <= steps; k++) {
210
+ const t = k / steps;
211
+ const u = 1 - t;
212
+ out.push([
213
+ u * u * from[0] + 2 * u * t * c[0] + t * t * to[0],
214
+ u * u * from[1] + 2 * u * t * c[1] + t * t * to[1],
215
+ ]);
216
+ }
217
+ }
218
+ out.push(controls[last]);
219
+ // a piece that starts where the one before ends (straightness 0) repeats the join
220
+ return out.filter((p, k) => k === 0 || p[0] !== out[k - 1][0] || p[1] !== out[k - 1][1]);
221
+ }
@@ -169,11 +169,19 @@ export const X11_COLORS: ReadonlyMap<string, string> = table(
169
169
  "tomato3=cd4f39 tomato4=8b3626 turquoise=40e0d0 turquoise1=00f5ff turquoise2=00e5ee turquoise3=00c5cd " +
170
170
  "turquoise4=00868b violet=ee82ee violetred=d02090 violetred1=ff3e96 violetred2=ee3a8c violetred3=cd3278 " +
171
171
  "violetred4=8b2252 wheat=f5deb3 wheat1=ffe7ba wheat2=eed8ae wheat3=cdba96 wheat4=8b7e66 white=ffffff " +
172
+ // added in later Graphviz releases (measured on 14.1.2): the web and X11 spellings of the five clashing names
173
+ "webgray=808080 webgreen=008000 webgrey=808080 webmaroon=800000 webpurple=800080 x11gray=bebebe " +
174
+ "x11green=00ff00 x11grey=bebebe x11maroon=b03060 x11purple=a020f0 " +
172
175
  "whitesmoke=f5f5f5 yellow=ffff00 yellow1=ffff00 yellow2=eeee00 yellow3=cdcd00 yellow4=8b8b00 " +
173
176
  "yellowgreen=9acd32",
174
177
  );
175
178
 
176
- /** dvips names, case as Pajek spells them. */
179
+ /**
180
+ * dvips names, case as Pajek spells them, and the ten Pajek adds (from LightYellow on: Pajek 6.02 manual, figure 19,
181
+ * with the CMYK values of the color dictionary in Pajek's own EPS export). LightOrange is the one its SVG export draws
182
+ * otherwise: #ffd9bc, Pajek's default vertex fill, not the EPS dictionary's #ffccb3 (`pajek-specimen-node-fills-borders-p2`
183
+ * `ic-lightorange`, `pajek-graphstream-b`: 18 vertices).
184
+ */
177
185
  export const DVIPS_COLORS: ReadonlyMap<string, string> = table(
178
186
  "GreenYellow=d9ff4f Yellow=ffff00 Goldenrod=ffe629 Dandelion=ffb529 Apricot=ffad7a Peach=ff804d " +
179
187
  "Melon=ff8a80 YellowOrange=ff9400 Orange=ff6321 BurntOrange=ff7d00 Bittersweet=c20300 RedOrange=ff3b21 " +
@@ -187,10 +195,8 @@ export const DVIPS_COLORS: ReadonlyMap<string, string> = table(
187
195
  "JungleGreen=03ff7a SeaGreen=4fff80 Green=00ff00 ForestGreen=00e000 PineGreen=00bf29 LimeGreen=80ff00 " +
188
196
  "YellowGreen=8fff42 SpringGreen=bdff3d OliveGreen=009900 RawSienna=8c0000 Sepia=4d0000 Brown=660000 " +
189
197
  "Tan=db9470 Gray=808080 Black=000000 White=ffffff " +
190
- // Pajek's own names, not in dvips: the RGB fill of each swatch in the Pajek 6.02 manual, Figure 19, p. 105
191
- // (http://mrvar.fdv.uni-lj.si/pajek/pajekman.pdf); Pajek's SVG export draws LightCyan as rgb(204,255,255) too.
192
198
  "LightYellow=ffff99 LightCyan=ccffff LightMagenta=ffccff LightPurple=ccccff LightGreen=ccffb3 " +
193
- "LightOrange=ffccb3 Canary=ffff7f LFadedGreen=e6ffcc Pink=ffd9f3 LSkyBlue=d9f3ff",
199
+ "LightOrange=ffd9bc Canary=ffff80 LFadedGreen=e6ffcc Pink=ffd9f2 LSkyBlue=d9f2ff",
194
200
  );
195
201
 
196
202
  /** Java's `java.awt.Color` constants, lowercase, with and without the underscore. */
@@ -405,6 +405,76 @@ function cssColor(text: string): { hex: StyleColor; alpha: number } | null {
405
405
  return hexColor(text, false) ?? cssFunction(text);
406
406
  }
407
407
 
408
+ /**
409
+ * sigma.js's `rgb()` / `rgba()` reader (sigma/utils parseColor, the regex
410
+ * `^\s*rgba?\s*\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)(?:\s*,\s*(.*)?)?\)\s*$`), read without backtracking: integer
411
+ * channels, no space before the `)` unless an alpha follows, the alpha on one line.
412
+ * @param text - the value
413
+ * @returns the three channels' digits and the alpha's text (empty when none), or null
414
+ */
415
+ function sigmaRgba(text: string): [string, string, string, string] | null {
416
+ const t = text.trim();
417
+ const head = /^rgba?\s*\(/.exec(t);
418
+ if (head === null || !t.endsWith(")")) {
419
+ return null;
420
+ }
421
+ const parts = t.slice(head[0].length, -1).split(",");
422
+ if (parts.length < 3) {
423
+ return null;
424
+ }
425
+ const alpha = parts.slice(3).join(",").trimStart();
426
+ // the third channel runs up to the `)` when no alpha follows it
427
+ const third = parts.length > 3 ? parts[2].trim() : parts[2].trimStart();
428
+ const channels = [parts[0].trim(), parts[1].trim(), third];
429
+ if (!channels.every((c) => /^\d*$/.test(c)) || /[\n\r\u2028\u2029]/.test(alpha)) {
430
+ return null;
431
+ }
432
+ return [channels[0], channels[1], channels[2], alpha];
433
+ }
434
+
435
+ /**
436
+ * A color as sigma.js 4.0.1 reads it (sigma/utils parseColor), untrimmed: `transparent`, the 148 HTML color names in
437
+ * any case, `#rgb`, `#rrggbb` and `#rrggbbaa` (any other length is read two digits a channel, so `#f80c` is
438
+ * `#f80c00`), and `rgb()` / `rgba()` with integer channels. Anything else, the empty string included, is black.
439
+ * @param text - the value as the file has it
440
+ * @returns the color and its alpha, and whether sigma read it as a color (else it is black, or garbled)
441
+ */
442
+ function sigmaColor(text: string): { color: StyleColor; alpha: number; read: boolean } {
443
+ const lower = text.toLowerCase();
444
+ if (lower === "transparent") {
445
+ return { color: "#000000", alpha: 0, read: true };
446
+ }
447
+ const named = CSS_COLORS.get(lower);
448
+ if (named !== undefined) {
449
+ return sigmaColor(named);
450
+ }
451
+ let rgb = [0, 0, 0];
452
+ let a = 1;
453
+ let read = false;
454
+ if (text.startsWith("#")) {
455
+ read = /^#(?:[\da-f]{3}|[\da-f]{6}|[\da-f]{8})$/i.test(text);
456
+ const at = text.length === 4 ? [1, 1, 2, 2, 3, 3] : [1, 2, 3, 4, 5, 6];
457
+ // parseInt reads a leading run of hex digits; NaN (no digit) is stored as 0
458
+ rgb = [0, 2, 4].map((k) => Number.parseInt(text.charAt(at[k]) + text.charAt(at[k + 1]), 16) || 0);
459
+ if (text.length === 9) {
460
+ a = Number.parseInt(text.slice(7, 9), 16) / 255;
461
+ }
462
+ } else {
463
+ const m = sigmaRgba(text);
464
+ if (m !== null) {
465
+ read = true;
466
+ rgb = [Number(m[0]), Number(m[1]), Number(m[2])];
467
+ if (m[3]) {
468
+ a = Number(m[3]);
469
+ }
470
+ }
471
+ }
472
+ // sigma packs each channel into a byte (ponytail: a channel over 255 wraps here; sigma lets it spill into the
473
+ // next channel)
474
+ const [r, g, b] = rgb.map((v) => v & 255);
475
+ return { color: rgbHex(r, g, b), alpha: ((a * 255) & 255) / 255, read };
476
+ }
477
+
408
478
  /** One of Pajek's decimal color channels in `RGB(1,0.8,0)`: 0..1, no spaces (Pajek 6.02 manual p. 76). */
409
479
  const PAJEK_CHANNEL = /^(?:\d+(?:\.\d*)?|\.\d+)$/;
410
480
 
@@ -478,9 +548,11 @@ function channels(raw: object): { hex: StyleColor; alpha: number } | null {
478
548
  /**
479
549
  * A canonical color in the file's dialect, or null with a note.
480
550
  *
481
- * - CSS (`css`, `vis`, `graphology`, `cytoscape-js`, `graphty` and any dialect not listed): `#rgb`, `#rgba`,
551
+ * - CSS (`css`, `vis`, `cytoscape-js`, `graphty` and any dialect not listed): `#rgb`, `#rgba`,
482
552
  * `#rrggbb`, `#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, `hsla()`, CSS names and `transparent`, resolved as
483
553
  * graphty-element resolves them (out-of-range channels are gamut mapped).
554
+ * - `graphology`: sigma.js's own parser (see `sigmaColor`); a string it cannot read is BLACK, with a note, because
555
+ * that is what sigma draws, and a value that is not a string is null (sigma throws on it).
484
556
  * - `graphviz`: Graphviz's own rules (see `graphvizColor`); an unknown color is BLACK, with a note, because that is
485
557
  * what Graphviz draws. `x11`: the same names, and an unknown one is null.
486
558
  * - `java`, `gephi`, `cytoscape`: the `java.awt.Color` names first, then CSS; a `java` integer is an RGB value.
@@ -511,6 +583,12 @@ export function canonColor(
511
583
  const v = raw >>> 0;
512
584
  return { color: rgbHex((v >>> 16) & 255, (v >>> 8) & 255, v & 255), alpha: 1 };
513
585
  }
586
+ if (dialect === "graphology" && typeof raw === "string" && raw.trim() === "") {
587
+ // sigma draws a blank color black, where every other reader has no color
588
+ spendAt(site, 1);
589
+ noteAt(site, STYLE_ISSUE.BAD_VALUE, raw);
590
+ return { color: "#000000", alpha: 1 };
591
+ }
514
592
  const text = scalarText(raw, site);
515
593
  if (text === null) {
516
594
  return null;
@@ -518,6 +596,9 @@ export function canonColor(
518
596
  if (dialect === "graphviz" || dialect === "x11") {
519
597
  return graphvizCanon(text, dialect === "x11" ? "x11" : "graphviz", site, options);
520
598
  }
599
+ if (dialect === "graphology") {
600
+ return graphologyColor(raw, text, site);
601
+ }
521
602
  const c = textColor(text.trim(), dialect);
522
603
  if (c === null) {
523
604
  noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
@@ -526,6 +607,26 @@ export function canonColor(
526
607
  return { color: c.hex, alpha: c.alpha };
527
608
  }
528
609
 
610
+ /**
611
+ * A graphology color as sigma.js draws it; a value that is not a string is no color, as sigma throws drawing it.
612
+ * @param raw - the file's value
613
+ * @param text - the value as text
614
+ * @param site - where it was read
615
+ * @returns the color and its alpha, or null
616
+ */
617
+ function graphologyColor(raw: unknown, text: string, site: CanonSite): CanonColor | null {
618
+ if (typeof raw !== "string") {
619
+ // sigma throws while drawing a color that is not a string
620
+ noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
621
+ return null;
622
+ }
623
+ const c = sigmaColor(text);
624
+ if (!c.read) {
625
+ noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
626
+ }
627
+ return { color: c.color, alpha: c.alpha };
628
+ }
629
+
529
630
  /**
530
631
  * A color given as an object: only GEXF and Gephi write one, as channels.
531
632
  * @param raw - the object
@@ -557,10 +658,11 @@ function graphvizCanon(
557
658
  site: CanonSite,
558
659
  options: CanonColorOptions,
559
660
  ): CanonColor | null {
560
- const g = graphvizColor(text, dialect === "x11" ? null : (options.scheme ?? null), options.use ?? "line");
661
+ const x11 = dialect === "x11";
662
+ const g = graphvizColor(text, x11 ? null : (options.scheme ?? null), options.use ?? "line", !x11);
561
663
  if (g.unknown) {
562
664
  noteAt(site, STYLE_ISSUE.BAD_VALUE, text);
563
- if (dialect === "x11") {
665
+ if (x11) {
564
666
  return null;
565
667
  }
566
668
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Canonical enumeration values: each dialect's spellings matched against an alias table without regard to case,
3
3
  * spaces or underscores. An unknown value of an open enumeration (shapes, border and line styles, arrows) is kept as
4
- * `other:<raw>` and noted; an unknown value of a closed one (weights, positions) gives no value and is noted.
4
+ * `other:<raw>` and noted; an unknown value of a closed one (weights, positions, label fits) gives no value and is noted.
5
5
  */
6
6
 
7
7
  import { STYLE_ISSUE } from "../codes.js";
@@ -12,7 +12,17 @@ import { type CanonSite, noteAt, scalarText } from "./site.js";
12
12
  * The enumerations a style value can belong to.
13
13
  * @category Styles
14
14
  */
15
- export type StyleEnumKind = "shape" | "borderStyle" | "lineStyle" | "arrow" | "weight" | "position";
15
+ export type StyleEnumKind =
16
+ | "shape"
17
+ | "borderStyle"
18
+ | "borderPosition"
19
+ | "lineStyle"
20
+ | "arrow"
21
+ | "arrowSide"
22
+ | "weight"
23
+ | "position"
24
+ | "labelFit"
25
+ | "textAlign";
16
26
 
17
27
  type Aliases = Readonly<Record<string, readonly string[]>>;
18
28
 
@@ -55,16 +65,34 @@ const SHAPES: Aliases = {
55
65
  "roundedrectangle",
56
66
  "round-rect",
57
67
  "mrecord",
58
- "cut-rectangle",
59
68
  "round-tag",
60
69
  "bottom-round-rectangle",
70
+ "bottomroundrectangle",
61
71
  ],
62
72
  triangle: ["triangle", "invtriangle", "round-triangle", "tag"],
63
73
  diamond: ["diamond", "rhombus", "mdiamond", "round-diamond"],
64
74
  pentagon: ["pentagon", "round-pentagon"],
65
- hexagon: ["hexagon", "hexagon2", "round-hexagon", "concave-hexagon", "septagon", "heptagon", "round-heptagon"],
66
- octagon: ["octagon", "doubleoctagon", "tripleoctagon", "round-octagon", "octagon2"],
67
- parallelogram: ["parallelogram", "parallelogram2", "rhomboid", "fat-arrow", "fatarrow"],
75
+ hexagon: [
76
+ "hexagon",
77
+ "hexagon2",
78
+ "round-hexagon",
79
+ "concave-hexagon",
80
+ "concavehexagon",
81
+ "septagon",
82
+ "heptagon",
83
+ "round-heptagon",
84
+ ],
85
+ // a cut rectangle is a rectangle with its four corners cut off: eight sides
86
+ octagon: [
87
+ "octagon",
88
+ "doubleoctagon",
89
+ "tripleoctagon",
90
+ "round-octagon",
91
+ "octagon2",
92
+ "cut-rectangle",
93
+ "cutrectangle",
94
+ ],
95
+ parallelogram: ["parallelogram", "parallelogram2", "rhomboid", "right-rhomboid", "fat-arrow", "fatarrow"],
68
96
  trapezoid: ["trapezoid", "trapezoid2", "invtrapezoid", "trapezium", "round-trapezoid"],
69
97
  star: ["star", "star5", "star6", "star8", "polygon"],
70
98
  vee: ["vee", "v"],
@@ -136,6 +164,35 @@ const POSITIONS: Aliases = {
136
164
  "bottom-left": ["bottom-left", "south-west", "southwest"],
137
165
  "bottom-right": ["bottom-right", "south-east", "southeast"],
138
166
  "inside-top": ["inside-top"],
167
+ "inside-bottom": ["inside-bottom"],
168
+ "inside-left": ["inside-left"],
169
+ "inside-right": ["inside-right"],
170
+ "inside-top-left": ["inside-top-left"],
171
+ "inside-top-right": ["inside-top-right"],
172
+ "inside-bottom-left": ["inside-bottom-left"],
173
+ "inside-bottom-right": ["inside-bottom-right"],
174
+ };
175
+
176
+ const BORDER_POSITIONS: Aliases = {
177
+ inside: ["inside"],
178
+ center: ["center", "centre", "middle"],
179
+ outside: ["outside"],
180
+ };
181
+
182
+ const ARROW_SIDES: Aliases = {
183
+ left: ["left"],
184
+ right: ["right"],
185
+ };
186
+
187
+ const TEXT_ALIGNS: Aliases = {
188
+ left: ["left", "start"],
189
+ center: ["center", "centre", "middle"],
190
+ right: ["right", "end"],
191
+ };
192
+
193
+ const LABEL_FITS: Aliases = {
194
+ inside: ["inside"],
195
+ bounds: ["bounds"],
139
196
  };
140
197
 
141
198
  /** vis-network draws these spellings differently from the common reading. */
@@ -146,11 +203,49 @@ const VIS: Partial<Record<StyleEnumKind, Aliases>> = {
146
203
  triangle: ["triangledown"],
147
204
  none: ["text"],
148
205
  },
149
- arrow: { inverted: ["inv-triangle"], square: ["box"] },
206
+ // curve and inv_curve: an arc at the end, bulging toward the node and away from it
207
+ arrow: { inverted: ["inv-triangle"], square: ["box"], "other:curve": ["curve"], "other:inv-curve": ["inv-curve"] },
208
+ };
209
+
210
+ /**
211
+ * Cytoscape.js's compound arrows (https://js.cytoscape.org/#style/edge-arrow): a triangle with a bar behind it, with a
212
+ * thin bar across the line behind it, a dot with a triangle behind it and its short chevron each keep their own name;
213
+ * its triangle-backcurve is a triangle whose back is hollowed out, which is how a vee is drawn.
214
+ */
215
+ const CYJS: Partial<Record<StyleEnumKind, Aliases>> = {
216
+ arrow: {
217
+ "other:triangle-tee": ["triangle-tee"],
218
+ "other:triangle-cross": ["triangle-cross"],
219
+ "other:circle-triangle": ["circle-triangle"],
220
+ // a vee two thirds as long as its triangle (0.2 of the arrow width against 0.3)
221
+ "other:chevron": ["chevron"],
222
+ vee: ["triangle-backcurve"],
223
+ },
224
+ };
225
+
226
+ /**
227
+ * Graphviz's curve and icurve (lib/common/arrows.c arrow_type_curve): a stem to the tip with an arc across it, bulging
228
+ * toward the tip and, inverted, away from it -- vis-network's curve and inv_curve.
229
+ */
230
+ const GRAPHVIZ: Partial<Record<StyleEnumKind, Aliases>> = {
231
+ arrow: { "other:curve": ["curve"], "other:inv-curve": ["icurve"] },
232
+ };
233
+
234
+ /**
235
+ * yEd's (yFiles for Java's) STANDARD arrow is "a triangle with impressed bottom side", a notched arrow; its DELTA is the
236
+ * plain triangle (https://docs.yworks.com/yfiles/doc/api/y/view/Arrow.html).
237
+ */
238
+ const YED: Partial<Record<StyleEnumKind, Aliases>> = {
239
+ arrow: { vee: ["standard"] },
150
240
  };
151
241
 
152
242
  /** Per-dialect overrides; a dialect not listed reads the common table alone. */
153
- const OVERRIDES: ReadonlyMap<string, Partial<Record<StyleEnumKind, Aliases>>> = new Map([["vis", VIS]]);
243
+ const OVERRIDES: ReadonlyMap<string, Partial<Record<StyleEnumKind, Aliases>>> = new Map([
244
+ ["vis", VIS],
245
+ ["graphviz", GRAPHVIZ],
246
+ ["cytoscape-js", CYJS],
247
+ ["yed", YED],
248
+ ]);
154
249
 
155
250
  const OPEN: ReadonlySet<StyleEnumKind> = new Set<StyleEnumKind>(["shape", "borderStyle", "lineStyle", "arrow"]);
156
251
 
@@ -174,8 +269,12 @@ const COMMON: ReadonlyMap<StyleEnumKind, ReadonlyMap<string, string>> = new Map(
174
269
  ["borderStyle", lookup(BORDER_STYLES)],
175
270
  ["lineStyle", lookup(LINE_STYLES)],
176
271
  ["arrow", lookup(ARROWS)],
272
+ ["arrowSide", lookup(ARROW_SIDES)],
177
273
  ["weight", lookup(WEIGHTS)],
178
274
  ["position", lookup(POSITIONS)],
275
+ ["labelFit", lookup(LABEL_FITS)],
276
+ ["borderPosition", lookup(BORDER_POSITIONS)],
277
+ ["textAlign", lookup(TEXT_ALIGNS)],
179
278
  ]);
180
279
 
181
280
  const DIALECT: ReadonlyMap<string, ReadonlyMap<StyleEnumKind, ReadonlyMap<string, string>>> = new Map(
@@ -12,6 +12,13 @@
12
12
  * scheme knows no names at all.
13
13
  * - `transparent`, `none` and `invis` are `#fffffe` with alpha 0, whatever the scheme.
14
14
  * - An unknown color is drawn BLACK.
15
+ * - A bare name SVG knows (`gray`, `purple`, `green`, `maroon`, `crimson` ...), not in a `/scheme/` and with no
16
+ * leading blanks, is drawn as the SVG color, whatever the scheme: Graphviz's SVG output writes such a name as it is
17
+ * (`fill="gray"`, gvrender_resolve_color) and every SVG reader draws it as CSS does, so `gray` is #808080 there,
18
+ * not X11's #c0c0c0. The SVG drawing is the one we read Graphviz by.
19
+ * - An outline or font color list whose first entry is such a name is written whole (`stroke="red:blue"`: Graphviz
20
+ * resolves the first entry in place and puts the `:` back), which no SVG reader can draw: an outline is not drawn
21
+ * and a text is black, SVG's own default.
15
22
  * - A color list (`red:blue`, `red;0.3:blue`): an outline or a font color draws the text before the first `:` as one
16
23
  * color, so `red:blue` is red and `red;0.3:blue` is black (`red;0.3` is not a color). A fill draws a gradient and
17
24
  * an edge draws one line per color; both start with the first entry's color, its `;fraction` dropped. A value
@@ -24,7 +31,7 @@ import { BREWER_SCHEMES, CSS_COLORS, X11_COLORS } from "./color-tables.js";
24
31
  * How Graphviz draws a color value, which decides how a color list is read.
25
32
  * @category Styles
26
33
  */
27
- export type GraphvizColorUse = "line" | "fill" | "edge";
34
+ export type GraphvizColorUse = "line" | "text" | "fill" | "edge";
28
35
 
29
36
  /**
30
37
  * A resolved Graphviz color, with how it was read.
@@ -159,30 +166,84 @@ function schemeColor(name: string, scheme: string): string | undefined {
159
166
  return colors !== undefined && index >= 1 ? colors[index - 1] : undefined;
160
167
  }
161
168
 
169
+ /**
170
+ * A color list whose first color is a bare SVG name, as Graphviz's SVG output draws it for a pen: no outline, black
171
+ * text.
172
+ * @param use - `line` or `text`
173
+ * @returns the color
174
+ */
175
+ function svgPenList(use: GraphvizColorUse): GraphvizColor {
176
+ return use === "line"
177
+ ? { hex: "#fffffe", alpha: 0, unknown: false, list: null }
178
+ : { hex: "#000000", alpha: 1, unknown: false, list: null };
179
+ }
180
+
181
+ /**
182
+ * A color list entry without its `;fraction`.
183
+ * @param text - the entry
184
+ * @returns the color part
185
+ */
186
+ function beforeSemicolon(text: string): string {
187
+ const semi = text.indexOf(";");
188
+ return semi >= 0 ? text.slice(0, semi) : text;
189
+ }
190
+
191
+ /**
192
+ * One Graphviz color, read from its scheme (X11 when none), a bare SVG name first when `svgNames` says so.
193
+ * @param raw - the whole value
194
+ * @param text - the color, without the list after it
195
+ * @param scheme - the object's `colorscheme`, or null
196
+ * @param svgNames - whether a bare SVG name is drawn as SVG's color
197
+ * @returns the color, or null when it is unknown
198
+ */
199
+ function resolveColorText(
200
+ raw: string,
201
+ text: string,
202
+ scheme: string | null,
203
+ svgNames: boolean,
204
+ ): { hex: string; alpha: number } | null {
205
+ const svgName = svgNames && raw.startsWith(text) ? CSS_COLORS.get(text.toLowerCase()) : undefined;
206
+ if (svgName !== undefined) {
207
+ return { hex: svgName, alpha: 1 };
208
+ }
209
+ if (text === "") {
210
+ return null;
211
+ }
212
+ const sc = scheme === null || scheme.trim() === "" ? "x11" : scheme.toLowerCase();
213
+ return resolveOne(text, sc);
214
+ }
215
+
162
216
  /**
163
217
  * Resolves a Graphviz color value the way Graphviz draws it for a use; an unknown color is black.
164
218
  * @param raw - the value, at most 256 characters
165
219
  * @param scheme - the object's `colorscheme`, or null
166
- * @param use - an outline or font color (`line`), a fill, or an edge's line color
220
+ * @param use - an outline color (`line`), a font color (`text`), a fill, or an edge's line color
221
+ * @param svgNames - whether a bare SVG name is drawn as SVG's color, as Graphviz's SVG output draws it (false: as
222
+ * every other Graphviz output draws it)
167
223
  * @returns the color and how it was read
168
224
  * @category Styles
169
225
  */
170
- export function graphvizColor(raw: string, scheme: string | null, use: GraphvizColorUse): GraphvizColor {
226
+ export function graphvizColor(
227
+ raw: string,
228
+ scheme: string | null,
229
+ use: GraphvizColorUse,
230
+ svgNames = true,
231
+ ): GraphvizColor {
171
232
  let text = raw.replace(/^[ \t\r\n]+/, "");
172
233
  let list: GraphvizColor["list"] = null;
173
234
  const colon = text.indexOf(":");
235
+ const pen = use === "line" || use === "text";
174
236
  if (colon >= 0) {
175
237
  text = text.slice(0, colon);
176
- if (use !== "line") {
177
- const semi = text.indexOf(";");
178
- if (semi >= 0) {
179
- text = text.slice(0, semi);
180
- }
238
+ if (svgNames && pen && raw.startsWith(text) && CSS_COLORS.has(text.toLowerCase())) {
239
+ return svgPenList(use);
240
+ }
241
+ if (!pen) {
242
+ text = beforeSemicolon(text);
181
243
  list = use === "fill" ? "gradient" : "lines";
182
244
  }
183
245
  }
184
- const sc = scheme === null || scheme.trim() === "" ? "x11" : scheme.toLowerCase();
185
- const resolved = text === "" ? null : resolveOne(text, sc);
246
+ const resolved = resolveColorText(raw, text, scheme, svgNames);
186
247
  return resolved === null
187
248
  ? { hex: "#000000", alpha: 1, unknown: true, list }
188
249
  : { hex: resolved.hex, alpha: resolved.alpha, unknown: false, list };
@@ -82,6 +82,25 @@ export function canonNumber(raw: unknown, site: CanonSite, factor = 1): number |
82
82
  return num6(scaled);
83
83
  }
84
84
 
85
+ /**
86
+ * A signed number (an offset): any finite value within the largest a style number may be, either way.
87
+ * @param raw - the file's value
88
+ * @param site - where it was read
89
+ * @returns the canonical number, or null (noted)
90
+ * @category Styles
91
+ */
92
+ export function canonSigned(raw: unknown, site: CanonSite): number | null {
93
+ const value = finite(raw, site);
94
+ if (value === null) {
95
+ return null;
96
+ }
97
+ if (Math.abs(value) > MAX_STYLE_NUMBER) {
98
+ noteAt(site, STYLE_ISSUE.BAD_VALUE, typeof raw === "string" ? raw : String(raw));
99
+ return null;
100
+ }
101
+ return num6(value);
102
+ }
103
+
85
104
  /**
86
105
  * An opacity from 0 to 1. Cytoscape desktop states opacities from 0 to 255 and is divided by 255; every other
87
106
  * dialect states 0 to 1. A value outside the dialect's range is null with a `W_STYLE_BAD_VALUE` note.