@dxos/diagram 0.11.1 → 0.13.0
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/lib/chunk-parse.mjs +9396 -0
- package/dist/lib/chunk-parse.mjs.map +1 -0
- package/dist/lib/extension.mjs +204 -0
- package/dist/lib/extension.mjs.map +1 -0
- package/dist/lib/index.mjs +497 -2846
- package/dist/lib/index.mjs.map +1 -1
- package/dist/types/src/aesthetics.d.ts +12 -0
- package/dist/types/src/aesthetics.d.ts.map +1 -0
- package/dist/types/src/aesthetics.test.d.ts +2 -0
- package/dist/types/src/aesthetics.test.d.ts.map +1 -0
- package/dist/types/src/appeal.d.ts +55 -0
- package/dist/types/src/appeal.d.ts.map +1 -0
- package/dist/types/src/appeal.test.d.ts +2 -0
- package/dist/types/src/appeal.test.d.ts.map +1 -0
- package/dist/types/src/architecture.d.ts +86 -0
- package/dist/types/src/architecture.d.ts.map +1 -0
- package/dist/types/src/architecture.test.d.ts +2 -0
- package/dist/types/src/architecture.test.d.ts.map +1 -0
- package/dist/types/src/compact.d.ts +39 -0
- package/dist/types/src/compact.d.ts.map +1 -0
- package/dist/types/src/compact.test.d.ts +2 -0
- package/dist/types/src/compact.test.d.ts.map +1 -0
- package/dist/types/src/diagnostics.d.ts +70 -3
- package/dist/types/src/diagnostics.d.ts.map +1 -1
- package/dist/types/src/dsl/cli.d.ts +2 -0
- package/dist/types/src/dsl/cli.d.ts.map +1 -0
- package/dist/types/src/dsl/compile.d.ts +12 -0
- package/dist/types/src/dsl/compile.d.ts.map +1 -0
- package/dist/types/src/dsl/convert.d.ts +45 -0
- package/dist/types/src/dsl/convert.d.ts.map +1 -0
- package/dist/types/src/dsl/convert.test.d.ts +2 -0
- package/dist/types/src/dsl/convert.test.d.ts.map +1 -0
- package/dist/types/src/dsl/dsl.test.d.ts +2 -0
- package/dist/types/src/dsl/dsl.test.d.ts.map +1 -0
- package/dist/types/src/dsl/gen/diagram.d.ts +3 -0
- package/dist/types/src/dsl/gen/diagram.d.ts.map +1 -0
- package/dist/types/src/dsl/index.d.ts +7 -0
- package/dist/types/src/dsl/index.d.ts.map +1 -0
- package/dist/types/src/dsl/parse.d.ts +49 -0
- package/dist/types/src/dsl/parse.d.ts.map +1 -0
- package/dist/types/src/dsl/print.d.ts +19 -0
- package/dist/types/src/dsl/print.d.ts.map +1 -0
- package/dist/types/src/dsl/semantic.test.d.ts +2 -0
- package/dist/types/src/dsl/semantic.test.d.ts.map +1 -0
- package/dist/types/src/dsl/vocabulary.d.ts +61 -0
- package/dist/types/src/dsl/vocabulary.d.ts.map +1 -0
- package/dist/types/src/dx-svg.d.ts +12 -0
- package/dist/types/src/dx-svg.d.ts.map +1 -0
- package/dist/types/src/dx-svg.test.d.ts +2 -0
- package/dist/types/src/dx-svg.test.d.ts.map +1 -0
- package/dist/types/src/extension/complete.d.ts +3 -0
- package/dist/types/src/extension/complete.d.ts.map +1 -0
- package/dist/types/src/extension/extension.test.d.ts +2 -0
- package/dist/types/src/extension/extension.test.d.ts.map +1 -0
- package/dist/types/src/extension/highlight.d.ts +14 -0
- package/dist/types/src/extension/highlight.d.ts.map +1 -0
- package/dist/types/src/extension/index.d.ts +6 -0
- package/dist/types/src/extension/index.d.ts.map +1 -0
- package/dist/types/src/extension/language.d.ts +13 -0
- package/dist/types/src/extension/language.d.ts.map +1 -0
- package/dist/types/src/extension/lint.d.ts +21 -0
- package/dist/types/src/extension/lint.d.ts.map +1 -0
- package/dist/types/src/extension/syntax.d.ts +3 -0
- package/dist/types/src/extension/syntax.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +14 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/mermaid-engine.d.ts +40 -1
- package/dist/types/src/mermaid-engine.d.ts.map +1 -1
- package/dist/types/src/mermaid.d.ts +3 -3
- package/dist/types/src/mermaid.d.ts.map +1 -1
- package/dist/types/src/nudge.d.ts +30 -0
- package/dist/types/src/nudge.d.ts.map +1 -0
- package/dist/types/src/nudge.test.d.ts +2 -0
- package/dist/types/src/nudge.test.d.ts.map +1 -0
- package/dist/types/src/objective.d.ts +4 -0
- package/dist/types/src/objective.d.ts.map +1 -1
- package/dist/types/src/ortho-router.d.ts +13 -1
- package/dist/types/src/ortho-router.d.ts.map +1 -1
- package/dist/types/src/ports.d.ts +40 -0
- package/dist/types/src/ports.d.ts.map +1 -0
- package/dist/types/src/ports.test.d.ts +2 -0
- package/dist/types/src/ports.test.d.ts.map +1 -0
- package/dist/types/src/relations.test.d.ts +2 -0
- package/dist/types/src/relations.test.d.ts.map +1 -0
- package/dist/types/src/rules.d.ts +30 -0
- package/dist/types/src/rules.d.ts.map +1 -0
- package/dist/types/src/scene.d.ts +99 -65
- package/dist/types/src/scene.d.ts.map +1 -1
- package/dist/types/src/score.d.ts +54 -0
- package/dist/types/src/score.d.ts.map +1 -0
- package/dist/types/src/score.test.d.ts +2 -0
- package/dist/types/src/score.test.d.ts.map +1 -0
- package/dist/types/src/semantic-engine.d.ts +41 -0
- package/dist/types/src/semantic-engine.d.ts.map +1 -0
- package/dist/types/src/semantic-engine.test.d.ts +2 -0
- package/dist/types/src/semantic-engine.test.d.ts.map +1 -0
- package/dist/types/src/semantic-place.d.ts +81 -0
- package/dist/types/src/semantic-place.d.ts.map +1 -0
- package/dist/types/src/semantic-route.d.ts +133 -0
- package/dist/types/src/semantic-route.d.ts.map +1 -0
- package/dist/types/src/semantic.d.ts +164 -0
- package/dist/types/src/semantic.d.ts.map +1 -0
- package/dist/types/src/uml-grid.d.ts.map +1 -1
- package/dist/types/src/uml.d.ts +3 -5
- package/dist/types/src/uml.d.ts.map +1 -1
- package/dist/types/src/view.d.ts +53 -0
- package/dist/types/src/view.d.ts.map +1 -0
- package/dist/types/src/view.test.d.ts +2 -0
- package/dist/types/src/view.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -5
- package/rules/DIAGRAM.mdl +388 -0
- package/src/aesthetics.test.ts +89 -0
- package/src/aesthetics.ts +148 -0
- package/src/appeal.test.ts +144 -0
- package/src/appeal.ts +586 -0
- package/src/architecture.test.ts +94 -0
- package/src/architecture.ts +215 -0
- package/src/compact.test.ts +67 -0
- package/src/compact.ts +219 -0
- package/src/diagnostics.test.ts +207 -1
- package/src/diagnostics.ts +481 -37
- package/src/dsl/cli.ts +46 -0
- package/src/dsl/compile.ts +28 -0
- package/src/dsl/convert.test.ts +51 -0
- package/src/dsl/convert.ts +98 -0
- package/src/dsl/diagram.grammar +195 -0
- package/src/dsl/dsl.test.ts +286 -0
- package/src/dsl/gen/diagram.ts +22 -0
- package/src/dsl/index.ts +44 -0
- package/src/dsl/parse.ts +1054 -0
- package/src/dsl/print.ts +198 -0
- package/src/dsl/semantic.test.ts +200 -0
- package/src/dsl/vocabulary.ts +150 -0
- package/src/dx-svg.test.ts +44 -0
- package/src/dx-svg.ts +77 -0
- package/src/extension/complete.ts +105 -0
- package/src/extension/extension.test.ts +135 -0
- package/src/extension/highlight.ts +23 -0
- package/src/extension/index.ts +9 -0
- package/src/extension/language.ts +31 -0
- package/src/extension/lint.ts +60 -0
- package/src/extension/syntax.ts +62 -0
- package/src/index.ts +14 -0
- package/src/mermaid-engine.test.ts +6 -6
- package/src/mermaid-engine.ts +569 -119
- package/src/mermaid.test.ts +17 -1
- package/src/mermaid.ts +30 -18
- package/src/nudge.test.ts +155 -0
- package/src/nudge.ts +385 -0
- package/src/objective.test.ts +2 -0
- package/src/objective.ts +17 -1
- package/src/ortho-router.ts +240 -80
- package/src/ports.test.ts +157 -0
- package/src/ports.ts +186 -0
- package/src/relations.test.ts +98 -0
- package/src/rules.ts +117 -0
- package/src/scene.ts +64 -3
- package/src/score.test.ts +64 -0
- package/src/score.ts +130 -0
- package/src/semantic-engine.test.ts +635 -0
- package/src/semantic-engine.ts +888 -0
- package/src/semantic-place.ts +1508 -0
- package/src/semantic-route.ts +1136 -0
- package/src/semantic.ts +278 -0
- package/src/typings.d.ts +8 -0
- package/src/uml-grid.ts +6 -1
- package/src/uml.test.ts +5 -1
- package/src/uml.ts +24 -11
- package/src/view.test.ts +139 -0
- package/src/view.ts +376 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/scene.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,KAAK,sKAchB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/scene.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,KAAK,sKAchB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAErD,2GAA2G;AAC3G,eAAO,MAAM,IAAI,gEAAwD,CAAC;AAC1E,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnD,eAAO,MAAM,MAAM,oEAA4D,CAAC;AAChF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,MAAM,iDAAyC,CAAC;AAC7D,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,CAAC;AAEvD,eAAO,MAAM,KAAK;;;EAGhB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAC;AAcrD,iDAAiD;AACjD,eAAO,MAAM,OAAO,sEAA8D,CAAC;AACnF,M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eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIyE,CAAC;AAErG,eAAO,MAAM,cAAc;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,YAAY;;;EAGvB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;EAIrB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAyF,CAAC;AAC9G,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import type * as Objective from './objective.ts';
|
|
3
|
+
/** What produced a score; open so a host can add its own kinds of judge alongside the built-in ones. */
|
|
4
|
+
export type Kind = 'constraint' | 'cost' | (string & {});
|
|
5
|
+
export type Result = {
|
|
6
|
+
/** In [0, 1]: 0 is bad, 1 is good. Meaningless when `error` is set. */
|
|
7
|
+
score: number;
|
|
8
|
+
/** Why, in a line or two: the violations, or the raw measure behind a cost. */
|
|
9
|
+
detail?: string;
|
|
10
|
+
/** The scorer could not judge (e.g. its model was unreachable); left out of {@link overall}. */
|
|
11
|
+
error?: string;
|
|
12
|
+
};
|
|
13
|
+
export type Entry = {
|
|
14
|
+
id: string;
|
|
15
|
+
kind: Kind;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* One judge of a subject — by default the layout. An effect, so a judge that asks something outside the
|
|
20
|
+
* process can run late, be interrupted, and name what it needs in `R`.
|
|
21
|
+
*/
|
|
22
|
+
export type Scorer<S = Objective.Layout, R = never> = Entry & {
|
|
23
|
+
evaluate: (subject: S) => Effect.Effect<Result, never, R>;
|
|
24
|
+
};
|
|
25
|
+
/** Several scores from one evaluation, in `entries` order: for a judge that answers many questions per call. */
|
|
26
|
+
export type Batch<S = Objective.Layout, R = never> = {
|
|
27
|
+
entries: readonly Entry[];
|
|
28
|
+
evaluate: (subject: S) => Effect.Effect<readonly Result[], never, R>;
|
|
29
|
+
};
|
|
30
|
+
export type Source<S = Objective.Layout, R = never> = Scorer<S, R> | Batch<S, R>;
|
|
31
|
+
export type Scored = Result & Entry;
|
|
32
|
+
/**
|
|
33
|
+
* Weighted cost at which a cost term scores 0.5: one crossing's worth (see `Objective.crossings`), so
|
|
34
|
+
* "half marks" means "as bad as one crossing" on every term.
|
|
35
|
+
*/
|
|
36
|
+
export declare const HALF_COST = 3;
|
|
37
|
+
/** Maps a weighted cost in [0, ∞) onto (0, 1]: 1 at no cost, 0.5 at `half`, falling off hyperbolically. */
|
|
38
|
+
export declare const fromCost: (weighted: number, half?: number) => number;
|
|
39
|
+
/** A hard requirement: 1 when it holds, 0 when anything violates it. */
|
|
40
|
+
export declare const constraintScorer: (constraint: Objective.Constraint) => Scorer;
|
|
41
|
+
/** A soft preference: its weighted cost through {@link fromCost}. */
|
|
42
|
+
export declare const costScorer: (term: Objective.CostTerm, half?: number) => Scorer;
|
|
43
|
+
/** Every constraint and cost term of an objective, constraints first. */
|
|
44
|
+
export declare const fromObjective: (objective: Objective.Objective, half?: number) => Scorer[];
|
|
45
|
+
/** Runs every source against one subject concurrently; results keep the sources' order, batches flattened. */
|
|
46
|
+
export declare const evaluate: <S, R>(sources: readonly Source<S, R>[], subject: S) => Effect.Effect<Scored[], never, R>;
|
|
47
|
+
/**
|
|
48
|
+
* One number for a set of scores: the worst constraint gates the mean of everything else, so a
|
|
49
|
+
* layout that breaks a constraint scores 0 however good it otherwise is — the same precedence
|
|
50
|
+
* `Objective.select` gives violations over cost — while every other kind contributes equally.
|
|
51
|
+
* `undefined` when nothing could be judged, so a set of failed scorers never reads as a perfect score.
|
|
52
|
+
*/
|
|
53
|
+
export declare const overall: (all: readonly Pick<Scored, 'kind' | 'score' | 'error'>[]) => number | undefined;
|
|
54
|
+
//# sourceMappingURL=score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../../src/score.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAEjD,wGAAwG;AACxG,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEzD,MAAM,MAAM,MAAM,GAAG;IACnB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,IAAI,KAAK,GAAG;IAC5D,QAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;CAC3D,CAAC;AAEF,gHAAgH;AAChH,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,SA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F,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.test.d.ts","sourceRoot":"","sources":["../../../src/score.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as Diagnostics from './diagnostics.ts';
|
|
2
|
+
import * as MermaidEngine from './mermaid-engine.ts';
|
|
3
|
+
import * as Objective from './objective.ts';
|
|
4
|
+
import * as Scene from './scene.ts';
|
|
5
|
+
import * as Place from './semantic-place.ts';
|
|
6
|
+
import * as Semantic from './semantic.ts';
|
|
7
|
+
/** One box size for every node, from the longest label wrapped at the widest box. */
|
|
8
|
+
export declare const measureBox: (labels: readonly string[]) => Semantic.Size;
|
|
9
|
+
/** Cell pitch for a box: a box-wide gutter across, and room for two frame borders, a title and a gap down. */
|
|
10
|
+
export declare const pitchFor: (box: Semantic.Size) => Semantic.Size;
|
|
11
|
+
export type SolveOptions = {
|
|
12
|
+
/** Objective that picks among routed candidates (default: the layout objective plus appeal). */
|
|
13
|
+
objective?: Objective.Objective;
|
|
14
|
+
/** Placements to refine besides the search's own. */
|
|
15
|
+
seeds?: readonly Map<string, Place.Cell>[];
|
|
16
|
+
/** Complete layouts to compare against, such as the mermaid engine's. */
|
|
17
|
+
alternatives?: readonly Scene.Command[][];
|
|
18
|
+
/** Independent placement searches (default 6). */
|
|
19
|
+
restarts?: number;
|
|
20
|
+
/** Routes the mermaid engine's candidates off the thread; see `MermaidEngine.CompileOptions`. */
|
|
21
|
+
emitCandidate?: MermaidEngine.CompileOptions['emitCandidate'];
|
|
22
|
+
};
|
|
23
|
+
export type Solution = {
|
|
24
|
+
commands: Scene.Command[];
|
|
25
|
+
issues: Semantic.Issue[];
|
|
26
|
+
report: Diagnostics.Report;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Groups whose frame spans a whole column or row with none of their members in it, each blamed on
|
|
30
|
+
* a relation tying a member to a node outside the group, which is what pulls the members apart.
|
|
31
|
+
*/
|
|
32
|
+
export declare const stretchIssues: (diagram: Semantic.Diagram, cells: Map<string, Place.Cell>) => Semantic.Issue[];
|
|
33
|
+
/** Lays out a semantic diagram synchronously with the grid search alone. */
|
|
34
|
+
export declare const solve: (source: Semantic.Diagram, options?: SolveOptions) => Solution;
|
|
35
|
+
/**
|
|
36
|
+
* Lays out a semantic diagram, also trying the mermaid engine's search when nothing was hinted:
|
|
37
|
+
* its placements seed the grid search and its own layout competes as a candidate. Async because
|
|
38
|
+
* ELK is; an engine failure only removes those candidates.
|
|
39
|
+
*/
|
|
40
|
+
export declare const compile: (source: Semantic.Diagram, options?: SolveOptions) => Promise<Solution>;
|
|
41
|
+
//# sourceMappingURL=semantic-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-engine.d.ts","sourceRoot":"","sources":["../../../src/semantic-engine.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,qBAAqB,CAAC;AAE7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AA2B1C,qFAAqF;AACrF,eAAO,MAAM,UAAU,WAAY,SAAS,MAAM,EAAE,KAAG,QAAQ,CAAC,IAO/D,CAAC;AAEF,8GAA8G;AAC9G,eAAO,MAAM,QAAQ,QAAS,QAAQ,CAAC,IAAI,KAAG,QAAQ,CAAC,IAGrD,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,gGAAgG;IAChG,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC;IAChC,qDAAqD;IACrD,KAAK,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;IAC3C,yEAAyE;IACzE,YAAY,CAAC,EAAE,SAAS,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IAC1C,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,aAAa,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC1B,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;CAC5B,CAAC;AAuoBF;;;GAGG;AACH,eAAO,MAAM,aAAa,YAAa,QAAQ,CAAC,OAAO,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,KAAG,QAAQ,CAAC,KAAK,EAgCpG,CAAC;AAEL,4EAA4E;AAC5E,eAAO,MAAM,KAAK,WAAY,QAAQ,CAAC,OAAO,YAAW,YAAY,KAAQ,QA0C5E,CAAC;AAsDF;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAkB,QAAQ,CAAC,OAAO,YAAW,YAAY,KAAQ,OAAO,CAAC,QAAQ,CAmBpG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-engine.test.d.ts","sourceRoot":"","sources":["../../../src/semantic-engine.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type * as Semantic from './semantic.ts';
|
|
2
|
+
export type Cell = {
|
|
3
|
+
col: number;
|
|
4
|
+
row: number;
|
|
5
|
+
};
|
|
6
|
+
export type PlaceNode = {
|
|
7
|
+
id: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
pin?: Cell;
|
|
10
|
+
};
|
|
11
|
+
export type PlaceRelation = {
|
|
12
|
+
from: string;
|
|
13
|
+
kind: Semantic.RelationKind;
|
|
14
|
+
target: string;
|
|
15
|
+
soft: boolean;
|
|
16
|
+
/** Cost of breaking a soft relation, in place of the default. */
|
|
17
|
+
weight?: number;
|
|
18
|
+
};
|
|
19
|
+
export type PlaceEdge = {
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
sides?: {
|
|
23
|
+
start?: readonly Semantic.Side[];
|
|
24
|
+
end?: readonly Semantic.Side[];
|
|
25
|
+
};
|
|
26
|
+
/** The target is an abstraction that reads best against the flow, above its subtypes. */
|
|
27
|
+
upward?: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** How a group may be shaped: at most `maxWidth` columns, and near-square when `compact`. */
|
|
30
|
+
export type GroupShape = {
|
|
31
|
+
maxWidth?: number;
|
|
32
|
+
compact?: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type PlaceInput = {
|
|
35
|
+
nodes: readonly PlaceNode[];
|
|
36
|
+
/** Group ids in declaration order. */
|
|
37
|
+
groups: readonly string[];
|
|
38
|
+
/** Shape limits by group id. */
|
|
39
|
+
shapes?: ReadonlyMap<string, GroupShape>;
|
|
40
|
+
/** Preferred columns over rows of the whole placement. */
|
|
41
|
+
aspect?: number;
|
|
42
|
+
/** Node relations; `from` and `target` are node ids. */
|
|
43
|
+
relations: readonly PlaceRelation[];
|
|
44
|
+
/** Group relations; `from` and `target` are group ids. */
|
|
45
|
+
groupRelations: readonly PlaceRelation[];
|
|
46
|
+
edges: readonly PlaceEdge[];
|
|
47
|
+
flow: Semantic.Flow;
|
|
48
|
+
/** Box half-extent as a fraction of the cell pitch, for the edge-through-box test. */
|
|
49
|
+
box?: {
|
|
50
|
+
x: number;
|
|
51
|
+
y: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export type PlaceOptions = {
|
|
55
|
+
/** Independent searches from different random seeds (default 6). */
|
|
56
|
+
restarts?: number;
|
|
57
|
+
/** Starting placements to refine besides the greedy ones (e.g. a layered engine's). */
|
|
58
|
+
seeds?: readonly Map<string, Cell>[];
|
|
59
|
+
/** How many distinct placements to return, best first (default 3). */
|
|
60
|
+
keep?: number;
|
|
61
|
+
};
|
|
62
|
+
export type Placed = {
|
|
63
|
+
cells: Map<string, Cell>;
|
|
64
|
+
cost: number;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Fewest bends an orthogonal route takes from side `start` of a box to side `end` of another box
|
|
68
|
+
* displaced by (dx, dy) cells, ignoring every other box: the template the router will try first.
|
|
69
|
+
*/
|
|
70
|
+
export declare const templateBends: (dx: number, dy: number, start: Semantic.Side, end: Semantic.Side) => number;
|
|
71
|
+
/** Hard relations the placement could not satisfy, as indices into `input.relations` and `input.groupRelations`. */
|
|
72
|
+
export declare const unmet: (input: PlaceInput, cells: Map<string, Cell>) => {
|
|
73
|
+
relations: number[];
|
|
74
|
+
groupRelations: number[];
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Places every node on the grid. Returns up to `keep` distinct placements, best first, so the caller
|
|
78
|
+
* can route each and let the real measurements choose.
|
|
79
|
+
*/
|
|
80
|
+
export declare const place: (input: PlaceInput, { restarts, seeds, keep }?: PlaceOptions) => Placed[];
|
|
81
|
+
//# sourceMappingURL=semantic-place.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-place.d.ts","sourceRoot":"","sources":["../../../src/semantic-place.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE/C,MAAM,MAAM,IAAI,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC;IAC5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,uFAAuF;IACvF,KAAK,CAAC,EAAE,SAAS,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;IACrC,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AA4LhE;;;GAGG;AACH,eAAO,MAAM,aAAa,OAAQ,MAAM,MAAM,MAAM,SAAS,QAAQ,CAAC,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAG,MAchG,CAAC;AA6mCF,oHAAoH;AACpH,eAAO,MAAM,KAAK,UACT,UAAU,SACV,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KACvB;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAwBjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,KAAK,UAAW,UAAU,8BAA0C,YAAY,KAAQ,MAAM,EAmE1G,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type * as Scene from './scene.ts';
|
|
2
|
+
import { type Side } from './semantic.ts';
|
|
3
|
+
import { type Rect } from './uml-grid.ts';
|
|
4
|
+
type Point = Scene.Point;
|
|
5
|
+
/** One end of a connector: a box (zero-sized for a bus junction), the sides it may use, and a fixed port. */
|
|
6
|
+
export type End = {
|
|
7
|
+
rect: Rect;
|
|
8
|
+
/** Key of the box, for port bookkeeping; undefined for a junction. */
|
|
9
|
+
node?: string;
|
|
10
|
+
sides: readonly Side[];
|
|
11
|
+
/** Sides the author prefers among `sides`; any other costs extra. */
|
|
12
|
+
preferred?: readonly Side[];
|
|
13
|
+
/** Fixed coordinate along the side. */
|
|
14
|
+
port?: number;
|
|
15
|
+
};
|
|
16
|
+
/** A waypoint in scene units: one coordinate pins that axis of the route, both pin a point. */
|
|
17
|
+
export type Waypoint = {
|
|
18
|
+
x?: number;
|
|
19
|
+
y?: number;
|
|
20
|
+
};
|
|
21
|
+
export type Piece = {
|
|
22
|
+
/** Connector id; pieces of one bus share a `bus` key and may touch. */
|
|
23
|
+
id: string;
|
|
24
|
+
bus?: string;
|
|
25
|
+
start: End;
|
|
26
|
+
end: End;
|
|
27
|
+
via: readonly Waypoint[];
|
|
28
|
+
points: Point[];
|
|
29
|
+
startSide?: Side;
|
|
30
|
+
endSide?: Side;
|
|
31
|
+
/** Drawn by the A* fallback, which ignores sides and waypoints. */
|
|
32
|
+
forced?: boolean;
|
|
33
|
+
/** Rank of the connector's relation; the highest on a shared side takes its centre. */
|
|
34
|
+
significance?: number;
|
|
35
|
+
};
|
|
36
|
+
export type Context = {
|
|
37
|
+
/** Every box a route must not cross. */
|
|
38
|
+
obstacles: readonly Rect[];
|
|
39
|
+
/** Text a route should avoid (frame titles). */
|
|
40
|
+
avoid: readonly Rect[];
|
|
41
|
+
/** Channel coordinates: x of vertical gutters, y of horizontal ones. */
|
|
42
|
+
channels: {
|
|
43
|
+
xs: readonly number[];
|
|
44
|
+
ys: readonly number[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const portPoint: (rect: Rect, side: Side, coord: number) => Point;
|
|
48
|
+
/** Drops repeated points and collinear midpoints; undefined when the path doubles back on itself. */
|
|
49
|
+
export declare const simplify: (points: readonly Point[]) => Point[] | undefined;
|
|
50
|
+
export declare const bendsOf: (points: readonly Point[]) => number;
|
|
51
|
+
/** A run of a route; `docked` marks an end that sits on a box port, where routes meet by design. */
|
|
52
|
+
type Segment = {
|
|
53
|
+
owner: string;
|
|
54
|
+
bus?: string;
|
|
55
|
+
pair?: string;
|
|
56
|
+
from: Point;
|
|
57
|
+
to: Point;
|
|
58
|
+
docked: [boolean, boolean];
|
|
59
|
+
/** The piece's ports on boxes. */
|
|
60
|
+
ports: readonly Point[];
|
|
61
|
+
};
|
|
62
|
+
/** Ports already taken, per box side, by role: an exit beside an entry reads as a crossing. */
|
|
63
|
+
type Terminals = Map<string, {
|
|
64
|
+
owner: string;
|
|
65
|
+
role: 'exit' | 'entry';
|
|
66
|
+
}[]>;
|
|
67
|
+
type Best = {
|
|
68
|
+
points: Point[];
|
|
69
|
+
startSide: Side;
|
|
70
|
+
endSide: Side;
|
|
71
|
+
cost: number;
|
|
72
|
+
};
|
|
73
|
+
/** The cheapest valid route for a piece over its allowed sides; undefined when no shape fits. */
|
|
74
|
+
export declare const bestRoute: (piece: {
|
|
75
|
+
id: string;
|
|
76
|
+
bus?: string;
|
|
77
|
+
start: End;
|
|
78
|
+
end: End;
|
|
79
|
+
via: readonly Waypoint[];
|
|
80
|
+
}, others: readonly Segment[], terminals: Terminals, context: Context) => Best | undefined;
|
|
81
|
+
/** A bus to route: a hub, its spokes, and the pieces that will be drawn once a junction is chosen. */
|
|
82
|
+
export type BusRequest = {
|
|
83
|
+
id: string;
|
|
84
|
+
hub: End;
|
|
85
|
+
spokes: {
|
|
86
|
+
id: string;
|
|
87
|
+
end: End;
|
|
88
|
+
}[];
|
|
89
|
+
direction: 'in' | 'out';
|
|
90
|
+
significance?: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Routes every piece and bus. Pieces with fewer possible bends go first, so straight neighbours
|
|
94
|
+
* claim their direct runs before a long edge looks for a channel.
|
|
95
|
+
*/
|
|
96
|
+
export declare const routeAll: (pieces: readonly Piece[], buses: readonly BusRequest[], context: Context) => Piece[];
|
|
97
|
+
/**
|
|
98
|
+
* Spreads the ports on every side that several pieces share, in the order their routes leave it,
|
|
99
|
+
* keeping straight pieces straight; returns the pieces with fixed sides and ports to re-route.
|
|
100
|
+
*/
|
|
101
|
+
export declare const spreadPorts: (pieces: readonly Piece[]) => Piece[];
|
|
102
|
+
/** Re-routes pieces whose sides and ports are now fixed; a piece no shape can draw keeps its old route. */
|
|
103
|
+
export declare const reroute: (fixed: readonly Piece[], previous: readonly Piece[], context: Context) => Piece[];
|
|
104
|
+
/** Separates parallel runs; bus pieces stay put, since they meet on purpose. */
|
|
105
|
+
export declare const separate: (pieces: readonly Piece[], context: Context) => Piece[];
|
|
106
|
+
export type LabelRequest = {
|
|
107
|
+
id: string;
|
|
108
|
+
text: string;
|
|
109
|
+
points: readonly Point[];
|
|
110
|
+
/** A trunk the route shares with others, where its label goes only when its own runs have no room. */
|
|
111
|
+
shared?: readonly Point[];
|
|
112
|
+
};
|
|
113
|
+
export type LabelOptions = {
|
|
114
|
+
/** Every drawn route, the label's own among them. */
|
|
115
|
+
paths: readonly (readonly Point[])[];
|
|
116
|
+
boxes: readonly Rect[];
|
|
117
|
+
/** Text already on the drawing (frame titles). */
|
|
118
|
+
avoid: readonly Rect[];
|
|
119
|
+
/** Group frames, whose dashed borders a label must not sit on. */
|
|
120
|
+
frames?: readonly Rect[];
|
|
121
|
+
bounds: Rect;
|
|
122
|
+
};
|
|
123
|
+
/** Whether a rect straddles a frame's border, rather than lying wholly inside or outside it. */
|
|
124
|
+
export declare const onBorder: (rect: Rect, frame: Rect, clearance?: number) => boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Each label beside a run of its own route, nearer that route than any other, and clear of boxes,
|
|
127
|
+
* other labels, other routes, frame borders and frame titles: the longest run first, its middle
|
|
128
|
+
* first, above a horizontal run or right of a vertical one (where the text starts at the line).
|
|
129
|
+
* When nothing is clear, the least-cluttered spot wins.
|
|
130
|
+
*/
|
|
131
|
+
export declare const placeLabels: (labels: readonly LabelRequest[], options: LabelOptions) => Scene.Text[];
|
|
132
|
+
export {};
|
|
133
|
+
//# sourceMappingURL=semantic-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-route.d.ts","sourceRoot":"","sources":["../../../src/semantic-route.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,IAAI,EAAS,MAAM,eAAe,CAAC;AACjD,OAAO,EAAQ,KA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M,QAAQ,SAAU,IAAI,SAAS,IAAI,yBAAsB,OAGrE,CAAC;AAKF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WAAY,SAAS,YAAY,EAAE,WAAW,YAAY,KAAG,KAAK,CAAC,IAAI,EA+G9F,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import type * as Scene from './scene.ts';
|
|
2
|
+
export type Range = {
|
|
3
|
+
from: number;
|
|
4
|
+
to: number;
|
|
5
|
+
};
|
|
6
|
+
/** A problem the engine found in the intent, with the source range it belongs to. */
|
|
7
|
+
export type Issue = Range & {
|
|
8
|
+
severity: 'error' | 'warning';
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
11
|
+
export type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
12
|
+
export declare const SIDES: readonly Side[];
|
|
13
|
+
/** Which way edges should read; the placement prefers targets on this side of their sources. */
|
|
14
|
+
export type Flow = 'down' | 'up' | 'right' | 'left';
|
|
15
|
+
export declare const FLOWS: readonly Flow[];
|
|
16
|
+
export type RelationKind = 'right-of' | 'left-of' | 'above' | 'below' | 'same-row' | 'same-col';
|
|
17
|
+
export declare const RELATION_KINDS: readonly RelationKind[];
|
|
18
|
+
/** `right-of X`: same row as X and to its right; `~` makes it a preference instead of a rule. */
|
|
19
|
+
export type Relation = {
|
|
20
|
+
kind: RelationKind;
|
|
21
|
+
target: string;
|
|
22
|
+
soft: boolean;
|
|
23
|
+
range: Range;
|
|
24
|
+
};
|
|
25
|
+
/** `@ x,y` pins the box's top-left exactly, in scene units; `@cell(c,r)` pins its grid cell. */
|
|
26
|
+
export type Pin = ({
|
|
27
|
+
kind: 'point';
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'cell';
|
|
32
|
+
col: number;
|
|
33
|
+
row: number;
|
|
34
|
+
}) & {
|
|
35
|
+
range: Range;
|
|
36
|
+
};
|
|
37
|
+
export type Node = {
|
|
38
|
+
id: string;
|
|
39
|
+
label: string;
|
|
40
|
+
group?: string;
|
|
41
|
+
ref?: string;
|
|
42
|
+
pin?: Pin;
|
|
43
|
+
relations: Relation[];
|
|
44
|
+
shape?: Scene.BoxKind;
|
|
45
|
+
color?: Scene.Color;
|
|
46
|
+
fill?: Scene.Fill;
|
|
47
|
+
stroke?: Scene.Stroke;
|
|
48
|
+
range: Range;
|
|
49
|
+
};
|
|
50
|
+
export type Group = {
|
|
51
|
+
id: string;
|
|
52
|
+
label: string;
|
|
53
|
+
relations: Relation[];
|
|
54
|
+
/** Extra clear space, in scene units, between this group and the groups it is placed relative to. */
|
|
55
|
+
gap?: number;
|
|
56
|
+
/** Most columns the group may span. */
|
|
57
|
+
maxWidth?: number;
|
|
58
|
+
/** Keep the group near-square rather than a strip. */
|
|
59
|
+
compact?: boolean;
|
|
60
|
+
color?: Scene.Color;
|
|
61
|
+
range: Range;
|
|
62
|
+
};
|
|
63
|
+
/** One coordinate or both; `cell` units are grid cells, where `n.5` is the channel after cell `n`. */
|
|
64
|
+
export type Waypoint = {
|
|
65
|
+
x?: number;
|
|
66
|
+
y?: number;
|
|
67
|
+
unit: 'scene' | 'cell';
|
|
68
|
+
range: Range;
|
|
69
|
+
};
|
|
70
|
+
/** One end of an edge; `soft` makes its sides a preference the router weighs instead of a rule. */
|
|
71
|
+
export type End = {
|
|
72
|
+
node: string;
|
|
73
|
+
sides?: readonly Side[];
|
|
74
|
+
soft?: boolean;
|
|
75
|
+
range: Range;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Relationship words an edge may use in place of `->`, each naming the scene relation it draws.
|
|
79
|
+
* The left end is the subtype, the whole, the owner, or the one side.
|
|
80
|
+
*/
|
|
81
|
+
export declare const RELATIONSHIPS: Readonly<Record<string, Scene.Relation>>;
|
|
82
|
+
/** The id of the scene object that holds every connector, so no node or group may take it. */
|
|
83
|
+
export declare const CONNECTORS = "edges";
|
|
84
|
+
/** Relations whose target is the abstraction, which reads best above its subtypes. */
|
|
85
|
+
export declare const pointsUp: (relation: Scene.Relation | undefined) => boolean;
|
|
86
|
+
/**
|
|
87
|
+
* How strongly a connector's relation shapes the reading of a diagram, highest first; on a box face
|
|
88
|
+
* shared by several connectors the most significant takes the centre.
|
|
89
|
+
*/
|
|
90
|
+
export declare const SIGNIFICANCE: Readonly<Record<Scene.Relation, number>>;
|
|
91
|
+
/** The significance of an edge's relation; an untyped dashed edge reads as a dependency. */
|
|
92
|
+
export declare const significance: (relation: Scene.Relation | undefined, stroke?: Scene.Stroke) => number;
|
|
93
|
+
export type EdgeStyle = {
|
|
94
|
+
relation?: Scene.Relation;
|
|
95
|
+
head?: Scene.ArrowHead;
|
|
96
|
+
tail?: Scene.ArrowTail;
|
|
97
|
+
stroke?: Scene.Stroke;
|
|
98
|
+
color?: Scene.Color;
|
|
99
|
+
};
|
|
100
|
+
export type Edge = EdgeStyle & {
|
|
101
|
+
/** Scene id of the connector, unique in the diagram. */
|
|
102
|
+
id: string;
|
|
103
|
+
from: End;
|
|
104
|
+
to: End;
|
|
105
|
+
label?: string;
|
|
106
|
+
via: readonly Waypoint[];
|
|
107
|
+
/** Edges with the same bus key and hub share one trunk. */
|
|
108
|
+
bus?: string;
|
|
109
|
+
range: Range;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Edges merged into one trunk: the hub end is shared, each spoke ends at its own node. `out` fans
|
|
113
|
+
* from the hub to the spokes, `in` gathers the spokes into the hub.
|
|
114
|
+
*/
|
|
115
|
+
export type Bus = {
|
|
116
|
+
id: string;
|
|
117
|
+
hub: End;
|
|
118
|
+
direction: 'out' | 'in';
|
|
119
|
+
edges: readonly Edge[];
|
|
120
|
+
/** Text on the trunk, from a multi-target statement's label. */
|
|
121
|
+
label?: string;
|
|
122
|
+
/** Gathered by relation rather than by a `bus` statement, so the router may still split it. */
|
|
123
|
+
implicit?: boolean;
|
|
124
|
+
};
|
|
125
|
+
export type Size = {
|
|
126
|
+
w: number;
|
|
127
|
+
h: number;
|
|
128
|
+
};
|
|
129
|
+
export type Diagram = {
|
|
130
|
+
flow: Flow;
|
|
131
|
+
origin: Scene.Point;
|
|
132
|
+
/** Cell pitch (box plus gutter), in scene units; measured from the boxes when absent. */
|
|
133
|
+
grid?: Size;
|
|
134
|
+
/** Box size; measured from the longest label when absent. */
|
|
135
|
+
box?: Size;
|
|
136
|
+
/** Preferred width over height of the whole drawing. */
|
|
137
|
+
aspect?: number;
|
|
138
|
+
nodes: Node[];
|
|
139
|
+
groups: Group[];
|
|
140
|
+
edges: Edge[];
|
|
141
|
+
/** Trunk labels by bus key (`<hub>|<name>|<direction>`), from multi-target statements. */
|
|
142
|
+
busLabels: Map<string, string>;
|
|
143
|
+
/** Whether any statement said how to place or route — when none did, the mermaid engine's search is also tried. */
|
|
144
|
+
hinted: boolean;
|
|
145
|
+
};
|
|
146
|
+
export declare const empty: () => Diagram;
|
|
147
|
+
/** The key edges share a trunk under. */
|
|
148
|
+
export declare const busKey: (hub: string, name: string, direction: Bus['direction']) => string;
|
|
149
|
+
/**
|
|
150
|
+
* The implicit bus key of an inheritance edge: subtypes of one abstraction share a trunk into it,
|
|
151
|
+
* unless the author routed the edge by hand.
|
|
152
|
+
*/
|
|
153
|
+
export declare const inheritanceKey: (edge: Edge) => string | undefined;
|
|
154
|
+
/** The edges grouped into buses (two or more edges with one key) and the rest. */
|
|
155
|
+
export declare const buses: (diagram: Diagram) => {
|
|
156
|
+
buses: Bus[];
|
|
157
|
+
single: Edge[];
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* The diagram as a mermaid flowchart, for the engine's own search when nothing was hinted; undefined
|
|
161
|
+
* when an id or label cannot be written in the mermaid subset.
|
|
162
|
+
*/
|
|
163
|
+
export declare const toMermaid: (diagram: Diagram) => string | undefined;
|
|
164
|
+
//# sourceMappingURL=semantic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../../src/semantic.ts"],"names":[],"m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EF;;;;GAIG;AACH,eAAO,MAAM,OAAO,WAAY,MAAM,YAAW,cAAc,KAAQ,KAAK,CAAC,OAAO,EAmCnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,kCACgB,SAAS,6BACO,WAAW,KACzD,KAAK,CAAC,OAAO,EAsPf,CAAC"}
|
package/dist/types/src/uml.d.ts
CHANGED
|
@@ -25,11 +25,9 @@ export type UmlModel = {
|
|
|
25
25
|
};
|
|
26
26
|
/** Parse a mermaid class diagram into a neutral model. Unrecognised lines are ignored. */
|
|
27
27
|
export declare const parse: (source: string) => UmlModel;
|
|
28
|
-
/** Arrow styling per relation kind; dependency and realization
|
|
29
|
-
export declare const relationStyle: (kind: RelationKind) =>
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
/** Mid-arrow label: cardinalities and the diamond glyph UML puts at the whole end. */
|
|
28
|
+
/** Arrow styling per relation kind: the scene relation sets the markers; dependency and realization dash, as in UML. */
|
|
29
|
+
export declare const relationStyle: (kind: RelationKind) => Pick<Scene.Arrow, 'relation' | 'stroke'>;
|
|
30
|
+
/** Mid-arrow label: the cardinalities around the label; the diamond at the whole end is a marker now. */
|
|
33
31
|
export declare const relationText: (relation: UmlRelation) => string | undefined;
|
|
34
32
|
/**
|
|
35
33
|
* Rank so arrows read upward where UML convention points at abstractions — inheritance,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uml.d.ts","sourceRoot":"","sources":["../../../src/uml.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;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import type * as Scene from './scene.ts';
|
|
2
|
+
type Point = Scene.Point;
|
|
3
|
+
type Rect = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
w: number;
|
|
7
|
+
h: number;
|
|
8
|
+
};
|
|
9
|
+
export type Box = {
|
|
10
|
+
ref: string;
|
|
11
|
+
label?: string;
|
|
12
|
+
rect: Rect;
|
|
13
|
+
frame: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type Path = {
|
|
16
|
+
ref: string;
|
|
17
|
+
points: Point[];
|
|
18
|
+
label?: string;
|
|
19
|
+
from?: Box;
|
|
20
|
+
to?: Box;
|
|
21
|
+
/** The arrow's end markers and line style, when not a plain solid arrow. */
|
|
22
|
+
style?: Pick<Scene.Arrow, 'head' | 'tail' | 'stroke'>;
|
|
23
|
+
};
|
|
24
|
+
export type Drawing = {
|
|
25
|
+
boxes: Box[];
|
|
26
|
+
paths: Path[];
|
|
27
|
+
bounds: Rect;
|
|
28
|
+
};
|
|
29
|
+
/** Boxes, frames and connector paths in absolute coordinates, each path resolved to the boxes at its ends. */
|
|
30
|
+
export declare const extract: (objects: readonly Scene.WorldObject[]) => Drawing;
|
|
31
|
+
/**
|
|
32
|
+
* Every box, frame and connector with its position in grid cells from the top-left corner (x right,
|
|
33
|
+
* y down): what a person reads off the picture as "where", in numbers.
|
|
34
|
+
*/
|
|
35
|
+
export declare const coordinates: (objects: readonly Scene.WorldObject[], cell?: number) => string;
|
|
36
|
+
/**
|
|
37
|
+
* The drawing in words, as a reader scans it: boxes row by row from the top, left to right, then each
|
|
38
|
+
* arrow with the way it runs across the page and the rows it spans.
|
|
39
|
+
*/
|
|
40
|
+
export declare const rows: (objects: readonly Scene.WorldObject[]) => string;
|
|
41
|
+
export type AsciiOptions = {
|
|
42
|
+
/** Scene units per column; small enough that a box's label fits inside it. */
|
|
43
|
+
column?: number;
|
|
44
|
+
/** Scene units per row. */
|
|
45
|
+
row?: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The drawing rasterized onto a character grid: boxes with their labels, dashed group frames, routed
|
|
49
|
+
* connectors with corners and junctions, and an arrowhead where each connector ends.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ascii: (objects: readonly Scene.WorldObject[], { column, row }?: AsciiOptions) => string;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=view.d.ts.map
|