@metronforge/concept-map 0.3.1 → 0.3.2
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/README.md
CHANGED
|
@@ -55,11 +55,11 @@ Load the stylesheet, one module script and one element on an HTML page:
|
|
|
55
55
|
```html
|
|
56
56
|
<link
|
|
57
57
|
rel="stylesheet"
|
|
58
|
-
href="https://esm.sh/@metronforge/concept-map@0.3.
|
|
58
|
+
href="https://esm.sh/@metronforge/concept-map@0.3.2/css"
|
|
59
59
|
/>
|
|
60
60
|
<script
|
|
61
61
|
type="module"
|
|
62
|
-
src="https://esm.sh/@metronforge/concept-map@0.3.
|
|
62
|
+
src="https://esm.sh/@metronforge/concept-map@0.3.2/element"
|
|
63
63
|
></script>
|
|
64
64
|
<concept-map src="./map.json" layout="dagre"></concept-map>
|
|
65
65
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ResolvedMap } from "../../schema.js";
|
|
2
2
|
import type { Measurer } from "../ports.js";
|
|
3
3
|
/** Re-measure text and place labels and numbers, keeping all fixed geometry.
|
|
4
|
-
*
|
|
4
|
+
* Authored anchors stay put until a previous measurement is available.
|
|
5
5
|
* No input is mutated; the checker measures independently of this metadata. */
|
|
6
6
|
export declare function refine(map: ResolvedMap, measurer: Measurer): ResolvedMap;
|
|
7
7
|
//# sourceMappingURL=refine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refine.d.ts","sourceRoot":"","sources":["../../../src/layout/stages/refine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"refine.d.ts","sourceRoot":"","sources":["../../../src/layout/stages/refine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkC5C;;+EAE+E;AAC/E,wBAAgB,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,CAQxE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { measureMono } from "../text-size.js";
|
|
2
1
|
import { measured } from "../measured.js";
|
|
3
2
|
import { placeAnnotations } from "./placement.js";
|
|
4
3
|
import { fixedAnnotations } from "./fixed-annotations.js";
|
|
@@ -8,11 +7,11 @@ function labels(map, measurer) {
|
|
|
8
7
|
const edges = Object.fromEntries(Object.entries(map.edges).map(([id, edge]) => {
|
|
9
8
|
if (!edge.label)
|
|
10
9
|
return [id, edge];
|
|
11
|
-
const previous = map.measurement?.labels[id] ?? measureMono(edge.label.text, style);
|
|
12
10
|
const size = measured(measurer.measure.bind(measurer), edge.label.text, {
|
|
13
11
|
...style,
|
|
14
12
|
edge: id,
|
|
15
13
|
});
|
|
14
|
+
const previous = map.measurement?.labels[id] ?? size;
|
|
16
15
|
const [x, y] = edge.label.at;
|
|
17
16
|
const at = [
|
|
18
17
|
x +
|
|
@@ -29,7 +28,7 @@ function labels(map, measurer) {
|
|
|
29
28
|
return { sizes, edges };
|
|
30
29
|
}
|
|
31
30
|
/** Re-measure text and place labels and numbers, keeping all fixed geometry.
|
|
32
|
-
*
|
|
31
|
+
* Authored anchors stay put until a previous measurement is available.
|
|
33
32
|
* No input is mutated; the checker measures independently of this metadata. */
|
|
34
33
|
export function refine(map, measurer) {
|
|
35
34
|
const text = labels(map, measurer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refine.js","sourceRoot":"","sources":["../../../src/layout/stages/refine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"refine.js","sourceRoot":"","sources":["../../../src/layout/stages/refine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM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AC,CAAC;oBACrC,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjD,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;SACtC,CAAC;QACF,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CACH,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;+EAE+E;AAC/E,MAAM,UAAU,MAAM,CAAC,GAAgB,EAAE,QAAkB;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG;QAClB,GAAG,GAAG;QACN,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE;QACxD,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC;IACF,OAAO,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ResolvedMap } from "../../schema.js";
|
|
2
2
|
import type { Measurer } from "../ports.js";
|
|
3
3
|
import type { LabelSize, LayoutPoint } from "../types.js";
|
|
4
|
-
import { measureMono } from "../text-size.js";
|
|
5
4
|
import { measured } from "../measured.js";
|
|
6
5
|
import { placeAnnotations } from "./placement.js";
|
|
7
6
|
import { fixedAnnotations } from "./fixed-annotations.js";
|
|
@@ -12,12 +11,11 @@ function labels(map: ResolvedMap, measurer: Measurer) {
|
|
|
12
11
|
const edges = Object.fromEntries(
|
|
13
12
|
Object.entries(map.edges).map(([id, edge]) => {
|
|
14
13
|
if (!edge.label) return [id, edge];
|
|
15
|
-
const previous =
|
|
16
|
-
map.measurement?.labels[id] ?? measureMono(edge.label.text, style);
|
|
17
14
|
const size = measured(measurer.measure.bind(measurer), edge.label.text, {
|
|
18
15
|
...style,
|
|
19
16
|
edge: id,
|
|
20
17
|
});
|
|
18
|
+
const previous = map.measurement?.labels[id] ?? size;
|
|
21
19
|
const [x, y] = edge.label.at;
|
|
22
20
|
const at: LayoutPoint = [
|
|
23
21
|
x +
|
|
@@ -36,7 +34,7 @@ function labels(map: ResolvedMap, measurer: Measurer) {
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
/** Re-measure text and place labels and numbers, keeping all fixed geometry.
|
|
39
|
-
*
|
|
37
|
+
* Authored anchors stay put until a previous measurement is available.
|
|
40
38
|
* No input is mutated; the checker measures independently of this metadata. */
|
|
41
39
|
export function refine(map: ResolvedMap, measurer: Measurer): ResolvedMap {
|
|
42
40
|
const text = labels(map, measurer);
|