@graphty/graph-io 0.3.44 → 0.3.45
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 → approximations-DJMHdDvv.js} +2 -2
- package/dist/chunks/{approximations-3Q4TsdTh.js.map → approximations-DJMHdDvv.js.map} +1 -1
- package/dist/chunks/{block-JQiwViEt.js → block-CPCHkX42.js} +42 -42
- package/dist/chunks/{block-JQiwViEt.js.map → block-CPCHkX42.js.map} +1 -1
- package/dist/chunks/{choose-BemygfH8.js → choose--jM0yYCo.js} +3 -3
- package/dist/chunks/{choose-BemygfH8.js.map → choose--jM0yYCo.js.map} +1 -1
- package/dist/chunks/{constants-BFUR_CtU.js → constants-BKwqelYD.js} +2 -2
- package/dist/chunks/{constants-BFUR_CtU.js.map → constants-BKwqelYD.js.map} +1 -1
- package/dist/chunks/{emit-DCwFLts5.js → emit-DZy6JgdA.js} +3 -3
- package/dist/chunks/{emit-DCwFLts5.js.map → emit-DZy6JgdA.js.map} +1 -1
- package/dist/chunks/{escape-B1rMftd9.js → escape-CgzxiYPg.js} +6 -6
- package/dist/chunks/{escape-B1rMftd9.js.map → escape-CgzxiYPg.js.map} +1 -1
- package/dist/chunks/{export-D7IGzTG4.js → export-BvqAXCKh.js} +4 -4
- package/dist/chunks/{export-D7IGzTG4.js.map → export-BvqAXCKh.js.map} +1 -1
- package/dist/chunks/{exporter-ChPyhBOv.js → exporter--Mk9gXCJ.js} +4 -4
- package/dist/chunks/{exporter-ChPyhBOv.js.map → exporter--Mk9gXCJ.js.map} +1 -1
- package/dist/chunks/{exporter-quPUCBiC.js → exporter-C-9cgZKa.js} +9 -9
- package/dist/chunks/{exporter-quPUCBiC.js.map → exporter-C-9cgZKa.js.map} +1 -1
- package/dist/chunks/{exporter-KEPxYUXD.js → exporter-DFqJhBnj.js} +7 -7
- package/dist/chunks/{exporter-KEPxYUXD.js.map → exporter-DFqJhBnj.js.map} +1 -1
- package/dist/chunks/{exporter-BtnqYuuj.js → exporter-DteVeJki.js} +6 -6
- package/dist/chunks/{exporter-BtnqYuuj.js.map → exporter-DteVeJki.js.map} +1 -1
- package/dist/chunks/{format-GDmO6m6Q.js → format-BpQBx8MZ.js} +35 -35
- package/dist/chunks/{format-GDmO6m6Q.js.map → format-BpQBx8MZ.js.map} +1 -1
- package/dist/chunks/{generic-BL06jrJf.js → generic-BGO71QBv.js} +4 -4
- package/dist/chunks/{generic-BL06jrJf.js.map → generic-BGO71QBv.js.map} +1 -1
- package/dist/chunks/{importer-dwoYpSqb.js → importer-B-9Rc1zO.js} +7 -7
- package/dist/chunks/{importer-dwoYpSqb.js.map → importer-B-9Rc1zO.js.map} +1 -1
- package/dist/chunks/{importer-CdzeN6X4.js → importer-BVVR740x.js} +6 -6
- package/dist/chunks/{importer-CdzeN6X4.js.map → importer-BVVR740x.js.map} +1 -1
- package/dist/chunks/{importer-B7r2owVf.js → importer-C0AjA3Ax.js} +9 -9
- package/dist/chunks/{importer-B7r2owVf.js.map → importer-C0AjA3Ax.js.map} +1 -1
- package/dist/chunks/{importer-C2nzGhdV.js → importer-C7pvJe1L.js} +17 -9
- package/dist/chunks/importer-C7pvJe1L.js.map +1 -0
- package/dist/chunks/{importer-ChKNC_GN.js → importer-ClwoVx3O.js} +8 -8
- package/dist/chunks/{importer-ChKNC_GN.js.map → importer-ClwoVx3O.js.map} +1 -1
- package/dist/chunks/{importer-BFmOP96W.js → importer-D0sC_6bO.js} +6 -6
- package/dist/chunks/{importer-BFmOP96W.js.map → importer-D0sC_6bO.js.map} +1 -1
- package/dist/chunks/{importer-CbX2_rNF.js → importer-EHQk1jbM.js} +9 -9
- package/dist/chunks/{importer-CbX2_rNF.js.map → importer-EHQk1jbM.js.map} +1 -1
- package/dist/chunks/{json-elements-C4FwgnH5.js → json-elements-DJZRZ6jd.js} +4 -4
- package/dist/chunks/{json-elements-C4FwgnH5.js.map → json-elements-DJZRZ6jd.js.map} +1 -1
- package/dist/chunks/{lexicon-B-knUi-l.js → lexicon-WMsNddyU.js} +5 -4
- package/dist/chunks/{lexicon-B-knUi-l.js.map → lexicon-WMsNddyU.js.map} +1 -1
- package/dist/chunks/{ontology-export-BSpbY5FL.js → ontology-export-G4MqRdux.js} +3 -3
- package/dist/chunks/{ontology-export-BSpbY5FL.js.map → ontology-export-G4MqRdux.js.map} +1 -1
- package/dist/chunks/{records-Nwz_rbNt.js → records-CiaWZrFH.js} +2 -2
- package/dist/chunks/{records-Nwz_rbNt.js.map → records-CiaWZrFH.js.map} +1 -1
- package/dist/chunks/{styles-Brt9JMfs.js → styles-DvoFBKCK.js} +4 -4
- package/dist/chunks/{styles-Brt9JMfs.js.map → styles-DvoFBKCK.js.map} +1 -1
- package/dist/chunks/{styles-yed-DAfcIkf7.js → styles-yed-Cz9rLBCP.js} +17 -17
- package/dist/chunks/{styles-yed-DAfcIkf7.js.map → styles-yed-Cz9rLBCP.js.map} +1 -1
- package/dist/chunks/{styles-_N-C8S-U.js → styles-zNTmz5R7.js} +5 -5
- package/dist/chunks/{styles-_N-C8S-U.js.map → styles-zNTmz5R7.js.map} +1 -1
- package/dist/chunks/{text-CgzMqHQb.js → text-CzJNFOS9.js} +2 -2
- package/dist/chunks/{text-CgzMqHQb.js.map → text-CzJNFOS9.js.map} +1 -1
- package/dist/chunks/writer-gQ8kx99H.js +448 -0
- package/dist/chunks/writer-gQ8kx99H.js.map +1 -0
- package/dist/csv.js +5 -5
- package/dist/cx.js +1 -1
- package/dist/cx2.js +2 -2
- package/dist/cys.js +1 -1
- package/dist/dot.js +2 -2
- package/dist/gexf.js +5 -5
- package/dist/gml.js +3884 -8
- package/dist/gml.js.map +1 -1
- package/dist/graph-io.js +90 -89
- package/dist/graph-io.js.map +1 -1
- package/dist/graphml.js +3 -3
- package/dist/json.js +1 -1
- package/dist/neo4j.js +4 -4
- package/dist/obo.js +1 -1
- package/dist/pajek.js +1 -1
- package/dist/src/formats/dot/styles.d.ts +1 -1
- package/dist/src/formats/dot/styles.d.ts.map +1 -1
- package/dist/src/formats/dot/styles.js +12 -0
- package/dist/src/formats/dot/styles.js.map +1 -1
- package/dist/src/styles/cyjs/emit.d.ts.map +1 -1
- package/dist/src/styles/cyjs/emit.js +2 -1
- package/dist/src/styles/cyjs/emit.js.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.d.ts.map +1 -1
- package/dist/src/styles/cytoscape/lexicon.js +3 -1
- package/dist/src/styles/cytoscape/lexicon.js.map +1 -1
- package/dist/src/styles/io/writer.d.ts +9 -0
- package/dist/src/styles/io/writer.d.ts.map +1 -1
- package/dist/src/styles/io/writer.js +31 -1
- package/dist/src/styles/io/writer.js.map +1 -1
- package/dist/styles.js +21 -21
- package/dist/styles.js.map +1 -1
- package/dist/xgmml.js +3 -3
- package/package.json +1 -1
- package/src/formats/dot/styles.ts +15 -1
- package/src/styles/cyjs/emit.ts +2 -1
- package/src/styles/cytoscape/lexicon.ts +3 -1
- package/src/styles/io/writer.ts +36 -1
- package/dist/chunks/importer-C2nzGhdV.js.map +0 -1
- package/dist/chunks/index-B9fdNpTA.js +0 -4310
- package/dist/chunks/index-B9fdNpTA.js.map +0 -1
package/src/styles/io/writer.ts
CHANGED
|
@@ -128,6 +128,37 @@ export function prepareStyleExport(
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* The work an exporter shares between the check and the write of one export call, by the styles input made for that
|
|
133
|
+
* call (null until the first exporter step does it). Only an input writePlan() made is here, so an input a caller
|
|
134
|
+
* builds and changes in place is always worked out again.
|
|
135
|
+
*/
|
|
136
|
+
const CALL_WORK = new WeakMap<
|
|
137
|
+
ExporterStyleInput,
|
|
138
|
+
{ readonly key: readonly unknown[]; readonly value: unknown } | null
|
|
139
|
+
>();
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Work an exporter does from its styles input once per export call: the registry checks before it writes, with the
|
|
143
|
+
* same input, graph and options. Outside an export call (an input the caller made) it is done every time.
|
|
144
|
+
* @param input - the exporter's `options.styles`
|
|
145
|
+
* @param key - what else the work reads (the graph, options), compared by identity
|
|
146
|
+
* @param compute - the work
|
|
147
|
+
* @returns its result
|
|
148
|
+
*/
|
|
149
|
+
export function sharedInExportCall<T>(input: ExporterStyleInput, key: readonly unknown[], compute: () => T): T {
|
|
150
|
+
if (!CALL_WORK.has(input)) {
|
|
151
|
+
return compute();
|
|
152
|
+
}
|
|
153
|
+
const done = CALL_WORK.get(input);
|
|
154
|
+
if (done?.key.length === key.length && done.key.every((k, i) => k === key[i])) {
|
|
155
|
+
return done.value as T;
|
|
156
|
+
}
|
|
157
|
+
const value = compute();
|
|
158
|
+
CALL_WORK.set(input, { key, value });
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
|
|
131
162
|
/**
|
|
132
163
|
* What an exporter is handed to write a graph's styles: the snapshot with the block and tagged values added where
|
|
133
164
|
* the format keeps them, and its `options.styles`.
|
|
@@ -164,9 +195,13 @@ function writePlan(
|
|
|
164
195
|
}
|
|
165
196
|
}
|
|
166
197
|
const block = writeStyleBlock(extracted, { snapshot });
|
|
198
|
+
const input = exporter.styles === undefined ? null : { picture, block, tags, rules: extracted };
|
|
199
|
+
if (input !== null) {
|
|
200
|
+
CALL_WORK.set(input, null);
|
|
201
|
+
}
|
|
167
202
|
return {
|
|
168
203
|
snapshot: styledSnapshot(snapshot, caps, tags, block, extracted.styles.rules),
|
|
169
|
-
input
|
|
204
|
+
input,
|
|
170
205
|
extracted,
|
|
171
206
|
picture,
|
|
172
207
|
};
|