@graphty/graph-io 0.3.42 → 0.3.44
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-3Q4TsdTh.js +40 -0
- package/dist/chunks/approximations-3Q4TsdTh.js.map +1 -0
- package/dist/chunks/block-JQiwViEt.js +2777 -0
- package/dist/chunks/block-JQiwViEt.js.map +1 -0
- package/dist/chunks/{choose-DvpbdRuz.js → choose-BemygfH8.js} +3 -2
- package/dist/chunks/{choose-DvpbdRuz.js.map → choose-BemygfH8.js.map} +1 -1
- package/dist/chunks/{constants-fT3E8JYY.js → constants-BFUR_CtU.js} +6 -2
- package/dist/chunks/constants-BFUR_CtU.js.map +1 -0
- package/dist/chunks/convert-BcQ8_jMo.js +59 -0
- package/dist/chunks/convert-BcQ8_jMo.js.map +1 -0
- package/dist/chunks/emit-DCwFLts5.js +3456 -0
- package/dist/chunks/emit-DCwFLts5.js.map +1 -0
- package/dist/chunks/{escape-B62ZGM_a.js → escape-B1rMftd9.js} +43 -20
- package/dist/chunks/escape-B1rMftd9.js.map +1 -0
- package/dist/chunks/{export-rKLeGQMo.js → export-D7IGzTG4.js} +196 -792
- package/dist/chunks/export-D7IGzTG4.js.map +1 -0
- package/dist/chunks/{exporter-BWwEuOPT.js → exporter-BtnqYuuj.js} +22 -12
- package/dist/chunks/exporter-BtnqYuuj.js.map +1 -0
- package/dist/chunks/{exporter-yLxKBvLE.js → exporter-ChPyhBOv.js} +4 -3
- package/dist/chunks/{exporter-yLxKBvLE.js.map → exporter-ChPyhBOv.js.map} +1 -1
- package/dist/chunks/{exporter-8hLNemFk.js → exporter-KEPxYUXD.js} +133 -74
- package/dist/chunks/exporter-KEPxYUXD.js.map +1 -0
- package/dist/chunks/{exporter-CpRyHZ3H.js → exporter-quPUCBiC.js} +1807 -288
- package/dist/chunks/exporter-quPUCBiC.js.map +1 -0
- package/dist/chunks/format-GDmO6m6Q.js +676 -0
- package/dist/chunks/format-GDmO6m6Q.js.map +1 -0
- package/dist/chunks/generic-BL06jrJf.js +1347 -0
- package/dist/chunks/generic-BL06jrJf.js.map +1 -0
- package/dist/chunks/{importer-WrGRZb0N.js → importer-B7r2owVf.js} +449 -102
- package/dist/chunks/importer-B7r2owVf.js.map +1 -0
- package/dist/chunks/{importer-Ht7LNg8L.js → importer-BFmOP96W.js} +116 -296
- package/dist/chunks/importer-BFmOP96W.js.map +1 -0
- package/dist/chunks/{importer-BbNb7eNg.js → importer-C2nzGhdV.js} +1390 -129
- package/dist/chunks/importer-C2nzGhdV.js.map +1 -0
- package/dist/chunks/{importer-Dz7tI8Sa.js → importer-CbX2_rNF.js} +617 -115
- package/dist/chunks/importer-CbX2_rNF.js.map +1 -0
- package/dist/chunks/{importer-D794XUTe.js → importer-CdzeN6X4.js} +31 -8
- package/dist/chunks/importer-CdzeN6X4.js.map +1 -0
- package/dist/chunks/{importer-xZ-3suY1.js → importer-ChKNC_GN.js} +791 -135
- package/dist/chunks/importer-ChKNC_GN.js.map +1 -0
- package/dist/chunks/{importer-C98dpSH4.js → importer-dwoYpSqb.js} +141 -82
- package/dist/chunks/importer-dwoYpSqb.js.map +1 -0
- package/dist/chunks/index-B9fdNpTA.js +4310 -0
- package/dist/chunks/index-B9fdNpTA.js.map +1 -0
- package/dist/chunks/{json-elements-DKSqpNW1.js → json-elements-C4FwgnH5.js} +123 -32
- package/dist/chunks/json-elements-C4FwgnH5.js.map +1 -0
- package/dist/chunks/lexicon-B-knUi-l.js +508 -0
- package/dist/chunks/lexicon-B-knUi-l.js.map +1 -0
- package/dist/chunks/{ontology-export-CtRXjg_i.js → ontology-export-BSpbY5FL.js} +3 -2
- package/dist/chunks/{ontology-export-CtRXjg_i.js.map → ontology-export-BSpbY5FL.js.map} +1 -1
- package/dist/chunks/{records-Cu4bxYOm.js → records-Nwz_rbNt.js} +2 -2
- package/dist/chunks/{records-Cu4bxYOm.js.map → records-Nwz_rbNt.js.map} +1 -1
- package/dist/chunks/styles-Brt9JMfs.js +690 -0
- package/dist/chunks/styles-Brt9JMfs.js.map +1 -0
- package/dist/chunks/styles-_N-C8S-U.js +2102 -0
- package/dist/chunks/styles-_N-C8S-U.js.map +1 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js +842 -0
- package/dist/chunks/styles-yed-DAfcIkf7.js.map +1 -0
- package/dist/chunks/{text-DHOJXnED.js → text-CgzMqHQb.js} +2 -2
- package/dist/chunks/{text-DHOJXnED.js.map → text-CgzMqHQb.js.map} +1 -1
- package/dist/chunks/units-XMZFIFe1.js +19 -0
- package/dist/chunks/units-XMZFIFe1.js.map +1 -0
- package/dist/csv.js +5 -4
- package/dist/csv.js.map +1 -1
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +5 -2
- package/dist/dot.js.map +1 -1
- package/dist/gexf.js +295 -414
- package/dist/gexf.js.map +1 -1
- package/dist/gml.js +8 -3031
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +354 -240
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +4 -2
- package/dist/graphml.js.map +1 -1
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -3
- package/dist/neo4j.js.map +1 -1
- package/dist/obo.js +1 -1
- package/dist/pajek.js +4 -2
- package/dist/positions.d.ts +1 -0
- package/dist/positions.js +427 -0
- package/dist/positions.js.map +1 -0
- package/dist/src/common/codes.d.ts +6 -0
- package/dist/src/common/codes.d.ts.map +1 -1
- package/dist/src/common/codes.js +6 -0
- package/dist/src/common/codes.js.map +1 -1
- package/dist/src/common/escape.d.ts.map +1 -1
- package/dist/src/common/escape.js +4 -2
- package/dist/src/common/escape.js.map +1 -1
- package/dist/src/common/export.d.ts +10 -0
- package/dist/src/common/export.d.ts.map +1 -1
- package/dist/src/common/export.js +123 -100
- package/dist/src/common/export.js.map +1 -1
- package/dist/src/common/input.d.ts.map +1 -1
- package/dist/src/common/input.js +8 -1
- package/dist/src/common/input.js.map +1 -1
- package/dist/src/common/json-elements.d.ts +12 -9
- package/dist/src/common/json-elements.d.ts.map +1 -1
- package/dist/src/common/json-elements.js +160 -37
- package/dist/src/common/json-elements.js.map +1 -1
- package/dist/src/common/notes.d.ts +42 -0
- package/dist/src/common/notes.d.ts.map +1 -0
- package/dist/src/common/notes.js +72 -0
- package/dist/src/common/notes.js.map +1 -0
- package/dist/src/common/report.d.ts +18 -0
- package/dist/src/common/report.d.ts.map +1 -1
- package/dist/src/common/report.js +36 -1
- package/dist/src/common/report.js.map +1 -1
- package/dist/src/common/units.d.ts +24 -0
- package/dist/src/common/units.d.ts.map +1 -0
- package/dist/src/common/units.js +26 -0
- package/dist/src/common/units.js.map +1 -0
- package/dist/src/common/xml.d.ts +18 -0
- package/dist/src/common/xml.d.ts.map +1 -1
- package/dist/src/common/xml.js +42 -5
- package/dist/src/common/xml.js.map +1 -1
- package/dist/src/formats/cx/exporter.d.ts +6 -0
- package/dist/src/formats/cx/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx/exporter.js +71 -8
- package/dist/src/formats/cx/exporter.js.map +1 -1
- package/dist/src/formats/cx/importer.d.ts +5 -2
- package/dist/src/formats/cx/importer.d.ts.map +1 -1
- package/dist/src/formats/cx/importer.js +102 -72
- package/dist/src/formats/cx/importer.js.map +1 -1
- package/dist/src/formats/cx/styles.d.ts +102 -0
- package/dist/src/formats/cx/styles.d.ts.map +1 -0
- package/dist/src/formats/cx/styles.js +225 -0
- package/dist/src/formats/cx/styles.js.map +1 -0
- package/dist/src/formats/cx2/exporter.d.ts +5 -0
- package/dist/src/formats/cx2/exporter.d.ts.map +1 -1
- package/dist/src/formats/cx2/exporter.js +181 -71
- package/dist/src/formats/cx2/exporter.js.map +1 -1
- package/dist/src/formats/cx2/importer.d.ts +4 -1
- package/dist/src/formats/cx2/importer.d.ts.map +1 -1
- package/dist/src/formats/cx2/importer.js +19 -1
- package/dist/src/formats/cx2/importer.js.map +1 -1
- package/dist/src/formats/cx2/styles.d.ts +18 -0
- package/dist/src/formats/cx2/styles.d.ts.map +1 -0
- package/dist/src/formats/cx2/styles.js +24 -0
- package/dist/src/formats/cx2/styles.js.map +1 -0
- package/dist/src/formats/cys/constants.d.ts +2 -0
- package/dist/src/formats/cys/constants.d.ts.map +1 -1
- package/dist/src/formats/cys/constants.js +2 -0
- package/dist/src/formats/cys/constants.js.map +1 -1
- package/dist/src/formats/cys/exporter.d.ts +6 -2
- package/dist/src/formats/cys/exporter.d.ts.map +1 -1
- package/dist/src/formats/cys/exporter.js +215 -53
- package/dist/src/formats/cys/exporter.js.map +1 -1
- package/dist/src/formats/cys/importer.d.ts +2 -1
- package/dist/src/formats/cys/importer.d.ts.map +1 -1
- package/dist/src/formats/cys/importer.js +119 -6
- package/dist/src/formats/cys/importer.js.map +1 -1
- package/dist/src/formats/cys/session.d.ts +2 -0
- package/dist/src/formats/cys/session.d.ts.map +1 -1
- package/dist/src/formats/cys/session.js +5 -0
- package/dist/src/formats/cys/session.js.map +1 -1
- package/dist/src/formats/cys/styles.d.ts +38 -0
- package/dist/src/formats/cys/styles.d.ts.map +1 -0
- package/dist/src/formats/cys/styles.js +213 -0
- package/dist/src/formats/cys/styles.js.map +1 -0
- package/dist/src/formats/cys/tables.d.ts +8 -3
- package/dist/src/formats/cys/tables.d.ts.map +1 -1
- package/dist/src/formats/cys/tables.js +88 -34
- package/dist/src/formats/cys/tables.js.map +1 -1
- package/dist/src/formats/dot/exporter.d.ts +2 -0
- package/dist/src/formats/dot/exporter.d.ts.map +1 -1
- package/dist/src/formats/dot/exporter.js +195 -81
- package/dist/src/formats/dot/exporter.js.map +1 -1
- package/dist/src/formats/dot/importer.d.ts.map +1 -1
- package/dist/src/formats/dot/importer.js +100 -20
- package/dist/src/formats/dot/importer.js.map +1 -1
- package/dist/src/formats/dot/index.d.ts +1 -0
- package/dist/src/formats/dot/index.d.ts.map +1 -1
- package/dist/src/formats/dot/index.js +1 -0
- package/dist/src/formats/dot/index.js.map +1 -1
- package/dist/src/formats/dot/positions.d.ts +14 -0
- package/dist/src/formats/dot/positions.d.ts.map +1 -0
- package/dist/src/formats/dot/positions.js +70 -0
- package/dist/src/formats/dot/positions.js.map +1 -0
- package/dist/src/formats/dot/styles.d.ts +82 -0
- package/dist/src/formats/dot/styles.d.ts.map +1 -0
- package/dist/src/formats/dot/styles.js +1484 -0
- package/dist/src/formats/dot/styles.js.map +1 -0
- package/dist/src/formats/gexf/exporter.d.ts.map +1 -1
- package/dist/src/formats/gexf/exporter.js +23 -7
- package/dist/src/formats/gexf/exporter.js.map +1 -1
- package/dist/src/formats/gexf/importer.d.ts +8 -1
- package/dist/src/formats/gexf/importer.d.ts.map +1 -1
- package/dist/src/formats/gexf/importer.js +251 -131
- package/dist/src/formats/gexf/importer.js.map +1 -1
- package/dist/src/formats/gexf/index.d.ts +8 -0
- package/dist/src/formats/gexf/index.d.ts.map +1 -1
- package/dist/src/formats/gexf/index.js +10 -2
- package/dist/src/formats/gexf/index.js.map +1 -1
- package/dist/src/formats/gexf/schema.d.ts +5 -0
- package/dist/src/formats/gexf/schema.d.ts.map +1 -1
- package/dist/src/formats/gexf/schema.js +5 -0
- package/dist/src/formats/gexf/schema.js.map +1 -1
- package/dist/src/formats/gexf/styles.d.ts +74 -0
- package/dist/src/formats/gexf/styles.d.ts.map +1 -0
- package/dist/src/formats/gexf/styles.js +604 -0
- package/dist/src/formats/gexf/styles.js.map +1 -0
- package/dist/src/formats/gml/exporter.d.ts +1 -5
- package/dist/src/formats/gml/exporter.d.ts.map +1 -1
- package/dist/src/formats/gml/exporter.js +19 -8
- package/dist/src/formats/gml/exporter.js.map +1 -1
- package/dist/src/formats/gml/importer.d.ts.map +1 -1
- package/dist/src/formats/gml/importer.js +4 -0
- package/dist/src/formats/gml/importer.js.map +1 -1
- package/dist/src/formats/gml/index.d.ts +2 -1
- package/dist/src/formats/gml/index.d.ts.map +1 -1
- package/dist/src/formats/gml/index.js +2 -1
- package/dist/src/formats/gml/index.js.map +1 -1
- package/dist/src/formats/gml/positions.d.ts +14 -0
- package/dist/src/formats/gml/positions.d.ts.map +1 -0
- package/dist/src/formats/gml/positions.js +46 -0
- package/dist/src/formats/gml/positions.js.map +1 -0
- package/dist/src/formats/gml/styles.d.ts +59 -0
- package/dist/src/formats/gml/styles.d.ts.map +1 -0
- package/dist/src/formats/gml/styles.js +1056 -0
- package/dist/src/formats/gml/styles.js.map +1 -0
- package/dist/src/formats/gml/syntax.d.ts +11 -0
- package/dist/src/formats/gml/syntax.d.ts.map +1 -1
- package/dist/src/formats/gml/syntax.js +151 -62
- package/dist/src/formats/gml/syntax.js.map +1 -1
- package/dist/src/formats/graphml/constants.d.ts +4 -0
- package/dist/src/formats/graphml/constants.d.ts.map +1 -1
- package/dist/src/formats/graphml/constants.js +5 -1
- package/dist/src/formats/graphml/constants.js.map +1 -1
- package/dist/src/formats/graphml/exporter.d.ts.map +1 -1
- package/dist/src/formats/graphml/exporter.js +133 -65
- package/dist/src/formats/graphml/exporter.js.map +1 -1
- package/dist/src/formats/graphml/importer.d.ts +4 -1
- package/dist/src/formats/graphml/importer.d.ts.map +1 -1
- package/dist/src/formats/graphml/importer.js +100 -44
- package/dist/src/formats/graphml/importer.js.map +1 -1
- package/dist/src/formats/graphml/index.d.ts +1 -0
- package/dist/src/formats/graphml/index.d.ts.map +1 -1
- package/dist/src/formats/graphml/index.js +1 -0
- package/dist/src/formats/graphml/index.js.map +1 -1
- package/dist/src/formats/graphml/styles-plain.d.ts +19 -0
- package/dist/src/formats/graphml/styles-plain.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-plain.js +187 -0
- package/dist/src/formats/graphml/styles-plain.js.map +1 -0
- package/dist/src/formats/graphml/styles-yed.d.ts +179 -0
- package/dist/src/formats/graphml/styles-yed.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yed.js +1086 -0
- package/dist/src/formats/graphml/styles-yed.js.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts +19 -0
- package/dist/src/formats/graphml/styles-yfiles3.d.ts.map +1 -0
- package/dist/src/formats/graphml/styles-yfiles3.js +508 -0
- package/dist/src/formats/graphml/styles-yfiles3.js.map +1 -0
- package/dist/src/formats/graphml/tree.d.ts.map +1 -1
- package/dist/src/formats/graphml/tree.js +34 -19
- package/dist/src/formats/graphml/tree.js.map +1 -1
- package/dist/src/formats/graphml/yfiles.d.ts +16 -2
- package/dist/src/formats/graphml/yfiles.d.ts.map +1 -1
- package/dist/src/formats/graphml/yfiles.js +83 -12
- package/dist/src/formats/graphml/yfiles.js.map +1 -1
- package/dist/src/formats/json/exporter.d.ts +5 -0
- package/dist/src/formats/json/exporter.d.ts.map +1 -1
- package/dist/src/formats/json/exporter.js +68 -25
- package/dist/src/formats/json/exporter.js.map +1 -1
- package/dist/src/formats/json/importer.d.ts +22 -3
- package/dist/src/formats/json/importer.d.ts.map +1 -1
- package/dist/src/formats/json/importer.js +441 -265
- package/dist/src/formats/json/importer.js.map +1 -1
- package/dist/src/formats/json/positions.d.ts +16 -0
- package/dist/src/formats/json/positions.d.ts.map +1 -0
- package/dist/src/formats/json/positions.js +44 -0
- package/dist/src/formats/json/positions.js.map +1 -0
- package/dist/src/formats/json/styles.d.ts +102 -0
- package/dist/src/formats/json/styles.d.ts.map +1 -0
- package/dist/src/formats/json/styles.js +1753 -0
- package/dist/src/formats/json/styles.js.map +1 -0
- package/dist/src/formats/neo4j/exporter.d.ts.map +1 -1
- package/dist/src/formats/neo4j/exporter.js +2 -1
- package/dist/src/formats/neo4j/exporter.js.map +1 -1
- package/dist/src/formats/pajek/exporter.d.ts +2 -0
- package/dist/src/formats/pajek/exporter.d.ts.map +1 -1
- package/dist/src/formats/pajek/exporter.js +142 -76
- package/dist/src/formats/pajek/exporter.js.map +1 -1
- package/dist/src/formats/pajek/importer.d.ts +4 -0
- package/dist/src/formats/pajek/importer.d.ts.map +1 -1
- package/dist/src/formats/pajek/importer.js +60 -6
- package/dist/src/formats/pajek/importer.js.map +1 -1
- package/dist/src/formats/pajek/index.d.ts +2 -0
- package/dist/src/formats/pajek/index.d.ts.map +1 -1
- package/dist/src/formats/pajek/index.js +2 -0
- package/dist/src/formats/pajek/index.js.map +1 -1
- package/dist/src/formats/pajek/styles.d.ts +50 -0
- package/dist/src/formats/pajek/styles.d.ts.map +1 -0
- package/dist/src/formats/pajek/styles.js +569 -0
- package/dist/src/formats/pajek/styles.js.map +1 -0
- package/dist/src/formats/pajek/syntax.d.ts +6 -0
- package/dist/src/formats/pajek/syntax.d.ts.map +1 -1
- package/dist/src/formats/pajek/syntax.js +6 -0
- package/dist/src/formats/pajek/syntax.js.map +1 -1
- package/dist/src/formats/xgmml/columns.d.ts.map +1 -1
- package/dist/src/formats/xgmml/columns.js +34 -9
- package/dist/src/formats/xgmml/columns.js.map +1 -1
- package/dist/src/formats/xgmml/constants.d.ts +2 -0
- package/dist/src/formats/xgmml/constants.d.ts.map +1 -1
- package/dist/src/formats/xgmml/constants.js +3 -1
- package/dist/src/formats/xgmml/constants.js.map +1 -1
- package/dist/src/formats/xgmml/document.d.ts +12 -8
- package/dist/src/formats/xgmml/document.d.ts.map +1 -1
- package/dist/src/formats/xgmml/document.js +56 -13
- package/dist/src/formats/xgmml/document.js.map +1 -1
- package/dist/src/formats/xgmml/emit.d.ts.map +1 -1
- package/dist/src/formats/xgmml/emit.js +12 -6
- package/dist/src/formats/xgmml/emit.js.map +1 -1
- package/dist/src/formats/xgmml/exporter.d.ts +3 -1
- package/dist/src/formats/xgmml/exporter.d.ts.map +1 -1
- package/dist/src/formats/xgmml/exporter.js +22 -9
- package/dist/src/formats/xgmml/exporter.js.map +1 -1
- package/dist/src/formats/xgmml/importer.d.ts +2 -1
- package/dist/src/formats/xgmml/importer.d.ts.map +1 -1
- package/dist/src/formats/xgmml/importer.js +31 -24
- package/dist/src/formats/xgmml/importer.js.map +1 -1
- package/dist/src/formats/xgmml/styles.d.ts +104 -0
- package/dist/src/formats/xgmml/styles.d.ts.map +1 -0
- package/dist/src/formats/xgmml/styles.js +310 -0
- package/dist/src/formats/xgmml/styles.js.map +1 -0
- package/dist/src/index.d.ts +9 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -7
- package/dist/src/index.js.map +1 -1
- package/dist/src/positions/codes.d.ts +31 -0
- package/dist/src/positions/codes.d.ts.map +1 -0
- package/dist/src/positions/codes.js +26 -0
- package/dist/src/positions/codes.js.map +1 -0
- package/dist/src/positions/convert.d.ts +58 -0
- package/dist/src/positions/convert.d.ts.map +1 -0
- package/dist/src/positions/convert.js +107 -0
- package/dist/src/positions/convert.js.map +1 -0
- package/dist/src/positions/extract.d.ts +27 -0
- package/dist/src/positions/extract.d.ts.map +1 -0
- package/dist/src/positions/extract.js +526 -0
- package/dist/src/positions/extract.js.map +1 -0
- package/dist/src/positions/index.d.ts +10 -0
- package/dist/src/positions/index.d.ts.map +1 -0
- package/dist/src/positions/index.js +9 -0
- package/dist/src/positions/index.js.map +1 -0
- package/dist/src/positions/types.d.ts +208 -0
- package/dist/src/positions/types.d.ts.map +1 -0
- package/dist/src/positions/types.js +10 -0
- package/dist/src/positions/types.js.map +1 -0
- package/dist/src/registry.d.ts +30 -0
- package/dist/src/registry.d.ts.map +1 -1
- package/dist/src/registry.js +130 -9
- package/dist/src/registry.js.map +1 -1
- package/dist/src/styles/annotations.d.ts +132 -0
- package/dist/src/styles/annotations.d.ts.map +1 -0
- package/dist/src/styles/annotations.js +320 -0
- package/dist/src/styles/annotations.js.map +1 -0
- package/dist/src/styles/budget.d.ts +45 -0
- package/dist/src/styles/budget.d.ts.map +1 -0
- package/dist/src/styles/budget.js +58 -0
- package/dist/src/styles/budget.js.map +1 -0
- package/dist/src/styles/canon/bends.d.ts +32 -0
- package/dist/src/styles/canon/bends.d.ts.map +1 -0
- package/dist/src/styles/canon/bends.js +74 -0
- package/dist/src/styles/canon/bends.js.map +1 -0
- package/dist/src/styles/canon/color-tables.d.ts +22 -0
- package/dist/src/styles/canon/color-tables.d.ts.map +1 -0
- package/dist/src/styles/canon/color-tables.js +369 -0
- package/dist/src/styles/canon/color-tables.js.map +1 -0
- package/dist/src/styles/canon/color.d.ts +66 -0
- package/dist/src/styles/canon/color.d.ts.map +1 -0
- package/dist/src/styles/canon/color.js +548 -0
- package/dist/src/styles/canon/color.js.map +1 -0
- package/dist/src/styles/canon/enums.d.ts +25 -0
- package/dist/src/styles/canon/enums.d.ts.map +1 -0
- package/dist/src/styles/canon/enums.js +187 -0
- package/dist/src/styles/canon/enums.js.map +1 -0
- package/dist/src/styles/canon/graphviz.d.ts +48 -0
- package/dist/src/styles/canon/graphviz.d.ts.map +1 -0
- package/dist/src/styles/canon/graphviz.js +160 -0
- package/dist/src/styles/canon/graphviz.js.map +1 -0
- package/dist/src/styles/canon/index.d.ts +13 -0
- package/dist/src/styles/canon/index.d.ts.map +1 -0
- package/dist/src/styles/canon/index.js +13 -0
- package/dist/src/styles/canon/index.js.map +1 -0
- package/dist/src/styles/canon/number.d.ts +59 -0
- package/dist/src/styles/canon/number.d.ts.map +1 -0
- package/dist/src/styles/canon/number.js +142 -0
- package/dist/src/styles/canon/number.js.map +1 -0
- package/dist/src/styles/canon/site.d.ts +51 -0
- package/dist/src/styles/canon/site.d.ts.map +1 -0
- package/dist/src/styles/canon/site.js +63 -0
- package/dist/src/styles/canon/site.js.map +1 -0
- package/dist/src/styles/canon/text.d.ts +61 -0
- package/dist/src/styles/canon/text.d.ts.map +1 -0
- package/dist/src/styles/canon/text.js +199 -0
- package/dist/src/styles/canon/text.js.map +1 -0
- package/dist/src/styles/codes.d.ts +95 -0
- package/dist/src/styles/codes.d.ts.map +1 -0
- package/dist/src/styles/codes.js +97 -0
- package/dist/src/styles/codes.js.map +1 -0
- package/dist/src/styles/cyjs/cascade.d.ts +134 -0
- package/dist/src/styles/cyjs/cascade.d.ts.map +1 -0
- package/dist/src/styles/cyjs/cascade.js +2252 -0
- package/dist/src/styles/cyjs/cascade.js.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts +25 -0
- package/dist/src/styles/cyjs/defaults-table.d.ts.map +1 -0
- package/dist/src/styles/cyjs/defaults-table.js +76 -0
- package/dist/src/styles/cyjs/defaults-table.js.map +1 -0
- package/dist/src/styles/cyjs/emit.d.ts +82 -0
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -0
- package/dist/src/styles/cyjs/emit.js +790 -0
- package/dist/src/styles/cyjs/emit.js.map +1 -0
- package/dist/src/styles/cyjs/index.d.ts +13 -0
- package/dist/src/styles/cyjs/index.d.ts.map +1 -0
- package/dist/src/styles/cyjs/index.js +13 -0
- package/dist/src/styles/cyjs/index.js.map +1 -0
- package/dist/src/styles/cyjs/live.d.ts +46 -0
- package/dist/src/styles/cyjs/live.d.ts.map +1 -0
- package/dist/src/styles/cyjs/live.js +108 -0
- package/dist/src/styles/cyjs/live.js.map +1 -0
- package/dist/src/styles/cyjs/mappers.d.ts +147 -0
- package/dist/src/styles/cyjs/mappers.d.ts.map +1 -0
- package/dist/src/styles/cyjs/mappers.js +744 -0
- package/dist/src/styles/cyjs/mappers.js.map +1 -0
- package/dist/src/styles/cyjs/selector.d.ts +113 -0
- package/dist/src/styles/cyjs/selector.d.ts.map +1 -0
- package/dist/src/styles/cyjs/selector.js +611 -0
- package/dist/src/styles/cyjs/selector.js.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts +37 -0
- package/dist/src/styles/cyjs/stylesheet-text.d.ts.map +1 -0
- package/dist/src/styles/cyjs/stylesheet-text.js +181 -0
- package/dist/src/styles/cyjs/stylesheet-text.js.map +1 -0
- package/dist/src/styles/cytoscape/emit.d.ts +125 -0
- package/dist/src/styles/cytoscape/emit.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/emit.js +1025 -0
- package/dist/src/styles/cytoscape/emit.js.map +1 -0
- package/dist/src/styles/cytoscape/index.d.ts +10 -0
- package/dist/src/styles/cytoscape/index.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/index.js +10 -0
- package/dist/src/styles/cytoscape/index.js.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts +49 -0
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/lexicon.js +603 -0
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -0
- package/dist/src/styles/cytoscape/mappings.d.ts +171 -0
- package/dist/src/styles/cytoscape/mappings.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/mappings.js +460 -0
- package/dist/src/styles/cytoscape/mappings.js.map +1 -0
- package/dist/src/styles/cytoscape/resolve.d.ts +137 -0
- package/dist/src/styles/cytoscape/resolve.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/resolve.js +381 -0
- package/dist/src/styles/cytoscape/resolve.js.map +1 -0
- package/dist/src/styles/cytoscape/translate.d.ts +50 -0
- package/dist/src/styles/cytoscape/translate.d.ts.map +1 -0
- package/dist/src/styles/cytoscape/translate.js +156 -0
- package/dist/src/styles/cytoscape/translate.js.map +1 -0
- package/dist/src/styles/defaults.d.ts +90 -0
- package/dist/src/styles/defaults.d.ts.map +1 -0
- package/dist/src/styles/defaults.js +414 -0
- package/dist/src/styles/defaults.js.map +1 -0
- package/dist/src/styles/index.d.ts +15 -0
- package/dist/src/styles/index.d.ts.map +1 -0
- package/dist/src/styles/index.js +14 -0
- package/dist/src/styles/index.js.map +1 -0
- package/dist/src/styles/internal.d.ts +17 -0
- package/dist/src/styles/internal.d.ts.map +1 -0
- package/dist/src/styles/internal.js +16 -0
- package/dist/src/styles/internal.js.map +1 -0
- package/dist/src/styles/io/approximations.d.ts +24 -0
- package/dist/src/styles/io/approximations.d.ts.map +1 -0
- package/dist/src/styles/io/approximations.js +51 -0
- package/dist/src/styles/io/approximations.js.map +1 -0
- package/dist/src/styles/io/block.d.ts +166 -0
- package/dist/src/styles/io/block.d.ts.map +1 -0
- package/dist/src/styles/io/block.js +930 -0
- package/dist/src/styles/io/block.js.map +1 -0
- package/dist/src/styles/io/generic.d.ts +88 -0
- package/dist/src/styles/io/generic.d.ts.map +1 -0
- package/dist/src/styles/io/generic.js +516 -0
- package/dist/src/styles/io/generic.js.map +1 -0
- package/dist/src/styles/io/index.d.ts +8 -0
- package/dist/src/styles/io/index.d.ts.map +1 -0
- package/dist/src/styles/io/index.js +7 -0
- package/dist/src/styles/io/index.js.map +1 -0
- package/dist/src/styles/io/writer.d.ts +80 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -0
- package/dist/src/styles/io/writer.js +596 -0
- package/dist/src/styles/io/writer.js.map +1 -0
- package/dist/src/styles/notes.d.ts +47 -0
- package/dist/src/styles/notes.d.ts.map +1 -0
- package/dist/src/styles/notes.js +140 -0
- package/dist/src/styles/notes.js.map +1 -0
- package/dist/src/styles/plan/classes.d.ts +31 -0
- package/dist/src/styles/plan/classes.d.ts.map +1 -0
- package/dist/src/styles/plan/classes.js +139 -0
- package/dist/src/styles/plan/classes.js.map +1 -0
- package/dist/src/styles/plan/continuous.d.ts +32 -0
- package/dist/src/styles/plan/continuous.d.ts.map +1 -0
- package/dist/src/styles/plan/continuous.js +165 -0
- package/dist/src/styles/plan/continuous.js.map +1 -0
- package/dist/src/styles/plan/discrete.d.ts +39 -0
- package/dist/src/styles/plan/discrete.d.ts.map +1 -0
- package/dist/src/styles/plan/discrete.js +127 -0
- package/dist/src/styles/plan/discrete.js.map +1 -0
- package/dist/src/styles/plan/families.d.ts +31 -0
- package/dist/src/styles/plan/families.d.ts.map +1 -0
- package/dist/src/styles/plan/families.js +95 -0
- package/dist/src/styles/plan/families.js.map +1 -0
- package/dist/src/styles/plan/features.d.ts +58 -0
- package/dist/src/styles/plan/features.d.ts.map +1 -0
- package/dist/src/styles/plan/features.js +185 -0
- package/dist/src/styles/plan/features.js.map +1 -0
- package/dist/src/styles/plan/index.d.ts +7 -0
- package/dist/src/styles/plan/index.d.ts.map +1 -0
- package/dist/src/styles/plan/index.js +7 -0
- package/dist/src/styles/plan/index.js.map +1 -0
- package/dist/src/styles/plan/plan.d.ts +71 -0
- package/dist/src/styles/plan/plan.d.ts.map +1 -0
- package/dist/src/styles/plan/plan.js +893 -0
- package/dist/src/styles/plan/plan.js.map +1 -0
- package/dist/src/styles/plan/resolve.d.ts +137 -0
- package/dist/src/styles/plan/resolve.d.ts.map +1 -0
- package/dist/src/styles/plan/resolve.js +587 -0
- package/dist/src/styles/plan/resolve.js.map +1 -0
- package/dist/src/styles/types.d.ts +702 -0
- package/dist/src/styles/types.d.ts.map +1 -0
- package/dist/src/styles/types.js +10 -0
- package/dist/src/styles/types.js.map +1 -0
- package/dist/src/styles/vocabulary.d.ts +41 -0
- package/dist/src/styles/vocabulary.d.ts.map +1 -0
- package/dist/src/styles/vocabulary.js +140 -0
- package/dist/src/styles/vocabulary.js.map +1 -0
- package/dist/src/types.d.ts +64 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +322 -0
- package/dist/styles.js.map +1 -0
- package/dist/xgmml.js +5 -4
- package/dist/xgmml.js.map +1 -1
- package/package.json +13 -2
- package/src/common/codes.ts +7 -0
- package/src/common/escape.ts +5 -2
- package/src/common/export.ts +179 -140
- package/src/common/input.ts +8 -4
- package/src/common/json-elements.ts +169 -38
- package/src/common/notes.ts +94 -0
- package/src/common/report.ts +41 -1
- package/src/common/units.ts +42 -0
- package/src/common/xml.ts +45 -5
- package/src/formats/cx/exporter.ts +95 -11
- package/src/formats/cx/importer.ts +126 -90
- package/src/formats/cx/styles.ts +304 -0
- package/src/formats/cx2/exporter.ts +234 -77
- package/src/formats/cx2/importer.ts +19 -1
- package/src/formats/cx2/styles.ts +29 -0
- package/src/formats/cys/constants.ts +3 -0
- package/src/formats/cys/exporter.ts +246 -60
- package/src/formats/cys/importer.ts +125 -9
- package/src/formats/cys/session.ts +6 -0
- package/src/formats/cys/styles.ts +254 -0
- package/src/formats/cys/tables.ts +117 -48
- package/src/formats/dot/exporter.ts +262 -126
- package/src/formats/dot/importer.ts +111 -20
- package/src/formats/dot/index.ts +1 -0
- package/src/formats/dot/positions.ts +77 -0
- package/src/formats/dot/styles.ts +1741 -0
- package/src/formats/gexf/exporter.ts +30 -13
- package/src/formats/gexf/importer.ts +308 -158
- package/src/formats/gexf/index.ts +10 -0
- package/src/formats/gexf/schema.ts +5 -0
- package/src/formats/gexf/styles.ts +719 -0
- package/src/formats/gml/exporter.ts +33 -14
- package/src/formats/gml/importer.ts +4 -0
- package/src/formats/gml/index.ts +2 -1
- package/src/formats/gml/positions.ts +52 -0
- package/src/formats/gml/styles.ts +1248 -0
- package/src/formats/gml/syntax.ts +173 -62
- package/src/formats/graphml/constants.ts +5 -0
- package/src/formats/graphml/exporter.ts +163 -71
- package/src/formats/graphml/importer.ts +119 -45
- package/src/formats/graphml/index.ts +1 -0
- package/src/formats/graphml/styles-plain.ts +236 -0
- package/src/formats/graphml/styles-yed.ts +1221 -0
- package/src/formats/graphml/styles-yfiles3.ts +573 -0
- package/src/formats/graphml/tree.ts +36 -20
- package/src/formats/graphml/yfiles.ts +89 -13
- package/src/formats/json/exporter.ts +76 -26
- package/src/formats/json/importer.ts +543 -323
- package/src/formats/json/positions.ts +50 -0
- package/src/formats/json/styles.ts +2082 -0
- package/src/formats/neo4j/exporter.ts +2 -1
- package/src/formats/pajek/exporter.ts +195 -106
- package/src/formats/pajek/importer.ts +78 -9
- package/src/formats/pajek/index.ts +2 -0
- package/src/formats/pajek/styles.ts +685 -0
- package/src/formats/pajek/syntax.ts +7 -0
- package/src/formats/xgmml/columns.ts +39 -9
- package/src/formats/xgmml/constants.ts +3 -0
- package/src/formats/xgmml/document.ts +54 -12
- package/src/formats/xgmml/emit.ts +11 -6
- package/src/formats/xgmml/exporter.ts +32 -13
- package/src/formats/xgmml/importer.ts +43 -29
- package/src/formats/xgmml/styles.ts +400 -0
- package/src/index.ts +16 -0
- package/src/positions/codes.ts +32 -0
- package/src/positions/convert.ts +123 -0
- package/src/positions/extract.ts +619 -0
- package/src/positions/index.ts +23 -0
- package/src/positions/types.ts +221 -0
- package/src/registry.ts +179 -8
- package/src/styles/annotations.ts +478 -0
- package/src/styles/budget.ts +60 -0
- package/src/styles/canon/bends.ts +84 -0
- package/src/styles/canon/color-tables.ts +386 -0
- package/src/styles/canon/color.ts +624 -0
- package/src/styles/canon/enums.ts +211 -0
- package/src/styles/canon/graphviz.ts +189 -0
- package/src/styles/canon/index.ts +13 -0
- package/src/styles/canon/number.ts +152 -0
- package/src/styles/canon/site.ts +87 -0
- package/src/styles/canon/text.ts +221 -0
- package/src/styles/codes.ts +104 -0
- package/src/styles/cyjs/cascade.ts +2670 -0
- package/src/styles/cyjs/defaults-table.ts +82 -0
- package/src/styles/cyjs/emit.ts +951 -0
- package/src/styles/cyjs/index.ts +37 -0
- package/src/styles/cyjs/live.ts +147 -0
- package/src/styles/cyjs/mappers.ts +879 -0
- package/src/styles/cyjs/selector.ts +778 -0
- package/src/styles/cyjs/stylesheet-text.ts +214 -0
- package/src/styles/cytoscape/emit.ts +1264 -0
- package/src/styles/cytoscape/index.ts +40 -0
- package/src/styles/cytoscape/lexicon.ts +656 -0
- package/src/styles/cytoscape/mappings.ts +603 -0
- package/src/styles/cytoscape/resolve.ts +521 -0
- package/src/styles/cytoscape/translate.ts +237 -0
- package/src/styles/defaults.ts +504 -0
- package/src/styles/index.ts +57 -0
- package/src/styles/internal.ts +17 -0
- package/src/styles/io/approximations.ts +47 -0
- package/src/styles/io/block.ts +1138 -0
- package/src/styles/io/generic.ts +687 -0
- package/src/styles/io/index.ts +18 -0
- package/src/styles/io/writer.ts +745 -0
- package/src/styles/notes.ts +165 -0
- package/src/styles/plan/classes.ts +166 -0
- package/src/styles/plan/continuous.ts +218 -0
- package/src/styles/plan/discrete.ts +165 -0
- package/src/styles/plan/families.ts +115 -0
- package/src/styles/plan/features.ts +234 -0
- package/src/styles/plan/index.ts +7 -0
- package/src/styles/plan/plan.ts +1129 -0
- package/src/styles/plan/resolve.ts +685 -0
- package/src/styles/types.ts +814 -0
- package/src/styles/vocabulary.ts +172 -0
- package/src/types.ts +76 -1
- package/dist/chunks/constants-fT3E8JYY.js.map +0 -1
- package/dist/chunks/escape-B62ZGM_a.js.map +0 -1
- package/dist/chunks/export-rKLeGQMo.js.map +0 -1
- package/dist/chunks/exporter-8hLNemFk.js.map +0 -1
- package/dist/chunks/exporter-BWwEuOPT.js.map +0 -1
- package/dist/chunks/exporter-CpRyHZ3H.js.map +0 -1
- package/dist/chunks/importer-BbNb7eNg.js.map +0 -1
- package/dist/chunks/importer-C98dpSH4.js.map +0 -1
- package/dist/chunks/importer-D794XUTe.js.map +0 -1
- package/dist/chunks/importer-Dz7tI8Sa.js.map +0 -1
- package/dist/chunks/importer-Ht7LNg8L.js.map +0 -1
- package/dist/chunks/importer-WrGRZb0N.js.map +0 -1
- package/dist/chunks/importer-xZ-3suY1.js.map +0 -1
- package/dist/chunks/json-elements-DKSqpNW1.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.d.ts","sourceRoot":"","sources":["../../../src/styles/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA0DxE;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,gGAAgG;IAChG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;;;;;OAMG;IACH,GAAG,CACC,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,WAAW,GAAG,OAAO,GAAG,IAAI,EACpC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,MAAM,GAAE,eAAoB,GAC7B,IAAI;IAqBP;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAInG;;;OAGG;IACH,IAAI,IAAI,SAAS,EAAE;CAatB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style notes are aggregated, never one per element: one note per (code, target, property), with up to 8 distinct
|
|
3
|
+
* samples, a total count and the element indexes the note covers.
|
|
4
|
+
*/
|
|
5
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
6
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
7
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
8
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
9
|
+
};
|
|
10
|
+
var _StyleNotes_notes;
|
|
11
|
+
/** At most this many samples per note. */
|
|
12
|
+
const MAX_SAMPLES = 8;
|
|
13
|
+
/** A sample is cut to this many characters. */
|
|
14
|
+
const MAX_SAMPLE_LENGTH = 80;
|
|
15
|
+
/** graph-io's English for each note, used only in its own report. */
|
|
16
|
+
const PHRASES = new Map([
|
|
17
|
+
["W_STYLE_VALUE_TOO_LONG", "values longer than 256 characters were not parsed"],
|
|
18
|
+
["W_STYLE_BAD_VALUE", "values do not parse"],
|
|
19
|
+
["W_STYLE_UNKNOWN_VALUE", "values have no name in the vocabulary and are kept as other:<value>"],
|
|
20
|
+
["W_STYLE_ALPHA_DROPPED", "color alpha was dropped"],
|
|
21
|
+
["W_STYLE_COLOR_LIST", "color lists are not read as one color"],
|
|
22
|
+
["W_STYLE_GRADIENT", "gradients are read as their first color"],
|
|
23
|
+
["W_STYLE_UNFILLED", "nodes with a fill color are drawn unfilled"],
|
|
24
|
+
["W_STYLE_NO_FILL", "fills are marked transparent"],
|
|
25
|
+
["W_STYLE_NO_STROKE", "strokes are marked absent"],
|
|
26
|
+
["W_STYLE_SIZE_MINIMUM", "node sizes are minimums: the node grows to fit its label"],
|
|
27
|
+
["W_STYLE_HTML_LABEL", "HTML-like labels keep their text; markup was dropped"],
|
|
28
|
+
["W_STYLE_RECORD_LABEL", "record label fields were joined"],
|
|
29
|
+
["W_STYLE_EXTRA_LABELS", "elements have more than one label; the first was kept"],
|
|
30
|
+
["W_STYLE_INHERIT_COLOR", "inherited colors cannot be expressed"],
|
|
31
|
+
["W_STYLE_NOT_CARRIED", "style properties have no counterpart and were not carried"],
|
|
32
|
+
["W_STYLE_BAD_MAPPING", "mappings cannot be read"],
|
|
33
|
+
["W_STYLE_MAPPING_COLUMN_MISSING", "mappings read a column the file does not have"],
|
|
34
|
+
["W_STYLE_REFERENCE_CYCLE", "style references are circular or too deep"],
|
|
35
|
+
["W_STYLE_UNRESOLVED", "style references name nothing"],
|
|
36
|
+
["W_STYLE_NESTING", "style structures are nested too deep"],
|
|
37
|
+
["W_STYLE_UNREADABLE", "a style section cannot be read"],
|
|
38
|
+
["W_STYLE_NO_VIZMAP", "the session holds no visual styles"],
|
|
39
|
+
["W_STYLE_VIEW_STYLE_MISSING", "the view names a style the file does not hold"],
|
|
40
|
+
["W_STYLE_OTHER_STYLES", "other visual styles were not read"],
|
|
41
|
+
["W_STYLE_OTHER_VIEWS", "other views were not read"],
|
|
42
|
+
["W_STYLE_SELECTOR", "invalid selectors match every element"],
|
|
43
|
+
["W_STYLE_SELECTOR_AS_COLUMN", "selectors were evaluated into per-element values"],
|
|
44
|
+
["W_STYLE_STATE_ASSUMED", "selector states were evaluated as at load"],
|
|
45
|
+
["W_STYLE_RAMP_ROUNDED", "continuous mappings match within the tool's rounding"],
|
|
46
|
+
["W_STYLE_LAYER_CAP", "rules were folded into per-element copies"],
|
|
47
|
+
["W_STYLE_BUDGET", "the work budget ran out; values were copied per element"],
|
|
48
|
+
["W_STYLE_BLOCK_IGNORED", "the graphty.styles block was ignored"],
|
|
49
|
+
["W_STYLE_NOT_WRITTEN", "the format cannot hold this style"],
|
|
50
|
+
["W_STYLE_APPROXIMATED", "written as the nearest value the format allows"],
|
|
51
|
+
["W_STYLE_RULES_NOT_KEPT", "per-element values were written but not the rules"],
|
|
52
|
+
["W_STYLE_LAYER_FLATTENED", "a style was written as per-element values"],
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* Collects style notes, aggregated per (code, target, property).
|
|
56
|
+
* @category Styles
|
|
57
|
+
*/
|
|
58
|
+
export class StyleNotes {
|
|
59
|
+
constructor() {
|
|
60
|
+
_StyleNotes_notes.set(this, new Map());
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Records one occurrence (or `count` occurrences) of a condition.
|
|
64
|
+
* @param code - the condition
|
|
65
|
+
* @param target - nodes, edges, the graph, or null for the file as a whole
|
|
66
|
+
* @param property - the property or the file's name for the construct, or null
|
|
67
|
+
* @param report - a sample, the element index and a count
|
|
68
|
+
*/
|
|
69
|
+
add(code, target, property, report = {}) {
|
|
70
|
+
const key = `${code}\u0000${target ?? ""}\u0000${property ?? ""}`;
|
|
71
|
+
let note = __classPrivateFieldGet(this, _StyleNotes_notes, "f").get(key);
|
|
72
|
+
if (note === undefined) {
|
|
73
|
+
note = { code, target, property, count: 0, samples: [], elements: new Set(), unindexed: false };
|
|
74
|
+
__classPrivateFieldGet(this, _StyleNotes_notes, "f").set(key, note);
|
|
75
|
+
}
|
|
76
|
+
note.count += report.count ?? 1;
|
|
77
|
+
if (report.element === undefined) {
|
|
78
|
+
note.unindexed = true;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
note.elements.add(report.element);
|
|
82
|
+
}
|
|
83
|
+
if (report.sample !== undefined && note.samples.length < MAX_SAMPLES) {
|
|
84
|
+
const sample = sampleText(report.sample);
|
|
85
|
+
if (!note.samples.includes(sample)) {
|
|
86
|
+
note.samples.push(sample);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether a note with this code, target and property covers an element.
|
|
92
|
+
* @param code - the condition
|
|
93
|
+
* @param target - nodes or edges
|
|
94
|
+
* @param property - the property
|
|
95
|
+
* @param element - the element index
|
|
96
|
+
* @returns true when such a note named the element
|
|
97
|
+
*/
|
|
98
|
+
covers(code, target, property, element) {
|
|
99
|
+
return __classPrivateFieldGet(this, _StyleNotes_notes, "f").get(`${code}\u0000${target}\u0000${property ?? ""}`)?.elements.has(element) === true;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The collected notes, in the order their conditions first occurred.
|
|
103
|
+
* @returns one note per (code, target, property)
|
|
104
|
+
*/
|
|
105
|
+
list() {
|
|
106
|
+
const out = [];
|
|
107
|
+
for (const n of __classPrivateFieldGet(this, _StyleNotes_notes, "f").values()) {
|
|
108
|
+
const where = n.property === null ? (n.target ?? "file") : `${n.target ?? "file"} ${n.property}`;
|
|
109
|
+
out.push({
|
|
110
|
+
code: n.code,
|
|
111
|
+
params: { property: n.property, target: n.target, count: n.count, samples: [...n.samples] },
|
|
112
|
+
elements: n.unindexed ? { count: n.count } : Array.from(n.elements).sort((a, b) => a - b),
|
|
113
|
+
message: `${where}: ${PHRASES.get(n.code) ?? n.code} (${n.count})`,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
_StyleNotes_notes = new WeakMap();
|
|
120
|
+
/**
|
|
121
|
+
* A sample as at most 80 characters of text.
|
|
122
|
+
* @param value - the sample
|
|
123
|
+
* @returns its text
|
|
124
|
+
*/
|
|
125
|
+
function sampleText(value) {
|
|
126
|
+
let text;
|
|
127
|
+
if (typeof value === "string") {
|
|
128
|
+
text = value;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
try {
|
|
132
|
+
text = JSON.stringify(value) ?? typeof value;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
text = typeof value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return text.slice(0, MAX_SAMPLE_LENGTH);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=notes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notes.js","sourceRoot":"","sources":["../../../src/styles/notes.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;;;;;AAIH,0CAA0C;AAC1C,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,+CAA+C;AAC/C,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,qEAAqE;AACrE,MAAM,OAAO,GAAuC,IAAI,GAAG,CAAwB;IAC/E,CAAC,wBAAwB,EAAE,mDAAmD,CAAC;IAC/E,CAAC,mBAAmB,EAAE,qBAAqB,CAAC;IAC5C,CAAC,uBAAuB,EAAE,qEAAqE,CAAC;IAChG,CAAC,uBAAuB,EAAE,yBAAyB,CAAC;IACpD,CAAC,oBAAoB,EAAE,uCAAuC,CAAC;IAC/D,CAAC,kBAAkB,EAAE,yCAAyC,CAAC;IAC/D,CAAC,kBAAkB,EAAE,4CAA4C,CAAC;IAClE,CAAC,iBAAiB,EAAE,8BAA8B,CAAC;IACnD,CAAC,mBAAmB,EAAE,2BAA2B,CAAC;IAClD,CAAC,sBAAsB,EAAE,0DAA0D,CAAC;IACpF,CAAC,oBAAoB,EAAE,sDAAsD,CAAC;IAC9E,CAAC,sBAAsB,EAAE,iCAAiC,CAAC;IAC3D,CAAC,sBAAsB,EAAE,uDAAuD,CAAC;IACjF,CAAC,uBAAuB,EAAE,sCAAsC,CAAC;IACjE,CAAC,qBAAqB,EAAE,2DAA2D,CAAC;IACpF,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;IAClD,CAAC,gCAAgC,EAAE,+CAA+C,CAAC;IACnF,CAAC,yBAAyB,EAAE,2CAA2C,CAAC;IACxE,CAAC,oBAAoB,EAAE,+BAA+B,CAAC;IACvD,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;IAC3D,CAA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,iBAAiB,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opaque pool: the families nothing explains. Over their non-text, non-size properties each distinct joint tuple
|
|
3
|
+
* of values is a style class, numbered 1..k by frequency in the style column `class`; a few classes become one group
|
|
4
|
+
* rule each, more become one table keyed by the class. What is left is copied per element.
|
|
5
|
+
*/
|
|
6
|
+
import type { StyleRule, StyleTarget, StyleValue } from "../types.js";
|
|
7
|
+
/** The style column holding each element's class. */
|
|
8
|
+
export declare const CLASS_COLUMN = "class";
|
|
9
|
+
/**
|
|
10
|
+
* The style classes of an opaque pool.
|
|
11
|
+
*/
|
|
12
|
+
interface StyleClasses {
|
|
13
|
+
/** The properties the classes explain. */
|
|
14
|
+
readonly classed: readonly string[];
|
|
15
|
+
/** The class of each element, 1..k, or null. */
|
|
16
|
+
readonly column: (number | null)[];
|
|
17
|
+
/** One group rule per class, or one mapping rule keyed by the class. */
|
|
18
|
+
readonly rules: StyleRule[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Finds the style classes of the opaque properties.
|
|
22
|
+
* @param target - nodes or edges
|
|
23
|
+
* @param props - the opaque properties
|
|
24
|
+
* @param truth - the values per property
|
|
25
|
+
* @param n - the element count
|
|
26
|
+
* @param spend - spends work from the budget
|
|
27
|
+
* @returns the classes, or null when the values have too many combinations
|
|
28
|
+
*/
|
|
29
|
+
export declare function styleClasses(target: StyleTarget, props: readonly string[], truth: ReadonlyMap<string, readonly (StyleValue | null)[]>, n: number, spend: (ops: number) => void): StyleClasses | null;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=classes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../../../src/styles/plan/classes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWtE,qDAAqD;AACrD,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC;;GAEG;AACH,UAAU,YAAY;IAClB,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACnC,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;CAC/B;AAwCD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CACxB,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,EAC1D,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7B,YAAY,GAAG,IAAI,CAgFrB"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The opaque pool: the families nothing explains. Over their non-text, non-size properties each distinct joint tuple
|
|
3
|
+
* of values is a style class, numbered 1..k by frequency in the style column `class`; a few classes become one group
|
|
4
|
+
* rule each, more become one table keyed by the class. What is left is copied per element.
|
|
5
|
+
*/
|
|
6
|
+
import { STYLE_PROPERTIES } from "../vocabulary.js";
|
|
7
|
+
import { MIN_MAPPED } from "./discrete.js";
|
|
8
|
+
import { valueKey } from "./families.js";
|
|
9
|
+
/** The most style classes; more distinct tuples are copied per element. */
|
|
10
|
+
const MAX_CLASSES = 64;
|
|
11
|
+
/** At most this many classes become one group rule each. */
|
|
12
|
+
const MAX_CLASS_RULES = 4;
|
|
13
|
+
/** Sizes vary per element by nature and are never joined into a class. */
|
|
14
|
+
const SIZES = new Set(["width", "height"]);
|
|
15
|
+
/** The style column holding each element's class. */
|
|
16
|
+
export const CLASS_COLUMN = "class";
|
|
17
|
+
/**
|
|
18
|
+
* Whether a property's values have few enough distinct values to be part of a class.
|
|
19
|
+
* @param values - the values
|
|
20
|
+
* @returns true when they do
|
|
21
|
+
*/
|
|
22
|
+
function fewValues(values) {
|
|
23
|
+
const seen = new Set();
|
|
24
|
+
for (const v of values) {
|
|
25
|
+
seen.add(valueKey(v));
|
|
26
|
+
if (seen.size > MAX_CLASSES + 1) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One element's combination of values of the classable properties, as a key; null when it has none.
|
|
34
|
+
* @param classable - the properties
|
|
35
|
+
* @param truth - the values per property
|
|
36
|
+
* @param i - the element
|
|
37
|
+
* @returns the key
|
|
38
|
+
*/
|
|
39
|
+
function tupleKey(classable, truth, i) {
|
|
40
|
+
let key = "";
|
|
41
|
+
let any = false;
|
|
42
|
+
for (const p of classable) {
|
|
43
|
+
const v = (truth.get(p) ?? [])[i] ?? null;
|
|
44
|
+
any || (any = v !== null);
|
|
45
|
+
key += `${valueKey(v)}\u0001`;
|
|
46
|
+
}
|
|
47
|
+
return any ? key : null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Finds the style classes of the opaque properties.
|
|
51
|
+
* @param target - nodes or edges
|
|
52
|
+
* @param props - the opaque properties
|
|
53
|
+
* @param truth - the values per property
|
|
54
|
+
* @param n - the element count
|
|
55
|
+
* @param spend - spends work from the budget
|
|
56
|
+
* @returns the classes, or null when the values have too many combinations
|
|
57
|
+
*/
|
|
58
|
+
export function styleClasses(target, props, truth, n, spend) {
|
|
59
|
+
const classable = props.filter((p) => STYLE_PROPERTIES[target].get(p) !== "text" && !SIZES.has(p) && fewValues(truth.get(p) ?? []));
|
|
60
|
+
if (classable.length === 0) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
spend(n * (classable.length + 1));
|
|
64
|
+
const counts = new Map();
|
|
65
|
+
const tupleOf = new Array(n).fill(null);
|
|
66
|
+
let withTuple = 0;
|
|
67
|
+
for (let i = 0; i < n; i++) {
|
|
68
|
+
const key = tupleKey(classable, truth, i);
|
|
69
|
+
if (key === null) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
withTuple++;
|
|
73
|
+
tupleOf[i] = key;
|
|
74
|
+
const c = counts.get(key);
|
|
75
|
+
if (c === undefined) {
|
|
76
|
+
counts.set(key, { count: 1, rep: i });
|
|
77
|
+
if (counts.size > MAX_CLASSES) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
c.count++;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (counts.size === 0 || withTuple < MIN_MAPPED || counts.size * 2 > withTuple) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
// classes by frequency, ties by first appearance (a stable sort)
|
|
89
|
+
const order = Array.from(counts.entries()).sort((a, b) => b[1].count - a[1].count);
|
|
90
|
+
const rank = new Map(order.map(([key], j) => [key, j + 1]));
|
|
91
|
+
const column = tupleOf.map((t) => (t === null ? null : (rank.get(t) ?? null)));
|
|
92
|
+
const ref = { style: CLASS_COLUMN };
|
|
93
|
+
const valueOf = (p, rep) => (truth.get(p) ?? [])[rep] ?? null;
|
|
94
|
+
const rules = [];
|
|
95
|
+
if (order.length <= Math.min(MAX_CLASS_RULES, Math.floor(withTuple / 4))) {
|
|
96
|
+
order.forEach(([, { count, rep }], j) => {
|
|
97
|
+
const set = {};
|
|
98
|
+
for (const p of classable) {
|
|
99
|
+
const v = valueOf(p, rep);
|
|
100
|
+
if (v !== null) {
|
|
101
|
+
set[p] = v;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
rules.push({
|
|
105
|
+
id: `${target}.class.${String(j + 1)}`,
|
|
106
|
+
target,
|
|
107
|
+
role: "group",
|
|
108
|
+
origin: "inferred",
|
|
109
|
+
where: { eq: [ref, j + 1] },
|
|
110
|
+
set,
|
|
111
|
+
facts: { elements: count, reason: "STYLE_CLASS" },
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
const map = {};
|
|
117
|
+
for (const p of classable) {
|
|
118
|
+
const table = [];
|
|
119
|
+
order.forEach(([, { rep }], j) => {
|
|
120
|
+
const v = valueOf(p, rep);
|
|
121
|
+
if (v !== null) {
|
|
122
|
+
table.push([j + 1, v]);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
map[p] = { kind: "discrete", by: ref, table };
|
|
126
|
+
}
|
|
127
|
+
rules.push({
|
|
128
|
+
id: `${target}.classes`,
|
|
129
|
+
target,
|
|
130
|
+
role: "mapping",
|
|
131
|
+
origin: "inferred",
|
|
132
|
+
where: { all: true },
|
|
133
|
+
map,
|
|
134
|
+
facts: { classes: order.length, elements: withTuple, reason: "STYLE_CLASS" },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return { classed: classable, column, rules };
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=classes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classes.js","sourceRoot":"","sources":["../../../../src/styles/plan/classes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,2EAA2E;AAC3E,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,4DAA4D;AAC5D,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,0EAA0E;AAC1E,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChE,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAcpC;;;;G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,MAAM,UAAU;YACvB,MAAM;YACN,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,UAAU;YAClB,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE;YACpB,GAAG;YACH,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE;SAC/E,CAAC,CAAC;IACP,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A continuous mapping on one numeric feature: the fewest linear pieces (at most 8, each explaining at least 3
|
|
3
|
+
* distinct inputs), exact first, else within the rounding the writing tool did per element.
|
|
4
|
+
*/
|
|
5
|
+
import type { ContinuousPoint, StyleValue } from "../types.js";
|
|
6
|
+
import type { Family } from "./families.js";
|
|
7
|
+
import type { FeatureInfo } from "./features.js";
|
|
8
|
+
/**
|
|
9
|
+
* A continuous mapping that explains a family.
|
|
10
|
+
*/
|
|
11
|
+
export interface ContinuousCandidate {
|
|
12
|
+
/** The kind of candidate. */
|
|
13
|
+
readonly type: "continuous";
|
|
14
|
+
/** The feature the ramp reads. */
|
|
15
|
+
readonly info: FeatureInfo;
|
|
16
|
+
/** The points per property. */
|
|
17
|
+
readonly points: ReadonlyMap<string, ContinuousPoint[]>;
|
|
18
|
+
/** Whether the ramp matches only within the tool's rounding. */
|
|
19
|
+
readonly tolerant: boolean;
|
|
20
|
+
/** The description cost. */
|
|
21
|
+
readonly cost: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Tests a continuous mapping on one feature.
|
|
25
|
+
* @param fam - the family
|
|
26
|
+
* @param info - the feature
|
|
27
|
+
* @param truth - the values per property
|
|
28
|
+
* @param spend - spends work from the budget
|
|
29
|
+
* @returns the candidate, or null when the feature does not explain the family
|
|
30
|
+
*/
|
|
31
|
+
export declare function continuousCandidate(fam: Family, info: FeatureInfo, truth: ReadonlyMap<string, readonly (StyleValue | null)[]>, spend: (ops: number) => void): ContinuousCandidate | null;
|
|
32
|
+
//# sourceMappingURL=continuous.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous.d.ts","sourceRoot":"","sources":["../../../../src/styles/plan/continuous.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AASjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,+BAA+B;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IACxD,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAwFD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,EAC1D,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7B,mBAAmB,GAAG,IAAI,CAkB5B"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A continuous mapping on one numeric feature: the fewest linear pieces (at most 8, each explaining at least 3
|
|
3
|
+
* distinct inputs), exact first, else within the rounding the writing tool did per element.
|
|
4
|
+
*/
|
|
5
|
+
import { MIN_MAPPED } from "./discrete.js";
|
|
6
|
+
import { interpolate, within } from "./resolve.js";
|
|
7
|
+
/** The most linear pieces a ramp may have. */
|
|
8
|
+
const MAX_PIECES = 8;
|
|
9
|
+
/** The most distinct inputs a ramp is fitted over. */
|
|
10
|
+
const MAX_DISTINCT_X = 4096;
|
|
11
|
+
const HEX6 = /^#[0-9a-f]{6}$/;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a value can be interpolated: a number or a canonical color.
|
|
14
|
+
* @param v - the value
|
|
15
|
+
* @returns true when it can
|
|
16
|
+
*/
|
|
17
|
+
function interpolable(v) {
|
|
18
|
+
return typeof v === "number" || (typeof v === "string" && HEX6.test(v));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The fewest linear pieces over sorted distinct points, or null when more than `MAX_PIECES` are needed.
|
|
22
|
+
* @param xs - the inputs, ascending
|
|
23
|
+
* @param ys - the outputs
|
|
24
|
+
* @param tolerant - whether a piece may miss a point by the tool's rounding
|
|
25
|
+
* @param spend - spends work from the budget
|
|
26
|
+
* @returns each piece's first and last point index, or null
|
|
27
|
+
*/
|
|
28
|
+
function fitPieces(xs, ys, tolerant, spend) {
|
|
29
|
+
const pieces = [];
|
|
30
|
+
let a = 0;
|
|
31
|
+
while (a < xs.length) {
|
|
32
|
+
let b = a;
|
|
33
|
+
// extend while the line from a to b + 1 reproduces every point between
|
|
34
|
+
while (b + 1 < xs.length) {
|
|
35
|
+
const ok = lineFits(xs, ys, a, b + 1, tolerant);
|
|
36
|
+
spend(b + 1 - a);
|
|
37
|
+
if (!ok) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
b++;
|
|
41
|
+
}
|
|
42
|
+
pieces.push([a, b]);
|
|
43
|
+
if (pieces.length > MAX_PIECES) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
a = b + 1;
|
|
47
|
+
}
|
|
48
|
+
return pieces;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Whether the line from point a to point c reproduces every point between.
|
|
52
|
+
* @param xs - the inputs, ascending
|
|
53
|
+
* @param ys - the outputs
|
|
54
|
+
* @param a - the first point
|
|
55
|
+
* @param c - the last point
|
|
56
|
+
* @param tolerant - whether the line may miss a point by the tool's rounding
|
|
57
|
+
* @returns true when it does
|
|
58
|
+
*/
|
|
59
|
+
function lineFits(xs, ys, a, c, tolerant) {
|
|
60
|
+
for (let j = a + 1; j < c; j++) {
|
|
61
|
+
const v = interpolate(ys[a], ys[c], (xs[j] - xs[a]) / (xs[c] - xs[a]));
|
|
62
|
+
if (tolerant ? !within(v, ys[j]) : v !== ys[j]) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The points of a fitted ramp.
|
|
70
|
+
* @param xs - the inputs
|
|
71
|
+
* @param ys - the outputs
|
|
72
|
+
* @param pieces - the pieces
|
|
73
|
+
* @returns the points, ascending
|
|
74
|
+
*/
|
|
75
|
+
function piecesToPoints(xs, ys, pieces) {
|
|
76
|
+
const out = [];
|
|
77
|
+
for (const [a, b] of pieces) {
|
|
78
|
+
out.push({ at: xs[a], below: ys[a], value: ys[a], above: ys[a] });
|
|
79
|
+
if (b !== a) {
|
|
80
|
+
out.push({ at: xs[b], below: ys[b], value: ys[b], above: ys[b] });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Tests a continuous mapping on one feature.
|
|
87
|
+
* @param fam - the family
|
|
88
|
+
* @param info - the feature
|
|
89
|
+
* @param truth - the values per property
|
|
90
|
+
* @param spend - spends work from the budget
|
|
91
|
+
* @returns the candidate, or null when the feature does not explain the family
|
|
92
|
+
*/
|
|
93
|
+
export function continuousCandidate(fam, info, truth, spend) {
|
|
94
|
+
if (!info.numeric || info.raw || fam.styled.length < MIN_MAPPED) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
const { values } = info.feature;
|
|
98
|
+
spend(values.length);
|
|
99
|
+
// the feature must be a number exactly where the family has a value
|
|
100
|
+
if (values.some((v, i) => (fam.blocks[i] === 0) === (typeof v === "number"))) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
for (const tolerant of [false, true]) {
|
|
104
|
+
const points = rampsOf(fam, values, truth, tolerant, spend);
|
|
105
|
+
if (points !== null) {
|
|
106
|
+
const entries = Array.from(points.values()).reduce((sum, pts) => sum + pts.length, 0);
|
|
107
|
+
return { type: "continuous", info, points, tolerant, cost: 50 + entries + (tolerant ? 10 : 0) };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The ramp of every property of the family over the feature, or null when one has none.
|
|
114
|
+
* @param fam - the family
|
|
115
|
+
* @param values - the feature's values
|
|
116
|
+
* @param truth - the values per property
|
|
117
|
+
* @param tolerant - whether a ramp may miss a value by the tool's rounding
|
|
118
|
+
* @param spend - spends work from the budget
|
|
119
|
+
* @returns the points per property, or null
|
|
120
|
+
*/
|
|
121
|
+
function rampsOf(fam, values, truth, tolerant, spend) {
|
|
122
|
+
const points = new Map();
|
|
123
|
+
for (const p of fam.props) {
|
|
124
|
+
const pts = rampOf(fam, values, truth.get(p) ?? [], tolerant, spend);
|
|
125
|
+
if (pts === null) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
points.set(p, pts);
|
|
129
|
+
}
|
|
130
|
+
return points;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The ramp of one property over the feature, or null when none explains it.
|
|
134
|
+
* @param fam - the family
|
|
135
|
+
* @param values - the feature's values
|
|
136
|
+
* @param ys0 - the property's values
|
|
137
|
+
* @param tolerant - whether the ramp may miss a value by the tool's rounding
|
|
138
|
+
* @param spend - spends work from the budget
|
|
139
|
+
* @returns the points, or null
|
|
140
|
+
*/
|
|
141
|
+
function rampOf(fam, values, ys0, tolerant, spend) {
|
|
142
|
+
const byX = new Map();
|
|
143
|
+
let good = true;
|
|
144
|
+
for (const i of fam.styled) {
|
|
145
|
+
const y = ys0[i];
|
|
146
|
+
const x = values[i];
|
|
147
|
+
const seen = byX.get(x);
|
|
148
|
+
if (!interpolable(y) || (seen !== undefined && seen !== y)) {
|
|
149
|
+
good = false;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
byX.set(x, y);
|
|
153
|
+
}
|
|
154
|
+
spend(fam.styled.length);
|
|
155
|
+
// a ramp needs at least 3 distinct outputs: two values over a number are a threshold, not a mapping
|
|
156
|
+
if (!good || byX.size < 2 || byX.size > MAX_DISTINCT_X || new Set(byX.values()).size < 3) {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
const xs = Array.from(byX.keys()).sort((a, b) => a - b);
|
|
160
|
+
const ys = xs.map((x) => byX.get(x));
|
|
161
|
+
const pieces = fitPieces(xs, ys, tolerant, spend);
|
|
162
|
+
// every piece must explain at least 3 distinct inputs, or a few points fit anything
|
|
163
|
+
return pieces === null || pieces.length * 3 > xs.length ? null : piecesToPoints(xs, ys, pieces);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=continuous.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuous.js","sourceRoot":"","sources":["../../../../src/styles/plan/continuous.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEnD,8CAA8C;AAC9C,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,sDAAsD;AACtD,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAkB9B;;;;GAIG;AACH,SAAS,YAAY,CAA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CAAC,MAAM,CAAC,CAAC;IACzB,oGAAoG;IACpG,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,cAAc,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACvF,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAe,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClD,oFAAoF;IACpF,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A discrete mapping on one categorical feature: the feature's values fall inside the family's blocks, up to 20% of
|
|
3
|
+
* the styled elements excepted, and the elements missing the feature may form their own group.
|
|
4
|
+
*/
|
|
5
|
+
import { type Family } from "./families.js";
|
|
6
|
+
import type { FeatureInfo } from "./features.js";
|
|
7
|
+
/** Below this many styled elements anything explains anything: no mapping is tried. */
|
|
8
|
+
export declare const MIN_MAPPED = 8;
|
|
9
|
+
/** A key of a discrete table, as the feature holds it. */
|
|
10
|
+
type KeyValue = string | number | boolean;
|
|
11
|
+
/**
|
|
12
|
+
* A discrete mapping that explains a family.
|
|
13
|
+
*/
|
|
14
|
+
export interface DiscreteCandidate {
|
|
15
|
+
/** The kind of candidate. */
|
|
16
|
+
readonly type: "discrete";
|
|
17
|
+
/** The feature the table reads. */
|
|
18
|
+
readonly info: FeatureInfo;
|
|
19
|
+
/** Each key (by its value key) with its raw value and the block it maps to. */
|
|
20
|
+
readonly table: Map<string, {
|
|
21
|
+
readonly raw: KeyValue;
|
|
22
|
+
readonly block: number;
|
|
23
|
+
}>;
|
|
24
|
+
/** The block the elements missing the feature share, or null. */
|
|
25
|
+
readonly bucket: number | null;
|
|
26
|
+
/** The description cost. */
|
|
27
|
+
readonly cost: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tests a discrete mapping on one feature.
|
|
31
|
+
* @param fam - the family
|
|
32
|
+
* @param info - the feature
|
|
33
|
+
* @param n - the element count
|
|
34
|
+
* @param spend - spends work from the budget
|
|
35
|
+
* @returns the candidate, or null when the feature does not explain the family
|
|
36
|
+
*/
|
|
37
|
+
export declare function discreteCandidate(fam: Family, info: FeatureInfo, n: number, spend: (ops: number) => void): DiscreteCandidate | null;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=discrete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discrete.d.ts","sourceRoot":"","sources":["../../../../src/styles/plan/discrete.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,uFAAuF;AACvF,eAAO,MAAM,UAAU,IAAI,CAAC;AAM5B,0DAA0D;AAC1D,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,6BAA6B;IAC7B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChF,iEAAiE;IACjE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAC7B,iBAAiB,GAAG,IAAI,CAiC1B"}
|