@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.
Files changed (171) hide show
  1. package/dist/lib/chunk-parse.mjs +9396 -0
  2. package/dist/lib/chunk-parse.mjs.map +1 -0
  3. package/dist/lib/extension.mjs +204 -0
  4. package/dist/lib/extension.mjs.map +1 -0
  5. package/dist/lib/index.mjs +497 -2846
  6. package/dist/lib/index.mjs.map +1 -1
  7. package/dist/types/src/aesthetics.d.ts +12 -0
  8. package/dist/types/src/aesthetics.d.ts.map +1 -0
  9. package/dist/types/src/aesthetics.test.d.ts +2 -0
  10. package/dist/types/src/aesthetics.test.d.ts.map +1 -0
  11. package/dist/types/src/appeal.d.ts +55 -0
  12. package/dist/types/src/appeal.d.ts.map +1 -0
  13. package/dist/types/src/appeal.test.d.ts +2 -0
  14. package/dist/types/src/appeal.test.d.ts.map +1 -0
  15. package/dist/types/src/architecture.d.ts +86 -0
  16. package/dist/types/src/architecture.d.ts.map +1 -0
  17. package/dist/types/src/architecture.test.d.ts +2 -0
  18. package/dist/types/src/architecture.test.d.ts.map +1 -0
  19. package/dist/types/src/compact.d.ts +39 -0
  20. package/dist/types/src/compact.d.ts.map +1 -0
  21. package/dist/types/src/compact.test.d.ts +2 -0
  22. package/dist/types/src/compact.test.d.ts.map +1 -0
  23. package/dist/types/src/diagnostics.d.ts +70 -3
  24. package/dist/types/src/diagnostics.d.ts.map +1 -1
  25. package/dist/types/src/dsl/cli.d.ts +2 -0
  26. package/dist/types/src/dsl/cli.d.ts.map +1 -0
  27. package/dist/types/src/dsl/compile.d.ts +12 -0
  28. package/dist/types/src/dsl/compile.d.ts.map +1 -0
  29. package/dist/types/src/dsl/convert.d.ts +45 -0
  30. package/dist/types/src/dsl/convert.d.ts.map +1 -0
  31. package/dist/types/src/dsl/convert.test.d.ts +2 -0
  32. package/dist/types/src/dsl/convert.test.d.ts.map +1 -0
  33. package/dist/types/src/dsl/dsl.test.d.ts +2 -0
  34. package/dist/types/src/dsl/dsl.test.d.ts.map +1 -0
  35. package/dist/types/src/dsl/gen/diagram.d.ts +3 -0
  36. package/dist/types/src/dsl/gen/diagram.d.ts.map +1 -0
  37. package/dist/types/src/dsl/index.d.ts +7 -0
  38. package/dist/types/src/dsl/index.d.ts.map +1 -0
  39. package/dist/types/src/dsl/parse.d.ts +49 -0
  40. package/dist/types/src/dsl/parse.d.ts.map +1 -0
  41. package/dist/types/src/dsl/print.d.ts +19 -0
  42. package/dist/types/src/dsl/print.d.ts.map +1 -0
  43. package/dist/types/src/dsl/semantic.test.d.ts +2 -0
  44. package/dist/types/src/dsl/semantic.test.d.ts.map +1 -0
  45. package/dist/types/src/dsl/vocabulary.d.ts +61 -0
  46. package/dist/types/src/dsl/vocabulary.d.ts.map +1 -0
  47. package/dist/types/src/dx-svg.d.ts +12 -0
  48. package/dist/types/src/dx-svg.d.ts.map +1 -0
  49. package/dist/types/src/dx-svg.test.d.ts +2 -0
  50. package/dist/types/src/dx-svg.test.d.ts.map +1 -0
  51. package/dist/types/src/extension/complete.d.ts +3 -0
  52. package/dist/types/src/extension/complete.d.ts.map +1 -0
  53. package/dist/types/src/extension/extension.test.d.ts +2 -0
  54. package/dist/types/src/extension/extension.test.d.ts.map +1 -0
  55. package/dist/types/src/extension/highlight.d.ts +14 -0
  56. package/dist/types/src/extension/highlight.d.ts.map +1 -0
  57. package/dist/types/src/extension/index.d.ts +6 -0
  58. package/dist/types/src/extension/index.d.ts.map +1 -0
  59. package/dist/types/src/extension/language.d.ts +13 -0
  60. package/dist/types/src/extension/language.d.ts.map +1 -0
  61. package/dist/types/src/extension/lint.d.ts +21 -0
  62. package/dist/types/src/extension/lint.d.ts.map +1 -0
  63. package/dist/types/src/extension/syntax.d.ts +3 -0
  64. package/dist/types/src/extension/syntax.d.ts.map +1 -0
  65. package/dist/types/src/index.d.ts +14 -0
  66. package/dist/types/src/index.d.ts.map +1 -1
  67. package/dist/types/src/mermaid-engine.d.ts +40 -1
  68. package/dist/types/src/mermaid-engine.d.ts.map +1 -1
  69. package/dist/types/src/mermaid.d.ts +3 -3
  70. package/dist/types/src/mermaid.d.ts.map +1 -1
  71. package/dist/types/src/nudge.d.ts +30 -0
  72. package/dist/types/src/nudge.d.ts.map +1 -0
  73. package/dist/types/src/nudge.test.d.ts +2 -0
  74. package/dist/types/src/nudge.test.d.ts.map +1 -0
  75. package/dist/types/src/objective.d.ts +4 -0
  76. package/dist/types/src/objective.d.ts.map +1 -1
  77. package/dist/types/src/ortho-router.d.ts +13 -1
  78. package/dist/types/src/ortho-router.d.ts.map +1 -1
  79. package/dist/types/src/ports.d.ts +40 -0
  80. package/dist/types/src/ports.d.ts.map +1 -0
  81. package/dist/types/src/ports.test.d.ts +2 -0
  82. package/dist/types/src/ports.test.d.ts.map +1 -0
  83. package/dist/types/src/relations.test.d.ts +2 -0
  84. package/dist/types/src/relations.test.d.ts.map +1 -0
  85. package/dist/types/src/rules.d.ts +30 -0
  86. package/dist/types/src/rules.d.ts.map +1 -0
  87. package/dist/types/src/scene.d.ts +99 -65
  88. package/dist/types/src/scene.d.ts.map +1 -1
  89. package/dist/types/src/score.d.ts +54 -0
  90. package/dist/types/src/score.d.ts.map +1 -0
  91. package/dist/types/src/score.test.d.ts +2 -0
  92. package/dist/types/src/score.test.d.ts.map +1 -0
  93. package/dist/types/src/semantic-engine.d.ts +41 -0
  94. package/dist/types/src/semantic-engine.d.ts.map +1 -0
  95. package/dist/types/src/semantic-engine.test.d.ts +2 -0
  96. package/dist/types/src/semantic-engine.test.d.ts.map +1 -0
  97. package/dist/types/src/semantic-place.d.ts +81 -0
  98. package/dist/types/src/semantic-place.d.ts.map +1 -0
  99. package/dist/types/src/semantic-route.d.ts +133 -0
  100. package/dist/types/src/semantic-route.d.ts.map +1 -0
  101. package/dist/types/src/semantic.d.ts +164 -0
  102. package/dist/types/src/semantic.d.ts.map +1 -0
  103. package/dist/types/src/uml-grid.d.ts.map +1 -1
  104. package/dist/types/src/uml.d.ts +3 -5
  105. package/dist/types/src/uml.d.ts.map +1 -1
  106. package/dist/types/src/view.d.ts +53 -0
  107. package/dist/types/src/view.d.ts.map +1 -0
  108. package/dist/types/src/view.test.d.ts +2 -0
  109. package/dist/types/src/view.test.d.ts.map +1 -0
  110. package/dist/types/tsconfig.tsbuildinfo +1 -1
  111. package/package.json +23 -5
  112. package/rules/DIAGRAM.mdl +388 -0
  113. package/src/aesthetics.test.ts +89 -0
  114. package/src/aesthetics.ts +148 -0
  115. package/src/appeal.test.ts +144 -0
  116. package/src/appeal.ts +586 -0
  117. package/src/architecture.test.ts +94 -0
  118. package/src/architecture.ts +215 -0
  119. package/src/compact.test.ts +67 -0
  120. package/src/compact.ts +219 -0
  121. package/src/diagnostics.test.ts +207 -1
  122. package/src/diagnostics.ts +481 -37
  123. package/src/dsl/cli.ts +46 -0
  124. package/src/dsl/compile.ts +28 -0
  125. package/src/dsl/convert.test.ts +51 -0
  126. package/src/dsl/convert.ts +98 -0
  127. package/src/dsl/diagram.grammar +195 -0
  128. package/src/dsl/dsl.test.ts +286 -0
  129. package/src/dsl/gen/diagram.ts +22 -0
  130. package/src/dsl/index.ts +44 -0
  131. package/src/dsl/parse.ts +1054 -0
  132. package/src/dsl/print.ts +198 -0
  133. package/src/dsl/semantic.test.ts +200 -0
  134. package/src/dsl/vocabulary.ts +150 -0
  135. package/src/dx-svg.test.ts +44 -0
  136. package/src/dx-svg.ts +77 -0
  137. package/src/extension/complete.ts +105 -0
  138. package/src/extension/extension.test.ts +135 -0
  139. package/src/extension/highlight.ts +23 -0
  140. package/src/extension/index.ts +9 -0
  141. package/src/extension/language.ts +31 -0
  142. package/src/extension/lint.ts +60 -0
  143. package/src/extension/syntax.ts +62 -0
  144. package/src/index.ts +14 -0
  145. package/src/mermaid-engine.test.ts +6 -6
  146. package/src/mermaid-engine.ts +569 -119
  147. package/src/mermaid.test.ts +17 -1
  148. package/src/mermaid.ts +30 -18
  149. package/src/nudge.test.ts +155 -0
  150. package/src/nudge.ts +385 -0
  151. package/src/objective.test.ts +2 -0
  152. package/src/objective.ts +17 -1
  153. package/src/ortho-router.ts +240 -80
  154. package/src/ports.test.ts +157 -0
  155. package/src/ports.ts +186 -0
  156. package/src/relations.test.ts +98 -0
  157. package/src/rules.ts +117 -0
  158. package/src/scene.ts +64 -3
  159. package/src/score.test.ts +64 -0
  160. package/src/score.ts +130 -0
  161. package/src/semantic-engine.test.ts +635 -0
  162. package/src/semantic-engine.ts +888 -0
  163. package/src/semantic-place.ts +1508 -0
  164. package/src/semantic-route.ts +1136 -0
  165. package/src/semantic.ts +278 -0
  166. package/src/typings.d.ts +8 -0
  167. package/src/uml-grid.ts +6 -1
  168. package/src/uml.test.ts +5 -1
  169. package/src/uml.ts +24 -11
  170. package/src/view.test.ts +139 -0
  171. package/src/view.ts +376 -0
@@ -0,0 +1,61 @@
1
+ /** Element kinds as the DSL spells them; each is also the scene element's `kind`. */
2
+ export declare const ELEMENT_KINDS: readonly ["rect", "ellipse", "diamond", "triangle", "circle", "line", "curve", "arc", "text", "arrow", "portal"];
3
+ export type ElementKind = (typeof ELEMENT_KINDS)[number];
4
+ /** Statements that state intent and leave layout to the engine. */
5
+ export declare const SEMANTIC_KEYWORDS: readonly ['diagram', 'group', 'node', 'edge'];
6
+ /** Statement keywords. */
7
+ export declare const STATEMENT_KEYWORDS: readonly ["object", "elements", "move", "remove", "diagram", "group", "node", "edge"];
8
+ /** Keywords inside semantic statements: `@cell(c,r)`, `via …`, `bus`, `compact`. */
9
+ export declare const CLAUSE_KEYWORDS: readonly ['cell', 'via', 'bus', 'compact'];
10
+ /**
11
+ * Words the grammar reserves, so the printer knows to quote an id that collides with one.
12
+ * `_` is reserved too: it is the unbound arrow end.
13
+ */
14
+ export declare const RESERVED: ReadonlySet<string>;
15
+ /** Attribute value shapes; `enum` carries the literals the schema allows, `size` is `WxH`, `ratio` is `W:H`. */
16
+ export type AttrType = {
17
+ type: 'number';
18
+ } | {
19
+ type: 'string';
20
+ } | {
21
+ type: 'boolean';
22
+ } | {
23
+ type: 'size';
24
+ } | {
25
+ type: 'ratio';
26
+ } | {
27
+ type: 'enum';
28
+ values: readonly string[];
29
+ };
30
+ export type AttrSpec = AttrType & {
31
+ name: string;
32
+ };
33
+ /**
34
+ * Attributes each element kind accepts, in the order they print. Geometry and the label are
35
+ * positional, so the schema's `x`/`y`/`w`/`h`/`points`/`text` do not appear here — except
36
+ * `text`'s wrap width, which the schema also calls `w`.
37
+ */
38
+ export declare const ELEMENT_ATTRS: Record<ElementKind, readonly AttrSpec[]>;
39
+ /** Object attributes other than `@ <origin>`, in the order they print. */
40
+ export declare const OBJECT_ATTRS: readonly AttrSpec[];
41
+ /** `diagram` attributes. */
42
+ export declare const DIAGRAM_ATTRS: readonly AttrSpec[];
43
+ /** `group` attributes. */
44
+ export declare const GROUP_ATTRS: readonly AttrSpec[];
45
+ /** `node` attributes. */
46
+ export declare const NODE_ATTRS: readonly AttrSpec[];
47
+ /** `edge` attributes. */
48
+ export declare const EDGE_ATTRS: readonly AttrSpec[];
49
+ /** Placement relations a `node` or `group` may state; `~` before one makes it a preference. */
50
+ export declare const RELATION_WORDS: readonly string[];
51
+ /** An id that needs no quoting: a bare word that is not reserved. */
52
+ export declare const BARE_ID: RegExp;
53
+ /** A ref that needs no quoting: every segment is a bare word. */
54
+ export declare const BARE_REF: RegExp;
55
+ /**
56
+ * A structurally valid ref — `[object/]element[#port]`, as `Scene.parseRef` reads it, whose ids may
57
+ * not contain `/` or `#`. Separate from {@link BARE_REF} because quoting exists to carry a ref
58
+ * whose ids cannot lex bare (`1st/box` from a numeric node id), which is well-formed all the same.
59
+ */
60
+ export declare const REF_SHAPE: RegExp;
61
+ //# sourceMappingURL=vocabulary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary.d.ts","sourceRoot":"","sources":["../../../../src/dsl/vocabulary.ts"],"names":[],"mappings":"AAeA,qFAAqF;AACrF,eAAO,MAAM,aAAa,kHAShB,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C,CAAC;AAEF,yBAAyB;AACzB,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAKzC,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAA4B,CAAC;AAEzE,qEAAqE;AACrE,eAAO,MAAM,OAAO,QAA8B,CAAC;AAEnD,iEAAiE;AACjE,eAAO,MAAM,QAAQ,QAAqF,CAAC;AAE3G;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAkC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** The container format; versions the slot and encoding, not the payload, which versions itself. */
2
+ export declare const FORMAT = "org.dxos.dx-svg@1";
3
+ /** Embeds a payload in a standalone SVG: a marker on the root and the payload as its first child. */
4
+ export declare const embed: (svg: string, payload: unknown) => string;
5
+ /** Whether an SVG carries a payload, without parsing it. */
6
+ export declare const isDxSvg: (svg: string) => boolean;
7
+ /**
8
+ * The payload of a `.dx.svg`, or undefined for a plain SVG. Works on the text alone, so it runs in node,
9
+ * workers and the browser. An encoding this version does not know is an error, not a missing payload.
10
+ */
11
+ export declare const extract: (svg: string) => unknown;
12
+ //# sourceMappingURL=dx-svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dx-svg.d.ts","sourceRoot":"","sources":["../../../src/dx-svg.ts"],"names":[],"mappings":"AAYA,oGAAoG;AACpG,eAAO,MAAM,MAAM,sBAAsB,CAAC;AA+B1C,qGAAqG;AACrG,eAAO,MAAM,KAAK,QAAS,MAAM,WAAW,OAAO,KAAG,MAWrD,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,OAAwD,CAAC;AAE/F;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,OAWrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dx-svg.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dx-svg.test.d.ts","sourceRoot":"","sources":["../../../src/dx-svg.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ export declare const diagramComplete: Extension;
3
+ //# sourceMappingURL=complete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../../src/extension/complete.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAkGnD,eAAO,MAAM,eAAe,EAAE,SAAkD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extension.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.test.d.ts","sourceRoot":"","sources":["../../../../src/extension/extension.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { HighlightStyle } from '@codemirror/language';
2
+ /**
3
+ * Fills the gaps the editor's own highlight style leaves. The grammar emits standard
4
+ * `@lezer/highlight` tags, so most of a document is coloured by whatever style the theme installs
5
+ * and inherits its palette — but `vscodeLightStyle`/`vscodeDarkStyle` define neither
6
+ * `attributeValue` nor `null`, which in this language are the enum values (`grey`, `dashed`,
7
+ * `triangle`) and the unbound arrow end. Those are the most scannable part of a diagram, so
8
+ * leaving them uncoloured is the one thing worth overriding.
9
+ *
10
+ * Classes are semantic theme tokens rather than hues, as in `mermaidHighlightStyle`, so light and
11
+ * dark follow the palette.
12
+ */
13
+ export declare const diagramHighlightStyle: () => HighlightStyle;
14
+ //# sourceMappingURL=highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["../../../../src/extension/highlight.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,sBAI9B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { diagram, diagramBlockDescription } from './language.ts';
2
+ export { type LintOptions, diagramDiagnostics, diagramLint } from './lint.ts';
3
+ export { diagramComplete } from './complete.ts';
4
+ export { diagramHighlightStyle } from './highlight.ts';
5
+ export { diagramLanguage } from './syntax.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extension/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,KAAK,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { LanguageDescription } from '@codemirror/language';
2
+ import { type Extension } from '@codemirror/state';
3
+ import { type LintOptions } from './lint.ts';
4
+ /**
5
+ * The fence dispatch point. Pass this alongside deus's `mdlBlockDescription` in
6
+ * `createMarkdownExtensions({ codeLanguages: [...] })` and a ```diagram block inside a `.mdl`
7
+ * document parses with the diagram grammar — a sibling of MDL's, not a nesting inside it. See
8
+ * `docs/DSL.md`.
9
+ */
10
+ export declare const diagramBlockDescription: LanguageDescription;
11
+ /** The whole editing surface for a standalone DSL buffer: mode, highlighting, completion, lint. */
12
+ export declare const diagram: (options?: LintOptions) => Extension;
13
+ //# sourceMappingURL=language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../src/extension/language.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAuC,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,OAAO,EAAE,KAAK,WAAW,EAAe,MAAM,WAAW,CAAC;AAG1D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,qBAIlC,CAAC;AAEH,mGAAmG;AACnG,eAAO,MAAM,OAAO,aAAa,WAAW,KAAQ,SAKnD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type Diagnostic } from '@codemirror/lint';
2
+ import { type Extension } from '@codemirror/state';
3
+ export type LintOptions = {
4
+ /**
5
+ * Also report the layout diagnostics — overlaps, a connector through a node, a label that does
6
+ * not fit. Off by default because a document being typed is briefly nonsense; the bench and the
7
+ * agent loop both want it on.
8
+ */
9
+ layout?: boolean;
10
+ };
11
+ /**
12
+ * What is wrong with a document: everything `parse` found, and optionally everything
13
+ * `Diagnostics.analyze` finds in the scene it produced, each carrying the range of the statement
14
+ * or element that produced it — a layout error is only actionable when it points at the box it is
15
+ * about. Separate from the CodeMirror wrapper so it needs no editor, which is also how the
16
+ * agent-facing path reports the same problems.
17
+ */
18
+ export declare const diagramDiagnostics: (text: string, { layout }?: LintOptions) => Diagnostic[];
19
+ /** The CodeMirror linter over {@link diagramDiagnostics}. */
20
+ export declare const diagramLint: (options?: LintOptions) => Extension;
21
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../../../src/extension/lint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAU,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnD,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,SAAU,MAAM,eAAsB,WAAW,KAAQ,UAAU,EA4BjG,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,WAAW,aAAa,WAAW,KAAQ,SAC4C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { LRLanguage } from '@codemirror/language';
2
+ export declare const diagramLanguage: LRLanguage;
3
+ //# sourceMappingURL=syntax.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../../../../src/extension/syntax.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYlD,eAAO,MAAM,eAAe,YA6C1B,CAAC"}
@@ -1,11 +1,24 @@
1
1
  export * from './content.ts';
2
2
  export * from './dialect.ts';
3
+ export * as Aesthetics from './aesthetics.ts';
4
+ export * as Appeal from './appeal.ts';
5
+ export * as Architecture from './architecture.ts';
3
6
  export * as Diagnostics from './diagnostics.ts';
7
+ export * as Dsl from './dsl/index.ts';
8
+ export * as DxSvg from './dx-svg.ts';
4
9
  export * as Layout from './layout.ts';
5
10
  export * as Mermaid from './mermaid.ts';
6
11
  export * as MermaidEngine from './mermaid-engine.ts';
12
+ export * as Nudge from './nudge.ts';
7
13
  export * as Objective from './objective.ts';
14
+ export * as Ports from './ports.ts';
15
+ export * as Rules from './rules.ts';
8
16
  export * as Scene from './scene.ts';
17
+ export * as Semantic from './semantic.ts';
18
+ export * as SemanticEngine from './semantic-engine.ts';
19
+ export * as SemanticPlace from './semantic-place.ts';
20
+ export * as SemanticRoute from './semantic-route.ts';
21
+ export * as Score from './score.ts';
9
22
  export * from './svg-handler.ts';
10
23
  export * as Ui from './ui.ts';
11
24
  export * as Uml from './uml.ts';
@@ -13,4 +26,5 @@ export * as UmlEngine from './uml-engine.ts';
13
26
  export * as UmlGrid from './uml-grid.ts';
14
27
  export * as UmlRules from './uml-rules.ts';
15
28
  export * as UmlSearch from './uml-search.ts';
29
+ export * as View from './view.ts';
16
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,WAAW,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AAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as Objective from './objective.ts';
2
2
  import type * as Scene from './scene.ts';
3
- import { type Router } from './uml-grid.ts';
3
+ import { type Rect, type Router } from './uml-grid.ts';
4
4
  /** How ELK orders siblings within a layer. */
5
5
  export type Order = 'model' | 'free';
6
6
  /**
@@ -48,12 +48,24 @@ export type CompileOptions = {
48
48
  * connect through one horizontal bus and a single triangle-headed trunk instead of parallel arrows.
49
49
  */
50
50
  bus?: readonly boolean[];
51
+ /**
52
+ * Compaction candidates (default both): with `true`, packages and boxes slide toward their partners
53
+ * after placement, closing empty lanes and long detours; see `compact.ts`.
54
+ */
55
+ compact?: readonly boolean[];
51
56
  /** Objective that picks among candidates (default `Objective.DEFAULT`). */
52
57
  objective?: Objective.Objective;
53
58
  /** Maximum cell width, in scene units (default GRID × 6); longer labels wrap. */
54
59
  maxWidth?: number;
55
60
  /** Connector router (default: obstacle-avoiding A* with the Z-router as fallback). */
56
61
  route?: Router;
62
+ /**
63
+ * Routes one candidate, nearly all of the layout's time (default: on this thread); a caller with
64
+ * worker threads can run {@link emitJob} there. Each candidate is handed over as soon as it is
65
+ * placed, so placing the rest overlaps the routing; the candidates are still collected in
66
+ * generation order. Not used with a custom `route`, which cannot leave the thread.
67
+ */
68
+ emitCandidate?: (job: EmitJob) => Promise<Scene.Command[]>;
57
69
  };
58
70
  /** One generated layout with the objective's verdict on it. */
59
71
  export type Candidate = {
@@ -62,6 +74,7 @@ export type Candidate = {
62
74
  arrangement: Arrangement;
63
75
  layering: Layering;
64
76
  alignment: Alignment;
77
+ compact: boolean;
65
78
  bus: boolean;
66
79
  commands: Scene.Command[];
67
80
  layout: Objective.Layout;
@@ -72,6 +85,31 @@ export type Result = {
72
85
  /** Every candidate, best first. */
73
86
  ranked: readonly Objective.Ranked<Candidate>[];
74
87
  };
88
+ export type Cell = {
89
+ w: number;
90
+ h: number;
91
+ };
92
+ export type Placement = {
93
+ nodes: Map<string, Rect>;
94
+ frames: Map<string, Rect>;
95
+ };
96
+ type EmitOptions = {
97
+ origin: Scene.Point;
98
+ scale: number;
99
+ bus: boolean;
100
+ arrangement: Arrangement;
101
+ route?: Router;
102
+ /** Run the port local search; costly, so only for the layout already chosen. */
103
+ search?: boolean;
104
+ };
105
+ /** One candidate's routing, as structured-cloneable data so it can cross to a worker thread. */
106
+ export type EmitJob = Omit<EmitOptions, 'route'> & {
107
+ source: string;
108
+ cell: Cell;
109
+ placement: Placement;
110
+ };
111
+ /** Routes one candidate with the default router; what a worker runs for `CompileOptions.emitCandidate`. */
112
+ export declare const emitJob: ({ source, cell, placement, ...options }: EmitJob) => Scene.Command[];
75
113
  /**
76
114
  * Lay out a mermaid flowchart: place once per lattice × ordering, emit with and without the
77
115
  * inheritance bus, analyze every candidate, and let the objective choose. All candidates come back
@@ -80,4 +118,5 @@ export type Result = {
80
118
  export declare const layout: (source: string, options?: CompileOptions) => Promise<Result>;
81
119
  /** The chosen layout's scene commands; see {@link layout} for the candidates and verdicts. */
82
120
  export declare const compile: (source: string, options?: CompileOptions) => Promise<Scene.Command[]>;
121
+ export {};
83
122
  //# sourceMappingURL=mermaid-engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mermaid-engine.d.ts","sourceRoot":"","sources":["../../../src/mermaid-engine.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,EAAmB,KAAK,MAAM,EAAW,MAAM,eAAe,CAAC;AAsBtE,8CAA8C;AAC9C,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;AAE9C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAWzC,MAAM,MAAM,cAAc,GAAG;IAC3B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IACrB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACrC,wGAAwG;IACxG,KAAK,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;IACzB,yFAAyF;IACzF,WAAW,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACrC,qEAAqE;IACrE,QAAQ,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IAC/B,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACzB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC;IAChC,iFAAiF;IACjF,QAAQ,CAAC,EAA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AAC,OAAO,EACzC,CAAC;AAKhD;;;;GAIG;AACH,eAAO,MAAM,MAAM,WAAkB,MAAM,YAAW,cAAc,KAAQ,OAAO,CAAC,MAAM,CA+GzF,CAAC;AA8CF,8FAA8F;AAC9F,eAAO,MAAM,OAAO,WAAkB,MAAM,YAAW,cAAc,KAAQ,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAC1D,CAAC"}
@@ -14,7 +14,7 @@ export type MermaidGroup = {
14
14
  children: string[];
15
15
  };
16
16
  /** Relationship kind, from the edge token; drawn with the UML end markers in `markers`. */
17
- export type RelationKind = 'reference' | 'inheritance' | 'hasMany' | 'contains';
17
+ export type RelationKind = 'reference' | 'inheritance' | 'implements' | 'hasMany' | 'contains' | 'creates';
18
18
  export type MermaidEdge = {
19
19
  from: string;
20
20
  to: string;
@@ -28,8 +28,8 @@ export type MermaidEdge = {
28
28
  * lines are already comments.
29
29
  */
30
30
  export declare const toStandard: (source: string) => string;
31
- /** Scene arrow markers for a relationship kind. */
32
- export declare const markers: (kind: RelationKind) => Pick<Scene.Arrow, 'head' | 'tail'>;
31
+ /** The scene relation a relationship kind draws as, with the dash its line needs; a plain reference stays a plain arrow. */
32
+ export declare const markers: (kind: RelationKind) => Pick<Scene.Arrow, 'relation' | 'stroke'>;
33
33
  export type MermaidGraph = {
34
34
  direction: Direction;
35
35
  nodes: MermaidNode[];
@@ -1 +1 @@
1
- {"version":3,"file":"mermaid.d.ts","sourceRoot":"","sources":["../../../src/mermaid.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,GAAG,C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ACtF,eAAO,MAAM,KAAK,WAAY,MAAM,KAAG,YAwFtC,CAAC;AAgBF,MAAM,MAAM,cAAc,GAAG;IAC3B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IACrB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,OAAO,WAAY,MAAM,YAAW,cAAc,KAAQ,KAAK,CAAC,OAAO,EAiGnF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type * as Scene from './scene.ts';
2
+ import { type Rect } from './uml-grid.ts';
3
+ type Point = Scene.Point;
4
+ /** A routed connector: its orthogonal polyline and the boxes its ends are attached to. */
5
+ export type NudgePath = {
6
+ points: readonly Point[];
7
+ /** Box the first point sits on; without it the start port is never moved. */
8
+ source?: Rect;
9
+ /** Box the last point sits on; without it the end port is never moved. */
10
+ target?: Rect;
11
+ };
12
+ export type NudgeOptions = {
13
+ /** Gap between separated parallel runs (default 8). */
14
+ spacing?: number;
15
+ /** Boxes no run may be pushed through. */
16
+ obstacles?: readonly Rect[];
17
+ /** Lines that never move but that paths must not be pushed onto (e.g. an inheritance bus). */
18
+ fixed?: readonly (readonly Point[])[];
19
+ /** Minimum distance between a moved port and its box's corner (default `spacing`). */
20
+ margin?: number;
21
+ };
22
+ /**
23
+ * Nudging (Wybrow, Marriott & Stuckey 2010): distinct connectors that share a collinear run are
24
+ * pulled apart across it by `spacing`, ordered so their turn-offs do not cross, with ports sliding
25
+ * along their box side. Fixed lines (a deliberate bus) never move. Paths that need no change come
26
+ * back as given.
27
+ */
28
+ export declare const nudge: (paths: readonly NudgePath[], options?: NudgeOptions) => Point[][];
29
+ export {};
30
+ //# sourceMappingURL=nudge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge.d.ts","sourceRoot":"","sources":["../../../src/nudge.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;AAMzB,0FAA0F;AAC1F,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IACzB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,IAAI,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IAC5B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,KAAK,EAAE,CAAC,EAAE,CAAC;IACtC,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAmUF;;;;;GAKG;AACH,eAAO,MAAM,KAAK,UAAW,SAAS,SAAS,EAAE,YAAW,YAAY,KAAQ,KAAK,EAAE,EAwBtF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=nudge.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge.test.d.ts","sourceRoot":"","sources":["../../../src/nudge.test.ts"],"names":[],"mappings":""}
@@ -56,6 +56,10 @@ export declare const noHardDefects: Constraint;
56
56
  /** Containers keep at least `gap` between them, so packages read as separate. */
57
57
  export declare const framesApart: (gap?: number) => Constraint;
58
58
  export declare const crossings: CostTerm;
59
+ /** Labels overlapping other labels or boxes; as costly as a crossing, since either hides what the reader needs. */
60
+ export declare const textOverlaps: CostTerm;
61
+ /** Connector pairs sharing a stretch of line; as costly as a crossing, since the reader cannot pair their ends. */
62
+ export declare const edgeOverlaps: CostTerm;
59
63
  export declare const bends: CostTerm;
60
64
  /**
61
65
  * Uneven gutters between frames, in grid units. Weighted so a whole cell of unevenness costs about
@@ -1 +1 @@
1
- {"version":3,"file":"objective.d.ts","sourceRoot":"","sources":["../../../src/objective.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,KAAK,WAAW,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAGzC,uDAAuD;AACvD,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,EAAE,SAAS,KAAK,CAAC,WAAW,EAAE,CAAC;IACtC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;CAC5B,CAAC;AAEF,+FAA+F;AAC/F,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;CACnD,CAAC;AAEF,iGAAiG;AACjG,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IACnC,KAAK,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,SAAS;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,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AAC,CAAC,CAAC,CAAC;IAAC,MAAM,EAAE,SAAS,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;CAUnD,CAAC;AAOF,uGAAuG;AACvG,eAAO,MAAM,aAAa,EAAE,UAK3B,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,WAAW,SAAS,MAAM,KAAU,UAO/C,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,QAKvB,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,YAAY,EAAE,QAK1B,CAAC;AAEF,mHAAmH;AACnH,eAAO,MAAM,YAAY,EAAE,QAK1B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,QAKnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAK7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,QAK7B,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,WAAW,EAAE,QAKzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,SAGrB,CAAC"}
@@ -1,13 +1,25 @@
1
+ import type * as Scene from './scene.ts';
1
2
  import type { Rect, Router } from './uml-grid.ts';
3
+ type Point = Scene.Point;
2
4
  export type AvoidingRouterOptions = {
3
5
  /** Search-cell size (scene px): a fraction of the layout grid, so routes can hug node borders. */
4
6
  step: number;
5
7
  };
8
+ /** The avoiding router plus a way to replay an earlier route's footprint without searching again. */
9
+ export type AvoidingRouter = Router & {
10
+ /**
11
+ * Marks the cells of a path an avoiding router over the same obstacles returned before as used, as
12
+ * routing it did; a path that marked nothing (a fallback route) marks nothing, so a replayed prefix
13
+ * leaves the same state.
14
+ */
15
+ reserve: (points: readonly Point[]) => void;
16
+ };
6
17
  /**
7
18
  * Creates a router that avoids the given node rects. Stateful across edges: earlier routes
8
19
  * penalize (not block) the cells they occupy, spreading parallel runs apart. `fallback` handles
9
20
  * the (fenced-in) edges the search cannot reach. The step is passed in rather than derived from
10
21
  * `uml-grid`'s `GRID`, which keeps this module free of a value import cycle with the dialects.
11
22
  */
12
- export declare const makeAvoidingRouter: (obstacles: Rect[], fallback: Router, { step: STEP }: AvoidingRouterOptions) => Router;
23
+ export declare const makeAvoidingRouter: (obstacles: Rect[], fallback: Router, { step: STEP }: AvoidingRouterOptions) => AvoidingRouter;
24
+ export {};
13
25
  //# sourceMappingURL=ortho-router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ortho-router.d.ts","sourceRoot":"","sources":["../../../src/ortho-router.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,EAAE,MAAM,eAAe,CAAC;AAiBlE,MAAM,MAAM,qBAAqB,GAAG;IAClC,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,cAClB,IAAI,EAAE,YACP,MAAM,kBACA,qBAAqB,KACpC,MAuUF,CAAC"}
1
+ {"version":3,"file":"ortho-router.d.ts","sourceRoot":"","sources":["../../../src/ortho-router.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,EAAE,MAAM,eAAe,CAAC;AAWlE,KAAK,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;AAgFzB,MAAM,MAAM,qBAAqB,GAAG;IAClC,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAKF,qGAAqG;AACrG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC;;;;OAIG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,KAAK,IAAI,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,cAClB,IAAI,EAAE,YACP,MAAM,kBACA,qBAAqB,KACpC,cAgZF,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type * as Scene from './scene.ts';
2
+ import { type Rect } from './uml-grid.ts';
3
+ type Point = Scene.Point;
4
+ export type Side = 'top' | 'bottom' | 'left' | 'right';
5
+ /** A routed connector with the boxes its ends sit on. */
6
+ export type PortPath = {
7
+ points: readonly Point[];
8
+ source: Rect;
9
+ target: Rect;
10
+ /** Ends whose coordinate must not move (a straightened edge, or a face the router picked itself). */
11
+ fixed?: {
12
+ start?: boolean;
13
+ end?: boolean;
14
+ };
15
+ };
16
+ /** New coordinates along the side for the ends that moved; an absent end keeps its place. */
17
+ export type Assigned = {
18
+ start?: number;
19
+ end?: number;
20
+ };
21
+ export type AssignOptions = {
22
+ /** Slot spacing and minimum distance from a box corner. */
23
+ step: number;
24
+ };
25
+ /** The side of `rect` that `point` sits on, if any. */
26
+ export declare const sideOf: (point: Point, rect: Rect) => Side | undefined;
27
+ /**
28
+ * Sort key of a terminal along its side, from its route read outward: a route turning toward the
29
+ * side's high end belongs at the high end, and of two turning the same way the one that runs out
30
+ * farther before turning sits nearer the low end, so neither turn-off cuts the other's stub.
31
+ */
32
+ export declare const keyOf: (outward: readonly Point[], side: Side) => number;
33
+ /**
34
+ * Reorders the ports on every box side so they follow their routes' key order, moving only the
35
+ * sides whose current order disagrees with it. Fixed terminals stay where they are and the free
36
+ * ones take slots on the `step` lattice in the gaps between them, at least `step` from a corner.
37
+ */
38
+ export declare const assign: (paths: readonly PortPath[], { step }: AssignOptions) => Assigned[];
39
+ export {};
40
+ //# sourceMappingURL=ports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../../src/ports.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,KAAK,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;AAEzB,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvD,yDAAyD;AACzD,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IACzB,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;IACb,qGAAqG;IACrG,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC5C,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,MAAM,aAAa,GAAG;IAC1B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAOF,uDAAuD;AACvD,eAAO,MAAM,MAAM,UAAW,KAAK,QAAQ,IAAI,KAAG,IAAI,GAAG,SAgBxD,CAAC;AAKF;;;;GAIG;AACH,eAAO,MAAM,KAAK,YAAa,SAAS,KAAK,EAAE,QAAQ,IAAI,KAAG,MAU7D,CAAC;AA8BF;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAAW,SAAS,QAAQ,EAAE,YAAY,aAAa,KAAG,QAAQ,EAyEpF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ports.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ports.test.d.ts","sourceRoot":"","sources":["../../../src/ports.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=relations.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.test.d.ts","sourceRoot":"","sources":["../../../src/relations.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ export type Evaluator = 'code' | 'vision' | 'both';
2
+ export type Category = 'crossings' | 'flow' | 'alignment' | 'space' | 'groups' | 'labels' | 'edges' | 'hierarchy';
3
+ export type DiagramRule = {
4
+ /** Kebab-case id; `Appeal`'s evaluators and the image judge's decision keys are derived from it. */
5
+ readonly id: string;
6
+ /** What a good diagram does, in one line. */
7
+ readonly title: string;
8
+ readonly category: Category;
9
+ readonly evaluator: Evaluator;
10
+ /** Relative importance in the overall appeal score; the research ranks crossings far above the rest. */
11
+ readonly weight: number;
12
+ /** The yes/no question a vision judge answers; `yes` means the drawing follows the rule. */
13
+ readonly question?: string;
14
+ readonly criteria?: {
15
+ readonly true: string;
16
+ readonly false: string;
17
+ };
18
+ /** Rationale, the evidence behind the rule, and what does not count against it. */
19
+ readonly prose: string;
20
+ };
21
+ /**
22
+ * Parses the `diagram-rule` blocks of an `.mdl` document, ignoring every other block. A malformed rule
23
+ * throws, naming it, since a rule that silently drops out would leave its evaluator unbound.
24
+ */
25
+ export declare const parse: (document: string) => DiagramRule[];
26
+ /** Every rule in `rules/DIAGRAM.mdl`. */
27
+ export declare const RULES: readonly DiagramRule[];
28
+ /** The camelCase decision key a judge answers a rule under. */
29
+ export declare const keyOf: (id: string) => string;
30
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/rules.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEnD,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAC;AAElH,MAAM,MAAM,WAAW,GAAG;IACxB,oGAAoG;IACpG,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,wGAAwG;IACxG,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAqCF;;;GAGG;AACH,eAAO,MAAM,KAAK,aAAc,MAAM,KAAG,WAAW,EAqChD,CAAC;AAEL,yCAAyC;AACzC,eAAO,MAAM,KAAK,EAAE,SAAS,WAAW,EAAgB,CAAC;AAEzD,+DAA+D;AAC/D,eAAO,MAAM,KAAK,OAAQ,MAAM,KAAG,MAAiF,CAAC"}